TransWikia.com

Missing images with LaTeX to HTML

TeX - LaTeX Asked by theozh on June 22, 2021

I would like to create an HTML file from a LaTeX document. The probably most convenient approach using TeXStudio‘s Tools | Convert to Html... | Launch results in an error:

Error : a process has failed
Fatal error : LaTeX errors detected.

Well, very meaningful… However, PdfLaTeX works fine on this document.

So, instead, I tried to use the command line and htlatex

htlatex myFile.tex

It works all fine, the HTML is generated, but the images are missing. Well, they are in the directory but just have 1 kB in size and are empty.

During compilation I get messages for all images, like:

...
System call: dvipng -T tight -D 144 -bg Transparent -pp 19:19 myFile.idv -o myFile9x.png
This is dvipng 1.16 Copyright 2002-2015, 2019 Jan-Ake Larsson
[19dvipng warning: at (-143,1) unimplemented special{em: graph Images/myPicture.png,72bp,72bp} ]
System return: 0
....

The images are mostly PNG and are included, e.g. via:

begin{figure}[htbp]%
    centering
    includegraphics[width=0.8columnwidth]{Images/myPicture.png}%
    caption{This is a picture}%
    label{fig:myPicture}%
end{figure}

What am I doing wrong here? Am I missing any command line option or configuration file?

I’m using Win10, pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7050 64-bit).
Any further information needed to make a suggestion?

Update:

According to @michal.h21’s suggestion,
I updated using the MiKTeX package manager mpm. It updated 97 packages. There was/is a package tex4ht from 2020-10-05, a package miktex-tex4ht from 2020-01-26, and a package miktex-tex4ht-x64-2.9 from 2020-10-31. Pretty confusing. Any other packages need to look at? When I ran htlatex afterwards it was installing two additional styles: I guess hosub-?something?.sty and iftex.sty. But the result is the same: no images in the HTML document. Maybe it’s worth mentioning, I have a portable installation, might this cause problems?

Installed packages containing tex4 in the name:

enter image description here

Update 2: Third approach using make4ht

Result is the same as above. No error message, HTML is generated, pictures have 1 kB empty. Output:

[STATUS]  make4ht: Conversion started
[STATUS]  make4ht: Input file: myFile.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 20.11 Portable)
entering extended mode
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 20.11 Portable)
entering extended mode
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 20.11 Portable)
entering extended mode
[STATUS]  make4ht: Conversion finished

Update 3: (minimal non-working example)

LaTeX file: LaTeX2Html.tex

documentclass[a4paper]{article}
usepackage{graphicx}

begin{document}

    begin{figure}[htbp]%
        centering
        includegraphics[width=0.8columnwidth]{Images/myPicture.png}%
        caption{}%
        label{}%
    end{figure}

end{document}

Image in the subfolder ImagesmyPicture.png

enter image description here

Result:

  • HTML is generated
  • one image in the main directory called LaTeX2Html0x.png, but size 1 kB and empty.

Output:

...
System call: dvipng -T tight -D 144 -bg Transparent -pp 2:2 LaTeX2Html.idv -o LaTeX2Html0x.png
This is dvipng 1.16 Copyright 2002-2015, 2019 Jan-Ake Larsson
[2dvipng warning: at (1,109) unimplemented special{em: graph Images/myPicture.png,72bp,72bp} ]
System return: 0
...

However, pdflatex to generate a PDF works fine.

Update 5:
During the compilation I found a message, maybe this will give a hint?!

