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.

Donald Knuth has written what are arguably the most beautiful books with the TeX system.

Now I understand that Knuth wrote them in plain TeX, and still uses plain TeX for his current projects. Which, to me at least, raises the question: how is it even possible to write a book of any significant size without the benefit of the LaTeX macros and the CTAN packages, some of which, I believe, will only work with LaTeX?

For instance, how did he do his drawings? How did he define his environments? (Did he?) How did he manage floats?

share|improve this question
At least in the case of the TeXbook you can actually see how did he do it since you can see the source of the TeXbook in CTAN. –  Gonzalo Medina Aug 1 '11 at 21:18
There's a reason why he wrote a TOC for seven volumes in 1962, but didn't get beyond number four yet. ;-) –  DevSolar Aug 1 '11 at 21:19
As for drawings, Knuth uses METAPOST. Implementing "environments" is easy. Floats are already in plain. Autogenerated TOC is not that difficult (I did one myself for my master's thesis). And Knuth's achievement (at least wrt. TeX macros) is not really that strange; LaTeX and ConTeXt also evolved from plain.tex, the former written primarily by Leslie Lamport, the latter by Hans Hagen. And plain gives you in fact more freedom - almost nothing is hardcoded! And there are plain TeX packages out there, too (tikz, TAP for tables, and quite a few others; google gustlib, for example). –  mbork Aug 1 '11 at 21:39
knuth designed tex to do exactly what he wanted. he is undoubtedly more familiar with what it can do and how to use it than anyone else is ever likely to be. the design of tex was based on what he needed for the revised volume 2 of taocp, and the first editions of volumes 1 and 3 were already in print in a form he liked, so "all" he had to do was make those concepts and constraints possible. he was generous in considering suggestions from other people, and released his early drafts of the tex and metafont books to many readers to make sure nothing was missed. still, a real tour de force! –  barbara beeton Aug 1 '11 at 22:25
@mbork For some of the figures he used ctan.org/pkg/picmac –  Yiannis Lazarides Dec 11 '11 at 3:58

3 Answers 3

For instance, how did he do his drawings?

I understand him to use MetaPost exclusively at this point.

share|improve this answer
Jim have Don or John make any public/private comments about Asymptote which is MetaPost "replacement"? –  Predrag Punosevac Jan 15 '12 at 3:29
There was a most impressive presentation on Asymptote at the San Francisco TUG meeting (I moderated the session), and Don was in the room so he was at least aware that there is a very capable program out there. I don't believe that he asked a question (there is a video online) and I don't know if he approached John Bowman about it at all; you'd have to ask John. As to John Hobby, I know zero. (Perhaps you know this: Asymptote isn't really a replacement (I note your quotes) in that it doesn't solve the systems as you write.) –  Jim Hefferon Mar 2 '12 at 18:07

How did he manage floats?

Plain-tex format builds up on the primitive \insert with its \topinsert, \midinsert and \pageinsert macros.

share|improve this answer

Knuth created a great little macro package; it should be in your local TeX installation as manmac.tex. He used it for the TeXbook. Reading it is very instructive. He does things like footnotes, inserts, and figures. There's a "proof mode" which changes the behavior of some things while you're proofing a manuscript. He has the proper macros for setting fonts down to 7pt size (including adjusting math mode fonts, symbols, strut boxes, etc.). He's got custom output routines. He's got a special syntax for verbatim text. He builds his own index. He has environments for double columns.

It's only 700ish lines of code. It's really worth studying. He even explains much of it in the TeXbook.

As Barbara Beeton pointed out in a comment, taocpmac.tex is used to typeset the Art of Computer Programming Series. It is also well worth studying.

share|improve this answer
manmac.tex is used for the "computers & typesetting" books. taocpmac.tex is used for "the art of computer programming". the latter is not in tex live or on ctan, but it is included in the bundle that knuth releases whenever tex is updated. you can find a copy on a stanford web server. like manmac.tex, it's well worth studying (but probably not for a novice). –  barbara beeton Dec 12 '12 at 19:05
Thanks @barbarabeeton, I have added a note in my answer. –  EfForEffort Dec 12 '12 at 23:22

Your Answer


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.