summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/xsim/examples/xsim.crossref.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/xsim/examples/xsim.crossref.tex')
-rw-r--r--Master/texmf-dist/doc/latex/xsim/examples/xsim.crossref.tex60
1 files changed, 60 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.crossref.tex b/Master/texmf-dist/doc/latex/xsim/examples/xsim.crossref.tex
new file mode 100644
index 00000000000..fa2fbbb509d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.crossref.tex
@@ -0,0 +1,60 @@
+\documentclass{article}
+\usepackage{xsim,lipsum,hyperref}
+
+\DeclareExerciseHeadingTemplate{custom}
+ {\section{\XSIMtranslate{default-heading}}}
+
+\DeclareExerciseEnvironmentTemplate{custom}
+ {%
+ \IfInsideSolutionTF
+ {\label{sol:\ExerciseID}}
+ {\label{ex:\ExerciseID}}
+ \subsection*
+ {%
+ \XSIMmixedcase{\GetExerciseName}%
+ \IfInsideSolutionTF
+ {
+ to \GetExerciseParameter{exercise-name}%
+ ~\GetExerciseProperty{counter}%
+ }
+ {%
+ ~\GetExerciseProperty{counter}
+ \GetExercisePropertyT{subtitle}
+ { {\normalfont\itshape\PropertyValue}}%
+ }%
+ }
+ \noindent\llap{%
+ \footnotesize\sffamily
+ \IfInsideSolutionTF
+ {%
+ \XSIMmixedcase{\GetExerciseParameter{exercise-name}}
+ on page~\pageref{ex:\ExerciseID}.%
+ }
+ {%
+ \XSIMmixedcase{\GetExerciseParameter{solution-name}}
+ on page~\pageref{sol:\ExerciseID}.%
+ }%
+ \hspace*{\marginparsep}%
+ }%
+ }
+ {}
+\xsimsetup{
+ exercise/template = custom ,
+ solution/template = custom ,
+ print-solutions/headings-template = custom
+}
+
+\begin{document}
+
+\section{Exercises}
+\begin{exercise}
+ \lipsum[4]
+\end{exercise}
+\begin{solution}
+ \lipsum[4]
+\end{solution}
+
+\clearpage
+\printsolutions
+
+\end{document}