summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/xsim/examples/xsim.difficulties.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/xsim/examples/xsim.difficulties.tex')
-rw-r--r--macros/latex/contrib/xsim/examples/xsim.difficulties.tex53
1 files changed, 53 insertions, 0 deletions
diff --git a/macros/latex/contrib/xsim/examples/xsim.difficulties.tex b/macros/latex/contrib/xsim/examples/xsim.difficulties.tex
new file mode 100644
index 0000000000..02712f15d6
--- /dev/null
+++ b/macros/latex/contrib/xsim/examples/xsim.difficulties.tex
@@ -0,0 +1,53 @@
+\documentclass{article}
+
+\usepackage[clear-aux]{xsim}
+\DeclareExerciseTagging{difficulty}
+\xsimsetup{
+ difficulty={easy,hard}
+}
+
+\DeclareExerciseEnvironmentTemplate{custom}
+ {
+ \subsection*
+ {%
+ \XSIMmixedcase {\GetExerciseName}\nobreakspace
+ \GetExerciseProperty{counter}%
+ \IfExercisePropertySetT{difficulty}
+ { {\normalfont(\GetExerciseProperty{difficulty})}}%
+ \IfInsideSolutionF{%
+ \IfExercisePropertySetT{subtitle}
+ { {\normalfont\itshape\GetExerciseProperty{subtitle}}}%
+ }%
+ }%
+ \IfExercisePropertySetT{points}
+ {%
+ \marginpar
+ {%
+ \IfInsideSolutionF{\rule{1.2cm}{1pt}\slash}%
+ \GetExerciseProperty{points}%
+ \IfExercisePropertySetT{bonus-points}
+ {\nobreakspace(+\GetExerciseProperty{bonus-points})}
+ \nobreakspace\XSIMtranslate{point-abbr}%
+ }%
+ }%
+ }
+ {}
+
+\xsimsetup{exercise/template = custom}
+
+\begin{document}
+
+\begin{exercise}[difficulty=easy]
+ An easy question.
+\end{exercise}
+\begin{exercise}[difficulty=medium]
+ This one's a bit harder.
+\end{exercise}
+\begin{exercise}[difficulty=hard]
+ Now let’s see if you can solve this one.
+\end{exercise}
+\begin{exercise}[difficulty=medium]
+ This is medium but printed anyway
+\end{exercise}
+
+\end{document}