在 MWE 中:
\documentclass{article}
\usepackage{exsheets}
\SetupExSheets{counter-format=}
\begin{document}
\begin{question}[name=Answer the following in one sentence]
\begin{enumerate}
\item Who is the President?
\item Who is the Prime minister?
\item \includequestions[random=2]{classA}
\end{enumerate}
\end{question}
\end{document}
classA.tex 的内容为:
\begin{input}
\begin{question}
Who is the Defence Minister?
\end{question}
\begin{question}
Who is the Home Minister?
\end{question}
\begin{question}
Who is the Finance Minister?
\end{question}
\begin{question}
Who is the External Affairs Minister?
\end{question}
\end{input}
编译后的样子如下:
问题围绕第3条展开,题意重复,计数器不前进。
我该如何克服这个问题?那么,它会随机选择问题并将问题编号 3 和 4 分配给它们吗?
如果 exsheets 不能做到这一点,还有其他包可以做到这一点吗?
答案1
我认为不能得到令人满意的解决方案,exsheets
但它的后继者可以xsim
– 诀窍是定义另一种仅用于子问题的练习类型。
\documentclass{article}
\usepackage{xsim}
\DeclareExerciseType{subquestion}{
exercise-env = question ,
solution-env = answer ,
exercise-name = Question ,
solution-name = Answer ,
exercise-template = item ,
solution-template = item
}
\DeclareExerciseProperty{title}
\DeclareExerciseEnvironmentTemplate{named}
{\subsection*{\GetExercisePropertyTF{title}{#1}{??}}}
{}
\DeclareExerciseEnvironmentTemplate{item}
{\item}
{}
\xsimsetup{
exercise/template = named
}
\DeclareExerciseCollection{exercise-pool}
\begin{filecontents*}{\jobname-exercises.tex}
\begin{question}
Who is the Defence Minister?
\end{question}
\begin{question}
Who is the Home Minister?
\end{question}
\begin{question}
Who is the Finance Minister?
\end{question}
\begin{question}
Who is the External Affairs Minister?
\end{question}
\end{filecontents*}
\begin{document}
\collectexercises{exercise-pool}
\input{\jobname-exercises.tex}
\collectexercisesstop{exercise-pool}
\begin{exercise}[title=Answer the following in one sentence:]
\begin{enumerate}
\item Who is the President?
\item Who is the Prime Minister?
\printrandomexercises[collection=exercise-pool]{2}
\end{enumerate}
\end{exercise}
\end{document}
PS:代码需要xsim
v0.10,在撰写本文时(2017-09-18 14:57 CEST)尚不可用,但正在向 CTAN(和流行的发行版)迈进。