\documentclass[12pt]{article}
\usepackage{amstex}
\begin{document}
\begin{center}
{\Large\bf 15-451: Sample Latex Math File}\\
by Weng-Keen Wong\\
\end{center}

\section{Math mode}
To enter Latex's math mode, use the \$ character to delimit the beginning
and end of math mode.  For example, \$$\backslash$Omega\$ gives you $\Omega$.
Once in math mode, you'll notice that mathematical symbols look fine but 
spacing and normal text work differently.  To add a space, use $\backslash$ followed by a space.\\
\\
For instance, \$$\backslash$epsilon\$ $\backslash$ \$$\backslash$epsilon\$
gives: $\epsilon \ \epsilon$ (note the space).  
\\
On the other hand, \$$\backslash$epsilon\$ \$$\backslash$epsilon\$ gives you $\epsilon \epsilon$.
\\
To add text, use either 
\begin{itemize}
\item \$$\backslash$text\{ {\it text here} \}\$\\
 eg. $\alpha\ =\ \text{size of array}$  
\item \$\{$\backslash$mbox\{$\backslash$scriptsize {\it text here} \}\$\\
eg. $\beta\ =\ \text{size of array}$
\item Or just make sure your math delimiters end before you start adding the text\\
eg. \$$\backslash$theta$\backslash$ =$\backslash$ \$ size of array, which gives
you $\theta\ =\ $ size of array
\end{itemize}

\section{Basic Mathematical Symbols}

Once in math mode, you can use all sorts of mathematical symbols.  Characters 
that you'll probably need in your assignments include:
\begin{enumerate}
\item Greek alphabet letters like\\
\\
\begin{tabular}{p{3cm}p{3cm}p{3cm}}

$\backslash$alpha ($\alpha$) & $\backslash$beta ($\beta$) & $\backslash$gamma ($\gamma$) \\ 
$\backslash$delta ($\delta$) & $\backslash$epsilon ($\epsilon$) & $\backslash$eta ($\eta$) \\ 
$\backslash$theta ($\theta$) & $\backslash$lambda ($\lambda$) & $\backslash$pi ($\pi$) \\ 
$\backslash$sigma ($\sigma$) & $\backslash$psi ($\psi$) & $\backslash$omega ($\omega$) \\ 
\end{tabular}\\
\\
You can also capitalize certain Greek characters eg.\\
\\
\begin{tabular}{p{3cm}p{3cm}p{3cm}}
$\backslash$Gamma ($\Gamma$) & $\backslash$Delta ($\Delta$) & $\backslash$Theta ($\Theta$) \\
$\backslash$Lambda ($\Lambda$) & $\backslash$Pi ($\Pi$) & $\backslash$Sigma ($\Sigma$) \\
$\backslash$Phi ($\Phi$) & $\backslash$Psi ($\Psi$) & $\backslash$Omega ($\Omega$) \\
\end{tabular}\\
\\

There are many more Greek letters available and this is not an exhaustive list.

\item Operators\\
\begin{tabular}{p{3cm}p{3cm}p{3cm}p{3cm}}
$\backslash$leq ($\leq$) & $\backslash$geq ($\geq$) & $\backslash$equiv ($\equiv$) & $\backslash$neq ($\neq$) \\
$\backslash$subset ($\subset$) & $\backslash$supset ($\supset$) & $\backslash$subseteq ($\subseteq$) & $\backslash$supseteq ($\supseteq$)
\end{tabular}\\
\\
Note that $<$ and $>$ can be typed in directly but you need to use it in math
mode.
\item Arrows\\
Latex has tons of arrows to use with your equations.  The list below is just
a sample of what is available.\\

\begin{tabular}{p{5cm}p{5cm}}
$\backslash$leftarrow ($\leftarrow$) & $\backslash$longleftarrow ($\longleftarrow$) \\
$\backslash$Leftarrow ($\Leftarrow$) & $\backslash$Longleftarrow ($\Longleftarrow$) \\
$\backslash$rightarrow ($\rightarrow$) & $\backslash$longrightarrow ($\longrightarrow$) \\
$\backslash$Rightarrow ($\Rightarrow$) & $\backslash$Longrightarrow ($\Longrightarrow$) \\
$\backslash$leftrightarrow ($\leftrightarrow$) & $\backslash$longleftrightarrow ($\longleftrightarrow$) \\ 
$\backslash$Leftrightarrow ($\Leftrightarrow$) & $\backslash$Longleftrightarrow ($\Longleftrightarrow$)\\
\end{tabular}

\item Misc Symbols\\
\begin{tabular}{p{3cm}p{3cm}p{3cm}p{3cm}}
$\backslash$ldots ($\ldots$) & $\backslash$cdots ($\cdots$) & $\backslash$vdots ($\vdots$) & $\backslash$ddots ($\ddots$) \\
$\backslash$forall ($\forall$) & $\backslash$infty ($\infty$) & $\backslash$emptyset ($\emptyset$) & $\backslash$exists ($\exists$) \\

$\backslash$sum ($\sum$) & $\backslash$prod ($\prod$) & $\backslash$bigcap ($\bigcap$) & $\backslash$bigcup ($\bigcup$).

\end{tabular}

\end{enumerate}

\section{Subscripts and Superscripts}
Subscripts are indicated by the \_ symbol.  For instance, a\_\{sub\} looks like $a_{sub}$.  Similarly, superscripts are indicated by the \verb!^! symbol eg. a\verb!^!\{super\} looks like $a^{super}$.  You can combine subscripts and superscripts as in T\_\{i\}\verb!^!\{2\}, which generates $T_{i}^{2}$.

\section{Overset and Underset}
Subscripts and superscripts can be used for summation or product
formulas.  For instance, $\backslash$sum\_\{n=0\}\verb!^!\{10\} looks like
$\sum_{n=0}^{10}$.  However, the $\backslash$overset and 
$\backslash$underset commands can also be used.  The table below
illustrates the use of these commands:\\
\\
\begin{tabular}{p{7cm}p{3cm}}
$\backslash$overset\{n\}\{$\backslash$sum\} & $\overset{n}{\sum}$\\
$\backslash$underset\{i=0\}\{$\backslash$prod\} & $\underset{i=0}{\prod}$\\
$\backslash$overset\{n\}\{$\backslash$underset\{i=0\}\{$\backslash$sum\}\} & $\overset{n}{\underset{i=0}{\sum}}$
\end{tabular}

\section{Fractions, Combinatorics, and Roots}
Fractions such as $\frac{11}{20}$ are created using the $\backslash$frac\{{\it numerator}\}\{{\it denominator}\} construct.  You can make the numerator and
denominator as complicated as you want eg. $\frac{\alpha*\beta}{{\delta}_{n}^{2}}$
\\
For the choose expression like $\binom{k}{2}$, use $\backslash$binom\{{\it top}\}\{{\it bottom}\}.
\\
For roots, use $\backslash$sqrt\{abc\} for $\sqrt{abc}$ and $\backslash$sqrt[n]\{abc\} for $\sqrt[n]{abc}$.

\section{Formatting Equations}
You can place equations in sections using Latex commands like equation, 
gather, and align.  The sections are indicated using $\backslash$begin\{...\} and
$\backslash$end\{...\} tags eg. $\backslash$begin\{equation\} and $\backslash$end\{equation\}.  Anything between these begin and end tags will be in math 
mode.  You will not need the \$ delimiters.  If you put a * after the command 
eg. $\backslash$begin\{equation*\}, it will not label the section with a
number.
\subsection{The Equation Command}
The equation command puts an equation on a separate line eg.
\begin{verbatim}
\begin{equation}
T(n) = 2T(\frac{n}{2}) + cn
\end{equation}
\end{verbatim}

Looks like:
\begin{equation}
T(n) = 2T(\frac{n}{2}) + cn
\end{equation}

Notice that it is numbered.  If I wanted the equation not to have a number,
I would have used Latex instructions like this:
\begin{verbatim}
\begin{equation*}
T(n) = 2T(\frac{n}{2}) + cn
\end{equation*}
\end{verbatim}

Which looks like:
\begin{equation*}
T(n) = 2T(\frac{n}{2}) + cn
\end{equation*}

\subsection{The Gather Command}
If you wanted to put multiple lines of an equation in a section with no
alignment, use the gather command eg.

\begin{verbatim}
\begin{gather}
x^2 + y^2 = 1\\
x = \sqrt{1-y^2}
\end{gather}
\end{verbatim}

Which yields:
\begin{gather*}
x^2 + y^2 = 1\\
x = \sqrt{1-y^2}
\end{gather*}

\subsection{The Align Command}
The align command lets you use vertical alignment on multiple lines of 
equations.  For example, the code below:

\begin{verbatim}
\begin{align*}
x^2 + y^2 &= 1\\
x &= \sqrt{1-y^2}
\end{align*}
\end{verbatim}

Gives you:
\begin{align*}
x^2 + y^2 &= 1\\
x &= \sqrt{1-y^2}
\end{align*}

Note that the \& indicates where you want the alignment.  In this case,
I wanted the alignment on the $=$ signs.  You also need a $\backslash$$\backslash$ at the end of every equation in order to indicate that a new line is
about to start.

\section{Online Latex Help}
Places on the web that can help you with Latex:\\
http://www.latex-project.org/\\
http://www.emerson.emory.edu/services/latex/latex\_toc.html\\
http://www.giss.nasa.gov/latex/\\
http://coulomb.ecn.purdue.edu/\verb!~!bulsara/LaTeX/latex.html
\end{document}
