%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%    Start of top matter
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[12pt]{amsart}
%
%   Square brackets contain optional parameters.
%   12pt is font size.
%


\usepackage{amssymb,amscd,amsmath,amsthm,url,multirow,graphicx}


% Theorem-like environments:
%
% \newtheorem {name in LaTeX} [how to enumerate] {name in output}

\newtheorem {Theorem}                    {Theorem}
\newtheorem {hocuspocus} [Theorem]       {Proposition}
\newtheorem {Lemma}      [Theorem]       {Lemma}
\newtheorem {Corollary}  [Theorem]       {Corollary}
\newtheorem {Proposition}[Theorem]       {Proposition}
\newtheorem {Claim}      [Theorem]       {Claim}
\newtheorem*{Prop}                       {Proposition} % star means no number

% http://en.wikibooks.org/wiki/LaTeX/Theorems

\theoremstyle{definition}
\newtheorem  {Definition} [Theorem]{Definition}

\theoremstyle{remark}
\newtheorem{Remark}[Theorem]{Remark}
\newtheorem{Example}[Theorem]{Example}


\numberwithin{equation}{section}

% http://en.wikibooks.org/wiki/LaTeX/Labels_and_Cross-referencing#numberwithin


%%
%%  Defining abbreviations of frequently used commands:
%%
\def \R {\mathbb R}
\def \C {\mathbb C}
\def \calA {\mathcal A}
\def \ol {\overline}
\def \ssminus {\smallsetminus}
\def \half {\frac{1}{2}}
\def \eps {\varepsilon}
\def \Inv {^{-1}}

% http://en.wikibooks.org/wiki/TeX/def
% \def <command> <parameter-text>{<replacement-text>}

%%
%%  Abbreviations with an [optional] parameter:
%%
\newcommand{\dd}[1] {\frac{\partial}{\partial[#1]}}

% http://en.wikibooks.org/wiki/LaTeX/Customizing_LaTeX
% \newcommand{name}[num]{definition}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%
%  End of top matter, start of document.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 


\begin{document}

\title{Example of a \LaTeX{} Document}


\author{Sue McGlashan}
\email{sue.mcglashan@utoronto.ca}

\author{Yael Karshon}
\email{yael.karshon@utoronto.ca}

\author{Gerhard Trippen}
\email{gerhard.trippen@utoronto.ca}

\address{Mathematical and Computational Sciences,
University of Toronto Mississauga, 3359 Mississauga Road North,
Mississauga, ON L5L 1C6}

\thanks{We thank UTM for the opportunity to deliver this course.}

\begin{abstract}
This is an example of a \LaTeX{} document.
\end{abstract}
		
\maketitle
%
%  "maketitle" processes the title, authors etc.
%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% If you want a table of contents, uncomment the lines below.
% To also show subsections, change the "tocdepth" parameter to 2.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \setcounter{tocdepth}{1}
 \tableofcontents





%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\subsection{Definition Tests}

$$\R \C \calA \ol \ssminus \half \eps \Inv \dd{x}$$

\subsection{The Real Introduction}

The goal of this document is to show some of the ways to use \LaTeX.
We recommend that you make a copy of this file
and play with it, to see how the different options work.
We start by quoting Audin -- 
\begin{quotation}
Always begin by quoting a famous mathematician.
\end{quotation}
Also notice how to \emph{emphasize} text
or to put it in \textbf{boldface}. 
Or how to skip a line:

\

And how to to handle spaces  \ such as \ \ here
or \quad here or \qquad here.

Use $\backslash$ to create a single space
(e.g.\ if you have an ``e.g." in the middle of a sentence
and you don't want \LaTeX\ to put a longer space after it
as it does after a period at the end of a sentence). 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Formulas and math symbols} \label{sec:formulas}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Use single dollar signs for an equation embedded in text,
such as when asserting that the circumference of a circle of radius $r$ 
is $2\pi r$.  Notice the difference between the product $wlog$ 
and the phrase wlog.

Use double dollar signs for an un-numbered displayed equation:
$$ 1 + \ldots + n = \sum_{k=1}^n k .$$
Also,
$$ n! = \prod_{k=1}^n  k 
\quad \text{and} \quad 
\int_0^\infty re^{-r^2} dr = \left. \frac{1}{2} e^{-r^2} \right|_0^\infty .$$
Also,
$$ \lim_{x \to \infty} f(x) = 1, $$
or
$$ \begin{CD} f(x) @>> x \to \infty > 1. \end{CD} $$

If your text contains the dollar sign, percent sign, or curly brackets, 
use backslash, e.g., in \$10, or \%10, or \{ here \}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Theorem-like environments}  \label{sec:thms}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

In this section we present some theorem-like environments.
We chose to enumerate them consecutively 
(``Theorem 1, Example 2, Definition 3 $\ldots$'')
in order to make it easier for the reader to navigate.

\begin{Theorem}     
Consider a quadratic equation
$ax^2 + bx + c = 0$,
where $a,b,c \in \R$ and $a \neq 0$.
The solutions to this equation are
$$ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}. $$
\end{Theorem}

