| Main » A not-so-gentle introduction to LaTeX |
|
LaTeX is a horribly-complicated monstrosity which is used to create documents, most commonly scientific ones like all those pretty computational linguistics journal articles you've probably been reading. To misquote Winston Churchill, it has been said that LaTeX is the worst document creator except all the others that have been made. It's annoying to even write the name properly -- who decides to have three capital letters separated by lowercase ones in a name?
However, all hope is not lost: This page is intended to help with questions asked frequently by students working with LaTeX for computational linguistics writing.
I want to know something about XeTeX, a.k.a. I want to make something related to comptational linguistics with *TeX as soon as possible.
Here is a simple example with XeLaTeX with IPA, a tree and an AVM. (No guarantee that the analysis is correct!) Note that it needs a recent version of XeTex to work, such as the one in TeXLive 2008. TeXLive 2007 (which is installed on the computer labs at the moment) is too old!
- All files in a tgz archive — includes qtree.sty and avm.sty, or else get them from Qtree or AVM and save them in the same folder as the TeX file, or install them.
- The XeLaTeX source file
- The PDF it makes
I want to start from scratch and learn everything completely.
There are many good introductions to LaTeX and tutorials for beginners on the Internet (as well as many not-so-good ones); one excellent resource for beginners and advanced users alike is the LaTeX wikibook. A more comprehensive introduction is Tobias Oetiker et al.'s Not So Short Introduction to LaTeX2e.
It should always be remembered that LaTeX is not a WSYIWYG ("what you see is what you get") document editor: You actually write a LaTeX file as source code using a special LaTeX syntax and vocabulary, which is then compiled into your desired document. Therefore, in order to insert most non-alphanumeric characters, special commands are used. An excellent reference for these commands is the Comprehensive LaTeX Symbol List.
NOTE: Due to this nature, the LaTeX compiler even treats periods/full stops in a "special" manner: It assumes that "." always denotes the end of a sentence, adding extra whitespace afterwards. In order to prevent this extra whitespace mid-senence (e.g. when writing abbreviations such as "Prof. Dr..."), add a backslash after the period and before the whitespace (e.g. "Prof.\ Dr...").
LaTeX Editors
Likewise, just as with any other "programming" language, a good IDE can increase your productivity:
- TeXnicCenter (Windows)
- Kile (Linux)
- TeXlipse (plugin for Eclipse IDE)
- LyX (Windows/Mac/*nix)
Extra Packages
LaTeX by itself does not offer much functionality; in order to expand this, third-party packages are used by declaring them in the .tex file preamble, e.g. "\usepackage{amsmath}".
Some more-essential/useful packages for computational linguistics/informatics:
- mathtools
- amsmath
- amssymb
- algorithms
- beamer (document class file, declared as "\documentclass[(options)]{beamer}")
- qtree
- Ralf Vogel has quite a few excellent packages specifically for (computational) linguists.
- Christopher Manning also has a few good style files, including one for creating AVMs.
NOTE: If you're using a standard and (reasonably) up-to-date LaTeX system such as TeX Live or MiKTeX, you will likely already have a number of these packages already installed; you only need to include them in your LaTeX project.
Templates/Examples
It's better to start with a template which you know already works than to re-invent the wheel each time you want to make a document. It's even better to have several templates for different types of documents you write more often.
External Resources
For further information, tips and general help, take a look at these websites:
FAQ
My output file isn't what I expected.
In any general case where you find that your output PDF/PS file is wrong, try deleting all .aux, .toc, and .out files. If using BibTex, also delete any .bbl files.
My citations are question marks [?].
The BibTeX informaton is incorrect for one reason or another. First run (pdf)latex on your .tex file, then run bibtex on your .tex file; take note of any error messages and warnings that are displayed and correct the problem. If there are no error messages, but there are still question marks, run both again: Latex/BibTeX sometimes needs to be run multiple times in order to process all citations.

