=% $Id: guide.tex,v 4.27 2008/11/18 05:32:26 pbaranay Exp pbaranay $
% $Source: /afs/sipb.mit.edu/project/doc/latex/RCS/guide.tex,v $
%
% Copyright 1987-2008
% MIT Student Information Processing Board (SIPB)
%
% The use and redistribution of this Inessential Guide to LaTeX
% is hereby granted with the following restrictions:
% * Bugs should be reported back to the SIPB
%	(send email to sipb@mit.edu)
% * The use of any portion of this guide must be credited to the SIPB
% * The use of this document in its entirety (except for local changes
%	and additions) must maintain the credits, name, and logo of the
%	SIPB and the Inessential Guide to LaTeX.

\documentclass[11pt,twoside]{report}
\usepackage{amsmath}
\usepackage{fancyhdr}
\usepackage{fancyvrb}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}
\usepackage{ifthen}
\usepackage{amssymb,latexsym,stmaryrd}
\usepackage[mathcal]{euscript}
\usepackage{multicol}
% The ifthen macro is for ``page layout parameters'' figure.

% Extract RCS values, defining \rcsRevision and \rcsLocker
\def\rcs$#1: #2 ${\expandafter\def\csname rcs#1\endcsname{#2}}
\def\rcsnull$#1: #2${\expandafter\def\csname rcsnull#1\endcsname{#2}}

% Note: the RCS version is now ``version.incremental'' so if you begin
% revision 5, you should ``ci -u -r5.0 guide.tex'' the first time you
% check in the document; afterwards, just ``ci -u guide.tex''.
\rcs$Revision: 4.27 $

% Remember to set the date by hand:
% %\date{December 19{\font\demo=ptmr {\demo +}\emph{kenta}-partial{\demo
% %+}\emph{merolish}}, 2004}
\date{November 18, 2008}

% Because people are dumb enough to print up copies of document without
% checking in their changes, give them a huge DRAFT if this is still
% checked out.
\rcsnull$Locker: pbaranay $
\ifthenelse{\equal{\rcsnullLocker}{}}
  {}
  {\usepackage{draftcopy}}

% Trademarks and copyright symbols. (What is the point? --jhawk 12/12/2004)
\def\PS{PostScript}
\def\SIPB{SIPB}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
    T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}

% Make from for \LaTeX in header.
\addtolength{\headheight}{2pt}
\setlength{\parskip}{7.2pt} % Why do we set this?

% Set headers and footers.
\pagestyle{fancyplain}  % {plain} won't DTRT on the first pages of TOC and LOF
\lhead{}
\chead{\fancyplain{}{\large Inessential \LaTeX{} }}
\rhead{}
\lfoot[Revision \rcsRevision]{MIT SIPB}
\rfoot[MIT SIPB]{Revision \rcsRevision}

% Set parameters for float (figure) placement.
\setcounter{totalnumber}{666}
\setcounter{bottomnumber}{666}
\def\bottomfraction{.8}

% Section modifications
\setcounter{secnumdepth}{3}	% subsubsections are numbered
\setcounter{tocdepth}{3}	% subsubsections are listed in toc
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\thesection.\arabic{subsection}}
\renewcommand{\thefigure}{\arabic{figure}}
%\renewcommand{\theequation}{\arabic{equation}}

