# What is the best way to learn TeX?

As opposed to LaTeX, which is addressed in another question.

Most of the references I've seen get too complex too quickly. I'm looking for something that gives me a top-down view of the language - what the parts of a document are and how (and when) each is processed before proceeding to infinite detail like character classes (e.g.). Something heavily example-based, with real-world examples, would be helpful as well. I just find the language incredibly obscure and difficult to grok.

-
I wonder if this is really possible. At a TeX level the 'parts of a document' are really not that relevant. TeX typesets 'stuff', and although you can alter how the stuff looks, TeX doesn't really care about structure. That is what LaTeX adds to TeX, by introducing a programming layer which does know about document structure. –  Joseph Wright Aug 4 '10 at 7:04

The TeXBook (by Knuth himself) is actually great! It starts with examples and explains clearly all the things starting from the simplest that you're most likely to need, and goes sufficiently deep. It is a strange book in that needs to be read in multiple passes, but you can do it. It's worth reading, especially since it also gives you insights that can be later crucial — into typography, why Knuth made the choices he made, and other issues about the internals of TeX.

-
The TeXBook is kinda strange. One chapter he will explain something and the next he will say "ignore what I mentioned previously, this is the truth". –  dreamlax Aug 5 '10 at 22:06
+1, my recommendation, with a copy of TeX by Topic by your side. needs to be read in multiple passes - I didn't find this, except for the infamous Appendix D. –  Charles Stewart Aug 11 '10 at 7:22
@dreamlax: He's very up front that some of the things he says are white lies. The point is not that what he said previously was wrong, merely that he omitted certain things that were not important right away. –  TH. Sep 13 '10 at 10:17
@dreamlax: that happens all the time in various courses of learning –  SamB Dec 1 '10 at 4:28

Victor Eijkhout's Tex by Topic provides for a good reference. It can complement more tutorial-style texts.

-
Yes, I've tried this reference a few times - but it turns out you are right, it's just a reference, not a tutorial. –  rogerl Aug 11 '10 at 12:49

Also see Making TeX Work and TeX For The Impatient. Obligatory FAQ link:
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=ol-books

-

Roger, you may have noticed something about the replies to your question. There is no consensus. This indicates that there is no real standard path to learning TeX. I've learned TeX the same way most of these folk have. I've read The TeXbook. I've read 'TeX by Topic'. I've spend hours, days, years pouring over OPC (other people's code) as the spittle drips from my mouth onto the page and my brain freezes and causes global body-locking until I fall off my chair in a dead faint. I've screamed and yelled at the impersonal sky-gods who have decreed that the people who know TeX will never set up easy and accessible methods of teaching and learning TeX except by the hard and stony path that they have trod. There shall be no web-sites where tex code can be looked at and reviewed by the tex-sages. There shall be no books on advanced TeX programming or methods of learning the TeX way implements standard algorithms or do standard thing that are in chapter 1 of most programming books. There shall be no path but the one; the path of figuring it all out by yourself.

You see, Roger, the *TeX community is not like other communities of software enthusiasts. In other communities there are books, magazines, classes, websites, and endless ways to learn the tips and tricks of programming in their language. People who know things are glad to help you, even if you are asking things that require them to read more than 10 lines of your code. Sometimes lots of code. There are places to get code reviews of your code. They actually like to spread their knowledge and watch their language spread around the world, creating thriving and pulsing groups of enthusiastic coders.

But in the *TeX world, we hate sharing what we know. Especially with those who don't know and want to learn. We're definitely not going to make it easy for you. If you weren't lazy, you'd do what we did, read the TeXbook, read 'TeX by Topic', read OTP, drool on our desks till you faint. You know, what non-lazy people who don't want others to do all their work for them do.

Let's see. It's almost 2011. TeX was created in 1979 and 'finalized' in 1982. That's almost 30 years ago. Ruby was released in 1995, 15 years ago. Last time I was in Borders, there was a whole shelf or two of Ruby programming books. There were none on programming TeX.

You know what happens when there is no simple path to learning something? Knowledge is lost over time. Are there more people willing to tread the hard and stony path to learning TeX today than 10 years ago, or less? Where is *TeX, and by extension, typographically beautiful documents, going to be in 50 years? Will *TeX, or any descendants, exist?

-
I'm not sure the comparison with Ruby is entirely fair. TeX is a rather specialised language, whereas Ruby ismuch more general and so do attract more programmers. (For Ruby one could substitute a number of other languages, of course.) I've also found that there is support available in terms of 'this is how you can'. Some of the posts to c.t.t. include lots of very clever ideas. It's just that in the main there is an expectation that to understand what happens you'll run the clever stuff with \tracingall! I guess that writing a better book that The TeXBook is actually very hard! –  Joseph Wright Nov 25 '10 at 9:01
Why do you think he would drool on your desk, bev? –  SamB Dec 1 '10 at 4:35
@SamB - actually, looking at it now, I'm quite embarrassed at how many typos are in there. I might fix them, or I might leave them as a living monument to how careless I am and how carefully I need to edit. –  bev Dec 1 '10 at 4:53
I love this answer. It's exactly the way I feel when I go to Google for an answer to some seemingly simple TeX question and get either nothing or 100 copies of the same web page from some university. –  rogerl Jun 29 '11 at 14:06

TeX has several components, including (1) typesetting (2) fonts and (3) macros.

Often, it is macros that people have the most difficulty with. For this there are some key concepts, such as the token stream and the action of the expansion of macros.

The expansion of a macro edits the stream of tokens. This is a key concept. Try running some very simple macros with \tracingall on.

A good lesson would be to read through and understand the output of

 \$ tex '\relax \tracingall \input story \end'

-

I learned from A Gentle Introduction to TeX (PDF file). I also have a copy of Knuth's TeXbook which I look at once in a while.

-

As for a different method,

I learned by building LaTeX documents and then looking at the TeX generated. This is so I could associate LaTeX commands with their TeX structures.

Much different from learning from a book.

-
How do you look at the TeX generated? –  ShreevatsaR Jul 26 '10 at 23:24
\tracingmacros (IIRC) does the trick. –  topskip Aug 4 '10 at 9:53

"Most of the references I've seen get too complex too quickly." I tried very hard not to do this in Formatting Information, so I'd appreciate any feedback. Since TUG published it, I have been busy with other things, so it needs an update, but the essentials are all still valid.

-
Hello, your book is great! It is recommended by several people at this other question. This question is about plain TeX only, though. –  ShreevatsaR Aug 3 '10 at 21:34