home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!ames!agate!gazpacho.Berkeley.EDU!mtr
- From: mtr@gazpacho.Berkeley.EDU (MT Raghunath)
- Newsgroups: comp.text.tex
- Subject: Disabling the underscore character
- Date: 30 Dec 1992 21:40:02 GMT
- Organization: University of California, Berkeley
- Lines: 27
- Distribution: world
- Message-ID: <1ht4viINNnaj@agate.berkeley.edu>
- NNTP-Posting-Host: gazpacho.berkeley.edu
-
- I am trying to write a tex macro that needs to print a
- file name as part of what it does. The macro does not
- work if the file name has an underscore character in it,
- since it interprets the underscore as the subscript
- character and starts inserting $ signs.
-
- The crux of what I am trying to do is:
-
- \def\foo#1{ {\tt #1} }
-
- \foo{file_name.ext}
-
- I tried defining foo as follows:
-
- \def\foo#1{ {\catcode`_=12 {\tt #1} } }
-
- but that does not work either. I tried many different
- variations without any success. It appears that I have
- to do the catcode stuff when I invoke foo:
-
- {\catcode`_=12 \foo{file_name.ext} }
-
- Is there a way of avoiding this and doing everything
- inside the macro?
-
- Thanks,
- mtr
-