\documentclass{article}

\usepackage{amsmath}     %comment: for align environment

\begin{document}

LaTeX is a document preparation system which is particularly good at typesetting mathematics.
LaTeX was introduced in 1985 and improves upon TeX, which came out in 1978.
It is a word processor which is quite different from something like Microsoft Word or Libre Office, which are WYSIWYG ("what you see is what you get").
Instead it is more like HTML in that a text file contains markup language which describes what is happening in the document.
To see the final form of the document it has to be processed by LaTeX.
Two popular free programs are MikTeX and TeXnicCenter under Windows.

The most basic thing that can be created in LaTeX are plain text documents.
Paragraphs are separated by one (or more) blank lines in the TeX source of the document.
LaTeX sees text on multiple lines the same as the same text on a single line, between the blank lines.
The number of spaces between words on a line does not matter.
This can be used as a convienience of the document prepairer to format things to be more readable for themselves.
One common usage is to place each sentence on its own line, which enables them to be moved around more easily.

The document markup commands in LaTeX are preceeded by a backslash,~\textbackslash.
For example, there is a special command to write the name LaTeX in its approved form, {\textbackslash}LaTeX, which appears as \LaTeX.
Other ones include {\textbackslash}textbackslash~(\textbackslash), {\textbackslash}ldots~(\ldots), and the special characters \$, \&, \% \_ \{ \} (all requiring a backslash before them).

Many commands take an argument, which is placed between brackets \{ \} which immediately follow the command.
One example is text accents, like a umlaut.
{\textbackslash}"\{o\} produces \"{o}.
Now you can draft a letter to Dr.~\v{C}u\v{c}kovi\'{c} or Dr.~\c{S}ahuto\u{g}lu.
Other commands include {\textbackslash}emph which will make \emph{selected text italicized} and {\textbackslash}texttt creates \texttt{monowidth typewriter-type}.

While talking about how text works here are some commands that do not use a backslash.
Placing a tilde (\textasciitilde) between words prevents them from appearing on new lines.
For instance you would not want to split pages when having someone read pages
4{\textasciitilde}to{\textasciitilde}7 (which appears 4~to~7).
The title of Dr. in the previous paragraph is joined with each respective name with a tilde.
Double quotes are odd in \LaTeX, as you do not use the double quote character ".
Instead, two left single quotes followed by to right single quotes ``quotes'' text properly.
Finally, and most usefully, \% starts a comment on a line - everything that appears after it will not affect the document.
% Note to self: verify that this is true.

A basic document looks like the following:\\
\texttt{
  {\textbackslash}documentclass\{article\} \\
  \% Here is where to include packages, styles, or define new commands \\
  {\textbackslash}begin\{document\} \\
  \% Here is where the document text and text markup goes \\
  {\textbackslash}end\{document\}
}

Math mode is the most important reason a mathematician would want to use \LaTeX.
It comes in two flavors, inline mode and display mode.
Inline mode is for more basic expressions and equations which naturally fit on a line.
Display mode can handle things which take up more space vertically, like matrices.
To use inline math mode, put your equation between two dollar signs.
\texttt{\$~y~=~x{\textasciicircum}2~-~3x~+~2~\$} produces $ y = x^2 - 3x + 2 $.
One invokes display mode by putting the math between \texttt{\textbackslash[}~and~\texttt{\textbackslash]}.
\texttt{\textbackslash[~y~=~x{\textasciicircum}2~-~3x~+~2~\textbackslash]} produces:
\[
  y = x^2 - 3x + 2
\]


The vast majority of commands are for math mode.
For example this is where you can access Greek letters:
  \texttt{\$ {\textbackslash}alpha, etc \$} produces
  $\alpha, \beta, \gamma, \ldots, \omega$.
