1

Inside the latex file (.tex) the typical picture command is used:

\includegraphics[bb=0 0 2100 1528,width=3.83in,height=2.79in,keepaspectratio]{summbetadiethist.eps}

However, when running htlatex with the command:

htlatex foo.tex "myfile.cfg,charset=utf-8,pic-m" " -utf8 -cunihft"

there are error messages thrown like:

enter image description here

The preamble (myfile.cfg contents) are as follows:

\Preamble{xhtml}
\DeclareGraphicsExtensions{.eps,.pdf,.svg,.png,.jpg}
\Configure{Picture}{.svg}
\ifdefined\HCode\else .... \fi
\DeclareMathSizes{12}{14}{10}{8}
\ConfigureEnv{tabular}
    {\HCode{}}{\HCode{}}{}{}
\ConfigureEnv{figure} 
    {\HCode{}}{\HCode{}}{}{}    
\Configure{float}
   {\ifOption{refcaption}{}{\csname par\endcsname\ShowPar \leavevmode}}
   {\HCode{}}
{\ifvmode \IgnorePar \fi\EndP \HCode{}\csname par\endcsname\ShowPar}
\Css {body {margin-top: 100px;
                 margin-right: 400px;
                 margin-bottom: 10px;
                 margin-left: 400px;
                }
         }
\begin{document}
\EndPreamble

If the .svg line in the preamble is commented out to enforce creation of .png files, the errors are still thrown for each input .eps image. So does the image engine(s) wrapped into tex4ht not like .eps images?

  • 1
    you will need to configure it to use the windows name for the imagemagic convert program which is renamed as convert is a system command (as you show above) that is trying to reformat your disk... (fortunately it is unlikely that you pass valid convert options by mistake) – David Carlisle Jun 9 '19 at 22:01
  • it is best to convert the eps images to either svg or png before the tex4ht conversion and to remove the .eps entry from \DeclareGraphicsExtensions. in this way the correct file will be used – michal.h21 Jun 10 '19 at 8:15
  • @michal.h21 there is something fishy here imho. In html4.4ht there is line \Needs{"convert \csname Gin@base\endcsname.eps \csname Gin@base\endcsname\PictExt"}. I would expected this to map somehow to the convert section in tex4ht.env but actually it is a direct call to an executable. – Ulrike Fischer Jun 10 '19 at 9:48
  • @UlrikeFischer tex4ht.env is used only for the DVI to output picture conversion, not for conversion between output formats. but the conversion command should be configurable, as is in the PDF configuration. – michal.h21 Jun 10 '19 at 10:06
  • @michal.h21 Yes, copying the configuration and changing it enables the eps to svg conversion on windows. I could add an answer when the question is reopened for the direct problem, but if you have suggestion how to make it configurable it would be perhaps better if you do it. – Ulrike Fischer Jun 10 '19 at 10:10
1

html4.4ht contains a configuration for graphics with a direct reference to a call to convert. If I copy this configuration to your cfg file and change it htlatex calls magick convert instead and succeeds on windows:

\Preamble{xhtml}
\DeclareGraphicsExtensions{.eps,.pdf,.svg,.png,.jpg}
\Configure{Picture}{.svg}
\Configure{graphics*}
   {eps}
   {\openin15=\csname Gin@base\endcsname\PictExt\relax%
   \ifeof15%
   \Needs{"magick convert \csname Gin@base\endcsname.eps \csname Gin@base\endcsname\PictExt"}%
   \fi%
   \closein15%
   {\Configure{Needs}{File: \csname Gin@base\endcsname\PictExt}\Needs{}}%
   \Picture[\csname a:GraphicsAlt\endcsname]{{\csname Gin@base\endcsname\PictExt} \csname a:Gin-dim\endcsname
}}
\ifdefined\HCode\else .... \fi
\DeclareMathSizes{12}{14}{10}{8}
\ConfigureEnv{tabular}
    {\HCode{}}{\HCode{}}{}{}
\ConfigureEnv{figure}
    {\HCode{}}{\HCode{}}{}{}
\Configure{float}
   {\ifOption{refcaption}{}{\csname par\endcsname\ShowPar \leavevmode}}
   {\HCode{}}
{\ifvmode \IgnorePar \fi\EndP \HCode{}\csname par\endcsname\ShowPar}
\Css {body {margin-top: 100px;
                 margin-right: 400px;
                 margin-bottom: 10px;
                 margin-left: 400px;
                }
         }
\begin{document}
\EndPreamble
  • alternative command, which doesn't rasterize vecors is "\Needs{epstopdf '\Gin@base.eps' '\Gin@base.pdf' && pdf2svg '\Gin@base.pdf' '\Gin@base.svg'"}. but the pdf2svg command isn't installed by default, it must be installed by the user. – michal.h21 Jun 10 '19 at 13:00
  • The above preamble will process .eps images, but for the .pdf images in converted_graphics, they just get passed over -- i.e. no recognition. I tried adding an entire new \Configure{graphics*} {pdf} with the appropriate file extension but still passes over the .pdf and does not respond. Also, in order to perform a complete image conversion, do the ImageMagick parameters like -trim -density 110x110 -transparent #FFFFFF need to be added into the preamble somewhere? – JoleT Jun 10 '19 at 16:39
  • Don't use comments for follow-up questions. Ask a new question so that I'm not the only one to see it. – Ulrike Fischer Jun 10 '19 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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