TeX category code 2026-11-05
A 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.[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.
TeX control sequence 2026-11-05
A TeX control sequence is a named command represented by a command token. With ordinary category conventions, a TeX control word begins with the escape character and continues through letters; a TeX control symbol uses a single nonletter after the escape.[ref]
Thus \demo is normally a control word and \% a control symbol. The name does not require a particular implementation: its current meaning may be a TeX primitive or a TeX macro. For example, \def\demo{A}\let\saved=\demo\def\demo{B} leaves \demo expanding to B and \saved expanding to the saved definition A.
Spaces also illustrate why the tokenization rules matter. Under the usual conventions, the space after a control word delimits its name and is ignored by input processing. Printing a space may therefore require an explicit command or another appropriate input construction. The TeX category code assignments determine which characters count as letters during this scan.