Access Keys:
Skip to content (Access Key - 0)

LaTeX on Athena - Basics

On this page:

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
  3. preview your document
  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)
  • certain characters that have a special meaning in LaTeX, such as #, $, %, &, _, \, ~, ^, and ,

Once this file has been created, you format it as described in ist:Processing Your Document.

Creating a Manuscript File

There are two commands which every LaTeX source file must have. Unless you're specifying an initial command, the first non-empty line in the source file should begin with the command

\documentclass{doc-class}

where doc-class is one of the four predefined document styles: article, report, book, or letter.

The text of the document itself must fall between the two commands:

\begin{document}

and

\end{document}

These commands divide the contents of the file into two parts:

\documentclass{doc-class}
preamble
\begin{document}
body
\end{document}

  • The part of the source file that comes after the \documentclass command and before the \begin{document} command is called the preamble. It should contain any special style declarations for that document. See Preamble Commands: Changing Defaults for more information about preamble commands.
  • Between the \begin{document} and \end{document} commands is the body of your document.

Any text that comes after the \end{document} command is ignored. You can put comments here if you like.

The bulk of your manuscript file will be the text of your paper or report. When entering plain text (not LaTeX commands or special environments, which are discussed in Environments: LaTeX Command Syntax), there are three conventions to keep in mind:

  • To separate words from each other, simply use a single space. If you leave any extra spaces, LaTeX ignores them unless they follow a full stop character (``.'' or ``?'' or ``!''), in which case LaTeX recognizes an end of sentence. If you need to produce an extra space, there are different spacing commands. See ist:Horizontal Spacing for information.
  • To start a new paragraph, leave a blank line before you start typing the first line of the next paragraph. (A blank line is one that looks blank on your screen, i.e., two *RETURN*s in a row.)
  • To insert comments which are ignored by LaTeX and do not appear in the output, use the % character to precede the text of the comment. A % at the beginning of the line causes the text on that line to be ignored; a % in the middle of a line causes all the text to the right of the % character to be ignored.

LaTeX does the following formatting by default:

  • ignores line breaks and extra spaces in the source file
  • makes appropriate line and page breaks, hyphenating words if necessary
  • justifies the text in each paragraph (adjusts the spacing to line up the text against both margins)
  • leaves no blank lines between paragraphs
  • indents each paragraph, except the first paragraph of a section or subsection
  • produces large, book-size margins
  • sets text in a 10 point font
  • sets text that looks "single-spaced"

This chapter gives you the information necessary to create a document using these defaults. The rest of this document discusses how to override some of these defaults. (In fact, many of them have been overridden in this document for the sake of Athena consistency of style.)

Processing Your Document

Once you have created a source file with an extension of .tex containing the text and commands for your document, you need to have the latex program read it and produce a formatted .dvi file to preview or send to a printer. To process your file with LaTeX, type:

latex filename.tex

at the athena% prompt. You may type the filename with or without the .tex extension.

LaTeX prints preliminary information on your screen, then begins to process your source file:

athena% latex myfile.tex
This is TeX, C Version 3.141 (C version d)
(myfile.tex)
LaTeX Version 2.09 <25 Mar 1992>

If there are no errors in your source file, LaTeX completes its formatting process and the athena% prompt appears again. In this case, LaTeX has created three new files in the current working directory. Each one has the same root name as your source file and a different extension:

  • myfile.dvi contains the formatted document which can be sent to a previewer or a printer.
  • myfile.log contains a record of what happened while LaTeX was processing the source file. The .log file contains more information than the screen messages. You can delete this if you want the space and you're not trying to trace errors.
  • myfile.aux is an auxiliary file used by the latex program. You don't need to read this. If you delete this file, you may have to run your file through LaTeX at least twice next time you process it, although you can delete without harm to your file if you need the space.

Previewing Your Document

If you are using a computer which supports the X Window System, you can use the xdvi program to look at your document on screen. It reads a .dvi file and places a window on your screen which displays on your screen almost exactly what the final copy will look like when printed, so that you can revise your document before printing out a draft. To use xdvi, enter a command of the form:

athena% xdvi filename.dvi &

