我有一大堆问题和解决方案,我想从中选择一部分用于考试。我正在使用 documentclass exam。请参阅以下示例
\documentclass[12pt]{exam}
\begin{document}
\begin{questions}
\question[30] this is a question I will use in this exam
\begin{solution} solution is here \end{solution}
\question this is another question but I will not use in this exam
\begin{solution} its solution is here \end{solution}
\question[20] yet another question that will be used in this exam
\begin{solution} yet another solution is here \end{solution}
\question this is another question it will not be in the exam
\begin{solution} its solution is here \end{solution}
\end{document}
答案1
很可能会有更多的这是一种高效的方式,但最近当我必须选择问题的子集时,我习惯于newcommand
创建一个hide
命令。请注意,这将要如果您有大量问题,则会很耗时。
\documentclass[12pt]{exam}
\newcommand{\hide}[1]{}
\begin{document}
\begin{questions}
\question[30] this is a question I will use in this exam
\begin{solution} solution is here \end{solution}
% Hide the next question
\hide{%
\question this is another question but I will not use in this exam
\begin{solution} its solution is here \end{solution}
}
\question[20] yet another question that will be used in this exam
\begin{solution} yet another solution is here \end{solution}
% Hide the next question
\hide{
\question this is another question it will not be in the exam
\begin{solution} its solution is here \end{solution}
}
\end{questions}
\end{document}
你必须经历手动来决定要显示哪些问题。
边注:当我这样做时,我的问题相当大(很长的问题主干和多个子部分)。因此,我将每个问题放在一个单独的 tex 文件中,并给它们赋予较长的描述性名称,例如 q_car_accelerating_around_a_corner.tex
然后,在主文件中,我可以指定我想在考试中包含哪些问题。例如,我可以指定\include{q_car_accelerating_around_a_corner.tex}
它将出现在我的考试中。请注意,我希望在我的考试中有分页符 - 如果你没有,那么你可能会想要input
。更多详细信息可以在这里找到:
何时应使用 \input 和 \include?