Getting started with LaTeX

January 21, 2008
LaTeX

For my first how-to post on LaTeX, I’m going to do a little introduction to help you get set up and started. Moving to LaTeX from traditional word processors like Microsoft Words or OpenOffice.Org necessitates some efforts, but once you’ve succeeded, you get all those fancy-looking equations as a reward!

Getting the software you need

Whatever the platform you’re on, you need two pieces of software for LaTeX: a LaTeX engine and a text editor. LaTeX documents are basically text files that are “compiled” by the LaTeX engine to create dvi, postscript or PDF documents. While you can use almost any text editor to create your LaTeX documents, such as Notepad on Windows or TextEdit on Mac OS, some are optimized for LaTeX and can therefore make you life easier. You might also need a viewer for the output files. LaTeX engines usually produce files in one of three formats: DVI, PostScript or PDF. I recommend outputting in PDF as it usually is more convenient and chances are you already have a viewer. All of the software I list below are free (except for WinEdt).

Windows

First, you need MiKTeX, a LaTeX engine. Then you need to choose a text editor. My editor of choice is TeXnicCenter, but WinEdt (shareware) is also very popular.

You can also download the proTeXt distribution which includes MiKTeX, TeXnicCener and GSView (a PostScript viewer).

Mac OS X

To install to LaTex engine on Mac OS, you first need to download i-Installer and use it to install the gwTeX package. Then you need to install an editor. My favorite is TeXShop, and iTeXMac is another good alternative.

The is also a complete distribution called MacTeX that includes the LaTeX engine (TeX Live 2007), TeXShop and other useful software. The only downside is the size (+700MB).

Linux

On Linux, you need the LaTeX and TeX packages that contain the engine. There are many editors available but the one I used when I was on Linux was Kile and I liked it very much.

Your first LaTeX document

\documentclass{report}

\begin{document}

\title{Introduction}
\author{You}
\maketitle

\tableofcontents

\chapter{Introduction}

You first \LaTeX file! This is a math equation $\alpha=0.1$
embedded in the text.
For a full equation:
\begin{equation}
\phi = \sum_{i=1}^{N} \left[ \frac{a^2_i}{2} \right]
\end {equation}

\section{A section}

This is the text that appears in the section.

\subsection{A sub section}

This is the text that appears in the sub section.

\chapter{Conclusion}

This concluded you first \LaTeX file.

\end{document}

The first line indicates the type of document. In this case it is a report, but it could have been an article or a book. The next line indicates the beginning of the document. The next three lines create the title page, and the one after that creates the table of content. The rest is the body of the document. This example document is quite simple, but you can build on it to make your own and learn.

Where to go from here

LaTeX is not something you can master in one day. I my opinion, the best way to learn is to start small and build on that. Don’t know how to do that symbol, how to put 3 images over a single caption or how to put colors in your document? That’s not a problem, Google is there for that. As long as you know the basics, you’re going to be able to do almost anything by looking it up on Google.

There is one book I would strongly recommend (it saved me a lot of time when I wrote my master thesis):


The LaTeX Companion (Tools and Techniques for Computer Typesetting)

Frank Mittelbach. Addison-Wesley Professional 2004, Paperback, 1120 pages, $64.99

Most of the information in this book can be found using Google, but having it all in a structured book can be a real time saver, especially in the beginning.

I plan to write a series of articles on LaTeX to follow up on this one, so make sure to check back (or subscribe to my rss feed).