I'm using tex4ht
to produce HTML that contains mathematical content to be rendered using MathJax.
This question is about inline mathematical content in moving arguments, such as \section{\(y^2\)}
and \caption{\(y^2\)}
.
Working minimal example
The following code compiles fine:
\documentclass{article}\begin{document}\section{$y^2$}\end{document}
Non-working minimal example
Using \(...\)
within the moving argument makes the compilation fail:
\documentclass{article}\begin{document}\section{\(y^2\)}\end{document}
Compilation
For both the working, and the non-working minimum working example, I'm using the following command to compile:
make4ht -a debug mwe.tex "mathjax"
texmf-dist/tex/generic/tex4ht/mathjax-latex-4ht.4ht
I think that this will likely come down to redefining \AltlMath
from mathjax-latex-4ht.4ht
, to make it robust. The default definition is:
\long\def\AltlMath#1\){\expandafter\alteqtoks{\(#1\)}\)}
Question
How can I configure AltlMath
to be robust so that \(...\)
works within moving arguments?
Footnote: changing the .tex file is not an option :)