[tex4ht] what is the fastest way to convert large document to HTML?

Michal Hoftich michal.h21 at gmail.com
Thu Aug 16 14:29:33 CEST 2018

Hi Nasser,

> I am still struggling with very slow latex to HTML conversion
> for large document with lots of math.
> using svg for math, the bottleneck is always dvisvgm.
> For a document of 4,000 pages, with about 50,000 math expressions, it
> takes 8 hrs on Linux in a Vbox and 2.5 hrs on PC running Linux. It
> takes less than 2 minutes to compile it using lualatex to PDF.

It is just too long, it shouldn't take more than few minutes. Maybe
you can try to play with Dvisvgm options?

> So I want to get away from dvisvgm. Using png for math is no
> better. Still just as slow.
> What other options are there using tex4ht to speed the
> process of conversion that I could try? Even if the quality of
> math is not as good as svg.
> I am only familiar with using svg and png for math images. But
> I know tex4ht supports other formats and also mathjax.  I now
> use make4ht to compile.

The fastest way  for compilation is MathJax. Either MathML + MathJax,
or LaTeX math + MathJax. I prefer the first option. For second, see
mathjax-latex-4ht.sty from helpers4ht [1], sample usage [2].

It is also possible to precompile MathML to HTML + CSS using
MathJax-node-page [3]. See mathjaxnode make4ht extension in the
make4ht doc. But from my experience, this may take also quite some
time, maybe more than Dvisvgm. But it produces best output, without
need to any JavaScript on the client side.

Best regards,

[1] https://github.com/michal-h21/helpers4ht
[2] https://tex.stackexchange.com/a/436928/2891
[3] https://github.com/pkra/mathjax-node-page/

More information about the tex4ht mailing list