我正在为我的学生编写练习表,我想使用 LaTeX xsim 仅打印奇数(或偶数)练习的答案。我在 Google 上搜索并查看了 xsim 手册,但找不到任何内容。那么有没有一种简单的方法可以用 xsim 仅打印奇数答案?
谢谢,祝你有个愉快的一天 Nicolas Leduc
答案1
只是一次尝试:
\documentclass{article}
\usepackage{xsim}
\xsimsetup{
exercise/within=section,
}
\begin{document}
\section{title}
\begin{exercise}
first exercise
\end{exercise}
\begin{solution}
first solution
\end{solution}
\begin{exercise}
second exercise
\end{exercise}
\begin{solution}
second solution
\end{solution}
\begin{exercise}
third exercise
\end{exercise}
\begin{solution}
third solution
\end{solution}
\section{title}
\begin{exercise}
first exercise
\end{exercise}
\begin{solution}
first solution
\end{solution}
\begin{exercise}
second exercise
\end{exercise}
\begin{solution}
second solution
\end{solution}
\begin{exercise}
third exercise
\end{exercise}
\begin{solution}
third solution
\end{solution}
\ForEachUsedExerciseByID{%
\ifodd\GetExerciseProperty{counter-value}\relax
\XSIMprint{solution}{#1}{#2}%
\fi
}
\end{document}