我正在使用该类exam
,并想更改\fillin
命令,使其产生虚线而不是实线。因此,我将命令定义复制并粘贴到我的序言中,并在适当的位置替换,如下所示\dotfill
:\hrule
\documentclass{exam}
\makeatletter
\def\@fillin@relay[#1]{%
% The first argument is in \fillin@ans, the second is #1.
\leavevmode
\ifprintanswers
\rlap{\raise -\answerclearance \hbox to #1{\hrulefill}}%
\begingroup
\setbox0 \hbox{\color@begingroup
\CorrectChoice@Emphasis \fillin@ans \color@endgroup}%
\ifdim\wd0 > #1\relax
\hbox{\CorrectChoice@Emphasis \fillin@ans}%
\else
\hbox to #1{\CorrectChoice@Emphasis \hfil \fillin@ans \hfil}%
\fi
\endgroup
\else
\raise -\answerclearance \hbox to #1{\dotfill}%
\fi
}% @fillin@relay
\makeatother
\begin{document}
\begin{questions}
\question Because I was so tired I \fillin on the bed. (lay/laid)
\end{questions}
\end{document}
这可行,但我真的需要将所有这些内容都添加到序言中吗,或者有没有更好/更有效的方法来做到这一点?
答案1
你可以做类似的事情
\documentclass{exam}
\newcommand\dotfillin{{\let\hrulefill\dotfill\fillin}}
\begin{document}
\begin{questions}
\question Because I was so tired I \dotfillin\ on the bed. (lay/laid)
\end{questions}
\end{document}