7

I need to store equations in a text file, in a source format that can be converted to something that can be rendered (e.g. mathML). I like the format used in OpenOffice. I don't want to use TeX, or at least I don't want to pull in all the baggage of interpreting TeX. What format does OpenOffice Equation Editor use, and are there 3rd party command-line converters that will process this format? I don't want to have to run OpenOffice every time I need to render/convert my equations.

2
  • 1
    Belong to stackoverflow
    – joe
    Jul 30, 2009 at 15:51
  • 1
    Ditto. It has nothing to do with programming.
    – Jason S
    Jul 30, 2009 at 15:58

4 Answers 4

4

What format does OpenOffice Equation Editor use?

LibreOffice Math (and OpenOffice Math) both use MathML to represent mathematical markup.

Just save any equation using Math and simply unpack it (it is ZIP packed). For example if you create famous [E=mc²] and save it, then in content.xml inside your .odt file you will find something like this:

<?xml version="1.0" encoding="UTF-8"?>
<math xmlns="http://www.w3.org/1998/Math/MathML">
    <semantics>
        <mfenced open="[" close="]"><mrow>
            <mi>E</mi><mo stretchy="false">=</mo><msup><mi mathvariant="italic">mc</mi><mn>2</mn></msup>
        </mrow></mfenced>
        <annotation encoding="StarMath 5.0">left[ E=mc^2 right]</annotation>
    </semantics>
</math>

As you see, Math stores equation in own format annotation section, but you can use plain MathML as input format.

… command-line converters that will process this format

I believe, you can use Python API for Libre (Open) Office.

You can put your own equation in annotation (in StarMath's format). Looks like Math builds equation based on how it is represented in annotation and the rest of MathML file is just for representation/compatibility.

If MathML doesn't look like made from StartMath it will propose to "repair" the file and it will work just fine after this.

1
  • The user interface of the editor does not use MathML. They may store math markup as MathML, but I don't want to use MathML. I want to use the markup language of the user interface (from looking at the "annotation" section of your answer, it must be called "StarMath"). It's much simpler.
    – Jason S
    May 17, 2011 at 21:44
2

I assume you want to know about the math commands for OpenOffice Math. The commands are proprietary, and there don't seem to be any 3rd party converters.

You can use tex without pulling in the whole tex compilation system. I use the javascript library mathJax to render directly. If you want to convert to an intermediate format such as mml and then render later, you can use a library such as SnuggleTeX for Java.

2

The syntax in OpenOffice Math is based on eqn, which is much more readable than LaTeX. If you store equations as eqn code, you can render them very quickly with troff or convert to LaTeX and render that way. Troff's rendering of math is not quite as nice as LaTeX's, but troff is much more lightweight.

2
  • +1 for the eqn reference!
    – dolmen
    Jun 11, 2015 at 15:35
  • The GNU version of eqn also lets you output actual MathML code. Aug 15, 2021 at 0:42
0

The format for StarMath is documented in the LibreOffice 4.4 Math Guide. Appendix A contains the Command Reference.

You must log in to answer this question.

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