## LaTeX forum ⇒ General ⇒ References to Parts of a Problem

LaTeX specific issues not fitting into one of the other forums of this category.
gfelder
Posts: 1
Joined: Thu Dec 05, 2013 3:56 am

### References to Parts of a Problem

I am writing a textbook and each chapter has problems with associated answers, which I want displayed at the end of the book. After some searching I have found the answers package most helpful for this. However, I have run into a problem with multi-part problems.
\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}

Within the text I often refer to earlier parts in a problem, e.g. "Using your answer to Part (b), find such-and-such". I've used the ref option to enumerate to get that to appear as (b) without the number of the problem. Unfortunately the answers package also uses that ref option and doesn't display the problem number at the back of the book. Does anyone know a simple way I could get the reference to look like Part (b) inside the text of the problem, but have the answer labeled 2b at the back of the book?

(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.
Last edited by localghost on Thu Dec 05, 2013 11:57 am, edited 1 time in total.
Reason: Longer passages of source code are tagged as code block, not as in-line code.

Tags: