I want to append an answer sheet to an exam. However, I only managed to do so manually, which causes conflicts if I reference things (with \cref
for instance). Also, if have to re-adjust the points in the answer sheet every time I change them in the questions. Is there a proper way of doing this?
\documentclass[addpoints, 12pt]{exam}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage[nameinlink]{cleveref}
\pagestyle{headandfoot}
\firstpageheader{\large\bfseries Astronomy Exam\\ \bigskip
\large\bfseries Last Name:\enspace\makebox[1.9in]{\hrulefill}}
{}
{\large\bfseries Univ ID: \makebox[2in]{\hrulefill} \\ \bigskip
\large\bfseries First Name:\enspace\makebox[2in]{\hrulefill}}
\runningheader{\large\bfseries Last Name:\enspace\makebox[1.9in]{\hrulefill}}
{}
{\large\bfseries First Name:\enspace\makebox[2in]{\hrulefill}}
\firstpagefooter{}{}{}
\runningfooter{}{\thepage}{}
\begin{document}
\begin{center}
\fbox{\fbox{\parbox{5.5in}{\centering
Answer the questions in the spaces provided on the
answer sheets.}}}
\end{center}
\begin{questions}
\question[60] Explain Principle A
\question[40] Explain Principle B
\end{questions}
\newpage
\begin{center}
\fbox{\fbox{\parbox{5.5in}{\centering
Answer sheet}}}
\end{center}
\bigskip
\begin{questions}
\question[60] Answer:
\vspace{\stretch{1}}
\question[40] Answer:
\vspace{\stretch{1}}
\end{questions}
\end{document}
Best Answer
Hi I modified the answer from How to get LaTeX to expand at the correct position? to create a new environment for my answer booklet.
Here's the solution using your MWE
You can rename skript to something more obvious like answerbox. Basically it just writes the contents of the environment to a file and outputs it when
\includeSkripts
is called.