惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
The GitHub Blog
The GitHub Blog
小众软件
小众软件
美团技术团队
博客园 - 司徒正美
G
Google Developers Blog
Blog — PlanetScale
Blog — PlanetScale
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
大猫的无限游戏
大猫的无限游戏
罗磊的独立博客
Recent Announcements
Recent Announcements
酷 壳 – CoolShell
酷 壳 – CoolShell
D
Docker
J
Java Code Geeks
Last Week in AI
Last Week in AI
V
Visual Studio Blog
Microsoft Azure Blog
Microsoft Azure Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Proofpoint News Feed
V
V2EX
C
Check Point Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
MyScale Blog
MyScale Blog

XeTeX and LaTeX

Author per chapter (a.k.a. Proceedings) Subscript and superscript in text mode Typesetting tilde or backslash Phantomas command First gloss line in italics (gb4e) Table lines starting with square bracket Filetype recognition in Vim Vim for XeTeX/LaTeX First word of a paragraph Tables Block comment Line spacing in tables Verbatim text as command argument Newcommand with an optional argument LaTeX’s new era started: XeTeX
Assign another catcode
noreply@blogger.com (Anonymous) · 2008-03-05 · via XeTeX and LaTeX

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.