Homework Template
Forfatter
Caleb McWhorter
Sidst opdateret
5 år siden
Licens
Creative Commons CC BY 4.0
Resumé
A template for creating course homeworks.
\documentclass[11pt,letterpaper]{article}
\usepackage[lmargin=1in,rmargin=1in,tmargin=1in,bmargin=1in]{geometry}
% -------------------
% Packages
% -------------------
\usepackage{
amsmath, % Math Environments
amssymb, % Extended Symbols
enumerate, % Enumerate Environments
graphicx, % Include Images
lastpage, % Reference Lastpage
multicol, % Use Multi-columns
multirow % Use Multi-rows
}
% -------------------
% Font
% -------------------
\usepackage[T1]{fontenc}
\usepackage{charter}
% -------------------
% Commands
% -------------------
\newcommand{\homework}[2]{\noindent\textbf{Name: }\makebox[3in]{\hrulefill} \hfill \textbf{MAT 999} \\ \textbf{Due: #2} \hfill \textbf{HW #1}\\}
\newcommand{\prob}{\noindent\textbf{Problem. }}
\newcounter{problem}
\newcommand{\problem}{
\stepcounter{problem}%
\noindent \textbf{Problem \theproblem. }%
}
\newcommand{\pointproblem}[1]{
\stepcounter{problem}%
\noindent \textbf{Problem \theproblem.} (#1 points)\,%
}
\newcommand{\pspace}{\par\vspace{\baselineskip}}
\newcommand{\ds}{\displaystyle}
\newcommand{\ansbox}[1]{%
\par\nobreak\vspace{\ht\strutbox} \noindent
\fbox{%
\parbox[c][\dimexpr#1-2\fboxsep][t]{\dimexpr\linewidth-2\fboxsep}{
\hrule width \hsize height 0pt
}%
}%
\par\vspace{\ht\strutbox}
}
\makeatother
% -------------------
% Header & Footer
% -------------------
\usepackage{fancyhdr}
\fancypagestyle{pages}{
%Headers
\fancyhead[L]{}
\fancyhead[C]{}
\fancyhead[R]{}
\renewcommand{\headrulewidth}{0pt}
%Footers
\fancyfoot[L]{}
\fancyfoot[C]{}
\fancyfoot[R]{\thepage \,of \pageref{LastPage}}
\renewcommand{\footrulewidth}{0.0pt}
}
\headheight=0pt
\footskip=14pt
\pagestyle{pages}
% -------------------
% Content
% -------------------
\begin{document}
\homework{\#}{MM/DD}
% Question
\prob This is an unnumbered problem.
\ansbox{2.5cm}
% Question 1
\problem This is a numbered problem.
\ansbox{2.5cm}
% Question 2
\problem This is the second numbered problem.
\ansbox{2.5cm}
% Question 3
\pointproblem{5} This problem has several parts:
\begin{enumerate}[(a)]
\item The first part.
\item The second part.
\item The third part.
\end{enumerate}
\ansbox{6cm}
\end{document}