# Reasons to use plain TeX

Given the active development in LaTeX and ConTeXt, and how LaTeX insulates the writer from typographical details and ConTeXt gives the user extensive control over formatting thus taking useful complementary approaches (see ConTeXt wiki), are there any reasons to use plain TeX?

-
Should this be community wiki? – Harald Hanche-Olsen Dec 17 '10 at 11:56
@Harald: in my personal opinion, this question feels similar in spirit to these others on reasons for using pdflatex rather than latex. I don't see much reason to turn these into CW as answers seem to be focused and objective. If you feel there is need to discuss this further, maybe start a question in meta? – Juan A. Navarro Feb 4 '11 at 10:59
@Juan: This post is so old, I don't think this is a good opportunity to start such a discussion. Maybe next time a question like this comes up. Just to put my comment in perspective, I am more used to the policy at mathoverflow, where the threshold for making something CW seems to be lower than here. – Harald Hanche-Olsen Feb 4 '11 at 13:59

Without disagreeing with the other answers, let my try to give an answer to your actual question.

I think that the best reason by far to use Plain TeX is that it will compile in 20 years and produce exactly the same output as it does now and as it did 20 years ago. (Okay, Knuth has fixed some extremely minor bugs.)

Consider the situation with LaTeX today. Various versions of packages can give wildly different results. I've written papers with people and in the 15 minutes before the deadline, we had three different looking PDFs, one of which was over the page limit, from the same code because the page breaking decision had been changed by something. And that's with everybody using LaTeX 2e. Try compiling a LaTeX 2.09 file today. What about Lamport's original LaTeX?

The situation with ConTeXt seems to be worse. It is still in heavy, active development.

-
To be fair, latex2e itself is very stable now, but indeed some of the packages can be fairly dynamic. The worst part is that there is no real change control -- I don't know of a distribution that allows you to downgrade a package back to a working version, and it is for the vast majority of packages it is impossible to find older versions anywhere on the web (eg, CTAN does not keep them). – Lev Bishop Dec 17 '10 at 17:33
But it is always possible to keep those versions used for a project with the project (same goes for collaborations). A life savior, the easy way: bundledoc package. – Meho R. Dec 17 '10 at 20:47
@TH: Couldn't this be said about any macro? That is, PGF is TeX compatible, but it could change between here and now and the future. I do agree with this answer, but I do not think that it is automatically the only or best answer to the question. For some people, page breaks or minor changes in formatting won't matter. The mere fact that TeX, LaTeX, ConTeXt, etc., are set down in plain tExT is enough to make them readable for all eternity, given that a person who knows that language and has access to an ASCII table can be expected to figure out the contents. Also, ++1 to what @Meho wrote. – Andrew Starks Dec 18 '10 at 15:52
@Andrew: Couldn't what be said about any macro? My point was that plain TeX is not going to change. To quote plain.tex, "Everybody's 'plain.tex' file should be the same, worldwide." With just base LaTeX as described in Lamport's book, one is fairly constrained in the type of documents that can be produced so packages and other classes are necessary. The same is not true of plain TeX. Obviously this isn't the only answer. Many others have given good answers. As for plain text, one need only examine xii.tex or Paul Taylor's diagrams.sty to see that the situation is a bit more complicated. – TH. Dec 18 '10 at 23:56
@TH: What can be said is that anytime anyone builds a macro in TeX or anything else, you have something that someone will revise and text might typeset differently. The virtue that you're rightly extolling of TeX is that it never improves. It's still the same processing language, built on the same 1980's assumptions, that it has always been. I didn't mean to dog your answer, I only was lamenting that someone "chose" it. My lament was because strict consistency is a somewhat narrow requirement. Is that really a reason that many would choose TeX over something more modern? I meant no offense. – Andrew Starks Dec 19 '10 at 5:08

Two words: output routines.

LaTeX does much of its heavy lifting in its enormously complex output routine, which leaves essentially no room for user customization. With plain TeX, you can override the default output routine with minimal fuss, giving you a tremendous amount of power over the precise output.

This is just one example of a more general experience that I've had with plain TeX vs. LaTeX. (I haven't used ConTeXt, but I would imagine the situation is similar.) If the core team or package author has anticipated your needs, either explicitly or via parametrization, then everything's fine. But if not, you're totally out of luck. Things tend to be set up in such a way that you can't override them without re-implementing a huge amount of scaffolding. One might say it's the inverse problem of leaky abstractions: the abstractions often prevent you from getting down to the lower levels, even when that's what you need to do.

Plain TeX takes exactly the opposite approach. Everything is low-level, and so is easy to change or override when you need to. The downside of this is obvious: it tends to be more work for the document or format author, since you generally can't just reach for an already prepared package to do X for you. But the advantage is that you can have vastly more control over how your document is typeset. If you don't care about that (and there are perfectly defensible reasons not to care), that's fine; but if you do, plain TeX makes it much easier to achieve.

