Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
1  
See the levels of TeX. –  Martin Schröder Feb 11 '13 at 15:26
1  
The tag wiki needs some love. –  Martin Schröder Feb 11 '13 at 15:27

2 Answers 2

up vote 21 down vote accepted

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)
share|improve this answer
    
Thank you. This is a much clearer explanation of "TeX format" than the one given on the The levels of TeX webpage. –  Lover of Structure Feb 10 '13 at 7:02
4  
Handy reference on all TeX-core primitives for those who doesn't have The TeXbook: tug.org/utilities/plain/cseq.html#top-ai –  tohecz Feb 10 '13 at 8:32
3  
Worth noting that VirTeX cannot really typeset anything as it has nothing set in the \output token register, whereas plain has a small but functional output routine. –  Joseph Wright Feb 10 '13 at 8:56
    
+1 for the sentence "Which primitive commands are known to TeX depends on the particular engine." –  Lover of Structure Feb 18 '13 at 13:46
    
Is there any way to invoke "virgin" TeX from the command line? –  Lover of Structure Feb 18 '13 at 13:47

The original typesetting system by Donald Knuth is TeX. Leslie Lamport made it easier to use by adding a bunch of macros on top, the result is called LaTeX. Both are TeX at the core, and make absolutely clear you are talking about the original, unadorned, TeX it is sometimes called "plain TeX".

share|improve this answer
1  
Thanks; I think this is, de facto, one usage of the expression "plain TeX". There are some people that distinguish "plain TeX" from "TeX", though. –  Lover of Structure Feb 10 '13 at 4:09
    
Sorry but this is some sense the contrary of what is asked. Instead of explaining "What is plain TeX, and what is the difference to TeX proper?", you're adding to the confusion... –  Stephan Lehmke Feb 10 '13 at 9:04
4  
Sorry but this is answer is just wrong. –  David Carlisle Feb 10 '13 at 10:54
5  
@vonbrand the other answer explains it to some extent. plain tex is a format just like latex (defined by loading plain.tex into initex just as latex is defined by loading latex.ltx into initex) latex is not built on top of plain tex (although some plain tex macros are copied into the latex sources) –  David Carlisle Feb 10 '13 at 12:10
2  
@DavidCarlisle I see, so I think what his answer does get across is that "plain TeX" is often contrasted with LaTeX. From everything written here I understand that technically "plain TeX" is really TeX with the format defined by plain.tex. But for someone not familiar with the matter, the meaning of "plain TeX" might simply be "TeX, not LaTeX", even though this is technically incorrect because the meaning of "plain TeX" is more specific than that. I don't mean to propagate incorrect usage, but I think this is worth pointing out. –  Lover of Structure Feb 10 '13 at 13:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.