I'd like to learn basic TeX programming (as a programming language instead of a tool of typeset) systematically, but I find "the Tex Book" by Knuth spends much time on typeset matter. Is there a book that focuses on explicit Tex programming and goes deeper?


3 Answers 3


The TeXbook is still a good source for pure TeX programming; just skip all the chapters that you don't care about.

Notes On Programming in TeX is pretty much exactly what you describe. It's fairly short, and not really suited to a beginner, but it is very good.

TeX in a Nutshell is also a very good. It spends a lot of time describing how boxes and glue work, but I wouldn't really call this "typesetting".

@mickep mentioned TeX by Topic. This is a good reference manual, but you really wouldn't want to use this to learn anything for the first time.

The macros category of TUGboat is also a good source. These are all short articles generally on a single topic, but they often discuss material that you can't find anywhere else. Some of these are intended for beginners, while others are intended for very advanced users.

In general though, I wouldn't recommend learning how to do pure "programming" tasks in TeX. If you ever need to do programming in TeX, you will have a much better time using either use Lua (via LuaTeX) or expl3.

  • 2
    It is of course a pure matter of opinion but using expl3 without having a deep understanding of the core TeX concepts which are nicely (to my mind) exposed in TeX by Topic is a kind of renouncement. There are actually further things needed beyond TeX by Topic because the latter does not cover the e-TeX expansion (lapsus, I meant extensions, but some have a lot to do with expansion...) which are crucial to many expl3 constructs. And primitives such as \expanded added more recently yet to the engines is not even explained in the e-TeX document.
    – user691586
    Apr 12, 2023 at 9:45
  • 2
    TeX in a Nutshell mentions the eTeX, pdfTeX and LuaTeX extensions too. For example \expanded primitive is described here too.
    – wipet
    Apr 13, 2023 at 6:39

If you are able to read Czech, then there is TeXbook inside out.


Si vous parlez français, vous peux trouver how to program in TeX chez CTAN.


If you speak French, then you can find "How to program in TeX" on CTAN.

  • 3
    That's a really interesting one that I've never seen before. For anyone who doesn't speak French, the linked manual is a 500 page book that covers TeX purely as a programming language, without covering typesetting at all. Apr 13, 2023 at 0:39

You must log in to answer this question.

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