# Formatting a LaTeX list as an HTML table

Is it possible to add some configuration somewhere in order to have LaTeX list, such as:

\begin{customlist}
\item[keyword1] Description.
\item[keyword2] Another description.
\item[keyword3] Yet another.
\end{customlist}


formated as an HTML table by tex4ht, something like:

<table>
<tr><td>keyword1</td><td>Description.</td></tr>
<tr><td>keyword2</td><td>Another description.</td></tr>
<tr><td>keyword3</td><td>Yet another.</td></tr>
</table>


?

Before you tell me that if I want a table I should use tabular, I'll say that I'm trying to adapt an old LaTeX document by modifying the .sty files, introducing as few changes as possible in the .tex. The customlist environment is defined as a list, introducing some kind of header, so the LaTeX output already looks a bit like a table.

My main problem with tex4t is that the descriptions are not the argument to any command, so I don't know how to introduce the </td></tr>part at the end of each row. The rest would probably be something along the lines of:

\ConfigureList{customlist}{\Tg<table>}{\Tg</table>}{\Tg<tr>\Tg<td>}{\Tg</td><td>}


But of course, that does not create a valid table (at least not in XHTML, which is what I'd prefer).

Something that formats the list as a tabular in LaTeX would be welcome too.

• Note the </td></tr> are optional in HTML, it is valid, and parses the same way, without them. – David Carlisle Aug 14 '13 at 18:38
• @DavidCarlisle You are right, of course... I guess I meant XHMTML, I've edited the question :) – Jellby Aug 14 '13 at 18:51
• what about something like (untested): \ConfigureList{customlist} {\Tg<table>\def\trtdend{}} {\Tg</table>} {\trtdend\HCode{<tr><td>}\def\trtdend{\HCode{</td></tr>}}} {\Tg</td><td>} – michal.h21 Aug 14 '13 at 19:13
• @michal.h21 Interesting... I'd need to add \trtdend before the </table> too, but it seems to do the work. – Jellby Aug 14 '13 at 19:22
• ok, I will add it as answer – michal.h21 Aug 14 '13 at 19:24

\ConfigureList{customlist}

Macro \trtdend is inserted in at every item. It is set empty at begining of the environment and in first item it is set to \HCode{</td></tr>} so these tags are correctly closed at every next item or at the end of the environment