\documentclass{article}

\usepackage{a4wide}
\usepackage{amsmath,amssymb}
\usepackage{cite}

\newcommand{\bard}{d \!\!\rule[5.2pt]{4pt}{0.3pt}}

\title{Notes on \LaTeX}

\author{Adrian Campbell--Smith}

\date{October 1999}

\begin{document}

\maketitle

\begin{abstract}
I present some (hopefully) useful notes which serve as an
introduction, ready-reference, and indication of some of my personal
preferences for using the \LaTeX\ typesetting program.  These notes
are not supposed to be totally comprehensive; they are designed to
introduce some of the most useful commands and options in \LaTeX\
roughly in the order in which they appear in a document.
\end{abstract}

\section{The Source File}

The source file (which should have a \texttt{.tex} tag) comprises two
parts: the \emph{preamble} and the \emph{body}.  The preamble contains
general commands which affect the overall appearance of your final
document, and the body contains the text of your document, with
formul\ae, figures, and typesetting commands.  By running the program
\texttt{latex} on your source, you can generate printable output: see
section~\ref{sec:procdoc}.

Sources at your disposal for learning \LaTeX\ are: the \LaTeX\ source
of papers from archives on the web (hep--th etc.), your colleagues,
and the many \LaTeX\ Introductions and Guides; combined searches for
``latex'' and specific package or command names on yahoo.com and
alltheweb.com can be very successful.

Before starting to create documents, there are some points to notice:

\subsection*{\LaTeX\ 2$_{\mbox{$\boldsymbol{\varepsilon}$}}$ and \LaTeX\ 2.09}

The most up-to-date version of \LaTeX, and that run in this
department, is 2$_{\mbox{$\varepsilon$}}$.  This is backwards
compatible with the older version 2.09.  There are a few differences
between the two, principally that 2$_{\mbox{$\varepsilon$}}$ compiles
files more quickly, and that the American Physical Society document
style, REV\TeX, is unavailable (as yet) in 2$_{\mbox{$\varepsilon$}}$.
Unless you wish to submit to the APS, you should certainly choose
\LaTeX\ 2$_{\mbox{$\varepsilon$}}$.

\subsection*{emacs}

\texttt{emacs} is a wonderful text editor which is wholeheartedly
recommended for the creation of source files.  It takes some effort to
get to know how to use it well, but it is well worth doing so.  It has
its own latex mode, which enables it to recognize a lot of \LaTeX\
syntax an run useful macros as a result; you can also run
\texttt{latex} and view resulting \texttt{dvi} and postscript files
within the program itself.  In the long run, studying the help pages
inside \texttt{emacs} (type \texttt{Ctrl-h i}) will save you lots of
time and effort when creating \LaTeX\ documents.  Note that
\texttt{emacs} also has C and Fortran modes, and a whole host of other
stuff (including a feature which computes the sunrise time at your
longitude/latitude!).

\subsection*{Comments}

Anything which follows the symbol \% on a given line in your source
file is ignored by \LaTeX.  Use \% for comments to yourself, or for
temporary removal of a part of your source file.


\section{The Preamble}

All source files start with the command
\begin{verbatim}
\documentclass{...}
\end{verbatim}
where the ellipsis is replaced with one of
\begin{verbatim}
letter   article   report   book
\end{verbatim}
These are the different classes of document available.  The
\texttt{letter} class will not be discussed further here.  The
principal difference between the other three classes is in the section
numbering, and the existence of chapters and parts in the
\texttt{report} and \texttt{book} classes.  Papers are in general
written as \texttt{article} class documents, theses as
\texttt{report}s.  A crucial exception to this is for authors who wish
to use the American Physical Society's own document style, REV\TeX.
As mentioned above, this is only available in the old version 2.09, in
which case one has to open the preamble with (indeed the differing
command here tells \LaTeX\ 2$\varepsilon$ to run in
backward-compatible mode)
\begin{verbatim}
\documentstyle{revtex}.
\end{verbatim}
When syntactical differences between 2$\varepsilon$ and 2.09 occur as
above, I shall do my best to point them out, especially since REV\TeX\
is a useful and attractive document style, and is almost essential for
submission to APS journals.

\subsection{Style Options}

The different style options and external packages which can be loaded
by \LaTeX\ are included with the command
\begin{verbatim}
\usepackage{...}
\end{verbatim}
Multiple options/packages can either be loaded with several
\verb+\usepackage+ commands, or by separating the options with commas
(and no spaces) in one command.  The ellipsis is replaced with the
name of the required package.  I will mention some of the most useful:
\begin{verbatim}
a4   a4wide   amsmath   amssymb   axodraw   cite   graphics   fancyhdr
\end{verbatim}
The first two of these tell \LaTeX\ to fit your document nicely onto
an A4 page, the latter with a slightly wider text width.  This
document is written with the \texttt{a4wide} option.  The two packages
starting with \texttt{ams} are for mathematical typesetting (see
section~\ref{sec:math}): \texttt{amsmath} loads some extra
equation-building environments, and \texttt{amssymb} loads extra
mathematical symbols, e.g. $\dotplus, \lll$.  The \texttt{axodraw}
package must be downloaded from the web (or copied from a colleague),
and is the best package for drawing Feynman graphs and flowcharts.  It
is very easy to use, and comes with its own excellent (and
pedagogical) manual, so will not be introduced in any detail here.
The \texttt{cite} package collates your citations in a nice way, such
that references like [1,2,3,4,9] are changed automatically to
[1--4,9].  The \texttt{graphics} package enables a bunch of nice
commands for handling postscript figures, to which I shall return
briefly in section~\ref{sec:figs}.  Finally \texttt{fancyhdr} is a
package which generates attractive headers for pages, useful for
theses.

In \LaTeX\ 2.09, these packages are loaded as ``options'' to
the \verb+\documentstyle+ command:
\begin{verbatim}
\documentstyle[amsmath,cite]{revtex}
\end{verbatim}
It is a general feature of \LaTeX\ that optional arguments for
commands appear in square brackets, while essential arguments are
enclosed in curly braces.

The REV\TeX\ document style has its own set of useful
options/packages.  Principal among these are
\begin{verbatim}
aps   12pt   preprint   tighten   twocolumn   eqsecnum
\end{verbatim}
The \texttt{aps} option tells \LaTeX\ to fit your document nicely onto
the page (the text width is larger than the \texttt{a4} style), and
conforms to the APS' requirements for section headings (centred, in
capitals) and section numbering (roman), etc.  One option from the set
\{\texttt{aps,osa,seg}\} must appear, and \texttt{aps} is recommended.
\texttt{12pt} and \texttt{preprint} both force REV\TeX\ into a
``preprint'' style (unlike the 10-point style which appears in APS
journals) with double-spacing and 12-point type.  They differ in the
presentation of the abstract and the exact format of the printed page:
which you choose is a matter of personal taste.  To close up the
double-spacing for either of these styles, choose \texttt{tighten}.
To have a look at your document in the two-column style which appears
in the journal use \texttt{twocolumn}, although mysterious things
happen to the abstract, and long equations are not broken.  This
option should only really be used to get an idea of the number of
pages the paper will occupy in the journal; in general it is best to
leave the editors to change your paper to a two-column format, and
stick to a \texttt{tighten}ed ``preprint'' style.  \texttt{eqsecnum}
numbers your equations by section, which is useful.  This can be
achieved outside REV\TeX\ with a little effort, see
section~\ref{sec:seceqnum}.

