[texhax] EXTERNAL: Aw: Use of \symbol{`\_} versus \symbol{'137} to produce\verb+_+ in moving arguments.

Beuthe, Thomas thomas.beuthe at cnl.ca
Tue Mar 3 02:03:33 CET 2015


>> Since \verb cannot be used in moving arguments like \chapter and \section
>BTW, \verb's catcode changing, especially for backslash and underscore, 
>fails in *any* macro argument (even "stationary"), e.g., \texttt{\verb+_+}.
>The package cprotect
>    http://ctan.org/pkg/cprotect
>seems to help with the situation.

Great suggestion, thanks!

I should also add that some replies have questioned the need to include
contents in tt mode in a section heading, but if you consider that the
report I am working on documents a set of computer code procedures,
I hope it begins to make more sense.  The names of the procedures are
included in the section headings, and of course I want to include them
in tt mode.  These name also potentially include underscores.

Give this (potentially) common situation, it might be good to consider
making it easier to include tt mode content containing "odd" characters
like underscore in future versions of LaTeX.  I have heard other discussions
along these lines, so I'm probably not the first to bring this up.


More information about the texhax mailing list