The standard trigonometric and logarithmic (natural and base 10) are produced by prepending a backslash to the name, as otherwise each character is treated as a variable.
$\sin(\theta)$ looks far more correct than $sin(\theta)$, which does not have the backslash.
There are symbols (far more than listed here) which come up in
 algebra ($\pm, \div, \leq, \approx, \infty$),
 set notation ($\cup, \cap, \subseteq, \in$),
 calculus ($f', \int, \partial, \nabla, \lim$),
 and proofs ($\forall, \exists, \neg, \Rightarrow$).


Many commands take a parameter, or two.
Square roots can be made with \texttt{\${\textbackslash}sqrt\{10\}\$} which produces $\sqrt{10}$.
This command also has an optional parameter for creating an $n^\textrm{th}$ root, designated by square brackets.
\texttt{\${\textbackslash}sqrt[3]\{10\}\$} produces $\sqrt[3]{10}$.
Fractions take two paramters:  \texttt{\${\textbackslash}frac\{2\}\{3\}\$} produces $\frac{2}{3}$.
This is enough to create the Quadratic Formula.
\[
 x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
\]


Superscripts are handled with \textasciicircum and subscripts with \_.
To put more than a single character in a superscript or subscript, use brackets.
For example \texttt{\$a\_123~+~b\_\{456\}\$} produces $a_123 + b_{456}$, where the first term is not displayed properly.
Some commands take superscripts or subscripts.
Limits take a subscript as do logarithms in a given base.
\texttt{{\textbackslash}lim\_\{x{\textbackslash}to{\textbackslash}infty\}}.
Sums ($\sum$), products ($\prod$), and integrals ($\int$) can take both subscripts and superscripts
\texttt{{\textbackslash}sum\_\{n=1\}\textasciicircum\{10\}}.
For example:
\[
 f'(x) = \lim_{h\to 0} \frac{f(x+h) - f(x)}{h}
\]
\[
 e^x = \sum_{n=0}^\infty \frac{x^n}{n!}
\]
\noindent Note that for inline math, these special commands will appear differently: $f'(x) = \lim_{x\to\infty} \frac{f(x+h) - f(x)}{h}$ and $e^x = \sum_{n=0}^\infty \frac{x^n}{n!}$.

Environments begin with \texttt{{\textbackslash}begin\{ \}} and end with \texttt{{\textbackslash}end\{ \}}.
The array envinronment is usefull for creating matricies, and is required to appear within math display mode.
It has a few parts.
First comes postional information: \texttt{{\textbackslash}begin\{array\}\{lcr\}} denotes that there are three columns which are left, center, and right justified respectively.
Within each row of the matrix/array, the items in each column are separated by \texttt{\&} and the whole row is terminated with \texttt{\textbackslash\textbackslash}.
For example, the $3^\textrm{rd}$ row below is created with
  \texttt{2~\&~0~\&~-1~\textbackslash\textbackslash}.
Finally, to put large parentheses around the array to make it a matrix, use \texttt{{\textbackslash}left(} and \texttt{{\textbackslash}right)}.
Other symbols which appear surrounding arrays can be made similarly large.

\[
M = \left(
\begin{array}{rrr}
 1 & 1 & 1 \\
 1 & -1 & 1 \\
 2 & 0 & -1 \\
\end{array}
\right)
\]
\noindent Piecewise functions can be created in the same way, pairing a left bracket~(\texttt{{\textbackslash}\{}) with a right period.
It can also be done with the \texttt{cases} environment, described below.
\[
 f(x) = \left\{
 \begin{array}{cc}
   x+2 & x \leq 5 \\
   8-x & x > 5 \\
 \end{array}
 \right.
\]

\noindent Note: larger parenthesis showing up in other contexts can be created with matching left/right commands.
\[
  \left( \frac{x^2 + 3x + 2}{x^2-1} \right)^3
  \qquad \textrm{or} \qquad
  \left( 3 +(x+1)^2 \right)^2
\]

Before mentioning the other types of multi-row aligned math content, it is a good idea to bring up packages.
Packages extend \LaTeX\ with more commands and environments.
Quite a useful package is the \texttt{amsmath} package.
To include it in you document, insert
 \texttt{{\textbackslash}usepackage\{amsmath\}} between
 \texttt{{\textbackslash}documentclass\{article\}} and
 \texttt{{\textbackslash}begin\{document\}} at the top of your document.

Some of the multi-row alignment envrionments are:
 \texttt{gather} and \texttt{multiline} which are for a single column (the first restricted to centered only),
 \texttt{matrix}, \texttt{array}, and \texttt{cases} are multi-column (the first restricted to centered only), 
 and finally \texttt{align} for aligning formulas.
These environments are \emph{not} to be placed within a displayed math environment, as they add it themselves.
Each of these environments come in two flavors: each line can be numbered or not.
The following uses \texttt{align*} to not number the lines.

\begin{align*}	% with * means no equation numbering
  (x+h)^2 &= (x+h)(x+h)\\
          &= x^2 + xh + hx + h^2\\
          &= x^2 + 2xh + h^2\\
\end{align*}

There are commands useful for creating homework, quizzes, and tests.
These are not in math display mode.
\texttt{{\textbackslash}vspace\{2 in\}} leaves a vertical space of 2 inches.
You can also specify the height in cm.
The itemize and enumerate envorionments allow one to write a list.
The \texttt{{\textbackslash}item[option]} command puts the next item down and alligned with the others.
The optional argument is what you would want to denote each item otherwise it uses a solid dot/hyphen/etc for \texttt{itemize} and 1.,2.,3./(a),(b),(c)/etc for \texttt{enumerate}.
You may embed a list within a list up to four levels deep.
Also, \texttt{{\textbackslash}vfill} fills the remainder of the page with blank space and \texttt{{\textbackslash}eject} ends the current page and starts the next one.

\vfill
\eject
\begin{center}
 \textbf{Quiz \#1}
\end{center}
\begin{itemize}
 \item[1.] Write the definition for a function $f(x)$ to be continuous at a point $x_0$.
 \vspace{2 cm}
 \item[2.] Let $f(x) = x^3 - 4x^2 + 3x +9$ and find the following:
  \begin{itemize}
   \item[a)] $f'(x)$
   \vspace{1 cm}
   \item[b)] $f''(x)$
   \vspace{1 cm}
  \end{itemize}
\end{itemize}

There are many many more things that can be done with \LaTeX.
There are ways to create a journal style article or books.
In those cases you can have chapters, sections, subsections, as well as cite references in a bibliography.
The University of Toledo has a style file which alters alters the default environment so that any thesis or dissertation is in their format.
You can embed images in a file with the figure environment.
\LaTeX\ can also be used to give presentations using the \texttt{beamer} documentclass.
Built-in is the abililty to show only parts of slides and reveal the rest as needed.


There is way too much information out there than you can hold in your head about how to use \LaTeX.
Use your favorite search engine to find information on how to accomplish the task you are interested in.
Also, there are several good books on \LaTeX.
Leslie Lamport's (the author of \LaTeX) ``\LaTeX\ User's Guide and Reference Manual'' is suggested for beginers.
\end{document}