....
l.10 --- TeX4ht warning --- File `"Images/myPicture.xbb"' not found ---
l.10 --- TeX4ht warning --- Cannot determine size of graphic in "Images/myPictu
re.xbb" (no BoundingBox) ---
...

What is the extension .xbb?
If I rename the .png to .xbb, only the message no bounding box will remain. Do I need to have .eps files instead?

Update 6: (the output when running make4ht -m draft -a debug LaTeX2Html.tex)

[INFO]    mkparams: Output dir:
[INFO]    mkparams: Compiler: latex
[INFO]    mkparams: Latex options: -jobname=LaTeX2Html
[INFO]    mkparams: tex4ht.sty: xhtml,,charset=utf-8
[INFO]    mkparams: tex4ht:  -cmozhtf -utf8
[INFO]    mkparams: build_file: LaTeX2Html.mk4
[INFO]    mkparams: Output format: html5
[STATUS]  make4ht: Conversion started
[STATUS]  make4ht: Input file: LaTeX2Html.tex
[INFO]    mkutils: Load extension       common_domfilters
[INFO]    mkutils: Cannot open config file      LaTeX2Html.mk4
[INFO]    make4ht-lib: setting param correct_exit
[INFO]    make4ht-lib: setting param ext
[INFO]    make4ht-lib: Adding:  ext     dvi
[INFO]    htlatex: LaTeX call: latex --interaction=errorstopmode -jobname=LaTeX2Html   makeatletterdefHCode{futureletHCodeHChar}defHChar{ifx"HCodedefHCode"##1"{Link##1}expandafterHCodeelseexpandafterLinkfi}defLink#1.a.b.c.{g@addto@macro@documentclasshook{RequirePackage[#1,html]{tex4ht}}letHCodedocumentstyledefdocumentstyle{letdocumentstyleHCodeexpandafterdefcsname tex4htendcsname{#1,html}defHCode####1{documentstyle[tex4ht,}@ifnextchar[{HCode}{documentstyle[tex4ht]}}}makeatotherHCode xhtml,,charset=utf-8,html5.a.b.c.input "detokenize{LaTeX2Html.tex}"
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 20.11 Portable)
entering extended mode
LaTeX2e <2018-12-01>
(LaTeX2Html.tex
(C:UsersxxxProgramstexmfsinstalltex/latex/basearticle.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(C:UsersxxxProgramstexmfsinstalltex/latex/basesize10.clo))
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4httex4ht.sty)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4htusepackage.4ht)
(C:UsersxxxProgramstexmfsinstalltex/latex/graphicsgraphicx.sty
(C:UsersxxxProgramstexmfsinstalltex/latex/graphicskeyval.sty)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4htusepackage.4ht)
(C:UsersxxxProgramstexmfsinstalltex/latex/graphicsgraphics.sty
(C:UsersxxxProgramstexmfsinstalltex/latex/graphicstrig.sty)
(C:UsersxxxProgramstexmfsinstalltex/latex/graphics-cfggraphics.cfg)
(C:UsersxxxProgramstexmfsinstalltex/latex/graphics-defdvips.def)))
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4httex4ht.4ht
::::::::::::::::::::::::::::::::::::::::::
TeX4ht info is available in the log file
::::::::::::::::::::::::::::::::::::::::::
) (C:UsersxxxProgramstexmfsinstalltex/generic/tex4httex4ht.sty
--- needs --- tex4ht LaTeX2Html ---
(LaTeX2Html.tmp) (LaTeX2Html.xref)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4htunicode.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4-math.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml5.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4htunicode.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4-math.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml5.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4htunicode.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4-math.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml5.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4htlatex.4ht
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4htunicode.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4-math.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml5.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4htunicode.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4-math.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml5.4ht))
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4htfontmath.4ht
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4htunicode.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4-math.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml5.4ht))
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4htarticle.4ht
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4htunicode.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4-math.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml5.4ht))
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4htgraphicx.4ht
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4htunicode.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4-math.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml5.4ht))
(graphics.4ht
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4htunicode.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4-math.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml5.4ht))
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4htdvips.4ht
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4htunicode.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4-math.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml5.4ht))
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4htunicode.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml4-math.4ht)
(C:UsersxxxProgramstexmfsinstalltex/generic/tex4hthtml5.4ht))
(LaTeX2Html.aux) [1] [2]
l.10 --- TeX4ht warning --- File `"Images/myPicture.xbb"' not found ---
l.10 --- TeX4ht warning --- Cannot determine size of graphic in "Images/myPictu
re.xbb" (no BoundingBox) ---
<Images/myPicture.png> [3] [4] (LaTeX2Html.aux) )
(end occurred inside a group at level 1)

