Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
LaTeX Homework Template
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{fancyhdr}
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\usepackage{graphicx}
% TODO List
\usepackage{color}
\usepackage{index} % use index package to create indices
\newindex{todo}{tod}{tnd}{TODO List} % start todo list
\newindex{fixme}{fix}{fnd}{FIXME List} % start fixme list
\newcommand{\todo}[1]{\textcolor{blue}{TODO: #1}\index[todo]{#1}} % macro for todo entries
\newcommand{\fixme}[1]{\textcolor{red}{FIXME: #1}\index[fixme]{#1}} % macro for fixme entries
\pagestyle{fancy}
\lhead{CS999 homework}
\rhead{Joe Smith (jsmith2)}
\newcommand{\answer}{\vspace{0.10in}\noindent}
\newcommand{\tab}{\hspace*{2em}}
\newcommand{\comment}[1]{}
\begin{document}
\begin{enumerate}
\setlength{\itemsep}{0.20in}
% Problem 1
\Large{\item \textbf{Generic Problem One}}
\normalsize
\answer{
\begin{enumerate}
% (a)
\item
\answer {
Example pseudocode w/ $for$, $while$, and $if$:
\begin{algorithmic}[1]
\Procedure{ExamplePseudocode}{$G, s$}
\For{\textbf{each} vertex $v \in G$}
\State $probability[v] \gets \infty$
\While{$Q$ is not empty}
\If{$probability[u] = \infty$}
\State \textbf{break}
\EndIf
\State remove $u$ from $Q$
\EndWhile
\EndFor
\State \textbf{return} ($probability[], previous[])$
\EndProcedure
\end{algorithmic}
Everything is proven. We're all happy.
$\blacksquare$
}
% (b)
\item
\answer {
Example equation array:
\begin{eqnarray*}
1 & = & 1 \\
1 & = & 2 \\
1 & > & 3
\end{eqnarray*}
FALCON PUNCH.
$\blacksquare$
}
\end{enumerate}
}
\end{enumerate}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.