summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/xsim/examples/xsim.floating.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-05-19 21:12:44 +0000
committerKarl Berry <karl@freefriends.org>2017-05-19 21:12:44 +0000
commitb6a9d061f27e2822b7de379c66c030d9ea0e8fb3 (patch)
tree7a9b6e488d40920bb153db1f0e7be10f8df3935a /Master/texmf-dist/doc/latex/xsim/examples/xsim.floating.tex
parent910f589664407d620dc2a30c7b1de1a10e715df1 (diff)
xsim (19may17)
git-svn-id: svn://tug.org/texlive/trunk@44430 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/xsim/examples/xsim.floating.tex')
-rw-r--r--Master/texmf-dist/doc/latex/xsim/examples/xsim.floating.tex50
1 files changed, 50 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.floating.tex b/Master/texmf-dist/doc/latex/xsim/examples/xsim.floating.tex
new file mode 100644
index 00000000000..08448df35a6
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.floating.tex
@@ -0,0 +1,50 @@
+% floating exercises:
+\documentclass{article}
+\usepackage{xsim,newfloat,caption,lipsum}
+
+\DeclareFloatingEnvironment[
+ fileext=loe,
+ listname={List of Exercises},
+ name=Exercise,
+ placement=htp,
+]{ex}
+
+\DeclareExerciseEnvironmentTemplate{float}
+ {%
+ \ex
+ \captionsetup{labelformat=empty,singlelinecheck=false,listformat=empty}
+ \IfExercisePropertySetTF{subtitle}{%
+ \XSIMexpandcode{%
+ \noexpand\caption{%
+ \noexpand\textbf{%
+ \XSIMmixedcase{\GetExerciseName}\nobreakspace
+ \GetExerciseProperty{counter}%
+ }: \GetExerciseProperty{subtitle}%
+ }%
+ }%
+ }{%
+ \caption{%
+ \textbf{%
+ \XSIMmixedcase{\GetExerciseName}\nobreakspace
+ \GetExerciseProperty{counter}%
+ }%
+ }%
+ }%
+ }
+ {\endex}
+
+\xsimsetup{exercise/template = float}
+
+\begin{document}
+
+\listofexs
+
+\begin{exercise}
+ \lipsum[4]
+\end{exercise}
+
+\begin{exercise}[subtitle=Let's have a look]
+ \lipsum[4]
+\end{exercise}
+
+\end{document}