# Putting solutions next to T/F choices

Setup

I have the following MWE:

  \documentclass[addpoints,12pt]{exam}

\usepackage{color}
\usepackage{amsmath}
\usepackage{amssymb}

\checkboxchar{$\Box$}
\checkedchar{$\blacksquare$}

\bracketedpoints
\renewcommand{\solutiontitle}{\noindent\textbf{Solution:}\par\noindent}

\begin{document}

\textbf{\textsc{True/False:}  [1pt each]}
\vspace{0.1in}
\begin{questions}

\question Every normal distribution has a bell-shaped graph.

\begin{oneparcheckboxes}
\correctchoice T
\choice F
\end{oneparcheckboxes}

\question If $X$ is a binomial random variable, then $X$ is approx. normal.

\begin{oneparcheckboxes}
\choice T
\correctchoice F
\end{oneparcheckboxes}

\question Why did the chicken cross the road?
\begin{solution}[1.0in]
To get to the other side!
\end{solution}

\end{questions}
\end{document}


Which produces a perfectly fine (short) exam. Now if I add the answers option - that is, change the first line to \documentclass[addpoints,12pt,answers]{exam} - then I will get the correct T/F choices bubbled in, and a solution for the short answer question.

Question

What I'd like to also do is add a short one-line solution next to each T/F question, with some reasoning. This solution would:

• have shaded background
• be on the same line as the T and F choices
• only be present when the answers option is given

Is there an easy way to do this?

I created \explanation, to be added at the end of the T/F oneparcheckboxes environment.

  \documentclass[addpoints,12pt,answers]{exam}

\usepackage{color}
\usepackage{amsmath}
\usepackage{amssymb}

\checkboxchar{$\Box$}
\checkedchar{$\blacksquare$}

\bracketedpoints
\renewcommand{\solutiontitle}{\noindent\textbf{Solution:}\par\noindent}
\definecolor{SolutionColor}{gray}{0.8}
\def\explanation#1{%

\begin{document}

\textbf{\textsc{True/False:}  [1pt each]}
\vspace{0.1in}
\begin{questions}

\question Every normal distribution has a bell-shaped graph.

\begin{oneparcheckboxes}
\correctchoice T
\choice F
\explanation{Explanation goes here}
\end{oneparcheckboxes}

\question If $X$ is a binomial random variable, then $X$ is approx. normal.

\begin{oneparcheckboxes}
\choice T
\correctchoice F
\explanation{Another explanation goes here}
\end{oneparcheckboxes}

\question Why did the chicken cross the road?
\begin{solution}[1.0in]
To get to the other side!
\end{solution}

\end{questions}
\end{document}


• Wow this is exactly what I had in mind! Two optional questions: (1) can I change the spacing between the "F" and the shaded box? (2) What happens if my explanation goes longer than a line? I will try this out as soon as I get home. Again, thanks! May 9, 2014 at 17:15
• Try \def\explanation#1{\ifprintanswers\mdseries\hspace{1em}\colorbox{SolutionColor}{\parbox[t]{2in}{#1}}\fi} May 9, 2014 at 17:27