Debian Codegraph @

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

raw
1 % https://tex.stackexchange.com/q/13635/
2 \documentclass{article}
3 \usepackage{xsim}
4
5 \DeclareExerciseEnvironmentTemplate{theorem:remark}
6 {
7 \par\addvspace{\baselineskip}
8 \noindent
9 \textit{%
10 \IfInsideSolutionF{\XSIMmixedcase{\GetExerciseName}~}%
11 \GetExerciseProperty{counter}}%
12 \GetExercisePropertyT{subtitle}{ \textup{(#1)}}%
13 . %
14 }
15 {\par\addvspace{\baselineskip}}
16
17 \DeclareExerciseHeadingTemplate{exercises}{\subsection*{Exercises}}
18
19 \xsimsetup{
20 exercise/template = theorem:remark ,
21 exercise/within = section ,
22 exercise/the-counter = \thesection.\arabic{exercise} ,
23 print-collection/headings = true ,
24 print-collection/headings-template = exercises
25 }
26
27 \DeclareExerciseCollection{prime numbers}
28 \DeclareExerciseCollection{Zeta function}
29
30 \xsimsetup{collect}
31
32 \begin{document}
33
34 \collectexercises{prime numbers}
35 \section{Prime Numbers}
36
37 A \emph{prime number} is a positive integer other than $1$ that is only
38 divisible by $1$ and itself.
39
40 \begin{exercise}[subtitle=Euclid's Theorem]
41 \label{ex:euclid}
42 Show that there are infinitely many prime numbers.
43 \end{exercise}
44
45 As you will show in Exercise \ref{ex:euclid}, there are infinitely many
46 primes. The number of primes that are smaller than a given natural number $n$
47 is denoted $\pi(n)$.
48
49 \begin{exercise}
50 Find an asymptotic formula for $\pi(n)$. \emph{Hint:} You might find
51 Exercise \ref{ex:zeta} helpful.
52 \end{exercise}
53 \collectexercisesstop{prime numbers}
54
55 \printcollection{prime numbers}
56
57 \collectexercises{Zeta function}
58 \section{Zeta function}
59
60 The zeta function is given by $\zeta(s) = \sum_{n=1}^\infty n^{-s}$, where $s$
61 is a complex number with real part bigger than $1$.
62 \begin{exercise}\label{ex:zeta}
63 Extend $\zeta$ as far as possible and find all zeros
64 of the function.
65 \end{exercise}
66 For example $\zeta(2) = \frac{\pi^2}{6}$.
67
68 \collectexercisesstop{Zeta function}
69
70 \printcollection{Zeta function}
71
72 \end{document}