Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
    
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? –  Scribblemacher May 4 '12 at 14:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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