如何替换答题线上的文字
根据考试类别手册;我可以使用下面提到的 tex 添加 MCQ 的答案行
\begin{questions}
\question
Who’s buried in Grant’s tomb?
\answerline
\question
What was the color of George Washington’s white horse?
\answerline
\question
Which is heavier: A pound of feathers, or a pound of lead?
\answerline
\end{questions}
输出结果为
我正在寻找更新选项
您能否建议如何实现这一目标?
答案1
您可以重新定义\answerline
:
\documentclass{exam}
\makeatletter
\renewcommand\answerline[1][{}]{%
% One optional argument, the default value of which is empty.
\ifx\@queslevel\ques@ref
\let\ans@l=\questionlabel
\else
\ifx\@queslevel\part@ref
\let\ans@l=\partlabel
\else
\ifx\@queslevel\subpart@ref
\let\ans@l=\subpartlabel
\else
\ifx\@queslevel\subsubpart@ref
\let\ans@l=\subsubpartlabel
\else
% Oops; no question level defined.
% We must be outide of the questions environment.
% Just leave out the label, I guess:
\def\ans@l{}%
\fi
\fi
\fi
\fi
\par \nobreak \vskip \answerskip
\hfill Answer)~%
\ifprintanswers
%\ans@l~
\hbox to 0pt{\hbox to \answerlinelength{\hrulefill}\hss}%
\raise \answerclearance\hbox to \answerlinelength{%
\CorrectChoice@Emphasis \hfil #1\hss}%
\else
%\ans@l~
\hbox to \answerlinelength{\hrulefill}%
\fi
\par
}% answerline
\makeatother
\begin{document}
\begin{questions}
\question
Who’s buried in Grant’s tomb?
\answerline
\question
What was the color of George Washington’s white horse?
\answerline[mmm]
\question
Which is heavier: A pound of feathers, or a pound of lead?
\answerline
\end{questions}
\end{document}
答案2
通过加载额外的包(xpatch
),您可以快速修补现有的\answerline
宏。
\documentclass{exam}
\def\NewAnswerLabel{Answer)}
\usepackage{xpatch}% http://ctan.org/pkg/etoolbox
\xpatchcmd{\answerline}% <cmd>
{\questionlabel}% <search>
{\NewAnswerLabel}% <replace>
{}{}% <success><failure>
\begin{document}
\begin{questions}
\question
Who’s buried in Grant’s tomb?
\answerline
\question
What was the color of George Washington’s white horse?
\answerline
\question
Which is heavier: A pound of feathers, or a pound of lead?
\answerline
\end{questions}
\end{document}
\answerline
我从以下问题/答案中了解并修补了它: