# LaTeX

### What is LaTeX?

Although not as widely known or used in the atmospheric science community as it is in other fields — especially math, physics, engineering, and computer science, LaTeX (pronounced “Lay-Tek” or sometimes “Lah-Tek”) is an established world-wide standard for the preparation of professional quality technical (and other) documents.

LaTeX is especially desirable for typesetting complex math equations and/or complex documents with numerous cross-references to equations, figures, and tables.   A related package called BibTeX facilitates the automated generation and formatting of reference lists.

LaTeX is NOT a word-processing program.  On the contrary, it behaves more like a compiled programming language in that you first use a text editor (e.g., Emacs) to create the LaTeX source for a document, including any needed formatting or typesetting commands, and then you run LaTeX on the source file to generate a high-quality PDF document or other output format.

When creating the source for a LaTeX document, the author concentrates on logical structure and content.  LaTeX then supplies appropriate and consistent formatting according to any of a number of possible class or style options.  By contrast, an author writing a document in Word must be concerned both with content and visual layout (fonts, margins, paragraph formatting, etc.).  Most authors don’t have the training to ensure consistent professional-quality layout.

### Why LateX?

If you want to read more about the pros (and a few cons) of LaTeX, I recommend that you browse the following pages to learn more about what LaTeX is and why I want you to get some exposure to using it:

You will especially appreciate LaTeX if you routinely write papers or other documents utilizing extensive math, as both the quality and speed with which you can typeset complex math equations (once you learn it) is superior to most or all of the alternatives.  And unlike most or all of those alternatives, it’s free!

Many technical journals require manuscripts to be submitted in LaTeX, as this greatly facilitates the final typesetting of the journal article, especially equations.    Neither the American Meteorology Society nor the American Geophysical Union journals require LaTeX (probably because too few atmospheric scientists are familiar with it!) but the AMS and AGU both provide LaTeX template and style files that they encourage authors to use when preparing journal articles.

### Installing LaTeX

LaTeX is free, and it can be readily installed on any commonly used machine, including Windows, Linux, and Mac OS X.  I recommend the TeXLive distribution.   In particular, look at the fourth “bullet point” on the TeXLive page for links to installation information for particular operating systems.

I believe LaTeX is (or soon will be) installed on the lab computers in 1411, so if you don’t want to install LaTeX on your own computer, you can use it there.

### Getting the AMS LaTeX TEMPLATE package

Visit the AMS Manuscript Template page.  Download the LaTeX template distribution (a .tar.gz file) to a convenient directory in your home directory tree.

At the command line, cd to that directory and execute

gunzip AMS_Latex_V3.1.2.tar.gz
tar xf AMS_Latex_V3.1.2.tar

This will create a subdirectory AMS_LaTeX containing style and template files as well as a sample document using the AMS style.

THE FIRST THING YOU SHOULD DO is view two files:  ‘amspaper.pdf’ and ‘amspaper2col.pdf’.  Notice that they both have the same content but are formatted quite differently – one is a double-spaced manuscript, the other looks like a journal preprint.  These were both generated from the same LaTeX source file ‘amspaper.tex‘ with only a minor change near the top of the file! This is one of the powerful features of LaTeX — the ability to impose vastly different visual layouts on the same logical content.  (In this respect, LaTeX is very similar to the use of CSS with HTML on web pages.)

### Running LaTeX on the AMS TEMPLATE files

cd to the AMS_LaTeX directory.  If your LaTeX package is installed correctly, you should be able to execute the following commands:

pdflatex amspaper
bibtex amspaper
pdflatex amspaper
pdflatex amspaper

There is a reason why you have to execute the same command several times – multiple passes are required to construct the reference list and resolve all cross-references.

Depending on what changes you make to your source document between runs, you may or may not have to execute all of the above lines; sometimes once is enough, especially if the change is minor.  The BibTeX command can also be left out unless you have added or deleted references.

Regardless, the final result of the above process is a file ‘amspaper.pdf’, which is the typeset document.    Open this file to view the results.  Initially, it should be a double-spaced manuscript of the type that you would submit to a journal for review.

Now open the file ‘amspaper.tex’ in a suitable text editor (e.g,. Emacs).  Note that all lines beginning with ‘%’ are comments.   Do the following:

1) Comment out the lines containing

\documentclass[12pt]{article}
\usepackage{ametsoc}
\linenumbers

by putting ‘%’ at the beginning of each line.

2) Uncomment the lines containing

%%%%%\documentclass[10pt]{article}
%%%%%\usepackage{ametsoc2col}

by deleting the ‘%’s at the beginning of each line.

3) Save the file and rerun LaTeX on it as before.

Now view the new output file ‘amspaper.pdf’.  You will find that the entire document has been reformatted into a two-column preprint style paper, simply by changing the above lines!

Start by quickly reading the formatted document ‘amspaper.pdf’ itself.

Then compare the LaTeX source file ‘amspaper.tex’ side by side with the above output document.   Examine the LaTeX commands used to achieve a certain effect, such as subscripts, superscripts, math equations, and references, and make a note of those that you are likely to use yourself.

Finally, make a copy of ‘amspaper.tex’ to a new file (e.g., ‘mypaper.tex’), and begin modifying the latter in your text editor.   At frequent intervals, run LaTeX on it to ensure that you haven’t broken anything (e.g., by mismatching parenthesis or by not having matching ‘begin{}’ and ‘end{}’ statements).  The more frequently you run LaTeX, the more quickly you’ll detect any errors you introduced and be able to fix them.

You might want to start by deleting most of the main text, leaving in a few sample section and subsection commands and other useful examples for including figures and tables, but otherwise stripping it down to a nearly bare skeleton of the original document.  Then you can set about inserting your own text.

By this process, you should quickly learn the most common LaTeX commands needed to produce a scientific document.

### University of Wisconsin thesis format

Meeting the strict formatting requirements of the Graduate School for theses and dissertations can be challenging if you use a word processing program like Word.  But if you use LaTeX, correct formatting can be achieved automatically, and cross-references, table of contents, reference lists, and automated numbering of equations, figures, and tables is easy.

Here is the Physics department’s page with links to sample theses in LaTeX format.