[tex4ht] Help on mathjax V3 configuration. Syntax error

Nasser M. Abbasi nma at 12000.org
Sun Mar 15 20:20:39 CET 2020


Using mathjax mode in tex4ht.

mathjax V3.0 has new configuration. The old

MathJax.Hub.Config({
    ....
})

Which Michael helped me before in setting up no longer works under V3.0

http://docs.mathjax.org/en/latest/upgrading/v2.html#v2-api-changes

They put a tool to help one in converting V2.0 to V3.0

https://mathjax.github.io/MathJax-demos-web/convert-configuration/convert-configuration.html

pasting the old V2.0 configuration in the top window, it generates
new V3.0 configuration code.

So I did this for mine and replaced the old V2.0 code in my .cfg with
the new one that the web site above generated.

But now make4ht gives syntax error when I compile  MWE latex file with
the new V3.0 configuration code

====================================
(/usr/local/texlive/2019/texmf-dist/tex/generic/tex4ht/html5.4ht)) (./foo.aux)
! Undefined control sequence.
\\  ->\let \reserved at e
                        \relax \let \reserved at f \relax \@ifstar {\let \reserv...

l.101 \EndPreamble
=======================

I added the new V3.0 configuration in my .cfg as follows

==============
\Preamble{xhtml,p-width}
.....

%V3.0 copied from the conversion tool
\Configure{@HEAD}{\HCode{
<script>
window.MathJax = {
   tex: {
     maxBuffer: 40*1024,
    ...
   }
};
</script>\Hnewline
}}


\begin{document}
\EndPreamble
======================

While the old V2.0 had this

===============
....
\Configure{@HEAD}{\HCode{ <script type="text/javascript"
    src="/scripts/MathJax-2.7.3/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
\Hnewline}}

\edef\mymathjaxconf{\detokenize{MathJax.Hub.Config({
         TeX: {
   MAXBUFFER: 40*1024,
   ...
}},
});}}

\ExplSyntaxOn
\regex_replace_all:nnN{ \x{23}\x{23}}{\x{23}}{\mymathjaxconf}
\ExplSyntaxOff
====================

It might be related to not using \detokenize and \regex_replace_all
now? But I do not know how to use the above macros and if they are
still needed now.

I put a MWE and my .cfg and foo.tex in this folder.

      https://www.12000.org/tmp/031520/

To reproduce and see the error, please type the command

make4ht -ulm default -c ./nma_mathjax.cfg foo.tex

Using TL 2019 on Linux ubuntu

which make4ht
/usr/local/texlive/2019/bin/x86_64-linux/make4ht

Thank you
--Nasser


More information about the tex4ht mailing list.