7

I'm using the exam class in a multicols environment to create a series of worksheets. Many questions are yes/no. If the question is too long, it wraps to the next line and moves the answers. Is there a way to "anchor" the answer yes/no checkboxes to always appear right aligned on the first line and wrap the text of the question appropriately?

Below is the way I can currently formatting yes/no questions. A solution would not hopefully not require the way questions are currently written to be changed since there are quite a few legacy documents. Also, a solution can't modify every question, because not every question is yes/no.

\documentclass{exam}
\usepackage{multicol}
\newcommand\YesNo{%
\hfill\mbox{\begin{oneparcheckboxes}
    \choice Yes
    \choice No
\end{oneparcheckboxes}}}

\begin{document}
\begin{multicols}{2}
\begin{questions}
\question This question is short\YesNo
\question This question is longer, and will probably wrap to the next line\YesNo

... % lots of questions go here

\end{questions}
\end{multicols}
\end{document}

Currently looks like... enter image description here

Should look like... enter image description here

1 Answer 1

3

Would using top-aligned \parboxes work?

enter image description here

\documentclass{exam}
\usepackage{multicol}% http://ctan.org/pkg/multicol
\newcommand\YesNo{%
\hfill\mbox{\begin{oneparcheckboxes}
    \choice Yes
    \choice No
\end{oneparcheckboxes}}}

\begin{document}
\begin{multicols}{2}
\begin{questions}
\question This question is short\YesNo
\question \parbox[t]{0.5\linewidth}{This question is longer, and will probably wrap to the next line}\YesNo
\question This question is short\YesNo
\question \parbox[t]{0.5\linewidth}{This question is longer, and will probably wrap to the next line}\YesNo
\question This question is short\YesNo
\question \parbox[t]{0.5\linewidth}{This question is longer, and will probably wrap to the next line}\YesNo
\question This question is short\YesNo
\question \parbox[t]{0.5\linewidth}{This question is longer, and will probably wrap to the next line}\YesNo
\question This question is short\YesNo
\question \parbox[t]{0.5\linewidth}{This question is longer, and will probably wrap to the next line}\YesNo
\question This question is short\YesNo
\question \parbox[t]{0.5\linewidth}{This question is longer, and will probably wrap to the next line}\YesNo
\question This question is short\YesNo
\question \parbox[t]{0.5\linewidth}{This question is longer, and will probably wrap to the next line}\YesNo
\question This question is short\YesNo
\question \parbox[t]{0.5\linewidth}{This question is longer, and will probably wrap to the next line}\YesNo
\question This question is short\YesNo
\question \parbox[t]{0.5\linewidth}{This question is longer, and will probably wrap to the next line}\YesNo
\question This question is short\YesNo
\question \parbox[t]{0.5\linewidth}{This question is longer, and will probably wrap to the next line}\YesNo
\end{questions}
\end{multicols}
\end{document}

The choice of \parbox width (0.5\linewidth) may be varied depending on the multiple choice style.

1
  • 1
    This does work, but can be a little tedious. This might be wishful thinking, but is there any way to bind this behavior to the \yesno macro so that existing documents would not need to be modified? May 4, 2012 at 14:53

You must log in to answer this question.

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