The following has already been reported upstream. Quoting from my e-mail message to gitinfo2, eso-pic, and tex4ht maintainers: I am using gitinfo2.sty (version 2.0.7 which comes with TeXLive 2017) for obtaining git metadata in my document. TeX4ht (installed from the Gentoo dev-tex/tex4ht-20090611_p1038-r5 package) is used to produce an HTML version of the document, using the command "mk4ht xhlatex test". Minimal example document (test.tex): ------------------------------------------------------------------- \documentclass{article} \usepackage[local]{gitinfo2} \begin{document} Test. \end{document} ------------------------------------------------------------------- The problem is that spurious <img /> elements appear in the HTML output, before the xml and DOCTYPE declarations, and at the end of the document: HTML output (test.html): ------------------------------------------------------------------- <img src="test0x.png" alt="PICT" /> <?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!--http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd--> <html xmlns="http://www.w3.org/1999/xhtml" > <head><title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="generator" content="TeX4ht (http://www.tug.org/tex4ht/)" /> <meta name="originator" content="TeX4ht (http://www.tug.org/tex4ht/)" /> <!-- xhtml,html --> <meta name="src" content="test.tex" /> <link rel="stylesheet" type="text/css" href="test.css" /> </head><body > <!--l. 4--><p class="noindent" >Test. </p> </body></html> <img src="test1x.png" alt="PICT" /> ------------------------------------------------------------------- If I remove \usepackage for gitinfo2, both img elements go away. Note that I don't use (nor need) any of the watermarking functionality of gitinfo2. (In fact, the example uses nothing from gitinfo2 at all; my real document does, of course.) I suspect that eso-pic (v2.0g), which is included from gitinfo2, is involved with this as well.
A fix for tex4ht is available upstream. Quoting Michal Hoftich: "Yes, it doesn't work because of the eso-pic package, respective because it adds some watermarks at every page. It seems that functionality provided by eso-pic doesn't make sense with tex4ht (at least I cannot think of a meaningful way of support), so I've added some code to usepackage.4ht to disable eso-pic at all, with a dummy version of its commands." So, could we cut a new revision of dev-tex/tex4ht with the following upstream fix included? http://svn.gnu.org.ua/viewvc/tex4ht?view=rev&revision=394
> So, could we cut a new revision of dev-tex/tex4ht with the following > upstream fix included? > http://svn.gnu.org.ua/viewvc/tex4ht?view=rev&revision=394 Hold on. This doesn't seem to fix it.
(In reply to Ulrich Müller from comment #2) > Hold on. This doesn't seem to fix it. In fact, it fixes the problem for the common use case that gitinfo2 is loaded with \usepackage. It is not entirely fixed for gitinfo2 being loaded from a class, but upstream has suggested a workaround for this (namely, loading the package in the begin document hook). In any case, the fix for eso-pic is in TeXLive now, r47578 of 2018-05-02: https://www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/generic/tex4ht/?view=log
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=63f679ef0b824a35f97d5b787b7173cf3cd57195 commit 63f679ef0b824a35f97d5b787b7173cf3cd57195 Author: Ulrich Müller <ulm@gentoo.org> AuthorDate: 2018-05-04 13:46:53 +0000 Commit: Ulrich Müller <ulm@gentoo.org> CommitDate: 2018-05-04 13:46:53 +0000 dev-tex/tex4ht: Revision bump, updating texmf from TeXLive. Closes: https://bugs.gentoo.org/654676 Package-Manager: Portage-2.3.35, Repoman-2.3.9 dev-tex/tex4ht/Manifest | 1 + dev-tex/tex4ht/tex4ht-20090611_p1038-r6.ebuild | 120 +++++++++++++++++++++++++ 2 files changed, 121 insertions(+)