考试课堂上如何圈出正确答案?

考试课堂上如何圈出正确答案?

我曾尝试使用以下代码:

\documentclass[12pt]{exam}
\CorrectChoiceEmphasis{\mbox{}}
\begin{document}
\begin{questions}
\question Who is an idot? 
\begin{choices}
\choice Not the writer of this post
\CorrectChoiceEmphasis The writter of this post
\end{choices}
\end{questions}
\end{document}

答案1

以下是几种方法:

代码:

\documentclass[12pt]{exam}
\newcommand{\mycorrectchoice}[1]{\CorrectChoice \fbox{#1}}

\usepackage{tikz}
\usetikzlibrary{calc,shapes}

\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}

\newcommand{\DrawSmartBox}[1][red]{%
    \tikz[overlay,remember picture]{
    \draw[#1]
      ($(bl)+(-1.75em,1em)$) rectangle
      ($(br)+(0.2em,-0.4em)$);}
}

% \MyCorrectSmartChoice:
% #1 optional argument: aspect customization
% #2 mandatory argument: the answer
\newcommand{\MyCorrectSmartChoice}[2][black]{\CorrectChoice \tikzmark{bl}#2\tikzmark{br}\DrawSmartBox[#1]}

\begin{document}
\begin{questions}
\question Who is an idot? 
\begin{choices}
\choice Not the writer of this post
\mycorrectchoice{The writter of this post}
\choice Who read this post
\end{choices}
\question Who is an idot? 
\begin{choices}
\choice Not the writer of this post
\MyCorrectSmartChoice[thick,rounded corners,red]{The writter of this post}
\choice Who read this post
\end{choices}
\end{questions}

\end{document}

结果:

在此处输入图片描述

请注意,由于宏的原因,示例需要两次编译运行\tikzmark;此外,这种方法允许自定义框的外观,就像示例中那样。

答案2

这是 Claudio 答案的修改版。通过此修改,如果您不使用answers考试类的选项(正确答案未加框),您可以将考试交给您的学生,结果是:

在此处输入图片描述

如果answers使用该选项(语法是

\documentclass[answers]{exam}

)则正确答案会被框起来。结果是:

在此处输入图片描述

代码如下

\documentclass[12pt]{exam} %Use the answers option to box correct answers

\usepackage{tikz}
\usetikzlibrary{calc,shapes}

\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}

\newcommand{\DrawSmartBox}[1][red]{%
    \tikz[overlay,remember picture]{
    \draw[#1]
      ($(bl)+(-1.75em,1em)$) rectangle
      ($(br)+(0.2em,-0.4em)$);}
}

%Here is the modification
\ifprintanswers
% \MyCorrectSmartChoice:
% #1 optional argument: aspect customization
% #2 mandatory argument: the answer
\newcommand{\MyCorrectSmartChoice}[2][black]{\CorrectChoice \tikzmark{bl}#2\tikzmark{br}\DrawSmartBox[#1]}
\else
\newcommand{\MyCorrectSmartChoice}[2][black]{\CorrectChoice #1}
\fi

\begin{document}
\begin{questions}
\question Who is an idiot? 
\begin{choices}
\choice Not the writer of this post
\MyCorrectSmartChoice[thick,rounded corners,red]{The writer of this post}
\choice Who read this post
\end{choices}
\end{questions}

\end{document}

相关内容