![LaTeX xsim:仅打印偶数/奇数答案](https://linux22.com/image/446180/LaTeX%20xsim%EF%BC%9A%E4%BB%85%E6%89%93%E5%8D%B0%E5%81%B6%E6%95%B0%2F%E5%A5%87%E6%95%B0%E7%AD%94%E6%A1%88.png)
我正在为我的学生编写练习表,我想使用 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}