% mathjax-latex-4ht.4ht (2025-01-26-07:11), generated from tex4ht-mathjax.tex
% Copyright 2018-2025 TeX Users Group
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c of this license or (at your option) any
% later version. The latest version of this license is in
%   https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions
% of LaTeX version 2005/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
%
% The Current Maintainer of this work
% is the TeX4ht Project <https://tug.org/tex4ht>.
%
% If you modify this program, changing the
% version identification would be appreciated.
\immediate\write-1{version 2025-01-26-07:11}


\ExplSyntaxOn
\:CheckOption{fastmathjax}\if:Option
\DeclareRobustCommand\alteqtoks[1]{%
  \tl_set:Ne \l_tmpa_tl {\detokenize{#1}}
  \HCode{\l_tmpa_tl}
}

\else
\cs_new_protected:Npn \alteqtoks #1
{
  \tl_set:Ne \l_tmpa_tl {\detokenize{#1}}
  % % replace < > and & with xml entities
  \regex_replace_all:nnN { \x{26} } { &amp; } \l_tmpa_tl
  \regex_replace_all:nnN { \x{3C} } { &lt; } \l_tmpa_tl
  \regex_replace_all:nnN { \x{3E} } { &gt; } \l_tmpa_tl
  % replace \par command with blank lines
  \regex_replace_all:nnN { \x{5C}par\b } {\x{A}\x{A}} \l_tmpa_tl
  \tl_set:Ne \l_tmpb_tl{ \l_tmpa_tl }
  \HCode{\l_tmpb_tl}
}

\fi
\ExplSyntaxOff
\NewConfigure{MathJaxConfig}{1}
\NewConfigure{MathJaxMacros}[1]{%
\Configure{@BODY}{\bgroup\NoFonts\ttfamily\detokenize{\(}%
  \special{t4ht*<#1}%
\detokenize{\)}\EndNoFonts\egroup}%
}

\long\def\AltlMath#1\){\expandafter\alteqtoks{\(#1\)}\)}
\long\def\AltlDisplay#1\]{\alteqtoks{\[#1\]}\]}
\long\def\AltMathOne#1${\alteqtoks{\(#1\)}$}
% this seems a bit hacky -- we need to skip some code inserted at the
% beginning of each display math
\long\def\AltlDisplayDollars#1$${\alteqtoks{\[#1\]}$$}

\NewConfigure{MathjaxEnv}{2}

\newcommand\VerbMathToks[2]{%
  \a:MathjaxEnv%
  \HCode{\string\begin{#2}}%
    \alteqtoks{#1}%
  \HCode{\string\end{#2}}%
  \b:MathjaxEnv%
}
\ExplSyntaxOn
\seq_new:N\:savedmathjaxenvs

\newcommand\:savemathjaxenv[1]{%
  \seq_gput_right:Nn\:savedmathjaxenvs{#1}
  \expandafter\let\csname mathjax-#1\expandafter\endcsname\csname #1\endcsname%
  \expandafter\let\csname mathjax-end#1\expandafter\endcsname\csname end#1\endcsname%
}

% we must not reintroduce the matrix environmeint in TikZ, because it interferes with the \matrix command
\newcommand\:ignoretikzmatrix{\seq_remove_all:Nn\:savedmathjaxenvs{matrix}}

\newcommand\RestoreMathJaxEnvironment[1]{%
  \expandafter\let\csname #1\expandafter\endcsname\csname mathjax-#1\endcsname%
  \expandafter\let\csname end#1\expandafter\endcsname\csname mathjax-end#1\endcsname%
}

\newcommand\RestoreMathJaxEnvironments{%
  \seq_map_function:NN\:savedmathjaxenvs\RestoreMathJaxEnvironment%
}
\ExplSyntaxOff
\ExplSyntaxOn
\cs_generate_variant:Nn \regex_extract_once:nnNTF {nV}
\newcommand\VerbMath[2][]{%
  \cs_if_exist:cTF{#2}{
    \:savemathjaxenv{#2}%
    \RenewDocumentEnvironment{#2}{+!b}{%
      \NoFonts\expandafter\VerbMathToks\expandafter{\detokenize{##1}}{#2}\EndNoFonts%
      \ifx\relax#1\relax\else%
      \refstepcounter{#1}%
      \regex_extract_once:nVNTF { label\s* \x{7B}([^\x{7D}]*)\x{7D}} {\l_tmpb_tl} \l_tmp_seq {\label{\seq_item:Nn\l_tmp_seq{2}}} {}%
      \fi
    }{}
  }{}%
}
\ExplSyntaxOff
\def\fixmathjaxtoc#1{\Configure{writetoc}{\def#1{\detokenize{#1}}}}

\AtBeginDocument{%
\VerbMath{subarray}
\VerbMath{smallmatrix}
\VerbMath{matrix}
\VerbMath{pmatrix}
\VerbMath{bmatrix}
\VerbMath{Bmatrix}
\VerbMath{vmatrix}
\VerbMath{Vmatrix}
\VerbMath{cases}
\VerbMath{subequations}
\VerbMath{aligned}
\VerbMath{alignedat}
\VerbMath{gathered}
\VerbMath[equation]{gather}
\VerbMath{gather*}
\VerbMath[equation]{alignat}
\VerbMath{alignat*}
\VerbMath{xalignat}
\VerbMath{xalignat*}
\VerbMath{xxalignat}
\VerbMath[equation]{align}
\VerbMath{align*}
\VerbMath{flalign[equation]}
\VerbMath{flalign*}
\VerbMath[equation]{split}
\VerbMath[equation]{multline}
\VerbMath{multline*}
\VerbMath[equation]{equation}
\VerbMath{equation*}
\VerbMath{math}
\VerbMath{displaymath}
\VerbMath{eqnarray}
\VerbMath{eqnarray*}
\ConfigureEnv{gather}{}{}{}{}
\ConfigureEnv{gather*}{}{}{}{}
\ConfigureEnv{multline}{}{}{}{}
\ConfigureEnv{multline*}{}{}{}{}
\fixmathjaxtoc\int
\fixmathjaxtoc\,
\fixmathjaxtoc\sin
\fixmathjaxtoc\cos
\fixmathjaxtoc\tan
\fixmathjaxtoc\arcsin
\fixmathjaxtoc\arccos
\fixmathjaxtoc\arctan
\fixmathjaxtoc\csc
\fixmathjaxtoc\sec
\fixmathjaxtoc\cot
\fixmathjaxtoc\sinh
\fixmathjaxtoc\cosh
\fixmathjaxtoc\tanh
\fixmathjaxtoc\coth
\fixmathjaxtoc\log
\fixmathjaxtoc\ln
\fixmathjaxtoc\sum
\fixmathjaxtoc\(
\fixmathjaxtoc\)
\fixmathjaxtoc\begin
\fixmathjaxtoc\end
\fixmathjaxtoc\\
\fixmathjaxtoc\exp
\fixmathjaxtoc\left
\fixmathjaxtoc\right

\@ifpackageloaded{mhchem}{%
\def\:tempa#1{\texttt{\detokenize{\(\ce{#1}\)}}}
\HLet\ce\:tempa
}{}

\@ifpackageloaded{tikz}{%
%\tikzset{every picture/.append code={\:ignoretikzmatrix\RestoreMathJaxEnvironments}}
\pend:def\tikz@installcommands{\RestoreMathJaxEnvironments}
}{}

}
\endinput































































































































































































































































































































































































































































































































































\endinput

