[tex4ht] [bug #340] Math issues in the ODF export

Michal Hoftich michal.h21 at gmail.com
Tue Nov 22 16:39:54 CET 2016

URL:
<http://puszcza.gnu.org.ua/bugs/?340>

Summary: Math issues in the ODF export
Project: tex4ht
Submitted by: michal_h21
Submitted on: Tue 22 Nov 2016 05:39:54 PM EET
Category: None
Priority: 5 - Normal
Severity: 5 - Normal
Status: None
Privacy: Public
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Any

_______________________________________________________

Details:

When I tried to compile the code from a question on TeX.sx [1], I found
several issues in ODT export:

1. The braces from \left are small, they don't cover the three lines in the
multi-line equation.

2. Instead of "<" characters at start of array columns, upside-down "?" are
displayed.

Ad 1: Definitions of \Configure{left} and \Configure{right} are redefined in
ooffice-mml.4ht. It is generated from tex4ht-ooffice.tex. There is a comment
in the sources:

> OO doesn't seem to hono mfenced

I've tried to delete the configurations for left and right from
ooffice-mml.4ht, so the default mathml configuration was used. This resulted
in brackets of correct size, but wrong form. "(" instead of "{" was used,
right bracket shouldn't be displayed at all.

I've took a look at the generated mathml code. For each math, one file named
"filename-m{count}/content.xml" is created. The automatic size bracket are
contained in <mfenced> element, with attributes left and right, where
the bracket character is specified. mathml used in odf uses math: prefix on
each element, this prefix must be used also on attributes. In our case left
and right attributes didn't have this prefix, so they haven't been taken
into the account and default brackets are used.

The prefixes are added using \a:mathml command in the tex4ht-mathml.tex, it
is empty by default, but ooffice uses mathml: prefix. It is used on all
element names and on most attributes, but it is missing on some of them, in
particular in all configurations which use <mfenced> element.

I will add the prefix for the attributes to all configurations which use
<mfenced> element and remove the configurations of "left"  and "right" from
ooffice-mml.4ht. But I guess there is much more instances of prefix-less
attributes which need to be fixed.

Also, maybe it is worth checking whether all mathml fixes in ooffice-mml.4ht
are really useful, or if there were only some minor bugs in mathml.4ht as in
this case.

Ad 2: It seems to be a bug in the LibreOffice mathml handling. Minimal example
which shows this issue is ${} < c$

This result in following mathml:

<math:math xmlns:math="http://www.w3.org/1998/Math/MathML"
c</math:mi></math:math>

this seems like valid code and Firefox for instance has no problem in
displaying that. It can be fixed if we add <math:mtext /> tag before
<math:mo>.

So my question is: is it really a bug in LO, or is there also some issue with
the mathml from tex4ht? If it is bug in tex4ht, can we insert <mtext />
automatically in the place of {} in the math context? Or is some
post-processing of the XML needed?

[1]  http://tex.stackexchange.com/q/340322/2891

_______________________________________________________