blob: beca1910055c5d9d16d5450bd8f1fe02229101fa (
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
|
\documentclass{article}
\usepackage{xsim}
\DeclareExerciseCollection{foo-easy}
\DeclareExerciseCollection{foo-medium}
\DeclareExerciseTagging{difficulty}
\usepackage{filecontents,lipsum}
\begin{filecontents*}{foo.tex}
\begin{exercise}[difficulty=easy,points=1]
foo one \lipsum[4]
\end{exercise}
\begin{solution}
foo one \lipsum[4]
\end{solution}
\begin{exercise}[difficulty=medium,points=1]
foo two \lipsum[4]
\end{exercise}
\begin{solution}
foo two \lipsum[4]
\end{solution}
\begin{exercise}[difficulty=easy,points=1]
foo three \lipsum[4]
\end{exercise}
\begin{solution}
foo three \lipsum[4]
\end{solution}
\end{filecontents*}
\begin{document}
\begin{exercise}
outside before
\end{exercise}
\collectexercises{foo-easy}
\xsimsetup{difficulty=easy}
\input{foo.tex}
\collectexercisesstop{foo-easy}
% collection `foo-easy' now contains all exercises of file `foo.tex' tagged
% with `difficulty=easy'
\collectexercises{foo-medium}
\xsimsetup{difficulty=medium}
\input{foo.tex}
\collectexercisesstop{foo-medium}
% collection `foo-medium' now contains all exercises of file `foo.tex'
% tagged with `difficulty=medium'
\section{Easy}
\printcollection{foo-easy}
\section{Medium}
\printcollection{foo-medium}
\printsolutions[difficulty=medium]
\section{All Exercises and Their Solutions Again, in Order of Appearance}
\printcollection[print=both]{all exercises}
\end{document}
|