\begin{proof}
Because $a \neq 0$, we divide through by $a$
and get
$$ x^2 + \frac{b}{a} x + \frac{c}{a} = 0.$$
The solution to this equation are the same as those
of the original equation.  Completing the square,
we re-write this equation as
$$ \left( x + \frac{b}{2a} \right)^2 - \frac{b^2}{4a^2}  
   + \frac{c}{a} = 0.$$
Adding $\displaystyle{\frac{ b^2 - 4ac}{4a^2}}$ and taking square roots,
we get
$$ x + \frac{b}{2a} = \pm \frac{ \sqrt{b^2 - 4ac}}{2a}  , $$
which yields the required formula.
\end{proof}

Here are more examples of theorem-like environments:

\begin{Example}
One of the two solutions to the equation $x^2 - x - 1 = 0$
is the golden ratio, $x = \frac{1 + \sqrt{5}}{2}$.
\end{Example}

\begin{Definition} \label{root}
A \emph{square root} of $\alpha$ is a number
whose square is equal to~$\alpha$.
\end{Definition}

\begin{hocuspocus}
Check out the \LaTeX\ source that created this proposition!
\end{hocuspocus}

\begin{Corollary}
The name of the theorem in the source can be different
from the name that shows in the output.
\end{Corollary}

Theorem-like environments can also come without numbers:

\begin{Prop} 
This proposition has no number.
\end{Prop} 



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Labels, cross references, and citations} \label{sec:cross}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

We can put a label on a theorem-like environment,
and we can later refer to it according to this label.
For example, check the source to see how we now refer to Definition~\ref{root}.

We can also refer to sections;
for example, this section is Section~\ref{sec:cross}.

\begin{Remark}
For cross-references to come out right after a recent source changes, 
run the latex program twice.
\end{Remark}

To create a labeled equation or formula, to which we can later refer
using its label, we use the ``equation" environment:
\begin{equation}  \label{polynomial}
   a_n x^n + a_{n-1} x^{n-1} + \ldots +  a_1 x + a_0.  
\end{equation}
See how we now refer to the Equation~\eqref{polynomial}
in this source of this file.

You can find many other options at 
\cite{lamport94,not_so_short,comprehensive}\footnote{Notice how we 
cite references!},
or simply through ``google".
{\footnotesize Google is great!  Try, e.g., 
to search ``latex font size".}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Lists} \label{sec:lists}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Thumb-rule for writing:

\begin{enumerate}
\item
Tell the reader what you're going to say.
\item
Say it.
\item
Tell the reader what you just said.
\end{enumerate}

\bigskip

Use 
\begin{itemize}
\item
``Enumerate" for a numbered list;
\item
``itemize" for an un-numbered list;
\begin{itemize}
\item you can indent lists,
\item such as here.
\end{itemize}
\end{itemize}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Cases; matrices}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The following text is produced with the ``cases" environment:
$$
|x| := \begin{cases}
    x & x \geq 0 \\
   -x & x < 0 
\end{cases}
$$

