6

I noticed tex4ht generates funny characters now in table when surrounding table with \begin{small}...\end{small} and at same time using p-width as option. This happens only in TL 2023. Here is an MWE and command to reproduce it:

\documentclass[12pt]{book}
\begin{document}
\begin{small}
\begin{tabular}[c]{|p{0.9in}|l|c c c c c c c c|}\hline
1& Optimal&Rubi&MMA&Maple&Maxima&Fricas&Sympy&Giac&Mupad\\ \hline
\end{tabular}
\end{small}
\end{document}

Compiled using

make4ht  -ulm default -a debug foo.tex "mathjax,htm,nostyle,p-width"

Gives

enter image description here

During compilation it says

INFO]    make4ht-lib: parse_lg process file: foo.htm
[WARNING] domfilter: DOM parsing of foo.htm failed:
[WARNING] domfilter: ...ive/2023/texmf-dist/tex/luatex/luaxml/luaxml-mod-xml.lua:175: Unbalanced Tag (/span) [char=1256]

Two ways to fix this, Either remove the p-width option, or remove the \begin{small}....\end{small}. So this MWE

\documentclass[12pt]{book}
\begin{document}
\begin{tabular}[c]{|p{0.9in}|l|c c c c c c c c|}\hline
1& Optimal&Rubi&MMA&Maple&Maxima&Fricas&Sympy&Giac&Mupad\\ \hline
\end{tabular}
\end{document}

And using same exact command to compile gives

enter image description here

The above happens only in TL 2023. I tested it under TL 2022 and it works OK in both cases.

Why does this happen? I use p-width all the time, there is reference and this is first time I see this problem. Btw, replacing \begin{small}...\end{small} with \small ....\normalsize does not fix the problem. So this MWE still gives the same problem in TL 2023

\documentclass[12pt]{book}
\begin{document}
\small 
\begin{tabular}[c]{|p{0.9in}|l|c c c c c c c c|}\hline
1& Optimal&Rubi&MMA&Maple&Maxima&Fricas&Sympy&Giac&Mupad\\ \hline
\end{tabular}
\normalsize
\end{document}

link tex4ht bug tracking.

1 Answer 1

5

This seems to be caused by the fact that the p-width option wrongly handles font sizes that contain decimal points. The small font, in your case is 10.95, and this causes the error.

Try this configuration file, it uses the FP library from LaTeX 3, which seems to fix this issue:

\Preamble{xhtml}
\makeatletter
\ExplSyntaxOn
  \Configure{HColWidth}
     {\ifnum\HRow=1% output CSS only on the first row, to prevent duplication
      \tmp:dim=\fp_to_dim:n{\dim_to_fp:n{\HColWidth}/\f@size}
      \Css{\#TBL-\TableNo\space td:nth-child(\HCol)% CSS selects ID of the current table column
          {width:\strip@pt\tmp:dim em;}}
     \fi}
\ExplSyntaxOff
\makeatother
\begin{document}
\EndPreamble

The result:

enter image description here

1
  • Thanks Michal. This seems to have fixed it on the small tests I did now.
    – Nasser
    Nov 1, 2023 at 10:19

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .