# How to link an answer to a specific question with exercise package?

I am typesetting some exercises with the following structure,

Exercise 1
Some introductory text.
1.1 The first question?
1.2 The second question?


Using the exercise package I can accomplish this in the following way,

\begin{Exercise}
Some introductory text.
\Question The first question?
\Question The second question?
\end{Exercise}


Now I want to type an answer to each question. The only way I found to do this is by setting the numbering myself in the answer,

\begin{Answer}[number=1.1]


which will eventually fail when the order of exercises/questions changes.

What is the right way of doing this?

How can I link an individual answer to each of the questions?

You can use the ref=<ref> or number=\ref{<ref>} key when you \label the questions of interest:

\documentclass{article}
\usepackage{exercise}% http://ctan.org/pkg/exercise
\begin{document}
\begin{Exercise}
Some introductory text.
\Question \label{first}The first question?
\Question \label{second}The second question?
\end{Exercise}

\end{document}


As alternative a quite elegant solution by the excellent »exsheets« package.

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}

counter-format=qu.tsk,
item-indent=3em,
label-width=2em
}

\begin{document}
\section{Foo}
\begin{question}\label{qu:twopart}
Some introductory text.