# Is it \catcode or \catcode?

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?

-

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:

\catcodeA=\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.,

\numberA


will typeset ‘65’.

-
Beat me to it by moments, Will. Just to add, this is described in the TeXbook, page 44. – Lev Bishop Sep 21 '10 at 1:59
Feel free to fix up any of my clunky statements. My explaining-brain feels like mush today. – Will Robertson Sep 21 '10 at 2:23
I guess it should read \catcode'A=\active in 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 7:45
Oh yes, that was quoted incorrectly. Thanks for spotting the error. – Will Robertson Sep 21 '10 at 11:30
Thanks for that informative explanation. To recap: in situations where TeX is looking for a number, it will interpret ` as "the character code of the next character". You have to admit, sometimes it's hard to navigate the TeXbook! – Brandon Kuczenski Sep 21 '10 at 21:08