我想在 xsim 中使用标签级别 (1,2,3),但不仅仅是以排他的方式,而是作为多个标签,以便练习可以具有标签级别 1 和 2。这样,以后收集我的 .tex 的所有 2 级练习或 1 级练习时,我将在两个章节中遇到相同的问题。(我想在后面的章节中再次提出一些基本问题以供修订。)
唯一的可能性是,我创建标签 1、标签 2 和标签 3?或者是否可以这样写
\begin{exercise}[level=1,level=2]
如果我现在这样做,1 就会被 2 覆盖,因此它只会打印在第 2 章中。
梅威瑟:
\documentclass{article}
\usepackage{xsim}
\DeclareExerciseCollection{foo-easy}
\DeclareExerciseCollection{foo-medium}
\DeclareExerciseTagging{level}
\usepackage{filecontents,lipsum}
\begin{filecontents*}{foo.tex}
\begin{exercise}[level=1]
foo one \lipsum[4]
\end{exercise}
\begin{solution}
foo one \lipsum[4]
\end{solution}
\begin{exercise}[level=2]
foo two \lipsum[4]
\end{exercise}
\begin{solution}
foo two \lipsum[4]
\end{solution}
\begin{exercise}[level=1]
foo three \lipsum[4]
\end{exercise}
\begin{solution}
foo three \lipsum[4]
\end{solution}
\end{filecontents*}
\begin{document}
\collectexercises{foo-easy}
\xsimsetup{level=1}
\input{foo.tex}
\collectexercisesstop{foo-easy}
% collection `foo-easy' now contains all exercises of file `foo.tex' tagged
% with `level=1' but only if I don't add a 'level=2' as suggested above
\collectexercises{foo-medium}
\xsimsetup{level=2}
\input{foo.tex}
\collectexercisesstop{foo-medium}
% collection `foo-medium' now contains all exercises of file `foo.tex'
% tagged with `level=2' and only those, but I would like to add certain level 1 exercises as well
\section{Easy}
\printcollection{foo-easy}
\section{Medium}
\printcollection{foo-medium}
\end{document}