Typesetting documents: LaTeX

LaTeX is a software system for typesetting text into high-quality, "camera-ready" format. It's especially good for typesetting papers with lots of mathematical symbols and equations. LaTeX is now the de facto standard for formatting conference papers in formal linguistics, especially in computational linguistics, syntax and semantics. LaTeX is based on TeX, which was designed by Donald Knuth.

The philosophy behind LaTeX is to allow the user to concentrate on the content and structure of the document rather than the exact appearance of the finished product. In other words, LaTeX is not WYSIWYG ("what you see is what you get") the way Microsoft Word is, so to the uninitiated a LaTeX source file looks like a jumble of strange commands.

Confusingly, there are two versions of LaTeX in widespread use: LaTeX2e and LaTeX 2.09. LaTeX2e is the new standard version of LaTeX and is the wave of the future. LaTeX 2.09 is now obsolete and is no longer supported, but is still used by many people who see no reason to switch to LaTeX2e. If you are a newcomer you definitely want to learn and use only LaTeX2e. How do you know which version is which? LaTeX 2.09 files begin with the command \documentstyle, while LaTeX2e files begin with \documentclass. Fortunately, when you run the command latex on your file, the software automatically figures out which version you're using and does the right things, so both versions use the same latex command.

The output of the latex command, i.e. the typeset document, is a file with the suffix .dvi. It is useful to *preview* your .dvi files *before* printing them out. This practice is strongly encouraged to minimize the paper and toner that are wasted by printing drafts. Within X Windows you can use xdvi for previewing, but if your paper contains pictures that are being drawn by postscript (e.g. trees), you may need to look at the .ps file with ghostview, if the machine you're using doesn't have a recent version of xdvi installed.

Use dvips filename to print .dvi files. You can use dviselect to print only selected pages.

Also, when printing drafts you may want to consider printing two pages next to each other on one piece of paper, with dvips -f filename | psnup -2r | lpr -h -Pvalkyr. You can even print duplex (i.e., on both sides of a piece of paper) by printing to valkyr-d, thus using four times as little paper! Consider making an alias for this:
alias dvip 'dvips -f \!* | psnup -2r | lpr -h -Pvalkyr-d'.

There are also a variety of versions of LaTeX for the Macintosh, e.g. Textures, which also allow previewing (even incrementally).

Tutorials, Macros, etc.

There are lots of LaTeX experts in the linguistics department, and many of them have made available various useful tools, macros, style files, tutorials, etc. that they have developed. You can save a lot of time by taking advantage of this expertise.

The various files mentioned in this section, and more, are available on the Leland system. Check in the directories /usr/pubsw/lib/site-texmf/tex/ and /afs/ir/data/linguistics/tex. If you have an account on Turing, look in /usr/local/lib/texmf/tex/. Some of the older materials in this section assume LaTeX 2.09, not LaTeX2e, so caveat emptor.

On to the goodies. Here's Emily Bender's tutorial:

Here is a short LaTeX example, written by Lynn Cherny and Chris Manning, and revised by Brett Kessler.

Emma's lingmacros.sty provide you with an easy way to do glossed examples, draw trees and do other things that are useful for linguists. The style file itself is well documented. Chris Manning's avm.sty is great for doing AVMs. There's also on-line documentation for it: (.tex file), (.ps file). To use these style files, you don't need to download them; just add the line \usepackage{lingmacros} or \usepackage{avm} after the first line of your LaTeX document. One style file you can include if you need phonetic symbols in your document is called tipa; to use it, just add tipa in with lingmacros and tree-dvips. For documentation, see /usr/local/lib/texmf/fonts/test/source/tipa/doc/tipaman.ps. The Leland system knows about these style files and will load them automatically for you. For more obscure style files, or ones you design yourself, you will have to tell latex explicitly where to find them.

Here's Rob Malouf's collection of LaTeX macros:

Lots more macros from the cmp-lg archive.

Books and other resources

On the web, check out the LaTeX FAQ.

The latest version of the standard LaTeX book:
Leslie Lamport
LaTeX: A Documentation Preparation System, 2nd edition
Addison-Wesley, 1994
ISBN: 0-201-52983-1
272 pages, $32.95
A much better LaTeX book:
Helmut Kopka and Patrick W. Daly
A Guide to LaTeX2e, 2nd edition
Addison-Wesley, 1995
ISBN: 0-201-42777-X
554 pages, $33.95
Another book, recommended by Brett:
The LaTeX companion
Michel Goossens, Frank Mittelbach, and Alexander Samarin
The LaTeX Companion
Addison Wesley, 1994

Back up to the Main Computing Page