19

Everywhere in the TeX community, I see suggestions like \parskip, \obeylines, \parindent, etc. I'd be surprised not to find them even in the most basic LaTeX packages. So I figured they must be deeper down in the TeX core as primitives. Knowing how they work would be very useful.

Googling for tex primitives takes me to TeX Primitive Control Sequences. Is there a printable PDF version of such a reference?

  • 4
    I take it 'Buy the TeXbook' would not count as an answer :-) – Joseph Wright Oct 22 '10 at 17:33
  • 1
    You could, of course, download texbook.tex, perform the obvious modification so that it is actually possible to TeX it, and finally print the output ... but that is likely illegal, would violate Knuth's stated desires, and it would certainly not have as nice a binding as if you just followed @Joseph's suggestion. – SamB Nov 30 '10 at 2:30
  • @SamB, I do not know the obvious modification and I think it will be a Pandora's Box should it leak out. – Kit Nov 30 '10 at 3:51
  • 1
    Incidentally, anyone who considers tex'ing the TeXBook should take a look at tex.stackexchange.com/q/6204/86 and in particular Barbara Beeton's comment therein. – Loop Space Mar 6 '11 at 19:34
  • 1
    +1: This is a good question. Not only would it be nice to have this reference in PDF form, but also a reference that doesn't require you to first know whether a command is a primitive, a plain TeX macro, or a LaTeX/ConTeXt/etc. command in order to find out where to look it up. – LarsH Jul 31 '13 at 21:09
18

I think your best bet is Victor Eijkhout's TeX by topic.

Oh, and by the way, some of those “primitives” aren't primitives at all, but plain TeX macros.

  • Please, can you clarify if the tex primitives are the ones in Chapter 37: Glossary of TeX primitives or the ones in the end of 36.2 Keywords titled as full list of all keywords? I am suspicious the glossary might actually list macroses too. For example, it lists \ifcase which I think could've been defined in terms of \if. – Hi-Angel Oct 12 '17 at 8:15
  • 1
    @Hi-Angel Definitely chapter 37, as the chapter title says. Yes, \ifcase could in principle be implemented in terms of \ifnum (not \if), but it would be very cumbersome, so Knuth implemented it in the TeX engine instead, which is what makes it a primitive. The keywords are different; they are only special when seen in special circumstances – most commonly while parsing a dimen or glue specification. – Harald Hanche-Olsen Oct 12 '17 at 8:28
13

Joseph assumes that "Buy the TeXbook" would not count as an answer, but I disagree.

I think that The TeXbook is very well-written and explains every primitive and plain TeX macro. It's well-worth the time to read it for any serious TeX user. The previous sentence is still true even if you never want to write a macro package or delve into the innards of TeX. It helps when macros become something you can understand rather than mystic incantations you utter from time to time.

  • 1
    TH, there's probably not in all the Philippines a single bookstore that stocks the TeXbook, and the cost of importing one probably puts that idea completely out of reach. I wonder if there were a way we could somehow band together to send him one ourselves? – Geoffrey Jones Oct 23 '10 at 4:27
  • I suppose one could read texbook.tex, but that would probably be a lot less helpful than having the actual book. – TH. Oct 23 '10 at 5:21
  • 2
    At some stage I do hope that Professor Knuth or his publishers will sort out a (paid for) PDF version of The TeXbook. This is the way many computer programming books are going, and it is quite technically possible. – Joseph Wright Oct 23 '10 at 10:08
  • Yes indeed. It's somewhat hard to tell the sample code from the actual markup of the book, for starters... – SamB Nov 30 '10 at 5:50
  • 3
    I have a hard copy of the TeXbook. As a new TeX user, I have tried to use it as a reference manual. While it is an excellent introduction to TeX, and I agree it's well worth your time, it is not a (good) reference manual. When a primitive is first described, it's described in the context of the topic being discussed, and in reference to a number of other things that are likely to be unknown to the new user. Its purpose is to describe TeX concepts and how to use them, not to make it easy to discover the basic meaning of a primitive. – LarsH Jul 31 '13 at 21:01
8

The book TeX for the Impatient is now freely available, and covers Plain TeX quite well: http://www.gnu.org/software/teximpatient/

At one point in time, I recall seeing an announcement of the source of Plain.tex inter-woven w/ the appropriate comments from TeXbook.tex as a literate program, but that probably runs afoul of the copyright limitations of the latter (but raises the question of why plain.tex isn't plain.web)

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.