\subsection{Title and Author}

You can declare who you are and what you are writing about in the
preamble with the commands
\begin{verbatim}
\title{Notes on \LaTeX}
\author{Adrian Campbell--Smith}
\address{Nonsense Land}
\date{October 1999}
\end{verbatim}
Note that the \verb+\address+ command is only available in REV\TeX;
the address can be put into the author field (after a carriage return
\verb+\\+) in other document classes:
\begin{verbatim}
\title{Notes on \LaTeX}
\author{Adrian Campbell--Smith\\Nonsense Land}
\date{October 1999}
\end{verbatim}
\LaTeX\ will build the title out of these declarations once you ask it
to do so in the body of your document (see section~\ref{sec:body}).
Each of the declarations is optional; in particular, you may not wish
to mention a date.  For the record, today's date can be generated with
\verb+\today+.  References to e.mail addresses and the like can be
made with the \verb+\thanks{...}+ command, which if put after an
author's name will generate a labelled footnote containing the
argument of the \verb+\thanks+.

\subsection{Declarations}

The rest of the preamble comprises any declarations you may wish to
make:  new commands, the page style to use, etc.

\subsubsection{New Commands}

A new command is defined by (replacing the old \TeX\ \verb+\def+):
\begin{verbatim}
\newcommand{\boldsigma}{\mbox{\boldmath$\sigma$}}
\end{verbatim}
means that any time you type \verb+\boldsigma+ in the body of your
document, \LaTeX\ reads it as \verb+\mbox{\boldmath$\sigma$}+ which,
for the record, is how to generate bold Greek characters (without
\texttt{amsmath}).  I strongly discourage you from using this to
generate abbreviations for things which you type commonly in your
documents.  You are much better off creating a global abbreviation
inside \texttt{emacs}.  In particular, you can get into problems if
you happen to choose a newcommand name which already exists somewhere
in \LaTeX\ or one of its loaded packages (\texttt{amssymb} can cause
particular problems here on account of the enormous number of extra
symbols).

\subsubsection{The Page Style}
\label{sec:pgsty}

The page style is set by the declaration
\begin{verbatim}
\pagestyle{...}
\end{verbatim}
where the ellipsis is to be replaced with one of the following:
\begin{description}
\item[\texttt{empty}]  Nothing on the page except your text (i.e. no
page number).
\item[\texttt{plain}] Generates a page number at the bottom (used in
this document).
\item[\texttt{headings}] Page number at the bottom, and header
determined by the document class.
\item[\texttt{myheadings}]  Page number at the bottom, your own
decision about the header.
\end{description}
See your manual for a detailed description of how to use the
\texttt{(my)headings} styles.  Sometimes you may wish that a
particular page has no number at the foot, while the rest of your
document has the \texttt{plain} page style.  This can be achieved with
the \verb+\thispagestyle{empty}+ command at the appropriate place in
the body.

If you are unsatisfied with the size of the printed page generated
then you can set the text width and height yourself in the preamble:
\begin{verbatim}
\setlength{\textwidth}{13.7cm}
\setlength{\textheight}{23cm}
\end{verbatim}

If you wish for \LaTeX\ to be relaxed rather than rigorous about
adhering to the text length (which is often a good idea for articles),
then use the command \verb+\raggedbottom+ in the preamble.

\section{The Body}
\label{sec:body}

The preamble is ended and the body begun with the command
\begin{verbatim}
\begin{document}
\end{verbatim}
Immediately after this a typical series of commands might be
\begin{verbatim}
\maketitle

\begin{abstract}
In this article our objective is to waffle endlessly about some problems 
which we could not solve except in the most ludicrous approximations.
\end{abstract}

\tableofcontents
\end{verbatim}
The first of these creates the title according to the declarations
(\verb+\author+, \verb+\title+ etc.) you have made in the preamble,
and the document class.  \verb+\tableofcontents+ builds a table of
contents: it will take \LaTeX\ several runs until it has it all
correct.  Similar commands will generate lists of figures and tables,
though these are principally of use only for theses.  If you do not
like the way \LaTeX\ creates your title and abstract, you can simply
create it yourself with \LaTeX's formatting commands (see below) and
forget about the declarations in the preamble.  To create a separate
page on which your title etc.\ appear, use the environment
\begin{verbatim}
\begin{titlepage}
...
\end{titlepage}
\end{verbatim}
in which you are free to do whatever you like:  use commands like
\begin{verbatim}
\small   \large   \Large   \LARGE   \huge   \Huge
\end{verbatim}
to change the type size, and things like
\begin{verbatim} 
\textbf{...} \textit{...} \textsl{...} \textsc{...} \textsf{...} \texttt{...}
\end{verbatim}
to generate \textbf{bold}, \textit{italic}, \textsl{slanted},
\textsc{Small Caps}, \textsf{sans serif} and \texttt{type}.  To use
these in any of the mathematics modes (see section~\ref{sec:math}),
replace \verb+\text+ with \verb+\math+.  Note the existence of the
command \verb+\emph{...}+ which generates \emph{emphasized text} with
the correct spacing around it.  For information on spacing and
formatting, see sections~\ref{sec:space} and~\ref{sec:envs}
respectively.

\subsection{Logical Units}
 
After generating your title etc.\ as above you are ready to start
typing the main body of your document.  Logical units are
automatically generated and numbered with the commands
\begin{verbatim}
\part  \chapter   \section   \subsection   \subsubsection
\end{verbatim}
The first is only available in the \texttt{book} document class, the
second in the \texttt{book} and \texttt{report} classes, and the
remainder in all the classes.  There are actually units below
\verb+\subsubsection+s should you need them, unfortunately called
\verb+\paragraph+ and \verb+\subparagraph+.  Each of these commands
takes an optional and an essential argument:
\begin{verbatim}
\section[short_title]{Logical Units}
\end{verbatim}
If you include the optional short title, it will appear in the page
header and table of contents.  The longer title appears in your
document, as with ``Logical Units'' above.

Appendices are generated with the \verb+\appendix+ command, after
which you use \verb+\section+ commands to actually generate the
appendices, which will then be numbered A, B, and so on, and given the
titles which you put as the argument of the \verb+\section+ command as
normal.

If you do not wish your ((sub)sub)section to be numbered, then simply
place a \verb+*+ before the argument.  I used this to generate the
unnumbered section on Emacs at the beginning, and this construction is
useful for such things as acknowledgements (note that REV\TeX\ has its
own \verb+\acknowledgments+ command (and note the American spelling)
which has the same result).  Logical units with asterisks will not
appear in the table of contents, and the next logical unit is numbered
correctly (i.e. as though your asterisked section were not present).

New paragraphs within sections are obtained by leaving a blank line
in your source file:
\begin{verbatim}
...end of paragraph on this.

Now we start a new paragraph on that...
\end{verbatim}
\LaTeX\ will indent each new paragraph as it goes along.  To suppress
this indentation for any reason, use \verb+\noindent+.  In general
carriage returns can be forced with the command \verb+\\+.

\subsection{Spacing and Line(Page)-Breaking}
\label{sec:space}

\LaTeX\ almost always gets the spacing in your document right.  When
you wish to add extra space for whatever reason, use the commands
\begin{verbatim}
\hspace{...}   \vspace{...}
\end{verbatim}
for horizontal and vertical space respectively: the argument is the
space, with units: 2pt, 3cm, 1.5in, etc.  Both can take negative
arguments if necessary.  Note also that the carriage return command
\verb+\\+ takes an optional argument \verb+\\[...]+ for an extra
amount of space (in some units) to leave after the carriage return
(good for leaving a blank gap between lines in an \texttt{align}
environment see section~\ref{sec:math}).

Sometimes \LaTeX\ will apparently fail to pay any attention to your
horizontal and vertical spacing commands, if it thinks the page looks
better without.  Therefore there are two ``I am angry with you, I
absolutely insist you put this space in'' commands:
\begin{verbatim}
\hspace*{...}   \vspace*{...}
\end{verbatim}
which \LaTeX\ will perform no matter what it thinks.

Page breaking, should you wish to force \LaTeX\ to do so at any point,
is done with the command \verb+\newpage+.  It is not worth messing
around with such things until you have the final draft of your
document.  The addition of a few words here and there can make an
enormous difference to where \LaTeX\ makes its page breaks.

You can change the line spacing in your document with ease: the
simplest way is to use the package \texttt{setspace} (with
\verb+\usepackage{setspace}+ in the preamble) which then enables the
commands
\begin{verbatim}
\singlespacing
\onehalfspacing      (this is equivalent to (1.5)\singlespacing)
\doublespacing
\end{verbatim}
which affect the spacing accordingly for text following the command.
This is useful if you want a double-spaced thesis, but single-spaced
title pages, contents table, acknowledgements, etc.

\subsection{Formatting Text}
\label{sec:envs}

There are several environments which can be used for formatting text
in different ways (and note that they can contain mathematics as
well).  To centre some text, use the following environment, with
different centred lines separated by \verb+\\+ commands:
\begin{verbatim}
\begin{center}
...\\
...
\end{center}
\end{verbatim}
Note the American spelling of \texttt{center}.
\begin{quotation}
This text is generated in a \texttt{quotation} environment, which is
useful for highlighting particular bits of text or for quoting long
passages from other sources.  The text is centered and the lines shorter.
\end{quotation}
There are a couple of environments for making text \texttt{flushleft} and
\texttt{flushright} e.g.:
\begin{flushright}
This text is generated with \verb+\begin{flushright}+,\\
(Separate lines with \verb+\\+)\\
and ended with 	\verb+\end{flushright}+
\end{flushright}

There are a number of useful list-making environments, principal among
them being \texttt{itemize} and \texttt{description}.
\texttt{itemize} produces a bulletted list as follows:  the input
\begin{verbatim}
\begin{itemize}
\item  Item one.
\item  Item two.
\item  And so on.
\end{itemize}
\end{verbatim}
generates the list:
\begin{itemize}
\item  Item one.
\item  Item two.
\item  And so on.
\end{itemize}
The \texttt{description} environment is used when you want something
other than a bullet at the beginning:  the source which produced the
list of page styles in section~\ref{sec:pgsty} is as follows:
\begin{verbatim}
\begin{description}
\item[\texttt{empty}]  Nothing on the page except your text (i.e. no
page number).
\item[\texttt{plain}] Generates a page number at the bottom (used in
this document).
\item[\texttt{headings}] Page number at the bottom, and header
determined by the document class.
\item[\texttt{myheadings}]  Page number at the bottom, your own
decision about the header.
\end{description}
\end{verbatim}
There is also the \texttt{enumerate} environment which generates a
numbered list with the syntax as above.


\subsection{Labelling and Cross-referencing}

Any time you wish, you can give a part of your text a label with the
command \verb+\label{the_label}+, and then cross-reference to this
using \verb+\ref{the_label}+.  For example, if you put the
\verb+\label+ command after a \verb+\section{...}+, then a subsequent
\verb+\ref+ will call the section number; a \verb+\label+ appearing
inside an equation (see section~\ref{sec:math}) will cause \verb+\ref+
to generate the equation number.  Figures, tables, subsections,
chapters, etc.\ can all be cross-referenced this way.  When calling
\verb+\ref+ it is worth knowing of the existence of \verb+~+ which
generates an unbreakable space: \LaTeX\ will never make a line-break
between ``section'' and its number in the following example
\begin{verbatim}
...refer to section~\ref{sec:whatever} for further information.
\end{verbatim}
This is also useful for ensuring that names and their associated
initials are not separated.

\subsection{Citations}

Citations are made using the \verb+\cite{...}+ command.  What appears
as the argument is the keyword of the citation you wish to call.
Later, \LaTeX\ will collect your citations in a bibliography at the
end of the document.  Again, it is worth attaching the citation to the
preceding text with an unbreakable space as in
\begin{verbatim}
...refer to reference~\cite{witten99} for the truth, stated without proof.
\end{verbatim}
For \LaTeX\ to call this citation, there must be a bibliography item
which is called \verb+witten99+: bibliographies are discussed further
in section~\ref{sec:bib}.

\subsection{ShowKeys}

There is a fabulous package called \texttt{showkeys} which can be
called in the preamble with the usual \verb+\usepackage{showkeys}+
command.  It makes \LaTeX\ print out the actual \texttt{label}s,
\texttt{ref}erences and \texttt{cite}ation keywords which you have
used.  This is very useful for keeping track of what label you gave to
something to which you wish to subsequently refer.  The labels thus
printed will show up in both the \texttt{dvi} and postscript files, so
they can be printed.  They do not affect the typesetting at all, and
will all disappear as soon as you comment out or delete the
\verb+\usepackage+ command.

\subsection{Footnotes}

Footnotes are very simple: they are generated by the
\verb+\footnote{...}+ command, which takes the text of your footnote
as its argument\footnote{A footnote}.

\section{Mathematics}
\label{sec:math}

The real power of \LaTeX\ is in typesetting mathematics.  The more
you use the program, the more you will find a feel for creating
good-looking formul\ae.  I cannot recommend the package
\texttt{amsmath} (and its symbols set \texttt{amssymb}) strongly
enough: it enables a set of environments for equations which are
hugely superior to the basic ones available in \LaTeX.  Basic REV\TeX\
is also quite good, essentially upgrading the basic environments to
the \texttt{amsmath} standard.  I will therefore mention the standard
environments quickly before giving details of the superior
\texttt{amsmath} commands.

\subsection{Basic Mathematics in \LaTeX}

Mathematics embedded in text is delimited with \verb+\(...\)+ or
(completely equivalently) \verb+$...$+.  A displayed (centred) formula
is obtained with \verb+\[...\]+.  For example, the source
\begin{verbatim}
A simple U(1) gauge field theory is defined by the action functional
\[ S= \int d^4x\; \left[ -\frac{1}{4} F_{\mu\nu}F^{\mu\nu} +
\overline{\Psi} (i\gamma^\mu D_\mu) \Psi \right],\]
where $F_{\mu\nu}$ and \(D_\mu = \partial_\mu + ieA_\mu\) are
respectively the U(1) curvature tensor and covariant derivative.
\end{verbatim}
generates the \LaTeX\ output:\vspace{.5cm}

A simple U(1) gauge field theory is defined by the action functional
\[ S= \int d^4x\; \left[ -\frac{1}{4} F_{\mu\nu}F^{\mu\nu} +
\overline{\Psi} (i\gamma^\mu D_\mu) \Psi \right],\]
where $F_{\mu\nu}$ and \(D_\mu = \partial_\mu + ieA_\mu\) are
respectively the U(1) curvature tensor and covariant derivative.\vspace{.5cm}

Numbered equations are generated by the environments \texttt{equation}
and \texttt{eqnarray}.  For example, by replacing the \verb+\[+ and
\verb+\]+ above with \verb+\begin{equation}+ and \verb+\end{equation}+
we obtain:\vspace{.5cm}

A simple U(1) gauge field theory is defined by the action functional
\begin{equation}\label{eqone}
S= \int d^4x\; \left[ -\frac{1}{4} F_{\mu\nu}F^{\mu\nu} +
\overline{\Psi} (i\gamma^\mu D_\mu) \Psi \right],
\end{equation}
where $F_{\mu\nu}$ and \(D_\mu = \partial_\mu + ieA_\mu\) are
respectively the U(1) curvature tensor and covariant derivative.\vspace{.5cm}

The \texttt{eqnarray} environment is used for equations broken across
several lines.  The environment asks you to split each line of your
equation into three logical bits separated by \verb+&+ symbols, and
separate each line by \verb+\\+.  Corresponding logical bits appear
vertically aligned in the output.  The input
\begin{verbatim}
\begin{eqnarray}\label{Fdef}
F_{\mu\nu} &\doteq& \partial_{[\mu} A_{\nu]}\\
&=& \partial_\mu A_\nu - \partial_\nu A_\mu \nonumber\\ 
\Rightarrow \partial^\mu F_{\mu\nu} &=& 0 \label{dF=0}.
\end{eqnarray}
\end{verbatim}
generates the output
\begin{eqnarray}\label{Fdef}
F_{\mu\nu} &\doteq& \partial_{[\mu} A_{\nu]}\\
&=& \partial_\mu A_\nu - \partial_\nu A_\mu \nonumber\\ 
\Rightarrow \partial^\mu F_{\mu\nu} &=& 0 \label{dF=0}.
\end{eqnarray}
Note the use of \verb+\nonumber+ to leave the second line unnumbered.
This environment is often used for typesetting single equations too
large to fit onto one line; there are several better ways of doing
this with \texttt{amsmath}, and I will mention the most flexible in
the following.  Note in particular that the spacing around the = signs
above is too large: this is an artifact of the array generation, and
looks ugly when near to \texttt{equation}s, such as
equation~(\ref{eqone}), where the spacing is correct.  All the
\texttt{amsmath} environments correct this.

\subsection{Labelling}

To cross-reference an equation, you put in a \verb+\label+ as above:
note the position of the \verb+\label+s in the references to
equations~(\ref{Fdef}) (\verb+\ref{Fdef}+) and~(\ref{dF=0})
(\verb+\ref{dF=0}+).  The labels can appear anywhere between the start
of each line and the \verb+\\+ symbol.  This is because the equation
counter is only incremented upon the appearance of an
\verb+\end{eq...}+ or a \verb+\\+ command, and \LaTeX\ knows that the
\verb+\ref+ command refers to the counter of whatever environment is
currently being type-set.

As with sections, \texttt{equation} and \texttt{eqnarray} have
numberless versions, namely \verb+equation*+ and \verb+eqnarray*+.
The starred \texttt{equation} does not differ from a basic
\verb+\[...\]+, but the starred \texttt{eqnarray} can be useful.

\subsection{Mathematics with \texttt{amsmath}}

The \texttt{amsmath} package improves greatly on the basic
\texttt{equation} and \texttt{eqnarray} environments.  They are
respectively replaced with \texttt{gather} and \texttt{align}, which
are much more robust, get spacing correct, never write equation
numbers over your text (which happens in \texttt{eqnarray} and
\texttt{equation} when the equations are very long), and are simpler
to use.

The \texttt{gather} environment allows multiple lines (separated by
\verb+\\+ as usual) and centres each line.  For one-line formul\ae\
this behaves like an improved \texttt{equation} environment.  For
example, the input:
\begin{verbatim}
\begin{gather}
(a+b)^2  = a^2 + 2 ab + b^2 \\
(a+b)\cdot(a-b) = a^2 - b^2
\end{gather}
\end{verbatim}
generates the output (you could use \verb+\nonumber+ to suppress an
equation number):
\begin{gather}
(a+b)^2  = a^2 + 2 ab + b^2 \\
(a+b)\cdot(a-b) = a^2 - b^2
\end{gather}

To obtain aligned multi-line output, the simplest approach is to use
an \texttt{align} environment.  Unlike \texttt{eqnarray} this does not
create an array, but simply aligns whatever \verb+&+ symbols you put
into the formula: the input
\begin{verbatim}
\begin{align}
x^2 +y^2 &= 1\\
x&= \pm \sqrt{1-y^2}
\end{align}
\end{verbatim}
generates the output
\begin{align}
x^2 +y^2 &= 1\\
x&= \pm \sqrt{1-y^2}
\end{align}
More complicated alignments with proper spacing can also be obtained
effortlessly:
\begin{verbatim}
\begin{align}
(a+b)^2 &= a^2+2ab+b^2 &x^2+y^2 &= 1\\
(a-b)^2 &= a^2-2ab+b^2 &x &=\pm\sqrt{1-y^2}
\end{align}
\end{verbatim}
generates
\begin{align}
(a+b)^2 &= a^2+2ab+b^2 &x^2+y^2 &= 1\\
(a-b)^2 &= a^2-2ab+b^2 &x &=\pm\sqrt{1-y^2}
\end{align}
If you thought the above would look better with the $x$ symbols
aligned rather than the $=$ signs, then you only have to move the
\verb+&+ symbols appropriately.  The \texttt{align} environment can be
used to split long equations using \verb+\nonumber+ to prevent the
generation of an equation number.  Note that both \texttt{gather} and
\texttt{align} have starred versions, which suppress the generation of
equation numbers.

