Page 1 of 1

Open-source editor for MathML equations in Author?

Posted: Tue Aug 06, 2019 3:11 pm
by chrispitude
Hi all,

Has anyone (1) found a decent open-source editor for MathML equations, and (2) found a good way to integrate it into Oxygen XML Author?

I started looking at OpenOffice Math, which is the open-source equation editor for OpenOffice applications:

https://www.openoffice.org/product/math.html

but quickly ran into the limitations of my own knowledge. It does support MathML so theoretically some kind of integration should be possible. The drawback is that the installation footprint is somewhat cumbersome, even if you choose only to install Math and not the other OpenOffice applications.

On the Author side, how can I configure my own wrapper scripts or plugins to run on tags of a particular type?

Re: Open-source editor for MathML equations in Author?

Posted: Mon Aug 12, 2019 2:49 pm
by Radu
Hi Chris,

I do not know of any particular free MathML editing tool. One option would be to keep the default editing behavior (which shows you a dialog in which you need to insert the MathML equation):

https://www.oxygenxml.com/doc/versions/ ... odes2.html

and then have third party applications installed in which you develop the equation and then you paste it in Oxygen's MathML editing dialog.
You do have Java-based API which would allow you to add custom contextual menu actions when right clicking for example inside equations but I do not know a free Java-based library to allow MathML editing.

Maybe another idea would be for you to try and use LateX instead of MathML, maybe you can find some free editing tools for that.
And we do have some extra plugins to handle the rendering and the publishing parts:

https://www.oxygenxml.com/doc/versions/ ... tions.html

Regards,
Radu

Re: Open-source editor for MathML equations in Author?

Posted: Tue Aug 20, 2019 2:11 am
by chrispitude
Hi Radu,

Previously I posted that I tried Apache OpenOffice Math, but it did not directly open and save MathML files.

Today I tried LibreOffice Math (a close cousin to OpenOffice) and it does open and save MathML files directly! So you can just do

C:\Program Files\LibreOffice\program\smath.exe my_eqn.mml

(or the equivalent in linux) and it allows the user to view, edit, and save the equation.

So how can we integrate this into Oxygen XML Author?? It wants the .mml file to exist, so we'd need to write an initial MathML file when creating a new equation instead of modifying an existing one.

Re: Open-source editor for MathML equations in Author?

Posted: Tue Aug 20, 2019 12:09 pm
by Radu
Hi Chris,

Our Oxygen SDK is Java based and it allows you to create and compile custom Author operations:

https://www.oxygenxml.com/oxygen_sdk.html

You will probably need to create your own custom "Insert MathML Equation" action and add it to the DITA toolbar (or main menu).
You already have a DITA framework extension from what I remember, I will link to the steps to do that just in case:

https://blog.oxygenxml.com/2015/08/docu ... aring.html

You can go to the Oxygen Preferences->"Document Type Associations" page and edit your DITA framework configuration extension.
In the Author tab there is an "Actions" tab where you can add a new action:

https://www.oxygenxml.com/doc/versions/ ... tions.html

A new action has an ID, name, icons. It also has multiple XPath activation contexts. You can look at the "insert.equation" for inspiration. This particular "insert.equation" action invokes a custom operation ro.sync.ecss.extensions.commons.operations.InsertEquationOperation.
You can find the source code for the "InsertEquationOperation" in our SDK, basically a custom operation needs to implement the ro.sync.ecss.extensions.api.AuthorOperation interface and then it can use custom Java code to create new files, start processes and so on. And it cal also use Oxygen API like:

Code: Select all

authorAccess.getDocumentController().insertXMLFragment("<test/>", authorAccess.getEditorAccess().getCaretOffset());
to insert an XML fragment inside the current edited document.
Your custom implementation of the "AuthorOperation" action needs to be compiled and packed in a JAR library which is placed in the custom framework extension folder. Then when you edit the DITA extension framework configuration in the Oxygen "Document Type Associations" preferences page you can add a reference to the custom JAR library in the "Classpath" tab:

https://www.oxygenxml.com/doc/versions/ ... ments.html

Once you have a custom Author action you can mount it to the DITA-specific main menu, contextual menu or toolbar.

Regards,
Radu

Re: Open-source editor for MathML equations in Author?

Posted: Tue Aug 20, 2019 1:07 pm
by chrispitude
Thanks Radu! This is great information to get me going. I'll need to learn Java and all this SDK stuff, so it might be some time before I can share my solution here. But, this is a good opportunity for me to learn how to extend Oxygen to my team's needs.