%%% The first command tells what kind of document we're making.
%%% In this case, it is an article in the AMS style (using the
%%% name amsart).  There are options for font and paper size,
%%% among other things.
\documentclass[12pt,letterpaper,oneside]{amsart}


%%% This part of the file (after the \documentclass command,
%%% but before the \begin{document}) is called the ``preamble''.
%%% This is where we call packages to be used, and where we put 
%%% our macro definitions.

%%% The following command loads other helpful packages from the AMS
\usepackage{amsmath,amsthm,amsfonts,amssymb}

\usepackage{mathtools} %extension of amsmath, provides bug fixes and other tools 
\usepackage{mathrsfs} %Provides a nice \mathscr command

%%% Here are a few other useful packages
%\usepackage[american]{babel} %language settings (for things other than american english)
%\usepackage[mathcal]{euscript} %provides different \mathcal command
%\usepackage{ulem} %Package for underlining.
\usepackage[active]{srcltx} %creates the .dvi file with links to the source .tex file
%\usepackage[notcite,notref]{showkeys} %shows labels in the margins
\usepackage[pdftex,bookmarks=true]{hyperref} %adds hypertext links, can't use in ``draft'' mode, and must use in pdf mode
%\usepackage{fullpage} %creates smaller margins

%%% The following commands allow you to use \Xy-pic to draw
%%% commutative diagrams.  (You can omit the second line if you want
%%% the default style of the nodes to be \textstyle.)
%\usepackage[all,cmtip]{xy}
%\let\objectstyle=\displaystyle

%%% If you'll be importing any graphics, uncomment the following
%%% line.  (Note: The spelling is correct; the package graphicx.sty is
%%% the updated version of the older graphics.sty.)
\usepackage{graphicx}

%%% The following command loads the amsrefs package, which will be
%%% used to create the bibliography:
\usepackage[alphabetic]{amsrefs}


%%% Here are a few user-defined commands
\newcommand{\R}{\mathbb{R}}
\newcommand{\Z}{\mathbb{Z}}

