| 1 |
% https://tex.stackexchange.com/q/305110 |
| 2 |
\documentclass[12pt, a4paper]{book} |
| 3 |
\usepackage{xsim} |
| 4 |
|
| 5 |
\xsimsetup{ |
| 6 |
exercise/within = section , |
| 7 |
exercise/the-counter = \thesection.\arabic{exercise} |
| 8 |
} |
| 9 |
|
| 10 |
\begin{document} |
| 11 |
\part{EXCERCISES} |
| 12 |
\chapter{Topic 1} |
| 13 |
|
| 14 |
\section{Section} |
| 15 |
|
| 16 |
\begin{exercise} |
| 17 |
I'm an excercise. |
| 18 |
\end{exercise} |
| 19 |
\begin{solution} |
| 20 |
I'm a solution. |
| 21 |
\end{solution} |
| 22 |
|
| 23 |
\section{Section} |
| 24 |
|
| 25 |
\begin{exercise} |
| 26 |
I'm an excercise. |
| 27 |
\end{exercise} |
| 28 |
\begin{solution} |
| 29 |
I'm a solution. |
| 30 |
\end{solution} |
| 31 |
|
| 32 |
\chapter{Topic 2} |
| 33 |
|
| 34 |
\section{Section} |
| 35 |
\begin{exercise} |
| 36 |
I'm an excercise. |
| 37 |
\end{exercise} |
| 38 |
\begin{solution} |
| 39 |
I'm a solution. |
| 40 |
\end{solution} |
| 41 |
|
| 42 |
\section{Section} |
| 43 |
\begin{exercise} |
| 44 |
I'm an excercise. |
| 45 |
\end{exercise} |
| 46 |
\begin{solution} |
| 47 |
I'm a solution. |
| 48 |
\end{solution} |
| 49 |
|
| 50 |
\setcounter{chapter}{0} |
| 51 |
\part{SOLUTIONS} |
| 52 |
|
| 53 |
\chapter{Topic 1} |
| 54 |
\section{Section} |
| 55 |
\printsolutions[chapter=1,section=1] |
| 56 |
|
| 57 |
\section{Section} |
| 58 |
\printsolutions[chapter=1,section=2] |
| 59 |
|
| 60 |
\chapter{Topic 2} |
| 61 |
\section{Section} |
| 62 |
\printsolutions[chapter=2,section=1] |
| 63 |
|
| 64 |
\section{Section} |
| 65 |
\printsolutions[chapter=2,section=2] |
| 66 |
|
| 67 |
\end{document} |