summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/xsim/examples/xsim.description-list.tex
blob: f3c9ed6d74f220d4b2c1a02ccf2a7f3b69357178 (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
\documentclass{article}
\usepackage{xsim,lipsum}

\DeclareExerciseEnvironmentTemplate{item}
  {\item[\XSIMmixedcase{\GetExerciseName}~\GetExerciseProperty{counter}]}
  {}
\xsimsetup{
  exercise/template=item,
  solution/template=item,
  print-solutions/headings-template=none
}

\newenvironment{exercises}
  {\section{Exercises}\description}
  {\enddescription}

\newenvironment{solutions}
  {\section{Solutions}\description}
  {\enddescription}
  
\begin{document}

\begin{exercises}
  \begin{exercise}
    \lipsum[4]
  \end{exercise}
  \begin{solution}
    \lipsum[3]
  \end{solution}
  \begin{exercise}
    \lipsum[12]
  \end{exercise}
  \begin{solution}
    \lipsum[23]
  \end{solution}
\end{exercises}

\begin{solutions}
  \printsolutions
\end{solutions}

\end{document}