Wednesday, August 17, 2005

Why TeX?

10 Good Reasons for using TeX

These are the reasons most often cited for using TeX, grouped into four areas: Output Quality, Superior Engineering, Freedom, and Popularity.

Output Quality You write documents to be read and understood. Your first concern should be: how good is the output? Is it as readable and as useful as possible? Is it, even, beautiful?

1) TeX has the best output. What you end with, the symbols on the page, is as useable, and beautiful, as a non-professional can produce.

This is especially noticable for complex documents, such as ones with mathematics; see this sample (from Rogers's Recursive Functions). It also holds for documents that are complex in other ways: with many tables, or many cross references or hyper-links, or just with many pages.

Even on simple documents TeX does a better job than a word processor. Compare these samples of plain text (from Herigel's Zen in the Art of Archery) done in Word and TeX. These are short and the typographic differences are subtle but even a non-expert may see that the TeX page looks "more right." The word processor's page has some lines with wide gaps between words and some lines with too many words stuffed in (contrast the second paragraph's second line with its third). TeX's output is more readable.

2) TeX knows typesetting. As the plain text samples in the prior item illustrate, TeX's more even line spacings are a consequence of its more sophisticated algorithms for making paragraphs and for hyphenating.

Another way that this expertise gives better output comes in setting technical material. TeX moves the task, as much as possible, into the software. For instance, it automatically classifies each mathematical symbol as a variable, or a relation, etc., and sets them with appropriate amounts of surrounding space. It also sizes superscripts, and many other things. The result is that, because your document follows the conventions of professional typesetting, your readers will know exactly what you mean. You almost never have to fret with the formulas. They just come out right.

The quality of output is the best reason to use TeX.

Superior Engineering Everyone has been frustrated with software that is slow, fat, buggy, or that undergoes frequent incompatible version changes. TeX will not give you those troubles; from a Computer Science standpoint, TeX is very impressive.

3) TeX is fast. TeX ran quickly when it was developed in 1978 and so on today's machines it is very fast. It is easy on your computer's memory and disk space, too.

4) TeX is stable. It is in wide use, with a long history. It has been tested by millions of users on demanding input. It will never eat your document. Never.

But there is more here than just that the program is reliable. TeX's designer has frozen the central engine, the actual tex program. Documents that run today will still run in ten years, or fifty. So "stable" means more than that it actually works; it means that it will continue to work, forever.

5) TeX is stable, but not rigid. A system locked into 1978's technology would today have gaps. That's why TeX is extendable, so that innovations can be added on, layered over the underlying engine.

An example is the LaTeX macro package, which is the most popular way to use TeX today. It is a front end to the engine, affecting the way authors input their work. It adds conveniences such as automatic cross references, indexing, a table of contents, automatic numbering of chapters, sections, theorems, etc., in a variety of styles, and a straightforward but powerful way to make tables.

LaTeX also adds a philosophy of encouraging authors to structure their document by meaning rather than by appearance. For instance, a LaTeX author might produce emphasized text by typing "it is \emph{hot} here" instead of specifying italics. This approach has two advantages. First, since it is a computer language command, it makes the type style, size, and spacing uniform throughout your document. Second, once the information is in the computer then you can do more with it. You can, for instance, distinguish between text that is italic because it is emphasized, and text that is italic because it is the name of a ship, perhaps by adding a command \ship{..} that saves the names of all ships for a separate index.

So TeX has been, and is being, developed and extended in many ways. (See also the nex two items.)

6) The input is plain text. TeX's source files are portable to any computing platform. They are also easy to produce automatically, for example as output from a program. They are compact; all of the files for my 450 page textbook and 125 page answer supplement fit easily on one floppy. And, they integrate with other tools such as search utilities.

Use of this type of input file stems from an overall mindset. TeX arose in the world of science and engineering where there is a tradition of cooperating closely with fellow workers. A binary input format, especially a proprietary one, is bad for cooperation: probably you have had to go through the trouble of upgrading a word processor version because coworkers upgraded and you could no longer read their files. With TeX systems that rarely happens -- the last time that a LaTeX release lost some backward compatibility was in 1995.

There are even ways to run TeX directly from XML input, which many people think is the standard input format of the future. So, with the TeX formatting engine in the middle, the input front end may be adjusted to meet your needs, and changing times.

7) The output can be anything. As with inputting, TeX's outputting step is separate from its typesetting. The TeX engine's results can be converted to a printer language such as PostScript, or to a web language such as PDF or HTML, or, probably, to whatever will appear in the future. And, the typesetting -- line breaks, etc. -- will be the same no matter where your output appears. (Did you know that word processing output depends on the printer's fonts, so if you email your work to someone with a different printer then the line and page breaks may come out differently?)

Many people find that TeX's input language fits with how they think about their material. For instance, a scientist might describe a formula to a colleague over a telephone using TeX constructs.

Freedom Most computer users have heard about Free and Open-Sourced software and know that, as with the GNU programs, Linux, Apache, Perl, etc., this style of development can yield software that is first class. TeX, along with associated materials such as index makers or style files, falls into this category.

8) TeX is free. The source of the main tex engine is open (the Free Software Foundation uses it for their documents). All of the other main components are open, also.

9) TeX runs anywhere. Whatever meets your platform -- Windows, Macintosh, a variety of Unix, or almost anything else -- you can get TeX, either freely distributed or in a commercial version.

So although the core of TeX was written some time ago, it fits well with today's trends.

Popularity Using the same system as many other people has advantages. You can get answers to your questions. Your problems might well have already been solved. And, because of this large user base, your system is sure to be around for years.

10) TeX is the standard. Most scientists, especially academic scientists, know TeX. Research preprints, drafts of textbooks, and conference proceedings, all are regularly produced with TeX. As a result, many publishers of technical material are set up to work with it.

Because it is the standard, TeX's support by other technical software is the best. For example, there are editing modes to make input convenient, such as AUCTeX for Emacs. Another example is that most computer algebra systems, such as Maple and Mathematica, will give output in TeX. And no doubt technical software developed in the future will support TeX, also.

In addition, TeX is used by many people outside of the sciences, for all of the reasons given in this document. For instance, there is a way to produce beautiful criticaleditiontexts.

You wouldn't want to use a bad system simply because it is popular. TeX has earned its user base for sound reasons, some of them given above. Nonetheless, the existence of such a base is itself one reason to adopt a software package.