\documentclass[12pt]{article}% there are lots of classes -- this is the easiest for us
\usepackage{amssymb}%  this allows us to use certain symbols from the Amer. Math. Soc.
%this is the end of the "top matter"  You could put user-defined definitions up here
\usepackage[all]{xy} %array package
\usepackage{amsmath}%uses \overset to set equations
\usepackage{graphicx}
\usepackage{amscd}
\usepackage{geometry}%
\usepackage{amsfonts}%
\usepackage{amsthm}
\usepackage{bm}
% Start by defining the theorem environments.

% The default theorem style is plain.
\newtheorem{defaultThm}{Theorem}[section]  %Ignore this for now

\begin{document}                %every document needs this command
\title{Midterm Key}             % Enter your title between curly braces
\author{ Fred Tinsley}          % Enter your name between curly braces
\date{\today}                   % Enter your date or \today between curly braces
\maketitle                      %This will gives our document a title, using the above info

To enter text, just type away!  LaTex will arrange everything for you.  It automatically indents each paragraph.
Two carriage returns result in a new paragraph.

You need to be aware of several special symbols.  Commands begin with the $\backslash$ symbol.  Some of the basic ones follow.  The \% symbol labels the LaTex line as a comment.  Nothing appears in the output.
%  See; this doesn't appear in the output file. 
A pair $\backslash\backslash$ results in a carriage return.  Math symbols must appear in one of two environments.  If you wish an exptression to appear in the same line with text, then enclose it within matching \$.  Try $f(x)=e^x$.  LaTex automatically controls spacing.  The other environment is called display math.  The math object is enclosed within $\backslash[$ and $\backslash]$.  In addition to being the prettiest typesetting, the math object is centered with ample spacing before and after.  Try \[ f(x)=e^x\].  Many choices for math symbols appear at the left in TexMaker.
Matching braces \{\} are used to group symbols, for example, into subscripts or superscripts.
\noindent                         %This eliminates the indention.
Now, compare the Latex files to the output files to gain an understanding of how to construct beautifully dispayed mathematics.
\section{Problem 1}             %Latex numbers the sections

a.  We denote a limit by \[ \lim_{x\rightarrow a \atop x\neq a} f(x)=L\]
          %Notice that \lim is LaTex special function, that _ designates a subscript, and that in display
          %math, this appears below the lim function.  Notice also how we make use of \atop. Many LaTex 
          %functions are 'common sense'. 
Given $\epsilon >0$ there exists a $\delta > 0$ such that $|f(x)-L|<\epsilon$ whenever $|x-a|<\delta$.\\

In writing a portion of the proof in part (b), I show you how to make use of arrays.  These are framed by begin and end statements.

\noindent
b.  We pick up with the proof:\\

$\begin{array}{rl}                     %rl indicates two columns that are right and left justified, repsectively
|x^4-a^4|=&|x-a||x^3+x^2a+xa^2+a^3\\   %The & separates colummns' \\ indicates a new row
\leq&|x-a|(|x^3|+|x^2a|+|xa^2|+|a^3|)
\end{array}$                           %The $'s frame the environment
\\

For problem 2 we import a figure.  For our purposes only the .pdf, .jpg, or .png files are allowed.  I created a graph in Derive called Graph.jpg and placed it in the same directory with this LaTex file.  I also add a caption.  As with arrays, the environment is designated by begin and end statements.
\section{Problem 2}

\begin{figure}  [h]                          %Figure is the environment; {h} designates the location as being "here" 
                                             %or at the given spot.  The other choices are t-top of the page, 
                                             %b-bottom of the page, or p-special page of figures.
\includegraphics[width=.8\linewidth]{Graph}  %\includegraphics is the key command.  We specify the width of the 
                                             %figure to be 80% of the width of the text.  We omit the file extension
                                             %on graph. LaTex maintains the aspect ratio of the figure.
\caption{h(x)}                               %We add the caption 'h(x)'  LaTex will also give a figure number.
\end{figure}

We use arrays again in problem 3 to create a function in pieces.  We introduce an expandable brace in display math.
\section{Problem 3}
\[ g(x)=\left\lbrace                         %\left makes \lbrace expandable
\begin{array}{lr}
x^2&x\geq 0\\
-x^2&x<0
\end{array}   
\right. \]                                   %The . instructs LaTex to have no matching right brace.
%~\cite{lyndon:tex}

%\nocite{*}
%\bibliography{tins_4}

%\bibliographystyle{abbrv}

\end{document} %all documents end here!
