I am using exercise package to list exercises/questions. I am defining exercise list like this:

  \Exercise{Exercise title}

  Some exercise introduction
  \Question{First question}
  \Question{Second question}
  \Question{Third question}

In the output questions are numbered like this:

1. First question

However my desire is to have following output:

(a) First question

Actually it would be best if I could manually define list letter for question as I anticipate some gaps in numbering later. For example \Question{e}{Some question}. From the package source I see that questions are translated to list items:


However I am unsure on how to redefine the macro in order to accomplish my goal.. Any ideas or hints?


Good on you to look in the source code. Good on the package author to use good macro names that describe the intent. I guessed from your posted snippet that \QuestionNB might be the macro that typeset the question number. Searching the source file for that string found me:

% Presentation of Questions
%    \begin{macrocode}
\newcommand{\QuestionNB}{\arabic{Question}.\ }

Excellent! We know \QuestionNB sets the arabic representation of the value the Question counter, with period and space. So all you have to do is insert

\renewcommand{\QuestionNB}{(\alph{Question})\ }

into the preamble after \usepackage{exercise} and you'll get what you want.

\renewcommand{\QuestionNB}{(\alph{Question})\ }
  \Exercise{Exercise title}

  Some exercise introduction
  \Question{First question}
  \Question{Second question}\label{q2}
  \Question{Third question (\textit{Hint}: use your answer to question~\ref{q2})}

(View this in CoCalc)

sample code output

The command \theQuestion is for setting the counter value in \references. So the line renewing it will take care of the situation described by Peutsch in the comments.

  • The problem of this solution is that referring to a question still uses the internal counter, which is numerical. Eg \Question Second question \label{q2} \Question{Third question. Hint: use your answer to question~\ref{q2}} would display "Hint: use your answer to question 2." – Peutch Sep 22 '18 at 21:37
  • @Peutch You are right, of course. I've updated the answer to take care of this. – Matthew Leingang Sep 23 '18 at 23:54

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.