summaryrefslogtreecommitdiff
path: root/support/TeX4ht/source/tex4ht-mathjax.tex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-10-07 03:03:15 +0000
committerNorbert Preining <norbert@preining.info>2022-10-07 03:03:15 +0000
commitbbbfa0a90645d4da46b1492f6513b28a01eb78da (patch)
treedcbf82e9f2bd50ac7596114690ad31ca7a6dbf8c /support/TeX4ht/source/tex4ht-mathjax.tex
parent678708e90ffe138885ed8c06b6780d491b80fae5 (diff)
CTAN sync 202210070303
Diffstat (limited to 'support/TeX4ht/source/tex4ht-mathjax.tex')
-rw-r--r--support/TeX4ht/source/tex4ht-mathjax.tex30
1 files changed, 24 insertions, 6 deletions
diff --git a/support/TeX4ht/source/tex4ht-mathjax.tex b/support/TeX4ht/source/tex4ht-mathjax.tex
index 0600eb10c3..2f511185f0 100644
--- a/support/TeX4ht/source/tex4ht-mathjax.tex
+++ b/support/TeX4ht/source/tex4ht-mathjax.tex
@@ -1,4 +1,4 @@
-% $Id: tex4ht-mathjax.tex 1190 2022-08-29 10:21:19Z michal_h21 $
+% $Id: tex4ht-mathjax.tex 1212 2022-10-06 10:29:28Z michal_h21 $
% compile: latex tex4ht-mathjax
%
% Copyright 2018-2022 TeX Users Group
@@ -99,12 +99,24 @@ environments. They will then keep the LaTeX code unchanged.
The \verb|\VerbMath| command redefines environments to pass their content
verbatim to the HTML output.
+The optional command can contain name of the counter that should be updated.
+It will also use LaTeX 3 regular expressions to search for label commands.
+Thanks to that, cross-referencing to the math environments should work.
+It is a bit limited, for example subequations cannot work. There can be also
+issues in books, where equation numbers are based on chapters, but MathJax
+numbers them consecutively. In these cases, other mechanisms may be necessary.
+
\<defined commands\><<<
\ExplSyntaxOn
-\newcommand\VerbMath[1]{%
- \cs_if_exist:cTF{#1}{
- \RenewDocumentEnvironment{#1}{+!b}{%
- \NoFonts\expandafter\VerbMathToks\expandafter{\detokenize{##1}}{#1}\EndNoFonts%
+\cs_generate_variant:Nn \regex_extract_once:nnNTF {nV}
+\newcommand\VerbMath[2][]{%
+ \cs_if_exist:cTF{#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
}{}
}{}%
}
@@ -154,7 +166,7 @@ Require verbatim math environments.
\VerbMath{split}
\VerbMath{multline}
\VerbMath{multline*}
-\VerbMath{equation}
+\VerbMath[equation]{equation}
\VerbMath{equation*}
\VerbMath{math}
\VerbMath{displaymath}
@@ -204,3 +216,9 @@ Fixes for tables of contents.
\fixmathjaxtoc\\
\fixmathjaxtoc\exp
>>>
+
+\<configure mathjax-latex-4ht mhchem\><<<
+\def\ce#1{\texttt{\detokenize{\(\ce{#1}\)}}}
+>>>
+
+\endinput