7

I'm using the exam class and I would like to write questions like this:

1. True False  This statement is false.

2. True False  This statement is true.  It's a long, though, so it 
               goes on to the second line.

Then the students can circle "True" or "False" depending on their mood, etc. Note the indentation for the second question. I would probably also put "True" and "False" in bold, with suitable spacing before, after, and between them.

I can see how to use \qformat to make it look like this:

1.  True False  
  This statement is false.

2.  True False  
  This statement is true.  It's a long, though, so it 
  goes on to the second line.

but then it's a little harder to distinguish the answer choices from the question.

I could also use the oneparchoices environment, but that doesn't handle the indentation, and it also would insert "A. True B. False", which I don't think looks good.

2 Answers 2

10

You could try something like this (feel free to make the necessary adjustments):

\documentclass{exam}

\newcommand*\TrueFalse{\bfseries True\hspace*{10pt}False\hspace*{10pt}}
\newlength\mylena
\newlength\mylenb
\settowidth\mylena{\TrueFalse}
\newcommand\MyQ[1]{%
  \setlength\mylenb{\linewidth}
  \addtolength\mylenb{-\mylena}
  \parbox[t]{\mylena}{\TrueFalse}\parbox[t]{\mylenb}{#1}}

\begin{document}

\begin{questions}
\question\MyQ{text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.}
\question\MyQ{How much wood would a woodchuck chuck if a woodchuck could chuck
wood?}
\question\MyQ{Compute $\displaystyle\int_0^1 x^2 \, dx$.}
\end{questions}

\end{document}
4
  • Lovely, but when I test it, \mylenb seems to be wrong. You can correct it by moving the computation of \mylenb inside the definition of \MyQ, so that it will start with the correct value of \linewidth. Commented Mar 10, 2011 at 0:23
  • @Phil: (Hi, Phil!) So inside the definition of \MyQ, I think I should put \setlength{\mylenb}{\linewidth} and then \addtolength{\mylenb}{-\mylena}. This is not quite what Gonzalo has: I changed the first "addtolength" to "setlength". Commented Mar 10, 2011 at 0:47
  • @John: {Hi John! I didn't notice this was from you until after I'd answered.} Anyway: Yes, or else the later questions would look pretty funny... Commented Mar 10, 2011 at 1:18
  • @Phil: You are right. I've edited the code to reflect your suggestion. Commented Mar 10, 2011 at 1:20
4

I think Gonzalo's answer is lovely, and I almost saw no reason to suggest an alternative, but if (1) You don't want to have to type the \MyQ and enclose the question in brackets, and (2) You're willing to have all of your questions be formatted in this way, you can also do the following:

\renewcommand{\questionshook}{%
  \settowidth{\leftmargin}{10.\hskip\labelsep\TrueFalse\hskip\labelsep}%
  \labelwidth\leftmargin\advance\labelwidth-\labelsep
  \renewcommand\questionlabel{\thequestion.\hskip\labelsep\TrueFalse}
}
\newcommand*\TrueFalse{\bfseries True\hspace*{10pt}False\hspace*{10pt}}

(Note that I used Gonzalo's definition of \TrueFalse here.) Of course, this changes the formatting of all of the questions, which may not be what you want.

This site is temporarily in read-only mode and not accepting new answers.

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