我希望在每章末尾有一个部分,仅提供奇数问题的解决方案。
答案1
如果你只想\printsolution[section]
打印奇数问题的解决方案,你可以添加
\usepackage{exsheets}[2016/01/26]% make sure you have v0.21 available
\ExplSyntaxOn
\cs_set_protected:Npn \__exsheets_print_solutions_section:nnn #1#2#3
{
\exsheets_print_solutions_if:nnn
{
\int_if_odd_p:n { \l_exsheets_counter_qu_int } &&
\int_compare_p:n { \l__exsheets_counter_sec_int = #3 }
}
{#1}
{#2}
}
\ExplSyntaxOff
到您的文档。但由于这重新定义了内部函数,因此并不完全安全。
\documentclass[twocolumn]{article}
\usepackage{exsheets}[2016/01/26]
\ExplSyntaxOn
\cs_set_protected:Npn \__exsheets_print_solutions_section:nnn #1#2#3
{
\exsheets_print_solutions_if:nnn
{
\int_if_odd_p:n { \l_exsheets_counter_qu_int } &&
\int_compare_p:n { \l__exsheets_counter_sec_int = #3 }
}
{#1}
{#2}
}
\ExplSyntaxOff
\begin{document}
\section{One}
\subsection{Exercises}
\begin{question}
qu one
\end{question}
\begin{solution}
sol one
\end{solution}
\begin{question}
qu two
\end{question}
\begin{solution}
sol two
\end{solution}
\begin{question}
qu three
\end{question}
\begin{solution}
sol three
\end{solution}
\begin{question}
qu four
\end{question}
\begin{solution}
sol four
\end{solution}
\begin{question}
qu five
\end{question}
\begin{solution}
sol five
\end{solution}
\subsection{Solutions}
\printsolutions[section]
\newpage
\section{Two}
\subsection{Exercises}
\begin{question}
qu one
\end{question}
\begin{solution}
sol one
\end{solution}
\begin{question}
qu two
\end{question}
\begin{solution}
sol two
\end{solution}
\begin{question}
qu three
\end{question}
\begin{solution}
sol three
\end{solution}
\begin{question}
qu four
\end{question}
\begin{solution}
sol four
\end{solution}
\begin{question}
qu five
\end{question}
\begin{solution}
sol five
\end{solution}
\subsection{Solutions}
\printsolutions[section]
\end{document}