\newcommand{\mfr}[1]{\ensuremath \mathfrak{#1}}
\newcommand{\mbb}[1]{\ensuremath \mathbb{#1}}
\newcommand{\mcl}[1]{\ensuremath \mathcal{#1}}
\newcommand{\msc}[1]{\ensuremath \mathscr{#1}}

\DeclareMathOperator{\GL}{GL}



%%%-------------------------------------------------------------------
%%%-------------------------------------------------------------------
%%% The Theorem environments:
%%%
%%%
%%% The following commands set it up so that:
%%% 
%%% All Theorems, Corollaries, Lemmas, Propositions, Definitions,
%%% Remarks, and Examples will be numbered
%%% in a single sequence, and the numbering will be within each
%%% section.  Displayed equations will be numbered in the same
%%% sequence. 
%%% 
%%% 
%%% Theorems, Propositions, Lemmas, and Corollaries will have the most
%%% formal typesetting.
%%% 
%%% Definitions will have the next level of formality.
%%% 
%%% Remarks and Examples will be the least formal.
%%% 


% The following causes equations to be numbered within sections
\numberwithin{equation}{section}

% We'll use the equation counter for all our theorem environments, so
% that everything will be numbered in the same sequence.

%       Theorem environments

\theoremstyle{plain} %% This is the default, anyway
\newtheorem{thm}[equation]{Theorem}
\newtheorem{cor}[equation]{Corollary}
\newtheorem{lem}[equation]{Lemma}
\newtheorem{prop}[equation]{Proposition}

\theoremstyle{definition}
\newtheorem{defn}[equation]{Definition}

\theoremstyle{remark}
\newtheorem{rem}[equation]{Remark}
\newtheorem{ex}[equation]{Example}



%%%-------------------------------------------------------------------
%%%-------------------------------------------------------------------
%%%-------------------------------------------------------------------
\begin{document}

%%% In the title, use a double backslash "\\" to show a linebreak:
%%% Use one of the following two forms:
%%% \title{Text of the title}
%%% or
%%% \title[Short form for the running head]{Text of the title}
\title[\LaTeX]{Introduction to \LaTeX}


%%% If there are multiple authors, they're described one at a time:
%%% First author: \author{} \address{} \curraddr{} \email{} \thanks{}
%%% Second author: \author{} \address{} \curraddr{} \email{} \thanks{}
%%% Third author: \author{} \address{} \curraddr{} \email{} \thanks{}
\author{John Q.~Doe}

%%% Your address, or department:
\address{Department of Mathematics, Eastern Upper Fake University, Nowhereville, SR 99999}

%%% Current address is optional.
% \curraddr{curraddr}

%%% Email address is optional.
\email{name@fake.address}

%%% Website address is optional.
\urladdr{http://name.fake.address/}

%%% Thanks acknowledges financial support, e.g., grant money
% \thanks{thanks}

%%% If there's a second author:
% \author{}
% \address{}
% \curraddr{}
% \email{}
% \urladdr{website}
% \thanks{thanks}


%%% AMS subject classification
\subjclass[2010]{53C44}
%53C44    	Geometric evolution equations (mean curvature flow, Ricci flow, etc.)

%%% The date, which can also be entered manually:
\date{\today}

%%% The abstract:
\begin{abstract}
This paper is a very, very brief introduction to basic \LaTeX usage.  Please edit this file however you choose.
\end{abstract}

%%% This puts the title, author information, and date on the first page.
\maketitle

%%% To include a table of contents, uncomment the following line:
\tableofcontents












%%%-------------------------------------------------------------------
%%%-------------------------------------------------------------------
%%% Start the body of the paper here:

  
\section{Introduction}
\label{sec:intro} %it is a good idea to label everything as you go!

\noindent What is this all about?
\begin{itemize}
\item \TeX is typesetting software that is especially useful for typesetting mathematical content.  The word \TeX sounds like ``tech.''
\item \LaTeX is an extension of \TeX.
\item AMS \LaTeX is a further extension, provided by the American Mathematical Society, geared explicitly towards the mathematical community.
\end{itemize}

One main philosophy: The author chooses the content and logical structure (chapters, sections, etc.), while \LaTeX takes care of the layout (margins, fonts, spacing, etc.).  Therefore, \LaTeX is not WYSIWYG like a normal word processor.








\newpage

\section{Mathematics}

\subsection{Basics}

There are two ways to include mathematics in your document.
\begin{itemize}
\item Inline:~ within a paragraph of text.  Type \texttt{\$ your math here \$}.
\item Displayed:~on its own line.  Type \texttt{\textbackslash [ your math here \textbackslash ]}.
\end{itemize}
There are many variations on the Displayed type; we'll see some later.

Here are some examples that illustrate a few important commands and features.
\begin{itemize}
\item superscripts: $x^0, {}^0 x$
\item subscripts: $x_0, {}_0 x$
\end{itemize}
If the super/subscript is more than one ``symbol'', put it in curly brackets: $x_{0,1}$. 

Most other typesetting commands come down to a few things.  First, simply inserting a symbol, e.g., \texttt{\textbackslash symbol}; second, putting symbols in some sort of construct, e.g., \texttt{\textbackslash command\{argument1\}$\cdots$\{argumentN\}}; third, combining these two ideas.

Here are more examples:
\begin{itemize}
\item greek letters: $\alpha, \beta, \gamma$, etc.
\item simple operators: $+, -, \times, \cdot, !, \oplus, \otimes, \wedge, \nabla, \partial$, etc.
\item relations: $<, >, \geq, \leq, =, \equiv, \sim, \simeq, \cong, \subset, \subseteq, \in, \notin, \ne$, etc.
\item delimiters: $(a), [b], \{c\}, \langle d \rangle, |e|$, etc.
\item arrows: $\rightarrow, \leftarrow, \Rightarrow, \Leftrightarrow$, etc.
\item dots: $\dots,\cdots,\vdots,\ddots$, etc.
\item predefined functions: $\exp, \ln, \log, \sin, \cos, \det$, etc.
\item large operators: $\int, \sum, \prod, \cup, \sqcup, \cap,$ etc.
\item ...with limits: $\sum_{k=1}^N a_k$.
\item roots: $\sqrt[3]{x+y}$  
\item fractions: $\frac{x}{y}$
\end{itemize}
Certain things show up better in display mode.  For example, with the \texttt{\textbackslash left} and \texttt{\textbackslash right} commands, delimiters scale appropriately, and the \texttt{big}/\texttt{long} adjectives can be used for some symbols:
\[ \left[ \int_a^b |f(x)|^p \, dx \right]^{1/p}, 
\quad \left\{ \sum_{k=1}^N \sqrt{\frac{a_k}{k!}} \longrightarrow 1 \right\}, 
\quad \bigcup_\alpha \left(\bigoplus_{k=1}^\infty U_k \right)^{\otimes \alpha} \]







\newpage

\subsection{Alignment}

A single equation is aligned in the center by default:
\[ \int_M d\omega = \int_{\partial M} \omega \]
If it is too long, or has many parts, then the \texttt{align} environment is helpful.  Use \& to set the alignment and $\backslash\backslash$ to break lines:
\begin{align}
S 
&= 1 - 1 + 1 - 1 \cdots \\
&= 1 - ( 1 - 1 + 1 \cdots ) \\
&= 1 - S \\
\Rightarrow S
&= \frac{1}{2}
\end{align}
Use a $\ast$ to make the equation numbers go away (this is true for many other commands as well), and \texttt{tag} to make your own number/text:
\begin{align*}
S 
&= 1 - 1 + 1 - 1 \cdots \\
&= 1 - ( 1 - 1 + 1 \cdots ) \\ 
&= 1 - S \\
\Rightarrow S
&= \frac{1}{2} \tag{what?!}
\end{align*}
You can also have multiple columns:
\begin{align*}
a_1 &= b_1    &   c_1 &= d_1 \\ 
a_2 &= b_2    &   c_2 &= d_2 
\end{align*}
You could make a matrix this way, but there are \texttt{matrix, pmatrix, bmatrix, vmatrix}, etc.  For example:
\[ 
\begin{matrix}
a & b \\
c & d
\end{matrix}, \quad
\begin{pmatrix}
a & b \\
c & d
\end{pmatrix}, \quad
\begin{bmatrix}
a & b \\
c & d
\end{bmatrix}, \quad
\begin{vmatrix}
a & b \\
c & d
\end{vmatrix} \]
Also helpful is \texttt{cases}:
\[ |x| = 
\begin{cases}
x  & \text{if } x \geq 0 \\
-x & \text{if } x < 0 
\end{cases} \]

It doesn't require math mode, but the \texttt{tabular} enviroment can make more complicated tables:
\begin{center}
\begin{tabular}{|l|c|r|}
\hline
\#1 & \#2 & \#3 \\
\hline
\hline
a   & b   & c   \\
d   & e   & f   \\
g   & h   & i   \\
\hline
\end{tabular}
\end{center}





\newpage

\subsection{Theorem environments}

There are built-in enviroments for theorems and theorem-like things.  You can also define your own theorem environments.

\begin{thm}
\label{thm:sample}
Here is a sample Theorem.  It has an equation:
\[ \det : \GL_n \R \longrightarrow \R \setminus \{0\} \]
\end{thm}



\begin{proof}
There is a proof environment that puts an empty square at the end of the proof.
\end{proof}

\begin{cor}
\label{cor:sample}
Here is a sample Corollary.
\end{cor}

\begin{lem}
\label{lem:sample}
Here is a sample Lemma.
\end{lem}

\begin{prop}
\label{prop:sample}
Here is a sample Proposition.
\end{prop}

\begin{defn}
\label{defn:sample}
Here is a sample \textit{Definition}.
\end{defn}

\begin{rem}
\label{rem:sample}
Here is a sample Remark. 
\end{rem}

\begin{ex}
\label{ex:sample}
Here is a sample Example. 
\end{ex}




\newpage

\section{Other \LaTeX basics}

\subsection{Fonts and text}

Generally, the font in the document is fixed, but there are a few common fonts used in mathematics.

\begin{itemize}
\item blackboard: $\mathbb{A}, \mathbb{F}, \mathbb{N}, \mathbb{Z}, \mathbb{Q}, \mathbb{R}, \mathbb{C}$
\item fraktur: $\mathfrak{g}, \mathfrak{h}, \mathfrak{k}, \mathfrak{m}, \mathfrak{n}$
\item script: $\mathscr{A}, \mathscr{B}, \mathscr{C}, \mathscr{D}, \dots$
\item caligraphic: $\mathcal{A}, \mathcal{B}, \mathcal{C}, \mathcal{D}, \dots$
\item roman (upright): $\mathrm{A}, \mathrm{B}, \mathrm{C}, \mathrm{D}, \dots$
\end{itemize}
There are standard alterations for ordinary text as well, although these should be used sparingly.
\begin{itemize}
\item \textit{italics}
\item \textbf{boldface}
\item \textsc{small caps}
\item \texttt{teletype}
\end{itemize}

You can use normal text inside of the  math environment with the \texttt{text} command:
\[ a = b \text{ and } b = c \text{ implies } a = c. \]

A few other tips:
\begin{itemize}
\item You can make lists with the \texttt{itemize} or \texttt{enumerate} environments
\item quotation marks are NOT made with shift+apostrophe; open with \texttt{``}, close with \texttt{''}
\item all white space greater than one space or one line break is ignored
\item there are ``special characters'' that must be preceded by a backslash
\[ \text{\#, \$, \%, etc.} \]
\end{itemize}








\newpage

\subsection{Defining your own commands}

One great feature of \TeX is its high degree of customizabity.  For example, almost no one types \texttt{\textbackslash mathbb\{R\}} every time they want to produce the symbol $\R$.  In the preamble, you can add
\[ \texttt{ \textbackslash newcommand\{\textbackslash R\}\{\textbackslash mathbb\{R\}\}} \]
and then just use \texttt{\textbackslash R} to produce $\R$.

You can also define ``functions'' that take certain arguments.  If we wanted to make a function that renders given text in the mathbb font, then we could define
\[ \texttt{\textbackslash newcommand\{\textbackslash mbb\}[1]\{\textbackslash ensuremath\textbackslash mathbb\{\#1\}\}} \]
which is a function taking 1 argument.  

Another nice thing is the ability to define new symbols representing mathematical operators.  It is a general philosophy (not held by everyone!) that things with fixed names (like $\sin$ or $\det$) should be typeset in upright letters and not italicized.  For example, if you wanted to talk about the general linear group, you'll notice that there is nothing ``built in'' like there is for $\det$.  We can do it with
\[ \texttt{\textbackslash DeclareMathOperator\{\textbackslash GL\}\{GL\}}, \]
which allow us to produce
\[ \GL_n(\R) \quad \text{instead of} \quad GL_n(\R). \]

Along these lines, there are a huge number of packages that contain other symbols, environments, and commands.  Load them in the preamble. 














\newpage

\subsection{Graphics}

%%% To import a graphics file, you must have said
%%% \usepackage{graphicx}
%%% in the preamble (i.e., before the \begin{document}).
%%% Putting it into a figure environment enables it to float to the
%%% next page if there isn't enough room for it on the current page.
%%% The \label command must come after the \caption command.
\begin{figure}[h]
  \includegraphics[scale=0.7]{ball1} %using an image from a pdf file
  \includegraphics{balls2} %using a jpg image
  \caption{Two images (hopefully).}
  \label{fig:images}
\end{figure}

It is relatively easy to include graphics in your document.  If your output is a \texttt{pdf}, your graphics must be in one of the following formats: \texttt{jpg, png, pdf}.  Mathematica and Matlab can output images in these formats.  Note that different output formats generally accept different image formats.

Here is a nice reference:
\[ \texttt{\url{http://en.wikibooks.org/wiki/LaTeX/Importing\_Graphics}} \]



\newpage

\subsection{Labels, references, citations}

In a formal paper, it is a good idea to label things like equations, figures, and (sub)sections so that they can be easily referenced at other points in the paper.  Lables are easy, just put \texttt{\textbackslash label\{label\_name\}} after the item.  Note that labeling an equation requires the \texttt{equation} environment:
\begin{equation}\label{eq:pythag}
a^2 + b^2 = c^2
\end{equation}
One references a label with \texttt{\textbackslash ref} command.  

Similarly, one can cite sources from the References section of the paper.  For our purposes, reference entries are handled in a separate file, which is called
\[ \texttt{refs\_template.bib} \]
It is handled at the very end of the document.  To create an entry, it is easy to simply go to 
\[ \texttt{\url{http://www.ams.org/mathscinet/}} \]
to search for your reference, click on its listing, then select the ``BiBTeX'' output.  Copy this into the references file, change the label, and cite it using your new label.


Here's an example:
\begin{quotation}
Equation (\ref{eq:pythag}) follows from \cite{chow04}*{Theorem 3.141592}.
\end{quotation}




\newpage

\section{Where to learn more}

Here are a few links to helpful internet references.
\begin{itemize}
\item Google!  Just about any question you will have has been answered somewhere already.
\item Detexify allows you to draw a symbol, and it tries to figure out what the \TeX command is.
\[ \texttt{\url{http://detexify.kirelabs.org/classify.html}} \]
\item If that doesn't work, try The Comprehensive LaTeX Symbol List.
\[ \texttt{\url{http://www.math.dartmouth.edu/~rweber/latex/tex\_symbols.pdf}} \]
\item Everything from this document is found in more detail here:
\[ \texttt{\url{ftp://ftp.ams.org/pub/tex/doc/amsmath/short-math-guide.pdf}} \]
\item Here is furter documentation for AMS-LaTeX
\[ \texttt{\url{http://ams.org/publications/authors/tex/amslatex.html}} \]
\end{itemize}

Finally, here's a nice reference card that you should print:
\[ \texttt{\url{www.math.brown.edu/~jhs/ReferenceCards/LaTeXRefCard.v2.0.pdf}}  \]



%%% -------------------------------------------------------------------
%%% -------------------------------------------------------------------

%%% This is where we create the bibliography.
\bibliography{refs_template}


\end{document}


