Debian Codegraph @

texmf-dist/doc/latex/ximera/src/hints.dtx

raw
1 % \subsubsection{Hints}
2 % \DescribeEnv{hint}{Hint environments can be embedded inside problems.}
3 % \begin{macrocode}
4 %<*classXimera>
5 % \end{macrocode}
6 % Create a counter that will track how deeply nested the current hint is
7 % \begin{macrocode}
8 \newcounter{hintLevel}
9 \setcounter{hintLevel}{0}
10 % \end{macrocode}
11 % Create an empty shell to renew
12 % \begin{macrocode}
13 \newenvironment{hint}{}{}
14 % \end{macrocode}
15 % Now we renew the environment as needed, this should allow support
16 % for any transition code that treats some parts as a "handout" and
17 % some parts as non-handout. renewing the environment on the fly is a
18 % bit hacky.
19 % \begin{macrocode}
20 \renewenvironment{hint}
21 {
22 \ifhandout
23 \setbox0\vbox\bgroup
24 \else
25 \begin{trivlist}\item[\hskip \labelsep\small\slshape\bfseries Hint:\hspace{2ex}]
26 \small\slshape
27 \fi
28 % \end{macrocode}
29 % Step up hint level to track the nested level of the hint. This will be used for problem numbering.
30 % \begin{macrocode}
31 \stepcounter{hintLevel}
32 }
33 {
34 \ifhandout
35 \egroup\ignorespacesafterend
36 \else
37 \end{trivlist}
38 \fi
39 % \end{macrocode}
40 % Detract from hint level counter to track hint nested level
41 % \begin{macrocode}
42 \addtocounter{hintLevel}{-1}
43 }
44
45 \ifhints
46 \renewenvironment{hint}{
47 \begin{trivlist}\item[\hskip \labelsep\small\slshape\bfseries Hint:\hspace{2ex}]
48 \small\slshape}
49 {\end{trivlist}}
50 \fi
51
52 %</classXimera>
53 % \end{macrocode}