tex 文件的序言:
%% LyX 2.3.3 创建了此文件。有关更多信息,请参阅http://www.lyx.org/. %%除非您确实知道自己在做什么,否则请不要编辑。
\documentclass[letterpaper,oneside,english,oldfontcommands]{memoir}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{amsmath}
\usepackage{graphicx}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\special{papersize=\the\paperwidth,\the\paperheight}
\makeatother
\usepackage{babel}
\begin{document}
**The latex code block dealing with including graphics:**
\begin{figure}
\centering
\includegraphics[scale=0.5]{Integration.png}
%\par\end{centering}
\end{figure}
**The tex4ebook command when executed goes like this:**
tex4ebook -s test2.tex -f epub3 mathml
[STATUS] tex4ebook: Conversion started
[STATUS] tex4ebook: Input file: test2.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7250 64-bit)
entering extended mode
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7250 64-bit)
entering extended mode
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7250 64-bit)
entering extended mode
**dvipng: Fatal error, PK file C:\Users\srirams05\AppData\Local\MiKTeX\2.9\fonts/pk/cx/jknappen/ec/dpi576\ecrm1000.pk ends prematurely**
1 file(s) copied.
1 file(s) copied.
1 file(s) copied.
1 file(s) copied.
The system cannot find the file specified.
1 file(s) copied.
HTML Tidy for Windows released on 25 March 2009
1 file(s) copied.
[STATUS] tex4ebook: Conversion finished
唯一的问题EPUB
是缺少图形。如果LaTeX
删除上面处理图形的代码块,则不会出现问题……我怀疑问题出在dvipng
和MikTeX
……
我正在使用tex4ebook
提供的MikTex 2.9。
答案1
看来 PNG 文件被错误识别了,TeX4ht 试图将其作为 EPS 文件包含。这导致调用dvipng
。尝试将此文件放入graphics.4ht
您的文档目录中:
% graphics.4ht (2019-11-25-09:03), 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\grf:removequote"#1"{#1}
\def\grf:thrashname#1\relax{}
\def\grf:fixquotes{%
\@ifnextchar"{\edef\Gin@base{\expandafter\grf:removequote\Gin@base}\grf:thrashname}{\grf:thrashname}}
\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\:tempc\Gin@setfile
\pend:defIII\:tempc{\a:graphics
\global\let\noBoundingBox\:UnDef
\let\@latex@error\grp:warning \let\@ehc\empty}
\append:defIII\:tempc{\b:graphics\grf:gobble\leavevmode grf:gobble}
\HLet\Gin@setfile\:tempc
\NewConfigure{graphics*}[2]{%
\expandafter\ifx \csname :.#1\endcsname\relax
\pend:defIII\n:Gin@setfile:{\csname :.#1\endcsname}%
\fi
\def\:temp{#2}\ifx \:temp\empty
\expandafter\let\csname :.#1\endcsname\:UnDef
\else
\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 }
\NewConfigure{graphics}{2}
\def\grf:gobble#1\leavevmode#2grf:gobble{%
\PictureOff\expandafter\grf:fixquotes\Gin@base\relax#1\PictureOn \G:cnfg \let\G:cnfg\relax}
\let\G:cnfg\relax
\let\old:GreadEps\Gread@eps
\def\Gread@eps#1{\old:GreadEps{"#1"}}
\def\if:boundingbox#1#2{\ifdim\Gin@req@width=\Gin@nat@width\ifx\noBoundingBox\UnDefined#1\else#2\fi\else#1\fi}
\Hinput{graphics}
\endinput
它是负责图形包含的当前代码。
答案2
我也遇到过丢失图像的情况,但问题的根源完全不同。似乎 tex4ebook (v0.3g,ubuntu) 几乎但并未完全处理图像的相对目录。图像../maps
与 .tex 文件相关,tex4ebook 命令留下了一个目录,该目录似乎是它用于创建最终压缩.epub
文件的输出。在该目录中,它已经有一个maps
位于正确位置的目录,但它尚未包含在最终文件中。因此,以下命令将文件夹添加到 epub 并修复了最终文件:
zip -ur mybook.epub maps
此后,图像在亚马逊预览器中看起来很好。