\documentclass{65240}

\author{Ben Bitdiddle}
\problem{- \textit{Latex Tutorial}}
\collab{Alyssa Hacker}


\usepackage{longtable}

\usepackage{shortvrb}
\MakeShortVerb{\|}

\begin{document}

\section{Math Macros}

\LaTeX\ is an excellent tool for typesetting mathematical writings.
To write math inline, use |$_$|, e.g. |$x^2$| will render as $x^2$. To write
math equations, use |$$_$$|, e.g. |$$x = y + 1$$| will render as $$x = y + 1$$
For a set of math symbols, see Section 3.3 of the \LaTeX\ manual.
Another great reference is available at: \url{http://latex.computersci.org}

The \texttt{65240.sty} package (included in the \texttt{6852.cls} class) provides
useful shorthands for a number of math expressions, in addition to the standard
math macros. Note, parentheses created using our macros will scale to the size
of the contained expression.

\begin{longtable}{p{3in}l}
|\reals|        & $\reals$ \\
|\integers|     & $\integers$ \\
|\naturals|     & $\naturals$ \\
|\rationals|    & $\rationals$ \\
|\complex|      & $\complex$ \\
\hline \\
|\lgg|          & $\lgg$ \\
|\lggg|         & $\lggg$ \\
|\lnn|          & $\lnn$ \\
|\lnnn|         & $\lnnn$ \\
\hline \\
|\norm{x}|      & $\norm{x}$ \\
|\set{x}|       & $\set{x}$ \\
|\abs{x}|       & $\abs{x}$ \\
|\card{x}|      & $\card{x}$ \\
|\floor{x}|     & $\floor{x}$ \\
|\ceil{x}|      & $\ceil{x}$ \\
|\ang{x}|       & $\ang{x}$ \\
|\sbrace{x}|    & $\sbrace{x}$ \\
|\cbrace{x}|    & $\cbrace{x}$ \\
|\paren{x}|     & $\paren{x}$ \\
|\prob{x}|      & $\prob{x}$ \\
|\expect{x}|    & $\expect{x}$ \\
|\variance{x}|  & $\variance{x}$ \\
|\choose{n}{k}| & $\choose{n}{k}$ \\
|a \goesto b|   & $a \goesto b$ \\
\hline \\
\begin{minipage}[c]{\linewidth}
\begin{verbatim}
\matx{3}{a & b & c \\
         d & e & f}
\end{verbatim}
\end{minipage}
 & $\matx{3}{a&b&c\\d&e&f}$ \\
|A\transpose|   & $A\transpose$ \\
|\Adj|          & $\Adj$ \\
|\percent|      & $\percent$ \\
|\qedbox|       & $\qedbox$ \\
\begin{minipage}[c]{\linewidth}
\begin{verbatim}
\cases{x & \cif{x > 0} \\
       -x & \cwhen{x < 0} \\ 
       0 & \cotherw}
\end{verbatim}
\end{minipage}
%|\cases{x & \cif{x > 0} \\ y & \cwhen{x < 0} \\ 0 & \cotherw}|
 & 
$\cases{x & \cif{x > 0} \\ y & \cwhen{x < 0} \\ 0 & \cotherw}$ \\
%|2=2\qed|       & $2=2\qed$ \\
\hline \\
\end{longtable}
% \end{tabular}

\section{Theorems}

Theorems are Latex environments to organize proofs. Environments are used as
follows:

\begin{verbatim}
 \begin{environmentname}
   environment content
 \end{environmentname}
\end{verbatim}

% NOTE: using verbatim to force tt

\begin{principle}
This is an example of a |principle|.
\end{principle}

\begin{theorem}
This is an example of a |theorem|.
\end{theorem}

\begin{lemma}
This is an example of a |lemma|.
\end{lemma}

\begin{corollary}
This is an example of a |corollary|.
\end{corollary}

\begin{example}
This is an example of an |example|.
\end{example}

\begin{proof}
This is an example of a |proof|.
\end{proof}

\begin{proofsketch}
This is an example of a |proofsketch|.
\end{proofsketch}

\begin{proofidea}
This is an example of a |proofidea|.
\end{proofidea}


% \newcommand{\eqnref}[1]     {(\protect\ref{#1})}
% \newcommand{\amortized}[1]  {\widehat{#1}}
%
% \renewcommand{\cases}[1]    {\left\{ \begin{array}{ll}#1\end{array}\right.}
% \newcommand{\cif}[1]        {\mbox{if $#1$}}
% \newcommand{\cwhen}[1]      {\mbox{when $#1$}}
% \newcommand{\cotherw}       {\mbox{otherwise}}
%
% % definitions and special styles
%
% \newcommand{\defn}[1]       {{\textit{\textbf{\boldmath #1}}}}


\section{Pseudocode}

The package \texttt{65240} automatically includes the package \texttt{clrscode4e}
which is a slight modification of Thomas H. Cormen's \texttt{clrscode3e}
package. Below is a short example. For detailed documentation see:
\begin{center}
\texttt{\url{http://www.cs.dartmouth.edu/~thc/clrscode/}}
\end{center}

\noindent\begin{minipage}[t]{.5\textwidth}
\begin{verbatim}
\begin{codebox}
\Procname{Find $p$}
\li \For $i \gets 0$ \To $n$ \Do
\li     \If $i > 1$ \Then
\li        $p\pp$
\li     \Else
\li        $p\mm$ 
        \End
      \End
\end{codebox}
\end{verbatim}
\end{minipage}
\noindent\begin{minipage}[t]{.5\textwidth}
\begin{codebox}
\Procname{Find $p$}
\li \For $i \gets 0$ \To $n$ \Do
\li     \If $i > 1$ \Then
\li        $p\pp$
\li     \Else
\li        $p\mm$ 
        \End
      \End
\end{codebox}
\end{minipage}

\section{Figures}

To include a diagram or drawing in your solutions, 
save the drawing to a PNG, JPG or PDF file, then use the command:
|\includegraphics{filename}|.
The command takes a number of useful options:
\begin{verbatim}
scale=<scaling-factor>
angle=<degrees>
width=...
height=...
bb=<bottom-left-x bottom-left-y top-right-x top-right-y>
page=<specific-page-in-PDF>
\end{verbatim}
The dimensions need to be given with the unit, e.g. \texttt{2in}, \texttt{50mm}.
For example, the command below extracts 2nd page, rotates it by 90 degrees and 
scales width to 2 inches:
\begin{verbatim}
\includegraphics[page=2,angle=90,width=2in]{mydrawing}
\end{verbatim}

Here is a sample drawing included using \verb|\includegraphics[width=2in]{drawing}|

\includegraphics[width=2in]{drawing}

\end{document}
