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.8\columnwidth]{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:
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.8\columnwidth]{Images/myPicture.png}%
\caption{}%
\label{}%
\end{figure}
\end{document}
Image in the subfolder Images\myPicture.png
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 \makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g@addto@macro\@documentclasshook{\RequirePackage[#1,html]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}\makeatother\HCode 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:\Users\xxx\Programs\texmfs\install\tex/latex/base\article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(C:\Users\xxx\Programs\texmfs\install\tex/latex/base\size10.clo))
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\tex4ht.sty)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\usepackage.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/latex/graphics\graphicx.sty
(C:\Users\xxx\Programs\texmfs\install\tex/latex/graphics\keyval.sty)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\usepackage.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/latex/graphics\graphics.sty
(C:\Users\xxx\Programs\texmfs\install\tex/latex/graphics\trig.sty)
(C:\Users\xxx\Programs\texmfs\install\tex/latex/graphics-cfg\graphics.cfg)
(C:\Users\xxx\Programs\texmfs\install\tex/latex/graphics-def\dvips.def)))
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\tex4ht.4ht
::::::::::::::::::::::::::::::::::::::::::
TeX4ht info is available in the log file
::::::::::::::::::::::::::::::::::::::::::
) (C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\tex4ht.sty
--- needs --- tex4ht LaTeX2Html ---
(LaTeX2Html.tmp) (LaTeX2Html.xref)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\unicode.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4-math.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html5.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\unicode.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4-math.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html5.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\unicode.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4-math.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html5.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\latex.4ht
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\unicode.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4-math.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html5.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\unicode.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4-math.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html5.4ht))
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\fontmath.4ht
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\unicode.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4-math.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html5.4ht))
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\article.4ht
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\unicode.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4-math.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html5.4ht))
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\graphicx.4ht
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\unicode.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4-math.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html5.4ht))
(graphics.4ht
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\unicode.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4-math.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html5.4ht))
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\dvips.4ht
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\unicode.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4-math.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html5.4ht))
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\unicode.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html4-math.4ht)
(C:\Users\xxx\Programs\texmfs\install\tex/generic/tex4ht\html5.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' forcmr10.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


dvipngmessage you got seems strange. Could you please post a complete sample document? The most important part are the used packages, maybe some of them changes the image handling. – michal.h21 Dec 08 '20 at 16:49\special{em: graph ...}should be, I don't use such a command (myself). Is something wrong with the subdirectoryImages/? I read once thathyperrefcould be problematic. Tomorrow, I will update MiKTeX and try to create a complete minimal example. – theozh Dec 08 '20 at 18:37\includegraphics[width=0.8\columnwidth]{Images/myPicture}– vaettchen Dec 08 '20 at 19:30myPicture.pngandmyPicture.pdfor another format in the directory which one would it have taken? – theozh Dec 09 '20 at 06:56\includegraphicsissues are much older, so they should be included. I think we will need to see the full MWE in this case, it can be really caused by some package. – michal.h21 Dec 09 '20 at 08:59graphics.4htfrom that answer can fix this issue. – michal.h21 Dec 09 '20 at 09:34graphics.4htinto the same directory asLaTeX2Html.tex. Same result, same output, no images. Actually, how will this file be called? Do I have to somehow include it intoLaTeX2Html.tex? – theozh Dec 09 '20 at 09:41\usepackage{graphicx}or\usepackage{graphics}? The latter will lead to an error when compling withpdflatex:Paragraph ended before \Gin@iii was complete.This is getting pretty painful and annoying. – theozh Dec 09 '20 at 09:45.4htfile will be called automatically by TeX4ht, you don't need to include it in your TeX file. This issue is indeed strange. Can you runmake4ht -m draft -a debug LaTeX2Html.texand post the full terminal outut? Or at least the log file? – michal.h21 Dec 09 '20 at 10:03.xbbfile can be created using theebb -x Images/myPicture.pngcommand. It contains the image dimensions. It probably won't help with the underlying issue, but it may help with the image appearance when the conversion works. – michal.h21 Dec 09 '20 at 10:04article 2018/09/03 v1.4i, while the current version isarticle 2020/04/10 v1.4m. This clearly indicates that your system is not up-to-date. – Ulrike Fischer Dec 09 '20 at 10:16article.clsand try again. – theozh Dec 09 '20 at 10:19mpmis not the right tool for updating? Can I somehow use it wrongly? It said it did 97 updates. What else then? Manual update of all packages and files? – theozh Dec 09 '20 at 10:25LaTeX2e <2018-12-01>. And that is old. I have latex 2020-10-01. So accept that something is wrong and try to find a clue what. You are using a portable miktex and so it is e.g. quite possible that you actually have two miktex installations around. Install for example a random package and look where it goes. – Ulrike Fischer Dec 09 '20 at 10:50