\documentclass[12pt]{report}
\usepackage{amsmath,amssymb,latexsym}
\begin{document}
\setlength{\textwidth}{7.5in}
\setlength{\leftmargin}{-.5in}
\begin{center} {\bf Getting Started with \LaTeX\ } \end{center} \vskip .7cm

This document is designed to help you see how to produce some
mathematical typesetting.  The best way to learn how to use \LaTeX\ is
to experiment with particular commands.  After you have read through
this you might just try making some small changes to the .tex file and see what happens
to the resulting pdf file you get.

Here is how to make the truth table near the bottom of page 38 of the textbook.
Notice how I made  ``double'' horizontal or vertical lines.
\medskip

\begin{center}
\begin{tabular} {|c|c||c|}
\hline
$P$ & $Q$ & $P \wedge Q$  \\ \hline\hline
$T$ & $T$ & $T$  \\ \hline
$T$ & $F$ & $F$  \\ \hline
$F$ & $T$ & $F$   \\ \hline
$F$ & $F$ & $F$ \\ \hline
\end{tabular}
\end{center}
\vskip .5cm
This table was typeset with the following commands.
\begin{verbatim}

\begin{center}
\begin{tabular} {|c|c||c|}
\hline
$P$ & $Q$ & $P \wedge Q$  \\ \hline\hline
$T$ & $T$ & $T$  \\ \hline
$T$ & $F$ & $F$  \\ \hline
$F$ & $T$ & $F$   \\ \hline
$F$ & $F$ & $F$ \\ \hline
\end{tabular}
\end{center}
\end{verbatim}
\medskip

I wanted the table to be centered horizontally so the table is inside what is
called the ``center'' environment.  To do this I started with the \verb|\begin{center}|
command and ended with \verb|\end{center}|.  Everything between these two commands is
centered horizontally.
If you look closely at the table and the commands that make it,
you will notice that it begins with the command
\begin{verbatim}
\begin{tabular} {|c|c||c|}
\end{verbatim}
and ends with the command \verb|\end{tabular}|


\medskip
Everything between these commands is part of what is called the ``tabular
environment.''  There are lots of other ``environments'' such as itemize,
center, enumerate, equation, align, eqnalign, and many others.  Each of these environments
is set up to do one special thing.  For example, the tabular environment is
to make a table, the center environment is to center some text horizontally on
a line, the enumerate environment helps you to enumerate items, and so on.
\begin{center}
 You get the idea, right?
\end{center}

You guessed it.  That last line was typeset with
\begin{verbatim}
\begin{center}
 You get the idea, right?
\end{center}
\end{verbatim}

Now notice the rest of the command that started the tabular environment.
It has a combination of vertical lines, like $|$, and three copies
of the letter `c'.  The fact that there are three tells \LaTeX\ that
the table will have three columns, and the vertical lines tell it where
to draw vertical lines up and down the table.  By the way, the letter `c'
does not stand for column but for `center'.  The way I made the table
each entry was centered in its column.  You can also use `r' for right and
`l' for left.  The `r' prints the column contents right justified; the `l'
prints the column contents left justified. Since each entry in the first and second columns in this example
was a single character, replacing `c' by `r' or `l' has no visible effect.  It would have changed the appearance
if I had replaced `c' by either `l' or `r' in the third column.
In the following example you can see what happens.


\medskip
\begin{tabular} {c||r|l|c}
$*$ & $a$ & $b$ & $c$ \\ \hline\hline
$a$ & $b-a$ & $c$ & $b+5c$ \\ \hline
$b$ & $a^{23}$ & $c+2d$ & $b$ \\ \hline
$c$ & $c$ & $b$ & $a+b-c$  \\
\end{tabular} \\ \vskip .5cm

Consecutive entries in a given row of a table are separated by an \& and each
row ends with a double backslash.

In this class - and in most higher level mathematics classes - you will have occasion to use set notation a lot.
Here are several examples of that.  The first of these is just below Definition 1.2 on page 8 of the text; the second is from page 6;
the third from Example 1.7 on page 20.

\noindent $A \times B=\{(k,q), (k,r), (\ell,q), (\ell,r), (m,q),
 (m,r)\}$ \\
$(a,b]=\{x \in \mathbb{R} \colon a < x \le b\}$ \\ 
$\overline{P}=\mathbb{N}-P=\{1,4,6,8,9,10,12,\ldots\}$

  




