diff options
Diffstat (limited to 'macros/latex/contrib/ximera/src/hints.dtx')
-rw-r--r-- | macros/latex/contrib/ximera/src/hints.dtx | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/macros/latex/contrib/ximera/src/hints.dtx b/macros/latex/contrib/ximera/src/hints.dtx new file mode 100644 index 0000000000..b777bd8235 --- /dev/null +++ b/macros/latex/contrib/ximera/src/hints.dtx @@ -0,0 +1,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} |