I've noticed that \catcode is poorly documented in the TeXbook. The primitive is defined as \catcode but every time it is used, it is used as \catcode` ... the backquote is never discussed. ` itself is not active (right?) so I don't understand its function. Is it required for \catcode to work properly?
Asked
Active
Viewed 1.1k times
69
Werner
- 603,163
Brandon Kuczenski
- 1,718
1 Answers
83
The backquote notation is discussed in the TeXbook, page 44.
\catcode takes as its first argument the character code of the character you want to change the catcode of. For example,
\catcode65=\active
will make ‘A’ an active character.
Instead of inserting the number ‘65’ directly, TeX allows the character code of a character to be inserted with the backtick notation you're referring to:
\catcode`A=\active
You need to escape the character if it happens to have a special catcode, though: `\%, for instance.
This backtick notation can be used wherever TeX expects a number. E.g.,
\number`A
will typeset ‘65’.
Will Robertson
- 73,872
\catcode'A=\activein your example (of course with a backtick; don't know how to put a backtick into the middle of a code sample.) – Hendrik Vogt Sep 21 '10 at 07:45