Since I moved away from LaTeX and to plain TeX, I've noticed another thing that's rarely mentioned. There's a very elegant kind of ‘minimal markup’ (I got this term from Kees van der Laan [PDF]) that tends to be used in plain TeX documents, which I find to be much nicer than the fairly verbose LaTeX commands and environments. Essentially, you end up with very many tiny domain-specific languages that allow you to clearly and concisely express the structure and style of your document. This makes automatic processing of plain TeX documents almost impossible, but it makes working on them as a human very pleasant. There's simply less clutter; the commands sort of fade into the background, leaving just the text.

There are plenty of other reasons I prefer plain Tex, but others have already raised many of them. Keep in mind, though, that the learning curve is steep, and the TeXbook (still the best way to master TeX) is not easy going. But, for me at least, it was—and continues to be—a thoroughly worthwhile and enjoyable experience. Making LaTeX do what I wanted always seemed frustrating and annoying; making plain TeX behave as I want it to is sometimes difficult, but vastly more satisfying.

-
Thank you very much for this answer. I fully agree and I'am unable to express these ideas better. – wipet Oct 15 '14 at 14:13
Bravo, beautifully written. – A Feldman Apr 15 at 4:00
I find this input out of the usual scope of answers in the site. If you elaborate that might help to create a path for others. Maybe some hints? Are you using a simple text-processor with markdown-pandoc? – nilon May 26 at 13:58

LaTeX does 90% of what I need, but there are times when I just need to get under the hood. It's the whole leaky abstraction thing. So although I don't recommend learning plain TeX the format, I think learning the core TeX language can make you a much better LaTeX or ConTeXt user.

-
I couldn't agree with you more on this one. Without learning the core TeX language one can never really understand what is happening under the hood. – Yiannis Lazarides Dec 17 '10 at 12:06

I like all of the other answers, as well. This is one of those questions that gets into individual needs, philosophies, time, brains and opinion. It's like arguing about rock 'n' roll. Fun, but you're not going actually settle the question: Is Mark Knopfler a better guitarist than Eric Clapton, or not?

I'll throw out my strategy for TeX's place in my world. It might be useful to others\ldots

Learning TeX, for the average person, can ben be very, very difficult. This is especially true if you try to learn via the TeXBook by the creator of TeX, Donald Knuth. For me, it was impenetrable. The man is on a different plain than I am. I actually got offended when I realized that the majority of his examples were not actually useful in real life, and only constructed for their compact brilliance at showing how complicated life can be in TeXland.

Thankfully there is TeX By Topic, by Victor Eijkhout. It's a far easier read and is very useful to have around, even if you choose to ignore TeX. (I'd also buy TeXBook, if only as a "thank you" to Mr. Knuth for starting all of this.)

Anyway, what worked for me was to go ahead and use LaTeX for everything, including some 20 page-long macros. It's easy enough to keep throwing packages at a problem, and get quick results. You might discover that something just isn't quite right here or there, but you'll get fast results and you'll marvel at all that you are able to do.

Then, you'll discover a package or two that have more momentum behind them than the one's you're using. You'll build them into your macros and you'll fix some of your problems. You'll also understand a bit more about what you are doing and you'll add more capability to your output and automation to your workflow.

Inevitably, you'll run into something that is just killing you, like trying to pass an argument to a macro without having TeX unpack it first, or trying to use certain commands inside of a longtable environment. You won't have any idea why it's not working and you'll find yourself reading a bunch of documentation with @ symbols all over it. "And why do some people make their macros with the \def command?"

Somewhere around that point, you'll start to get interested in TeX and realize that much of what you thought was easier in LaTeX is actually just more characters of typing. Some stuff is easier in TeX and sometimes it's really important to understand how it works in order to know why it's not working for you.

So, in short, I suggest ignoring TeX when you start. Just enjoy the output that you get with LaTeX, or ConTeXt, and ask for help when you get stuck. If you're a the kind of person that wants to keep going and learning new things, then you'll naturally come to TeX when all of the layers on top of it reveal that, in the end, they are only their author's semi-walled gardens of abstraction. If you hit the walls and try to drag something in from the outside, it's time to learn you some TeX.

### Most important: Abstract macro commands away from your main document!

Think carefully before you put a LaTeX command directly into your document, especially if that command has options or requires a lot of typing, such as the figure environment. Instead, wrap those commands up into your own macros.

The main advantage of this is that you can change your own macros later and easily add capability to your existing documents without too much editing of those documents.

I've found that the fact that I abstracted my figure, references and all other formatting commands, I've been able to evolve my documents with me. Also, if a future change to the rendering engine is made or I switch to ConTeXt, it's easier for me to refractor my work than if I had used the base commands.

### Picking an Engine: XeLaTeX or LuaLaTeX

I'd start with XeLaTeX or LuaLaTeX as your engine and use the fontspec package to change font definitions. It will create output that most printers (Lulu) can work with, where you'd have trouble with pdflatex.

### If you're making illustrations (not bitmap pictures), build them in LaTeX

If you're using an arrow to point at something or label a picture with text, it might be initially faster to crank that out in Illustrator or Photoshop and saveas a PDF file, but you're making headaches for yourself and your document will not look as nice.

Eventually, you'll learn that it is more maintainable, prettier and headache-free to use LaTeX for all vector artwork and text.

