| 1 |
% http://texwelt.de/wissen/fragen/6698/ |
| 2 |
\documentclass{article} |
| 3 |
\usepackage[ngerman]{babel} |
| 4 |
|
| 5 |
\usepackage{needspace} |
| 6 |
\usepackage{xsim} |
| 7 |
\xsimsetup{ |
| 8 |
exercise/name = Aufgabe , |
| 9 |
solution/name = Lösung , |
| 10 |
exercise/within = section , |
| 11 |
exercise/the-counter = \thesection.\arabic{exercise} , |
| 12 |
exercise/template = mine |
| 13 |
} |
| 14 |
|
| 15 |
\newif\iflist |
| 16 |
|
| 17 |
\DeclareExerciseEnvironmentTemplate{mine}{ |
| 18 |
\par\vspace{\baselineskip} |
| 19 |
\Needspace*{3\baselineskip} |
| 20 |
\noindent |
| 21 |
\textbf{\GetExerciseName~\GetExerciseProperty{counter}}% |
| 22 |
\GetExercisePropertyT{subtitle}{\quad\textit{#1}}% |
| 23 |
\iflist |
| 24 |
\GetExercisePropertyT{page}{ (Seite~#1)}% |
| 25 |
\fi |
| 26 |
% not necessary if you don't use points: |
| 27 |
\GetExercisePropertyT{points}{% |
| 28 |
\marginpar{% |
| 29 |
\PropertyValue |
| 30 |
\GetExercisePropertyT{bonus-points}{+\PropertyValue}% |
| 31 |
\,\XSIMtranslate{points-abbr}% |
| 32 |
}% |
| 33 |
}% |
| 34 |
\par\noindent |
| 35 |
} |
| 36 |
{} |
| 37 |
|
| 38 |
\usepackage{multicol} |
| 39 |
|
| 40 |
\begin{document} |
| 41 |
|
| 42 |
\section{Erstes Kapitel} |
| 43 |
\begin{exercise} |
| 44 |
Eine erste Aufgabe |
| 45 |
\end{exercise} |
| 46 |
\begin{exercise} |
| 47 |
Eine zweite Aufgabe |
| 48 |
\end{exercise} |
| 49 |
|
| 50 |
\subsection{Erstes Unterkapitel} |
| 51 |
\begin{exercise} |
| 52 |
Eine Aufgabe in einem Unterkapitel |
| 53 |
\end{exercise} |
| 54 |
\begin{exercise} |
| 55 |
Noch eine Aufgabe in einem Unterkapitel |
| 56 |
\end{exercise} |
| 57 |
|
| 58 |
\subsubsection{Tiefer geschachteltes Unterkapitel} |
| 59 |
\begin{exercise} |
| 60 |
Noch eine Aufgabe |
| 61 |
\end{exercise} |
| 62 |
|
| 63 |
\subsubsection{Weiter geschachtelt} |
| 64 |
\begin{exercise} |
| 65 |
Eine weitere Aufgabe |
| 66 |
\end{exercise} |
| 67 |
|
| 68 |
\subsection{Zweites Unterkapitel} |
| 69 |
\begin{exercise} |
| 70 |
Und eine weitere Aufgabe |
| 71 |
\end{exercise} |
| 72 |
|
| 73 |
\clearpage |
| 74 |
|
| 75 |
\section{Zweites Kapitel} |
| 76 |
\begin{exercise} |
| 77 |
Eine Aufgabe in einem anderen Kapitel |
| 78 |
\end{exercise} |
| 79 |
|
| 80 |
\begin{multicols}{2}[\section{Aufgabenübersicht}] |
| 81 |
\listtrue |
| 82 |
\printcollection{all exercises} |
| 83 |
\end{multicols} |
| 84 |
|
| 85 |
\end{document} |