Homework with answer key (answers)
Homework exercises whose solutions are written to a separate file by the answers package and printed as an answer key at the end.
- Category
- Teaching
- Document class
article(article.cls) — ships with TeX Live- Workflow
- Assignment / problem set — no revision rounds
- Author
- Mike Piff, Joseph Wright
- Source
- CTAN
- Licence
- answers.sty: The LaTeX Project Public License 1.3c. Sample text: Manulyx, CC0 1.0 (free to use, no conditions).
What you get
main.tex— the file that is compiled · 2 KB
These become your files. Editing them afterwards changes your project and nothing else — a project owns its files from the moment it is made.
Link to this template. Send it to a student or co-author: it starts a new paper in this template, through sign-up if they need an account.
https://manulyx.com/start/ctan-teaching-answers
2 venues use this class
Manulyx keeps one template per document class and relates every venue to it, rather than one near-identical card per journal. Searching the gallery for any of these names finds this template.
Journal of Machine Learning Research, Transactions on Machine Learning Research
- Journal of Machine Learning Research
- Transactions on Machine Learning Research
Source
main.tex — the file that is compiled · 2 KB
\documentclass[a4paper,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{tikz}
% With [nosolutionfiles] the solutions appear where they are written instead.
\usepackage{answers}
\newtheorem{exercise}{Exercise}
% Every sol environment is written to the file handle ans, inside a Solution environment.
\Newassociation{sol}{Solution}{ans}
\renewcommand{\Solutionlabel}[1]{\textbf{Solution to Exercise #1.}}
\title{Your paper}
\author{Course Code -- Course Name}
\date{Homework 4}
\begin{document}
\maketitle
\Opensolutionfile{ans}[answer-key]
\section*{Exercises}
\begin{exercise}
Solve the system
\begin{equation}
\begin{aligned}
2x + y &= 7, \\
x - y &= -1 .
\end{aligned}
\end{equation}
\begin{sol}
Adding the equations gives $3x = 6$, so $x = 2$ and $y = 3$.
\end{sol}
\end{exercise}
\begin{exercise}
The table shows the number of hours $h$ that five students studied and their marks $m$.
\begin{center}
\begin{tabular}{@{}lccccc@{}}
\toprule
$h$ & 1 & 2 & 3 & 4 & 5 \\
\midrule
$m$ & 52 & 58 & 65 & 70 & 77 \\
\bottomrule
\end{tabular}
\end{center}
Compute the mean mark.
\begin{sol}
$(52 + 58 + 65 + 70 + 77)/5 = 322/5 = 64.4$.
\end{sol}
\end{exercise}
\begin{exercise}
Find the perimeter of the rectangle below.
\begin{center}
\begin{tikzpicture}
\draw[thick] (0,0) rectangle (3,1.5);
\node[below] at (1.5,0) {6 cm};
\node[right] at (3,0.75) {3 cm};
\end{tikzpicture}
\end{center}
\begin{sol}
$2(6 + 3) = 18$\,cm.
\end{sol}
\end{exercise}
\Closesolutionfile{ans}
\section*{Answer key}
\input{answer-key}
\end{document}
The first page, as this template compiles today. Click it to enlarge, and again to shrink. Open the file ↗