Geoscientist’s Toolkit: LaTeX

A LaTeX file.  Image/text credit: Bill Mitchell.
A LaTeX file. Image/text credit: Bill Mitchell.

LaTeX is a typesetting program used for preparing documents—generally articles and books, but sometimes posters and presentation slides. It is available for Linux, Mac, and Windows, and is free, open-source software. The primary output file format these days is PDF, but other options are available.

When you are putting together a document with figures, citations, and sections which get moved around, it is tough to use a common word processing program and maintain sanity. However, because LaTeX is a markup language (like HTML, the HyperText Markup Language), it is explicit which text is grouped where. For instance, suppose you are trying to have both superscripts and subscripts following a letter, such as in CO32-. If you need to edit the superscripts or subscripts in Word, it can get confused easily. In LaTeX, it is explicit which parts are superscript and which are subscript. A little more work up front saves a lot of frustration later.

Above is a small excerpt from my dissertation, written in LaTeX. I am not sure I would have survived grad school had I attempted to write my dissertation in a word processor.

Yes, there is a learning curve to using LaTeX, and you don’t see changes in the finished document immediately when you make them in your text editor, but there are tons of advantages.

First, the format is all plain text, so it will be readable for a long time and across platforms (although the OpenDocument formats are attempting to make word processor documents future-compatible). Plain text is also very convenient when combined with things like version control software. Track changes isn’t just for word processors!

LaTeX separates the content from the formatting. Most of the formatting is done automatically. Yes, you manually specify that something is a emphasized, or is part of a quote, or a heading, but LaTeX will make sure that the formatting is consistent throughout (unless you intervene), and the defaults are generally good.

One place where LaTeX really shines is in mathematical equations. Greek letters and many mathematical symbols are input as commands such as \beta or \sqrt{n}, so your hands need never leave the keyboard. Once typeset, the equations are neat and properly sized.

Many journals accept submissions in LaTeX, if they do not outright encourage its use, because it is easy to keep the formatting consistent from article to article. The fonts will match, the font sizes will match, and in general things are awesome and look professional.

I have given several presentations made with LaTeX (pdf output). The outline slides are automatically maintained, and slide headers/footers can show where in the presentation you are. Those indicators link to the sections if you click on the section name, and it’s all done automatically. LaTeX is totally worth the effort of learning, and do it soon while you can take your time and experiment. Writing your dissertation while learning LaTeX is a recipe for unhappiness.

So, now that you’re ready to get started, here are some tutorials and reference materials:

It really bothers me when the justification for doing something slow, inefficient, and expensive is “that’s what most people use, and I can’t be bothered to learn something new.” There comes a time to do things differently, and a good ecosystem is one where there are several options based around open standards. Case in point: USB ports are great! The proprietary charger connection on my (old-school) phone? Awful. Lock-in is expensive. Choose open source.

Advertisements