summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/xsim/examples/xsim.floating.tex
diff options
context:
space:
mode:
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}