When I posted that I was going back to using TeX, I mentioned that TeX had changed a lot in 20 years, but didn’t really go into too many details. Time to remedy that.
TeX is two layers of software. Underneath is the core of TeX, written in a variant of Pascal. These days it gets translated to C before being compiled to a binary. On top of the TeX core, you have a set of macros which provide all the handy commands
you use to typeset documents.
There are a number of different macro packages. Knuth’s own is known as “Plain TeX”; it’s what I used back when I last wrote TeX documents. It’s extremely flexible, and I managed to make it format my dissertation in a way that was so un-TeX-like that the examiners asked what I used. Unfortunately, Plain TeX is rather ugly to use. For example, here’s the code of a Plain TeX macro for placing two pieces of text side by side:
\def\xsplit#1#2#3#4#5{{
\setbox1=\vbox{\hsize= #1 #4} % First column
\setbox2=\vbox{\hsize= #3 #5} % Second column
% If the boxes are output side by side at this point, they
% will be aligned at the bottom instead of the top.
\ifdim\ht2>\ht1 % Column two is longer than column one
% Fill bottom of column one with glue
\setbox1=\vbox to \ht2{\hsize= #1 #4 \vfill}
\else
\ifdim\ht1>\ht2 % Column one is longer than column two
% Fill bottom of column two with glue
\setbox2=\vbox to \ht1{\hsize= #3 #5 \vfill}
\fi
\fi
\hbox{\box1\hskip#2\box2}}}
I remember spending most of a summer vacation poring over a copy of Knuth’s The TeXbook, slowly assembling my own set of macros. I based my page layout on that of Apple’s Macintosh Human Interface Guidelines. I had found the book particularly readable, and reasoned that Apple probably knew what it was doing as far as designing page layouts for technical documentation. Bending TeX to my will wasn’t much fun.
It’s a problem lots of people had. So to get away from all that, Leslie Lamport wrote an alternate set of macros called LaTeX. He provided standard templates for letters, technical articles, reports, books, and overhead projector slides. (Kids: Ask an old person what an overhead projector was.) LaTeX also had macros for bibliographies, tabular data, simple diagrams, indexes, and pretty much everything else needed for academic documents. Its book — LaTeX: A Document Preparation System — was about half the thickness of Knuth’s book, more focused on end users, and came with a handy quick reference card.
LaTeX spread through academia faster than Far Side cartoons. It was particularly popular with mathematicians, physicists, chemists, computer scientists, and anyone else who needed to be able to typeset mathematical equations. (It was also about the only way to typeset Tibetan in 1990, which led to my helping out some humanities students.) LaTeX is probably the most popular TeX macro package. There’s even a full graphical editor for LaTeX, so you can avoid the markup language entirely. If you have a mental image of what a TeX document looks like, chances are it’s the look of a standard LaTeX template.
I had toyed with returning to TeX a year or so ago, and picked up a copy of Lamport’s book in order to try out LaTeX. There’s a problem with LaTeX, though. If you don’t care about page design, it makes it really easy to put together a document that looks exactly as specified by its templates; but if you want to design your own page layout from scratch, you quickly enter a world of pain. That’s probably why almost all LaTeX documents look alike.
So I did some more research, and decided to try a newcomer to the TeX package market: ConTeXt. Its development started in 1990; it attempts to make TeX behave in ways familiar to people used to modern DTP packages. It’s more flexible than LaTeX, yet easier to use than Plain TeX. Here’s how you put two paragraphs side by side in ConTeXt:
\defineparagraphs[sidebyside][n=2]
\setupparagraphs[sidebyside][1][width=.45textwidth]
\setupparagraphs[sidebyside][2][width=.45textwidth]
\startsidebyside
First paragraph goes here.
\sidebyside
Second paragraph goes here.
\stopsidebyside
It’s still a bit long-winded, but that’s because it’s completely general. The first chunk is the setup; you can adjust the number of columns, define each column’s width differently, give different columns different text styles, and so on, and give each setup its own name and pair of macros
to apply to your paragraphs, as in the second chunk of text.
So, I had chosen a macro package; but there were more decisions to make…