I'm using tex4ht
to produce XHTML files from a LaTeX file. The XHTML file I obtain uses images for some equations which tex4ht
could not convert directly to XHTML.
Problem: images of equations have very bad quality.
What I want: Better quality images.
More info on attempts & system:
I'm using MikTeX 2.9 under Windows Vista. I go to the command line and type htlatex document.tex "xhtml"
to get the resulting XHMTL file.
After doing some search on the web, I tried to change the file tex4ht.env
as mentioned in here (changing -density 110x100
to -density 220x220 -geometry 50%
) in all locations I could find in my system (within the MikTeX path and also in the AppData
windows directory) but the results are the same. I obtain during the compilation of hlatex
the following line (among others):
System call: mgs -sDEVICE=pngalpha -sOutputFile=Untitled11x.png
-r110x110 -dEPSC rop -dBackgroundColor=16#ffffff -dTextAlphaBits=2 -dGraphicsAlphaBits=2 -q -dbat ch -dNOPAUSE zzUntitled1.ps -c quit
In particular, I would guess that the -r110x110
means resolution was still set to 110×110, despite my changes to the file tex4ht.env
.
Any suggestions on how to improve the quality of equations images?
Best Answer
The
env
file is stored in%texmf-home%/texmf-dist/tex4ht/base/unix
or%texmf-home%/texmf-dist/tex4ht/base/win32
, depending on your operating system. For testing purposes, it is best to make copy of that file in your working directory.The structure of this file is little bit strange:
Spaces are important. All lines with space at the beginning are ignored. Tagged sections are sometimes ignored. Quoting
tex4ht.env
itself:In the example, only
GNext command
is actually executed. If you look at actualtex4ht.env
file, you can see that there are several configurations for output of images. Default islines
means, that default conversion uses
dvips
command to convert picture to the eps file and then using convert to the final output format.There is also section
Which uses
dvipng
instead ofconvert
anddvips
and in my opinion the output is better. So to use this configuration, just erase spaces before<convert>
and</convert>
, and add space at the beginning of<dvipng>
and</dvipng>
Another opinion is to use
svg
images instead of thepng
. Just add :Create the file
myconfig.cfg
:and call:
Edit:
Another option is to to use make4ht build system. You can specify image conversion command in the build file, see the chapter on that matter