LaTeX forum ⇒ Document Classes ⇒ Total Points at Top of each Question

Information and discussion about specific document classes and how to create your own document classes.
g_theonion
Posts: 2
Joined: Thu Feb 28, 2013 6:13 am

Total Points at Top of each Question

I'm writing with the exam document class, and want it to automatically calculate the total points for questions for which there are multiple parts. Not all questions have parts, so I can "add" those up myself. Can I just type:

\question[99]Why is this question worth so many points? \question[\totalpoints]\begin{parts}\part[5]How old are you?\part[5]Why?\end{parts}

And expect to automatically get 10 at the top of the question? This seems to (maybe) be working the first time I compile the document, but then each time I edit it and recompile, the point total keeps getting bigger and bigger.
Any suggestions?

Thanks,
G
Last edited by localghost on Thu Feb 28, 2013 10:03 am, edited 2 times in total.

Tags:

alainremillard
Posts: 45
Joined: Fri Mar 16, 2012 8:22 pm
Hi

first of all, it will be a lot easier to help you if you provide a minimal working example.

Two solutions for you.

1. The add up occur because \totalpoints count all the points in the question and the questions before. To avoid this problem, simply add \noaddpoints before \question and \addpoints after.

\noaddpoints\question[\totalpoints]\addpoints

This also solve an other issue. In your code, you could not remove your first question without getting an error, with this fix you could.

2. Use the \qformat command from the exam class, see section 4.4 of the exam manual. This command allows you to customize your question style, but the text of the question will start on the next line. Here is a minimal working example, you can visualize it by clicking on "Open in writeLaTeX"
\documentclass[addpoints]{exam} \begin{document} \begin{questions} \qformat{Question \thequestion{} : \totalpoints{} \points \hfill} \question[99]Question without parts \questionQuestion with parts\begin{parts}\part[5] first part\part[5] second part\end{parts} \end{questions} \end{document}

Regards
Alain Rémillard

g_theonion
Posts: 2
Joined: Thu Feb 28, 2013 6:13 am
Thank you, the second method works well. I can have multiple-part and no-part questions in any order or combination, and get the point totals for each question automatically at the top of each question.