Sign up ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have been trying tex4ht and comparing its output to Latex2html (l2h).

I still find l2h to produce better math in the HTML than tex4ht. But it could be I am not doing something right and I thought to check with the experts here.

I'll show a very small example, and show the commands used, and show the output I get from l2h and tex4h. Clearly the l2h Math looks better. The math from tex4h is not straight on the same line as the text around it, also the \prime shows up like just a straight up tick instead of a real math \prime. Also some letters with tex4ht seems to be fussy looking, while other Math letters seems to be sharp. Also the letter v looks different from a real v letter in math mode.

I hope someone can spot something I am doing wrong when it comes to using tex4ht

Here is the tex file:


Where $\left[M\right]_{v^{\prime}\to v}$ is the change of basis matrix which
when applied to $\mathbf{x}_{v^{\prime}}$ returns the coordinates of the
vector w.r.t. basis $v$


Here is the Latex2html and htlatex commands used to make the HTML

latex2html t4.tex
htlatex t4.tex

Here is a screen shot of the output from l2h

enter image description here

Here is a screen shot of the output from tex4ht

enter image description here


Linux mint xfce 14, tex4ht

tex4ht -v tex4ht.c (2009-01-31-07:33 kpathsea)

latex2html -v This is LaTeX2HTML Version 2008 (1.71)

latex -v pdfTeX 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian) kpathsea version 6.1.0


Thanks to suggestion by @cmhughes below, I tried the command suggested. It improved the output for sure, but the -> has too much spaces between them. Here is a screen shot as seen on Chrome browser (same browser used for the above screen shots). But I would use over the last command.

   mk4ht mzlatex t4.tex "html,mathplayer"

and now looking at the file 4.xht

enter image description here

btw, when I tried the above mk4ht command on other latex documents I have, I now get syntax errors which do not show up when I use the command htlatex foo.tex. Here is one example:

mk4ht mzlatex report.tex "html,mathplayer"

! Display math should end with $$.
<to be read again> 
l.470 \end{equation}


So, I am not sure I want to use this command if I have to go now edit all my latex files again to make it work with mathml generation. I do not know what other incompatibilities this will bring up and if I do this change, will the file work again with Latex?

share|improve this question
how about mk4ht mzlatex myfile.tex "html,mathplayer"? – cmhughes Jan 21 '13 at 4:54
Wouldn't you rather use \to instead of ->? – Loop Space Jan 21 '13 at 8:44
@AndrewStacey, thanks! yes ofcourse, much better. I have updated now all images again. – Nasser Jan 21 '13 at 9:28
@Nasser you can also convert to html5 and mathjax using tex4ht. see – michal.h21 Jan 21 '13 at 10:28
@michal.h21, thanks! I did not know this, will look at it. – Nasser Jan 21 '13 at 10:42

1 Answer 1

Another possible solution is to change the default density when tex4ht calls imagemagick's convert in tex4ht.env.

This is at line 167 in my version where it says:

Gif exist DEL >nul
Gif exist %%3 DEL %%3 >nul
Gdvips -E -Ppdf -mode ibmvga -D 110 -f %%1 -pp %%2 >
Gconvert -trim +repage -density 110x110 -transparent "#FFFFFF" %%3
Gif exist DEL >nul  

Just change 110x110 to 500x500. Actually for your inline example this makes an appropriately high resolution [M], but much too large so this would need to be tweaked, possibly with the line above as well.

Maybe this could be done in a configuration file instead, so the original file isn't modified.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.