The \emph{characteristic polynomial} of the $3 \times 3$~matrix
$$ T := 
\left[ \begin{array}{ccc}
a & b & c \\
d & e & f \\
g & h & i 
\end{array} 
\right]  $$
is $ \lambda \mapsto \det (\lambda I - T) $.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Tables}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

This example shows how to create a simple table in LaTeX. It is a three-by-three table, but without any lines.

\begin{tabular}{ l c r }
  1 & 2 & 3 \\
  4 & 5 & 6 \\
  7 & 8 & 9 \\
\end{tabular}

Add some lines, as well as centering (notice the use of the center environment):

\begin{center}
  \begin{tabular}{ l | c || r | }
    \hline
    1 & 2 & 3 \\ \hline
    4 & 5 & 6 \\ \hline
    7 & 8 & 9 \\
    \hline
  \end{tabular}
\end{center}

\subsection{Rows spanning multiple columns; Columns spanning multiple rows}
\
The first thing you need to do is add 
\begin{verbatim}
\usepackage{multirow}
\end{verbatim}
to the preamble. 

The command for this looks like this: 
\begin{verbatim}
\multicolumn{num_cols}{alignment}{contents}. 
\end{verbatim}
num\_cols is the number of subsequent columns to merge; 
alignment can be l, c, r. 
And contents is simply the actual data you want to be contained within that cell.

\begin{verbatim}
\multirow{num_rows}{width}{contents}.
\end{verbatim}
The arguments are pretty simple to deduce (* for the width means the content's natural width).

An example:

\begin{tabular}{|l|l|l|}
\hline
\multicolumn{3}{|c|}{Team sheet} \\
\hline
Goalkeeper & GK & Paul Robinson \\ \hline
\multirow{4}{*}{Defenders} & LB & Lucus Radebe \\
 & DC & Michael Duberry \\
 & DC & Dominic Matteo \\
 & RB & Didier Domi \\ \hline
\multirow{3}{*}{Midfielders} & MC & David Batty \\
 & MC & Eirik Bakke \\
 & MC & Jody Morris \\ \hline
Forward & FW & Jamie McMaster \\ \hline
\multirow{2}{*}{Strikers} & ST & Alan Smith \\
 & ST & Mark Viduka \\
\hline
\end{tabular}

% http://en.wikibooks.org/wiki/LaTeX/Tables

\newpage

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Figures}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Last but not least a simple example that shows how to include a figure saved in eps format.

\begin{figure}[h!]
  \centering
    \includegraphics[width=0.8\textwidth]{btree}
  \caption{Deletion in a B-tree}
\end{figure}

% http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions

The figure itself does not look very nice.
A very useful to draw figures is Ipe\footnote{\url{http://ipe7.sourceforge.net/}}
by Otfried Cheong.
Ipe is a drawing editor for creating figures in PDF or (encapsulated) Postscript (eps/ps) format. 
It supports making small figures for inclusion into LaTeX-documents as well as making multi-page PDF presentations 
that can be shown on-line with Acrobat Reader.

%%%%%%%%%%%%%%%%%%%%%
\section*{Conclusion}
%%%%%%%%%%%%%%%%%%%%%

We hope that you find this document helpful.
If you have suggestions for improvement, please let us know.



%%%%%%%%%%%%%%%%%%%%%%%
\begin{thebibliography}{9}
%%%%%%%%%%%%%%%%%%%%%%%

\bibitem{lamport94}
Leslie Lamport, \emph{\LaTeX: A Document Preparation System}.
Addison Wesley, Massachusetts, 2nd Edition, 1994.

\bibitem{not_so_short}
Tobias Oetiker, Hubert Partl, Irene Hyna, and Elisabeth Schlegl,
\emph{The Not So Short Introduction to \LaTeX2E},
\url{http://tobi.oetiker.ch/lshort/lshort.pdf}.

\bibitem{comprehensive}
Scott Pakin,
\emph{The Comprehensive \LaTeX{} symbol list},
\url{http://www.ctan.org/tex-archive/info/symbols/comprehensive/symbols-a4.pdf}

\end{thebibliography}

\end{document}
