[tex4ht] about configuring where to load mathjax from when using tex4ht in mathjax mode.

Nasser M. Abbasi nma at 12000.org
Tue Mar 3 23:47:58 CET 2020


On 3/3/2020 2:26 PM, Michal Hoftich wrote:

> the path to MathJax can be configured using \Configure{MathjaxSource}.
> The default value is:
> 
> \Configure{MathjaxSource}
> {https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/%
> latest.js?config=TeX-AMS-MML_HTMLorMML}
> 
> You can change it to a relative path.
> 
> I can see that version 2.7.5 is hardcoded, so we may want to switch to
> the newer version. Could you test it if it works with your code? I
> think your documents are good test suite for edge cases :)
> 
> Best regards,
> Michal
> 

Thanks Michal. I did not know about \Configure{MathjaxSource}{URL}

But it does not work with V 3.0 of Mathjax. Since V 3.0 has to be loaded
using script and not a URL, like this

<script id="MathJax-script" async src="/my_scripts/MathJax_V3/es5/tex-mml-chtml.js">

So when I added this to my .cfg and compiled, it did not work, i.e. mathjax did
not work.

\Configure{MathjaxSource}
{
<script id="MathJax-script" async src="/my_scripts/MathJax_V3/es5/tex-mml-chtml.js">
}

But instead this below worked :

=======================
\Configure{MathjaxSource}{}  %this to disable tex4ht loading mathjax

%now load mathjax V3.0 explicitly
\Configure{@HEAD}{\HCode{
  <script id="MathJax-script" async
     src="/my_scripts/MathJax_V3/es5/tex-mml-chtml.js"></script>
\Hnewline}}
=====================

If you want to load it from the cloud instead of local folder,
then replace the above with

=======================
\Configure{MathjaxSource}{}  %this to disable tex4ht loading mathjax

%code to load mathjax V3
\Configure{@HEAD}{\HCode{
  <script id="MathJax-script" async
    src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
\Hnewline}}
=====================

All the above should go to your .cfg file under the \Preamble tag.

I also just compiled a large file with lots of math using V3 mathjax
and so far I see no problems with the math. I also noticed mathjax is
now faster than before !

So I am now will be using the above from all my pages.

Thanks
--Nasser



More information about the tex4ht mailing list.