6

I'm using the exam package to create a mathematics question paper. When printing answers, the \correctchoice command makes the choice letter as well as the text in the choice bold. However, it does not make any mathematic expressions bold.

Is there a way to add this to the document? I think the commands \boldmath and \unboldmath when put around the text will make both normal text and mathematic expressions bold, but I do not know how to "merge" it with the \correctchoice command.

doncherry
  • 54,637

3 Answers3

8

You already seem to have answers that will work, but the exam class provides a hook for customizing the correct choices. If you give the command:

\CorrectChoiceEmphasis{\bfseries\boldmath}

then you'll get what you want. The default behavior was created with the command here:

\CorrectChoiceEmphasis{\bfseries}
Bobyandbob
  • 4,899
7

The best solution would be to use \correctchoice as a hook and tack \boldmath and \unboldmath onto it that way using a formula of \edef and \expandafters that I've yet to grasp/memorize. See How to add a hook to a macro.

In absence of hooking, I would say

\renewcommand{\choiceshook}{%
  \ifprintanswers
    \let\oldchoice\choice
    \let\oldcorrectchoice\correctchoice
    \def\choice{\unboldmath\oldchoice}
    \def\correctchoice{\oldcorrectchoice\boldmath}
  \fi}

\noprintanswers:
enter image description here

\printanswers:
enter image description here

Sean Allred
  • 27,421
0

Reading the answers to this question I was able to do it.

Adding

\newcommand{\MyCorrectChoice}[1]{%
   \ifprintanswers
      \CorrectChoice \boldmath#1\unboldmath%
   \else
      \CorrectChoice #1%
   \fi
}

to the preamble fixed my problem.