为什么在 TL 最新更新后,tex4ht 不再在表格中显示 \hline

为什么在 TL 最新更新后,tex4ht 不再在表格中显示 \hline

昨晚更新 Tex Live 2021 后,我发现 tex4ht 不再在表格中显示水平线。

这是为什么?以及如何让它们再次显示?

这是 MWE

\documentclass[12pt]{book}
\begin{document}

\begin{tabular}{|c|c|}\hline
A & B \\\hline 
C & D \\\hline 
\end{tabular}

\end{document}

使用编译

>make4ht -ulm default -a debug foo2.tex "htm"
[INFO]    mkparams: Output dir:
[INFO]    mkparams: Compiler: dvilualatex
[INFO]    mkparams: Latex options: -jobname=foo2
[INFO]    mkparams: tex4ht.sty: xhtml,htm,charset=utf-8
[INFO]    mkparams: tex4ht:  -cmozhtf -utf8
[INFO]    mkparams: build_file: foo2.mk4
[INFO]    mkparams: Output format: html5
[STATUS]  make4ht: Conversion started
[STATUS]  make4ht: Input file: foo2.tex
[INFO]    mkutils: Load extension       common_domfilters
[INFO]    mkutils: Cannot open config file      foo2.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=foo2   '\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{foo2.tex}"'
This is LuaTeX, Version 1.13.2 (TeX Live 2021)
....
Execute script `foo2.lg'

[INFO]    make4ht-lib: executing: t4ht  "foo2.dvi"
----------------------------
t4ht.c (2018-07-04-14:25 kpathsea)
t4ht foo2.dvi
(/usr/local/texlive/2021/texmf-dist/tex4ht/base/unix/tex4ht.env)
Entering foo2.lg
Entering foo2.css
Entering foo2.tmp

[INFO]    mkutils: Parse LG
[INFO]    make4ht-lib: parse_lg process file: foo2.htm
[INFO]    make4ht-lib: parse_lg process file: foo2.htm
[INFO]    make4ht: outdir:
[INFO]    make4ht-lib: parse_lg process file: foo2.css
[INFO]    make4ht: outdir:
[INFO]    make4ht-lib: parse_lg process file: foo2.tmp
[INFO]    make4ht-lib: tmp file
[STATUS]  make4ht: Conversion finished
>

给出这个 HTML

在此处输入图片描述

它生成的原始 HTML 是

<!DOCTYPE html> 
<html lang='en-US' xml:lang='en-US'> 
<head><title></title> 
<meta charset='utf-8' /> 
<meta content='TeX4ht (https://tug.org/tex4ht/)' name='generator' /> 
<meta content='width=device-width,initial-scale=1' name='viewport' /> 
<link href='foo2.css' rel='stylesheet' type='text/css' /> 
<meta content='foo2.tex' name='src' /> 
</head><body> 
<div class='tabular'> <table class='tabular' id='TBL-1'><colgroup id='TBL-1-1g'><col id='TBL-1-1' /></colgroup><colgroup id='TBL-1-2g'><col id='TBL-1-2' /></colgroup><tr class='hline'><td></td><td></td></tr><tr id='TBL-1-1-' style='vertical-align:baseline;'><td class='td11' id='TBL-1-1-1' style='white-space:nowrap; text-align:center;'>A</td><td class='td11' id='TBL-1-1-2' style='white-space:nowrap; text-align:center;'>B</td></tr><tr class='hline'><td></td><td></td></tr><tr id='TBL-1-2-' style='vertical-align:baseline;'><td class='td11' id='TBL-1-2-1' style='white-space:nowrap; text-align:center;'> C </td> <td class='td11' id='TBL-1-2-2' style='white-space:nowrap; text-align:center;'>D</td>
</tr><tr class='hline'><td></td><td></td></tr></table>
</div>   
 
</body> 
</html>

但是lualatex foo2.tex给出这个 PDF

>lualatex foo2.tex
This is LuaHBTeX, Version 1.13.2 (TeX Live 2021)
 restricted system commands enabled.
(./foo2.tex
LaTeX2e <2021-06-01> patch level 1
 L3 programming layer <2021-08-27>
(/usr/local/texlive/2021/texmf-dist/tex/latex/base/book.cls
Document Class: book 2021/02/12 v1.4n Standard LaTeX document class
(/usr/local/texlive/2021/texmf-dist/tex/latex/base/bk12.clo))
(/usr/local/texlive/2021/texmf-dist/tex/latex/l3backend/l3backend-luatex.def)
(./foo2.aux) (/usr/local/texlive/2021/texmf-dist/tex/latex/base/ts1cmr.fd)
[1{/usr/local/texlive/2021/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./foo2.aux))
 406 words of node memory still in use:
   3 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 4 attribute, 48 glue_spec
, 4 attribute_list, 1 write nodes
   avail lists: 2:58,3:4,4:1,5:23,6:2,7:112,8:1,9:56
</usr/local/texlive/2021/texmf-dist/fonts/opentype/public/lm/lmroman12-regular.
otf>
Output written on foo2.pdf (1 page, 3083 bytes).
Transcript written on foo2.log.
>

在此处输入图片描述

为了验证,我在未更新 texlive 的 Linux 上编译了相同的 tex 文件。使用与上述相同的命令。它给出了正确的输出

>make4ht -ulm default -a debug foo2.tex "htm"
[INFO]    mkparams: Output dir: 
[INFO]    mkparams: Compiler: dvilualatex
[INFO]    mkparams: Latex options: -jobname=foo2  
[INFO]    mkparams: tex4ht.sty: xhtml,htm,charset=utf-8
[INFO]    mkparams: tex4ht:  -cmozhtf -utf8
[INFO]    mkparams: build_file: foo2.mk4
[INFO]    mkparams: Output format: html5
[STATUS]  make4ht: Conversion started
[STATUS]  make4ht: Input file: foo2.tex
[INFO]    mkutils: Load extension   common_domfilters
[INFO]    mkutils: Cannot open config file  foo2.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=foo2   '\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{foo2.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> (./foo2.tex
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/book.cls
Document Class: book 2019/12/20 v1.4l Standard LaTeX document class
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/bk12.clo))
(/usr/local/texlive/2019/texmf-dist/tex/generic/tex4ht/tex4ht.sty)
(/usr/local/texlive/2019/texmf-dist/tex/generic/tex4ht/tex4ht.4ht
....

Execute script `foo2.lg'

