\documentclass[dvips,
 % pdflatex,
 footrule,
 landscape,
 % shortform
]{foils}

%\usepackage{times}
%\usepackage{lucidbry}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{latexsym}
%\usepackage{epsfig}
\usepackage{graphicx}
\usepackage{color}
\usepackage{array}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{subfigure}
\usepackage{wrapfig}
\usepackage{slashbox}
\usepackage{delarray}
\usepackage{alltt}
\usepackage{pifont}
%\usepackage{bbding}

\addtolength{\topmargin}{-0.5in} \addtolength{\textheight}{1in}
\setlength{\parindent}{0in} \setlength{\foilheadskip}{-0.25in}

\renewcommand{\arraystretch}{1.15}

\newcommand{\smallsp}{\hspace{0.1in}}
\newcommand{\medsp}{\hspace{0.25in}}
\newcommand{\bigsp}{\hspace{0.5in}}
\newcommand{\mr}{\mathrm}
\newcommand{\convprob}{\ensuremath{\stackrel{P}{\longrightarrow}}}
\newcommand{\convae}{\ensuremath{\stackrel{a.e.}{\longrightarrow}}}
\newcommand{\convas}{\ensuremath{\stackrel{a.s.}{\longrightarrow}}}
\newcommand{\convd}{\ensuremath{\stackrel{\mathcal{D}}{\longrightarrow}}}
\newcommand{\appdist}{\ensuremath{\stackrel{approx.}{\sim}}}
\newcommand{\define}{\ensuremath{\stackrel{Def}{=}}}
\newcommand{\iid}{\ensuremath{\stackrel{iid}{\sim}}}
\newcommand{\ind}{\ensuremath{\stackrel{ind}{\sim}}}
\newcommand{\bs}{\backslash}
\newcommand{\Dhat}{\ensuremath{\hat{D}}}
\newcommand{\phat}{\ensuremath{\hat{p}}}
\newcommand{\pihat}{\ensuremath{\hat{\pi}}}
\newcommand{\Rhat}{\ensuremath{\hat{R}}}
\newcommand{\thetahat}{\ensuremath{\hat{\theta}}}
\newcommand{\betahat}{\ensuremath{\hat{\beta}}}
\newcommand{\varhat}{\ensuremath{\widehat{\Var}}}
\newcommand{\ptilde}{\ensuremath{\tilde{p}}}
\newcommand{\Ptilde}{\ensuremath{\tilde{P}}}
\newcommand{\ytilde}{\ensuremath{\tilde{y}}}
\newcommand{\xtilde}{\ensuremath{\tilde{x}}}
\newcommand{\Xtilde}{\ensuremath{\tilde{X}}}
\newcommand{\yrep}{\ensuremath{y^{rep}}}
\newcommand{\phiold}{\ensuremath{\phi^{\mathrm{old}}}}
\newcommand{\phinew}{\ensuremath{\phi^{\mathrm{new}}}}
\newcommand{\yhat}{\ensuremath{\hat{y}}}
\newcommand{\Yhat}{\ensuremath{\hat{Y}}}
\newcommand{\xbar}{\ensuremath{\bar{x}}}
\newcommand{\Xbar}{\ensuremath{\bar{X}}}
\newcommand{\ybar}{\ensuremath{\bar{y}}}
\newcommand{\Ybar}{\ensuremath{\bar{Y}}}
\newcommand{\Var}{\ensuremath{\mathrm{Var}}}
\newcommand{\Cov}{\ensuremath{\mathrm{Cov}}}
\newcommand{\Corr}{\ensuremath{\mathrm{Corr}}}
\newcommand{\Mode}{\ensuremath{\mathrm{Mode}}}
\newcommand{\Med}{\ensuremath{\mathrm{Med}}}
\newcommand{\SD}{\ensuremath{\mathrm{SD}}}
\newcommand{\tr}{\ensuremath{\mathrm{tr}}}
\newcommand{\logit}{\ensuremath{\mathrm{logit}}}
\newcommand{\zscore}{\ensuremath{z}-score}
\newcommand{\pvalue}{\ensuremath{p}-value}
\newcommand{\rank}{\ensuremath{\mathrm{rank}}}
\newcommand{\diag}{\ensuremath{\mathrm{diag}}}
\newcommand{\invchisq}{\ensuremath{\mathrm{Inv-}\chi^2}}
\newcommand{\invwish}{\ensuremath{\mathrm{Inv-}\mathrm{Wishart}}}
\newcommand{\wish}{\ensuremath{\mathrm{Wishart}}}
\newcommand{\ninvchisq}{\ensuremath{\mathrm{N-}\mathrm{Inv-}\chi^2}}
\newcommand{\invgamma}{\ensuremath{\mathrm{Inv-}\mathrm{Gamma}}}
\newcommand{\Rn}[1]{\ensuremath{\mathbb{R}^#1}}
\newcommand{\silly}[2]{\ensuremath{f(#1 + 2, #2 - 2)}}
\newcommand{\boldw}{{\mathbf{w}}}
\newcommand{\boldW}{{\mathbf{W}}}
\newcommand{\boldv}{{\mathbf{v}}}
\newcommand{\boldV}{{\mathbf{V}}}
\newcommand{\bolds}{{\mathbf{s}}}
\newcommand{\boldy}{{\mathbf{y}}}
\newcommand{\boldx}{{\mathbf{x}}}
\newcommand{\boldY}{{\mathbf{Y}}}
\newcommand{\boldX}{{\mathbf{X}}}
\newcommand{\boldZ}{{\mathbf{Z}}}
\newcommand{\boldc}{{\mathbf{c}}}
\newcommand{\boldd}{{\mathbf{d}}}
\newcommand{\bolde}{{\mathbf{e}}}
\newcommand{\boldC}{{\mathbf{C}}}
\newcommand{\boldD}{{\mathbf{D}}}
\newcommand{\boldE}{{\mathbf{E}}}
\newcommand{\boldm}{{\mathbf{m}}}
\newcommand{\boldp}{{\mathbf{p}}}
\newcommand{\boldq}{{\mathbf{q}}}
\newcommand{\boldr}{{\mathbf{r}}}
\newcommand{\boldP}{{\mathbf{P}}}
\newcommand{\boldQ}{{\mathbf{Q}}}
\newcommand{\boldR}{{\mathbf{R}}}
\newcommand{\boldO}{{\mathbf{0}}}
\newcommand{\boldK}{{\mathbf{K}}}
\newcommand{\boldA}{{\mathbf{A}}}
\newcommand{\bolda}{{\mathbf{a}}}
\newcommand{\boldb}{{\mathbf{b}}}
\newcommand{\boldcA}{{\boldsymbol{\mathcal A}}}
\newcommand{\boldcW}{{\boldsymbol{\mathcal W}}}
\newcommand{\boldcX}{{\boldsymbol{\mathcal X}}}
\newcommand{\boldcZ}{{\boldsymbol{\mathcal Z}}}
\newcommand{\bolddelta}{{\boldsymbol{\delta}}}
\newcommand{\boldepsilon}{{\boldsymbol{\epsilon}}}
\newcommand{\boldmu}{{\boldsymbol{\mu}}}
\newcommand{\boldnu}{{\boldsymbol{\nu}}}
\newcommand{\boldpi}{{\boldsymbol{\pi}}}
\newcommand{\boldSigma}{{\boldsymbol{\Sigma}}}
\newcommand{\scriptX}{{\mathcal{X}}}
\newcommand{\scriptY}{{\mathcal{Y}}}
\newcommand{\neff}{{\ensuremath{n_{\mathrm{eff}}}}}
\newcommand{\matlab}{\textbf{MATLAB}}
\newcommand{\R}{\textbf{R}}
\newcommand{\sas}{\textbf{SAS}}
\newcommand{\spss}{\textbf{SPSS}}
\newcommand{\stata}{\textbf{Stata}}
\newcommand{\systat}{\textbf{Systat}}
\newcommand{\minitab}{\textbf{Minitab}}
\newcommand{\WinBugs}{\textbf{WinBUGS}}
\newcommand{\winbugs}{\textbf{WinBUGS}}
\newcommand{\openbugs}{\textbf{OpenBUGS}}
\newcommand{\bugsr}{\textbf{bugs.R}}
\newcommand{\brugs}{\textbf{BRugs}}
\newcommand{\splus}{\textbf{S-Plus}}
\newcommand{\s}{\textbf{S}}
\newcommand{\url}[1]{$<${\tt #1}$>$}
\newcommand{\code}[1]{\texttt{#1}}
\newcommand{\tab}{$\backslash$t}

\newcommand{\bst}{{\verb+\+}}


\newenvironment{Cases}{\begin{array}\{{lL}.}{\end{array}}
\newenvironment{Matrix}{\begin{array}{*{20}{c}}}{\end{array}}

\def\otabler#1{\vbox{\offinterlineskip\halign{
\enspace\hfil$##$\strut~\vrule\enspace&&\enspace\hfil$##$\enspace\cr#1}}}

\def\ctabler#1{\vbox{\offinterlineskip\hrule\halign{\vrule
\enspace\hfil$##$\strut\enspace\vrule&&\enspace\hfil$##$\enspace\vrule\cr#1}\hrule}}

\def\dtabler#1{\vbox{\offinterlineskip\hrule\halign{\vrule
\enspace\hfil$##$\strut\enspace\vrule&&\enspace\hfil$##$\enspace\vrule\cr#1}\hrule}}

\title{\LaTeX}
\author{Statistics 135}

\date{Autumn 2005}



\begin{document}

\maketitle \MyLogo{Copyright \copyright 2005 by Mark E. Irwin}

\vspace{0.5in}

\begin{center}
\includegraphics[scale=1]{harvardshield.eps}
\end{center}



\foilhead{What is \TeX?} \MyLogo{What is \TeX?}

\begin{quote}
\TeX\ represents the state-of-the-art in computer typesetting. It is
particularly valuable where the document, article, or book to be
produced contains a lot of mathematics, and where the user is
concerned about typographic quality.  \TeX\ software offers both
writers and publishers the opportunity to produce technical text, in
an attractive form, with the speed and efficiency of a computer
system.

(from the back cover of The \TeX book by Donald E. Knuth, the
initial developer of \TeX)

\end{quote}

Most of what is done today is not in plain \TeX, but with addon
macro packages.  Parts of \TeX\ tend to be cryptic, so these addons
have been created to make things easier.  The most popular of these
addons is \LaTeX.  Others you might come across are AMS-\TeX and
AMS-\LaTeX.

\foilhead{What is \LaTeX?} \MyLogo{What is \LaTeX?}

\LaTeX\ is a document preparation system based on the \TeX\
formatter.  It is a set of macros which simplifies much of plain
\TeX. \LaTeX\ is the most popular approach to writing papers in
Science, particularly in Mathematics and Physical Sciences.  Much
publishing today is done in \LaTeX\.  I believe everything published
by Springer-Verlag, is prepared in \LaTeX.  Many journals have also
gone the \LaTeX\ route as well, with packages prepared to assist
with matching the journal format.

The most current version commonly available is \LaTeXe, though
\LaTeX3 is currently in development.  The previous version was
\LaTeX\ 2.09, which is quite a bit different.  While files written
in this version will run in \LaTeXe\ (usually), you want to stick
with \LaTeXe\ for your writing.

\LaTeX, and all \TeX\ derivatives are page markup languages, with
formatting commands mixed in with the text, similar to HTML.  It is
not a WYSIWYG approach, like Microsoft Word, though there are
products that try to bring this to the \LaTeX\ world.

A \LaTeX\ file, is a plain text file which is then processed to give
the desired output.  The output is usually in a {\tt .dvi} file,
which then can be converted to other formats, such as postscript or
pdf, if desired.

This approach to preparing documents allows for great flexibility
and many things to be automated.  These include

\begin{itemize}
\item Pagination

\item Equation numbering

\item Creation of tables of contents, list of figures, etc

\item Bibliography creation and proper citation in the text

\item Changing fonts and font sizes

\end{itemize}

\foilhead{How to Learn \LaTeX} \MyLogo{How to Learn \LaTeX}

While checking manuals, online searches, etc can be helpful, the way
most people learn \LaTeX\ is to see other \LaTeX\ files.  In
addition to these overheads, I will make available the \LaTeX\ file
for this document, plus others, so you can see how things work.

Even if you think you know how to do something, many things can be
done many ways, so it can be interesting to see how other people
will approach a problem.

For example \texttt{$\bs$textit\{italic\}} and {\texttt{\{$\bs$it
italic\}} will both italicize the word \textit{italic}.


\foilhead{Example \LaTeX\ file} \MyLogo{Example \LaTeX\ file}

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

% define the title
\author{H. ~Partl}
\title{Minimalism}

\begin{document}

% generate the title
\maketitle

% insert the table of contents
\tableofcontents

\section{Some interesting words}
Well, and here begins my lovely article.

\section{Good Bye World}
\ldots{} and here it ends.

\end{document}

\end{verbatim}

\foilhead{Typical \LaTeX\ session} \MyLogo{Typical \LaTeX\ session}

\begin{enumerate}
\item Edit/Create your \LaTeX\ input file.  This file must be plain
ASCII text.  In addition, the file name must in in {\tt .tex}

\item Run \LaTeX\ on your input file.  It may be necessary to run
\LaTeX\ more than once to get the table of contents, table numbers,
citations, etc correct.  If there is a bug in your input file, you
will get an error message and processing will stop.  If there are no
errors you will get a {\tt .dvi} file.

In Unix, you can process your document with a command such as {\tt
latex foo.tex}.

\newpage
\item Viewing the {\tt .dvi} file.  There are a number of ways to
do this.  In Unix (under X windows), the file can be display on your
screen with {\tt xdvi foo.dvi \&}.  In Windows, you can use the
program {\tt yap}.  You can convert the file to postscript with {\tt
dvips foo.dvi -o foo.ps} or print it with {\tt dvips foo.dvi} in
Unix.  It can be converted to pdf with {\tt dvipdf foo.dvi}.
\end{enumerate}

These three steps will be required regardless of your computer
setup, however how they are implemented can very greatly.  For
example, many people in the Unix world will often run \LaTeX from
within an {\tt emacs} session, where the approach is a bit more
unified.  However others tend to work from the command line. Also,
the {\tt emacs} setup can also be used in a Windows or Macintosh
setup, though I think these are less common.

\foilhead{Document Layout} \MyLogo{Document Layout}

\begin{enumerate}
\item Document Classes.

\LaTeX\ needs to what type document is to be created.  This is
specified with the {\tt documentclass} command.

\framebox{\tt $\bs$documentclass[{\it options}]\{{\it class}\}}

{\it class} specifies the type of document to be created.  Common
choices are {\tt article}, {\tt report}, {\tt book}, and {\tt
slides}. These slides were created with {\tt foils}, a different set
of macros for preparing slides.  Note foils is not in the standard
\LaTeX\ installations, but can downloaded via CTAN (The
Comprehensive TeX Archive Network). I'll look into having it
installed.

The {\it options} parameter customize the behaviour of the document
class.  The options need to be separated by commas. Popular options
are {\tt 10pt}, {\tt 12pt}, {\tt onecolumn}, and {\tt landscape}.
The actual options available will vary by document class.

\clearpage

\item Packages

When preparing your document, you may find that there are things you
would like to do which aren't available in the default \LaTeX\
setup.  If you want to include graphics, add color, or include
source code from a file into your document, you will need to enhance
your setup.  These enhancements are known as packages and can be
activated with the

\framebox{\code{$\bs$usepackage[{\it options}]\{{\it class}\}}}

For example, to typeset the document using Times-Roman instead of
the standard Computer Modern font, add the command

\begin{verbatim}
\usepackage{times}
\end{verbatim}

Note how a package acts may depend on the document style being used.
For example, the above would actually make this document be typeset
in Helvetica, not Times (it is a quirk of the way \code{foils} is
designed). However for \code{article}, \code{report}, etc, you would
get times.

\item Page Styles

\LaTeX\ supports three different page styles (header/footer)
combinations.  The \textit{style} parameter of the command

\framebox{\tt $\bs$pagestyle\{{\it style}\}}

defines which to use.  The choices are {\tt plain} (page number at
the bottom of the page in the middle of the footer), {\tt heading}
(prints current chapter heading and the page number in the header,
while the footer remains empty), and {\tt empty} (both header and
footer are empty).

To change it only for the current page, use the command

\framebox{\tt $\bs$thispagestyle\{{\it style}\}}

To do more complicated things,  see either The \LaTeX\ Companion or
The Not so Short Introduction to \LaTeX2e\ (available on the course
web site).

\end{enumerate}

\foilhead{Document Structure - Sectioning} \MyLogo{Document
Structure - Sectioning}

For most document styles, documents are divided using the different
sectioning commands.  The standard ones are
\begin{verbatim}
  \part      \subsection      \paragraph
  \chapter   \subsubsection   \subparagraph
  \section
\end{verbatim}
The {\tt article} class doesn't contain the \verb+\chapter+ command.
However this makes it easy to include an ``article'' as a chapter of
a ''report'' or ``book''.

The form of these commands is similar to \verb+\section{Example+
\verb+Section}+.

With this approach, it is easy to have your chapter, sections,
subsections, etc, to be automatically numbered.  For articles,
number is of the form Section 2, Subsection 3.4, Subsubsection
3.1.5.  For books and reports, the form is Chapter 3, Section 4.2,
etc.

If you want to have an unnumbered subsection, for example, you need
to add a {\tt *} to the command, such as
\verb+\subsection*{Unnumbered+ \verb+subsection}+.  Adding a {\tt
*} to the end of a command that deals with numbering, will often
remove that numbering from the object.

You can keep track off section numbers you use elsewhere in the text
with \verb+\label{+{\it keystring}\verb+}+ command.  To refer to a
stored label, use the \verb+\ref{+{\it keystring}\verb+}+ and its
page number with \verb+\pageref{+{\it keystring}\verb+}+ command.
These commands are particularly useful with equations.


\foilhead{Preparing and Input File} \MyLogo{Preparing and Input
File}

As mentioned before, your input file should be a plain ASCII text
files with a filename ending with {\tt .tex}.  Only the standard
character set, numbers, and punctuation characters
\begin{center}
\verb+ . : ; , ? ! ` ' ( ) [ ] - / * @+
\end{center}
should be used.

There are 10 special characters
\begin{center}
\verb+# $ % & ~ _ ^ \ { }+
\end{center}
that are only used in \LaTeX\ commands.  For example \% initiates a
comment, \$ is used to indicate mathematics, and $\bs$ indicates a
command.

The characters \verb. + = | < >. are mainly used in mathematical
formulas, though + and = can be used in ordinary text.  Most of the
special characters can be included in text by preceding it with a
$\bs$.  For example {\tt $\bs$\$} will give a \$.

When entering text, the ends of words and sentences are marked by
spaces.  It doesn't matter how many spaces you leave when you type;
100 spaces acts the same as 1.

To indicate a new paragraph, leave one or more blank lines before
the next paragraph.

\foilhead{Fonts} \MyLogo{Fonts}

\begin{table}[h]
\centering { \small
\begin{tabular}{lll}
Style & Approach 1 & Approach 2 \\
{\it italics} & {\tt \{$\bs$it italics\}} & {\tt $\bs$textit\{italics\}} \\
{\sl slanted} & {\tt \{$\bs$sl slanted\}} & {\tt $\bs$textsl\{slanted\}} \\
{\em emphasized} & \code{\{$\bs$em emphasized\}} & \code{$\bs$textem\{emphasized\}} \\
{\bf boldface} & {\tt \{$\bs$bf boldface\}} & {\tt $\bs$textbf\{boldface\}} \\
{\tt typewriter} & {\tt \{$\bs$tt typewriter\}} & {\tt $\bs$textt\{typewriter\}} \\
{\rm roman} & {\tt \{$\bs$rm roman\}} & {\tt $\bs$textrm\{roman\}} \\
{\sc small caps} & {\tt \{$\bs$sc small caps\}} & {\tt
$\bs$textsc\{small caps\}}
\end{tabular}
} \caption{Font styles}
\end{table}

\clearpage

\begin{table}[h]
\centering { \small
\begin{tabular}{ll}
Size & Approach\\
{\tiny tiny} & {\tt \{$\bs$tiny tiny\}}  \\
{\scriptsize scriptsize} & {\tt \{$\bs$scriptsize scriptsize\}}  \\
{\footnotesize footnotesize} & {\tt \{$\bs$footnotesize footnotesize\}}  \\
{\small small} & {\tt \{$\bs$small small\}}  \\
{\normalsize normalsize} & {\tt \{$\bs$normalsize normalsize\}}  \\
{\large large} & {\tt \{$\bs$large large\}}  \\
{\Large Large} & {\tt \{$\bs$Large Large\}}  \\
{\huge huge} & {\tt \{$\bs$huge huge\}}  \\
{\Huge Huge} & {\tt \{$\bs$Huge Huge\}}  \\
\end{tabular} }
\caption{Font sizes}
\end{table}

\foilhead{Braces, Environments, and Delimeters} \MyLogo{Braces,
Environments, and Delimeters}

In \LaTeX, braces \{ and \} are used to indicate pieces of text that
are to be treated in a certain way.  For example on the previous
page, construction like {\tt \{$\bs$Large match your braces\}} were
used to indicate a piece of text is to be displayed in the {\tt
Large} font size.  Missing the closing \}, could lead to the rest of
the document being created in the {\tt Large} font, or more likely
an error message when being processed. You have to make sure your
braces match.

This also occurs with other \LaTeX\ constructs.  For example,
in-line math formulas are usually indicated with {\tt \$ ... \$}. If
the closing {\tt \$} is missing you will usually get an error
message. The other common situation where you need to be careful is
with \LaTeX\ environments, which are indicated with {\tt
$\bs$begin\{\} ... $\bs$end\{\}}.  Enviroments are used in many
situations, such as equations, lists, tables, figures, quotes, and
so on.

\newpage
Also when dealing with these sorts of constructs, you need to deal
with them in a LIFO (Last In, First Out) type approach.  For example
{\verb+{ $ \alpha } $+ probably will return an error message, where
{\verb+{ $ \alpha $ }+ will work fine, displaying the greek letter
$\alpha$.

These sorts of problems are probably the second most common errors
in \LaTeX, following omitting a backslash for a command.  For
example, typing {\verb+$bar{x}$+ instead of \verb+$\bar{x}$+, which
will lead to $bar{x}$, instead of displaying $\bar{x}$.


\foilhead{Mathematical Formulas}  \MyLogo{Mathematical Formulas}

All mathematical typesetting is done through one of the math modes,
{\tt math}, {\tt displaymath}, and {\tt equation}.  These are used
for \emph{in-text} formulas, unnumbered display equations, and
numbered display equations.

Math mode is usually indicated by \texttt{\$ ... \$}.  For example
the code
\begin{verbatim}
  The equation $\alpha + \beta = \gamma$
  is just for example.
\end{verbatim}
gives the output ``The equation $\alpha + \beta = \gamma$ is just
for example''.

\clearpage

The other 2 environments deal with display equations. Examples of
each are are
\begin{verbatim}
  \begin{equation}
  g(s, t; X_{t}) = \int \delta(r_{s,w})
  f(w|s, X_t)dw;~s \in D
  \end{equation}

  \begin{displaymath}
  g(s, t; X_{t}) = \int \delta(r_{s,w})
  f(w|s, X_t)dw;~s \in D
  \end{displaymath}
\end{verbatim}
These give the following output

\begin{equation}
g(s, t;X_{t}) = \int \delta(r_{s,w}) f(w|s, X_t)dw;~s \in D
\end{equation}

\begin{displaymath}
g(s, t;X_{t}) = \int \delta(r_{s,w}) f(w|s, X_t)dw;~s \in D
\end{displaymath}

\newpage
Note that the {\tt displaymath} environment can also be indicated
with \verb+\+{\tt begin\{equation*\} ... } \verb+\+{\tt
end\{equation*\}} or with the even easier \verb+$$ ... $$+

The {\tt displaymath} and {\tt equation} environments are designed
for one-line formulas.  For multiline formulas, one approach is the
{\tt eqnarray} environments. For example
\begin{verbatim}
  \begin{eqnarray*}
  y & = & \int_a^b (f(x) + g(x))dx \\
    & = & \int_a^b f(x)dx + C
  \end{eqnarray*}
\end{verbatim}
gives
\begin{eqnarray*}
y & = & \int_a^b (f(x) + g(x))dx \\
  & = & \int_a^b f(x)dx + C
\end{eqnarray*}

\clearpage

Adding the package \code{amsmath}
(\code{$\bs$usepackage\{amsmath\}}), part of $\mathcal{AMS-}$\LaTeX,
allows for other approaches.

For example, the \code{align} environment has a similar effect, but
better spacing in my opinion.

\begin{verbatim}
  \begin{align*}
  y & = \int_a^b (f(x) + g(x))dx \\
    & = \int_a^b f(x)dx + C
  \end{align*}
\end{verbatim}
gives
\begin{align*}
y & =  \int_a^b (f(x) + g(x))dx \\
  & =  \int_a^b f(x)dx + C
\end{align*}

\clearpage

Other environments for mulitline formulas are \code{multiline},
\code{gather}, and \code{split}.

The package \code{amsmath} does much more than this.  If you are
dealing with mathematics, use almost always want to add this
package, along with \code{amsfonts} and \code{amssymb}.  For
example, additional mathematical features and structures are added.
One example is \code{$\bs$binom\{a\}\{b\}}, which gives
$$
\binom{a}{b}
$$

Adding unused packages to a \LaTeX\ file usually has minimal effect.
So many people will create lists of items that they will include in
all files.

\foilhead{Math Symbols}

There is a wide arrange of symbols available in \LaTeX. I suggest
checking any of the suggested reference on the web site. One useful
is at {\tt <http://www.agu.org/symbols.html>}.

Many of them are obvious, where a \verb+\+ proceeds the name, e.g.
\verb+\theta+ or \verb+\div+.  However some are a bit cryptic, e.g.
\verb+\pm+ for $\pm$.

A common convention in mathematical typesetting, is for functions
like {\tt log, sin, min} to in roman text, not italized.  For these
sorts of functions, adding a \verb+\+ to the command stops the
function name from begin italized.  For example \verb+$\exp(x)$+
gives $\exp(x)$, whereas, \verb+$exp(x)$+ gives $exp(x)$.

\foilhead{Common Structures}

\noindent {\bf Subscripts and Superscripts}
\newline
Subscripts and superscripts are made with the {\_} and
{\^~}commands.  These can be combined to make complicated structures
\begin{table}
\begin{center}
\begin{tabular}{llll}
$x^{2y}$ & \verb+x^{2y}+ & $x^{y^2}$ & \verb+x^{y^2}+ \\
$x_{2y}$ & \verb+x_{2y}+ & $x_2^y$ & \verb+x_2^y+
\end{tabular}
\end{center}
\end{table}

\noindent {\bf Fractions}
\newline
Fractions can either be denoted with / with the \verb+\frac+
command.  For example \verb+$a/b$+ gives $a/b$ where as
\verb+\frac{a}{b}+ gives
$$
\frac{a}{b}.
$$
The \verb+\frac+ command can be used inline, but it tends not to be.

\clearpage

\noindent {\bf Roots}
\newline
Roots are indicated with the \verb+\sqrt+ command.  A square root is
indicated with \verb+\sqrt{x \times y}+ ($\sqrt{x \times y}$) and an
$n^{th}$ root with \verb+\sqrt[n]{3}+ ($\sqrt[n]{3}$).

\noindent {\bf Summation, Integrals, Products, ...}
\newline
The commands for these functions have the property that they they
adjust there size, depending on the formula.  The basic structure is
of the form
\begin{verbatim}
  \begin{equation}
  \frac{\pi^2}{8} = \sum_{k=1}^{\infty}
                         \frac{1}{(2k-1)^2}
  \end{equation}
\end{verbatim}
which gives
\begin{equation}
  \frac{\pi^2}{8} = \sum_{k=1}^{\infty} \frac{1}{(2k-1)^2}
\end{equation}


For integration use {\tt int}, products use {\tt prod}, unions
($\bigcup$) use {\tt bigcup}, intersections ($\bigcap$), use {\tt
bigcap}, etc.

\foilhead{Defining commands} \MyLogo{Defining Commands}

A useful feature in \LaTeX\ is the ability to define commands. These
are often used to create custom shortcuts for your commonly used
commands.    To do this use the \verb+\newcommand+ command. Its
first argument is the command name and the second argument isthe
command text.  For example to create a command for \xbar, you could
use
\begin{verbatim}
  \newcommand{\xbar}{\ensuremath{\bar{x}}}
\end{verbatim}

It is possible to create more complicated commands, such as ones
that take arguments.  An example, albeit silly, is
\begin{verbatim}
  \newcommand{\silly}[2]
     {\ensuremath{f(#1 + 2, #2 - 2)}}
\end{verbatim}
for which \verb+\silly{2x}{z}+ gives \silly{2x}{z}.

You need to be a bit careful in naming your new commands.  You don't
want them to start with the names of built in commands.

\foilhead{Adding Graphics} \MyLogo{Adding Graphics}

While there are many ways of adding graphics to a \LaTeX\ document,
probably the most popular way currently is with the {\tt graphicx}
package, which I believe is now part of most standard \LaTeX\
installations.  To use it, you just need to give the command
\verb+\usepackage{graphicx}+.

This is particularly useful with postscript graphics created by
either \s\ or \matlab.  I believe that the package will handle other
graphics format such as tiff, but I've never used anything but
encapsulated postscript.

The base command is

\framebox{\tt $\bs$includegraphics[{\it key=value, ...}]\{{\it
file}\}}}

The important {\it keys} are {\tt width}, {\tt height}, {\tt angle},
and {\tt scale}.

\begin{figure}[ht]
\begin{center}
\includegraphics[scale=0.8]{rbox.ps}
\caption{\label{fig:rbox}Boxplot of Petal Width generated by R}
\end{center}
\end{figure}

which was formatted by the following code

\clearpage

\begin{verbatim}
  \begin{figure}[ht]
  \begin{center}
  \includegraphics[scale=0.8]{rbox.ps}
  \caption{\label{fig:rbox}
  Boxplot of Petal Width generated by R}
  \end{center}
  \end{figure}
\end{verbatim}

Usually you want to create the graphic the correct size and set the
scale at 1 [\code{scale=1}], but there can be times that rescaling
the size of the graphic can be useful.


\foilhead{List Structures} \MyLogo{List Structures}

There are a number of different list environments available in
\LaTeX.  These include

\begin{itemize}

\item Unnumbered lists: \code{itemize}

Items in this type of list are headed by bullets, dashes, etc

\item Numbered lists: \code{enumerate}

Items in this type of list are headed by numbers, letters, roman
numerals, etc

\item Lists with user specified labels: \code{description}

In this type of list, the user can specified the header of each
item, including no header, though this usually looks weird.

\end{itemize}

\clearpage

This list was created by the following \LaTeX\ code:

\begin{verbatim}
  \begin{itemize}

  \item Unnumbered lists: \code{itemize}

  \item Numbered lists: \code{enumerate}

  \item Lists with user specified labels: \code{description}

  \end{itemize}
\end{verbatim}

To create a list, the appropriate \verb+\begin+ and \verb+\end+
commands must bracket the list.  A new list item is indicated with
the \verb+\item+ command.  For a \code{description} list, the item
header are created by \verb+\item[headername]+.

\clearpage

For example

\begin{verbatim}
\begin{description}

\item[gnat] A small animal, $\ldots$

\item[gnu] A large animal, $\ldots$

\item[armadillo] A medium sized animal, $\ldots$
\end{description}
\end{verbatim}

will create

\begin{description}

\item[gnat] A small animal, $\ldots$

\item[gnu] A large animal, $\ldots$

\item[armadillo] A medium sized animal, $\ldots$
\end{description}



\end{document}
