A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

{catcodes} is about "category codes" — an integer number from 0–15 associated to each of the 256 character codes. The category codes indicate the role of a character.

is about "category codes" — an integer number from 0–15 associated to each of the 256 character codes. The category codes indicate the role of a character.

The following is a list of the sixteen category codes and the Plain TeX settings:

  • 0 = Escape character; this signals the start of a control sequence. IniTeX makes the backslash \ (code 92) an escape character.

  • 1 = Beginning of group; such a character causes TeX to enter a new level of grouping. The plain format makes the open brace { a beginning-of-group character.

  • 2 = End of group; TeX closes the current level of grouping. Plain TeX has the closing brace }as end-of-group character.

  • 3 = Math shift; this is the opening and closing delimiter for math formulas. Plain TeX uses the dollar sign $ for this.

  • 4 = Alignment tab; the column (row) separator in tables made with \halign (\valign). In Plain TeX this is the ampersand &.

  • 5 = End of line; a character that TeX considers to signal the end of an input line. IniTeX assigns this code to the return, that is, code 13. Not coincidentally, 13 is also the value that IniTeX assigns to the \endlinechar parameter.

  • 6 = Parameter character; this indicates parameters for macros. In plain TeX this is the hash sign #.

  • 7 = Superscript; this precedes superscript expressions in math mode. It is also used to denote character codes that cannot be entered in an input file; see below. In Plain TeX this is the circumflex ^.

  • 8 = Subscript; this precedes subscript expressions in math mode. In plain TeX the underscore _ is used for this.

  • 9 = Ignored; characters of this category are removed from the input, and have therefore no influence on further TeX processing. In Plain TeX this is the null character, that is, code 0.

  • 10 = Space; space characters receive special treatment. IniTeX assigns this category to the ASCII space character, code 32.

  • 11 = Letter; in IniTeX only the characters a..z, A..Z are in this category. Often, macro packages make some ‘secret’ character (for instance @) into a letter.

  • 12 = Other; IniTeX puts everything that is not in the other categories into this category. Thus it includes, for instance, digits and punctuation.

  • 13 = Active; active characters function as a TeX command, without being preceded by an escape character. In Plain TeX this is only the tie character ~, which is defined to produce an unbreakable space.

  • 14 = Comment character; from a comment character onwards, TeX considers the rest of an input line to be comment and ignores it. In IniTeX the percent sign % is made a comment character.

  • 15 = Invalid character; this category is for characters that should not appear in the input. IniTeX assigns the ASCII delete character, code 127, to this category.

The user can change the mapping of character codes to category codes with the \catcode command.

history | excerpt history