TeX category code
= TeX category code
{c}
{title2=`\catcode`}
A \b[TeX category code] tells the <TeX input processor> how to treat an input character syntactically. Categories include escape 0, beginning-group 1, ending-group 2, letter 11, other 12 and active 13. The usual backslash and brace conventions are assignments of these categories, rather than immutable properties of the printed characters.<TeX by Topic by Victor Eijkhout>[§2.3: category codes; §2.4: conversion to tokens]{ref}
For example, suppose `a` initially has category 11. Defining `\def\demo{a}` stores that character token. The assignment `\catcode 97=12` changes how a subsequently read character with code 97 is classified. It does not change the earlier character token inside `\demo`. The example assumes the ordinary character-code mapping for `a` and leaves the letters of `demo` unchanged.
The distinction matters for reusable <TeX macros>: a definition can preserve syntax that would be read differently under later category assignments. It also explains how changing letter categories can alter the scanning of a <TeX control word> without changing the visible spelling of the source.