我最初的问题是找到一个解决方案,让我能够收集考试文档类中的所有答案并将它们打印在文档末尾。我找到了这个解决方案点击,几乎完美地满足了我的需求,但是,有一件事我不喜欢:
我不想要解决方案周围的方框!我试图找到哪个命令实际上导致打印该方框,但是,作为刚开始使用 LaTeX 的人,我什么也没找到。
如果有人能指导我找到解决方案,我将不胜感激:)
提前致谢!
下面,我从上面链接的线程中指出了整个代码,以方便您使用:):
\documentclass[a4paper]{exam}
\usepackage{xparse}
\printanswers
\ExplSyntaxOn
% Counters are not reset on \end{parts} so I add code to reset them
\tl_put_right:Nn \endparts { \setcounter{partno}{0} }
\tl_put_right:Nn \endsubparts { \setcounter{subpart}{0} }
\tl_put_right:Nn \endsubsubparts { \setcounter{subsubpart}{0} }
\seq_new:N \l_exam_endprint_seq
\seq_new:N \l_exam_endprint_labels_seq
\tl_new:N \l__exam_endprint_temp_tl
\NewDocumentCommand \WriteAnswer { +m } {
\seq_gput_right:Nx \l_exam_endprint_labels_seq {\arabic{question}\alph{partno}\roman{subpart}\greeknum{subsubpart}} \seq_gput_right:Nn \l_exam_endprint_seq { #1 }
}
\NewDocumentCommand \EndPrintAnswers { } {
\seq_map_inline:Nn \l_exam_endprint_seq {
\seq_pop_left:NN \l_exam_endprint_labels_seq \l__exam_endprint_temp_tl
\renewcommand{\solutiontitle}{\noindent\textbf{Solution~\l__exam_endprint_temp_tl}:\enspace}
\begin{solution} ##1 \end{solution}
}
}
\ExplSyntaxOff
\begin{document}
\begin{questions}
\addpoints \question
\begin{parts}
\part This is the first part of question one.
\WriteAnswer{This is the solution to part one of question one.}
\part This is the second part of question one.
\begin{subparts}
\subpart This is the first subpart of the second part of question one.
\WriteAnswer{This is the solution to the first subpart of part two of question one.}
\subpart
\begin{subsubparts}
\subsubpart This is the first subsubpart of the second subpart of the second part of question one.
\WriteAnswer{This is the solution to the first subsubpart of the second subpart of the second part of question one.}
\end{subsubparts}
\end{subparts}
\part This is the third part of question one
\WriteAnswer{This is the solution to part three of question one.}
\end{parts}
\addpoints \question This is the second question.
\WriteAnswer{This is the solution to question two.}
\end{questions}
\EndPrintAnswers
\end{document}
答案1
欢迎来到TeX.SE...
标签\unframedsolutions
可以起到作用,并且MWE
是:
\documentclass[a4paper]{exam}
\usepackage{xparse}
\printanswers
\unframedsolutions
\ExplSyntaxOn
% Counters are not reset on \end{parts} so I add code to reset them
\tl_put_right:Nn \endparts { \setcounter{partno}{0} }
\tl_put_right:Nn \endsubparts { \setcounter{subpart}{0} }
\tl_put_right:Nn \endsubsubparts { \setcounter{subsubpart}{0} }
\seq_new:N \l_exam_endprint_seq
\seq_new:N \l_exam_endprint_labels_seq
\tl_new:N \l__exam_endprint_temp_tl
\NewDocumentCommand \WriteAnswer { +m } {
\seq_gput_right:Nx \l_exam_endprint_labels_seq {\arabic{question}\alph{partno}\roman{subpart}\greeknum{subsubpart}} \seq_gput_right:Nn \l_exam_endprint_seq { #1 }
}
\NewDocumentCommand \EndPrintAnswers { } {
\seq_map_inline:Nn \l_exam_endprint_seq {
\seq_pop_left:NN \l_exam_endprint_labels_seq \l__exam_endprint_temp_tl
\renewcommand{\solutiontitle}{\noindent\textbf{Solution~\l__exam_endprint_temp_tl}:\enspace}
\begin{solution} ##1 \end{solution}
}
}
\ExplSyntaxOff
\begin{document}
\begin{questions}
\addpoints \question
\begin{parts}
\part This is the first part of question one.
\WriteAnswer{This is the solution to part one of question one.}
\part This is the second part of question one.
\begin{subparts}
\subpart This is the first subpart of the second part of question one.
\WriteAnswer{This is the solution to the first subpart of part two of question one.}
\subpart
\begin{subsubparts}
\subsubpart This is the first subsubpart of the second subpart of the second part of question one.
\WriteAnswer{This is the solution to the first subsubpart of the second subpart of the second part of question one.}
\end{subsubparts}
\end{subparts}
\part This is the third part of question one
\WriteAnswer{This is the solution to part three of question one.}
\end{parts}
\addpoints \question This is the second question.
\WriteAnswer{This is the solution to question two.}
\end{questions}
\EndPrintAnswers
\end{document}