What the heck is Latex?
This document attempts to explain what Latex is, in under five minutes.
Latex is a document preparation system
You use Latex to create documents for others to read. In that respect it
is similar to Microsoft Word. But the similarities end there.
Document preparation with Latex typically consists of using a text editor
(such as Emacs, vi, or even Notepad) to edit a Latex source file,
which has the extension .tex, and then running the latex
program to convert the source file to a document interchange format such
as Postscript or PDF. Once the document is in a document interchange format,
it can be previewed on the screen, sent to others, printed, etc.
What is up with the name "Latex"?
The name is (in my opinion) the worst part. It is too easily confused with
latex, a synthetic rubber-like substance, and it seems elitist to many
people. But try to forgive the name; it was created by Computer Scientists
like me, and we're terrible at naming things.
Pronounciation: I usually pronounce it "LAY-tek", though
some pronounce it "LAH-tek". In any case, the second syllable is not
pronounced "teks".
Typography: In an obnoxious combination of captialization,
font sizing, and baseline offsetting, Latex is often (and officially)
written LATEX.
Actually, the HTML doesn't really do it justice, so I made the following
image using Latex itself:
Even by writing "Latex" instead of "LaTeX" or "LATEX"
I'm violating the "recommended practice". But the other forms are just too
annoying.
The reason for this bizarre arrangement of letters is in part
to distinguish it from the aforementioned rubber-like substance, but
mostly to show off what is possible in Latex (encouraging the perception of
elitism).
Etymology (word origin): Donald Knuth created "Tex" ("TEX"),
the three letters actually being uppercase Greek tau, epsilon and chi. This Greek
"tex" is the root of English words like "technical" and "technique". Later,
Leslie Lamport built "Latex" on top of Tex, prepending
the "La" presumably to reflect his name.
Markup versus WYSIWYG
To someone familiar with MS Word or the like, the most radical aspect of
Latex is that you do not (necessarily) interact with a graphical user
interface (GUI), and you do not immediately see how your document will
be typeset.
Consider a typical WYSIWYG ("what you see is what you get") word processor,
such as Open Office, shown in the
screenshot below:
In such a program, the GUI always shows what the final printed copy will
look like, including formatting, etc. The GUI further contains a bunch of
buttons (etc.) that can be used to apply formatting.
In contrast, the usual mode of interaction with Latex is via a text editor.
The screenshot below shows fox.tex being
edited in Emacs:
Here, we just see the plain text input file, plus the markup commands
that apply formatting. This is similar to HTML. Actually, Emacs does
show a little more than the plain text, by using different colors for different
elements of the Latex input file, and even using boldface for the text that
follows the boldface markup command "\bf".
When you want to see how the document will actually look when printed,
you invoke the latex program to generate (typically) Postscript, and
then view that with a previewer program such as
gv. Below is
a screenshot of using gv to look at the output of fox.tex:
Postscript is a good interchange format on Unix systems, but in the Windows
world, PDF is much better. I usually convert Postscript to PDF using
ps2pdf. You can
also use a specialized version of latex called
pdfTeX.
The produces output that works better with onscreen
previewers; they should produce identical printed output.
Both are typically included with Latex distributions.
What is good about Latex?
Why would anyone use Latex? Here are some good points:
- Superior typographic quality.
The main reason I use Latex is it produces output that is,
typographically, far better than any of the alternatives.
Latex has excellent built-in fonts, good algorithms for
automatic spacing, and the ability to fine-tune the spacing
arbitrarily. Bad typography gives a bad first impression,
and reflects poorly on the content of a document.
- Output device independence. MS Word has (what I consider
to be) a bug, where the formatting applied to a document depends on
the printer designated as "current". Latex has no such misfeatures.
- Compatibility with revision control. Because .tex files
are plain text, I can use revision control software to remember the
history of changes. Off-the-shelf revision control software has
features that far exceed MS Word's built-in history mechanism.
- Portability. Latex runs on virtually any operating system in
existence. MS Word only works on Windows, and even OpenOffice does
not run on all Unixes (though that is improving).
- Document longevity. Latex documents written 10 years ago
still work and still produce the same output as they did when originally
written. In contrast, Microsoft uses version evolution as a strategic
tool to force people to upgrade continuously, so MS Word documents are
typically useful only for 3-4 years.
- Macros and other programmatic features. Latex lets me define
macros, canned sequences of text and/or markup, that I can
then use repeatedly. It's much better than copy+paste since it can
be changed by changing just the definition. Even more, Latex allows
people to write programs in their documents, which is handy
on occasion (mostly for people who already know how to write
computer programs).
- Mathematical typesetting. Typesetting mathematics is why
Tex was first created, and Latex continues to excel at this task.
What is bad about Latex?
So why would anyone not use Latex?
- More moving parts.
Using Latex means using an editor, latex itself, a document
previewer (such as gv), and usually a few other assorted
programs. In contrast, WYSIWYG word processors are self-contained.
- Difficulty knowing/remembering markup commands.
Learning the markup commands takes time, and it can initially be
quite frustrating. That is why I recommend the use of a front-end
GUI at first; see below.
- Previewing delay.
There is a delay between typing something in the editor and seeing
the result in the document previewer.
- Possibility of syntax errors.
Unlike in a WYSIWYG word processor, it is possible to create a .tex
file that latex will reject, complaining of a syntax error.
Worse, the actual error report is needlessly cryptic. It takes a
bit of experience to learn how to deal with these errors.
- Adding new fonts.
You can't just download some .ttf (TrueType Font) file off
the web and start using it. In fact, I don't even know how
to add a new font (though I'm sure Google does). Whatever the
procedure, it's not trivial.
- Lack of support for newspaper-style continued columns.
Newspapers often have articles that span multiple columns, on multiple
(possibly disjoint) pages, in ad-hoc ways. Further, a single
physical column may contain text from several articles. Latex does
not support such complex page designs. (Of course, neither does
MS Word; this is a comparison to the Framemaker class of desktop
publishing software.)
How do I get started?
If you want to get started using Latex, here is what I recommend:
- Get a Latex distribution.
If you're using Linux or another Unix variant, chances are you
already have latex installed. If not, you should probably
get teTeX.
If you're using Windows, MiKTeX
is a good choice.
A Latex distribution includes latex itself, a bunch of
fonts, and some useful utility programs like bibtex and
dvips.
- Get a document previewer.
On Unix, gv
is popular. On Windows,
Ghostview is good. You
can also just use
Acrobat Reader
if you exclusively generate PDFs instead of Postscript.
- Get a GUI front-end.
LyX is a pretty good front-end
editor for Latex (Windows version
here).
However, it is not WYSIWYG--it makes only minimal effort to render
the text as latex will. The main benefit of using a GUI
is you don't have to remember all the markup commands since you
just select text and press buttons. Ultimately, I found the GUI
approach limiting, why is why the last bullet:
- Get a book.
Every Latex document is, in fact, a program, and Latex
is really a programming language. You're not just going
to intuit your way through it, and what is online is fragmented
and incomplete. I recommend "The Latex Companion" by Grossens,
Mittelbach and Samarin, which is probably the most popular Latex
book.
Related Links
Here are some related sites that may be of interest: