8

I am creating a set of problems, with the bonus problems starred with an *, but when I use \bonusqformat to customize the mark, it pushes the text onto a new line. Is there any way to prevent this from happening?

MWE

\documentclass{exam}

\bonusqformat{\thequestion *.}
\begin{document}
\begin{questions}
\bonusquestion This is a question.

\end{questions}
\end{document}

MWE

  • This is the default behavior of exam. The question title (typeset according to \qformat or \bonusqformat) is on a line by itself and the question text is below it. – egreg Jan 17 '13 at 12:47
  • I understand this is the default behaviour, I'm more looking for a way to overcome it, whilst still having the starred questions. – Nathanael Farley Jan 17 '13 at 13:22
  • Thanks for pointing that out @egreg, prompted me to look elsewhere for the answer! Posted it below. – Nathanael Farley Jan 17 '13 at 13:33
6

Turns out that because of the default behaviour of \bonusqformat (pointed out by egreg), it is easier to achieve this effect by the following code in the preamble:

\newcommand\bonusquestionlabel{\thequestion{}*.}
\makeatletter
\def\question@number{%
  \if@bonus
    \if@bonusqformat
      \makebox[\hsize][s]{\@bonusquestionformat}\hskip-\labelsep
    \else
      \bonusquestionlabel
    \fi
  \else
    \if@qformat
      \makebox[\hsize][s]{\@questionformat}\hskip-\labelsep
    \else
      \questionlabel
    \fi
  \fi
}
\makeatother

This code redefines the question label for bonus questions and makes a new label for them.

Result from the MWE with the extra code in the preamble MWE working!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.