Code: Select all
\documentclass{book}
\usepackage{enumitem}
\usepackage{answers}
\Newassociation{answer}{Answer}{ans}
\begin{document}
\Opensolutionfile{ans}
\begin{enumerate}
\item First exercise
\begin{answer}
First answer
\end{answer}
\item Second exercise
\begin{enumerate}[ref=(\alph*)]
\item\label{somelabel} The first part
\begin{answer}
Another answer.
\end{answer}
\item Use your answer to Part~\ref{somelabel} in this part.
\begin{answer}
Stuff
\end{answer}
\end{enumerate}
\end{enumerate}
\Closesolutionfile{ans}
\textbf{Answers to Selected Exercises}
\input{ans}
\end{document}
(I don't think this is relevant, but I am compiling with PDFLaTeX.)
Thank you,
Gary
P.S. This is my first post, so please do tell me if there is anything I should do differently in future posts.