LaTeX Setup and Tutorial

Introduction

LaTeX is a markup language, which means it finds little snippets of code in a plain text document and uses that to typeset the text. If you're familiar with HTML, this is exactly what LaTeX is like. If that analogy makes you more confused, perhaps think about it like this: imagine the bits of code in your document are like a book editor's red pen marks, indicating to the publisher how to print the text. When you run LaTeX on your document, it is like sending your manuscript to the printer, with instructions for how to print. They send it back to you as a pdf.

So, great. What do we need? First we need a way to make the manuscript (in the jargon: a tex file (sound like "tech")). Second we need the typesetter/printer to send the manuscript to (in the jargon: a LaTeX compiler). How you accomplish both of these steps depends on your operating system. The instructions below will guide you through the installation of both the compiler and the editor for both Windows and Macs.

To sum up:

• The editor helps you write your .tex file with LaTeX code.
• The compiler reads your .tex file and makes a pretty document.

Windows

the compiler - MiKTeX

The Windows LaTeX compiler is called MiKTeX and it will give your computer the power to compile .tex files. It also manages LaTeX packages, which work very similarly to R packages. MiKTeX is a little scary, but hopefully once you install it, you won't have to deal with it a whole lot. Think of it as setting up a really fast typesetter in your computer.

1. Go to www.miktex.org/2.7/Setup.aspx.
3. Open up the installer and use all the default settings

the (free) editor - Texmaker

The dual-edged sword aspect of LaTeX is that the .tex files are actually just plain text. So, you could just use Notepad or Wordpad or Word or some other program. These are fine, but there are other programs that will greatly expand your productivity in LaTeX. For Windows, we are going to recommend the free editor Texmaker. It has fun stuff like syntax highlighting and buttons on the side with all of the math symbols, so you don't have to look them up every time you write up a problem set. In addition, there are menu buttons and keyboard shortcuts that allow you to compile the .tex file. So, to install:

2. Click on Executable file for win32 systems : texmakerwin32_install.exe.
3. Run the installer and use all of the default settings.
Now that we have an editor, we can fire up some LaTeX and get to your classic hello world program. Start by opening Texmaker and copying into it the following text:
\documentclass{article}
\title{Worlds Apart: Hello Worlds in the Comparative Context}
\author{Matt Blackwell}
\begin{document}
\maketitle
Hello world!
$$f(x)=x^2$$
\end{document}
Now:
1. Save the file in a convenient place as "helloworld.tex"
2. Click on the button labeled "PDFLAT" to run pdflatex
3. Click on the "View PDF" button to open Acrobat to view the resulting PDF

Mac OS X

the compiler - MacTeX

MacTeX is the basic Mac distribution of the LaTeX compiler. A bit of a warning: the download for this is over 1GB, so it might take a bit. In addition, you have drive space limitations, you may want to consider one of the stripped down versions of MacTeX. Wonderfully, MacTeX installs a very slick editor called TeXShop. To obtain this compiler:

1. Go to http://tug.org/mactex/
3. Unzip and run the MacTeX.mpkg file, keeping all the defaults.

the (free) editor - TeXShop

The dual-edged sword aspect of LaTeX is that the .tex files are actually just plain text. So, you could just use any old text editor. These are fine, but there are other programs that will greatly expand your productivity in LaTeX. For Macs, we are going to recommend the editor that comes with MacTex, called TeXShop. It will ease the LaTeX editing and compiling process.

Now that we have an editor, we can fire up some LaTeX and get to your classic hello world program. Start by opening TexShop and copying into it the following text:

\documentclass{article}
\title{Worlds Apart: Hello Worlds in the Comparative Context}
\author{Matt Blackwell}
\begin{document}
\maketitle
Hello world!
$$f(x)=x^2$$
\end{document}
Now:
1. Save the file in a convenient place as "helloworld.tex"
2. Click on the button labeled "Typeset" to run the compiler
You should see a pdf file with a title and all that.

the (free) editor (ii) - Texmaker

You may find TeXShop a bit intimidating. It doesn't have the helpful buttons for bold, italics, math symbols, etc. If you want these features, you can always download Texmaker for Macs and use that. To obtain it: