[texhax] Passing Underscore

Uwe Lück uwe.lueck at web.de
Tue Sep 19 07:24:37 CEST 2006

At 01:46 19.09.06, Philip TAYLOR wrote:

>Peter Abbott wrote:
>  > I have file names containing the _ (underscore) character and need to
>  > pass the _ into a macro as part of a file name. \_ inserts protect 
> command etc.
>  >
>  > Can I declare it as a 'normal' character?
>You can, but then something else wanting it to have
>its canonical catcode would get confused.  I suggest
>you hide the underscore in a control sequence, where
>it can lose its pathological catcode without causing
>problems :
>\documentclass {article{
>\begin {document}
>\def \noescape {}
>\edef \fileone {\expandafter \expandafter \expandafter \noescape 
>\expandafter \string \csname file_one\endcsname}
>\include \fileone
>\end {document}
>This will happily \include a file called "file_one" without problems.

What puzzles me here: I once encountered the problem many years ago.
But in the recent year, I had no trouble at all with an underscore in the
argument of \include (e.g.: \include{hsgraz_1}). (Difference \include/\input?)



More information about the texhax mailing list