[INFO]    make4ht-lib: executing: t4ht  "foo2.dvi"
----------------------------
t4ht.c (2018-07-04-14:25 kpathsea)
t4ht foo2.dvi 
(/usr/local/texlive/2019/texmf-dist/tex4ht/base/unix/tex4ht.env)
Entering foo2.lg
Entering foo2.css
Entering foo2.tmp

[INFO]    mkutils: Parse LG
[INFO]    make4ht-lib: parse_lg process file: foo2.htm
[INFO]    make4ht: outdir: 
[INFO]    make4ht-lib: parse_lg process file: foo2.css
[INFO]    make4ht: outdir: 
[INFO]    make4ht-lib: parse_lg process file: foo2.tmp
[INFO]    make4ht-lib: tmp file
[STATUS]  make4ht: Conversion finished

在此处输入图片描述

该系统上的原始 HTML 似乎没什么不同(尚未检查差异在哪里)

<!DOCTYPE html> 
<html lang="en-US" xml:lang="en-US" > 
<head><title></title> 
<meta  charset="utf-8" /> 
<meta name="generator" content="TeX4ht (http://www.tug.org/tex4ht/)" /> 
<meta name="viewport" content="width=device-width,initial-scale=1" /> 
<link rel="stylesheet" type="text/css" href="foo2.css" /> 
<meta name="src" content="foo2.tex" /> 
</head><body 
> 
<div class="tabular"> <table id="TBL-1" class="tabular" 
 
><colgroup id="TBL-1-1g"><col 
id="TBL-1-1" /></colgroup><colgroup id="TBL-1-2g"><col 
id="TBL-1-2" /></colgroup><tr 
class="hline"><td><hr /></td><td><hr /></td></tr><tr  
 style="vertical-align:baseline;" id="TBL-1-1-"><td  style="white-space:nowrap; text-align:center;" id="TBL-1-1-1"  
class="td11">A</td><td  style="white-space:nowrap; text-align:center;" id="TBL-1-1-2"  
class="td11">B</td></tr><tr 
class="hline"><td><hr /></td><td><hr /></td></tr><tr  
 style="vertical-align:baseline;" id="TBL-1-2-"><td  style="white-space:nowrap; text-align:center;" id="TBL-1-2-1"  
class="td11"> C </td> <td  style="white-space:nowrap; text-align:center;" id="TBL-1-2-2"  
class="td11">D</td>
</tr><tr 
class="hline"><td><hr /></td><td><hr /></td></tr><tr  
 style="vertical-align:baseline;" id="TBL-1-3-"><td  style="white-space:nowrap; text-align:center;" id="TBL-1-3-1"  
class="td11">  </td> 
</tr></table>
</div>   
 
</body> 
</html>

所以最近 tex4ht 中发生了一些变化,导致了这种情况。

参考https://puszcza.gnu.org.ua/bugs/index.php?528

答案1

这实际上是由 引起的make4ht。它会自动修复 HTML 代码中的一些问题,其中之一是它从表格中删除了水平线,假设它们将使用 CSS 呈现。但事实并非如此,这可能是我的错误造成的。我将在 TeX4ht 源中修复该问题。同时,您可以在配置文件中使用以下 CSS:

\Preamble{xhtml}
\Css{tr.hline{border-top:1px solid black;}}
\begin{document}
\EndPreamble

该表看起来正确:

在此处输入图片描述

相关内容