I have two systems where I need to run tex4ht/make4ht. They are different versions of Ubuntu, I believe 18.04 LTS vs 19.04. I use the most recent version of make4ht from github, but the version of tex4ht is whatever is available in the apt package manager.

Either way, differing versions of tex4ht (presumably) mean that when compiling doc.tex with an image fig.eps, say, the image included in the HTML output is called doc0x.png on one system (the older one), and fig.png on the other.

I don't particularly mind about the naming convention here. But I would like it to be consistent, otherwise I will need to write an even worse Makefile than I already have.

So is there a way that I can either go back to the doc0x.png convention on the newer version, or activate the fig.png convention on the older one? I've read the tex4ht FAQ but I am none the wiser.

1 Answer 1


The original image files should be used by default. The behavior you describe is an issue which was caused by a recent update to the Graphics package. I've updated the TeX4ht sources with a fix, so it should be fixed in TL soon. Meanwhile, you can use the following graphics.4ht file:

% graphics.4ht (2019-10-13-23:30), generated from tex4ht-4ht.tex
% Copyright 1997-2009 Eitan M. Gurari
% Copyright 2009-2019 TeX Users Group
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c of this license or (at your option) any
% later version. The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions
% of LaTeX version 2005/12/01 or later.
% This work has the LPPL maintenance status "maintained".
% The Current Maintainer of this work
% is the TeX4ht Project <http://tug.org/tex4ht>.
% If you modify this program, changing the
% version identification would be appreciated.

   \expandafter\let\csname includegraphics \endcsname\includegraphics
\def\includegraphics{\expandafter\protect\csname includegraphics \endcsname}
\def\grp:warning#1{\no:bound#1(no BoundingBox)//\:warning{#1}}
\def\no:bound#1(no BoundingBox)#2//{\gdef\noBoundingBox{#2}\ifx
   \noBoundingBox\empty \global\let\noBoundingBox\:UnDef\fi}
    \let\@latex@error\grp:warning \let\@ehc\empty}
\append:defIII\:tempc{\b:graphics\grf:gobble\leavevmode grf:gobble}
   \expandafter\ifx \csname :.#1\endcsname\relax
      \pend:defIII\n:Gin@setfile:{\csname :.#1\endcsname}%
   \def\:temp{#2}\ifx \:temp\empty
     \expandafter\let\csname :.#1\endcsname\:UnDef
     \expandafter\def\csname :.#1\endcsname{\edef\:temp{\detokenize{.#1}}%
        \ifx \:temp\Gin@ext  \let\a:graphics\relax
           \def\G:cnfg{#2}\expandafter\grf:gobble \fi}%
   \fi }
   \PictureOff\expandafter\grf:fixquotes\Gin@base\relax#1\PictureOn \G:cnfg \let\G:cnfg\relax}



Here is a sample:

% https://tex.stackexchange.com/q/512238/2891






And resulting html:

<!--l. 8--><p class="noindent" ><img 
src="example-image.png" alt="PIC"  
width="401" height="301"  />
</p><!--l. 10--><p class="indent" >   <img 
src="epssample.png" alt="PIC"  
width="321" height="240"  />
  • I'm glad to know that the 'correct' behaviour is to retain the filenames, that's very helpful. Your .4ht doesn't fix the issue in my older distribution, which is an up-to-date Ubuntu 18.04 where the texlive deb has version "2017.20180305-1". Obviously I am not requesting that you go back in time and figure out what was wrong with graphics at this time! But it's very useful to know that the *x.png behaviour is an aberration, and I will plan accordingly. Oct 16, 2019 at 15:57
  • @AlexWatson that's very old version, but it is really strange why it behaves this way, as this issue happened only with the LaTeX update from the last week. this may be some different issue...
    – michal.h21
    Oct 16, 2019 at 17:36
  • I know - TL with a package management system is just such a mess and I'm not used to latex being such a fast-paced development environment, but things have changed... Oct 16, 2019 at 21:19
  • @AlexWatson I am little bit worried about the changes in the LaTeX kernel, I think debugging collisions with TeX4ht would be nightmare. As was this image issue, which took several hours to fix.
    – michal.h21
    Oct 16, 2019 at 21:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .