% \subsubsection{MathJax support} % When using mathjax, dump all the |\newcommand|s to a |.jax| file. % % First, create the |.jax| file. % \begin{macrocode} %<*classXimera> \ifdefined\HCode \else \newwrite\myfile \immediate\openout\myfile=\jobname.jax \fi % % \end{macrocode} % From |only.dtx| we must also create |prompt| on the MathJax side. % \begin{macrocode} %<*classXimera> \ifdefined\HCode \else \immediate\write\myfile{\unexpanded{\newenvironment}{prompt}{}{}} \fi % % \end{macrocode} % Redefine newcommand appropriately. % \begin{macrocode} %<*classXimera> \ifdefined\HCode \else \let\@oldargdef\@argdef \long\def\@argdef#1[#2]#3{% \immediate\write\myfile{\unexpanded{\newcommand}{\unexpanded{#1}}[\unexpanded{#2}]{\unexpanded{#3}}}% \@oldargdef#1[#2]{#3}% } \let\@OldDeclareMathOperator\DeclareMathOperator \renewcommand{\DeclareMathOperator}[2]{\@OldDeclareMathOperator{#1}{#2}\immediate\write\myfile{\unexpanded{\DeclareMathOperator}{\unexpanded{#1}}{\unexpanded{#2}}}} \fi % % \end{macrocode} % Include the jax'ed newcommands % \begin{macrocode} %<*cfgXimera> % Remove commands that use @ \immediate\write18{sed -i "/@/d" \jobname.jax} % Replace ##1 with #1 and so forth \immediate\write18{sed -i "s/\string#\string#\string\\([0-9]\string\\)/\string#\string\\1/g" \jobname.jax} \Configure{BVerbatimInput}{}{}{}{} \Configure{verbatiminput}{}{}{}{} % Instead of a nonbreaking space, use a standard space \makeatletter \def\FV@Space{\space} \makeatother % Include the mathjax newcommands in a math/tex script right at the beginning of the body \Configure{BODY}{% \HCode{
\Hnewline}% \Tg