# Thoughts on LibreOffice Math

Frédéric WANG fred.wang at free.fr
Mon Jun 24 07:28:55 PDT 2013

> Can you please describe in more details what is wrong with the exported
> MathML? LibreOffice uses "Presentation Markup" and not "Content Markup".
> But besides that, what is bad?
For example,

- If you type "1 + 2x" then "2x" is interpreted as a single number
rather than a number times a variable.
- If you add a space like "1 + 2 x", then it is now interpreted as
"{1+2} times x"
- If you type "a+b+c+d+e+..." you'll get a nested mrow structure like
{{{{{a+b} + c}+d}+e}+...} which is correct but very inconvenient to
browse e.g. for accessibility tools. The operators of same priority
could be grouped in the same row.
- Other commands like wide accents, math symbols or overstrike are lost

I don't want to give the details here, but I'm going to open bugs and
submit patches when I have time:

> MathML import and export is already available. What is needed in addition?
Yes, I didn't mean it is not supported, but just wanted to list some
features that I think people would like to implement or keep in any
future versions of Math. Note that:

- MathML export has some bugs but I hope it won't be too difficult to fix.
- A MathML or LaTeX import is not possible without loss of information,
because StarMath is less expressive ; or one will have to extend the
StarMath language with many new constructions.
- LibreOffice MathML claims export/import support for "MathML 1.0" but
the recommendation is now "MathML3".
- As I already reported, HTML5 import/export with embedded MathML would
be great!
- Perhaps the (X)HTML export should have an option to insert a line of
code to load MathJax, when the document contains MathML formulas:
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=MML_HTMLorMML"></script>

> Do you want an export to Content Markup?
No I'm not interested in a Content MathML export. If I can improve the
Presentation MathML export to at least produce good markup for the
StarMath constructions and so that users stop complaining about issues
with the formulas generated by LibreOffice, then that would be fine to me.
> The StarMath code is stored in the<annotation>  element.
Yes, that's what I mean, the <annotation> / <annotation-xml> elements
are children of <semantics>.

> Export to PNG already exists but needs improvement.
True. That said, I'm not really a big fan of PNG export for mathematical
formulas ;-)

> There are not only the large goals you have outlined, but a lot of
> enhancement request, which are open for many years, like arbitrary
> colors, storing in Gallery, better integral sign.
>
> The Math module has got very small enhancements in the last years. It
> would be really good, if you can help in that area.
I'd like to help but I'm not sure I'll have time to. In the short term,
I just plan to improve MathML export so that LibreOffice users can
publish their math document on the Web, without having to use PNG images
or similar hacks.

Thanks,

--
Frédéric Wang
maths-informatique-jeux.com/blog/frederic