When is TeX better than LaTeX?

  • TeX is useful when you want to fully understand what's going on, or want to have full control. In principle this is possible with LaTeX too, but there's a lot more to understand. (That is, LaTeX is easy but not simple, while plain TeX is simple but not easy. Related talk on software design.)

  • TeX is a tool for typesetting; LaTeX is a document preparation system. IMO TeX is useful when you want to play the role of the printer/typesetter; LaTeX is useful when you want to play the role of the author.

To elaborate on the second point: Once upon a time, books were produced in the following way:

  • The author would write their manuscript (the contents of the book) either by hand (with pen or pencil on paper), or with a typewriter, or something like that, and then (after editing and proofreading etc), send it to a printer (a person).

  • The printer (a person, not a machine!) would have the job of taking this content, and turning them into pages: picking up pieces of metal type (for each letter), spacing them into equal-length lines, adding spaces here and there, and so on. (Literally, setting type, so typesetter.)

TeX was originally written to help with the latter job (Knuth already had most of the content; he was only producing the second edition of his book (TAOCP Vol 2)); later Leslie Lamport realized that this was all too low-level for authors, and came up with LaTeX. So it is hard to recommend writing a book from scratch in plain TeX; you'll probably end up with your own complex macros just like LaTeX. But if you already have the content in another format and just want to solve a problem very specific to pages of a certain known size, it is possible that it may be easier to do it using plain TeX (using as few macros as possible) than with LaTeX.


To give a somewhat trivial example of the first point: consider the font-changing commands. Plain TeX produces a way to say "start using the following font", something specific like "Computer Modern italic at 9pt". Of course you probably want to switch back to roman type at the end of it, so you need to be careful to enclose this command in a group. But not just that: you're probably using italics for emphasis, and if within something that is emphasized you want to emphasize further, then the convention is to switch back to roman type. Also, if you want to emphasize something within bold, you should switch not to regular italics, but to bold italics. Similarly if your font is larger then you should switch to the larger italic font. All this sort of thing LaTeX's default \emph does automatically. This is usually what you want, if you're writing a document. But if for some reason you want to explicitly control which font gets used where, then you may not know how to do it with LaTeX, and when you figure out you'll be using something so far from typical LaTeX that it's closer to plain TeX.

Here's another example, thanks to Bruno Le Floch's unravel package. Compare what happens internally when you run the LaTeX \newcommand, versus the plain TeX \def:

