将解决方案放在 T/F 选择旁边

将解决方案放在 T/F 选择旁边

设置

我有以下 MWE:

  \documentclass[addpoints,12pt]{exam}

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

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

  \bracketedpoints
  \shadedsolutions
  \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}

这样就可以制作出一份完美的(简短)考试。现在,如果我添加选项answers- 即,将第一行更改为\documentclass[addpoints,12pt,answers]{exam}- 那么我将得到正确的 T/F 选项,以及简答题的解决方案。

问题

我还想做的是,在每个 T/F 问题旁边添加一行简短的解决方案,并附上一些理由。此解决方案将:

  • 有阴影背景
  • 与 T 和 F 选项一致
  • answers仅当给出选项时才出现

是否有捷径可寻?

答案1

我创建了\explanation,将其添加到T/F 环境的末尾oneparcheckboxes

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

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

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

  \bracketedpoints
  \shadedsolutions
  \renewcommand{\solutiontitle}{\noindent\textbf{Solution:}\par\noindent}
  \definecolor{SolutionColor}{gray}{0.8}
  \def\explanation#1{%
    \ifprintanswers\mdseries\colorbox{SolutionColor}{\strut #1}\fi}

  \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}

在此处输入图片描述

相关内容