I have a question (code given below) which has subparts. Part (a) is further divided into 3 parts: i, ii and iii, whereas Part (b) does not contain any subparts. The total points awarded to this question is 15 of which Part (a) carries 11 marks and Part (b) 4 marks.
There exists the macro \totalpoints
in the exam class package that gives me the 11 + 4 = 15 points for the whole question. However there is no macro to compute the number of points (marks) for Part (a) only. I would like a macro that also sums the marks for Part (a) i.e. 2 + 6 + 3 for the subparts to give 11. As the code is today, I have to manually write \part[11]
i.e. I myself must manually do the addition of 2 + 6 + 3. I would like a macro that I can just use as \part[\mymacro]
that will be equivalent to \part[11]
.
\totalpoints
should also recognise the macro so that I still get 11 + 4 = 15 as the total points for the question. The macro should perhaps just be visible to one subquestion of a whole question so that it can be used in other subquestions of other questions to count the respective sums overthere.
\documentclass[addpoints,12pt]{exam}
\begin{document}
\pointpoints{mark}{marks}
\begin{questions}
\qformat{Question: \thequestion \dotfill {\bfseries \totalpoints\ marks}}
\question
\begin{parts}
\addpoints
\boxedpoints
\part[11]
\noboxedpoints
\noaddpoints
Some background words about the first question.\\[-6.5mm]
\begin{subparts}
\subpart[2] Show that John is a boy.
\subpart[6] Show that Jane is a girl.
\subpart[3] Show that Janice is a monkey.
\end{subparts}
\vspace{5mm}
\addpoints
\boxedpoints
\part[4]
\noboxedpoints
My second question is here and it is worth 4 points. There are no subparts.
\end{parts}
\end{questions}
\end{document}
Based on the answer proposed by @John Kormylo in order for the macro to cater for half points as well, the correct output is not obtained. See output below:
We do get 9 1/2 marks as the required sum for the subpart total subtotal
. However there are three extras 1/2 inserted between Part (ii) and Part (iii). Moreover now \totalpoints
is ignoring the 1/2 marks. The aux
file is shown below:
\relax
\gdef\subtotal@i@i{9\half}
\gdef\pointsofq@i{13}
\gdef\bonuspointsofq@i{0}
\PgInfo{question@1}{1}
\PgInfo{question1@object1}{1}
\newlabel{question@1}{{1}{1}}
\PgInfo{part@1@1}{1}
\PgInfo{question1@object2}{1}
\newlabel{part@1@1}{{a}{1}}
\PgInfo{subpart@1@1@1}{1}
\PgInfo{question1@object3}{1}
\newlabel{subpart@1@1@1}{{i}{1}}
\newlabel{firstpoints@onpage@1}{{i}{1}}
\PgInfo{subpart@1@1@2}{1}
\PgInfo{question1@object4}{1}
\newlabel{subpart@1@1@2}{{ii}{1}}
\PgInfo{subpart@1@1@3}{1}
\PgInfo{question1@object5}{1}
\newlabel{subpart@1@1@3}{{iii}{1}}
\PgInfo{part@1@2}{1}
\PgInfo{question1@object6}{1}
\newlabel{part@1@2}{{b}{1}}
\gdef\exam@lastpage{1}
\gdef\exam@lastcoverpage{0}
\gdef\exam@totalpages{1}
\gdef\exam@numpoints{13}
\gdef\exam@numbonuspoints{0}
\gdef\exam@numquestions{1}
\gdef\exam@numparts{2}
\gdef\exam@numsubparts{3}
\gdef\exam@numsubsubparts{0}
\gdef\pointsonpage@i{13}
\gdef\lastpage@withpoints{1}
\gdef\lastpage@withbonuspoints{0}
Compilation is done with TeXLive 2014
using the dvi > ps > pdf
workflow.
\subtotal
command twice within the same question, it increases thetotalpoints
value. Im not sure why it does this?