Access Keys:

LaTeX on Athena - Basics

Introduction

LaTeX is a program that formats text for printing. It makes producing attractive, professional-looking documents as easy as making a text file. This document introduces you to the principles of LaTeX and teaches you the basic commands.

LaTeX is based on TeX, a sophisticated typesetting program. LaTeX adds a set of commands to simplify using TeX.

Although LaTeX's syntax may not seem very straightforward, its ability to typeset math and foreign characters makes it ideal to use for technical papers. For example, this document was formatted with LaTeX, including all the sections and subsections, the margins and math, etc.

To create a document with LaTeX on Athena you need to:

1. create a source file with a text editor
2. process the source file with the latex program
4. revise your source file as necessary
5. print the final formatted version of the document

This document discusses each of these tasks. After reading this, you should be able to use LaTeX to produce a printed copy of a straightforward paper with title page, quotations, footnotes, and section headings.

This document assumes that you are familiar with the basic techniques of file handling and that you are acquainted with a text editor such as Emacs. There is information on Emacs available in on-line help (type help at the athena% prompt).

Inessential LaTeX, published by the Student Information Processing Board (SIPB, W20-557, 253-7788), was invaluable in compiling this document. Most of the tables of symbols in this document were copied (with permission) directly from SIPB's document. LaTeX: A Document Preparation System, User's Guide and Reference Manual, the official LaTeX Manual (copies are available in the Barker and Hayden libraries), was also used extensively in preparing this documentation. For more information about LaTeX not covered here, see either of these documents.

Producing a Simple Document

The first step in producing a LaTeX-formatted document is to create a plain text file with a text editor such as Emacs. This file must be named with a file suffix of .tex (for example, myfile.tex), so that the programs you will be using will recognize your file as a LaTeX source file. This file will contain:

• the text of the your paper
• commands that tell LaTeX how the paper should be formatted (commands are usually regular English words preceded by the backslash character, \'', like this: \begin)

Produces:

Displayed Math

The Displaymath Environment

If you enclose your mathematical text with pairs of dollar signs, LaTeX displays the math much like a quotation (with increased margins on a line of its own). You may also use the \begin{displaymath} and \end{displaymath} commands.

...when Einstein came up with that doozy of an equation, $$E = mc^{2}$$ he was one happy man.

The displaymath environment is almost exactly the same as the math environment. The two differences are that LaTeX positions the text differently in displaymath and uses larger versions of some symbols.

The Equation Environment

The equation environment is identical to the displaymath environment except that LaTeX adds an equation number in parentheses at the right margin. Equations are numbered sequentially from the beginning of the document.

...when Einstein came up with that doozy of an equation
\begin{equation}
E=mc^{2}
\end{equation}
he was one happy man.

Errors in Processing

Memory Problems

LaTeX is a program that takes a lot of memory to run, that is, the amount of swap space the workstation uses, not the amount of disk space allotted to the user (quota). Many people who run out of memory with LaTeX have interrupted previous LaTeX sessions with Ctrl-Z. This only stops a process, and does not kill it, so it still uses memory. To exit LaTeX, you should type X'' at the prompt you get after it finds an error.

If you are truly running out of memory (i.e., you do not have stopped LaTeX jobs), the only solution is to kill off some other processes you don't want and try again.

File Not Found''

If you get a file not found'' message, enter Ctrl-d to exit (neither Ctrl-z, Ctrl-c, nor `X'' work).

Dealing with Errors

More often than not LaTeX reports an error in the source file. Do not be intimidated by long, complex error reports. Very often the error is trivial and only LaTeX's response is obtuse. When LaTeX finds an error, it prints some relevant information on the screen (and in the .log file), and prompts you for an instruction with a question mark. From this prompt you may type any of the following:

• ? to display a list of commands
• x to exit LaTeX after writing the output created up to the point of error
• i to insert some text at the point where LaTeX stopped
• h to display a help message (if one is available) about the error
• RETURN or ENTER to have LaTeX try to recover and continue on

If you have made a typo in a command, type i correction, where correction is the properly spelled command. This corrects the error for the moment, but the change is not permanent. You need to edit the file to fix the error.

For other errors, try letting LaTeX recover and continue by typing RETURN. If that leads to a string of other errors, type x to exit.

Unless you know what you are doing, do not type e to edit the source file. See the LaTeX Manual for more information.

If you cannot eliminate an error from your source file, consult the LaTeX manual in the cluster documentation racks or a friendly Athena consultant (email olc@mit.edu or call x3-4435).

Sample Files

LaTeX sample files can be found in the thesis locker on Athena. While logged into Athena you can attach it using attach thesis. You can also browse to it via the web at:

http://web.mit.edu/thesis/tex/

IS&T Contributions

January 27, 2016

Get Help

Request help
from the Help Desk
Report a security incident
to the Security Team
Labels:
athena athena Delete
latex latex Delete
m-hermes m-hermes Delete
olc-latex olc-latex Delete