[Tex/LaTex] How to change the numbering style of question parts in the exam class

examnumbering

How can I change the numbering style of question parts in the exam class? Currently, I have

1.
 (a)
 (b)

but I would prefer

1.
 (1.1)
 (1.2)

I have already tried

\renewcommand{\thepartno}{\thecurrentpartno.\arabic{partno}}

but this results in

1.
 (.1)
 (.2)

What should I do?

Best Answer

I have read the manual examdoc.pdf and the source code exam.cls which can be found in LaTeX2e distribution. The increment 1, 2, 3, ... is actually done by the question counter. And the increment a, b, c, ... is done by the partno counter. It can be found in the source code that \partlabel is defined to be (\alpha{partno}). Thus, we can redefine it as in the code below:

\documentclass{exam}
\renewcommand\partlabel{(\thequestion.\arabic{partno})}
\begin{document}
    \begin{questions}
    \question
    \begin{parts}
        \part first
        \part second
    \end{parts}
    \end{questions}
\end{document}