### semi simple group (level 1) entered at line 6 (begingroup)
### bottom level
Output written on LaTeX2Html.dvi (4 pages, 10840 bytes).
Transcript written on LaTeX2Html.log.
[INFO]    make4ht-lib: executing: tex4ht  -cmozhtf -utf8 "LaTeX2Html.dvi"
----------------------------
tex4ht.c (2018-07-03-10:36 Windows MiKTeX)
tex4ht -cmozhtf
-utf8
LaTeX2Html.dvi
(C:/Users/xxx/Programs/texmfs/install/tex4ht/base/win32/tex4ht.env)
(C:/Users/xxx/Programs/texmfs/install/tex4ht/ht-fonts/mozilla/charset/unicode.4hf)
(C:/Users/xxx/Programs/texmfs/install/fonts/tfm/public/cm/cmr10.tfm)
(C:/Users/xxx/Programs/texmfs/install/tex4ht/ht-fonts/alias/lm/lm-rep-cmrm/cmr.htf)
Searching `lm-rep-cmrm.htf' for `cmr10.htf'
(C:/Users/xxx/Programs/texmfs/install/tex4ht/ht-fonts/unicode/lm/lm-rep-cmrm.htf)
[1 file LaTeX2Html.html
file LaTeX2Html.css
file LaTeX2Html.tmp
] [2] [3 file LaTeX2Html.tmp
] [4]
Execute script `LaTeX2Html.lg'

[INFO]    make4ht-lib: executing: t4ht  "LaTeX2Html.dvi"
This is dvipng 1.16 Copyright 2002-2015, 2019 Jan-Ake Larsson
[2dvipng warning: at (1,109) unimplemented special{em: graph Images/myPicture.png,72bp,72bp} ]
----------------------------
t4ht.c (2018-07-04-14:25 MiKTeX)
t4ht LaTeX2Html.dvi
(C:/Users/xxx/Programs/texmfs/install/tex4ht/base/win32/tex4ht.env)
Entering LaTeX2Html.lg
System call: dvipng -T tight -D 144 -bg Transparent -pp 2:2 LaTeX2Html.idv -o LaTeX2Html0x.png
System return: 0
Entering LaTeX2Html.css
Entering LaTeX2Html.tmp

[INFO]    mkutils: Parse LG
[INFO]    make4ht-lib: parse_lg process file: LaTeX2Html.html
[INFO]    make4ht-lib: parse_lg process file: LaTeX2Html.html
[INFO]    make4ht: outdir:
[INFO]    make4ht-lib: parse_lg process file: LaTeX2Html.css
[INFO]    make4ht: outdir:
[INFO]    make4ht-lib: parse_lg process file: LaTeX2Html.tmp
[INFO]    make4ht-lib: tmp file
[INFO]    make4ht-lib: parse_lg process file: LaTeX2Html0x.png
[INFO]    make4ht: outdir:
[STATUS]  make4ht: Conversion finished

One Answer

Thank you @Ulrike Fischer and @michal.h21 for your suggestions and patience.

Rule number 1: Make sure you have an up-to-date installation!

However, I was trusting the MiKTeX package manager (mpm) , but apparently something else was messed up with the MiKTeX installation. I can't really tell what and why. Hence, I used mpm to deinstall MiKTeX and installed it from scratch and again as portable version. Maybe, as @Ulrike Fischer, says there was another installation, which I couldn't locate on the system. Apparently, this solved the problem with outdated files and the missing images. Now, all images are included in the HTML file, but some are distorted (probably, because of some default size settings), but this is again another issue. Addition: A solution to this can be found in an answer from @michal.h21.

Correct answer by theozh on June 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP