I have the following MWE:
\documentclass{book}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
Lorem ipsum dolor sit amet, \(k_\delta=\frac{3 \mathit{EJ}}{l^3}\) consectetur:
\begin{equation*}k_\delta=\frac{3 \mathit{EJ}}{l^3}\end{equation*}
\begin{centering}
\includegraphics[width=0.5\textwidth]{myimage.eps}
\end{centering}
\end{document}
which compiles fine to html
(with htlatex example.tex "myconfig, xhtml, charset=utf-8" " -cunihtf -utf8"
under Ubuntu TeXLive), myconfig.cfg
being
\Preamble{xhtml}
\Configure{graphics*}
{jpg}
{\Picture[pict]{\csname Gin@base\endcsname .jpg
\space width="\expandafter\the\csname Gin@req@width\endcsname"}}
\Configure{graphics*}
{png}
{\Picture[pict]{\csname Gin@base\endcsname .png
\space width="\expandafter\the\csname Gin@req@width\endcsname"}}
\begin{document}
\EndPreamble
Looking for a workaround to the unsolved problem of small image sizes in html
output, I wrote a Python script which parses html
source and doubles width
and height
of all images, getting in face of a new problem, poor quality of 'doubled' eps
images. So I tried to increase density from 110×110 to 220×220 in tex4ht.env
, <convert>
section:
Gconvert -trim +repage -density 220x220 -transparent '#FFFFFF' zz%%4.ps %%3
This actually increased the resolution of eps
images, so that now I can double their size in html
source with my Python script, but also increased the size of math formula images (whose size is not affected by my Python script because they don't hold width
nor height
attributes).
Is there a way to increase eps
images resolution without affecting math images size?
Here is a screenshot of the html
output with doubled size of math formulas:
Best Answer
It seems I managed to find a solution by myself. I rolled back the change to
tex4ht.env
, so that math formulas rendered as image are safe now, and I added the following section to my above mentioned preamblemyconfig.cfg
:This way
eps
images are managed in a different way (dvi
code is bypassed, as said here), so that now they lackwidth
attribute inhtml
source; however such lack is perfectly fine because noweps
images look bigger inhtml
output, their size is satisfactory and they don't need to be "externally" enlarged through my post-production Python script.Here is a screenshot of original example after solution:
FOLLOW UP
I actually discovered that, although above solution is able to enlarge
eps
images, their size is independent from the size specified in LaTeX source, and inconsistent withjpg
andpng
images, which retain thewidth
andheight
inhtml
output. If you are looking for a consistent solution, theeps
section ofmyconfig.cfg
should beThis way
width
andheight
attributes inhtml
output are retained also foreps
images, and their size is consistent withjpg
andpng
images, as I describe also in the problem I cited before.