TEX is a typesetter, not a word-processor

TEX was designed with no limiting application in mind. It was intended to be able to prepare practically any document—from a single page all-text letter to a full blown book with huge numbers of formulae, tables, figures etc. The size and the complexity of a TEXable document is limited only by hardware considerations. Furthermore, TEX seeks to achieve all this whilst setting typesetting standards of the highest order for itself. The expertise of generations of professional printers has been captured in TEX, and it has been taught all the tricks of the trade.

Historically, printers prepared a document by placing metal characters in a large tray and arranging and binding them to form a page. This was very precisely done, but the ultimate precision was limited because of the mechanical nature of things and by time considerations. TEX prepares a page in an analogous manner (putting your characters and formulae into ``boxes'' which are then ``glued'' together to form the page), but has the advantage of enormous precision because placement calculations are performed by computer. Indeed, TEX's internal unit (the ``scaled point'') is about one-hundredth of the wavelength of natural light!

``But conventional word processors run on computers , too'', you object. Yes, but their fundamental limitation is that they try to ``keep up'' with you and ``typeset'' your document as you type. This means that it can only make decisions at a local level (eg, it decides where to break a line just as you type the end of the line). TEX's secret is that it waits until you have typed the whole document before it typesets a single thing! This means that TEX can make decisions of a global nature in order to optimise the aesthetic appeal of your document. It has been taught what looks good and what looks bad (having been given a measure of the ``badness'' of various possibilities) and makes choices for your document that are designed to make it ``minimally bad''.

But TEX's virtues run much deeper than that, which is just as well because it is possible to get satisfactory, though imperfect, results from some word processors. One of TEX's strongest points is its ability to typeset complicated formulae with ease. Not only does TEX make hundreds of special symbols easily accessible, it will lay them out for you in your formulae. It has been taught all the spacing, size, font, ...conventions that printers have decided look best in typeset formulae. Although, of course, it doesn't understand any mathematics it knows the grammar of mathematics—it recognises binary relations, binary operators, unary operators, etc. and has been taught how these parts should be set. It is consequently rather difficult to get an equation to look bad in TEX.

Another advantage of compiling a document after it is typed is that cross-referencing can be done. You can label and refer back to chapters, sections, tables etc. by name rather than absolute number, and TEX will number and cross-reference these for you. Similarly, it will compile a table of contents, glossary, index and bibliography for you.

Essential to the spirit of TEX is that it formats the document whilst you just take care of the content, making for increased productivity. The cross-referencing just mentioned is just part of this. Many more labour-saving mechanisms are provided for through style files. These are generic descriptions of classes of documents, teaching TEX just how each class likes to be formatted. This is taught in terms of font preferences, default page sizes, placement of title, author, date, etc. For instance, a paper style file could teach TEX that when typesetting a theorem it should embolden the part that states the theorem number and typeset the text of the theorem statement in slanted Roman typeface (as in many journals). The typist simply provides and indication that a theorem is being stated, and then types the text of the theorem without bothering to choose any fonts or do any formatting—all that is done by the style file. Style files exist for all manner of document—letters, articles, papers, books, proceedings, review articles, and so on.

In addition to style files, there are macro packages. A macro is just a definition of a new TEX command in terms of existing ones. Don't think small when you think of macros! When typing a document that has a lot of repetition in it, say the same expression is used again and again in different different equations, you can define a macro in your document to abbreviate that expression. But macros can teach TEX how to typeset all sorts of complicated structures, not just parts of an equation. Many macro packages (files that are just collections of definitions) have been written to teach TEX all sorts of applications. There are specialist maths packages (, 2 A 2 M2 S-LATEX), general purpose packages (LATEX), packages for setting tree diagrams, Feynmann diagrams, languages like Chinese, Arabic and Ancient Greek, orchestral scores, and many, many more. All these are freely available, a spin-off of the giant TEX cult.

Another facet of the design of TEX allows it to use practically any output device. In fact, TEX doesn't talk to any printers, screens, phototypesetters at all! Instead, when a document is compiled a device independent (.dvi) is produced—TEX does not compile with any particular output device in mind. Printer drivers are then invoked on this .dvi file and, in consultation with the font data for that printer, produce output suitable for the particular device. You can choose an HP Laserjet driver, or an Apple LaserWriter driver, or a dot matrix driver etc. All use the same .dvi file as input (and remember the material in there is set to enormous accuracy) and attempt to image that file on the particular device as faithfully as possible. If you are using a top of the line laser printer or phototypesetter, then TEX's massive internal precision will not be wasted. Alternatively, a dot matrix printer will give a coarse approximation of the ideal image that is suitable only for proof-reading. In addition to portability, these .dvi files help ensure that there are very few printing surprises when you move from one device to another: how many times has your favourite word-processor made you reformat a document when you wish to change printers?

There are many other motivations one could cite for the superiority of TEX. But it is time that we started to get our hands dirty. One last comment: TEX was not designed to supplant secretaries and professional printers—it was designed to aid them in their work and, in the words of the TEX designer Donald Knuth, allow them to ``go forward and create masterpieces of the publishing art''.It also allows those who generate the material to be typeset—mathematicians, physicists, computer scientists, etc—to prepare their own documents in a language that is intimately linked to the language we use for writing such material.

The novice reader will still have no idea of what a TEX source file looks like. Indeed, why do we keep referring to it as a source file? The fact of the matter is that TEX is essentially a programming language. Just as in any compiled language (e.g., Pascal, C) one prepares a source file and submits it to the compiler which attempts to produce an object file (.dvi file in the TEX case). To learn TEX is to learn the command syntax of the commands that can be used in the source file.