Here filename.dvi is the name of the file that LaTeX created when it read your .tex file. The following options are available to you when the mouse cursor is in the xdvi window:

  • f causes xdvi to move forward one page
  • b causes xdvi to move back one page
  • pressing and holding down a mouse button magnifies the section of the text around the mouse cursor – the left button shows a small area, the middle button shows a larger area, and the right button a still larger area.

Note that xdvi is not able to display all the fonts that are available. In general, xdvi only displays TeX fonts, even though LaTeX can produce some PostScript fonts, which are available on Athena printers. Instead of stopping (giving error messages and refusing to preview at all) if it can't find the bitmap version of a font (the version needed to display on the screen), it substitutes a similar font.

Printing Your Document

A .dvi file prepared with LaTeX is not in a form ready to send directly to a standard Athena PostScript printer. Before you can send the file to the printer, you must use the dvips program to convert it to PostScript format:

dvips -Pprintername filename.dvi

To print out selected pages of a file, use the -p (page) and -l (last) options to dvips. For example, to print out the pages numbered 22 to 31, you type:

athena% dvips -Pajax -p 22 -l 31 main.dvi

To print out the first 7 pages of the file named main.dvi on the Athena printer ajax, you type:

athena% dvips -Pajax -l =7 main.dvi

Use the = sign before the number to specify a sequence number rather than a real number, so that you print the first 7 pages regardless of how the pages are actually numbered.

Note: If you use an equals sign and get the error "Directory stack not that deep.", put a backslash ( \ ) in front of the equals sign, like so:

dvips -Pajax -l \=7 main.dvi

The HP LaserJets on Athena support the capability for printing on both sides of the page, rather than just one. This is called ``duplex printing." To use dvips to print duplex, use the printer name followed by a ``2", as in most printing commands.

There are many useful options to dvips. Type man dvips for more information.

Doing More With Your Document

Writers know the power of the printed word. Typesetters and publishers know the power of the look of the printed word. Not only do features such as italics and boldface make a document look nicer and more pleasing to the eye, something about a professional-looking document adds weight to the contents. It is worth your while to learn and use some basic typesetting conventions.

Preamble Commands: Changing Defaults

Many popular class options and packages (i.e., sets of LaTeX defaults) are available through the \documentclass and \usepackage command lines:

\documentclass[ist:options]{doc-class}
\usepackage[ist:options]{packages}

Options specified in \documentclass are specific to the document class (book, article, report, or letter) you specify. \usepackage tells LaTex to load packages any document class can use. Square brackets indicate optional arguments, curly braces required. Note that the \usepackage command is not a required part of the preamble. The preamble options available vary from changing font size and type (\documentclass[ist:11pt,times]) to using the fullpage package (\usepackage{fullpage}) to specify normal margins.

You can specify multiple class options, packages, or package options by separating them with a comma.

\documentclass[ist:11pt,twoside]{book}
\usepackage{fullpage,epsfig}

Font Families

For the PostScript fonts, there are LaTeX class options that work as follows:

\usepackage{times}

This line specifies Times Roman as the font family. The following PostScript families are currently available:

avantgarde - Avant-Garde
bookman - Bookman
chancery - Zapf Chancery
helvet - Helvetica
ncs - New Century Schoolbook
palatino - Palatino
times - Times

Changing the Margins

LaTeX's margins are by default 1.75 inches wide on 11pt documents, 1.5 inches wide on 12pt documents, and 1.875 inches wide on 10pt documents. This is the standard for book margins. If you want to change it to 1 inch on all sides, add the fullpage package to your \usepackage line:

\usepackage{fullpage}

Double Spacing

To doublespace a LaTeX document, include doublespace in your list of packages; in other words, if you have:

\usepackage{fullpage}

at the top of your document after your documentclass, change it to:

\usepackage{fullpage,setspace}

Then add "doublespacing" to your documentclass options, like this:

\documentclass[ist:doublespacing]{article}

This makes the text of the whole document doublespaced. Footnotes, figures, and tables will still be singlespaced, however.

In order to make a part of a doublespaced document use singlespacing, you can put:

\begin{singlespace}

and

\end{singlespace}

around the text you want to be singlespaced.

Alternatively, you can omit the "doublespacing" option from your documentclass and then use the following commands throughout your document to change the spacing. Each command is in effect until the next spacing command.

