\documentclass[12pt]{article}

\usepackage{geometry}

\geometry{verbose,letterpaper,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
\pagestyle{empty}



\begin{document}



\title{Math in \LaTeX}
\author{Eric Eaton}

\maketitle

\hrule

\section{General Information}

\noindent Special Characters: \# \$ \% \& \{ \} \_ \verb2 ~ ^ \2.
The first seven can be generated with \verb+\+ followed by the
character.

\vspace{0.25in} \noindent
Quotation marks:  \verb+``\ldots''+
yields ``\ldots''.

\vspace{0.25in} \noindent
Dashes:  \verb+-+ (hyphen - ), \verb+--+
(range -- ), and \verb+---+ (dash
---).

\vspace{0.25in} \noindent
Spaces   between words    don't matter   a bit.  Forced
hy\-phen\-a\-tion can be done this way: \verb+hy\-phen\-a\-tion+.

\vspace{0.25in} \noindent \verb+\emph{Emphasized Text}+ =
\emph{Emphasized Text}

\noindent \verb+{\bf Bold Text}+ = {\bf Bold Text}

\noindent \verb+{\tt Typewriter Text}+ = {\tt Typewriter Text}

\vspace{0.25in} \noindent
To prevent line breaks between certain words, use a \verb+~+ in
place of a space: Mr.~Johns, Figure~7 (\verb+Mr.~Johns, Figure~7+).

\vspace{0.25in} \noindent
To print long text on a single line, surround it by an
\verb+\mbox+: \verb+\mbox{This text will appear on one line.}+

\vspace{0.25in} \noindent
Footnotes\footnote{This is a footnote.} can be printed using
\verb+\footnote{This is a footnote}+.

\vspace{0.25in} \noindent
Comments are done by \% characters.

\vspace{0.25in} \noindent
Vertical space can be specified by \verb+\vspace{0.25in}+

\vspace{0.25in} \noindent
Verbatim text can be done with \verb3\verb+Text!+ 3 or
the verbatim environment \\
\verb3\begin{verbatim} ... \end{verbatim}3.

\vspace{0.25in} \noindent
Lists types:  itemize, enumerate, and description.

\begin{verbatim}
\begin{itemize}
    \item \begin{description}
        \item[Name1] Description of the Name1 object.
        \item[Name2] Description of the Name2 object.
        \end{description}
    \item \begin{enumerate}
        \item item1
        \item item2
        \end{enumerate}
\end{itemize}
\end{verbatim}

\begin{itemize}
    \item \begin{description}
        \item[Name1] Description of the Name1 object.
        \item[Name2] Description of the Name2 object.
        \end{description}
    \item \begin{enumerate}
        \item item1
        \item item2
        \end{enumerate}
\end{itemize}





\section{Types of Math Environments}

\noindent Formulas in the middle of text: \verb3\(2x=4\)3 or
\verb3$2x=4$3. This appears as follows: \(2x=4\) or $2x=4$.
\verb+\begin{math} \end{math}+ also works the same.

\vspace{0.25in} \noindent
The displaymath environment offsets equations for emphasis:
\begin{verbatim}
\begin{displaymath}
    2x=4
\end{displaymath}
\end{verbatim}
\begin{displaymath} 2x=4 \end{displaymath}
The commands \verb+\[ \]+ are shortcuts to the displaymath
environment.

\vspace{0.25in} \noindent
The equation environment does the same, but numbers the equation:
\begin{verbatim}
\begin{equation}
    2x=4
    \label{simpleequation}
\end{equation}
\end{verbatim}
\begin{equation} 2x=4 \label{simpleequation}
\end{equation} To refer to Equation~\ref{simpleequation} (\verb+Equation~\ref{simpleequation}+), use a cross-reference.
Note that this takes multiple passes of \LaTeX.  In figures, the
label command must go after the caption command.



\section{Typical Math Constructs}

\noindent Exponentiation:  \verb+$x^2$+ $= x^2$, \verb+$x^{2y}$+
$= x^{2y}$, \verb+$x^{4^y}$+ $= x^{4^y}$.

\vspace{0.25in} \noindent
Subscripts: \verb+$x_{2}$+ $= x_{2}$, \verb+$x^{y_2}$+ $= x^{y_2}$.

\vspace{0.25in} \noindent
Fractions: \verb3$n/(2+m)$3 $= n/(2+m)$,
\verb3\[ \frac{y+z/2}{y^2+1} \]3 =
\[\frac{y+z/2}{y^2+1}\]

\vspace{0.25in} \noindent
Ellipsis: \verb+\ldots+ = \ldots

\vspace{0.25in} \noindent
Roots:  \verb3$\sqrt{x+y}$3 $= \sqrt{x+y}$, \verb3$\sqrt[n]{x+y}$3
$= \sqrt[n]{x+y}$

\vspace{0.25in} \noindent
Greek letters:  \verb+\alpha+ $= \alpha$, \verb+\beta+ $= \beta$,
\verb+\delta+ $= \delta$, \verb+\Delta+ $= \Delta$, \verb+theta+
$= \theta$, \verb+\pi+ $= \pi$, \ldots

\vspace{0.25in} \noindent
Common operators:

\begin{verbatim}
\times       \div         \pm               \bullet
\cap         \cup         \subset           \supset
\lor         \land        \lnot             \in
\leq         \geq         \neq              \equiv
\infty       \forall      \exists           \emptyset
\leftarrow   \Leftarrow   \leftrightarrow   \Leftrightarrow
\end{verbatim}

 \(\begin{array}{cccc}
\times & \div  & \pm     & \bullet \\
\cap   & \cup  & \subset & \supset \\
\lor   & \land & \lnot   & \in    \\
\leq   & \geq  & \neq    & \equiv  \\
\infty & \forall & \exists & \emptyset \\
\leftarrow & \Leftarrow & \leftrightarrow & \Leftrightarrow
\end{array}\)

\subsection{Functions}

\begin{verbatim}
\sum      \prod     \int
\bigcup   \bigcap   \oint
\end{verbatim}

\( \begin{array}{ccc}
\sum & \prod & \int \\
\bigcup & \bigcap & \oint \\
\end{array} \)

\noindent These functions all work similar to the following example: \\
\verb+$\sum_{i=0}^{n} x_i = \int_0^1 f$+. This expression will
look this way \mbox{$\sum_{i=0}^{n} x_i = \int_0^1 f$} when in the
text but this way \[ \sum_{i=0}^{n} x_i = \int_0^1 f \] when in
displaymath mode.

\vspace{0.25in} \noindent Common math functions:
\begin{verbatim}
\log     \cos     \sin   \tan
\arccos  \arcsin  \cosh  \sinh
\lim     \ln      \max   \min
\end{verbatim}

\( \begin{array}{cccc}
\log & \cos & \sin & \tan \\
\arccos & \arcsin & \cosh & \sinh \\
\lim & \ln & \max & \min
\end{array} \)

\vspace{0.25in}

\noindent Example with limits:
\begin{verbatim}
\lim_{n \rightarrow \infty} x = 0
\end{verbatim}
$\lim_{n \rightarrow \infty} x = 0$ and in displaymath mode:
\[\lim_{n \rightarrow \infty} x = 0\]

\vspace{0.25in}

\noindent Picky things about functions:
\begin{itemize}

\item To typeset \verb+{a | a>0}+, try $\{a\mid a>0\}$. The point
is to use \verb+\mid+ instead of \verb+|+. The latter has spacing
problems.

\item To typeset \verb+f: X -> Y+, try $f\colon X\to Y$. Use
\verb+\colon+ instead of : to get the correct spacing.

\item To typeset multi-character names in math mode, use
\verb+\mathit+.  For example, doesn't $\mathit{difference} = 1$
look better than $difference = 1$?  The commands \verb+\textstyle+
(for in-text math) and \verb+\displaystyle+ (for displaymath mode)
can be used to make plain text in an equation:
\verb+\[\displaystyle{Let\,} x=1.\]+
\[\displaystyle{Let\,} x=1.\]  Notice the extra space by
\verb+\,+!  You can also use \verb+\mbox+ to make plain text.
\end{itemize}

\vspace{0.25in}

\noindent You can define your own function in the following
manner:

\begin{verbatim}
\newcommand{\SumToX}[2]{\ensuremath{\sum_{#1=1}^{#2}}}
\newcommand{\QuadraticFormula}[3]{\ensuremath{\frac{-#2 \pm
\sqrt{#2^2 - 4 \times #1 \times #3}}{2 \times #1}}}
\end{verbatim}

\newcommand{\QuadraticFormula}[3]{\ensuremath{\frac{-#2 \pm
\sqrt{#2^2 - 4 \times #1 \times #3}}{2 \times #1}}}

\newcommand{\SumToX}[2]{\ensuremath{\sum_{#1=1}^{#2}}}

Then we can use the new commands in our document:
\verb+$\SumToX{i}{N}x_i$+ = $\SumToX{i}{N}x_i$.
\verb+\[\QuadraticFormula{a}{b}{c}\]+ =
\[\QuadraticFormula{a}{b}{c}\]



\subsection{Arrays}

\noindent Note that the \verb+\tabular+ environment is very
similar to the \verb+\array+ environment, except it is for regular
text.

\begin{verbatim}
\( \begin{array}{cl|r}
Name1 & Name2  & Name3 \\ \hline
a     &   xy   &   12  \\
a+b   &   x+y  &   5   \\
a+b+c &   x/y  &   100
\end{array} \)
\end{verbatim}

\( \begin{array}{cl|r}
Name1 & Name2  & Name3 \\ \hline
a     &   xy   &   12  \\
a+b   &   x+y  &   5   \\
a+b+c &   x/y  &   100
\end{array} \)


\vspace{0.25in}

\noindent Delimiters are often used in combination with arrays.
The delimiters automatically scale to encompass the arrays.  Use
the commands \verb+\left+ or \verb+\right+ before a delimiter to
specify the left or right side.  Common delimiters:

\begin{verbatim}
(         )         [        ]
\{        \}        |        \|
\lfloor   \rfloor   \lceil   \rceil
\end{verbatim}

\( \begin{array}{cccc}
(       & )       & [      & ]  \\
\{      & \}      & |      & \| \\
\lfloor & \rfloor & \lceil & \rceil
\end{array} \)

\noindent An example:

\begin{verbatim}
\[ \left( \begin{array}{c}
    \left[ \begin{array}{cc} x_1 & x_2 \\ x_3 & x_4 \end{array} \right]\\
    y \\
    z
    \end{array} \right) \]
\end{verbatim}

\[ \left( \begin{array}{c}
    \left[ \begin{array}{cc} x_1 & x_2 \\ x_3 & x_4 \end{array} \right]\\
    y \\
    z
    \end{array} \right) \]


\vspace{0.25in}

\noindent The argument \emph{t} aligns the top line of the second
array with the center of the first.  The argument \emph{b} would
align the bottom line with the center.
\begin{verbatim}
\[ X = \left[ \begin{array}{c} a_1 \\ \ldots \\ a_n \end{array} \right] -
       \left[ \begin{array}[t]{cc} x-y & x+y \\ xy & x/y \end{array} \right] \]
\end{verbatim}

\[ X = \left[ \begin{array}{c} a_1 \\ \ldots \\ a_n \end{array} \right] -
       \begin{array}[t]{cc} x-y & x+y \\ xy & x/y \end{array} \]

\noindent You can make an invisible delimiter with a ``.'' as
follows:

\begin{verbatim}
\[x = \left\{ \begin{array}{ll}
    y & \mbox{if $y>0$} \\
    0 & \mbox{otherwise}
    \end{array}
    \right. \]
\end{verbatim}

\[x = \left\{ \begin{array}{ll}
    y & \mbox{if $y>0$} \\
    0 & \mbox{otherwise}
    \end{array}
    \right. \]


\subsection{Equation Arrays}

\noindent Equation arrays allow you to create an aligned series of
equations.  Each equation can either be numbered (using
\verb+\eqnarray+) or unnumbered (using \verb+\eqnarray*+).  A
\verb+\nonumber+ command on a line tells \LaTeX to not number that
line.  Here are two examples:

\begin{verbatim}
\begin{eqnarray}
x & = & 5y + 6z \\
y & > & a + b + c + d +  \\
  &   & e + f + g \nonumber
\end{eqnarray}

\begin{eqnarray*}
10 & = & 5x \\
x  & = & 10/5 \\
x  & = & 2
\end{eqnarray*}
\end{verbatim}

\begin{eqnarray}
x & = & 5y + 6z \\
y & > & a + b + c + d + \nonumber \\
  &   & e + f + g
\end{eqnarray}

\begin{eqnarray*}
10 & = & 2x + 3x \\
10 & = & x(2+3) \\
x  & = & 2
\end{eqnarray*}



\subsection{Stacking}

\noindent You can overline with the \verb+\overline+ command and
underline with the \verb+\underline+ command.  For example,
\verb8$\overline{\overline{y}^3 + 1} = \underline{3x}$8 yields
$\overline{\overline{y}^3 + 1} = \underline{3x}$.

\vspace{0.25in}

\noindent Overbracing and underbracing works similarly:
\verb3$\overbrace{w + \underbrace{x + y}_{12}}^{24}$3 yields
$\overbrace{w + \underbrace{x + y}_{12}}^{24}$.

\vspace{0.25in}

\noindent Some common math accents:
\begin{verbatim}
\(\begin{array}{cccc}
\hat{x} & \bar{x} & \vec{x} & \dot{x}
\end{array} \)
\end{verbatim}

\(\begin{array}{cccc} \hat{x} & \bar{x} & \vec{x} & \dot{x}
\end{array} \)

\noindent The letters $i$ and $j$ should not have dots when
accented, so use \verb+\imath+ and \verb+\jmath+ to produce these:
$\vec{\imath} + \vec{\jmath}$.

\vspace{0.25in}

\noindent The \verb+\stackrel+ command allows us to stack
arbitrary symbols: \\
\verb+$\vec{X}\stackrel{\mathit{def}}{=}(x_1,\ldots, x_n)$+ yields
$\vec{X} \stackrel{\mathit{def}}{=} (x_1, \ldots, x_n)$.


\subsection{Theorems and Such}

\noindent We can define and automatically number theorems as shown
in the following examples:

\begin{verbatim}
\newtheorem{theorem}{Theorem}
\newtheorem{axiom}{Axiom}

\begin{theorem}
    This is a theorem.
    \label{TheoremThis}
\end{theorem}

\begin{axiom}
    All theorems are dull.
    \label{AxiomDullTheorems}
\end{axiom}
\end{verbatim}

\newtheorem{theorem}{Theorem}
\newtheorem{axiom}{Axiom}
\begin{theorem}
    This is a theorem.
    \label{TheoremThis}
\end{theorem}
\begin{axiom}
    All theorems are dull.
    \label{AxiomDullTheorems}
\end{axiom}

\begin{verbatim}
By Axiom~\ref{AxiomDullTheorems}, we can state that
Theorem~\ref{TheoremThis} is dull.
\end{verbatim}

\noindent By Axiom~\ref{AxiomDullTheorems}, we can state that
Theorem~\ref{TheoremThis} is dull.

\end{document}
