# Starting with TeX (not LaTeX)

I've been using LaTeX for 3 years and I'm decided to switch to (plain) TeX. For the moment I'm reading The TeXbook for the third time (I quietly start to read the double-danger signed paragraphs) and I'm looking for informations about stuff that are not covered in the book but needed to use TeX with all that has been added since the 90's: etex, eplain, preloading other formats, pdftex, texmf trees, character encodings (utf8/latin1), foreign language hyphenation (French in particular), use of colors, image inclusion, etc. I also read somewhere that TeX's modern implementation have switched from 256 to (a higher number I've forgotten) registers. What about it?

• Why do you want to use an old system like plain (which doesn't know anything of the newer development like unicode) instead of a modern system like latex or context? – Ulrike Fischer Jan 21 '13 at 15:58
• @Ulrike: I use plain format with XeTeX and I have everything I want with UTF-8 support (\defs, etc.). – morbusg Jan 21 '13 at 16:22
• @Ulrike: It says "TeX" right there at the top of this page, not LaTeX, so I don't see why some people have made it their business to decide what format other people should use. This isn't the first time I see that kind of question (I'm referring to your question) on this site. I'm not asking why would you drive a Peugeot, am I now? – morbusg Jan 21 '13 at 16:25
• @morbusg: I'm giving such advices all the time. I care about people and try to show them the best way. So I'm telling people to drop bibtex and switch to the modern biber/biblatex, I'm telling people to drop old classes and switch to a modern class, I'm telling people to drop old TeXLive versions and to update. I don't intent to let someone run without comment in the plainTeX adventure if I have the impression that he/she doesn't really know what plainTeX is. – Ulrike Fischer Jan 21 '13 at 16:58
• @Ulrike: I want to leave LaTeX (I play with it for 3 years) because I believe that things are much easier to do in TeX than in LaTeX, for example creating a page layout from zero. From my little experience, I see the link between LaTeX commands and TeX primitives a bit cloudy (in other words: there's a cloud of abstraction between low- and high-level) and that makes it difficult to modify existing things. – lvaneesbeeck Jan 21 '13 at 19:10

Here's a whirlwind of some of the things you can do with XeTeX (and to even larger extent, LuaTeX). Plain-kru putting a stop to this discrimination nonsense.

\uselanguage{french}
\frenchspacing
\input eplain % http://tug.org/eplain/

\font\bodyfont="Liberation Serif:mapping=tex-text" at 12bp
\bodyfont
\font\titlefont="Liberation Serif:letterspace=12" at 20bp
\baselineskip=16bp

\fontdimen2\font=.25em % inter-word space
\fontdimen3\font=.25em % inter-word stretchability
\fontdimen4\font=.05em % inter-word shrinkability
% ^ http://tex.stackexchange.com/a/49306/1410

\parindent=1.3em % paragraph indentation
\parskip=0pt % normally there is stretchability between par's, remove it

\topskip=\baselineskip \lineskip=\baselineskip
\smallskipamount=\baselineskip \medskipamount=2\baselineskip
\bigskipamount=3\baselineskip % retain vertical rhythm

\emergencystretch=1em % in a case of emergency, let there be some extra
% stretchability on that line. http://tex.stackexchange.com/a/52855/1410

\XeTeXprotrudechars=2
\def\marginprotrusion#1{% let these characters protrude into right margin
% just some random test values to play with. http://tex.stackexchange.com/a/8130/1410
\rpcode#1 U” 150 \rpcode#1 U’ 150 \rpcode#1 U! 100
\rpcode#1 U, 200 \rpcode#1 U- 200 \rpcode#1 U. 200
\rpcode#1 U: 100 \rpcode#1 U; 100 \rpcode#1 U? 100}
\marginprotrusion\bodyfont

\doublecolumns % this command comes from eplain
% see http://tug.org/eplain/doc/eplain/Multiple-columns.html#Multiple-columns

\special{background rgb 1.0 0.941176470588235 0.96078431372549}

\special{color push rgb 1 0 0}
\centerline{\titlefont J'accuse}
\special{color pop}
\medskip
\XeTeXpicfile "Desktop/daalia.jpg" width\hsize height 10\baselineskip
\medskip
\input zola

\bye


• +1 (extra if I could for the choice of text!) – Alan Munn Jan 21 '13 at 19:37
• ... though you're tying yourself to XeTeX tremendously by using all these primitives without any abstraction layer inbetween... – Stephan Lehmke Jan 21 '13 at 19:51
• @Stephan: Yes, true, but then again that's what I use. I usually do abstract away stuff, but I just wanted to quickly compile an example for this question (OP mentioned primitives vs abstraction in the comments). I phrased poorly the first line, though. What I meant was that you can do even more neat stuff with LuaTeX. – morbusg Jan 21 '13 at 20:00
• +1 for completeness to the answer will you please add texdoc xetexref` – Yiannis Lazarides Jan 21 '13 at 20:45

these resources don't cover "recent" implementations of (plain) tex, but are nonetheless useful in explaining its workings.

• Victor Eijkhout's TeX by Topic is a solid reference that explains the meaning of all (original) TeX primitives in the context of related commands; available on-line in PDF form or printed/bound on demand (see the linked page for details). Edit 2014-04-01: TeX by Topic is now available in a new revised edition by the german user group DANTE.
• A Gentle Introduction to TeX by Michael Doob gives a tutorial in source and output; an interesting (to me) feature is the inclusion in the source of both Canadian and U.S. spellings, and the ability to choose between them by setting of a "true" or "false" condition (requires changing the source).
• An excellent introduction is A Beginner's Book of TeX by Silvio Levy and Raymond Seroul (translated and expanded from the French original by Levy).
• David Salomon wrote The Advanced TeXbook to cover topics such as page layout, font manipulation, contents and indexes; this book was out of print, but has been republished. Some of the material was published in TUGboat; look in the list by author for relevant articles.
• another author of an extensive work about (plain) TeX, TeX in Practice (4 volumes), is Stephan Bechtolsheim; again, the work goes in and out of print, but some of the material was presented in TUGboat.

unfortunately, the tugboat list by category doesn't usually identify plain/latex/context, but everything there that was published more than a year ago is open to all.

• The Advanced TeXbook does not seem to be out of print: amazon.com/The-Advanced-TeXbook-David-Salomon/dp/0387945563/… – Mafra Jan 21 '13 at 23:19
• @Mafra -- thanks. it was out of print for awhile, but it seems that springer has republished it (it's listed under "new and forthcoming titles). i'll update the ams master list of tex-related books. – barbara beeton Jan 22 '13 at 14:07
• I started reading A Beginner's Book of TeX after seeing it highly recommended in the ConTeXt reference manual by Hans Hagen ("the book that turns every beginner into an expert"). It is truly excellent. I cannot recommend it enough. To clarify a minor ambiguity above in "(translated and expanded from the French original by Seroul)": the French original Le Petit livre de TeX is by Seroul, and it was translated and expanded by Levy. – ShreevatsaR Dec 17 '16 at 18:34
• @ShreevatsaR -- yes, you are correct; silvio levy translated the book, not raymond seroul. the french original quickly became a favorite when i received a copy, and i was very happy that it was translated for a wider audience. there is also a german translation, mentioned on the ams web page cited in a comment above. – barbara beeton Dec 17 '16 at 21:56

I post here answers to my questions as I find them. I'm not finished with reading all I've found, so this answer will be edited.

(personnal note: get information about multilingual support.)