我无法得到板状的与 tex4ebook 一起工作。其他表格环境工作正常;不幸的是,我正在转换一个现有的项目,该项目相当大并且大量使用 xltabular,我应该尽可能为两个版本保留相同的源代码。MWE:
\documentclass[a5paper,10pt,openright]{book}
\usepackage[a5paper, portrait, margin=2cm]{geometry}
\usepackage[portuguese]{babel}
\usepackage{xltabular}
\begin{document}
\begin{xltabular}
{\textwidth}
{| >{\raggedright\arraybackslash}X | >{\raggedright\arraybackslash}X | }
\hline
1st col & 2nd col \\
\hline
\end{xltabular}
\end{document}
命令行:
tex4ebook -l -f epub3 test.tex
(将 -l 切换为 -x 没有任何区别。)
错误消息:
[STATUS] tex4ebook: Conversion started
[STATUS] tex4ebook: Input file: test.tex
[ERROR] htlatex: Compilation errors in the htlatex run
[ERROR] htlatex: Filename Line Message
[ERROR] htlatex: ./test.tex 14 Undefined control sequence.
[ERROR] htlatex: ./test.tex 14 Missing number, treated as zero.
[ERROR] htlatex: ./test.tex 14 Missing number, treated as zero.
[ERROR] htlatex: ./test.tex 14 Missing = inserted for \ifnum.
[ERROR] htlatex: ./test.tex 14 Missing number, treated as zero.
[ERROR] htlatex: ./test.tex 14 Missing number, treated as zero.
[ERROR] htlatex: ./test.tex 14 Undefined control sequence.
[ERROR] htlatex: ./test.tex 14 Missing number, treated as zero.
[ERROR] htlatex: ./test.tex 14 Missing number, treated as zero.
[ERROR] htlatex: ./test.tex 14 Undefined control sequence.
[ERROR] htlatex: ./test.tex 14 Missing } inserted.
[ERROR] htlatex: ./test.tex 14 Undefined control sequence.
[ERROR] htlatex: ? 14 Undefined control sequence.
[ERROR] htlatex: ? 14 Undefined control sequence.
[ERROR] htlatex: ? 14 Incompatible list can't be unboxed.
[ERROR] htlatex: ? 14 Missing } inserted.
[ERROR] htlatex: ? 14 Too many }'s.
[ERROR] htlatex: ? 14 Too many }'s.
[ERROR] htlatex: ? 14 LaTeX Error: \begin{document} ended by \end{tabularx}.
[ERROR] htlatex: ? 14 Extra \endgroup.
(重复 3 次)
但是,使用 pdflatex 或 xelatex 进行正常编译可以正常工作。
我一直在阅读文档,但到目前为止我还没能弄清楚发生了什么。我也找不到任何迹象表明 xltabular 环境和 tex4ebook 不兼容。
谢谢。
答案1
我刚刚发现这个问题,我最初有点忽略了它。这个配置文件xltabular.4ht
应该可以解决这个问题:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% xltabular.4ht (2024-03-05-16:19), generated from tex4ht-4ht.tex
% Copyright 2024 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 2024-03-05-16:19}
% xltabular redefines \LT@array, which breaks all TeX4ht patches for this command
% we must restore TeX4ht's version
\let\xltabular\tabularx
\let\endxltabular\endtabularx
\let\longtable\XLT@longtable
\AtBeginDocument{
\HLet\XLT@LT@array\n:LT@array:
}
\Hinput{xltabular}
\endinput
它已经包含在 TeX Live 中,因此您只需更新您的发行版即可工作。
这是示例生成的 HTML: