summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ximera/src/outcomes.dtx
blob: 1e174b765551bf2549a2660c6f839f9070b4ea23 (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
% \subsubsection{Learning Outcomes}
% \DescribeMacro{\outcome}{Specify a learning outcome, either at the level of a |problem| or an entire document in the preamble.}
%    \begin{macrocode}
%<*classXimera>
\def\theoutcomes{}

\ifdefined\HCode%
  \newcommand{\outcome}[1]{}
\else%
  \newwrite\outcomefile
  \immediate\openout\outcomefile=\jobname.oc

  \newcommand{\outcome}[1]{\edef\theoutcomes{\theoutcomes #1~}%
  \immediate\write\outcomefile{\unexpanded{\outcome}{#1}}}
  \fi%
%</classXimera>
%    \end{macrocode}
% These can appear in either the preamble or in problem environments.
% with pdflatex, we produce the .oc file which includes ALL the
% outcomes; in the tex4ht world, we just produce spans for the
% specific outcomes.
%    \begin{macrocode}
%<*cfgXimera>
\renewcommand{\outcome}[1]{
  \Configure{@HEAD}{\HCode{<meta name="learning-outcome" content="#1"/>\Hnewline}}
}
% Sometimes there are no outcomes at all
\IfFileExists{\jobname.oc}{\input{\jobname.oc}}{}

\renewcommand{\outcome}[1]{%
  \HCode{<span class="learning-outcome">#1</span>}
}
%</cfgXimera>
%    \end{macrocode}