I want to use both \question and \titledquestion of the exam documentclass without messing up the gradetable. From this question we know how to patch the questions environment in order to preserve the grade table with the numbers of the questions. But the solution to that question works for \titledquestion only, it breaks down if some of the questions are typeset using the \question command without a title.
For example having question 2 input with the \question command (see the MWE below) will result in a line "Question 2: 2...". We see that exam treats the number of the question as its title and thus prints it twice.
In this case I want it reduced to "Question 2...", but at the same time I want to keep the behaviour for titled questions.
I have tried to compare the macros with an if statement:
\if\thequestiontitle\thequestion ...
but this approach seems too simple and I couldn't get it to work anyway. My MWE attached:
\documentclass[addpoints]{exam}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\questions}
{\def\@currentlabel{\thequestiontitle}}
{\def\@currentlabel{\thequestion}}
{}
{}
\makeatother
\qformat{Question~\thequestion:~\thequestiontitle\dotfill (\thepoints)}
\begin{document}
\begin{questions}
\titledquestion{Wood}[15]
How much wood would a woodchuck chuck if a woodchuck could chuck
wood?
\question[10] Here the problem turns up!
\end{questions}
\gradetable[v][questions]
\end{document}
\titledquestion, but with an empty title. It seems to me that the only problem is that both\questionand\titledquestionuse the same\qformat. – John Kormylo Nov 19 '23 at 14:36