\noindent These three lines were typeset with the following commands

\begin{verbatim}
\noindent $A \times B=\{(k,q), (k,r), (\ell,q), (\ell,r), (m,q),
 (m,r)\}$ \\
$(a,b]=\{x \in \mathbb{R} \colon a < x \le b\}$ \\
$\overline{P}=\mathbb{N}-P=\{1,4,6,8,9,10,12,\ldots\}$
\end{verbatim}

Notice the \verb|\noindent| at the beginning of the first line and the double backslash \verb|\\|
at the end of the first and second lines.  It's sort of obvious what \verb|\noindent| means.  The double
backslash is a command to end a line of text and begin a new line.  Also notice the \verb|\mathbb{R}| and 
\verb|\mathbb{N}| commands above.  These are commands to use the ``blackboard'' font that we mathematicians
tend to use for special sets - in this case for the set of real numbers and the set of natural numbers, respectively.
You probably also see the strange \verb|\ell| above.  Sometimes it seems natural to use a lower case eleventh letter of the 
alphabet in what we write, but it tends to be easily confused with the numeral 1.  So \verb|\ell| produces a script form of
this letter.

Here are three algebraic equations illustrating some of the common algebraic
operations like fractions, powers and roots.
\[\alpha^3=\frac{-1+i}{\sqrt{2}}, \hskip 1cm \alpha^5=\frac{-1-i}{\sqrt{2}},
\hskip 1cm \beta=\sqrt[5]{x^3-3x^2+17}\,.\]
That last line was typeset with this command.

\begin{verbatim}
\[\alpha^3=\frac{-1+i}{\sqrt{2}}, \hskip 1cm
\alpha^5=\frac{-1-i}{\sqrt{2}},
\hskip 1cm \beta=\sqrt[5]{x^3-3x^2+17}\,.\]
\end{verbatim}

This line is set in mathematical font and is on a line centered horizontally
with a space above it and a space below the line (before the text begins again).
To set off mathematics like this you start the line with the command \verb|\[|
and end it with \verb|\]|.  You can instead use \verb|$$| to begin and \verb|$$|
to end the line.  

