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' 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
dvipng
message 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.\special{em: graph ...}
should be, I don't use such a command (myself). Is something wrong with the subdirectoryImages/
? I read once thathyperref
could be problematic. Tomorrow, I will update MiKTeX and try to create a complete minimal example.\includegraphics[width=0.8\columnwidth]{Images/myPicture}