\documentclass{assignment}
\usepackage{amsmath}
\usepackage{graphicx}
\coursetitle{Creating assignments}
\courselabel{CSE 252 B}
\exercisesheet{Assignment 1}{\LaTeX{}}
\student{Satya P. Mallick and Serge Belongie}
\university{University of California, San Diego}
\semester{Spring 2006}
\date{March 22, 2006}
\begin{document}
\begin{problemlist}
\pbitem How do I compile hw.tex ?
Windows users can use the following command
\begin{verbatim}
texify -p hw.tex
\end{verbatim}
in the command prompt and it will run pdflatex and bibtex the required
number of time and output this pdf. If you want to use pdflatex and
bibtex directly, you need to use the following set of commands
\begin{verbatim}
pdflatex hw
pdflatex hw
bibtex hw
pdflatex hw
\end{verbatim}
Although, in practice it may not be required to use pdflatex three
times always. Once you have created a pdf file identical to this one,
you can go back and forth between the pdf and the tex file to see what
command in \LaTeX{} produces what output.
\pbitem How do I specify a problem ?
You can specify the problem as above. 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. 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 = 2in]{graph} &
\includegraphics[height = 2in]{gbu} &
\includegraphics[height = 2in]{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}
\pbitem How can I generate plot in pdf format using MATLAB ?
MATLAB allows you to directly save the current figure as a PDF file
using the print command. However, the PDF file usually contains large
white spaces around the plot. You can work around this problem by
first generating an eps file using matlab
\begin{verbatim}
print -depsc2 filename.eps
\end{verbatim}
This eps file can then be converted to pdf using epstopdf.
\begin{verbatim}
epstopdf filename.eps
\end{verbatim}
\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 Did you make this assignment class ?
No I modified it slightly. But all credit for the assignment class
goes to Madhusudan Singh (C) 2004.
\pbitem How do I cite references ?
There are a few ways to add references. The cleanest way is using
bibtex. During the course, you can maintain a single bibfile and refer
from that file ``cite''. For example, I can cite
Higham~\cite{Higham2002} and Horn~\cite{Horn1987} and only those
entries from the bibfile appear in the reference which I have cited.
\end{problemlist}
\bibliographystyle{plain} \bibliography{bibfile}
\end{document}