我收到了错误
Overfull \vbox (22903.01811pt too high) detected at line 2038
! Dimension too large.
\n:LT@start: ...\ifdim \ht \@arstrutbox >\ht \tw@
\@arstrutbox \else \tw@ \f...
作为使用 tex4ht 编译非常大的 Latex 文件的一部分,这发生在longtable
我花了很长时间将其简化为尽可能最小的例子。
MWE 仍然太大而无法发布,因为它发生在很长一段时间内 longtable
。因此,在这篇文章的最后,我在我的页面上提供了 zip 文件链接,用于下载名为 latex 的文件KERNEL.tex
及其生成的日志文件。
使用 tex4ht 并使用命令进行编译
make4ht -ulm default -a debug KERNEL.tex "htm"
给出错误
make4ht -ulm default -a debug KERNEL.tex "htm"
[INFO] mkparams: Output dir:
[INFO] mkparams: Compiler: dvilualatex
[INFO] mkparams: Latex options: -jobname=KERNEL
[INFO] mkparams: tex4ht.sty: xhtml,htm,charset=utf-8
[INFO] mkparams: tex4ht: -cmozhtf -utf8
[INFO] mkparams: build_file: KERNEL.mk4
[INFO] mkparams: Output format: html5
[STATUS] make4ht: Conversion started
[STATUS] make4ht: Input file: KERNEL.tex
[INFO] mkutils: Load extension common_domfilters
[INFO] mkutils: Cannot open config file KERNEL.mk4
[INFO] make4ht-lib: setting param correct_exit
[INFO] make4ht-lib: setting param correct_exit
[INFO] make4ht-lib: setting param correct_exit
[INFO] make4ht-lib: setting param ext
[INFO] make4ht-lib: Adding: ext dvi
[INFO] htlatex: LaTeX call: dvilualatex --interaction=errorstopmode -jobname=KERNEL '\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,htm,charset=utf-8,html5.a.b.c.\input "\detokenize{KERNEL.tex}"'
This is LuaTeX, Version 1.13.2 (TeX Live 2021)
restricted system commands enabled.
LaTeX2e <2021-06-01> patch level 1
L3 programming layer <2021-08-27> (./KERNEL.tex
(/usr/local/texlive/2021/texmf-dist/tex/latex/base/article.cls
.......
l.2019 --- TeX4ht warning --- \Link{subsubsection 199}? ---
l.2029 --- TeX4ht warning --- \Link{subsubsection 200}? ---
Overfull \vbox (22903.01811pt too high) detected at line 2038
! Dimension too large.
\n:LT@start: ...\ifdim \ht \@arstrutbox >\ht \tw@
\@arstrutbox \else \tw@ \f...
l.2038 \\\hline
? X
971873 words of node memory still in use:
14934 hlist, 458 vlist, 2076 rule, 2128 disc, 2418 local_par, 1 dir, 840 mat
h, 37921 glue, 5047 kern, 7775 penalty, 45259 glyph, 15325 attribute, 75 glue_s
pec, 15325 attribute_list, 1 if_stack, 413 write, 25686 special nodes
avail lists: 1:1,2:6,3:17,4:11,5:1,6:1,7:17,8:52,9:7,10:10
No pages of output.
Transcript written on KERNEL.log.
[FATAL] make4ht-lib: Fatal error. Command htlatex returned exit code 1
使用编译没有问题lualatex KERNEL.tex
我现在还更新了我的 TL 安装,以确保我的 Linux 系统上有最新版本。
仅使用 tex4ht 时才会出现此问题。mathjax
如上述命令所示,当模式或默认模式 (png) 时,就会出现此问题。
为什么会发生此错误?有解决方法吗?
请在此处找到 zip 文件(安全链接。这是我自己的页面)
更新
我刚刚在 Linux 机器上编译了同一个文件,使用的是 TL 2019,我已经两年没有更新了。在这个 TL 上,没有错误。
make4ht -ulm default -a debug KERNEL.tex "htm"
[INFO] mkparams: Output dir:
[INFO] mkparams: Compiler: dvilualatex
[INFO] mkparams: Latex options: -jobname=KERNEL
[INFO] mkparams: tex4ht.sty: xhtml,htm,charset=utf-8
[INFO] mkparams: tex4ht: -cmozhtf -utf8
[INFO] mkparams: build_file: KERNEL.mk4
[INFO] mkparams: Output format: html5
[STATUS] make4ht: Conversion started
[STATUS] make4ht: Input file: KERNEL.tex
[INFO] mkutils: Load extension common_domfilters
[INFO] mkutils: Cannot open config file KERNEL.mk4
[INFO] make4ht-lib: setting param correct_exit
[INFO] make4ht-lib: setting param correct_exit
[INFO] make4ht-lib: setting param correct_exit
[INFO] make4ht-lib: setting param ext
[INFO] make4ht-lib: Adding: ext dvi
[INFO] htlatex: LaTeX call: dvilualatex --interaction=errorstopmode -jobname=KERNEL '\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,htm,charset=utf-8,html5.a.b.c.\input "\detokenize{KERNEL.tex}"'
This is LuaTeX, Version 1.10.0 (TeX Live 2019)
restricted system commands enabled.
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-02-25> (./KERNEL.tex
...
avail lists: 2:5756,3:3677,4:11,5:634,6:298,7:9571,8:52,9:2195,10:10,11:297
Output written on KERNEL.dvi (21 pages, 372860 bytes).
Transcript written on KERNEL.log.
[INFO] make4ht-lib: executing: tex4ht -cmozhtf -utf8 "KERNEL.dvi"
--- warning --- Too many rows (> 146) for map: `&'
----------------------------
tex4ht.c (2018-07-03-10:36 kpathsea)
tex4ht -cmozhtf
-utf8
KERNEL.dvi
....
INFO] make4ht-lib: parse_lg process file: KE65x.png
[INFO] make4ht: outdir:
[INFO] make4ht-lib: parse_lg process file: KE66x.png
[INFO] make4ht: outdir:
[STATUS] make4ht: Conversion finished
>
编译没有错误。但注意到
--- warning --- Too many rows (> 146) for map: `&'
以上。这也许可以解释为什么它在最新的 TL 2021 中失败了。
答案1
编辑:
看来.cfg 文件是不够的,您需要更新的longtable.4ht
文件:
% longtable.4ht (2021-09-27-10:15), generated from tex4ht-4ht.tex
% Copyright 1997-2009 Eitan M. Gurari
% Copyright 2009-2021 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.
\immediate\write-1{version 2021-09-27-10:15}
\def\:tempc[#1]#2{%
\gHAdvance\float:cnt 1
\gHAssign\capt:cnt0
\hbox{\def\flt:anchor{}\get:cptg}%
%
\def\Clr{#2}\a:VBorder
\HAssign\ar:cnt0
\let\HAlign\empty
%
\def\aa:longtable{%
\gdef\aa:longtable{\let\HRow\lt:sv
\HAdvance\HRow by 1 \global\let\:MkHalign:\lt:MkHalign:}%
\global\setbox\LT:box\vbox{\a:longtable}%
\global\let\lt:MkHalign:\:MkHalign:}%
\def\bb:longtable{%
\ifHCond \global\let\bb:longtable\empty
\global\setbox\LT:ebox=\vbox{{\ht:everypar{}\leavevmode}\b:longtable}%
\global\HCondfalse
\fi}
%
\refstepcounter{table}\stepcounter{LT@tables}%
\if l#1%
\LTleft\z@ \LTright\fill
\else\if r#1%
\LTleft\fill \LTright\z@
\else\if c#1%
\LTleft\fill \LTright\fill
\fi\fi\fi
\let\LT@mcol\multicolumn
\let\LT@@tabarray\@tabarray
\let\LT@@hl\hline
\def\@tabarray{%
\let\hline\LT@@hl
\LT@@tabarray}%
\let\\\LT@tabularcr\let\tabularnewline\\%
\let\newpage\empty
\let\pagebreak\empty
\let\nopagebreak\empty
%
\let\hline\LT@hline \let\kill\LT@kill\let\caption\LT@caption
\@tempdima\ht\strutbox
\let\@endpbox\LT@endpbox
\ifx\extrarowheight\@undefined
\let\@acol\@tabacol
\let\@classz\@tabclassz \let\@classiv\@tabclassiv
\def\@startpbox{\vtop\LT@startpbox}%
\let\@@startpbox\@startpbox
\let\@@endpbox\@endpbox
\let\LT@LL@FM@cr\@tabularcr
\else
\advance\@tempdima\extrarowheight
\col@sep\tabcolsep
\let\@startpbox\LT@startpbox\let\LT@LL@FM@cr\@arraycr
\fi
\setbox\@arstrutbox\hbox{}%
\let\@sharp##\let\protect\relax
\begingroup
\@mkpream{#2}%
\xdef\LT@bchunk{%
\global\advance\c@LT@chunks\@ne
\global\LT@rows\z@\setbox\z@\vbox\bgroup
\LT@setprevdepth
\everycr{}\tabskip\LTleft\noexpand\MkHalign\noexpand\@sharp
{\tabskip\z@ \@arstrut \@preamble \tabskip\LTright}%
}%
\tmp:cnt=0
\global\let\:tempa\empty
\loop\ifnum \ar:cnt>\tmp:cnt
\advance\tmp:cnt by 1
\expandafter\ifx \csname @testpach \the\tmp:cnt\endcsname\relax
\else
\xdef\:tempa{%
\:tempa
\def \expandafter\noexpand
\csname @testpach \the\tmp:cnt\endcsname{\csname @testpach
\the\tmp:cnt\endcsname}}%
\expandafter\let\csname @testpach \the\tmp:cnt\endcsname\relax
\fi
\repeat
\aftergroup\:tempa
\xdef\:temp{%
\def\noexpand\HAlign{\HAlign}%
\def\noexpand\ar:cnt{\ar:cnt}}\aftergroup\:temp
%
\endgroup
\LT@cols\ar:cnt
%
\LT@make@row
\m@th\let\par\@empty
\everycr{}\lineskip\z@\baselineskip\z@
\ifx \EndPicture\:UnDef
\SaveMkHalignConfig \ifx \recall:ar\:UnDef
\edef\recall:ar{%
\noexpand\ifx \noexpand\EndPicture\noexpand\:UnDef \noexpand\else
\arrayrulewidth\the\arrayrulewidth
\doublerulesep\the\doublerulesep
\arraycolsep\the\arraycolsep
\tabcolsep\the\tabcolsep
\noexpand\fi }%
\fi
\arrayrulewidth\z@ \doublerulesep\z@
\arraycolsep\z@ \tabcolsep\z@
\Configure{MkHalign}
\aa:longtable
{\bb:longtable \ProperTrTrue}
{\a:putHBorder\InitHBorder \ifProperTr{\c:longtable}}
{\ifProperTr{\d:longtable}\a:putHBorder\InitHBorder}%
{\ifProperTr{\e:longtable}\RecallMkHalignConfig\recall:ar}
{\ifProperTr{\f:longtable}}
%
\let\@sharp\relax
\else \let\@sharp##\fi
\LT@bchunk}
\HLet\LT@array\:tempc
\def\:tempc{%
\crcr\LT@save@row\cr
\ifx \EndPicture\:UnDef \EndMkHalign\else \egroup\fi
%
\global\setbox\@ne\lastbox \unskip
\egroup}
\HLet\LT@echunk\:tempc
\let\:tempc\LT@startpbox
\append:defI\:tempc{\everypar{\HtmlPar}\a:longtableparbox}%
\HLet\LT@startpbox\:tempc
\NewConfigure{longtableparbox}{1}
\NewConfigure{longtable}{6}
\csname newbox\endcsname\LT:box
\csname newbox\endcsname\LT:ebox
\def\:tempc{%
\ifvoid\LT@head\else
\ifvoid\LT@firsthead
\global\setbox\LT@firsthead=\hbox{\box\LT@head}%
\else
\global\setbox\tmp:bx=\hbox{\box\LT@head}%
\fi\fi%
\box\LT:box%
\ifvoid\LT@firsthead\copy\LT@head\else\box\LT@firsthead\fi\nobreak
\output{\LT@output}
}
\HLet\LT@start\:tempc
\let\:tempc\endlongtable
\append:def\:tempc{\box\LT:ebox}
\pend:def\:tempc{\global\HCondtrue}
\HLet\endlongtable\:tempc
\let\:tempc\LT@ntabularcr
\pend:def\:tempc{\global\let\lt:sv\HRow}
\HLet\LT@ntabularcr\:tempc
\let\:tempc\LT@end@hd@ft
\pend:defI\:tempc{\global\let\lt:sv\HRow}
\HLet\LT@end@hd@ft\:tempc
%\def\:tempc{\global\let\lt:sv\HRow}
%\HLet\LT@kill\:tempc
\def\LT@rebox#1\bgroup{%
#1\bgroup
\unskip
}
\let\:tempc\LT@kill
\pend:def\:tempc{\global\let\lt:sv\HRow}
\HLet\LT@kill\:tempc
\let\LT:argtabularcr\LT@argtabularcr
\def\:tempc{\global\let\lt:sv\HRow \LT:argtabularcr}
\HLet\LT@argtabularcr\:tempc
\ifx \tmp:bx\:UnDef \csname newbox\endcsname \tmp:bx \fi
%\def\:tempc{\LT@end@hd@ft\tmp:bx}
%\HLet\endhead\:tempc
% \def\:tempc{\LT@end@hd@ft\tmp:bx}
% \HLet\endfoot\:tempc
\pend:def\LT@output{%
\ifvoid\LT@foot\else
\ifvoid\LT@lastfoot
\global\setbox\LT@lastfoot=\hbox{\box\LT@foot}%
\else
\global\setbox\tmp:bx=\hbox{\box\LT@foot}%
\fi\fi
}
\def\:tempc{\global\HCondtrue \LT@end@hd@ft\LT@lastfoot}
\HLet\endlastfoot\:tempc
\def\LT@tabularcr{%
\relax\iffalse{\fi\ifnum0=`}\fi
\@ifstar
{\LT@t@bularcr}%
{\LT@t@bularcr}}
\def\:tempc{%
\o:noalign:{\ifnum0=`}\fi
\penalty\@M
\futurelet\@let@token\LT@@hline}
\HLet\LT@hline\:tempc
\def\:tempc{%
\ifx\@let@token\hline
\global\let\@gtempa\@gobble
\gdef\LT@sep{\penalty-\@medpenalty\vskip\doublerulesep}%
\else
\global\let\@gtempa\@empty
\gdef\LT@sep{\penalty-\@lowpenalty\vskip-\arrayrulewidth}%
\fi
\ifnum0=`{\fi}%
\a:hline
%
\o:noalign:{\penalty\@M}%
\@gtempa}
\HLet\LT@@hline\:tempc
\def\:tempc{%
\o:noalign:\bgroup \gHAdvance\TitleCount 1
\@ifnextchar[{\egroup\LT@c@ption\@firstofone}\LT@capti@n}
\HLet\LT@caption\:tempc
\def\:tempc#1#2#3{%
\LT@mcol\LT@cols c{\hbox{\parbox[t]\LTcapwidth{%
\cptA: #1{\cap:ref{#2}}\if\relax\detokenize{#1}\relax\else\cptB:\fi\cptC:#3\cptD:
\endgraf\vskip\baselineskip}}}}
\HLet\LT@makecaption\:tempc
\def\:tempc#1[#2]#3{%
\LT@makecaption#1\fnum@table{#3}%
\cur:lbl{}%
\def\@tempa{#2}%
\ifx\@tempa\@empty\else%
{\let\\\space%
\protect:wrtoc%
\edef\:temp{#2}%
\edef\:temp{\the\:tokwrite{\string\doTocEntry%
\string\toclot%
{\thetable}{\string\csname\space a:TocLink\string\endcsname%
{\FileNumber}{\cur:th \:currentlabel}{}{\ifx\:temp\empty\else \ignorespaces #2\fi}}%
{}\relax}}\:temp%
}%
\fi%
}
\HLet\LT@c@ption\:tempc
\Hinput{longtable}
\endinput
您的表格似乎太高了,这可能是由于它没有像正常的 LaTeX 运行那样分成几页。作为一种解决方法,我们可以重新定义放置表格行的代码以省略维度检查,因为它似乎对 TeX4ht 没什么用。
尝试这个配置文件:
\def\LT@start{%
\ifvoid\LT@firsthead\copy\LT@head\else\box\LT@firsthead\fi\nobreak
\output{\LT@output}
}
\Preamble{xhtml}
\begin{document}
\EndPreamble
我必须将 的重新定义放在命令\LT@start
之前\Preamble
,因为longtable.4ht
也会修补此命令。如果我们将其放在 之后\Preamble
,此修补将失败。
经过此更改后,您的文件可以顺利编译,除了 DOM 解析失败之外。事实证明,由于您在表中使用了以下代码,您的文件产生了无效的 HTML 代码:
\ifdefined\HCode\hyperlink{subsubsection 1}\else \hyperlink{subsection 1}\fi{ODE 1} &
我会使用自定义命令,如下所示:
\newcommand\sectionlink[2]{\ifdefined\HCode\hyperlink{subsubsection #1}{#2}\else\hyperlink{subsection #1}{#2}\fi}
经过这一改变,它就可以正常工作了。
这是一个较小的测试:
\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{xcolor}% http://ctan.org/pkg/color
\usepackage[colorlinks,allcolors=blue,linktocpage,bookmarks,bookmarksdepth=3]{hyperref}
\usepackage{bookmark}%added may 26,2020 to get rid of
\hypersetup{%
colorlinks=false,% hyperlinks will be black
urlbordercolor=blue%
}
\usepackage{pifont} %http : // ctan.org/pkg/pifont
\newcommand{\cmark}{\ding{51}} %
\newcommand{\xmark}{\ding{55}} %
\usepackage{longtable}
\usepackage{listings,lstautogobble}% added lstautogobble oct 30,2020
\newcommand\sectionlink[2]{\ifdefined\HCode\hyperlink{subsubsection #1}{#2}\else\hyperlink{subsection #1}{#2}\fi}
\begin{document}
%%%%%%%%%%%%%%%%
\section{Detailed lookup table and classification for each ODE}
\begin{center}
\begin{longtable}{|l|p{5 in}|}\hline
\caption{ODE classification and performance for each differential equation}\label{table:4} \\\hline
%---------------------------------------
\#&result\\\hline
\endfirsthead
%------------------------------------
\multicolumn{2}{c}{\tablename\ \thetable{} -- continued from previous page} \\\hline
\#&result\\\hline
\endhead\hline
\multicolumn{2}{|r|}{Continued on next page} \\ \hline
\endfoot\hline
\endlastfoot
% \ifdefined\HCode\hyperlink{subsubsection 1}\else \hyperlink{subsection 1}\fi{ODE 1}&
\sectionlink{1}{ODE 1} &
$y'(x)=a f(x)$
\begin{lstlisting}
[_quadrature]
\end{lstlisting}
\underline{Solution method} Separable ODE, Dependent variable missing\newline
Maple \textcolor{blue}{\Large \cmark}\newline Mathematica \textcolor{blue}{\Large \cmark}
\\\hline
% \ifdefined\HCode\hyperlink{subsubsection 2}\else \hyperlink{subsection 2}\fi{ODE 2}&
\sectionlink{2}{ODE 2} &
$y'(x)=y(x)+x+\sin (x)$
\begin{lstlisting}
[[_linear, `class A`]]
\end{lstlisting}
\underline{Solution method} Linear ODE\newline
Maple \textcolor{blue}{\Large \cmark}\newline Mathematica \textcolor{blue}{\Large \cmark}
\\\hline
\end{longtable}
\end{center}
\end{document}
结果如下: