I quite like exam
package, but in my use case, each question has a title and a number. The same as the \section
of an article which has a name and a number. Thus, I would like to display the current question number/or name in the header the same way we use \rightmark
. Last but not least, I would like the grade table to display the full question name.
In my case the first question is named Foo
, has the number 1
and its full name is: Problem 1: Foo
.
\documentclass[addpoints]{exam}
\firstpageheader{Exam}{}{}
\runningheader{Exam / Problem \thecurrentquestionnumber}{}{}
\newcounter{questioncounter}
\newcommand\thequestionnumber[1]{\thequestioncounter}
\qformat{%
\addtocounter{questioncounter}{1}
\large\textbf{Problem \thequestionnumber~:~\thequestiontitle}
\quad (\thepoints)\hfill
\vrule depth 1.5em width 0pt
}
\begin{document}
\begin{center}
% In this table I would like the question number instead of the question name
\gradetable[v][questions] \vspace*{10ex}
\end{center}
\begin{questions}
\newpage
\titledquestion{Foo}[10] % Question 1
...\par
\newpage
\titledquestion{Bar}[10] % Question 2
...\par
\newpage
\titledquestion{Baz}[10] % Question 3
...\par
\end{questions}
\end{document}
How can I perform the following using the exam package? Where should I look at?
- Insert current question name/number in the header
- Display full name with the question number in the gradetable
- Deal with both question name and question number
EDIT
One possibility is to monkey patch the exam.cls
by adding the following:
\newenvironment{questions}{%
...
\def\@queslevel{question}%
\def\titledquestion##1{%
\@bonusfalse
\def\thequestiontitle{##1}%
\process@question
}%
...
\def\process@question{%
...
\xdef\rightmark{Problem \thenumquestions~\thequestiontitle}
But I would like to know if there is a better option...
\xdef\rightmark{...}
and instead display the last value set.