Debian Codegraph @

texmf-dist/doc/latex/xsim/examples/xsim.texsx-199360.tex

raw
1 % http://tex.stackexchange.com/a/199360/
2 \documentclass{scrartcl}
3 \usepackage[clear-aux]{xsim}
4
5 \usepackage{tcolorbox,blindtext}
6
7 \DeclareExerciseEnvironmentTemplate{custom}
8 {%
9 \begin{tcolorbox}[
10 width = \textwidth ,
11 colbacktitle = \IfInsideSolutionTF{green}{red} ,
12 coltitle = black ,
13 title = {\XSIMmixedcase{\GetExerciseName}~\GetExerciseProperty{counter}}]}
14 {\end{tcolorbox}}
15
16 \xsimsetup{
17 exercise/template = custom ,
18 solution/template = custom
19 }
20
21 \begin{document}
22
23 \begin{exercise}
24 First Question
25 \end{exercise}
26 \begin{solution}
27 Yes, it's a question
28 \end{solution}
29
30 \begin{exercise}[print=false,use]
31 Question: What is special about Brontosaurs?
32 \end{exercise}
33 \begin{solution}
34 They are thin at one end, thick in the middle and thin on the end again
35 \end{solution}
36
37 \begin{exercise}
38 Proof
39 \begin{equation}
40 a^2 + b^2 = c^2
41 \end{equation}
42 \end{exercise}
43 \begin{solution}
44 to be done
45 \end{solution}
46
47 \begin{exercise}
48 Cite a Latin Text
49 \end{exercise}
50 \begin{solution}
51 \textcolor{blue}{\blindtext}
52 \end{solution}
53
54 \begin{exercise}
55 \textcolor{red}{\textbf{Cite a Latin text again}}
56 \end{exercise}
57
58 \printsolutions*
59
60 \end{document}