Document Classesexam | Total Points in Margin

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
Knuffi
Posts: 25
Joined: Fri Oct 10, 2008 1:27 pm

exam | Total Points in Margin

Post by Knuffi »

Is there a way to get the total points of the exam (\numpoints) at the end of the exam in the right margin like the points of each question (\pointsinrightmargin)? I just want to sum up at the end and do not need a point table.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Knuffi
Posts: 25
Joined: Fri Oct 10, 2008 1:27 pm

exam | Total Points in Margin

Post by Knuffi »

I wrote a mail to the author of the class and Philip Hirschhorn replied in the following way:
Try putting the following into the preamble (i.e., after the \documentclass command and before \begin{document}):

Code: Select all

\makeatletter
\def\dropnumpoints{%
  \leavevmode\unskip\nobreak\hfill
  \rlap{\hskip\rightmargin  % Defined by the list environment
        \hskip\@rightmargin % Defined by exam.cls
        \hskip-\rightpointsmargin
        \llap{(\numpoints)}%
  }% rlap
  \par
}% dropnumpoints
\makeatother
You can then say \dropnumpoints and it will put \numpoints in the right margin, in the same place the points land when you're using \pointsinrightmargin.

If you want it formatted some way other than \numpoints just change the line

Code: Select all

\llap{(\numpoints)}%
to be

Code: Select all

\llap{whatever}%
In case you're curious: That definition of \dropnumpoints is a simple modification of the definition of \droptotalpoints in "exam.cls".
Thanks to Philip Hirschhorn 8-)
Post Reply