[tex4ht] trying to understand how to use mathjax in tex4ht

Nasser M. Abbasi nma at 12000.org
Sat Sep 8 14:19:28 CEST 2018

On 9/8/2018 6:25 AM, Michal Hoftich wrote:
> Hello Nasser,
>> Am I using wrong options for matjax with tex4ht? What are the correct
>> command line options to use when one wants to use make4ht and
>> mathjax?
>> I wanted to try mathjax, but if I had to go change my latex code to
>> make it compile, then this is a no starter for me.
> There are lot of different versions of the MathJax configuration
> around the web, but the one which is updated is this one:
> https://github.com/michal-h21/helpers4ht/blob/master/mathjax-latex-4ht.sty
> I hope to include it in tex4ht one day, but I am not sure if it is
> robust enough. I guess that your files will find some edge cases that
> doesn't work really well.
> Anyway, it can be used with the following configuration file:
> \RequirePackage{mathjax-latex-4ht}
> \Preamble{xhtml}
> \begin{document}
> \EndPreamble
> Best regards,
> Michal

Thanks Michal;

The above helped with the example I posted. But when I tried it on
a little larger file (one page long with some math in it), it failed
completely. No error where generated, but half the text is missing,
and half the math did not even render.

I put the small latex file foo.tex and the .cfg file and the PDF file
in a zip file so you can try for yourself.


The command I used is

make4ht -ulm default -c ./nma_mathjax.cfg foo.tex
                "htm,0,charset=utf-8" " -cunihtf -utf8"

I used your nma_mathjax.cfg (included in the zip file)


and put the mathjax-latex-4ht.sty file in my
~/texmf/tex/local/mathjax-latex-4ht.sty so it can see it.

Here is screen shot of what the output looked like in HTML in chrome


And this is screen shot showing what it should look like (in PDF)


You can see the big difference. Large block of text is missing
as well.

If I can help test mathjax for your make4ht, I'll be happy
to. I am not sure if I am using the correct command line
options there in the command, but this is what I had before.


More information about the tex4ht mailing list