I am interested in learning plain TeX especially in

  1. automation: looping, conditional branching, jumping, iterating, etc.
  2. layout: creating custom smart tables and boxes that can span cross pages.

What is the most often used commands for doing those above? At least I have a rough direction to the target.


Reading Knuth's book needs much time. I want to be more practical and instant first. Later after grasping the rough and basic understanding, I will read the Knuth's book.

  • 4
    I'm afraid that for tables in particular there are no short-cuts. The \halign primitive is something you need to be very careful with, hence the complexity of many of the table packages around. – Joseph Wright Dec 24 '10 at 10:48
  • Smile, breathe and go slowly. - Thich Nhat Hanh. Automation in TeX is easy there is one construct and that is recursion everything is build around this, including the loop. Branching is a few primitives \if, ifnum etc. As Joseph mentioned the table building mechanism is complicated and has been overwritten by LaTeX, so if you play with TeX tables you need to stick to TeX mostly. There are some good suggestions by the posters below. Try reading the TeXbook or at least skimping through it first. – Yiannis Lazarides Dec 24 '10 at 13:33
  • @Yiannis Lazarides: \halign works just fine in LaTeX, so I don't know what you mean by "overwritten". – morbusg Dec 24 '10 at 17:03
  • 1
    @morbusg: not only does latex not overwrite \halign, it also goes so far as to use it ... which isn't terribly surprising, if you think about it... (not that it's relevant here, since the op wants to know about plain. – wasteofspace Aug 30 '14 at 13:56

I know only of two:



You'll find free pdf versions of the books in the directories. If you will be a member of DANTE (Germans TeX user group http://www.dante.de) you'll get a free copy of the book TeX by Topic`. At least for mebers in 2014.

  • 1
    I will try to read chapter 9 of TeX for the Impatient. I think it is what I need. Thanks very much for the links. – xport Dec 24 '10 at 12:40
  • I'd recommend making clear what those links are to. – Seamus Dec 25 '10 at 3:14
  • @Seamus, just click *.pdf from the list shown. – xport Dec 25 '10 at 3:22
  • @xport The point is to make clear what those links are for. It's all very well giving a link, but it's better to give a link and an explanation of what those links are... – Seamus Dec 25 '10 at 3:31
  • @Seamus, it is self-explanatory. – xport Dec 25 '10 at 3:47

The problem you will have here is that a lot of the basic work on plain TeX programming was reported in TUGBoat, which therefore means things are spread out. At the same time, a lot of the basics are leant from existing code, rather than from books. This applies in particular to loops, where most people use ideas from The TeXbook, etc., and adapt them. For tables, you'll be best looking at the various LaTeX packages and the ConTeXt TaBlE implementation for ideas. This reflects the fact that once something is implemented in TeX, the usual way to reuse the idea is to copy the code. It's not the same a a compiled language where you need to know about the implementation approach without the option of simply copying all of the code.

  • yes, TUGboat is a good source, especially the "ask Nelly" section – user2478 Dec 24 '10 at 11:15
  • Many things are spread out there. Thanks for the link, @Joseph. I will revisit the link after reading the book TeX for the Impatient (chapter 9). – xport Dec 24 '10 at 12:45
  • 3
    and it is also a good idea to be a member of TUG ... ;-) – user2478 Dec 24 '10 at 12:51
  • @Herbert, someday I will register. – xport Dec 24 '10 at 13:07

In addition to TeX for the Impatient, I also like looking at Don Knuth's TeX code, most of which is available on his homepage: Preprints of Recent Papers.

The CTAN plain contrib may also be useful, as well as Eplain: Expanded Plain TeX.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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