Get to know PGF/TiKz. They make great graphics together.

### Some other useful macro-bulding packages

Get to know PGF and TiKz, again. :) Use its utility macros when you need things that other packages do, such as foreach loops, key/value pairs, and math functions. PGF has excellent documentation, a ton of development behind it and is, overall, a great tool. On top of all of this, it makes the excellent aforementioned graphics.

You'll need the Graphicx package for inserting external pdf/png graphics, even though PGF can do this. It doesn't do it very well and even the PGF author suggests sticking with Graphicx.

Get to know etoolbox. It's a nice, lightweight little set of macros that will keep you away from a lot of other, older packages. If you need a case statement, you can add boolexpr.

If you are compiling documents conditionally, the optional package is excellent, even though etoolbox exposes some of that functionality. I like the syntax of optional and you can easily extend it to give you an ifthenelse and case version (with boolexpr).

-
As someone who really enjoys the freedom (read: control) that ConTeXt give me, I find comparing it to LaTeX (repeated at least twice in this page) very insulting :) The fact that LaTeX is extremely rigid, unpredictable and disorganised does not mean every high level macro package have to be so ;) – Khaled Hosny Dec 18 '10 at 20:25
@Khaled: I agree. However, ConTeXt has documentation issues. Someone needs to clean up old documentation, complete the current documentation, and then organize it. After the 3rd or 4th time carrying out some old procedure only to find it did not apply to Mark IV... sigh. It got old. Also, Mac support is not awesome. I will switch to ConTeXt, but I'm giving them another 6 months to clean it up. Also, LaTeX is not bad, at all. With few exceptions, it actually is pretty sweet and unlike ConTeXt, is not a moving target. – Andrew Starks Dec 18 '10 at 22:54

Why use Plain? This is why I do:

I have always used Plain TeX, starting for historical reasons (my original computer didn't have enough memory to support LaTeX).

Now, it is for aesthetic reasons, similar to some of those mentioned by others above: the document is easier to read and type (at least in my mind). And I have a file of Plain macros to provide document structure (title, part, chapter, section, subsection, colour support, double/triple columns, font sizing [includes text and math fonts and fixes line spacing & relative size of eg headings etc as well], graphic inclusion. (many of these I've generated and many use macros published by others.).

I admit it was an effort learning TeX, but the reward for me is an intuitive way to control the document and "tweak" it.

Sadly, integrated environments for editing TeX often do not provide an easy Plain Tex option, requiring a bit more effort to support Plain Tex.

-
A warm welcome to fellow plainer. :-) – morbusg Aug 16 '13 at 9:41

It is TeX rather than LaTeX that insulates the writer from typographical details. LaTeX provides a library mainly for structured documentation thus extending the basic typographical rules that are in-built in TeX; all the main typographical rules such as hyphenation, kerning, breaking and floating items are provided by TeX. Plain TeX normally refers to another set of macros distributed with TeX that is very similar to those provided by LaTeX.

LaTeX provides another advantage over the original plain TeX macros, in that it provides a better human interface - and IMHO its main strength. There are also a substantial amount of packages that work with it, whereas the same is not true for plain TeX.

If the OP means using plain TeX over LaTeX, most users will opt for the latter. Macro writers continue to use a mixture of TeX and LaTeX commands in packages - even if this is frowned upon and this is perhaps unavoidable.

Compared to other computer languages one would never dream of producing a serious amount of programming by using only the libraries of the language - in our case LaTeX.

To summarize the answer - use LaTeX but do not be afraid to mingle a bit of TeX. Use TeX only if you have a few commands to test and just saying \bye, is quicker than typing all the preamble commands of a LaTeX class.

PS: Knuth still typesets all his books using plain TeX, so maybe he knows something!

-

For me, I like to know what's on my plate, so to speak. I can think of a couple of reasons:

• When you absolutely need to regain control for some very specific formatting. Where loading a bucketload of packages for those specific needs might seem more trouble than laying it out in Plain.
• Learning a language for learning a language's sake. Although the same could be said about LaTeX, I suppose.

In general, from how I've understood things, LaTeX "enforces" a specific way to format a document, and when you need to break away from that (in a way that LaTeX doesn't provide), you use a package designed for those specific needs. Usually this is what you want; a standard way to format documents. Note, however, that for the most part, you can just use Plain-commands inside a LaTeX document if need be.

ConTeXt, on the other hand, in addition to the above about LaTeX, is basically a re-implementation of the TeX programming language done in Lua (over-simplification for MkIV, sorry! ;-) ). Watching this years TUG-conference talk of Hans Hagen reveals the "why": their specific needs included fully automated, non-attended builds of documents.

-
The claim about LuaTeX is simply not true. LuaTeX is an extended version of pdfTeX using Lua as an embedded scripting language. – TH. Dec 17 '10 at 12:25
@TH.: It was meant as a joke, hence the smiley at the end. – morbusg Dec 17 '10 at 12:31
@TH: what claim about LuaTeX? Do you mean the claim about ConTeXt MkIV? – LarsH May 30 '13 at 21:18