There is also the so-called \texttt{multline} environment, which is
another attractive way to typeset long mathematical relations.  It
left justifies the first line, centres any middle parts and then right
justifies the last line:
\begin{multline}
\int \bard^4 q\; d^4\theta \; \frac{1}{2} 4e^2 G_4
\, \Phi_+(-p,\theta,\bar{\theta})\, \Delta^{VV}(q)\,
\Phi_+^{\dagger}(p,\theta,\bar{\theta})\\
=\int \bard^4 q\; 2e^2G_4\,
\frac{2}{q^4}(1\!-\!\xi) \int d^4\theta \;
\Phi_+^{\dagger}(p,\theta,\bar{\theta})\,
\Phi_+(-p,\theta,\bar{\theta}).
\end{multline}

Finally, you can insert text into an \texttt{align} environment while
preserving the alignment:
\begin{verbatim}
\begin{align*}
\Psi &\longrightarrow {\frak g}\Psi\\
\overline{\Psi} &\longrightarrow \overline{\Psi} {\frak g}^{-1}\\
\intertext{and the gauge field transforms as}
A &\longrightarrow {\frak g} \left( A+\partial\right) {\frak g}^{-1}
\end{align*}
\end{verbatim}
generates:
\begin{align*}
\Psi &\longrightarrow {\frak g}\Psi\\
\overline{\Psi} &\longrightarrow \overline{\Psi} {\frak g}^{-1}\\
\intertext{and the gauge field transforms as}
A &\longrightarrow {\frak g} \left( A+\partial\right) {\frak g}^{-1}
\end{align*}

Of course, the editor and referee will not notice any of this
beautiful typesetting, but at least you will know that your document
looks correct (unless of course you let your supervisor get hold of
the source file, in which case literally anything can happen to your
wonderful paper).

\subsection{Spacing and Breaking}

Most of the time \LaTeX\ gets the spacing in your equations just
right, but occasionally it does not understand what you mean, or you
just prefer something else.  An excellent example of this is
integration, where \LaTeX\ does not appreciate that the measure needs
to be separated from the integrand.  Compare:
\begin{verbatim}
\begin{gather*}
\int d^4 x C(x) \delta^{(4)}(x) = C(0)\\
\int d^4 x\; C(x)\, \delta^{(4)}(x) = C(0)
\end{gather*}
\end{verbatim}
which generates\vspace{.5cm}

\begin{gather*}
\int d^4 x C(x) \delta^{(4)}(x) = C(0)\\
\int d^4 x\; C(x)\, \delta^{(4)}(x) = C(0)
\end{gather*}
There are several different sizes of space in \LaTeX\ which you can
use to move things around:
\begin{verbatim}
\,   \;   \:   \     \quad   \qquad   \!
\end{verbatim}
These are respectively: thin space, medium space, thick space,
inter-word-space (that is backslash-space), a ``quad'' a double
``quad,'' and a negative thin space.  If you are desperate, you can
always use \verb+\hspace{...}+ (which can take a negative argument),
see section~\ref{sec:space}.

Sometimes \LaTeX\ chooses to change page in the middle of an
\texttt{eqnarray} or \texttt{align}, at one of your line breaks
\verb+\\+.  You can prevent this by using \verb+\\*+ which says
``break line but do not break page.''  Of course at this stage \LaTeX\
may choose to move your entire equation onto the next page: it is not
worth playing with any of this until you have a \emph{final} draft of
your paper.  Remember that \verb+\\[...]+ takes a useful optional
argument, good for extra space in \texttt{align}ed formul\ae.

\subsection{Text in Mathematics}

Aside from text generated by the \verb+\intertext+ command, you may
wish to put other text into your mathematics.  While in any of the
mathematics-generating environments, \LaTeX\ treats everything as
mathematics until you tell it to do something else.  The commands
\begin{verbatim}
\mathrm{...}   \mathit{...}
\end{verbatim}
are used to generate correctly spaced roman and italic type inside
mathematics.  Note that since \LaTeX\ still thinks it is producing
mathematics, it will ignore any spaces between words.  If you wish to
include more than one word (i.e. with spaces), use the
\verb+\text{...}+ command:
\begin{verbatim}
\begin{gather*}
{\frak L}_{eff} \quad\text{is to be compared with}\quad {\frak
L}_{\mathit{eff}}
\end{gather*}
\end{verbatim}
generates
\begin{gather*}
{\frak L}_{eff} \quad\text{is to be compared with}\quad {\frak
L}_{\mathit{eff}}
\end{gather*}
In the first effective Lagrangian, \LaTeX\ treats the subscript
``eff'' as the product $e\times f\times f$, whereas in the second it
spaces it correctly for text.  The command \verb+\mathrm+ generates
non-italic text with the correct spacing inside mathematics:  ${\frak
L}_{\mathrm{eff}}$.

\subsection{Delimiters}

