9

I would like to calculate the total marks of the questions, parts, and subparts based on their children's.

\documentclass[addpoints,answers,10pt]{exam}

\marksnotpoints
\marginpointname{ marks}
\pointformat{(\themarginpoints)\hspace{2mm}}
\pointsinmargin

\begin{document}
\begin{questions}
    \question[7] marks should be calculated here
    \begin{parts}
        \part[2] ...
        \part[5] marks should be calculated here
        \begin{subparts}
            \subpart[2] ....
            \subpart[3] marks should be calculated here
            \begin{subsubparts}
                \subsubpart[1] f
                \subsubpart[2] k
            \end{subsubparts}
        \end{subparts}
    \end{parts}
\end{questions}
\end{document}

enter image description here


After being able to calculate the question total marks, I would like to redesign the question label to include the calculated marks and be like

Question (1) [7 Marks]

while left-aligning it with the question body without going through the left margin.

1
  • 2
    I'm afraid this can't be done with the exam class. The class only supports points calculation on the question level, not on sub-levels Sep 20, 2018 at 9:47

1 Answer 1

2

Here is a solution combining examples from section 4.4 of "Using the exam document class" by Philip Hirschhorn. It seems like calculating marks on the level of a part is not easily possible with the exam class.

\documentclass[addpoints,answers,10pt]{exam}

\marksnotpoints
\marginpointname{ marks}
\pointformat{(\themarginpoints)\hspace{2mm}}
\pointsinmargin

\qformat{\textbf{Question \thequestion}\quad (\totalpoints{} marks)\hfill}

\begin{document}
\begin{questions}
    \question marks should be calculated here
    \begin{parts}
        \part[2] ...
        \part marks should be calculated here
        \begin{subparts}
            \subpart[2] ....
            \subpart marks should be calculated here
            \begin{subsubparts}
                \subsubpart[1] f
                \subsubpart[2] k
            \end{subsubparts}
        \end{subparts}
    \end{parts}
\end{questions}
\end{document}

Screenshot of output

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .