I am creating an exam with two parts, the first part is short questions and the second part is essay question, and I would like to automatically count the number of questions for the two parts separately. By default, the \numquestions
displays the total number of questions in the document.
\documentclass{exam}
\begin{document}
\begin{questions}
\fullwidth{\Large \textbf{Short questions}}
There are \numquestions\ short questions. %display the number of short questions.
\question
This is the first short question.
\question
This is the second short question.
\setcounter{question}{0}
\fullwidth{\Large \textbf{Essay questions}}
There are \numquestions\ essay questions. %display the number of essay questions.
\question
This is the first essay question.
\question
This is the second essay question.
\question
This is the third essay question.
\question
This is the fourth essay question.
\end{questions}
\end{document}