diff options
author | Karl Berry <karl@freefriends.org> | 2017-09-20 22:36:23 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-09-20 22:36:23 +0000 |
commit | baaddc3c242540fcc6eef178a4576c34df84c339 (patch) | |
tree | 3dd7e8072b95be228ebfff3acb9f40f0e7823b88 /Master/texmf-dist/doc/latex/xsim/examples/xsim.listofexercises.tex | |
parent | 6fdb207f55c75b496f116c760eab2e1640de2b88 (diff) |
xsim (20sep17)
git-svn-id: svn://tug.org/texlive/trunk@45355 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/xsim/examples/xsim.listofexercises.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/xsim/examples/xsim.listofexercises.tex | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.listofexercises.tex b/Master/texmf-dist/doc/latex/xsim/examples/xsim.listofexercises.tex new file mode 100644 index 00000000000..c2a9a3fe362 --- /dev/null +++ b/Master/texmf-dist/doc/latex/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} |