\documentclass{article}
\usepackage{unravel}
\begin{document}
\unravel{\newcommand*{\foo}[1]{bar(#1)}}   % The LaTeX way
\unravel{\def\foo#1{bar(#1)}}              % The plain-TeX way
\foo{3}
\end{document}

As printed by unravel, the former takes 126 steps, while the latter takes 2 steps. This example illustrates quite a few other points of difference between LaTeX and plain TeX:

  • The plain TeX way is still technically available in LaTeX, just discouraged.
  • Plain TeX markup can often be shorter (by doing less: see next point).
  • The LaTeX way is probably what most authors want, as it is born of experience and provides additional protections (in this case, against the all-too-common possibility of accidentally redefining an existing command).
  • Still, overall, very few people using LaTeX would be aware of everything that \newcommand is doing under the scenes, so it's less conducive to understanding exactly what is going on.

As yet another example (last one I promise), compare a standard LaTeX way to get a bulleted list:

\documentclass{article}
\begin{document}

Some text.
\begin{itemize}
\item first
\item second
\end{itemize}
More text.

\end{document}

with the way Knuth does it in texbook.tex (corresponding to page 10):

% TeXbook uses "\input manmac"; for this example just need the following from it.
\def\bull{\vrule height .9ex width .8ex depth -.1ex } % square bullet
% These 3 are already in plain.tex, reproduced here as they may be less familiar.
\def\hang{\hangindent\parindent}
\def\textindent#1{\indent\llap{#1\enspace}\ignorespaces}
\def\item{\par\hang\textindent}

Some text.
\nobreak\medskip
\item\bull first
\smallskip
\item\bull second
\medbreak\noindent
More text.

\bye

If you surround the "Some text... More text" with \tracingmacros=1 and \tracingmacros=0, you get about 25 times more lines in the LaTeX case. More importantly, the LaTeX way is probably closer to the author's mind, and the TeX way shows clearly all the typesetting that's going on.


The question has no answer, actually it meets the standard "opinion based" close reason. but I'll attempt an answer anyway.

TeX is a macro expansion language, and

LaTeX is defined as a set of macros, so everything that you write in LaTeX expands eventually to some sequence of TeX primitives.

Conversely, TeX allows you to define macros, so starting from just the primitives (initex) or from plain TeX, you could define macros equivalent to LaTeX.

So at some level the capabilities are identical. For vast majority of people for the majority of the time, it is best to use LaTeX, as whatever the technical pros and cons, LateX, basically forms a language of communication that has meaning separate from its implementation in the TeX typesetter, and writing in a common language with a shared understanding has its uses. If you write your own TeX macros, even if they typeset equivalent documents, those documents will be harder for other humans and other systems to understand.

Aside from the shared language aspects, the LaTeX macros are not always the implementation you would choose now (they were designed for far smaller machines) but they have been used by millions of users for decades and the chances are that most of the more serious bugs are either fixed or have known workarounds. If you "roll your own" document macros while it is in theory possible that they could be as robust, it's somewhat unlikely, millions of man hours of testing time are hard to beat.

Since I've been part of the team maintaining LaTeX for over 25 years this perhaps is not the most objective neutral comparison that you could get, but still...

Since it's December it's probably a good time of year to point out that I do use plain tex sometimes, this plain tex that I wrote a while back has had some use over the years for example.

\let~\catcode~`76~`A13~`F1~`j00~`P2jdefA71F~`7113jdefPALLF
PA''FwPA;;FPAZZFLaLPA//71F71iPAHHFLPAzzFenPASSFthP;A$$FevP
A@@FfPARR717273F737271P;ADDFRgniPAWW71FPATTFvePA**FstRsamP
AGGFRruoPAqq71.72.F717271PAYY7172F727171PA??Fi*LmPA&&71jfi
Fjfi71PAVVFjbigskipRPWGAUU71727374 75,76Fjpar71727375Djifx
:76jelse&U76jfiPLAKK7172F71l7271PAXX71FVLnOSeL71SLRyadR@oL
RrhC?yLRurtKFeLPFovPgaTLtReRomL;PABB71 72,73:Fjif.73.jelse
B73:jfiXF71PU71 72,73:PWs;AMM71F71diPAJJFRdriPAQQFRsreLPAI
I71Fo71dPA!!FRgiePBt'el@ lTLqdrYmu.Q.,Ke;vz vzLqpip.Q.,tz;
;Lql.IrsZ.eap,qn.i. i.eLlMaesLdRcna,;!;h htLqm.MRasZ.ilk,%
s$;z zLqs'.ansZ.Ymi,/sx ;LYegseZRyal,@i;@ TLRlogdLrDsW,@;G
LcYlaDLbJsW,SWXJW ree @rzchLhzsW,;WERcesInW qt.'oL.Rtrul;e
doTsW,Wk;Rri@stW aHAHHFndZPpqar.tridgeLinZpe.LtYer.W,:jbye

A few years ago I threw some effort into learning plain TeX. I did this because:

  • I find LaTeX output ugly
  • I was learning ConTeXt, and its documentation often suggests you drop down to plain TeX when you want to do something complex

Specifically with LaTeX, I often find that it has made some decision, ostensibly to free you from having to think about something, and you dislike the decision it made. Your options will be to either read the LaTeX code and find out what is happening and how (which is not easy), find a package that fixes this little thing (often possible, but sometimes feels gross), or suffer.

With plain TeX, you are the one responsible for whatever behavior you see, so if you don't like it, it's your fault, and you can understand what you did wrong. Or at least ask here on tex.SE. :)

By the way, if you want to learn plain TeX, I would recommend you start from XeTeX or LuaTeX because the font situation is much easier from those engines.