I'm using the exsheets package to write exercises and solutions in a textbook. My purpose is to list some exercises at the end of each section followed by their corresponding solutions, as intended in the following MWE:
\documentclass[12pt,a4paper]{book}
\usepackage{exsheets}
\begin{document}
\chapter{Chapter A}
\section{Section A}\exlabel{sec:AA}
\subsection{Subsection A}
\subsection*{Exercises}
\begin{question}
Question 1.
\end{question}
\begin{solution}
Answer 1.
\end{solution}
\subsection*{Solutions}
\printsolutions[section=\S{sec:AA}]
\chapter{Chapter B}
\section{Section A}\exlabel{sec:BA}
\subsection{Subsection A}
\subsection*{Exercises}
\begin{question}
Question 2.
\end{question}
\begin{solution}
Answer 2.
\end{solution}
\subsection*{Solutions}
\printsolutions[section=\S{sec:BA}]
Solution 1 shouldn't appear twice!
\end{document}
My Problem is, that the solutions of the previous sections (with the same number of the current section) reappear after a new chapter. That means especially for the MWE: Solution 1 is printed both in chapter A section A and in chapter B section A. How can I avoid this? Do I miss something? Reading the Documentation didn't help.
Remarks: I use exlabel
because of hyperref in my original document. Also, I could easly use my own environments instead of exsheets. But I want to be flexible, if I decide to print all solutions at the end of my document.