
設定
私の 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 質問の横に、理由を添えた短い 1 行の解決策を追加することです。この解決策は次のようになります。
- 背景が陰影になっている
- 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}