« Back to home

Why TeX?

Posted on

Recently someone on Stack Exchange asked Why are there no alternatives to TeX, or, why is TeX still used?

Here are some reasons.

It works.

It sounds trite, but TeX has a robustness and reliability that other software lacks. Recently, there was a discussion of a bug in LuaTeX triggered when a document hits 3,987 pages. I can’t imagine creating a document with over 1,000 complex pages using something like Microsoft Word or OpenOffice Writer.

It’s predictable.

If you’ve ever wondered why your word processor is formatting something a particular way, well, sometimes there’s really no way to answer the question. Microsoft’s OOXML spec resorted to defining many aspects of formatting by saying that they had to be the same as particular versions of Word; even Microsoft couldn’t specify what that behavior actually was. Pro typesetting software like Adobe InDesign isn’t much better when it comes to maintaining compatibility between versions.

With TeX, there are fewer ghosts in the machine. Even if the details underneath are pretty scary, at least you can always see exactly what macros you are applying to a piece of text and what parameters you have tweaked. Nothing is hidden, and there’s more of a feeling of being in control.

It keeps working.

I’ve used a lot of word processors over the years. Wordwise, View, LocoScript, 1st Word Plus, MacWrite, WordStar, WordPerfect, AppleWorks, DisplayWrite, Word Pro, ClarisWorks… They’re all dead and gone now. Good luck reading any files you still have stored in their special file formats. In fact, there have been discussions on Macintouch recently about the problems of converting a large number of legacy ClarisWorks documents into something readable, and that product was only declared end-of-life in 2007. Yet if I still had a copy of my dissertation, I could typeset and print it today, because I wrote it in TeX.

ConTeXt is the newest and most rapidly changing TeX macro package. Even so, switching from a 2 year old version to today’s bleeding-edge beta is mostly a non-event.

It runs everywhere.

Using TeX, I can produce finished documents on Mac, Windows, Linux, or any Unix-like OS. I don’t need a high-end CPU, I don’t even need a high resolution display.

You can edit it using whatever tool you prefer.

TeX files are just UTF-8 text files. Edit them with TextWrangler, vim, Emacs, jEdit, pretty much any text editor you want. It helps to have syntax highlighting, but it’s not essential.

Edit on your laptop, on someone else’s laptop, on a tablet, on your phone. Anywhere there’s a text editor.

Put your documents in version control. They’re just text, so you can diff them. They’re small and compress really well, so you can keep every version forever and not run out of space. Store them on a remote server and edit via SSH. Transfer them in a fraction of a second across a modern network connection.

It’s cheap.

I use the word ‘cheap’ rather than ‘free’ because really, I’m not at all averse to paying for software. However, my budget is limited.

There are some solid proprietary page layout systems that can deal robustly with large documents. Adobe FrameMaker, for example. MSRP for that is $999. If you want something a bit cheaper, there’s InDesign, for $699. Both are a bit pricey for my liking.

Or there’s TeX, which is where FrameMaker got its typesetting algorithms from anyway. Cost: $0. I think it’s something of a bargain.

It gets out of the way.

Recently, a lot of writers have been discovering the joy of ultra-minimalistic tools which get out of the way and let you focus on the actual writing. There are programs like WriteRoom, DarkRoom, jDarkRoom, Byword, OmmWriter, and so on, which attempt to remove distractions and give you just text on an otherwise empty screen. Then there are tools like Markdown, reStructuredText and wiki syntax, markup languages which allow you to edit plain text with minimal annotations and convert it into something with pretty formatting later on.

All of these tools are rediscovering something that was lost when we moved from word processors like WordPerfect, which used plain text with embedded formatting commands, and entered the WYSIWYG world of the 90s with its endless buttons, sliders, ribbons and rulers.

Being a markup language, TeX has that minimalist essence. It’s just text.

It’s extensible, on the fly.

Sometimes I’m writing some documentation, and I suddenly realize I’ll have to repeatedly refer to some kind of thing — a set of menu entries, say — and format them in a special way throughout the text.

In a normal word processor, I stop writing. I decide whether I need a paragraph style or a text style. I decide what existing style it needs to be based on. I click around to create my new style and give it a name. I adjust its formatting to be distinctive so I can see what I’m editing. I map it to a key. And then I try to remember what I was about to write before my multi-minute jaunt into wordprocessorland.

In TeX, I make up an imaginary macro off the top of my head — \Menu{File — Quit} — and keep on writing. After I’m done writing whatever was in my head, then I worry about extraneous details such as how it’ll look on the page and whether it needs to be based on the look of anything else. Even if I decide I need a more elaborate calling pattern — say, if the macro needs some arguments — it doesn’t matter, because the plain text nature of my made-up-on-the-spot macro makes it easy to find and replace.

Obviously, actually applying the formatting is harder than with a word processor. But once I’ve done it once, I can re-use that magic incantation endlessly.

It handles vector art properly.

One place a surprising number of word processors fall down is incorporating images into the text. Somehow it seems to be acceptable to offer fonts that are infinitely scalable vectors, and then fail to offer any reliable way to insert and adjust a vector diagram. Want to bring your process diagram into OpenOffice? Sorry, can’t read the SVG, why don’t you just draw it again with the horrible OpenOffice Draw?

In business, it’s not at all unusual to receive documents that have diagrams as horrible resized bitmaps, or tables as embedded objects that look like crap, for pretty much this reason.

With TeX, I can use any vector graphics tool I like, and there’s almost always a way to get PDF out — either directly, or via a print-to-PDF driver. Once I have PDF, it’s painless to place it onto the page as vectors. So like everything else, it scales correctly for the display. The only things in my documents that end up as ugly bitmaps are the screen captures, and that’s the way it should be.

There are more reasons if you’re a mathematician or scientist. I’m just listing reasons why a person who wants to write ordinary everyday business and personal documents might choose to use TeX to do so.

Nevertheless, I would absolutely use something more modern that met the same basic requirements. If you know of a word processor that runs on any modern computer, can deal with 5,000 page documents, imports vector art in standard formats and handles it in vector form, writes to tagged PDF with working hyperlinks, is guaranteed to be around and supported for the next 40 years, will let me edit without having to learn a new user interface or have anything but my text on the screen, has output the quality of FrameMaker or InDesign, is arbitrarily extensible, and costs under $100, do please let me know.