summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/xsim/examples/xsim.different-point-types.tex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-02-01 03:00:47 +0000
committerNorbert Preining <norbert@preining.info>2021-02-01 03:00:47 +0000
commit87c74b3292e1c3efc4427ae0536a1d30a0dc8e4b (patch)
tree219447f0cb875a4889a8cac2bea6deb012b7ca7b /macros/latex/contrib/xsim/examples/xsim.different-point-types.tex
parent8eab566745f1c61319c17e6a1aeea0f18bcfc34c (diff)
CTAN sync 202102010300
Diffstat (limited to 'macros/latex/contrib/xsim/examples/xsim.different-point-types.tex')
-rw-r--r--macros/latex/contrib/xsim/examples/xsim.different-point-types.tex52
1 files changed, 52 insertions, 0 deletions
diff --git a/macros/latex/contrib/xsim/examples/xsim.different-point-types.tex b/macros/latex/contrib/xsim/examples/xsim.different-point-types.tex
new file mode 100644
index 0000000000..0ac3536776
--- /dev/null
+++ b/macros/latex/contrib/xsim/examples/xsim.different-point-types.tex
@@ -0,0 +1,52 @@
+\documentclass{article}
+\usepackage{xsim}
+
+\DeclareExerciseGoal{A}
+\DeclareExerciseGoal{C}
+\DeclareExerciseGoal{E}
+
+\newcommand*\printA{\TotalExerciseGoal{A}{~A~point}{~A~points}}
+\newcommand*\printC{\TotalExerciseGoal{C}{~C~point}{~C~points}}
+\newcommand*\printE{\TotalExerciseGoal{E}{~E~point}{~E~points}}
+
+\usepackage{needspace}
+\DeclareExerciseEnvironmentTemplate{custom}
+ {%
+ \par\vspace{\baselineskip}
+ \Needspace*{2\baselineskip}
+ \noindent
+ \textbf{\GetExerciseProperty{counter}}%
+ \IfExercisePropertySetT{subtitle}
+ { \textit{\GetExerciseProperty{subtitle}}} %
+ \IfInsideSolutionF{%
+ \marginpar{%
+ (\IfExercisePropertySetTF{E}{\GetExerciseProperty{E}}{0}/%
+ \IfExercisePropertySetTF{C}{\GetExerciseProperty{C}}{0}/%
+ \IfExercisePropertySetTF{A}{\GetExerciseProperty{A}}{0})%
+ }%
+ }%
+ }
+ {}
+\xsimsetup{
+ exercise/template = custom ,
+ solution/template = custom
+}
+\renewcommand*\theexercise{\arabic{exercise}.}
+
+\begin{document}
+
+Reachable: \printA, \printC, and \printE.
+
+\begin{exercise}[E=1]
+ Differentiate $y=3x^2+5x+3$.
+\end{exercise}
+
+\begin{exercise}[E=2,C=1]
+ Find the equation of the tangent line to the function $y=x/2$ at $x=2$.
+\end{exercise}
+
+\begin{exercise}[C=1,A=2]
+ Prove that the derivative of a constant is zero.
+\end{exercise}
+
+\end{document}