\doublespacing – Double-space any subsequent lines
\singlespacing – Single-space any subsequent lines
\onehalfspacing – 1.5 space any subsequent lines

For example:

\usepackage{setspace}
This line will be single-spaced because that is the default setting.
So will this line
\doublespacing Now these lines will be double-spaced.

And this line

And this line
\singlespacing And now back to single-spacing

Making a Title Page

LaTeX automatically formats title information for you if you supply it with the name of the author and the title of the document. Place the following commands in the preamble (after the \usepackage command and before the \begin{document} command):

\author{author's name}
\title{title}
\date{date}

Then place the \maketitle command in your source file wherever you would like the title to appear (usually at the beginning!). The \date command is optional. Giving the command \today as an argument to the \date command inserts the date on which the file is processed:

\documentclass{article}
\author{Jimi Hendrix}
\title{If 6 was 9}
\date{\today}
\begin{document}
\maketitle
Yeah! Sing a song!
...
\end{document}

In the report and book document styles, the titling is placed on a separate page. In the article document style, the titling appears at the top of the first page.

Chapters, Sections, and Subsections

For any substantial paper, it is helpful to organize the text into parts, such as chapters and sections. The document begins with a \documentstyle command, as mentioned in ist:Creating a Manuscript File. The document style determines the section commands that are available; here are the standards:

  • \part
  • \chapter
  • \section
  • \subsection
  • \subsubsection
  • \paragraph
  • \subparagraph

These commands go in the body of the file at the beginning of the section you wish to label, taking the name of that section as an argument, as in:

\chapter{Introduction}

The article document class does not recognize the \chapter command. Each of the sectional units must come as a subunit of the previous command: don't break chapters directly into paragraphs.

These commands automatically assign numbers in sequence to the sectional units. For instance, the command \section{Environments: LaTeX Command Syntax} would assign a number to the next section.

The \part command is used in long documents, such as a book, for major divisions.

To include an appendix, use the \appendix command; then use the same subunit commands as above. The \appendix command does not take an argument. For example, if you have been using chapters, use the \appendix command, followed by \chapter{Mathematical Symbols}, etc.

To include a table of contents, put the \tableofcontents command in your source file wherever you would like the table of contents to appear. The sections are numbered automatically when you use sectioning commands such as \chapter and \section. When you create a table of contents, you may have to run your document through LaTeX two or three times to make sure it gets numbered correctly. The latex program normally tells you at the end of the process if you need to run latex again. When you have a table of contents, another auxiliary file with the extension .toc is created for LaTeX's reference. (See ist:Processing Your Document.)

Environments: LaTeX Command Syntax

An environment is a region of your source file which LaTeX treats in a special way. There are many LaTeX environments. Any text enclosed by the commands \begin{environment} and \end{environment}, where environment is the name of a LaTeX environment, is considered to be within the named environment and is given the special treatment dictated by the particular environment. For example, LaTeX centers the text in a center environment between the left and right margins instead of making it flush with the margins:

\begin{center}
In the final copy, this sentence will be centered.
\end{center}

If you begin a second environment before ending a first one, the special treatments of both environments are applied to the text that follows (except when the environments conflict). You in fact already know about one environment, the document environment. It is very important; it causes the text in the environment to be put in the printed copy.

Font Faces

To emphasize some text in your document, use the \em ("emphasis") command. It normally italicizes that text, but using \em is preferred to using \it (see below), because you can nest \em commands:

{\em This sentence is {\em emphasized}, with emphasis on the word
{\em emphasized}.}

Produces:

This sentence is emphasized, with emphasis on the word emphasized.

If you want to put a small piece of text in a specific type style, you can do it as follows:

{\em This text will be in italics.}
{\bf This text will be bold!}
{\tt This will be in a "typewriter font."}
{\sf This will be sans serif type.}
{\sl This will be slanted – not italic.}
{\sc This will be in Small Caps.}
{\rm This will be normal, or "roman" type.}

If you want to put larger amounts of text into these type styles, you can use \begin and \end commands:

\begin{it}
All this text will be italicized.
\end{it}

Which produces:

All this text will be italicized.

If you want to be able to "stack" type styles (bold and italic, for example), then you need to use slightly different commands:

{\bfseries This is in bold {\em This is italic bold}}

produces:

This is in bold This is in italic bold

The equivalents to bfseries for the other type styles are rmfamily, sffamily, ttfamily, mdseries, upshape, itshape, slshape, and scshape.

Each of these change one attribute of the font (series and shape for a bold italic). Note that not all combinations of styles will have a font associated with them.

Font Sizes

There are two basic ways to change font sizes in LaTeX. The first way is to change the base font size used all the way through your paper. There are three sizes available for the base size: 10pt, 11pt, and 12pt. (A point is 1/72 inch.) To change the base size (10pt is default), put either 11pt or 12pt in your \documentclass line. For example, if you had:

\documentclass[ist:times]{report}

you would change it to:

\documentclass[ist:times,12pt]{report}

if you wanted to use 12 point type size.

If you want to change just a part of your paper into a different font size, you can use one of the sizing environments. In increasing size, they are:

{\tiny Gnat size.}
{\scriptsize - Cockroach.}
{\footnotesize - Hamster.}
{\small - Rabbit size.}
{\normalsize - Garfield.}
{\large - Irish setter.}
{\Large - Saint Bernard.}
{\LARGE - Hippopotamus size!}
{\huge - White elephant sale.}
{\Huge - Save the whales.}

Two items to note:

  • The case is important in these commands (large, Large, LARGE), as in all LaTeX commands.
  • In some document styles, some of these commands may produce the same size font.

For example, if you wanted to just make a few words of your text in a different font, you would use something like:

This would be in normal text, while {\Large these words would not}.

Or, if you wanted to put a larger region in a different size, you'd use something like:

\begin{scriptsize}
This entire paragraph would be in scriptsize text.
\end{scriptsize}

Centering

Text within the center environment is centered between the left and right margins. To indicate a line break (which is like a RETURN), use a double backslash (except after the last line).

Centered text draws the reader's eye away from the left margin. Avoid overusing the center environment for text; use the other environments which LaTeX provides. Centering is best used for the non-text parts of your documents like figures and tables, and for the titling material. You will learn more about how to do these things later.

Quotations

Use the quote environment for a short quotation and the quotation environment for a longer quote. For each of these environments, LaTeX uses larger left and right margins; in the quotation environment, paragraphs are indented and spaced as they would be in normal text. Here is an example using quote:

... about the Olympians.
\begin{quote}
Athena, born out of the head of Zeus, is the goddess of wisdom, skills, and
warfare. Her Roman name is Minerva.
\end{quote}
Then there was ...

The quote environment produces:

... about the Olympians.
......... Athena, born out of the head of Zeus, is the goddess of
......... wisdom, skills, and warfare. Her Roman name is Minerva.
Then there was ...

Here is an example using the quotation environment:

... about the twelve Olympians.
\begin{quotation}
Athena, born out of the head of Zeus, is the goddess of wisdom, skills, and
warfare. Her Roman name is Minerva.

Zeus is the most powerful of all the ancient gods — ruler of heaven and
earth, of all gods and all men.
\end{quotation}
And the others.

The quotation environment produces:

...about the twelve Olympians.
............... Athena, born out of the head of Zeus, is the goddess of wisdom,
....... skills, and warfare. Her Roman name is Minerva.
............... Zeus is the most powerful of all the ancient gods — ruler of
....... heaven and earth, of all gods and all men.
And the others.

Lists

There are several environments which display their contents as lists. All of them require the item command to begin each list member.

  • The enumerate environment sequentially numbers each list member, beginning each on a new line and indenting them all from the left margin.
  • The itemize environment uses a bullet instead of a number.
  • The description environment is used to specify item labels.

Here is a list environment using enumerate:

\begin{enumerate}
\item Developer
\item Stop bath
\item Fixer
\item Wash
\end{enumerate}

Which produces:

  1. Developer
  2. Stop bath
  3. Fixer
  4. Wash

Here is a list using itemize:

\begin{itemize}
\item Julia Child
\item The Frugal Gourmet
\item Yan Can Cook
\end{itemize}

Which produces:

  • Julia Child
  • The Frugal Gourmet
  • Yan Can Cook

And finally, a description list:

\begin{description}
\item[ist:Fred] The patriarch of this stone-age family, he likes to eat,
especially Brontosaurus burgers.
\item[ist:Wilma] Fred's petite wife who lives to shop.
\item[ist:Barney] Fred's simple-minded next door neighbor and best friend.
\end{description}

Which produces:

Fred
.......... The patriarch of this stone-age family, he likes to eat,
.......... especially Brontosaurus burgers.

Wilma
.......... Fred's petite wife who lives to shop.

Barney
.......... Fred's simple-minded best friend and next door neighbor.

Footnotes

Footnotes are very easy in LaTeX. You simply place the footnote text where you want the footnote number to appear and LaTeX takes care of everything else, including the numbering and placement. To put a footnote into text, just type the command \footnote right where you want the reference number to go:

To put a footnote\footnote{Whether long, short, or medium-sized.}
into text, just type the command \footnote right
where you want the reference number to go.

Punctuation

Special Punctuation

The special characters mentioned earlier as having special meaning in LaTeX may appear in your writing. If you put them in your text file as is, LaTeX tries to interpret them. For most cases, you can get around this by using a backslash in front of the character:

\#  \$  \%  \&  \_  \{  \}

Produces:

#   $   %   &   _   {   }

To get the others, it's a little trickier:

\~{ }   \^{ }   $\backslash$ 

Produces:

~   ^   \ 

See: ist:Math in Running Text for information on formatting mathematical symbols.

Quotation Marks

You may have noticed in books that the double quotation marks are not the same as on a typewriter ("), but rather there is a difference between the left and right quotes: `` and ''. (These are sometimes referred to as 66-99 quotes, because of the way they look in most fonts.) In LaTeX, you can produce them by typing two single quotes. (On many keyboards, the left single quote is at the top left corner of the keyboard, and the right single quote is to the right of the semi-colon.)

If you are in LaTeX mode in Emacs, typing a " produces a `` or '' as appropriate; that is, Emacs knows what LaTeX will process, and keeps track of matching left and right quotation marks. This saves you a keystroke or two. To get into LaTeX mode in Emacs, type M-x latex-mode.

Note: The command notation used here is the same as in the Emacs on Athena document. M-x means hold down the Compose Character or Alt key (depending on your keyboard) and press the x key.

You will see LaTeX in the bar at the bottom of the window, indicating LaTeX mode. Emacs should enter LaTeX mode automatically when you edit a file with the .tex extension. LaTeX mode has other useful features which you can see by typing C-h m once you're in Emacs LaTeX mode.

Dashes

LaTeX can produce three different sizes of dash:

  • Use one dash (-) for an intra-word dash or hyphen.
  • Use two dashes (-) for a medium (en) dash, as in number ranges: 1-2.
  • Use three dashes to get a punctuation (em) dash (---) like this.

Usually there should be no space before and after a dash. Minus signs are different, and are discussed in the math section.

Horizontal Spacing

A space at the end of a sentence should be larger than the space between words within a sentence. You sometimes have to type special commands in conjunction with punctuation characters to get this right, as in the following sentence.

Gnats, gnus, etc.\ all begin with G@. Hogs, horses, ....

The word ``etc.'' should be followed by a "\ " (a backslash and a space) to show that it is not the end of a sentence. The ``G.'', since it is a single letter followed by a ``.'', should be typed G@. to indicate that it is the end of a sentence, otherwise LaTeX would assume it to be an initial, as in E. B. White.

To indicate a space where a linebreak should not occur, use the ~ character, as in E.~B.~White.

To help LaTeX switch from italic to roman type, add a little extra space to cushion the bump using the \/ command.

Foreign Symbols

Many Western languages use symbols and accents that do not appear in normal English. LaTeX provides a convenient method of generating accents and other symbols. Accents can be placed on any existing character. These do not have to be in math mode, i.e., no dollar signs are necessary, as described in the next chapter. (These commands work in LaTeX, even if the results don't show up in your Web browser.)

\'{o} ó
\`{o} ò
^{o} ô
\"{o} ö
~{o} õ
\={o}
\.{o}
\u{o}
\v{o}
\H{a} ã
\t{oo}
\c{c} ç
\d{o}
\b{o}

Some other foreign characters are encoded directly when they cannot be built as combinations. Here are some available foreign language symbols and some special non-English symbols.

\oe
\OE
\ae æ
\AE Æ
\aa å
\AA Å
\o ø
\O Ø
\l
\L
\ss ß
?` ¿
!` ¡
\dag
\ddag
\S §
\P ¶
\copyright ©
\pounds £

Formatting Mathematical Formulas

LaTeX is designed to make it easy for you to typeset mathematical expressions. An advanced user could typeset a math textbook with LaTeX.

A complex mathematical expression is made up of several simpler subexpressions, each of which, in turn, is made up of simpler ones, and so on. If you learn how to write simple expressions and then learn how to combine expressions into larger ones, then you will be able to handle virtually any expression.

Math in Running Text

The simplest expression is a single letter or number, like ``x'' or ``2''. To put a simple expression like that in your text, type $x$ or $2$, which produce x and 2, respectively. Anything between a pair of dollar signs is interpreted by LaTeX as mathematical text. The first dollar sign marks the beginning of the math environment; the second marks the end of it. They are shorthand for the commands \begin{math} and \end{math}.

LaTeX typesets letters in the math environment in an italic font. Numbers are typeset in a roman (normal) font. The spacing rules are also changed so that the text is spaced correctly for math. LaTeX ignores all spaces in the math environment (although you may need to include spaces to signal the end of a command that begins with a backslash). Put spaces in wherever you want; LaTeX does all the spacing itself for math. If you put $ x$ or $ 2 $ in your file, the result would be the same as the first example.

The next step is to write simple equations or inequalities, like this:

$x = 2$
$x=2$
$ x= 2 $
$2x + 7 = 94 - 1$
$x > 52$
$z/(4 + x) - y = M$

Note that the first three equations all look the same in the final copy.

The =, +, >, <, (, ), and / characters all indicate the symbol they look like. In the math environment, a single ``-'' (hyphen) prints as a minus sign.

Some LaTeX commands are only used in a math environment. The following are several of the most useful ones.

Superscripts and Subscripts

Superscripts and subscripts are indicated with the ^ and _ commands, respectively. While they do not begin with a backslash (which is unusual in LaTeX) they take as an argument the text of the superscript or the subscript:

$x^{4}$ x to the fourth power
$y_{4}$ y subscript 4
$x^{y_{4}}$ x to the (y subscript 4)
$x_{4}^{y}$ (x subscript four) to the y power
$x^{y}_{4}$ (x to the y power) subscript four
$E = mc^{2}$ E = mc-squared

Fractions

Fractions are made either with a ``/'' or with the \frac command, which places the numerator directly above the denominator with a horizontal line between. The \frac command takes two arguments, the numerator and denominator:

$1/32$
$\frac{1}{32}$
$\frac{x^{2}}{a(1 + b_{0})}$
$\frac{y + 3z/2}{b}$
$\frac{y + \frac{3z}{2}}{b}$

Greek Letters

A Greek letter is placed in the expression by a command with the name of the Greek letter. For the uppercase version of the letter, capitalize the first letter of the command:

$\theta$
LaTeX is as easy as a little $\pi$.
LaTeX is as easy as a big $\Pi$.
$\Sigma$

Note that $\Sigma$ is not the way to get a summation sign, which is produced as (\sum_{i=1}^{n} x_{i} = \int_{0}^{1} f ).

See the LaTeX manual for more information.

Square Roots

The \sqrt command places its argument in a square root symbol:

$i = \sqrt{-1}$
$\sqrt{a + b\sqrt{2}}$

Other Symbols

LaTeX can make dozens of mathematical symbols, probably every one you've ever seen. If you still need more information, we recommend the books LATEX : a document preparation system or The TeXbook. Both books are available in Barker Library.

Two important ones are the \cdot command, which prints a centered multiplication dot, and the \not command, which places a slash through the following symbol. To write ``a is not an element of B'', for example, type $a \not \in B$. See ist:Foreign Symbols for a list of accents and other non-English symbols.

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/

Related Links

Athena at MIT
Athena Help
Athena Consultants

IS&T Contributions

Documentation and information provided by IS&T staff members


Last Modified:

July 21, 2014

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
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
Feedback
This product/service is:
Easy to use
Average
Difficult to use

This article is:
Helpful
Inaccurate
Obsolete
Adaptavist Theme Builder (4.2.3) Powered by Atlassian Confluence 3.5.13, the Enterprise Wiki