summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/xsim/doc/examples/xsim.texsx-305110.tex
blob: c10928da0ce332425f4f6ee7ab4cb94ea51bd72d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
% https://tex.stackexchange.com/q/305110
\documentclass[12pt, a4paper]{book}
\usepackage{xsim}

\xsimsetup{
  exercise/within = section ,
  exercise/the-counter = \thesection.\arabic{exercise}
}

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

\section{Section}

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

\section{Section}

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

\chapter{Topic 2}

\section{Section}
\begin{exercise}
  I'm an excercise.
\end{exercise}
\begin{solution}
  I'm a solution.
\end{solution}

\section{Section}
\begin{exercise}
  I'm an excercise.
\end{exercise}
\begin{solution}
  I'm a solution.
\end{solution}

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

\chapter{Topic 1}
\section{Section}
\printsolutions[chapter=1,section=1]

\section{Section}
\printsolutions[chapter=1,section=2]

\chapter{Topic 2}
\section{Section}
\printsolutions[chapter=2,section=1]

\section{Section}
\printsolutions[chapter=2,section=2]

\end{document}