2

I can't get xltabular to work with tex4ebook. Other table environments work fine; unfortunately, I'm converting an existing project, which is quite large and uses xltabular a lot, and I'm supposed to keep the same source code for both versions, as much as possible. 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}

Command Line:

tex4ebook -l -f epub3 test.tex

(Switching -l to -x makes no difference.)

Error Messages:

[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.

(repeated 3x)

Normal compilation with either pdflatex or xelatex works fine, though.

I've been reading documentation but so far I haven't been able to figure out what's going on. I also couldn't find any indication of incompatibility of the xltabular environment and tex4ebook.

Thanks.

1 Answers1

2

I've just found this question, I missed it somewhat originally. This configuration file, xltabular.4ht should fix the issue:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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

It is already included in TeX Live, so you can just update your distro and it should work.

This is the resulting HTML from your example:

enter image description here

michal.h21
  • 50,697