6

How do I adjust the vertical space between the question titles and the text of the questions in the exam-class.

\documentclass{exam}

\qformat{\large\textbf{Question \thequestion}\hfill}

\begin{document}
\begin{questions}
    \question
    Some text
\end{questions}
\end{document}

I've tried adding some \vspace to the end of the argument of \qformat but that doesn't work. I can't figure out what controls the spacing.

2 Answers 2

8

The format provided with the qformat marco is injected in a horizontal box; that's why \vspace is not working.

To add vertical space after the question, one option is to add depth to the box, for instance with:

\qformat{
    \large\textbf{Question \thequestion}
    \hfill
    \vrule depth 1em width 0pt % Large depth to make space
} 
0

You could patch the macro responsible for issuing \item, adding \\*[<length>] at the end of it, with \mbox{} in order to make LaTeX think that some text actually follows.

\documentclass{exam}
\usepackage{xpatch}

\usepackage{lipsum}

\qformat{\textbf{\large Question \thequestion}\hfill}

\makeatletter
\xapptocmd{\item@points@pageinfo}
  {\mbox{}\\*[2ex]}% <---- use the length you prefer
  {}{}
\makeatother

\begin{document}

\begin{questions}

\question \lipsum[2]

\end{questions}

\end{document}

enter image description here

You must log in to answer this question.

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