












The actual and more elegant solution for my problem with verbatim text in argument position decribed in the previous post is much simpler. Since the underscore “_” is the only nasty character which does not allow me to write things like “NA071112-01_E.008” as an argument of my \ru command the best solution for me is to assign the underscore another catcode (thanks to Enrico Gregorio). This simply achieved by …
\catcode`\_=12
… in the preamble. Thereby the underscore looses its subscript function (category code 8) and is treated like any other puctuation character (category code 12).
As a linguist I do not need the underscore as a shortcut for subscript in math mode. If I want, I can still do it by “\sb” instead of the “_”. (\sb is actually short enough.)
I then can define my \ru just like this:
\providecommand{\ru}[1]{#1}
(I may want to fill it with additional commands later.)
I get the feeling that changing the category code of certain special characters may be the most accessible (if not the only) way of accepting verbatim text as an argument of a command.
This whole thing around my \ru command motivates me to go through some introduction to TeX. Very nice explanation of catcodes and their purpose I found in Eijkhout’s TeX by Topic on p. 29.
D. E. Knuth certainly was a smart guy.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。