# Reference a question (exercise package)

I am using the package 'exercise' and I want to reference a question and a question later in the text. Something like this:

\documentclass{article}
\usepackage{exercise}

\begin{document}

\begin{Exercise}

\Question{This is a question}
\subQuestion{this is a subquestion}

\Question{Reference question 1 here}
\subQuestion{Reference subquestion 1.a here}

\end{Exercise}

\end{document}


What is the best way to do this?

Just use the \label - \ref - mechanism, i.e. \label{foo} and \ref{foo} at the required places and compile twice.

\documentclass{article}
\usepackage{exercise}
\renewcommand{\thesubQuestion}{\theQuestion.\alph{subQuestion}}
\begin{document}

\begin{Exercise}

\Question{This is a question} \label{foo}
\subQuestion{this is a subquestion} \label{foobar}

\Question{Reference question \ref{foo} here}
\subQuestion{Reference subquestion \ref{foobar} here}

\end{Exercise}

\end{document}