Plain TeX 2026-11-05
Plain TeX is Donald E. Knuth's foundational collection of TeX macros, parameters and conventions, described in The TeXbook by Donald E. Knuth. It makes a usable document interface from the lower-level facilities of TeX.[ref]
Plain TeX in the Comprehensive TeX Archive Network. Official package description: format-building files and relation to The TeXbook
For example,
$x^2+1$\bye requests an inline mathematical expression and ends the document. The \bye macro handles paragraph completion and final output before ending the run.[ref] The example uses the format's existing definitions together with TeX primitives and mathematical typesetting rules.Plain TeX is useful when studying how relatively small definitions control layout. LaTeX provides a different TeX format with more document-level structure. Choosing a format determines which definitions an input file can expect to find already loaded.
TeX 2026-11-05
TeX is Donald E. Knuth's programmable system for typography, particularly mathematical typesetting. A document supplies text and instructions; TeX macros and TeX primitives build material whose dimensions determine the eventual page layout. Computer fonts supply glyphs and font metrics, while line breaking selects how a text paragraph is divided. The Knuth-Plass line-breaking algorithm is one of the system's central layout methods.[ref]
Breaking paragraphs into lines by Donald E. Knuth and Michael F. Plass. pp.1119–1122 and 1175–1176: paragraph optimization and development in TeX
A TeX format supplies a prepared collection of definitions. Plain TeX and LaTeX provide different document interfaces built on TeX technology. For example, in Plain TeX the input
$\sqrt{2}$\bye requests a square root expression, , and ends the document. The computer font, glyph positioning and mathematical typesetting rules determine the printed geometry; the source characters alone are not a picture of the result.The TeXbook by Donald E. Knuth is the system's user and reference manual. TeX source code by Donald E. Knuth exposes the implementation as a documented computer program, making the paragraph algorithm and its numerical conventions inspectable.[ref]
The TeXbook by Donald E. Knuth. Author’s official bibliography: Volume A as user/reference manual, Volume B as documented program
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.
TeX expansion 2026-11-05
TeX expansion replaces expandable TeX tokens with other tokens according to their current meanings and the scanning context. TeX macros provide replacement lists; some TeX primitives also expand. Subsequent processing can execute commands or build typesetting boxes.[ref]
For example,
\def\firstdemo{AB}\def\seconddemo{\firstdemo} establishes two macros. Expanding \seconddemo first produces the token for \firstdemo; expanding that yields the character tokens A and B. The intermediate result is a token stream. The printed shapes are determined later by computer fonts and layout.Meaning can change between definition and use. With
\def\value{A}\def\callvalue{\value}, redefining \value to expand to B changes the later expansion of \callvalue to B. The stored TeX control sequence still identifies the same name, while its current definition supplies the replacement. This makes the distinction between token identity and current meaning practically useful. TeX format 2026-11-05
A TeX format is a prepared collection of definitions and initialization state used with TeX. A TeX format file, conventionally ending in
.fmt, stores internal structures so they can be loaded efficiently instead of reconstructed from the original initialization input.[ref]Plain TeX supplies one such foundation; LaTeX supplies another, with document-level conventions and facilities. The same mathematical input
$x^2$ can be embedded in either system, but an authoring command defined by one format need not be available in the other.Keeping the layers separate helps diagnose a failed document. The TeX implementation provides TeX primitives; the format makes further TeX macros and defaults available; a document invokes those definitions. Loading a different format can change the meaning or availability of commands without changing their spelling in the input file.