[tex4ht] TeX4ht warning --- Cannot determine size of graphic in svg graphics. Does tex4ht support bounding box on svg?

Michal Hoftich michal.h21 at gmail.com
Mon May 18 16:02:24 CEST 2015

Hi Nasser,

I think your setup is too complicated.

First of all, you should conditionals for tex4ht in text of your
document, you should use that only for conditional package loading in
the preamble. You can configure graphicx package to include pdf image
when you compile to pdf and svg when you compile with tex4ht. You only
need to remove the image extension from the document:



% \includegraphics[]{p}


Now you need to decide. If you always use
\includegraphics[width=something]{imagename}, you can just configure
graphicx to include svg files and configure tex4ht to support it:

\Preamble{ext=htm,p-width,pic-align} %work well with something, I forgot what
  {\Configure{Needs}{File: \Gin at base.svg}\Needs{}}
  \Picture[\csname a:GraphicsAlt\endcsname]{\csname
Gin at base\endcsname.svg width="\expandafter\the\csname
Gin at req@width\endcsname"  height="\expandafter\the\csname
Gin at req@height\endcsname"

see \DeclareGraphicsExtensions and \Configure{graphics*}{svg}

if you want to include images using their natural size, you need to
extract the boinding box using `ebb -x imagename.pdf` command. This
will create file imagename.xbb. Graphicx package with dvipdfmx option
can then use this file for extracting the bounding box of the image:


% \includegraphics[width=0.5\paperwidth]{p}

and add to the .cfg file under \makeatletter:

\@namedef{Gin at rule@.svg}#1{{svg}{.xbb}{#1}}
\@namedef{Gin at rule@.SVG}#1{{svg}{.xbb}{#1}}


More information about the tex4ht mailing list