# 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 or vim) 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.
If you choose to install it on your own computer, here are the recommended choices:

The main drawback to installing your own copy of LaTeX is that it’s pretty large and will tie up some disk space — around 3.5 GB, give or take. This will also take some time to download.
I believe LaTeX is 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. If it isn’t currently available on those computers, let me know, and I’ll check with Pete about that.

### Getting the AMS LaTeX TEMPLATE package

Visit the AMS LaTeX Authors page.  Download the AMS LaTeX template distribution (a .zip file) to a convenient directory in your home directory tree. Double-clicking should unzip the file to unpack the 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!