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