LaTeX forum ⇒ Document ClassesTotal 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

Postby g_theonion » Thu Feb 28, 2013 6:23 am

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:

  1. \question[99]
  2. Why is this question worth so many points?
  3.  
  4. \question[\totalpoints]
  5. \begin{parts}
  6. \part[5]
  7. How old are you?
  8. \part[5]
  9. Why?
  10. \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

Postby alainremillard » Thu Feb 28, 2013 6:57 pm

Hi

first of all, it will be a lot easier to help you if you provide a Infominimal 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.

    1. \noaddpoints
    2. \question[\totalpoints]
    3. \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 Infominimal working example, you can visualize it by clicking on "Open in writeLaTeX"
    1. \documentclass[addpoints]{exam}
    2.  
    3. \begin{document}
    4.  
    5. \begin{questions}
    6.  
    7. \qformat{Question \thequestion{} : \totalpoints{} \points \hfill}
    8.  
    9. \question[99]
    10. Question without parts
    11.  
    12. \question
    13. Question with parts
    14. \begin{parts}
    15. \part[5] first part
    16. \part[5] second part
    17. \end{parts}
    18.  
    19. \end{questions}
    20.  
    21. \end{document}


Regards
Alain Rémillard

g_theonion
Posts: 2
Joined: Thu Feb 28, 2013 6:13 am

Postby g_theonion » Thu Feb 28, 2013 8:31 pm

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.


Return to “Document Classes”

Who is online

Users browsing this forum: No registered users and 3 guests