Consider the following code:
\documentclass[a4paper,12pt]{book}
\usepackage{amsthm}
\usepackage{hyperref}
\theoremstyle{plain}
\newtheorem{exercise}{Exercise}
\newtheorem{solution}{Solution}
\begin{document}
\begin{exercise}
This is an exercise.
\end{exercise}
\begin{solution}
This is a solution.
\end{solution}
\end{document}
I'd like to:
- Assign the same number to each "exercise" and "solution" pair (possibly via some sort of unique ID they share?);
- Automatically generate hyperlinks from an "exercise" title to its corresponding "solution" and vice versa, so one can easily navigate from a problem to its solution and vice versa.
I'm probably asking for something fairly difficult -- I'd be happy with just the first question. I'm not sure if they should be two separate questions but they seem quite related to me.
exercise
andsolution
always be next to one another? Or do you plan on puttingsolution
s (say) at the end of the document, while theexercise
s will be part of the main document body?answers
package (and others) make this possible. You should be able to get the numbering and linking to work with its structure.