my ebook created with tex4ebook contains cellspacing and cellpadding in tables. These attributes are not tolerated anymore (according to the ebookcheck). How can I remove them in the build process?

<div class='tabular'> <table class='tabular' cellspacing='0' cellpadding='0' id='TBL-3'><colgroup id='TBL-3-1g'><col id='TBL-3-1' /><col id='TBL-3-2' /><col id='TBL-3-3' /><col id='TBL-3-4' /><col id='TBL-3-5' /></colgroup><tr style='vertical-align:baseline;' id='TBL-3-1-'><td class='td11' id='TBL-3-1-1' style='white-space:nowr  ...

Kind regards


1 Answer 1


You can try this .cfg file:

\HCode{id="TBL-\TableNo" class="tabular"\Hnewline

The \Configure{halignTB<>} command configures contents of HTML attributes that are used in the <table> element. I took this definition from TeX4ht source code and removed cellspacing and cellpading.

The following sample file:

\begin{tabular}{|l| l|}
  first & second\\
  third & fourth\\\hline

Compiled using

tex4ebook -c mycfg.cfg sample.tex

Produces this HTML code:

<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><hr /></td><td><hr /></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:left;'>first</td><td class='td11' id='TBL-1-1-2' style='white-space:nowrap; text-align:left;'>second</td></tr><tr class='hline'><td><hr /></td><td><hr /></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:left;'>third</td> <td class='td11' id='TBL-1-2-2' style='white-space:nowrap; text-align:left;'>fourth</td>
</tr><tr class='hline'><td><hr /></td><td><hr /></td></tr></table>
  • Perfect, this works, thank you. I have one additional question but I will ask it in a separate post as not related.
    – berchas
    Commented Jan 10, 2021 at 13:28

You must log in to answer this question.

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