Article View: comp.text.tex
Article #10944Re: Disabling the underscore character
From: Peter Schmitt
Date: Tue, 05 Jan 1993 18:43
Date: Tue, 05 Jan 1993 18:43
25 lines
1130 bytes
1130 bytes
>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.
>\def\foo#1{ {\tt #1} }
>\foo{file_name.ext}
>I tried defining foo as follows:
>\def\foo#1{ {\catcode`_=12 {\tt #1} } }
This is a very common error: The catcode is already fixed when the
argument is passed!
>{\catcode`_=12 \foo{file_name.ext} }
>Is there a way of avoiding this and doing everything
>inside the macro?
Sure: Use a macro to call \foo:
e.g.: \def \Foo{\bgroup\catcode`\_=12\foo}
and add a \egroup to the end of \foo
Peter
Technical Details
Message-ID:
<1993Jan5.184943.3979@newssrv.edvz.univie.ac.at>Path:
arc1-ca.pugleaf.net!sparky!uunet!news.univie.ac.at!vm.univie.ac.at!A8131DALShow Full Headers
Complete Article Headers
Newsgroups: comp.text.tex Path: arc1-ca.pugleaf.net!sparky!uunet!news.univie.ac.at!vm.univie.ac.at!A8131DAL From: A8131DAL@vm.univie.ac.at (Peter Schmitt) Subject: Re: Disabling the underscore character Message-ID: <1993Jan5.184943.3979@newssrv.edvz.univie.ac.at> Sender: news@newssrv.edvz.univie.ac.at (News System - Vienna University) Nntp-Posting-Host: helios.edvz.univie.ac.at Organization: University of Vienna Date: Tue, 5 Jan 1993 18:43:24 GMT Lines: 26