I've been using LaTeX for about a year or two as part of writing reports in university and want to gain a more in-depth understanding of how it works (I'm a computer science student).

Would Donald Knuth's The TeXbook be a recommended read for me? What does it cover? What is your impression of it, those who have read it?

  • 13
    Yes, You should read it. As Knuth says, it gives you every single detail about TeX and how it works. I am Persian and since English was not my mother tongue, I had difficulties understanding TeXBook and I had to read each concept several times until I could understand them.
    – IRAN
    Feb 11 '11 at 15:05
  • 5
    read the TeX by Topic from Victor Eikhout. It is much more readable than the TeXbook
    – user2478
    Feb 11 '11 at 15:10
  • 8
    Since this question asks for impressions and experiences of several users, not for a best answer or solution, I suggest converting it to community wiki.
    – Stefan Kottwitz
    Feb 11 '11 at 15:10
  • 16
    @Herbert: I disagree; the TeXbook has very elegant prose, a natural development, and is much more readable as literature. TeX By Topic, however, is much better as a technical manual: as the title says, it is organized by topic, so there's no danger of having to look in five different places for complete information about some builtin. And it has very useful examples.
    – Ryan Reich
    Feb 11 '11 at 21:02
  • 8
    @Vafa: The TeXbook is not organized as a reference manual of TeX as TeX by Topic is. Knuth is clearly aiming to teach the novice reader how to use TeX to produce beautiful books and the advanced reader (dangerous bend sections) more advanced material. As such, Knuth starts with a very basic example of a .tex file and works up to macros, math, tables, and all of the advanced topics. I don't really recall The TeXbook jumping from topic to topic. There's a fairly logical progression of ideas.
    – TH.
    Feb 15 '11 at 6:07

If you want an in-depth understanding of LaTeX you can start somewhere else. However, if you want to really understand TeX then there is no way to avoid the great TeXBook! (I actually ordered the whole 'Computers & Typesetting, Volumes A-E Boxed Set' just two weeks ago. It's still on its way to Europe -- the US prices are so much cheaper :-) )

It explains a lot of how the TeX engine works. I really just started to understand some of the fine mechanics of it after reading this book.

The sources of The TeXBook are on CTAN, so you could have a peek in it (in source form only). There is also TeX for the Impatient as a full PDF document. However, I didn't read that book yet.

  • "the US prices are so much cheaper" — weird, because in the U.S. the Indian/east Asian versions of books like that are cheaper than domestic...
    – Andrew
    Feb 15 '11 at 3:34
  • @Andrew: That books are, as originals, of course more expensive in Europe because of shipping, customs and the share the retail trader gets. Here it happened that the Amazon.com price (reduced)+shipping was cheaper than the Amazon.de price (also reduced, but less) with free shipping. Anyway, I just figured out that I have to pay customs and claim the book from the customs office, so it isn't really cheaper. The last time I ordered such books (Companion set) from Amazon.com I did so from Ireland which has 0% VAT on books, which made the order smoothly and made me forget about customs this time.
    – Martin Scharrer
    Feb 15 '11 at 9:30

If you want to gain an in-depth understanding of the TeX family, you will certainly read the TeXbook, early or late.

There are electronic versions of "TeX for the Impatient" and "TeX by Topic" (already installed in TeX Live, but not MiKTeX). They are easy to achieve, and can be additional supplements or alternate of TeXbook. Anyway, TeXbook is still worth to read.

Since you are a LaTeX user, you may also read the documented source code of LaTeX, say source2e and classes document, and source code of any package you are interested in. This may be what Martin said a start somewhere else about LaTeX. I learned a lot from others' code, no less than from the books.

Since you want to understand how TeX works, you may also need knowledge of MetaFont, modern TeX engines (eTeX, pdfTeX, XeTeX, LuaTeX, ...), PostScript/PDF drivers (Dvips, dvipdfmx, ...), WEB2C, and so on. For an overview of TeX family, I suggest "An overview of TeX". These may be as important as TeX language itself.

  • 1
    The @name syntax doesn't work in answers, just comments. You have a typo "electric versions" should be 'electronic versions', shouldn't it.
    – Martin Scharrer
    Feb 11 '11 at 16:19
  • @Martin: I didn't know much about the @ notation, thanks. And for the typo. (I'm not good at English.) The using of double quotes is just a custom.
    – Leo Liu
    Feb 12 '11 at 6:00

Yes, you should definitely read it. I also have a background in Computer Science, and I first read The TeX Book ~5 years after I learned LaTeX; I seriously regret not having read it sooner.

The argument for a LaTeX user to learn TeX is similar to the argument for a C coder to learn assembly: You can program just fine in C without understanding assembly, but it's often useful to know what is going on behind the scenes.

As for first reading alternative texts, I think there is something to be said about reading the manual written by the guy who created TeX in the first place. Isn't that why most C++ programmers first read Stroustrup's book? I also find Knuth's writing style to be very entertaining.

  • 1
    I agree; other books and articles are better at explaining different aspects of TeX/LaTeX, but I think the TeXBook does the best job at making TeX interesting.
    – MSC
    Aug 8 '14 at 19:10

Of course everyone should read the TeXbook. But if you are a proficient LaTeX user who is pressed for time, I'd suggest just a few chapters (until you get hooked). Chapter 7 for character codes and tokens: you should know about tokens. Chapter 12 for TeX's treatment of spacing. Chapter 18 for good style in the input of math formulas. Skim Chapter 20 on macros and Appendix F on font glyphs and their classification. Even if you stop there, you'll have a good appreciation of how LaTeX really works.


IMHO, no. It is a waste of time, unless you really need to do TeX hacking. You cannot really understand the book in the first read, nor in the second, or third. And, I am not sure there is broad computer science added value to the book.

  • 4
    In computer science, TeX is a good example of macro programming language. (This kind of language is rare)
    – Leo Liu
    Feb 13 '11 at 6:19
  • 2
    @Leo: I cannot agree less... There are a number of macro programming languages, including e.g., M4 and the C preprocessor. Some are good, some are not as good. But TeX is not one of them.
    – Yossi Gil
    Feb 13 '11 at 11:08
  • OK, I made a mistake. I don't like the disadvantages of TeX macros either. I intended to say, TeX is a widely used and speical language that worth to understand for a CS student, even if we don't like it.
    – Leo Liu
    Feb 13 '11 at 14:41
  • 5
    @Yossi: Like any style of language (imperative, functional, logical, etc.), macro programming languages simply require a different mindset. TeX may have some flaws, but its macro expansion seems pretty solid to me.
    – TH.
    Feb 15 '11 at 6:00
  • 3
    Dear @TH: What I mean is that I do not wish to worry about register numbers. I wish that I could define variables, with types, just as I can with any other programming language, and let the underlying system take care of allocation for me. \newSomething approximates that. Let me also clarify what I say about if statements: they are not general purpose in that you cannot just check the value of a Boolean expression - you would have to define a new Boolean variable using a \newif. This, and other annoyances take all the pleasure from reading the TeXBook IMHO. I just want to get the work done.
    – Yossi Gil
    Feb 21 '11 at 8:51

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