4

How do I globally suppress the display of points (for questions and for parts) in exam class?

I like to have the points display on the question sheet, but not on the answer (questions+solutions) sheet.

I tried \nopointsinmargin but that did not work. It only shifted the displayed points to another location.

A minimum working example:

\documentclass[answers]{exam}
%\documentclass{exam}
%\pointsinrightmargin
\nopointsinrightmargin
\begin{document}
\begin{questions}
    \question[5]
        How long is a piece of string?
        \begin{parts}
            \part[2] Define "piece".
            \begin{solution}
                A piece is \dots
            \end{solution}
            \part[3] Define string.
            \begin{solution}
                A string is \dots
            \end{solution}
    \end{parts}
    \droppoints
\end{questions}
\end{document}
1
  • 1
    Welcome to TeX.SX!! Rather than posting code fragments it is better to give a full minimal working example. Currently we have to guess what packages etc you are using and this makes it really hard to help you. A MWE should start with a \documentclass command, have a minimal preamble and then \begin{document}...\end{document}. The code should compile and be as small as possible to demonstrate your problem.
    – user30471
    Commented Sep 23, 2018 at 9:03

1 Answer 1

4

You could add

\ifprintanswers\pointformat{}\fi

to the preamble. The \pointformat macro is used to define the formatting of the printed points, by leaving it empty nothing is printed. \ifprintanswers means that \pointformat{} is only used if the answers option is added to the class options.

Complete code, using an example from the manual.

\documentclass[
% answers
]{exam}
\ifprintanswers\pointformat{}\fi
\begin{document}
\begin{questions}
\question[7] Who was the fifth Beatle? \answerline[Murray the K]
\question[5] What is the answer to the ultimate question of life, the
universe, and everything? \answerline[42]
\end{questions}
\end{document}

Without answers option:

enter image description here

With answers:

enter image description here

You must log in to answer this question.

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