\documentclass{assignment}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{listings}
\lstset{
numbers=left
}

\coursetitle{Computer Vision I}
\courselabel{CSE 252A}
\exercisesheet{Homework Template}{\LaTeX{}}
\student{Last Name, First Name}
\university{University of California, San Diego}
\semester{Fall 2015}
\date{Semptember 23, 2015}

\begin{document}
\begin{problemlist}




\pbitem How to use this document?

To understand each of the examples, make sure to look at the original latex source code. The source code will provide example solutions to latex related issues. Feel free to use this document as a template for all your assignments. Just make sure to replace the contents \textbackslash student with your name and update \textbackslash exercisesheet accordingly. To use this file as a template, make sure that the assignment.cls file is in the same directory as the .tex file.

\begin{figure}[b]
	\includegraphics[height = 2in]{pdflatex}
	\caption{Make sure to select Latex $\rightarrow$ Pdf option in texnic center}
    \label{fig:technicpdf}
\end{figure}

\pbitem How do I use latex?

For windows users, download \href{http://miktex.org/download}{MiKTex}. MiKTex will provide the base system
needed to compile \LaTeX files. It comes with an editor but I normally use \href{http://www.texniccenter.org/}{TeXnicCenter}.\\

For linux and mac users, the goal is install the pdflatex program. \\

On Ubuntu, to install everything use the following command.
\begin{verbatim}
  apt-get install texlive-full
\end{verbatim}

With other linux distros, find what packages provide pdflatex.\\

Mac users can download \href{http://www.tug.org/mactex/}{MacTex} or use something like homebrew to download the latex system (like linux there probably is set of packages like texlive).

\pbitem{How do I compile latex?}

When using a gui editor, make sure that the "Latex $\rightarrow$ Pdf" option is selected. See Fig~\ref{fig:technicpdf}.


Then use the compile/generate button. From command line use pdflatex \textless filename\textgreater.

Note: In order to have figures properly referenced, you may need to run pdflatex multiple times. For example, if your text says "Fig. ??", then please re-run pdflatex.


\pbitem How do I specify a problem?

You can specify the problem using \textbackslash pbitem. However if you do not want to
cut paste the problem from the assigment you can simply start writing
the answer as shown below.


\pbitem  

Although you can directly start writing the answer without writing the
question, it might be useful to write the question down for
completeness. 

\pbitem How do I write an equation?

There are several ways. Equation with an equation number can be written as 
\begin{align}
  E  =  mc^{2} \label{eq:emc2} 
\end{align}
You can refer the above equation as Eq.~\ref{eq:emc2}. If an equation
is not important and you wont refer it later, you might not want to number it. 
\begin{align*}
  E  =  mc^{2} 
\end{align*}
You can also write a set of aligned equations as 
\begin{align}
  E    &= mc^{2} \label{eq:emc2} \\ 
  G(x) &= \frac{1}{2\pi \sigma} \exp
   \frac{(x-\mu)^2}{2\sigma^2} 
\end{align}

\pbitem How can I add an image or a graph ? 

In PDFLatex you can add images as JPEG and PNG files. To be able to add images
to the latex file, make sure that \textbackslash use\{graphicx\} is included at
the top of your \LaTeX document. Graphs and plots should be added as PDF because
JPEG and PNG would store the graph as an image while PDF uses vector graphics
format. An example is shown in Fig.~\ref{fig:images}. \LaTeX{} does not provide
a lot of flexibility in where exactly the figure will be placed but after a while
it does not bother you much.

\begin{figure}[t]
\begin{tabular}{ccc}
  \includegraphics[height = 1.5in]{graph} &
  \includegraphics[height = 1.5in]{gbu}   & 
  \includegraphics[height = 1.5in]{monica}\\
  a & b & c
\end{tabular} 
\caption{(a) shows a graph attached as a PDF, (b) shows a JPEG image
while (c) shows a PNG image.}
\label{fig:images}
\end{figure} 

Use the \textbackslash label and \textbackslash ref commands to create links to figures.


\pbitem Can one have more than one answer
section for the problem ?

\begin{enumerate}
\item Part 1
  Answer to part one.
\item Part 2
    Answer to part two.
\end{enumerate}

\pbitem How do I list code?


Use the listings package. With the listings package you can either add the code
directly into the latex file, or link a file. In order to show line numbers make
sure the following lines are in your latex file.

\begin{verbatim}
\lstset{
numbers=left
}
\end{verbatim}

In this file the numbers=left option is set at the top of document.

\begin{lstlisting}[language=MATLAB, caption=Matlab example]
function f = fibonacci(n)
    if (n==1)
        f = 1;
    elseif (n == 2)
        f = 2;
    else
        f = fibonacci(n-1) + fibonacci(n-2);   
    end
end
\end{lstlisting}

\lstinputlisting[language=MATLAB, caption=MATLAB source file example]{source_filename.m}

\end{problemlist}
\end{document}