Delimiters $(,[,\{,|$ etc.\ are produced with the obvious direct
input, save that $\{$ is produced with \verb+\{+.  \LaTeX\ will expand
a delimiter to make it as big as the symbols between if you prepend it
with a \verb+\left+ and prepend a \verb+\right+ to its partner closing
delimiter.  In the following example several different uses of
\verb+\left+ and \verb+\right+ appear: note the use of \verb+\left.+
which produces no output, but keeps \LaTeX\ from complaining that
there is an unmatched delimiter (in this case the matching delimiter
is the ``to be evaluated at'' sign):
\begin{verbatim}
\begin{gather*}
S[\phi] = \int d^4x\; \left.\left( -\frac{1}{4} F^{\mu\nu}F_{\mu\nu} +
\frac{1}{2} \left| D_\mu \phi \right|^2 \right)\right|_{|\phi|^2=1}
\end{gather*}
\end{verbatim}
which produces
\begin{gather*}
S[\phi] = \int d^4x\; \left.\left( -\frac{1}{4} F^{\mu\nu}F_{\mu\nu} +
\frac{1}{2} \left| D_\mu \phi \right|^2 \right)\right|_{|\phi|^2=1}
\end{gather*}

If for any reason \LaTeX\ does not produce a delimiter as large as you
would wish, you can try \verb+\big(+, \verb+\Big(+ etc., which produce
larger delimiters (the commands can be used with delimiters other than
\verb+( )+\;) automatically.
\begin{verbatim}
\begin{gather*}
\text{The integral} \quad\int db\; \big( A(b)+B(b) \big) \quad\text{looks better
than}\quad \int db\; \left( A(b)+B(b) \right)
\end{gather*}
\end{verbatim}
\begin{gather*}
\text{The integral} \quad\int db\; \big( A(b)+B(b) \big) \quad\text{looks better
than}\quad \int db\; \left( A(b)+B(b) \right)
\end{gather*}
since \LaTeX\ does not understand the distinction between the
delimiters of the arguments and the delimiters of the integrand.  It
is normally worth seeing what \verb+\left+ and \verb+\right+ produce
before you start to play.  In the example with $\phi$ above, the
modulus signs around $D_\mu \phi$ are no bigger than they would have
been if I had left out the \verb+\left+ and \verb+\right+: as you get
used to \LaTeX\ you will get a feel for when these commands are
unnecessary like the case above.

Note that for correlation functions there exist \verb+\langle+ and
\verb+\rangle+ (which can of course be used with \verb+\left+ and
\verb+\right+) which are much better than \verb+<+ and \verb+>+ as
exemplified in the following:
\begin{verbatim}
\begin{gather*}
<\phi(x) \phi(0) > \neq \langle \phi(x) \phi(0) \rangle.
\end{gather*}
\end{verbatim}
\begin{gather*}
<\phi(x) \phi(0) > \neq \langle \phi(x) \phi(0) \rangle.
\end{gather*}

If you have used \verb+\left+ in an equation which is broken across
several lines, you need to match all the \verb+\left+ commands with
\verb+\right+ commands \emph{before} you put in a line break.  A
silly example:
\begin{verbatim}
\begin{align*}
S[\Psi_1,\Psi_2] = \int d^4x\;& \left[ \bar{\Psi}_1 (i\gamma^\mu
D_\mu ) \Psi_1 +\right.\\ &\qquad+\left.\overline{\Psi}_2 (i\gamma^\mu
D_\mu ) \Psi_2 \right]
\end{align*}
\end{verbatim}
which generates
\begin{align*}
S[\Psi_1,\Psi_2] = \int d^4x\;& \left[ \bar{\Psi}_1 (i\gamma^\mu
D_\mu ) \Psi_1 +\right.\\ &\qquad+\left.\overline{\Psi}_2 (i\gamma^\mu
D_\mu ) \Psi_2 \right]
\end{align*}
By the way, note the difference between \verb+\overline+ and
\verb+\bar+ in the example above.

\subsection{Matrices}

There are five matrix generating environments in \texttt{amsmath}:
\texttt{matrix}, \texttt{pmatrix}, \texttt{bmatrix}, \texttt{vmatrix}
and \texttt{Vmatrix}; these are used as follows (and can generate
matrices as large as 10$\times$10)
\begin{verbatim}
\begin{gather*}
\begin{matrix} 0 & 1 \\ 1 & 0\end{matrix}\quad
\begin{pmatrix} 0 &-i \\ i &0 \end{pmatrix}\quad
\begin{bmatrix} 1 &0\\0 &-1\end{bmatrix}\quad
\begin{vmatrix} a&b\\c&d\end{vmatrix}\quad
\begin{Vmatrix} 1&0\\0&1\end{Vmatrix}
\end{gather*}
\end{verbatim}
and generate
\begin{gather*}
\begin{matrix} 0 & 1 \\ 1 & 0\end{matrix}\quad
\begin{pmatrix} 0 &-i \\ i &0 \end{pmatrix}\quad
\begin{bmatrix} 1 &0\\0 &-1\end{bmatrix}\quad
\begin{vmatrix} a&b\\c&d\end{vmatrix}\quad
\begin{Vmatrix} 1&0\\0&1\end{Vmatrix}
\end{gather*}

Occasionally you may be disappointed with the alignment in a matrix:
compare
\begin{gather*}
\begin{pmatrix} 0&-1 \\2&1\end{pmatrix}\qquad\text{with}\qquad
\begin{pmatrix} 0&-1\\2&\phantom{-}1\end{pmatrix}.
\end{gather*}
The right-hand matrix was generated with the following source
containing the devilishly cunning \verb+\phantom{...}+ command:
\begin{verbatim}
\begin{pmatrix} 0&-1\\2&\phantom{-}1\end{pmatrix}
\end{verbatim}

\subsection{Equation Numbering}
\label{sec:seceqnum}

You may wish to number your equations by section, by chapter, or
whatever.  Simply create a file called \texttt{seceq.sty} (or
something similar) and include the following in it:
\begin{verbatim}
\renewcommand{\theequation}{\thesection.\arabic{equation}}
\@addtoreset{equation}{section}
\end{verbatim}
Then load this style file with \verb+\usepackage{seceq}+.  In
\texttt{report} class documents, this automatically numbers your
equations as \textsf{chapter.section.equation}.


\subsection{Final Remarks}

There are a host of different (in)equality signs, and some look better
than others, for example:
\begin{itemize}
\item  \verb+\approx+ \quad\(\approx\) \quad cf. \verb+\thickapprox+
\quad $\thickapprox$ \quad cf. \verb+\simeq+ \quad\(\simeq\) \quad
cf. \verb+\approxeq+ \quad $\approxeq$
\item  \verb+\leq+ \quad\(\leq\) \quad cf. \verb+\leqslant+
\quad\(\leqslant\) \quad cf. \verb+\eqslantless+ \quad $\eqslantless$
\quad cf. \verb+\leqq+ \quad $\leqq$
\item  \verb+<<+ \quad $<<$ \quad cf. \verb+\ll+ \quad $\ll$
\end{itemize}

There are some extra fonts which are useful:
\begin{itemize}
\item \verb+\mathbb{...}+ for sets etc.:  ${\mathbb{R,C}}$
\item \verb+\boldsymbol{...}+ for bold symbols, including Greek:
$\boldsymbol{\gamma}\cdot\boldsymbol{\partial}$
\item \verb+\mathcal{...}+ for caligraphic upper case letters:
$\mathcal{L}\sim\mathcal{O}(g^2)$
\item \verb+\frak{...}+ for Euler Fraktur letters (upper and lower case):
$\frak{L}$, $\frak{D}$, $\frak{g}$
\item \verb+\pmb{...}+ ``Poor man's bold'' for otherwise unavailable (=random)
boldface characters: $\pmb{\oint}$
\item  I suggest \verb+\mathtt{R\!e}+  for $\mathtt{R\!e}\{z\}=x$.
\end{itemize}

The Fraktur $\frak L$ and $\frak D$ are good for Lagrangian densities
and functional measures; at least I think they look better than the
caligraphic ones $\mathcal L$ and $\mathcal D$.

When you first start \LaTeX ing, you may end up with lots of spurious
indentations around equations, for if you leave a blank line before
the \verb+\begin{...}+ and/or a blank line after \verb+\end{...}+ then
\LaTeX\ will assume you wish to begin a new paragraph.  The same is
true around figure environments and the like.

\section{Figures}
\label{sec:figs}

Pictures can be generated inside \LaTeX, for example using such
packages as \texttt{axodraw}, and appear inside \texttt{picture}
environments.  Alternatively, you can import (encapsulated) postscript
into your document.  All these appear inside a \texttt{figure}
environment as follows (remember the American spelling of
\texttt{center}!)
\begin{verbatim}
\begin{figure}
\begin{center}
...
\caption{Here is the figure caption.\label{fig_caption}}
\end{center}
\end{figure}
\end{verbatim}
Note the position of the \texttt{label}: it is tied to the caption.
To include postscript files use the \texttt{graphics} package, and the
command \verb+\includegraphics+:
\begin{verbatim}
\begin{figure}
\begin{center}
\includegraphics{file.ps}
\end{center}
\end{figure}
\end{verbatim}

Should you wish to take only a little part of the file
\texttt{file.ps}, delimited by the box with lower left-hand coordinates
$(x,y)$ and upper right-hand coordinates $(x',y')$,
\verb+\includegraphics+ takes a pair of optional arguments:
\begin{verbatim}
\includegraphics[x,y][x',y']{file.ps}
\end{verbatim}
where you must specify the units (which can all be different) for
$\{x,y,x',y'\}$.

To rescale postscript files, use the command \verb+\resizebox+ which
takes three arguments, the width, the height and the object to be rescaled:
\begin{verbatim}
\resizebox{width}{height}{\includegraphics{file.ps}}
\end{verbatim}
Replacing either \texttt{width} or \texttt{height} with \texttt{!}
retains the aspect ratio of the figure while scaling to meet your
required height/width.  The width and height must have units, but note
the existence of \verb+\textwidth+ which can be used (with or without
a multiplicative factor) in the width slot.

Programs such as \texttt{Mathematica} often produce really nasty
postscript with lots of ugly extra space etc.\ which can be the reason
why you cannot seem to get anything else on the page which contains
your graph.  Type the following in a command shell (not in your source
file)
\begin{verbatim}
ps2epsi file.ps file.eps
\end{verbatim}
which will generate a properly bounded encapsulated postscript file
(which can be included with the \verb+\includegraphics+ command as
above).

\subsection{Subfigures}

The package \texttt{subfigure} allows you to put several different
figures into one, and have them individually numbered $N$(a), $N$(b),
etc., labelled and captioned, and allows an overall caption for the
group of figures.  This is useful for putting lots of graphs for
similar results together.  The syntax is as follows:
\begin{verbatim}
\begin{figure}
\begin{center}
\subfigure[First sub-caption]{\label{first_label}\includegraphics{file1.ps}}
\subfigure[Second sub-caption]{\label{second_label}\includegraphics{file2.ps}}
...
\caption{The overall caption.\label{overall_label}}
\end{center}
\end{figure}
\end{verbatim}
Then the call
\begin{verbatim}figure~\ref{first_label}\end{verbatim} generates ``figure
$N$(a)'', while \verb+\ref{overall_label}+ generates ``$N$'' and so
on.

\section{Tabular Environments and Tables}

Tabular environments are for aligning text.  The
\verb+\begin{tabular}+ command takes an argument, which is the
alignment of the columns.  Columns themselves are separated by the
usual \verb+&+ symbols, and rows by \verb+\\+ carriage returns. For
example:
\begin{verbatim}
\begin{tabular}{|c|l|c|}\hline
Gauge Group & Charge & Gauge Field\\
\hline\hline
SU(3)& Colour & 8 gluons\\
SU(2)& Weak isospin & W$^\pm$, Z\\
U(1) & Electric charge & $\gamma$\\\hline
\end{tabular}
\end{verbatim}
generates\vspace{.5cm}

\begin{tabular}{|c|l|c|}\hline
Gauge Group & Charge & Gauge Field\\
\hline\hline
SU(3)& Colour & 8 gluons\\
SU(2)& Weak isospin & W$^\pm$, Z\\
U(1) & Electric charge & $\gamma$\\\hline
\end{tabular}

\vspace{.5cm}

\noindent Notice how the double \verb+\hline+ separates the top from
the rest: if you only put one, this will not happen.  There is a great
amount of flexibility in choosing the layout and presence/absence of
lines when building your tablular environment: if you really need a
complex table, look up \verb+\cline+ and \verb+\multicolumn+ in a
\LaTeX\ manual.  To put the above tabular environment in an article it
is best to put it into a properly spaced \texttt{table} environment
with caption etc. as follows:
\begin{verbatim}
\begin{table}
\begin{center}
The tabular environment above
\caption{The gauge groups of the standard model \label{tab:ggofsm}
\end{center}
\end{table}
\end{verbatim}

\begin{table}[h!]
\begin{center}
\begin{tabular}{|c|l|c|}\hline
Gauge Group & Charge & Gauge Field\\
\hline\hline
SU(3)& Colour & 8 gluons\\
SU(2)& Weak isospin & W$^\pm$, Z\\
U(1) & Electric charge & $\gamma$\\\hline
\end{tabular}
\caption{The gauge groups of the standard model \label{tab:ggofsm}}
\end{center}
\end{table}

\section{Bibliography}
\label{sec:bib}

Basic bibliographies are generated with the
\verb+\begin{thebibliography}+ environment (do not forget to
\texttt{end} it again before ending your document): this puts a
section heading ``Bibliography'' and then lets you list your
references in whatever order you wish them to appear.  The command
\verb+\cite{cornwall74}+ in the body of your document will refer to
the \verb+\bibitem+ as below:
\begin{verbatim}
...
\bibitem{cornwall74} 
J.~Cornwall, R.~Jackiw, and E.~Tomboulis,
Physical Review \textbf{D 10}, 2428 (1974).
...
\end{verbatim}

In this way your document will conclude with a list of
\verb+\bibitem+s like this which will form your bibliography.  \LaTeX\
will need to be run twice on your document to cite everything
properly.

\subsection{BIB\TeX}

A very good way to get \LaTeX\ to create bibliographies for you is by
using BIB\TeX.  Running \LaTeX\ once on your document creates a file
\texttt{file.aux} in which a record is kept of which citations have
been made.  Running BIB\TeX\ (with the command \texttt{bibtex file} or
from within emacs) on your file scans the \texttt{.aux} file and looks
up the citations from your citations master-file in which you keep
records of all the citations you may ever wish to make.  BIB\TeX\ then
creates a file \texttt{file.bbl} which is essentially the bibliography
section for your article, ordered correctly and formatted according to
the style file which you declare.  Running \LaTeX\ again on your file
will actually put the contents of \texttt{file.bbl} into the generated
\texttt{dvi} as though it had been part of your source file.  When you
submit the \LaTeX\ form of an article (e.g. to a journal), you can
simply import the \texttt{.bbl} file into your document and remove the
two commands below which invoke BIB\TeX.

This may sound complicated, but it is actually very easy: you never
have to worry about the order of your citations, you never have to
worry about formatting your bibliography, and most importantly, you
only ever have to look up citations once.  Once they appear in your
references master file, you can cite them whenever you want.

To invoke this bibliography creation you must declare the style file
you wish to use for the bibliography; this affects things like the
order of volume, page, (date), the use of boldface, the use of
italics, the use of \textit{et al} etc.  There are a number of style
files available over the web or from your office mates, simulating
Physical Review, Nuclear Physics, etc.\ bibliography styles.  When you
wish your bibliography to appear (normally the last thing in the
document), you simply use the commands
\begin{verbatim}
\bibliographystyle{sty_file}
\bibliography{references_file}
\end{verbatim}
which respectively declare the style file you wish to use and the name
of your citations master-file (which should have a \texttt{.bib} tag).
If you have the style file in your home directory somewhere you
obviously only want to keep one copy, so refer to \verb+sty_file+ with
its full path (dropping the final \texttt{.sty}), starting from
\verb+/home/wytham...+.  Or if you are clever you can change your
paths so that \LaTeX\ knows where to find it.  To create your
citations master-file requires a little effort; here is where
\texttt{emacs} really comes into its own, for it understands the
syntax in your master-file as well, and has all sorts of nice features
which help with the construction of your bibliography.
Particle-people will be pleased to know that the SPIRES database has a
BIB\TeX\ function which will print out the entry which you should put
into your master references file for any paper since 1975, and for
many from before.  After a while it is pretty easy to figure them out
for yourself.  For instance, the entry which appears in my
\texttt{refs.bib} file which generates the Cornwall 1974 reference
above is:
\begin{verbatim}
@Article{cornwall74,
     author    = "John M. Cornwall and R. Jackiw and E. Tomboulis",
     title     = "EFFECTIVE ACTION FOR COMPOSITE OPERATORS",
     journal   = "Phys. Rev.",
     volume    = "D10",
     year      = 1974,
     pages     = 2428,
     SLACcitation  = "%%CITATION = PHRVA,D10,2428;%%"
}
\end{verbatim}

There are also \verb+@Book+ types, \texttt{eprint} fields and lots
more: it is worth playing with BIB\TeX\ and working out how to get it
to do what you want.  In the end, it is much simpler and quicker to
have all your references in one place (you can include your own notes
on each paper which BIB\TeX\ will ignore) and to let BIB\TeX\ do the
sorting.

\section{Errors}

\textsc{do not panic.}

It is essentially inevitable that \LaTeX\ will generate errors when
you first try to compile a document.  There are many common errors
which occur, and as you get used to things, you will start to spot
them more easily.

\texttt{emacs} can help a lot, for it can tell you when you do not
have matching brackets, dollar signs, etc., and can \texttt{end}
environments automatically after you \texttt{begin} them.

For other errors, you just have to go back and look at your document:
no doubt you will have done something strange/silly.  Sometimes it is
worth letting \LaTeX\ continue if it will, for often the output which
it generates makes it much easier to trace your error.  However, this
can go wrong when one error leads to another, e.g. when you have
missed a curly brace delimiting an argument of a command, such as when
you type
\begin{verbatim}
\frac{1}{a lot of old rubbish here
\end{verbatim}
and \LaTeX\ tries in vain to put the entirety of the remainder of your
document in the denominator of your fraction.  Who can blame it for
complaining?

It sometimes happens that you make a catastrophic error (which may
actually seem quite harmless to you) and after you have corrected it
\LaTeX\ will apparently refuse to compile your document ever again,
complaining that it does not even understand the command
\verb+\begin{document}+.  Do not worry: simply remove the
\texttt{.aux} file which accompanies your source and run \LaTeX\
again.

One last thing: \LaTeX\ regularly complains about lines being too
long, i.e. when it complains about an \verb+Overfull \hbox+.  This can
be an equation that needs wrapping, or simply a bunch of words it does
not know how to hyphenate.  Although \LaTeX\ will happily compile such
documents, they look terrible, so do try to sort out the problem.
\LaTeX\ does not know how to hyphenate some scientific words, and you
can teach it to do so as and when required with the ``you may put a
hyphen here if you want'' command \verb+\-+, as in
\verb+renormal\-ization+.  You only need to do this as and when
problems arise: \LaTeX\ copes quite happily most of the time.  For
equations, sometimes you simply have to accept that your wonderful
mathematics has to be broken over two lines, and include some carriage
returns.  After all: do you want to do it yourself, or are you willing
to let the \textsf{EDITOR} do it?

\noindent\textsc{do not panic.}

\section{Processing and Viewing Your Document}
\label{sec:procdoc}

To compile your document, \texttt{source.tex}, run the following
command (the commands in this section are to be run in an ordinary
command shell):
\begin{verbatim}
latex source
\end{verbatim}
(The \texttt{.tex} tag is implied: if you are perverse and have not
used this then you will have to tell \LaTeX\ explicitly what you are
talking about.)  This will generate all sorts of other files,
\texttt{.log} files, \texttt{.aux} files, etc.: do not worry about
them.  If you have citations, references etc., then \LaTeX\ will
initially complain that you have all sorts of undefined whatnots.  Run
\LaTeX\ again and only then will it stop complaining and
cross-reference everything properly (assuming you have made no
mistakes).  If you are using BIB\TeX\ then run
\begin{verbatim}
bibtex source
latex source
latex source
\end{verbatim}
after the original \LaTeX\ run.  Do not worry: you do not need to run
\LaTeX\ three times every time you compile, but if you change your
citations, it will take the above sequence to get it right.  In the
course of making a document, you will run \LaTeX\ many many many
times, and the citations, references, etc.\ will catch up with
themselves; there is no point in running \texttt{bibtex} unless you
have changed your citations.

All this \LaTeX ing will generate a \texttt{source.dvi} which can be
viewed with
\begin{verbatim}
xdvi source &
\end{verbatim}
(the ampersand runs \texttt{xdvi} in the background so that you can
still use your window).  If you wish to convert to postscript then use
\begin{verbatim}
dvips -o source.ps source.dvi
\end{verbatim}
and you can then view the postscript with \texttt{ghostview} or print
with \texttt{lpr}.  Note that \texttt{dvips source} (i.e. without the
option \verb+-o+) will print without cluttering up your home directory
with postscript.  Note further that there are some things
(\texttt{axodraw} figures, for instance) which only appear in the
final postscript (which you can view or print).

To print on one side of the paper only in this department, use
\begin{verbatim}
lpr -Z simplex source.ps
\end{verbatim}
Presumably the \texttt{Z} stands for ``Zen'' or something similar;
nevertheless, it works.

\section{Conclusion}

Finally I should just like to say that \LaTeX\ provides many different
solutions to the same typesetting problems: it is fun to try to find
the right way, the most elegant way, the way which impresses your
office-mates the most, and so on.  It is really worth scanning a
\LaTeX\ guide, or better, a \emph{Companion}, and finding the right
way to do things.  Alternatively, an excellent local web-site:
\begin{verbatim}
www-thphys.physics.ox.ac.uk/users/JennyWilliams/home.html
\end{verbatim}
in which there is much about \LaTeX, and BIB\TeX\ in particular.

\section{The End}

Do not forget to end your document:
\begin{verbatim}
\end{document}
\end{verbatim}

\end{document}
