# Suppress points in exam class

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}

• 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. – Andrew Sep 23 '18 at 9:03

\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[
]{exam}

Without answers option:
With answers: