Debian Codegraph @

texmf-dist/doc/latex/xsim/examples/xsim.different-point-types.tex

raw
1 \documentclass{article}
2 \usepackage{xsim}
3
4 \DeclareExerciseGoal{A}
5 \DeclareExerciseGoal{C}
6 \DeclareExerciseGoal{E}
7
8 \newcommand*\printA{\TotalExerciseGoal{A}{~A~point}{~A~points}}
9 \newcommand*\printC{\TotalExerciseGoal{C}{~C~point}{~C~points}}
10 \newcommand*\printE{\TotalExerciseGoal{E}{~E~point}{~E~points}}
11
12 \usepackage{needspace}
13 \DeclareExerciseEnvironmentTemplate{custom}
14 {%
15 \par\vspace{\baselineskip}
16 \Needspace*{2\baselineskip}
17 \noindent
18 \textbf{\GetExerciseProperty{counter}}%
19 \IfExercisePropertySetT{subtitle}
20 { \textit{\GetExerciseProperty{subtitle}}} %
21 \IfInsideSolutionF{%
22 \marginpar{%
23 (\IfExercisePropertySetTF{E}{\GetExerciseProperty{E}}{0}/%
24 \IfExercisePropertySetTF{C}{\GetExerciseProperty{C}}{0}/%
25 \IfExercisePropertySetTF{A}{\GetExerciseProperty{A}}{0})%
26 }%
27 }%
28 }
29 {}
30 \xsimsetup{
31 exercise/template = custom ,
32 solution/template = custom
33 }
34 \renewcommand*\theexercise{\arabic{exercise}.}
35
36 \begin{document}
37
38 Reachable: \printA, \printC, and \printE.
39
40 \begin{exercise}[E=1]
41 Differentiate $y=3x^2+5x+3$.
42 \end{exercise}
43
44 \begin{exercise}[E=2,C=1]
45 Find the equation of the tangent line to the function $y=x/2$ at $x=2$.
46 \end{exercise}
47
48 \begin{exercise}[C=1,A=2]
49 Prove that the derivative of a constant is zero.
50 \end{exercise}
51
52 \end{document}