3

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?

4

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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.