There are several ways to put vertical and horizontal space in what you write.  You can tell
the program exactly how much space to put by putting in a command like
\verb|\vskip 2cm| which asks for a vertical skip of 2 centimeters.  A horizontal
skip is similar and the command would be \verb|\hskip 2 cm|. You can ask the program
to insert just a small horizontal space by using \verb|\,|.  You will find
such a command in the last line of mathematics above. If you simply press the
`Enter' key twice then you get a new paragraph, but pressing it more than twice
doesn't give you any more vertical space.  Try it.





Sometimes it is helpful (to us and especially to those who read what we write) to
display the simplification or expansion of an expression as an array
of equations, congruences, inequalities, etc.  Here is an example of doing this to show the simplification of
a sum.  (This is from a proof on page 158 of the text.  You will
see that I have given this array a number (even though it does not have one in the text) so that I can easily refer
to it elsewhere in my writing.  Actually I didn't give it a number, but
\LaTeX\ automatically gave it a number when I decided to give it a label.
Look below to the commands that generated this aligned set of expressions
to see where I gave it a label.
\vskip .5cm
\begin{eqnarray}\label{simplify}
\sum_{i=0}^{k+1} i \cdot i! &=& \left(\sum_{i=0}^{k} i \cdot i!\right) +(k+1)(k+1)!\\
                            &=& \left((k+1)!-1\right)+(k+1)(k+1)!\nonumber \\
                            &=& (k+1)! + (k+1)(k+1)! -1 \nonumber \\
                            &=& (1+(k+1))(k+1)!-1 \nonumber \\
                            &=& (k+2)(k+1)!-1 \nonumber \\
                            &=& (k+2)!-1 \nonumber \\
                            &=& ((k+1)+1)!-1. \nonumber
\end{eqnarray}


\noindent I can now refer to this array of expressions \eqref{simplify} by giving the command
\verb|\eqref{simplify}|.
\vskip .5cm
The above was typeset using the following commands.  I hope you can
see that \LaTeX\ automatically generates the numbers associated with
things like arrays of equations.  You can use whatever name you want
as the label; \LaTeX\ takes care of the rest.  If you have other equations
that you want to refer to elsewhere in the same document, then again,
\LaTeX\ handles all of the bookkeeping for you.

\begin{verbatim}
\begin{eqnarray}\label{simplify}
\sum_{i=0}^{k+1} i \cdot i! &=& 
\left(\sum_{i=0}^{k} i \cdot i!\right) +(k+1)(k+1)!\\
                            &=& 
\left((k+1)!-1\right)+(k+1)(k+1)!\nonumber \\
                            &=& (k+1)! + (k+1)(k+1)! -1 \nonumber \\
                            &=& (1+(k+1))(k+1)!-1 \nonumber \\
                            &=& (k+2)(k+1)!-1 \nonumber \\
                            &=& (k+2)!-1 \nonumber \\
                            &=& ((k+1)+1)!-1. \nonumber
\end{eqnarray}
\end{verbatim}

We will spend some time studying functions and their properties.  Here is an example from exercise 15
on page 205 of the text that illustrates function notation.

\noindent $f:\{A,B,C,D,E,F,G\} \to \{1,2,3,4,5,6,7\}$ 

\noindent This is typeset using the commands 
\begin{verbatim}
$f:\{A,B,C,D,E,F,G\} \to \{1,2,3,4,5,6,7\}$
\end{verbatim}







How about some fancy ``underbraces''?  In this course you probably won't need to do anything
this fancy, but I just want to show you that \LaTeX\ is really a powerful program.  We have 
just scratched the surface.  Here is an example.
\[ \underbrace{(1+1+\cdots+1)}_{n \,\,\mbox{{\scriptsize summands} }}
\underbrace{(1+1+\cdots+1)}_{m \,\,\mbox{{\scriptsize summands} }}=
\underbrace{(1+1+\cdots+1)}_{nm \,\,\mbox{{\scriptsize summands} }}\]
typeset with
\begin{verbatim}
\[ \underbrace{(1+1+\cdots+1)}_{n \,\,\mbox{{\scriptsize summands} }}
\underbrace{(1+1+\cdots+1)}_{m \,\,\mbox{{\scriptsize summands} }}=
\underbrace{(1+1+\cdots+1)}_{nm \,\,\mbox{{\scriptsize summands} }}\]
\end{verbatim}
In the above example the command \verb|\,| adds a little space and the
command \verb|{\scriptsize summands}| prints the word ``summands'' in a
font size about the same as the $n$ or the $m$.  The command
\verb|\mbox|  allows you to insert regular text fonts inside a mathematical
expression.  The text you wish to put there is enclosed inside the
set brackets \verb|{| and  \verb|}|.  Here the mathematical expression
is put into ``display mode'' by the use of the delimiter \verb|\[| at
the beginning and \verb|\]| at the end.





















To get started producing your own typesetting with \LaTeX\ there are a
couple more important things for you to know.  You have to tell \LaTeX\ what
kind of a document you are creating.  You do that in the first lines of
the .tex file with some commands such as

\begin{verbatim}
\documentclass[12pt]{report}
\usepackage{amsmath,amssymb,latexsym}
\end{verbatim}

These particular commands tell the program that your document will be a
report written in 12 point font.  There are other document classes such
as letters, articles, etc.  The command
\verb|\usepackage{amsmath,amssymb,latexsym}|  instructs the program to use
certain packages or style files that tell it what symbols and so on to
expect.  There are lots of style files; it is best to consult a \LaTeX\
manual or ask someone about these.

There are lots of other commands that allow you to set the size of the margins
of your document, the width of the text, the height of text, etc.  Here are several
of those that I used at the top of this document.  You might try experimenting with
these, but you should keep in mind that some of this is quite subtle.\footnote{See the
negative left margin setting if you don't understand what I mean by subtle.  By the
way, please look at the .tex file that produced this pdf to see how easy it is to make footnotes
in \LaTeX.}  Consulting
a \LaTeX\ book or asking an expert is advisable.


\begin{verbatim}
\setlength{\textwidth}{7.5in}
\setlength{\leftmargin}{-.5in}
\end{verbatim}

You also have to tell \LaTeX\ where the actual document begins and where
it ends.  You have probably figured out that is done with
\verb|\begin{document}| and \verb|\end{document}| respectively.  Check out
the .tex file that produced this pdf file and you can see where these
commands belong.

\end{document}
