From 87c74b3292e1c3efc4427ae0536a1d30a0dc8e4b Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 1 Feb 2021 03:00:47 +0000 Subject: CTAN sync 202102010300 --- .../contrib/xsim/examples/xsim.listofexercises.tex | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 macros/latex/contrib/xsim/examples/xsim.listofexercises.tex (limited to 'macros/latex/contrib/xsim/examples/xsim.listofexercises.tex') diff --git a/macros/latex/contrib/xsim/examples/xsim.listofexercises.tex b/macros/latex/contrib/xsim/examples/xsim.listofexercises.tex new file mode 100644 index 0000000000..c2a9a3fe36 --- /dev/null +++ b/macros/latex/contrib/xsim/examples/xsim.listofexercises.tex @@ -0,0 +1,81 @@ +% https://tex.stackexchange.com/q/94766/ +\documentclass[a4paper,10pt]{book} +\usepackage[utf8]{inputenc} + +\usepackage{xsim} +\xsimsetup{ + exercise/within=chapter, + exercise/template=theorem , + exercise/the-counter=\thechapter.\arabic{exercise} +} + +\DeclareExerciseEnvironmentTemplate{theorem} + {% + \par\addvspace{\baselineskip} + \noindent + \XSIMexpandcode{\noexpand\label{\ExerciseType:\ExerciseID}} + \Large\textbf{% + \space\GetExerciseProperty{counter}% + \GetExercisePropertyT{subtitle}{ (\PropertyValue)}% + } \normalsize\itshape + } + {\par\addvspace{\baselineskip}} + +\usepackage{multicol} + +\newcommand\listofexercises{ + \chapter*{List of Exercises} + \def\CurrentExerciseChapter{}% + \ForEachPrintedExerciseByType{ + \global\let\LastExerciseChapter\CurrentExerciseChapter + \xdef\CurrentExerciseChapter{\ExercisePropertyGet{##1}{##2}{chapter}}% + \XSIMifeqF{\LastExerciseChapter}{\CurrentExerciseChapter} + { + \XSIMifblankF{\LastExerciseChapter}{\end{multicols}} + \begin{multicols}{2}% + [\contentsline{chapter}{Chapter \CurrentExerciseChapter}{}{}] + } + \contentsline + {section} + {% + Exercise \ExercisePropertyGet{##1}{##2}{counter}% + \XSIMifblankF{##4}{ (##4)}% + } + {\pageref{##1:##2}}{}% + } + \end{multicols} +} + +% \usepackage{hyperref} +% \newcommand\theHexercise{\thechapter.\arabic{exercise}} + +\begin{document} + +\chapter{kinetic} +\begin{exercise} + 435-1 +\end{exercise} +\begin{exercise}[subtitle=Foo Bar] + 435-2 +\end{exercise} +\begin{exercise} + 435-3 +\end{exercise} + +\chapter{momentum} +\begin{exercise} + 436-1 +\end{exercise} +\begin{exercise} + 436-2 +\end{exercise} +\begin{exercise} + 436-3 +\end{exercise} +\begin{exercise} + 436-4 +\end{exercise} + +\listofexercises + +\end{document} -- cgit v1.2.3