home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / text / tex / 14533 < prev    next >
Encoding:
Internet Message Format  |  1992-12-30  |  1.1 KB

  1. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!ames!agate!gazpacho.Berkeley.EDU!mtr
  2. From: mtr@gazpacho.Berkeley.EDU (MT Raghunath)
  3. Newsgroups: comp.text.tex
  4. Subject: Disabling the underscore character
  5. Date: 30 Dec 1992 21:40:02 GMT
  6. Organization: University of California, Berkeley
  7. Lines: 27
  8. Distribution: world
  9. Message-ID: <1ht4viINNnaj@agate.berkeley.edu>
  10. NNTP-Posting-Host: gazpacho.berkeley.edu
  11.  
  12. I am trying to write a tex macro that needs to print a
  13. file name as part of what it does.  The macro does not
  14. work if the file name has an underscore character in it,
  15. since it interprets the underscore as the subscript
  16. character and starts inserting $ signs.
  17.  
  18. The crux of what I am trying to do is:
  19.  
  20. \def\foo#1{ {\tt #1} }
  21.  
  22. \foo{file_name.ext}
  23.  
  24. I tried defining foo as follows:
  25.  
  26. \def\foo#1{ {\catcode`_=12 {\tt #1} } }
  27.  
  28. but that does not work either.  I tried many different
  29. variations without any success.  It appears that I have
  30. to do the catcode stuff when I invoke foo:
  31.  
  32. {\catcode`_=12 \foo{file_name.ext} }
  33.  
  34. Is there a way of avoiding this and doing everything
  35. inside the macro?
  36.  
  37. Thanks,
  38. mtr
  39.