summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/xsim/doc/examples/xsim.texsx-13635.tex
blob: 3b52ce46b24f027b1b0ad92aaba161467319db82 (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
68
69
70
% https://tex.stackexchange.com/q/13635/
\documentclass{article}
\usepackage{xsim}

\DeclareExerciseEnvironmentTemplate{theorem:remark}
  {
    \par\addvspace{\baselineskip}
    \noindent
    \textit{%
      \IfInsideSolutionF{\XSIMmixedcase{\GetExerciseName}~}%
      \GetExerciseProperty{counter}}%
    \GetExercisePropertyT{subtitle}{ \textup{(#1)}}%
    . %
  }
  {\par\addvspace{\baselineskip}}

\DeclareExerciseHeadingTemplate{exercises}{\subsection*{Exercises}}

\xsimsetup{
  exercise/template = theorem:remark ,
  exercise/within = section ,
  exercise/the-counter = \thesection.\arabic{exercise} ,
  print-collection/headings = true ,
  print-collection/headings-template = exercises
}

\DeclareExerciseCollection{prime numbers}
\DeclareExerciseCollection{Zeta function}

\begin{document}

\collectexercises{prime numbers}
\section{Prime Numbers}

A \emph{prime number} is a positive integer other than $1$ that is only
divisible by $1$ and itself.

\begin{exercise}[subtitle=Euclid's Theorem]
  \label{ex:euclid}
  Show that there are infinitely many prime numbers.
\end{exercise}

As you will show in Exercise \ref{ex:euclid}, there are infinitely many
primes.  The number of primes that are smaller than a given natural number $n$
is denoted $\pi(n)$.

\begin{exercise}
  Find an asymptotic formula for $\pi(n)$. \emph{Hint:} You might find
  Exercise \ref{ex:zeta} helpful.
\end{exercise}
\collectexercisesstop{prime numbers}

\printcollection{prime numbers}

\collectexercises{Zeta function}
\section{Zeta function}

The zeta function is given by $\zeta(s) = \sum_{n=1}^\infty n^{-s}$, where $s$
is a complex number with real part bigger than $1$.
\begin{exercise}\label{ex:zeta}
  Extend $\zeta$ as far as possible and find all zeros
  of the function.
\end{exercise}
For example $\zeta(2) = \frac{\pi^2}{6}$.

\collectexercisesstop{Zeta function}

\printcollection{Zeta function}

\end{document}