[tex4ht] problem with slow compilation of large latex file with large math content

Nasser M. Abbasi nma at 12000.org
Sun Mar 27 00:20:37 CET 2016

On 3/26/2016 5:44 PM, Karl Berry wrote:
>      I have many many latex files this large
> Is the one you provided already one of the smaller ones?  The smaller
> the file that still exhibits the problem, the easier to debug.

The file I put a link to is an average size Latex file. I have some larger.
I picked this one since it showed the problem clearly.

>      given that lualatex takes one hr or so.
> Oh, lualatex is another important part of the story.  LuaTeX is already
> significantly slower than standard TeX (or XeTeX), and depending on what
> your document is doing, we may be hitting some kind of new/unusual
> slowdown that is specific to luatex.  Must you use luatex?

Sorry, I meant lualatex takes one hr for _all_ the files (I have about
50-60 files like this one for this one test). I did not mean it
takes one hr for this one file.

Just to be clear: For the specific file I posted


pdflates and lualatex take about 2-3 minutes to compile the above file,
on native linux on new PC.  Even on Vbox and cygwin, pdflatex and lualatex
as really fast. Not more than 4-5 minutes at most on this file.

tex4ht takes about 5 hrs on the new Linux PC. All running new installed TL 2015.
Linux mint 17.3, 64 bit. tex4ht takes 14 hrs on VBox and 10 hrs
on cygwin. On same file.

Any one can download the zip file and check for themselves. Sorry it
is little large. But it is only one command to run and see ;)

>      Finally, is there a document that describes the passes/process
>      that tex4ht uses to compile to HTML at some high level?
> The htlatex script is six lines long, and is the clearest possible
> summary of what is run.  I'll omit the TeX gobbeldygook that Eitan
> uses.
> #!/bin/sh
>          latex $5 ...
>          latex $5 ...
>          latex $5 ...
>          tex4ht -f/$1  -i~/tex4ht.dir/texmf/tex4ht/ht-fonts/$3
>          t4ht -f/$1 $4
> I assume Michal's make4ht is fundamentally equivalent.
> As CVR says, the reason for the three latex runs is simply to resolve
> references.  Thus if you are repeatedly running the same doc, with all
> aux files already in place, one run would suffice.

But I do not know how to decide if I need one run or two or three?
I call make4ht to compile the file, and it does its thing. How
is the user supposed to control this?

> For sure, a design document, among many others, would be extremely
> desirable, not to mention many updates to the code, not to mention a new
> release, not to mention ...  What's fundamentally needed are more
> volunteers with time and ability to help develop and document this
> highly complex system!
> karl

Sure. tex4ht is very complicated and only very few experts know how
it works from the inside, and it is only the only tool we have
really to convert latex to HTML well enough, so it is important
to have design document that describes how it works. I switch
to tex4ht from latex2html about 2 years ago, since latex2html is basically
not maintained any more now and does not support many Latex packages.

Thank you for the input Karl.


More information about the tex4ht mailing list