Today’s guest post is by Tim Sherry, a first year PhD student at McGill University who just finished up undergrad at UC Santa Cruz. Be sure to check out his blog, Up Section.

There is only one word processor / document preparation software you should use: LaTeX. No, not latex, it’s pronounced: LAY-TEK. I abandoned MS Word and made the jump to LaTeX my senior year of undergrad. What caused the switch? Placing figures in MS Word sucks. Captions would overlap body text, the numbering system was a fail, ect. There had to be a better way!

I had seen my thesis adviser using some strange program to make documents. She would “compile” documents and a finished pdf would pop up. What?! She turned me on to LaTeX and left me to learn it myself.

Why use LaTeX?

If I had to name only one feature of LaTeX, I would talk about figures. Yea, those little pictures that give a manuscript the punch and kick to bring the reader through the story. Figures in LaTeX are amazing. Why? Here’s an example. Let’s say I’ve written a paragraph that references two figures. Now, what if I decide that Figure 2 should be before Figure 1. In a normal word processor, I would have to move these figures around and retype all the times that I references of Figure 2 into Figure 1 and vice versa. This is tedious and can be time consuming, especially if a figure is referenced several times.

Now let’s say I’ve written that paper with LaTeX. All I need to do is move the code for Figure 2 infront of Figure 1, hit compile, and voila! LaTeX re-numbers everything for me. Simple. Fast. Easy.

What’s good about LaTeX other than totally awesome figure management, you ask? Answer: Formatting. When you’re typing a document in MS Word, you have to format the text yourself. If you want a subheader, you have to highlight that text and change the font style , then change back to your normal body font before continuing to type.

How’s it done in LaTeX? Before the body of your document, code defining the template is typed. Then in the document body, all you need to do type the code for a section header and LaTeX does the rest for you.

Want another reason? Effortless numbering. LaTeX automatically keeps track of Figure, Section, Table, ect. numbers… plus there’s only one line of code to make a table of contents.

I know what you’re saying: “Hold on, you’ve used the word “code” at least three times now. What the hell? I thought this was a word processor.”

How LaTeX works

LaTeX isn’t like a normal word processor. Honestly, it is closer to writing HTML than just typing a document. HTML? But that sounds much harder than typing a normal document! Don’t worry. There’s a bit of a learning curve, but after you’re over that hill LaTeX is faster and cleaner looking documents than anything out there.

The beginning of the document

A .tex file starts with some code defining the layout of the document. Something like:

\oddsidemargin=-0.1in \evensidemargin=-0.1in
\headheight=0pt \headsep=0pt \topmargin=-0.1in
\raggedbottom \raggedright
\parindent=0.7cm \parskip=7pt \mathindent=10pt

Up top, the type of document, or “Document Class” is defined (article, book, slideshow, ect.), as well as the paper size and standard font size. Below that we’ve defined the margins and indents, nothing too crazy, but also not required. Next is a big section of packages. Packages are little useful addons that reference code outside of the document. Makes it very easy to do complicated things like adding math symbols, inserting graphics, or referencing sources. The last line of code defines the style that we want our bibliography to use. In this case it’s a format used by many science journals.

Now that we’ve got our basic document structure, let’s move on to the actual document.  It needs a title and author. Well, there’s a line of code for that:

\title{The Title of My Awesome Paper} %

Defines the title.

\author{That Guy} %

Defines the author.

Ok, now to start the document:

\begin{document} %

This starts the document.

\maketitle %

This makes a title page with title, author, and date(unless specified).

\section{This is my first section} %

This creates uses a header format and creates a section

Then I write some text talking about stuff.

\section{Then I talk about this}

And then I write some more.

\end{document} %

This ends the document.

Click “Compile” and… congrats! You’ve just made your first LaTeX document! Yes, it’s a tad over simplified and will just print a couple lines of text to your pdf, but it’s the basics of almost every LaTeX document.

There’s so much more to LaTeX that it would take me an entire book to talk about. Luckily, someone else has already done that. The best LaTeX source out there is the LaTeX Wikibook. This is the first stop I go to if I get stumped in LaTeX.

Where to get LaTeX? offers links to Mac, Windows, and Linux versions . I’ve mostly used TeXworks, a subset of Pro-TeX and MiKTeX for Windows. I have limited experience with Linux versions and no experience with Mac versions.

Closing Thoughts

I should warn that there is a learning curve with LaTeX. Initially it will take longer to write a document because the code for this and the code for that will need to be looked up. After you have these codes down, the time to prepare a document shrinks exponentially. Why? 1) Once you have a template you like, you can save it for reuse. 2) LaTeX handles the formatting it allowing you to concentrate on what is important: writing.

[Image by Thenub314 and licensed under CC 3.0]