exsheets: How to print solutions to a very specific section?

I write some questions and answers with the exsheets package. I want to print the solution of a specific section, e.g. the solutions from section 2 of chapter 2.

What doesn't work

• \printsolutions[section={2}]: this command prints the solutions of every section 2 in the document (e.g. section 2 of chapter 1 and section 2 of chapter 2)
• to label the section with \exlabel{sec:mysection} and print the solutions with \printsolutions[section={-\S{sec:mysection}}] which will print all solutions from questions up to and including the labeled section

MWE:

\documentclass[12pt, a4paper]{book}
\usepackage{exsheets}
\SetupExSheets{
counter-within=section,
counter-format=ch.se.qu[1]
}

\begin{document}
\part{EXCERCISES}
\chapter{Topic 1}

\section{Section}

\begin{question}
I'm an excercise.
\end{question}
\begin{solution}
I'm an solution.
\end{solution}

\section{Section}

\begin{question}
I'm an excercise.
\end{question}
\begin{solution}
I'm an solution.
\end{solution}

\chapter{Topic 2}

\section{Section}\exlabel{sec:sectionone}
\begin{question}
I'm an excercise.
\end{question}
\begin{solution}
I'm an solution.
\end{solution}

\section{Section}\exlabel{sec:sectiontwo}
\begin{question}
I'm an excercise.
\end{question}
\begin{solution}
I'm an solution.
\end{solution}

\setcounter{chapter}{0}
\part{SOLUTIONS}

\chapter{Topic 1}

\section{Section}
\printsolutions[section={1}] % there should be only the solution to 1.1.1

\section{Section}
\printsolutions[section={2}] % there should be only the solution to 1.2.1

\chapter{Topic 2}

\section{Section}
\printsolutions[section={-\S{sec:sectionone}}] % there should be only the solution to 2.1.1

\section{Section}
\printsolutions[section={-\S{sec:sectiontwo}}] % there should be only the solution to 2.2.1

\end{document}


EDIT: There is a workaround

To get the desired result you can use [ID=1] to give questions an ID and \printsolutions[byID={1}] to print the solution.

MWE:

\documentclass[12pt, a4paper]{book}
\usepackage{exsheets}
\SetupExSheets{
counter-within=section,
counter-format=ch.se.qu[1]
}

\begin{document}
\part{EXCERCISES}
\chapter{Topic 1}

\section{Section}

\begin{question}[ID=111]
I'm an excercise.
\end{question}
\begin{solution}
I'm an solution.
\end{solution}

\section{Section}

\begin{question}[ID=121]
I'm an excercise.
\end{question}
\begin{solution}
I'm an solution.
\end{solution}

\chapter{Topic 2}

\section{Section}
\begin{question}[ID=211]
I'm an excercise.
\end{question}
\begin{solution}
I'm an solution.
\end{solution}

\section{Section}
\begin{question}[ID=221]
I'm an excercise.
\end{question}
\begin{solution}
I'm an solution.
\end{solution}

\setcounter{chapter}{0}
\part{SOLUTIONS}

\chapter{Topic 1}

\section{Section}
\printsolutions[byID={111}]

\section{Section}
\printsolutions[byID={121}]

\chapter{Topic 2}

\section{Section}
\printsolutions[byID={211}]

\section{Section}
\printsolutions[byID={221}]

\end{document}


PS: I hope there'll be a feature soon, Clemens ;)

• I asked the same question a year ago and got no answer/comment so the question got deleted in the meantime. At least now you got a comment :) I solved the issue by eliminating the need to do the printing per section but a quick solution I came up with before that was to continue section numbering across chapters. With that solution your MWE would look like this: pasted.co/5b29e5df – alwaysask Apr 19 '16 at 11:22
• Just posted a feature request on BitBucket. – Sr. Schneider Apr 19 '16 at 11:28
• I'll try to come up with something (maybe tomorrow) but I won't promise anything. – clemens Apr 19 '16 at 11:36
• @Sr.Schneider BTW: I haven't forgotten: bitbucket.org/cgnieder/exsheets/issues/34 – clemens May 11 '16 at 12:20
• The news is this: exsheets itself is not going to be updated any more but I nearly finished its successor package xsim which supports this: \printsolutions[chapter=2,section=3] – clemens Mar 29 '17 at 10:40