% Special text style commands
\newcommand{\prompt}{\textbf{ athena\texttt{\%}} }	% Athena prompt
\newcommand{\user}[1]{``\textbf{ #1}''}			% Style for user input

% Describe title page

% Allow symbol footnote for title
\def\thefootnote{\fnsymbol{footnote}}

\title {% Sipb Owl Logo
	\vspace{-1in}
	\includegraphics[natwidth=200,natheight=200]{cover-owl.PS}
	\vspace{1in}\\
	{\huge Inessential \LaTeX{} %
	\thanks{\scriptsize
	  Copyright \copyright\ 1987--2008 Student Information
	  Processing Board of the Massachusetts Institute of Technology}}
	\\ {\small (Revision \rcsRevision)}
	\\ {\small \texttt{http://stuff.mit.edu/sipb/ilatex}}
%	\\ {\Huge\bf BLEED ON ME}
}

\author{\large\textbf{The Student Information Processing Board}}
% tightens the description environment:

\newenvironment{tightdescription}
{\begin{description}\setlength{\parskip}{0pt}\setlength{\itemsep}{0pt}}
{\end{description}}

% End of Preamble

\begin{document}

\pagenumbering{roman}

% Title page
\maketitle
\def\thefootnote{\arabic{footnote}} % Return to arabic footnotes
\newpage

% Table of Contents
{
% Produce a compact \tableofcontents
\setlength\parskip{0ex}
\makeatletter
% Use \section* instead of the default \chapter*
\section*{\contentsname
  \@mkboth{%
    \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
\@starttoc{toc}%
\makeatother
}
\vfill

%% List of Figures
%\listoffigures
%\newpage

\newpage
\pagenumbering{arabic}

\section{Introduction}
\subsection{What is \LaTeX{} ?}

\LaTeX{} is a complex text-processing system often recommended by the
\SIPB\ and used for scholarly publishing all over academia, and by many 
of your professors.

There are \LaTeX{} manuals available for use in the \SIPB\ office, and
you're welcome to drop by the office with a question.  There are also
manuals available for short-time loan from the OLC (On-Line
Consultants) office (N42) and some available for withdrawal from the
MIT Libraries. There is also plenty of documentation online 
(see Section~\ref{sec:more_info} on p. \pageref{sec:more_info}).

If you have any comments, additions or corrections to this manual,
please send them to \verb+sipb@mit.edu+ or drop by the \SIPB\ office
(W20-557) and let us know.

\LaTeX{} works by processing a text source file containing formatting
commands, and produces high-quality output. This source file is
created by you, using some kind of text editor. This separation between editing
and processing is a major difference between \LaTeX{} and word
processors like Microsoft Word or OpenOffice, as well desktop
publishing software like Adobe InDesign or Quark XPress, all of which
are ``WYSIWYG''\footnote{What You See Is What You Get} tools.

A major advantage to \LaTeX{}'s non-WYSIWYG interface is the ability
to manage your document as raw text under a revision control system
such as \emph{RCS} or \emph{CVS}, as well as the ability to exercise
precise control over the output in ways that WYSIWYG systems often do
not allow. It is also much easier to produce complex equations.

\subsection{\LaTeX{} on Athena}

You can run \LaTeX{} on any Athena workstation.  Instructions for
setting up your environment and running \LaTeX{} on these platforms
are given in Section~\ref{sec:processing}
(p. \pageref{sec:processing}) of this document.  To get more
information on using other software available on the Athena
workstations, see the \emph{Getting Started on Athena\/} document
available from MIT Copy Tech, and the \emph{Inessential Guide to
Athena\/} available from the \SIPB\ office (W20-557).

Versions of \LaTeX{} can be obtained many other types of machines.
However, many \LaTeX{} distributions for popular platforms are
commercial packages, and their features and usage may differ.
Hopefully, your \LaTeX{} package will come with some instructions for
setting it up and running it.

The version of \LaTeX{} described in this document is version
\LaTeXe{}, which is the version currently supported by Athena and
\SIPB\null.  Version 2.09 is still available in the \verb+newtex+
locker under the name \verb+latex209+.  Section 11 of this document
describes the differences between the two versions.

\section{Getting Started}

This section describes how to typeset a simple paper in the standard
way for processing by \LaTeX{}.  All of the information here is also
presented elsewhere in this document, but with a lot more detail;
think of this section as ``the short form'' to using \LaTeX{}.

The first thing you need to do is to create your \LaTeX{} source file.
This file contains all the text for your paper as well as \LaTeX{}
commands (to be described shortly).  You can use any editor you wish
to create the file; documentation on how to use text editors is
available from Athena.  Emacs includes special code set up to make
using \LaTeX{} easier, and is a good first choice.  You can name your
\LaTeX{} file anything you wish; the only requirement is that it end
with the four characters~\verb+.tex+.

The general format of a \LaTeX{} file is shown in the following
example.

\begin{verbatim}
\documentclass{article}
\usepackage[doublespacing]{setspace}
\usepackage{fullpage}

\title{A Sample Paper}
\author{Melissa I. Thompson}
\date{June 16, 1904} 

\begin{document}

\maketitle

It was a dark and stormy night, and all of the Athena fileservers had
crashed.  Poor me, I had to write a paper for one of my HASS-D
classes.

Luckily, I was able to use a wonderful text formatting program called
\LaTeX{}, and everything worked out fine.
\end{document}
\end{verbatim}

\noindent Here is a description of each part.

\begin{itemize}

\item The first line of every \LaTeX{} file contains a
\verb+\documentclass+ command.  This command tells \LaTeX{} the
general style of your document as well as the style ``options'' you
wish to use.  The word in between \verb+{+curly braces\verb+}+
is the main style.  You can specify options for the style in square
brackets before the main style.  For example,
\verb+\documentclass[12pt]{article}+ would use article document class
in 12 point type.

\item The \verb+\usepackage+ commands specifies additional packages or
to use.  For example, the \verb+doublespace+ package tells
\LaTeX{} to doublespace your document, and the \verb+fullpage+ option
says to set the margins so you have one inch of blank space on all
sides.  You can supply options to these packages in square brackets as
well: \verb|\usepackage[doublespacing]{setspace}|

\item The \verb+\title+, \verb+\author+, and \verb+\date+ commands are
used to specify the title, author and creation date of the document.
The default date is \verb+\today+ (meaning that you don't need to give
the \verb+\date+ command if you just want to use the current date).

\item The \verb+\begin{document}+ line marks the beginning of the
main part of the document.  The section before this line is called
the \emph{preamble}.  More on this later.

\item The \verb+\maketitle+ line tells \LaTeX{} to insert a title page
in the beginning of your document.  The data from each of the
\verb+\title+, \verb+author+, and \verb+\date+ commands is used here.

\item \verb+\LaTeX{}+ is a special command in \LaTeX{}, used to
represent the appropriate magic so that you see ``\LaTeX{}'' instead
of ``LaTeX{}.''

\item The \verb+\end{document}+ line marks the end of the main part of
the document.  In \LaTeX{}, something between
\verb+\begin{+\emph{foo}\verb+}+ and \verb+\end{+\emph{foo}\verb+}+ is
said to be in the \emph{foo} environment (more on environments later).

%%% ALERT: MISSING STUFF
%%% The explanations aren't complete.  The real fix for this is to
%%% coalesce (and/or rewrite) 2 and 3 into one chapter.
%%%
%%% I made a rough attempt to fill them in.  Merging 2 and 3 may still
%%% be `The Right Thing'.
%%% [yandros:95/05/02-04:53:48-EST]

\end{itemize}

\section{Creating your Document}

For \LaTeX{} to know that you are writing a document, you have to give
it some information first.  This section describes what you need to
have in a file to run it through \LaTeX{}.

\subsection{In the Beginning\ldots}
A typical file, such as a term paper, will begin like this:

\noindent
\verb|\documentclass{article}|\\
\verb|\begin{document}|

\noindent This tells \LaTeX{} the following things:

\begin{itemize}
\item This example is an \verb+article+.  The article style may be
used for any kind of standard paper.  An \verb+article+ is shorter
than a \verb+report+.\footnote{This \LaTeX{} guide is a
\texttt{report}.}  The \verb+book+ style also exists.  It is meant for
real books.  These options control section headings and tables of
contents and other things.

\item The main text is printed in a 10 point font by default.  There
are several text sizes available: 10, 11, and 12 point.  This document
is printed in 11 point.  The various \emph{type sizes} within a
document are relative to this base size, as described in
subsection~\ref{subsec:typ} (p. \pageref{subsec:typ}).  If no base size
is specified, 10 point is assumed.  To change to a base size of 11
point or 12 point, change the document class with an optional
parameter, placed inside square braces immediately after the command
name, like this:

\begin{verbatim}
\documentclass[11pt]{article}
\end{verbatim}

\item There are many other optional parameters which can be used, some
of which will be mentioned later.  They are all entered inside the
square brackets and are separated by commas, with no spaces in
between.  For example,
\begin{verbatim}
\documentclass[twoside,11pt]{report}
\usepackage[doublespacing]{setspace}
\end{verbatim}

sets the document up as an 11-point, double-spaced, double-sided
report.

%Most of these options cause corresponding \LaTeX{} 
%\verb+style files+ to be loaded (twoside.sty, doublespace.sty, etc.),
%but some of them are built in to the document type (the \texttt{11pt}
%option is done this way).  You generally won't care about this unless
%you mistype one of the options or some optional package isn't
%available with the current configuration (described later).

\item The space between the \verb+\documentclass+ and the
\verb+\begin{document}+ commands is called the \emph{header area\/} or
\emph{preamble}.  Various control parameters, such as the layout of the
title page (if you want one) go here.  The actual text of your
document begins after the \verb+\begin{document}+.
\end{itemize}

% \subsubsection{Optional Parameters}  

% There are many optional parameters which may be included in the
% \verb+\documentstyle+ line, as in the example above.  These options
% can be combined.  Some of the common ones are:\footnote{Those marked
% with a ${}^{\dagger}$ require a special \verb+TEXINPUTS+ environment
% variable discussed in Section~\ref{texinputs}.}

There are many packages and options which may be included with the
\verb+\usepackage+ line or as an option to
\verb+\documentclass+. Packages can also take options, which are
specified in square brackets before the package name.  You can include
multiple packages with a single \verb+\usepackage+ command.  For
example, \verb+\usepackage[red,blue]{foo,bar}+ would include the
packages \verb+foo+ and \verb+bar+, giving the \verb+red+ and
\verb+blue+ options to both. Some of the common \emph{packages} are:

% XXX ugly --jhawk
\begin{tightdescription}
% \setlength{}{0pt}

\item[setspace] Allows for doublespaceing; defines
\verb+\doublespacing+, \verb+\singlespacing+, and\\
\verb+\onehalfspacing+ for changing document spacing. Also allows them
as options.

\item[fullpage] Sets up 1 inch margins.\footnote{Both
\texttt{fullpage} and \texttt{simplemargins} (see below) are explained
in detail in Section~\ref{sec:margins}, p. \pageref{sec:margins}.}

\item[geometry] Enables commands to simplify modifying the margins.
This gives more flexibility than the \texttt{fullpage} package.

\item[graphicx] Allows you to include PostScript graphics. See
Section~\ref{sec:inclusions} (p. \pageref{sec:inclusions} or
\texttt{texdoc grfguide}).

\item[latexsym] Defines several symbols not defined by default in
\LaTeXe{}.  See Figure~\ref{fig:latexsym} (p. \pageref{fig:latexsym})
for a list of these symbols, or \texttt{texdoc symbols}.

\item[quiet] Will tell \LaTeX{} to run in ``quiet'' mode,
suppressing warning messages.

\vspace{2ex}

\font\demo=ptmr
\item[mathptmx] To format the entire document (with math) in {\demo
Times Roman} font.
\item[times] To format the non-math portions of the document in {\demo
Times Roman} font.
\font\demo=pplr
\item[palatino] To format the non-math portions of the document in
{\demo Palatino} font.
\font\demo=phvr
\item[helvet] To format the non-math portions of the document in
{\demo Helvetica} font. % XXX fails to work w/o textsf?
\font\demo=pncr
\item[ncs] To format the non-math portions of the document in {\demo
New Century Schoolbook} font.
\font\demo=pagk
\item[avantgarde] To format the non-math portions of the document in
{\demo Avant-Garde} font.
\font\demo=pbkl
\item[bookman] To format the non-math portions of the document in
{\demo Bookman} font.
\end{tightdescription}

For detailed documentation on most packages, try \texttt{texdoc
\emph{packagename}}. For an overview of most installed packages, see
\texttt{texdoc index.html}. For details on the fonts, \texttt{texdoc
psnfss2e}.

\noindent
Some standard \emph{options} for \LaTeX{}'s documentclasses:
\begin{tightdescription}
\item[twocolumn] Will print text in two vertical columns, side by side.
\end{tightdescription}

\subsection{Title Page}
To put a title page into a document, you could type the following:

\begin{verbatim}
\documentclass{report}

\title{Inessential \LaTeX{}}
\author{The Student Information Processing Board}
\date{January 1, 1969} % If you use \today, the date may change inadvertently.

\begin{document}
\maketitle
\end{verbatim}

\noindent Creating a title page is a two step process in \LaTeX{}.
First you give it the information you want it to put on the title page
and then you tell it to make the title page.  The \verb+\title+,
\verb+\author+ and \verb+\date+ commands do not generate text---they
merely specify what \verb+\maketitle+ will place on the title page.
If you use \verb+\maketitle+, you must specify a \verb+\title+, but
any or all of the others may be omitted.  The \verb+\maketitle+
command generates the title page.  You must place it after the
\verb+\begin{document}+.  In the \verb+article+ document style, the
title block is at the top of the first page of the document.  To put
the title block on a page by itself place a \verb+\newpage+ command
after the \verb+\maketitle+.  In the \verb+report+ and \verb+book+
styles, it is on a separate page at the beginning.
\label{sec:docclass}

\LaTeX{}  will automatically number pages, but often you don't want a
page number on the title page.  To eliminate the page number on the
first page, put \verb+\thispagestyle{empty}+ before the
\verb+\maketitle+. 

It is possible to number pages alphabetically or with
Roman numerals.  It is also possible to change the current page
number.  See the section of the \LaTeX{}  manual on page styles.

You can also generate a title page using the \verb+titlepage+
environment.  Anything placed in this environment will be placed on the
title page (which will be a separate page even if you are using the
\verb+article+ document class).  Another good way to create a title page
is to do it yourself, probably using commands like
\verb+\begin{center}+, \verb+\large{}+, and \verb+\newpage+.  Using this
method, \LaTeX{} won't know the difference between your title page and
any other page, but it may be easier to get what you want.


\subsection{Body}
The body of the document can be normal text.  Paragraphs are separated
by completely blank lines or by the \verb+\par+ command.
\paragraph{Special characters}
When entering normal text, you must watch out for a few things.  Some
characters are reserved for commands to \LaTeX{}, and are treated as
such unless you tell \LaTeX{} to treat them as normal characters.  To
use the characters
\begin{verbatim}
	# $ % & _ { }
\end{verbatim} % $ %% un-fool emacs font-lock-mode (verbatim vs. math-mode)
outside of a \verb+verbatim+ environment (see Section~\ref{sec:group}
for more information on environments, p. \pageref{sec:group}), you
must precede them with a backslash (\verb+\+), like this:
\begin{verbatim}
	\# \$ \% \& \_ \{ \}
\end{verbatim}

These characters are also reserved:
\begin{verbatim}
	~ ^ \ < >
\end{verbatim}
Often, if you think you want one of these characters, you probably
want to do something else.
\begin{itemize}
\item \verb+~+ can be produced in several ways.  If you want a tilde
	over a character, like \~{n}, you can type \verb+\~{n}+ or
	\verb+\~n+.  If you want a mathematical $\sim$ you can type
	\verb+$\sim$+ (which stands for \emph{sim}\/ilar to).  More
	often you will want the $\sim$ within another math expression
	anyhow; for more detail see Section~\ref{sec:math},
	p. \pageref{sec:math}.
\item \verb+^+ can likewise mean circumflex, as in \^{o} which is
	produced with \verb+\^{o}+ or \verb+\^o+.  In math mode you would use
	\verb+\hat{o}+ to indicate a unit vector. 
\item \verb+\+ is not used very often in normal writing, but you can
	type \verb+$\backslash$+ if you want to use it. 
\item \verb+<+ and \verb+>+ can be written as \verb+$<$+ and
	\verb+$>$+.  If you insert these symbols in your document
	without quoting them as described here, they will appear as
	upside-down exclamation points (<) and question marks (>).
\end{itemize}

\paragraph{Quotation Marks}
Ever notice how typeset material always has nice quotation marks, for
example, ``this'' instead of "this"?  \LaTeX{} can generate these
fancy quotes with just a little effort on your part.  The ``
character, used to start a quotation, is made by typing \verb+``+.
Note that these are reverse quote, or ``back-tick'' characters,
usually found on the upper-left hand side of PC-style keyboards
(however, Sun keyboards puts it in the upper right).  The '' character
is made by typing \verb+''+.  In Emacs, the default mode for \LaTeX{}
files (called \verb+tex-mode+) will generate the proper characters
when you press the \verb+"+ key.  Emacs's \texttt{latex-mode} is
automatically loaded when you load a file ending in \verb+.tex+ that
has a \verb+\documentclass+ command near the top.

\paragraph{Divisions}
Text can be divided into parts, chapters,\footnote{Chapters are
available within \texttt{book} and \texttt{report} but not in
\texttt{article}, so that an article can be included as a chapter.}
sections, subsections, subsubsections, paragraphs, and subparagraphs.
Each division has its own \LaTeX{} command (\verb+\section+,
\verb+\subsection+, etc.).  These commands produce the appropriate
headings and entries in the table of contents, as well as numbering
the divisions.  For normal use, you probably want to use
\verb+section+, \verb+subsection+, and \verb+paragraph+.  The section
\verb+paragraph+ is different from the command \verb+\par+.  A section
command places the title you give it in bold at the beginning of the
paragraph.  The \verb+\par+ command simply marks the beginning of the
paragraph, as would a blank line.

For example, in this document you are currently reading:

\begin{verbatim}
\section{Creating Your Document}
... things that are in the section ...
\subsection{Body}
... things that are in the subsection ...
\paragraph{Divisions}
... things that are in the paragraph ...
\end{verbatim}

If you don't want the division to be numbered in the document, include
an asterisk (\verb+*+) after the division name (e.g. \verb+\subsection*{Body}+).

\paragraph{Table of Contents}
Since \LaTeX{} already has all of this information about the structure
of the document, it can easily collect it and build a table of
contents.  It will only do this if you explicitly tell it to.
\LaTeX{} \ will put the table of contents wherever you include the
line: \verb|\tableofcontents|

To put the table of contents at the beginning (where people expect to
find it) just put it in after the \verb+\maketitle+ command.  You
should run \LaTeX{} at least twice after you add the table of
contents, since it takes two or three tries to get the table of
contents right---once to write all the page numbers out to a
file\footnote{This information is stored in the file ending in
\texttt{.aux}, which some people remove between invocations of
\LaTeX{}.  This causes \LaTeX{} to have to repeat a lot of work, so
you should avoid doing this until you're sure that you won't be
re-running \LaTeX{} again in the near future.}, and a second time to
include those numbers at the beginning of the document, and possibly a
third time if the number of pages the table of contents occupies
changes.

When you make major changes, \LaTeX{} may tell you that you need to
run it twice.  It is always a good idea to do this before you print
the final version of a document, just to make sure everything is
correct.


\subsection{Environments}
You can change how \LaTeX{} treats a certain section of text (for
instance changing the type style).  In \LaTeX{} lingo, you need to
indicate the \emph{scope\/} of the command you are using to change the
\emph{environment}.  For small sections of text, this is done by
starting the \emph{environment\/} with a left curly brace~\verb+{+
character, followed by the command to change the defaults, and ending
with the right curly brace~\verb+}+ character.
	
 For example, to make appear in a {\Large larger font}, you could type
\verb+{\Large larger font}+.  This limits the \emph{scope} of the
large command to the environment within the braces.

 An environment can also be delimited with a \emph{begin--end\/} pair.
This is quite useful for larger sections of text. For example, to
center multiple lines of text (here on the left), you could use the
commands on the right:

\begin{multicols}{2}
%\setlength{\columnseprule}{0.4pt}
\begin{center}
like\\
these two,
\end{center}
\vfill
\columnbreak
\noindent
\begin{verbatim}
\begin{center}
like\\
these two,
\end{center}
\end{verbatim}
\end{multicols}

\noindent The \verb+\\+ at the end of the second line tells \LaTeX{}
to break the line at that point, rather than filling the text
completely between the two margins like it normally does.  It allows
you to force lines to end when you want them to, rather than when
\LaTeX{} wants them to.

\subsection{Ending the Document}
The last thing to put in the document is the line: \verb+\end{document}+

\LaTeX{} ignores anything which follows the \verb+\end{document}+
command.  The only text after this should be comments, since you have
now finished your document.

% Save overfull vbox
\section{Processing your Document}
\label{sec:processing}

\label{texinputs}Once you have written your file and entered all the necessary
\LaTeX{} commands, you have to process the file before previewing or
printing it. 

A graphical frontend to \LaTeX{} named LyX is also available in the
\texttt{lyx} locker.

\subsection{Running \LaTeX{} }\label{sec:run}
%% This is all deprecated, right? jhawk 12/13/2004
% If you have used any special \verb+.sty+ files (the optional packages
% or options mentioned previously) which are only available from \SIPB,
% you must first set an environment variable to let \LaTeX{} know where
% to go to find these files.  The command is:
% 
% \begin{verbatim}
% attach sipb
% setenv TEXINPUTS .:/mit/sipb/lib/tex/macros/:
% \end{verbatim}
% 
% These lines can be placed in your \verb+.environment+ file.  (See the
% Athena document \emph{Essential Dotfiles} for more details).  The
% trailing colon represents a blank path entry, which \LaTeX{} replaces
% with the default path entries.

%%% ALERT: this should probably go SOMEWHERE...
%%% \footnote{\SIPB\ introduced \LaTeX{}  on Athena, which eventually led
%%% to Athena adopting it in the summer of 1989.}

You can process a \LaTeX{} file by typing: \texttt{latex \emph{filename}.tex}
where \texttt{\emph{filename}.tex\/} is the name of your file that
you want to process.  \LaTeX{} produces an output file named
\texttt{\emph{filename}.dvi} (a \textbf{d\/}e\/\textbf{v\/}ice
\textbf{i\/}ndependent file), which can be converted and printed on
various types of printers.

\subsection{Previewing the Final Output}
It is usually convenient to preview your document before printing it.
Running \texttt{xdvi \emph{filename}\&} creates a window which
shows you what the file will look like when it is printed on the
printer.  After you position the \texttt{xdvi} window on your screen,
it should show the first page of the document.  You can use this like
the \texttt{more} command: hit space to go forward a page, and
\texttt{b} to go back a page.  This way you can go back and forth
between the \texttt{xdvi} previewer and the \LaTeX{} source, rerunning
\LaTeX{} and looking at the \texttt{xdvi} display each time
(\texttt{xdvi} automatically notices that you've changed something,
and displays the newest output).

%%% ALERT: this guide was sperated out of iLaTeX{} but isn't distributed
%%% anymore.  Do something about this. [Attic/xdvi.tex --jhawk 12/13/2004]
%%%
%%% For more details about how to use \verb+xdvi+ see the one page guide
%%% at the end of this document.  Using \verb+xdvi+ will prevent you from
%%% having to print out your document each time you want to see what the
%%% final product will look like.

\subsection{Printing the File}
When you are ready to print out the file, you must convert from dvi
format to the format of the printer you are using.  To translate
\texttt{\emph{filename}.dvi} to \PS{}\footnote{\PS{} is the ``language''
understood by Athena printers, and many others.} and send it to your
default printer, use the command: \texttt{dvips \emph{filename}.dvi}

If you have no default printer\footnote{You can check this by typing
\texttt{lpq} and noting what printer it lists.} or you want to send
the printout to a specific printer use the command: \texttt{dvips
-P\emph{printername\/} \emph{filename}.dvi}

\noindent replacing \emph{printername\/} with the name of the printer to
which you want to send your document. 

It is possible to obtain the intermediate \PS{} file with the command:\\
\texttt{dvips -o \emph{filename}.ps \emph{filename}.dvi}

It is possible to select particular pages out of a document, if you
are making changes and want to see what they will look like on paper
(note that \verb+xdvi+ gives a very accurate rendition, and should be
enough for most purposes).  The command:\\ \texttt{dvips
-p\emph{first\/} -l\emph{last\/} -P\emph{printername\/} \emph{filename}.dvi}

\noindent will print from the page numbered ``first'' to the page numbered
``last.''

For more information on {\tt dvips}, type {\tt man dvips} (for the
manual page, brief), or {\tt texdoc dvips} (for the full
documentation).  The older \texttt{dvi2ps} program no longer exists on
Athena.

\subsection{Producing PDFs and Web Pages}

The Adobe Portable Document Format is now the lingua franca of much of
the world; \LaTeX{} has several ways to produce PDF documents
(whichever you choose, be sure to inspect the PDF file to make sure it
came out ok):

\begin{enumerate}
\item Typing {\tt pdflatex \emph{filename}.tex} will run a special
version of the \LaTeX{} interpreter that handles PDF files and produce
\texttt{\emph{filename}.pdf}. It the easiest choice, but it has some
limitations with respect to included images; see below.

\item If the other methods gets a symbol wrong (as may happen), try the
longer approach of creating a PostScript file and producing the PDF from
that.  Create the PostScript file with {\tt dvips -P pdf -G\rlap{/}0
\emph{file}.dvi}. On Sun machines, you can create the PDF with Adobe's
commercial software with {\tt add acro; distill \emph{file}.ps}; on
other machines, you must use the free software equivalent, {\tt add
gnu; ps2pdf \emph{file}.ps}.

\item The {\tt dvipdfm} utility will produce a PDF file from a DVI
file. First {\tt latex \emph{filename}.tex} to produce the DVI file,
and then {\tt dvipdfm \emph{filename}.dvi} to produce the PDF.\\ See
{\tt texdoc~dvipdfm} for the full documentation\footnote{Do not
confuse {\tt dvipdfm} with the {\tt dvipdf} program in the {\tt
ghostscript} locker, which actually runs {\tt dvips} and {\tt
ps2pdf}.}; it cannot include most PostScript images without special
care.

\end{enumerate}
 
\subsubsection{pdflatex limitations and specifics}
See \texttt{texdoc pdftex} for a full explanation of
\texttt{pdflatex}.  The most striking limitation is that {\tt
pdflatex} cannot import PostScript images -- instead, you need an image
in PDF, PNG, JPEG, or TIFF format.

To put figures in your document, you can make them available to {\tt
pdflatex} as their own PDFs, using {\tt epstopdf} (see
Section~\ref{sec:inclusions}, p. \pageref{sec:inclusions}).

To encode hypertext references in your PDF, you can use the {\tt
hyperref} package and use
\verb|\href{|\texttt{\emph{URL}}\verb|}{|\texttt{\emph{text}}\verb|}|
in the same
way you write the equivalent HTML prose.

To put in your own PDF bookmarks, use
\verb|\pdfbookmark[|\texttt{\emph{n}}%
\verb|]{|\texttt{\emph{title}}%
\verb|}{|\texttt{\emph{internal\_label}}%
\verb|}|, with
\texttt{\emph{internal\_label}} serving as a label for any \verb+\ref+
references you want to put in.

\subsubsection{Web documents from LaTeX source}
The {\tt latex2html} program, available on the Web and on Athena in
the {\tt infoagents} locker, is a Perl script that generates a set of
HTML pages from a Latex document. It can make a single Web page, or a
set of them, with a page for each section, subsection or so on and so
forth.  To generate a Web page set based in the directory {\tt
dstdir}, from a document {\tt \emph{file}.tex}, type {\tt latex2html -d
dstdir \emph{file}.tex}. This will generate a whole tree of HTML files for
each subsection. The control how deep the tree should go, there is the
{\tt -split} option.  For a single HTML page, set it as {\tt -split
0}.  For more information, type {\tt latex2html -help}.

% \paragraph{Printing for non-Athena Printers}

% Currently available in the \verb+outland+ locker\footnote{The
% \texttt{outland} locker is maintained by the \SIPB\ and many other
% contributors, and generally holds programs that are unsupported or in
% testing.  Please read the file \emph{/mit/outland/README} for more
% information on the support policy.} is a suite of tools to convert DVI
% files to HP LaserJet or IBM 3812 format, suitable for printing on many
% home printers.  For more information on this suite of tools, you can
% currently do:

% \begin{verbatim}
% add outland
% man dvi2xx
% \end{verbatim}

\subsection{Landscape (or Sideways) Mode}
% XXX jhawk: Is this really the right way? ``rotation''?
If you want to print your document ``sideways,'' with the text running
parallel to the long edge of the paper, simply include 
\begin{verbatim}
\special{landscape}
\end{verbatim}
in the preamble of your document.  You also need to set the margins to
correspond to this new paper size (11x8.5$''$ instead of 8.5x11$''$). 
See Section~\ref{sec:margins} for details on changing
them, p. \pageref{sec:margins}.

\subsection{Using Both Sides of the Paper: Duplex and Tumble Modes}

Two-sided printing has two modes. In \emph{duplex} printing, the pages
are printed such that the pages read correctly when turned over the
long axis (as in a book). In \emph{tumble} mode (also known as
short-edge duplexing), pages read correctly when turned upwards (as in
a legal notepad). The orientation will obviously be somewhat different
if the printout is landscape mode instead of portrait mode.  For most
uses, the duplex mode is the more fitting.

With \verb+dvips+, you can print in \emph{duplex} or \emph{tumble} mode
by using the \verb+-h+ option:

\noindent
\texttt{dvips -h duplex filename.dvi}\\
or \texttt{dvips -h tumble filename.dvi}

If you always want your document to be printed two-sided, you can
include one of the following commands in your document preamble:

\noindent
\verb+\special{header=duplex}+\\
\verb+\special{header=tumble}+


\section{Error Messages}
The error messages produced by \LaTeX{} are the most confusing part of
using it.  Most people have trouble understanding what \LaTeX{} is
telling them.  This section describes some of the more common errors,
what they mean, and how you can fix the problem.

In general, when an error occurs you should hit return to see if
\LaTeX{} will keep on going, or enter \verb+x+ to exit.  If \LaTeX{}
is asking for a filename, \verb+Control-D+ will help exit \LaTeX{}.
If \verb+x+, \verb+^C+, and \verb+^D+ do not return you to your
\verb+athena%+ prompt, type \verb+^Z+.  In order to kill the
\emph{stopped\/} process you need to do the following (assuming that
you use \texttt{csh} or one of its descendants):
\begin{verbatim}
athena% kill %latex
athena% 
[1]  + Terminated           latex
athena%
\end{verbatim}
By hitting \emph{return} when you get your prompt back you should get
the message that \LaTeX{} was indeed killed.

\subsection{\LaTeX{}  errors}
There are two kinds of errors: \LaTeX{} errors and \TeX{} errors.
\TeX{} is the language in which \LaTeX{} is written, and some of the
basic errors come from there.  All errors have an error message which
starts with an exclamation point.  A \LaTeX{} error can be
distinguished from a \TeX{} error by the following:
\begin{verbatim}
! LaTeX error: <error message here>

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

\end{verbatim}
\noindent The error message is printed on the next line, which starts
with a number and then the text of the line that caused the error.  The
part of the number after the decimal point is the line number where the
error occurred.  If you cannot figure out what the problem is by looking
at the error message, you can go to the offending line in the original
document and look at it.  The problem may lie a few lines above the one
which \LaTeX{} complained about.  The error message should make more
sense after you have looked at the offending text.

Some of the more common error messages are:

\begin{verbatim}
! \begin{...} ended by \end{...}.
\end{verbatim}

\noindent This is usually caused by forgetting to end an environment which
was started by a \verb+\begin+ command.

\begin{verbatim}
!  Can be used only in preamble.
\end{verbatim}

\noindent Certain commands can only be entered before the
\verb+\begin{document}+ statement.  This part of the file is called
the \emph{preamble}.  Move the offending statement to the preamble and
try again.


\begin{verbatim}
!  Environment ... undefined.
\end{verbatim}

\noindent An environment defined in a \verb+\begin+ or \verb+\end+
statement is not recognized.  This is usually caused by a spelling
error.

\begin{verbatim}
!  Missing \begin{document}.
\end{verbatim}

\noindent All files must have a \verb+\begin{document}+ before any
text which is intended to be printed.

\subsection{\TeX{} errors}

\begin{verbatim}
!  I can't find file `...'.
\end{verbatim}

\noindent This often indicates that the file name was mistyped or that
you are not in the correct directory.  \TeX{} will wait for you to
type in a file name.  If a mistake was made, and you want to abort the
command, you will need to hit \verb+^D+ which will cause an
``Emergency stop'' when \TeX{} is waiting for you to type something.

\begin{verbatim}
!  Missing { inserted.
!  Missing } inserted.
\end{verbatim}

\begin{verbatim}
!  Missing $ inserted.
\end{verbatim} % $ %% un-fool emacs font-lock-mode (verbatim vs. math-mode)

\noindent This usually occurs if a command was typed which can only be
used in math mode.  \LaTeX{} can be allowed to continue, but the
output will look strange.  The offending command should be put into
math mode by surrounding it with dollar signs, like: \verb|$\sum$|

\begin{verbatim}
! Undefined control sequence.
l.7 \auhtor{The Student Information Processing Board}
\end{verbatim}

\noindent The command \verb+\auhtor+ on line seven is misspelled and
so \LaTeX{} does not recognize it.  If \LaTeX{} does not recognize a
command you used, but you think it exists, check the documentation
again to make sure you are using the command correctly.


If you cannot figure out what is wrong, give the \SIPB\ office a
call,\footnote{Our phone number is 253-7788, or stop by W20-557---just
outside the Student Center cluster.} or try the Athena
Consultants.\footnote{On-line, type \texttt{olc} or call 253-4435.}
The Zephyr \texttt{help} class is also often useful; see the document
\emph{Inessential Zephyr} for more details on using zephyr classes and
instances.

\subsection{Warnings}

Warnings do not cause \LaTeX{} to stop processing the document, but
preview the output before printing your final version to make sure the
output is acceptable.  Below are some common warnings, followed by
explanations. In general, \TeX{} is probably more of a perfectionist
about wanting to get your spacing right than you are, so you shouldn't
worry if it complains about overfull/underfull when it looks fine to
you.


\begin{verbatim}
Overfull \hbox (24.30751pt too wide) in paragraph at lines 6--9
\end{verbatim}

\noindent This occurs whenever a line is too wide the available
horizontal space (e.g. margins, or special boxes). \LaTeX{} will
produce a line that is too wide when it cannot find an acceptable
place to insert a line break.  Use \verb+xdvi+ to look at the output,
then change the file if necessary.

\begin{verbatim}
Underfull \hbox (badness 10000) in paragraph at lines 6--18
\end{verbatim}

\noindent This error is similar to \verb+Overfull \hbox+.  It occurs
when \LaTeX{}  is forced to put lots of space between words to justify
the text.  This usually happens when a paragraph is not properly ended
before certain kinds of environments (like forcing a carriage return with
\verb+\\+).  Inserting a blank line or a 
\verb+\par+ command after the offending paragraph should fix it.

\begin{small}
\begin{verbatim}
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
\end{verbatim}
\end{small}

\noindent This occurs when page numbers change from one running of
\LaTeX{}  to another.  Simply re-run \LaTeX{}  to resolve the problem.
Occasionally, \LaTeX{}  will have to be run twice in a row to clear up
the problem.


\section{Other useful things to know about}
\label{sec:group}

\LaTeX{}  is very powerful.  There are commands to do
almost anything.  This guide is an attempt to explain many of the
commonly used commands.  Below you will find information that should
help you produce papers with \LaTeX{}.  

\subsection{Margins}
\label{sec:margins}

\LaTeX{} has very large default margins---almost two inches wide on
each side.  Most people don't like them.\footnote{\ldots but people writing
books or theses often need them.}  Fortunately, \LaTeX{}'s margins can
be changed.  An easy way to use more of the page is to use the
\verb+fullpage+ option to \verb+documentclass+ (see
Section~\ref{sec:docclass}, p. \pageref{sec:docclass}).

To set uniform margins, use the \texttt{geometry} package:
\verb|\usepackage[margin=1.5in]{geometry}|

For nonuniform margins, these options are available:\\
\verb|\usepackage[top=.8in,bottom=.8in,left=1in,right=2.54cm]{geometry}|

For full details, see \texttt{texdoc geometry}.



\subsection{Type Styles}
\VerbatimFootnotes

There are several different type styles available in \LaTeX{}:
\textbf{ bold} (textbf), \textsf{sans serif} (textsf),
\textsl{slanted\/} (textsl), \textsc{small caps} (textsc),
\texttt{typewriter} (texttt), \textit{italic\/} (textit), and the
default, roman (textrm). In general, \textit{italics} should be
produced with \verb+\emph{}+ rather than \verb+\textit{}+.\footnote{%
%
This is because \verb+\emph{}+ is about logical structure, and
\verb+\textit{}+ is about a visual property. In some contexts, the
visual properties associated with emphasis may change, and text
formatted as \verb+\emph{}+ will change appropriately.} 

To use one of these type styles simply use the appropriate command as
shown in the following example.

\begin{tabbing}
\hspace{2.5in}\=\kill

The following lines:		\> Are produced by:\\

\textbf{This is bold type.}	\> \verb+\textbf{This is bold type.}+\\
\textsf{This is sans serif type.}	\> \verb+\textsf{This is sans serif type.}+\\
\textit{This is italic type.}	\> \verb+\textit{This is italic type.}+\\
\textsl{This is slanted type.}	\> \verb+\textsl{This is slanted type.}+\\
\textsc{This is Small Caps type.}	\> \verb+\textsc{This is Small Caps type.}+\\
\texttt{This is typewriter type.}	\> \verb+\texttt{This is typewriter type.}+\\
\textrm{This is normal, roman, type.} \> \verb+\textrm{This is normal, roman, type.}+
\end{tabbing}

You will notice that there is no underline style.  This is
intentional, since underlining is not normally used in a typeset
document.  Titles (and other text normally underlined in hand-written
documents) are properly emphasized with the \verb+\emph+ command.%
%
\footnote{If you really want to get \underline{underlining}, \LaTeX{}
supports \verb+\underline{+\emph{text to be underlined\/}\verb+}+, but
that command is ``fragile'' and doesn't break across lines. A better
choice is \verb|\usepackage{ulem}|, which defines
\verb+\uline{+\emph{text\/}\verb+}+, and several others. For detailed
documentation, see \texttt{less `kpsewhich ulem.sty`}.}

\subsection{Type Sizes}\label{subsec:typ}
The type size can be controlled as well.  If you want to change the
size as well as the style, you must set the size first, and
then the style; to get a large bold type style, type
\verb+{\large\bf +\emph{text\/}\verb+}+.

\vspace{-1pc}
\begin{tabbing}
\hspace{3.25in}\=\kill
The following sizes:		\> Are produced by:\\
{\tiny This is tiny type.} \> \verb+{\tiny This is tiny type.}+ \\
{\scriptsize This is scriptsize type.} \> \verb+{\scriptsize This is scriptsize type.}+ \\
{\footnotesize This is footnotesize type.} \> \verb+{\footnotesize This is footnotesize type.}+ \\
{\small This is small type.} \> \verb+{\small This is small type.}+ \\
{\normalsize This is normalsize type.} \> \verb+{\normalsize This is normalsize type.}+ \\
{\large This is large type.} \> \verb+{\large This is large type.}+ \\
{\Large This is Large type.} \> \verb+{\Large This is Large type.}+ \\
{\LARGE This is LARGE type.} \> \verb+{\LARGE This is LARGE type.}+ \\
{\huge This is huge type.} \> \verb+{\huge This is huge type.}+ \\
{\Huge This is Huge type.} \> \verb+{\Huge This is Huge type.}+
\end{tabbing}

% XXX talk about NFSS? --jhawk -- texdoc fntguide?

\subsection{Footnotes}

	Footnotes are very easy in \LaTeX{}.  You simply place the
footnote text where you want the reference to appear and \LaTeX{}
takes care of everything else.  This sentence and
footnote\footnote{See?  It's a footnote.} were created by typing the
following:
\begin{small}
\begin{verbatim}
This sentence and footnote\footnote{See? It's a footnote.} were created
by typing the following.
\end{verbatim}
\end{small}
Don't use footnotes for citations though. See Section~\ref{sec:cite}
(p. \pageref{sec:cite}) for details.

\subsection{Tables}

	\LaTeX{} has a simple method for generating all sorts of
tables.  You give it one command to tell it how to set up the table
and then give it the data.  You specify how many columns the table is
going to have, what to do to the data within each column as well as
how to separate each column.  When you enter the data you give one row
at a time.  The character ``\verb+&+'' comes after each data field and
``\verb+\\+'' marks the end of a row.  Here are several examples of
what is possible and how to create them.

\begin{multicols}{2}
\begin{tabular}{clr}
a& b& c\\ aa& bb& cccccc\\
aaa& 
bbb& ccc\\
\end{tabular}

\columnbreak

\begin{verbatim}
\begin{tabular}{clr}
a& b& c\\ aa& bb& cccccc\\
aaa& 
bbb& ccc\\
\end{tabular}
\end{verbatim}

\end{multicols}

This is a table with three columns.  In the first column the data are
centered, in the second they are left justified and in the third they
are right justified.  This was done by entering \verb+{clr}+.
Changing what is in these curly braces changes the number of columns
and how each one is formatted.    Notice that the line breaks in the typed text
make no difference to \LaTeX{}.  Rows are separated by the \verb+\\+
character and the columns within the rows are separated by the \&
character.


	You can also have boxes around the table and lines separating
the columns if you like.  \LaTeX{} will put vertical lines wherever
you put a \verb+|+ in the column specifications.  \LaTeX{} has two
commands for creating horizontal lines in tables.  \verb+\hline+
creates a horizontal line across the whole table.  \verb+\cline{m-n}+
creates a horizontal line from the beginning of column \verb+m+ to the
end of column \verb+n+.

\begin{multicols}{2}
\begin{center}
\begin{tabular}{||c|l||r||}\hline
a& b& c\\ \cline{2-3} aa& bb& cc\\
\hline aaa& 
bbb& ccc\\ \hline\hline
\end{tabular}
\end{center}
\columnbreak
\begin{verbatim}
\begin{center}
\begin{tabular}{||c|l||r||}\hline
a& b& c\\ \cline{2-3} aa& bb& cc\\
\hline aaa& 
bbb& ccc\\ \hline\hline
\end{tabular}
\end{center}
\end{verbatim}
\end{multicols}

\subsection{Lists}

	There are four different types of lists in \LaTeX{}.  The
following is an example containing all four.
 
\begin{multicols}{2}
\begin{description}
\item [Enumerate] will give you a numbered list.
\begin{enumerate}
\item You can nest lists in \LaTeX{} \
\begin{enumerate}
\item You can even sub-nest lists
\item and it changes how they are counted
\end{enumerate}
\item up to four levels deep
\end{enumerate}
\item [Itemize] produces a list with bullets
\begin{itemize}
\item Some people like bullets.
\item Others do not.
\end{itemize}

\item [Description] is what you use when you want to describe a
list of items.  This list of \verb+list+ environments is an example of
a \verb+description+.  Notice that it will make the items you are
describing appear in bold faced type.

\item [List] If you do not like any of these possibilities you can
modify the \verb+list+ environment to create your own.  See the 
\LaTeX{}  manual for more information.
\end{description}
\end{multicols}

\noindent The following text was used to create the previous example
(the entire example is columnized with the \texttt{multicol} package;
see \texttt{texdoc multicol}).  We have broken it up to add comments
and explanations of some of the more obscure commands.


\begin{verbatim}
% The percent sign is the comment character in LaTeX.  LaTeX ignores
% everything on a line following a % character.
\begin{description}

% Notice the brackets and braces; {} are very different from [] in LaTeX

\item [Enumerate] will give you a numbered list.

\begin{enumerate}
\item You can nest lists in \LaTeX{} 
\begin{enumerate}
\item You can even sub-nest lists
\item and it changes how they are counted
\end{enumerate}
\item up to four levels deep
\end{enumerate}

\item [Itemize] produces a list with bullets

\begin{itemize}
\item Some people like bullets,
\item while others do not.
\end{itemize}

\item [Description] is what you use when you want to describe a
list of items.  This list of \verb+list+ environments is an example of
a \verb+description+.

\item [List] If you do not like any of these possibilities you can
modify the \verb+list+ environment to create your own.  See the 
\LaTeX{}  manual for more information.
\end{description}
\end{verbatim}


\section{Documents in Foreign Languages }\label{sec:lang}

\LaTeX{} is very useful for writing documents in foreign languages.
\LaTeX{} can theoretically support any language.  However, in reality,
there is hyphenation support for only a few dozen.  The standard
version of \LaTeX{} \ supports the English language, and it can
hyphenate most English words correctly.
%% I can't imagine this is really true. -- jhawk 12/13/2004
% \SIPB\ has a version of \LaTeX{} which can hyphenate a document
% written in German, and we are working on getting French and Spanish
% versions.
The English version can be used to produce foreign language documents,
but be warned that hyphenation will be according to rules of the
English language.

\paragraph{International characters}
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.  Figure~\ref{fig:accents} shows accents
that can be placed on any existing character---simply replace the
\verb+o+ in the curly braces with the letter you wish to accent.

\begin{figure}[hbt]
\begin{center}
\begin{tabular}{clclclclclclcl}
\'{o} & \verb+\'{o}+&
\`{o} & \verb+\`{o}+&
\^{o} & \verb+\^{o}+&
\"{o} & \verb+\"{o}+&
\~{o} & \verb+\~{o}+&
\={o} & \verb+\={o}+&
\.{o} & \verb+\.{o}+\\
\u{o} & \verb+\u{o}+&
\v{o} & \verb+\v{o}+&
\H{o} & \verb+\H{o}+&
\t{oo} & \verb+\t{oo}+&
\c{o} & \verb+\c{o}+&
\d{o} & \verb+\d{o}+&
\b{o} & \verb+\b{o}+\\
\end{tabular}
\end{center}
\caption{Accents}\label{fig:accents}
\end{figure}

Some other foreign characters are encoded directly, when they cannot
be built as combinations.  Figure~\ref{fig:syms} shows foreign-language
symbols which are available, and Figure~\ref{fig:spsyms} shows some
special non-English symbols.  Note that these characters cannot
immediately be followed by other characters, so you must follow them
with a space or with empty curly braces, as in:

\L{}ukasiewicz invented prefix (Polish) notation.

\noindent which is produced by

\begin{verbatim}
\L{}ukasiewicz invented prefix (Polish) notation.
\end{verbatim}

\begin{figure}[hbt]
\begin{center}
\begin{tabular}{clclclclcl}
\oe & \verb+\oe+ &
\OE & \verb+\OE+ &
\ae & \verb+\ae+ &
\AE & \verb+\AE+ &
\aa & \verb+\aa+ \\
\AA & \verb+\AA+ &
\o & \verb+\o+ &
\O & \verb+\O+ &
\l & \verb+\l+ &
\L & \verb+\L+ \\
\ss & \verb+\ss+ &
?` & \verb+?`+ &
!` & \verb+!`+\\
\end{tabular}
\end{center}
\caption{Foreign language symbols}\label{fig:syms}
\end{figure}

\begin{figure}[hbt]
\begin{center}
\begin{tabular}{clclclclclcl}
\dag & \verb+\dag+ &
\ddag & \verb+\ddag+ &
\S & \verb+\S+ &
\P & \verb+\P+ &
\copyright & \verb+\copyright+ &
\pounds & \verb+\pounds+ \\
\end{tabular}
\end{center}
\caption{Special Language Symbols}\label{fig:spsyms}
\end{figure}

\section{Mathematical Text and other Special Symbols}\label{sec:math}

Equations can be inserted into your text in several ways.  Placing
\verb+$+\ldots\verb+$+ or \verb+\(+\ldots\verb+\)+ or
\verb+\begin{math}+ \ldots \verb+\end{math}+ around the mathematical
expression or special symbol allows you to place it in a line of
normal text.  This will use the variable-sized symbols (see
Table~\ref{op}, p. \pageref{op}; and Figure~\ref{fig:varsym-extra},
p. \pageref{fig:varsym-extra}), and adjust the size of the formula as
necessary.  It will also adjust other things.  For example, to place
$\sum_{i=1}^n$ in a line of text, \LaTeX{} puts the ``$i=1$'' to the
right of the $\sum$ instead of underneath.  Placing
\verb+\[+\ldots\verb+\]+ or \verb+\begin{displaymath}+\ldots
\verb+\end{displaymath}+ around the expression will center it and set
it off from the rest of the text, using the larger symbols.




To create a simple equation, for example $ F=ma $, you need only type
\verb+$ F=ma $+.  For more advanced formul\ae, like $ E=mc^2 $, you
need to tell \LaTeX{} to superscript the 2.  The \verb+^+ character
instructs \LaTeX{} to raise a superscript, and the \verb+_+ character
instructs \LaTeX{} to lower a subscript.

For example, \verb+$ E=mc^2 $+ is used to produce $E=mc^2$.  Likewise
\verb:$ x_{k+1} $: is used to produce $ x_{k+1}$.

If you want to put more than one character in the superscript or
subscript, you need to group them, using \verb+{+ and \verb+}+ as in
the examples above.  To print something with both superscripts and
subscripts, like $ _{238}U^{+4} $, just type \verb|$ _{238}U^{+4} $|.
Anything can go into the brackets, and \LaTeX{} will figure out what
to do with it: $ x^{35+9^{y_{z}}+4_{z}}_{1997} $ requires the hideous
expression \verb|$x^{35+9^{y_{z}}+4_{z}}_{1997}$|, but if you look
carefully it should be clear what is happening.  To get the prime
($'$) symbol in math mode, type an apostrophe (\verb+'+).  Try some
complex expressions of your own, and see how easy they are to create.
There are many symbols not found on the keyboard to help you in
formatting just about any kind of formula.  See Tables~\ref{bin},
\ref{rel}, \ref{arrow} and \ref{ord} (pp. \pageref{bin}-\pageref{ord})
for symbols not found on the keyboard, like $\pm$, $\geq$, and $\wp$.

Of course, not all expressions are polynomials.  \LaTeX{} uses two
special cases, \verb+\sqrt+ and \verb+\frac+ to create square roots
(radical sign surrounding the entire expression) and fractions (one
expression over another with a dividing bar between them)
respectively.  The term $ \sqrt{1-\frac{v^2}{c^2}} $, commonly used in
Lorentz transformations, is expressed as
\verb|$\sqrt{1-\frac{v^2}{c^2}} $| in line.  You might want it
displayed as \[ \sqrt{1-\frac{v^2}{c^2}} \] instead, which is
generated with \verb|\[\sqrt{1-\frac{v^2}{c^2}} \]|.

If the equation is more interesting, or if you want to refer to it
later on, you might want to assign it a number by using the
\verb+equation+ environment.  The quadratic formula
\begin{equation}
x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}
\end{equation}

\noindent is displayed by

\begin{verbatim}
\begin{equation}
x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}
\end{equation}
\end{verbatim}

%}

You can supply an optional argument to \verb+\sqrt+, specifying a
different root than 2.  For example, the fourth root,
$\sqrt[4]{1024}$, is expressed as \verb+\sqrt[4]{1024}+.

Often in a mathematical equation you will want to use symbols instead
of the standard italicized letters for variable names.  You can add
Greek letters by typing the command associated with the particular
letter---see Table~\ref{greek} on page \pageref{greek}.

Note that if you want to use Greek letters in normal text mode, you
must place them in a math environment by surrounding them with
\verb+$+\ldots\verb+$+.  You can also create function names with the
$\cal CALLIGRAPHY$ font.  This is treated like any type style change,
such as \verb|\|\verb|bf|, but like the Greek letters, you can use it only in
math mode, and you only have the 26 upper-case letters available (see
Table~\ref{alphabets}, p. \pageref{alphabets}).

Sometimes, a formula contains text that should be set in roman type.
For example, in the formula ``$\log xy = \log x + \log y$,'' the word
``log'' is not italicized like the variables $x$ and $y$.  It would be
inconvenient to have to exit math mode to type the text in normal
roman type, so the most common function names are defined as special
commands.  If the desired command isn't defined, you can use something
like \verb+$x = \textrm{foo}$+ to produce $x = \textrm{foo}$ rather
than $x = foo$.  A formula such as $\cos^2 x + \sin^2 x = 1$ would be
entered as \verb|$\cos^2 x + \sin^2 x = 1$|.  See Table~\ref{log}
(p. \pageref{log}) for a list of all the special commands which are
typeset like this.

The modulus function is slightly different from the other special
commands---it has two forms, a binary and a parenthesized one.  See
Figure~\ref{fig:mods} for an example of their usage.  There are also
various types of brackets and other delimiters available in math mode,
as shown in Table~\ref{dels} (p. \pageref{dels}).  Certain accents and
other diacritical marks are available in math mode.  Some of these
\emph{math mode accents\/} are only available in math mode, while
others are modified to work better in math mode.  See
Table~\ref{accent} (p. \pageref{accent}) for examples.

\begin{figure}[hbtp]
\begin{center}
\begin{tabular}{cc}
%% and specials
$a \bmod b$	&	\verb+a \bmod b+ \\
$\pmod{a+b}$	&	\verb-\pmod{a+b}- \\
\end{tabular}
\end{center}
\caption{Modulus functions}\label{fig:mods}
\end{figure}


The symbols in Figure~\ref{fig:latexsym} were provided by \LaTeX{}
2.09, but not by \LaTeXe.  You can access them by using the
\texttt{latexsym} package.
%% Symbols that were available in latex, but in 2e only
%% with the latexsym package
\begin{figure}[hbtp]
\begin{center}
\begin{tabular}{clclclclcl}
$\mho$ & \verb+\mho+ & $\Join$ & \verb+\Join+ &
$\Box$ & \verb+\Box+ & $\Diamond$ & \verb+\Diamond+ &
$\leadsto$ & \verb+\leadsto+ \\

$\sqsubset$ & \verb+\sqsubset+ & $\sqsupset$ & \verb+\sqsupset+ &
$\lhd$ & \verb+\lhd+ & $\unlhd$ & \verb+\unlhd+ & $\rhd$ & \verb+\rhd+ \\

$\unrhd$ & \verb+\unrhd+
\end{tabular}
\end{center}
\caption[\texttt{latexsym} Symbols]{Symbols available in the
\texttt{latexsym} package}\label{fig:latexsym}
\end{figure}

All of the tables on the succeeding pages are available online as
\texttt{texdoc symbols}. Those whose captions refer to AMS require
\verb|\usepackage{amsmath}|.


%% Variable-sized Symbols (3.8, p45) which are different in text/display.
\begin{figure}
\begin{tabbing}
\hspace{1.6in}\=
\hspace{1.6in}\=
\hspace{1.6in}\=
\kill
\begin{minipage}[b]{.4in}\[ \iint \]\end{minipage} $\iint$ \verb+  \iint+
\>
\begin{minipage}[b]{.4in}\[ \iiint \]\end{minipage} $\iiint$ \verb+  \iiint+
\>
\begin{minipage}[b]{.8in}\[ \idotsint \]\end{minipage} $\idotsint$ \verb+  \idotsint+
\\
\end{tabbing}
\caption{Variable-sized symbols only in {\tt amsmath}}
\label{fig:varsym-extra}
\end{figure}


%% Include the ``texdoc symbols'' output.
% Define the stuff it wants from its preamble (\ifAMS, etc.)
\newif\ifAMS \AMStrue
\newif\ifST  \STtrue
  \newcommand\ST{\textsf{stmaryrd}}
\newif\ifEU  \EUtrue
{
%\addtolength{\evensidemargin}{-4pc}
%\addtolength{\oddsidemargin}{-4pc}

%\topmargin -45pt
%\textwidth=532pt
%\oddsidemargin=-40pt \evensidemargin\oddsidemargin
%\textheight 682pt

\hfuzz=9pc %Shut up, LaTeX
\vbadness=11000
\input{symbols-edited}
}
% Undefine the stuff it leaves behind.
\let\W=\undefined
\let\X=\undefined
\let\Y=\undefined
\let\Z=\undefined

\section{Pretty Pictures}

\subsection{Including \PS{} and PDF Files}
\label{sec:inclusions}
To import picture files into \LaTeX{}, you need 
to generate files in the Encapsulated PostScript format. 
Many programs, {\it e.g.} Matlab will create EPS files for you.
Otherwise, the utility {\tt ps2epsi}
will convert any PS file into an EPS one for you (just
type {\tt ps2ps filename.ps filename.eps}). 

Having done so, you have many packages at your disposal 
to import the file into your \LaTeX{} document. 
We recommend the {\tt graphicx} package. An example of how it
is used is below: 

\begin{verbatim}
\usepackage{graphicx}
... ... ... 
\begin{figure}
\label{ndas}
\includegraphics[scale=0.5]{ndas}
\caption{Nude, descending a staircase.}
\end{figure}
\end{verbatim}

The {\tt scale} directive is an example of one of the many
things the \texttt{includegraphics} directive lets you do. 
The {\tt trim} argument lets you make a picture of only a 
cropped portion of the imported file, and the {\tt angle} and 
{\tt origin} arguments let that cropped portion be 
rotated. For the full details, see \texttt{texdoc grfguide}.

When {\tt latex} looks at this section, it will go and find the file
{\tt ndas.eps} and put it in the image.  For documents created with
{\tt pdflatex}, you can include other PDF files as figures, as well as
\texttt{.png}, \texttt{.gif}, and \texttt{.jpeg} images. Conveniently
enough, the above piece of \LaTeX{} code will prompt {\tt pdflatex} to
find the file {\tt ndas.pdf} for making the image.  You can use the
{\tt epstopdf} utility to convert PS to PDF.  Matlab can also export
PDF.

\subsection{\LaTeX{}  \texttt{picture} Environment}
%\nopagebreak

You can create pictures within \LaTeX{}  using a limited set of picture
symbols.  These include \verb+vector+, \verb+line+, \verb+oval+, and
others.  They are fairly difficult to use, and you have to set them up
by hand.  Fortunately, the {\tt xfig} drawing utility ({\tt add graphics}) 
and the {\tt dia} diagram program ({\tt add dia}) let you create 
such figures with your mouse and generate the \LaTeX{} code that will
create them. Just use the export button and copy the resulting file
into your \LaTeX{} document. 
For more information you should refer to the \LaTeX{}  manual, 
and also SIPB's {\it Inessential Graphics on Athena}.
%\nopagebreak

\begin{minipage}[b]{19pc}This picture
was made with the following \LaTeX{}  code.
\begin{verbatim}
\begin{picture}(80,80)(0,0)
\put(60,77){\vector(1,0){7}}
\put(60,85){$\theta^+$}
\put(60,40){\line(1,5){10}}
\put(60,40){\line(0,1){50}}
\put(60,40){\oval(40,40)[l]}
\put(60,20){\line(0,1){40}}
\put(0,40){\vector(1,0){40}}
\put(0,43){flow}
\end{picture}
\end{verbatim}
\end{minipage}
\begin{minipage}[b]{3in}
\begin{picture}(80,100)(0,0)
\put(60,77){\vector(1,0){7}}
\put(60,85){$\theta^+$}
\put(60,40){\line(1,5){10}}
\put(60,40){\line(0,1){50}}
\put(60,40){\oval(40,40)[l]}
\put(60,20){\line(0,1){40}}
\put(0,40){\vector(1,0){40}}
\put(0,43){flow}
\end{picture}
\end{minipage} 

Another way to get pictures in your \LaTeX{} document is to use plain
\TeX{} commands.  See \emph{The TeXbook} and/or ask for more
information.

\section{Citations and References}
\label{sec:cite}

Your document may require references from one section to another,
references to figures, tables, or references to other documents in a
bibliography. Once you begin to edit and re-edit your document,
\LaTeX{} can keep track of those references better than you can
yourself. For internal references, you start by using
\verb+\label{foo22}+ anywhere you will later want to put a
reference. In the source code for this guide, this section is marked
\verb+\label{sec:cite}+. The label must be unique. The conventional
label for a section is the mark `sec', then the semicolon, then a
relevant keyword.  Once the section is labeled, you can put
``\verb|Section~\ref{sec:cite} (p. \pageref{sec:cite})|'' anywhere and
it will always refer to Section \ref{sec:cite} (p. \pageref{sec:cite})
no matter how things get rearranged.

To build a bibliography of external references, some people use the
\BibTeX{} tool, but it is overkill for most users\footnote{See
\texttt{texdoc btxdoc} and \texttt{man bibtex} for details; \BibTeX{}
is most useful when citing the same references in multiple
documents.}. Instead, use the \texttt{thebibliography} environment
(the parameter in curly braces after \verb|\begin{thebibliography}|
should be the widest label you use, so \LaTeX{} can size the
indentation appropriately.):

\noindent
\verb|Practitioners of quantum gravity should read|
  \verb|\cite{sokalhoax}.|\\
\vdots\\
\verb|\begin{thebibliography}{Sokal 96}|\\
\verb|\bibitem[Sokal 96]{sokalhoax} Sokal, Alan. ``Transgressing the|\\
\verb|Boundaries, towards a formative hermeneutics of quantum gravity''.|\\
\verb|\emph{Lingua Franca}: 1996.|\\
\verb|\bibitem{1066} Sellar, W.C. \& R.J. Yeatman. \emph{1066 and|\\
\verb|all that: a memorable history of England}. 1953. New York: E.P.|
  \verb|Dutton.|\\
\verb|\end{thebibliography}|

\noindent
Which then appears as:
\noindent
\begin{quote}
Practitioners of quantum gravity should read \cite{sokalhoax}.\\
\vdots
\vspace{-2ex}
% I'm very sorry about this. Unfortunately thebibliography wants to start
% a new \chapter*, which is just not a way to play nice with excerpts in
% the middle. So we redefine \chapter and \@mkboth, then use it, and then
% we put them back. --jhawk 12/15/2004.
\makeatletter
\let\oldchapter=\chapter
\let\old@mkboth=\@mkboth
\def\chapter#1#2{}
\def\@mkboth#1#2{}
\makeatother
\begin{thebibliography}{Sokal 96}
\bibitem[Sokal 96]{sokalhoax} Sokal, Alan. ``Transgressing the
Boundaries, towards a formative hermeneutics of quantum gravity''.
\emph{Lingua Franca}: 1996.
\bibitem{1066} Sellar, W.C. \& R.J. Yeatman. \emph{1066 and all
that: a memorable history of England}. 1953. New York: E.P. Dutton.\hfill
\end{thebibliography}
\makeatletter
\let\chapter=\oldchapter \let\@mkboth=\old@mkboth
\makeatother
\end{quote}

If the optional \texttt{[Sokol 96]} label is omitted, then \LaTeX will
number your \verb+\bibitem+ entries for you.

\section{Setting Page Layout Parameters}
\input{layout-truncated}%
\LaTeX{} uses many parameters to layout a
page.  These parameters set the distance between the main text and
margin notes, headers, and footers, among other things.  To change the
value of one of these parameters, you can use the \verb+\addtolength+
commands described in subsection~\ref{sec:margins}
(p. \pageref{sec:margins}).  Figure~\ref{fig:layout} shows the layout
for a printed page reduced to 65\% of full size.

\section{Where to Get More Information}
\label{sec:more_info}

For a detailed overview and links to common packages, try:
{\tt texdoc index.html}

\noindent
For quick lookups of \LaTeX{} packages, use the {\tt texdoc}
command: {\tt texdoc \emph{packagename}}

\emph{\LaTeX{}: A Document Preparation System: User's Guide \&
Reference Manual\/} (Lamport) is a very useful book which goes into
much more detail than we have attempted here, for those who wish to
delve deeper into the intricacies of \LaTeX{}.  It is highly
recommended, and not very expensive, at least as far as reference
books go (\~\$30). \emph{A Guide to \LaTeX{}: Document Preparation for
Beginners and Advanced Users} (Kopka and Daly) is also quite useful,
and substantially more detailed.

Since Athena officially supports \LaTeX{}, you can ask questions about
it using \verb+olc ask latex+, and look through the OLC Stock Answers for the
answers to other commonly asked questions (\texttt{olc answers} or on
the Web at \texttt{http://web.mit.edu/answers/}).

You may also wish to look at the online version of the \LaTeX{} user's
guide, which is particularly useful when converting documents to
\LaTeXe{} format: \texttt{texdoc usrguide}. \emph{The Not So Short
Introduction to \LaTeXe{}} is also recommended: \texttt{texdoc
lshort}.

If you're looking for special symbols, the ones in this document are
also available by typing \texttt{texdoc symbols}. The
\emph{Comprehensive \LaTeX{} Symbol List}, a 98-page wonder, is also
available. SIPB's office has a bound copy, and you can view it
online (PDF or PS) by running \texttt{texdoc~symbols.html} and
clicking on the folder icon.

You can come by the \SIPB\ office (in W20-557, just outside the
Student Center cluster), or call us on the phone (617-253-7788),
particularly if you have a more obscure or complicated question.  As a
last resort, \emph{The~\TeX book\/} describes the \TeX{} typesetting
system, which forms the basis for \LaTeX{}.  It is significantly
harder to understand than the \LaTeX{} manual.

CTAN, the Comprehensive TeX Archive Network, centered at {\tt
http://www.ctan.org}, is another good resource for \LaTeX{}
information, and for such things as the \LaTeX{} templates required by
various publishers and academic organizations.

% XXX jhawk: Suppress the font substitution warning because the
% \varepsilon in \LaTeXe does not come in bold. Unfortunately, you'll
% still get the "LaTeX Font Warning: Some font shapes were not
% available, defaults substituted" at the end of the run.
\makeatletter \let\old@font@warning=\@font@warning
\let\@font@warning=\@font@info
\GenericWarning{}{Manually suppressing font substitution warning}%
\section{Converting from \LaTeX{} 2.09 to \LaTeXe}\label{sec:2.09}
\let\@font@warning=\old@font@warning
\makeatother
Converting documents from \LaTeX{} 2.09 format to \LaTeXe{} format is
fairly simple.  The primary differences are that \verb+\documentstyle+
has been replaced with \verb+\documentclass+, and that outside
packages are included \verb+\usepackage+.

Another change is that the commands such as \verb+{\tt}+ have been
superseded by the commands of the form \verb+\texttt{}+.  \LaTeXe{}
also added the \verb+\textsuperscript+ command for use in normal text
as an alternative to using math mode to generate superscripted text.
See Section~\ref{sec:more_info}, above, for several additional sources
of information which are useful in converting documents.

\paragraph{Running Previous Versions of \LaTeX{} }
The supported version of \LaTeX{}  on Athena is currently \LaTeXe, but
there are usually separate installations of older versions available.
Currently, \LaTeX{} 2.09 is available in the \verb+newtex+
locker.  You can access it by typing:

\noindent
\texttt{add newtex\\
latex209 filename.tex}

% The acks+lof+lot fit well together one one page.
% Unless there is a small item previous to them, let's
% fill up the whitespace here, rather than gratuitously
% breaking Acknowledgments across 2 pages.
\vfill
\pagebreak
{
\addtolength{\columnsep}{2pc} \begin{multicols}{2}[\section{Acknowledgments}]
\small \raggedcolumns
The original version of this document was written by Mark Eichin to
give people a handy reference to the many symbols that \LaTeX{} 
supports, especially the math mode symbols.  Most of his text and all
of his tables were included in the guide that you are holding now.

The rest of the first edition of the guide was written and edited by
Nancy Gilman, David Jedlinsky and Mary Vogt, with lots of comments
(flamage) from \SIPB\ members and other people who experimented with
the early versions of the guide.  Robert French perfected this
document to produce Revision 1.

Later, Chee Chew, added more changes (with more input/flamage from
\SIPB\ members) to produce Revision 2.

Revision 3 was updated by Mark Eichin to
cover the replacement of \verb+dvi2ps+ by the superior \verb+dvips+,
to acknowledge Athena's support of \LaTeX{}, and to include further
\SIPB\ member comments.  Subsequent changes have been made by Richard
Barbalace, bert Dvornik, and Chad Brown, with the cheerful support of
many \SIPB\ members and prospectives.

Revision 4 was updated by Alex Rolfe to reflect the adoption of
\LaTeXe as the default version on Athena. John Hawkinson made
numerous edits and is the current document maintainer.

Thanks to John Kohl and Jean Marie Diaz for getting most of the
original \TeX{} and \LaTeX{} system running on Athena in the first
place; without their efforts, this guide would be useless.

And, of course, thanks to Don Knuth, the author of \TeX{}, and Leslie
Lamport, the author of \LaTeX{};  they have done an incredible
% ``incredible'' but not necessarily ``good''... yes, I'm being snide =)
job.
\end{multicols}}

% List of Figures / Tables

% Punt inter-paragraph spacing.
\setlength{\parskip}{0in}	

% \listoffigures/\listoftablesbut without the newpage/chapter

\vspace{-4ex}
\makeatletter
\begin{multicols}{2}[\section{\listfigurename}]
  \small \raggedcolumns
      \@mkboth{\MakeUppercase\listfigurename}%
              {\MakeUppercase\listfigurename}%
    \@starttoc{lof}%
\end{multicols}
\begin{multicols}{2}[\section{\listtablename}]
  \small \raggedcolumns
      \@mkboth{%
          \MakeUppercase\listtablename}%
         {\MakeUppercase\listtablename}%
    \@starttoc{lot}%
\end{multicols}
\makeatother

\end{document}
