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?

  • 16
    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. Commented Aug 1, 2011 at 21:18
  • 11
    There's a reason why he wrote a TOC for seven volumes in 1962, but didn't get beyond number four yet. ;-)
    – DevSolar
    Commented Aug 1, 2011 at 21:19
  • 16
    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
    Commented Aug 1, 2011 at 21:39
  • 24
    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! Commented Aug 1, 2011 at 22:25
  • 2
    @mbork For some of the figures he used ctan.org/pkg/picmac
    – yannisl
    Commented Dec 11, 2011 at 3:58

3 Answers 3


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.

  • 11
    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). Commented Dec 12, 2012 at 19:05
  • Thanks @barbarabeeton, I have added a note in my answer. Commented Dec 12, 2012 at 23:22
  • Do I need just texbook.tex and manmac.tex to build the book? (for experimentation, not reading or distribution, of course) Commented Oct 29, 2021 at 17:17

For instance, how did he do his drawings?

I understand him to use MetaPost exclusively at this point.

  • Jim have Don or John make any public/private comments about Asymptote which is MetaPost "replacement"? Commented Jan 15, 2012 at 3:29
  • 2
    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.) Commented Mar 2, 2012 at 18:07

How did he manage floats?

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .