Conversion Toolstex4ht | XML Error with multiple Columns in Table

Information and discussion about output converters related to LaTeX (e.g. dvips, ps2pdf, ...)
Post Reply
jlinkels
Posts: 7
Joined: Fri May 20, 2011 1:58 pm

tex4ht | XML Error with multiple Columns in Table

Post by jlinkels »

Hi all,

I have this document:

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage{tabularx}
\usepackage{array}
\usepackage{multirow}

\begin{document}
\begin{table}[H]
\begin{tabularx}{\textwidth}{|c|X|c|}
        \hline
         foo & Spam and eggs for sale & \\
        \hline
        &\multicolumn{2}{X|}{spam}\\
        \hline
\end{tabularx}
\end{table}

\end{document}
When I convert this file with this command:

Code: Select all

htlatex tbx.tex "xhtml,ooffice" "ooffice/! -cmozhtf" "-coo -cvalidate"
a .ODT file is produced. However when loading this file in Libreoffice 3.3 it terminates with an error message: "invalid XML"

When I unpack the .ODT, I run xmllint --valid content.xml, and this produces this as first error:

Code: Select all

content.xml:77: parser error : Opening and ending tag mismatch: table-cell line 74 and p
</text:p></table:table-cell></table:table-row><table:table-row  
There are a bunch more errors, but since they are complaining about mismatching tags I hope it is all induced by this one.

When I look into the content.xml, I see this:

Code: Select all

<table:table-cell  
table:number-columns-spanned="2" 
 table:style-name="TBL-4-2-2"> spam
</text:p></table:table-cell>
Now just before the "spam", a text tag should have been inserted, like:

Code: Select all

<text:p text:style-name="Text-body">
On a place where I do not use multicolumn, but single-column, the <text:p tag is correctly inserted. It is just in multicolumn where this fails.

Now I have looked in the file /usr/share/texmf/tex/generic/tex4ht/ooffice.4ht which apparently holds the configuration for ooffice conversion.

However, in this file, as it seems all number-columns-spanned are followed by table:style-name and <text:p , but I don't see that appearing in my XML file!

Anyone experience with converting to OO and configuration?

jlinkels

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
jlinkels
Posts: 7
Joined: Fri May 20, 2011 1:58 pm

tex4ht | XML Error with multiple Columns in Table

Post by jlinkels »

The problem is in:

Code: Select all

 &\multicolumn{2}{X|}{spam}\\
tex4ht doesn't like the {X|}. It has nothing to do with the multicolumn. That is handled correctly.

Any recommendation about how to add/modify in the the tex4ht macrofiles as to have tex4ht to ignore the unknown X and revert to a default situation where the XML remain corrected are highly appreciated.

Any pointer to a document describing properly the macro language is most welcome as well.

jlinkels
Post Reply