TeX

TeX is a typesetting system created by Donald E. Knuth of Stanford University. As the TeX Users Group describes it, TeX is “a special-purpose programming language, and the program that interprets the language,” that sits at the center of a system “that produces publication quality mathematics (and surrounding text).” Instead of formatting text visually, the author writes a plain text manuscript interleaved with TeX commands and then runs the TeX program to produce formatted output. Knuth has placed all of the source code for TeX in the public domain.

Knuth began work on TeX in 1978 out of frustration with the declining quality of typesetting in the proofs of his own book series, The Art of Computer Programming. He set out to build a system that he could control completely, so that his books would look the same for generations regardless of changes in printing technology. The result handles fine details of page layout and, above all, the demanding two-dimensional structure of mathematical formulas, an area where ordinary word processors of the era failed badly.

The internal model of TeX treats everything on the page as nested boxes joined by stretchable and shrinkable “glue.” Characters become small boxes, words and lines are larger boxes, and the spaces between them are glue that can expand or contract so that text fills a line or a page evenly. Line breaking is handled by a global optimization that considers an entire paragraph at once rather than breaking greedily line by line, which is one reason TeX output looks so even. Penalties and discretionary breaks let the system make good decisions about hyphenation and where to split formulas.

TeX is also notable for its approach to versioning and stability. Knuth long ago declared the system essentially finished, and its version number asymptotically approaches the mathematical constant pi: each revision adds another digit, so versions have run 3.14, 3.141, 3.1415, and onward. Knuth has stated that when he dies the version number is to be frozen at pi exactly, and any remaining bugs will then become features. The companion system METAFONT follows the same convention, with its version number converging to the constant e.

The definitive reference for the system is Knuth’s The TeXbook (1984), published both on its own and as Volume A of the five-volume Computers and Typesetting series. Knuth’s Stanford pages describe The TeXbook as “the definitive user manual and reference manual for TeX,” while Volume B, TeX: The Program, presents the complete source written in his literate programming style. Decades after its creation, TeX and its descendants remain the standard for mathematical and scientific publishing.

Sources

Last verified June 8, 2026