[Tex/LaTex] “plain TeX”

plain-textex-core

I occasionally see a statement that plain TeX is not the same as TeX, because plain TeX is already a format.

What is plain TeX, and what is the difference to TeX proper?

Some answers are here (The differences between TeX engines), but I am looking for a definitive summary.

Best Answer

The "smallest" possible TeX is what Knuth called "virgin" TeX (TeXbook, p.342): it knows just primitive commands, no macros. Plain TeX is the set of macros (developed by Knuth) which makes TeX usable in everyday life of a typist.

And yes, these days we're using many different sets of macros ... one popular set is of course LaTeX. Plain TeX is, well ... the plainest of these ;-)

Regarding formats (as far as I understand). "Teaching" TeX all the macros (of plain TeX, for example) on each run would take too long (well, at least in the old days). Thus, we do it once for good: we input the definitions and take a snapshot, called a format.


The available commands can be classified into primitive commands and macros. Macros are composite commands built from primitive commands and/or other macros.

The "virgin" TeX knows only the primitive commands. Which primitive commands are known to TeX depends on the particular engine. For example, eTeX has more primitives than the original (Knuth's) TeX; \unexpanded is an example of a new eTeX primitive. Examples of primitive commands: \relax, \def, \halign. (There's about 300 of them.)

Formats (plain TeX, LaTeX, etc.) extend TeX's vocabulary by defining macros. (Actually, packages also do that.) For example, plain TeX defines macros \item, \rm, \newdimen, \loop, etc. (Plain TeX defines about 600 macros. The complete vocabulary of plain TeX has thus about 900 words.)

To check whether a command is primitive or a macro, one can:

  • look into the index of the TeXbook: primitive operations are marked with an asterisk
  • Use (primitive) command \show: \show\cs writes the meaning of \cs to the terminal. If you \show a primitive command, it will simply tell you its "name": \relax=\relax, halign=\halign, etc. In contrast, if you use \show on a macro, you will get its definition, e.g. \newdimen=macro:->\alloc@ 1\dimen \dimendef \insc@unt.

To reiterate, there are two types of commands:

  • primitives (these are the only things that "virgin" TeX knows about)
  • macros ("virgin" TeX knows no macros; macros are defined by formats and packages; formats and packages define only macros)