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.

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.


EDIT 1:

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.

share|improve this question
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

3 Answers 3

up vote 12 down vote accepted

I know only of two:

http://mirror.ctan.org/info/texbytopic/

http://mirror.ctan.org/info/impatient/

You'll find free pdf versions of the books in the directories.

share|improve this answer
    
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.

share|improve this answer
    
yes, TUGboat is a good source, especially the "ask Nelly" section –  Herbert 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 ... ;-) –  Herbert 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.

share|improve this answer

Your Answer

 
discard

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.