MathFlow

Post here questions and problems related to editing and publishing DITA content.
KatieKelly
Posts: 20
Joined: Thu Sep 10, 2020 11:22 pm

MathFlow

Post by KatieKelly »

I need to be able to create equations. In previous versions of Oxygen, I used an add-on called MathFlow, but I'm having problems finding this product for Oxygen 22.0. I am on a new machine now, and I no longer have access to products I was using before.

So I've contacted Design Science a few times now about either transferring a license to this new machine or buying a new product outright. It's been a challenge getting any kind of response. So after some digging, I have discovered that t MathType is no longer a part of Design Science, and is now a part of a company called Wiris. Your documentation still refers users to Design Science, however.

http://www.wiris.com/en

http://www.wiris.com/mathflow

I'm hoping to hear back from someone, anyone, soon, but I thought I'd alert anyone reading this to the change.

-Katie
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: MathFlow

Post by Radu »

Hi Katie,

We knew about this change, we originally thought that the product will be left with its original web site and we did not change the references to it. I just went through our entire user manual replacing the naming of the product, we should have these changes included in the user's manual which will be bundled with Oxygen 23 (November 2020).
In Oxygen 22.1 we added an alternative to editing MathML equations using a free MathML editing tool bundled with LibreOffice:

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

It can also be used with older Oxygen versions, but you will need to manually copy paste the equation outside of Oxygen, to the Libre Office equation editor and then copy paste it back.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
KatieKelly
Posts: 20
Joined: Thu Sep 10, 2020 11:22 pm

Re: MathFlow

Post by KatieKelly »

This is very helpful. I actually immediately saw the changes. I am impressed. Thank you!

I will try Libre Office now. Thank you again!

-Katie
KatieKelly
Posts: 20
Joined: Thu Sep 10, 2020 11:22 pm

Re: MathFlow

Post by KatieKelly »

Unfortunately, I'm not having much luck with LibreOffice. I am able to run smath.exe from my computer's command line.

But in Oxygen, I copied and pasted this into the Command line field on the Preferences dialog box (Editor/Edit Modes/Author/MathML):

"C:\Program Files\LibreOffice 5\program\smath.exe" "${cf}"

And obviously I must have done something wrong because nothing has changed.

I am not sure how to enter an equation. Intuitively, I went to DITA/Insert/Insert Equation, and the XML Fragment Editor appears. It looks like here I would just paste the mathml code into this dialog box? In LibreOffice Math, I see I can save the equation with an .mml extension, but then how to insert that into a dita document in Oxygen is not clear to me.

I would use MathFlow, but I was hoping to establish human contact with them first before buying their product, and they never respond.

-Katie
Cosmin Duna
Site Admin
Posts: 120
Joined: Wed Dec 12, 2018 5:33 pm

Re: MathFlow

Post by Cosmin Duna »

Hi Katie,

Your command line seems to be correct. The LibreOffice Math must have opened after you had invoked "Insert Equation" action.
Could you send me a screenshot with the Editor / Edit Modes / Author / MathML preferences page?

Could you do the following steps:
1. Open the "Information" view (Window>Show view>Information)
2. Remove all messages from it using the button from the upper-left corner of this view.
3. Invoke the "Insert Equation" action from the "DITA>Insert" menu.
4. Copy all text from the Information view and post it here or send us to "support@oxygenxml.com"

Regards,
Cosmin
Cosmin Duna
<oXygen/> XML Editor
http://www.oxygenxml.com
KatieKelly
Posts: 20
Joined: Thu Sep 10, 2020 11:22 pm

Re: MathFlow

Post by KatieKelly »

Thanks Cosmin. I am sending all of this to you in an email.

-Katie
KatieKelly
Posts: 20
Joined: Thu Sep 10, 2020 11:22 pm

Re: MathFlow

Post by KatieKelly »

I'll send you an email but I want to let you know that I think I fixed it. I located the .exe file in its specific directory in Windows Explorer, and then right-clicked to copy the address, and then pasted that into the field before the .exe file. I'm not sure exactly what is different, but now when I double-click the inserted equation, Libre Office Math actually appears.

Also, when I select Insert Equation from the DITA menu, Libre Office Math appears again.

Again, I'm not sure exactly what was off, because the command line you provide seems identical, but actually getting the address from Windows Explorer seemed to do the trick.

I am not clear on exactly how this should work. If I select Insert Equation, LibreOffice Math appears. Here I can create an equation. But how to insert it? What seems to work is to save it as an mml file and then insert it as an image, but not an equation. When I double-click it, it appears in LibreOffice Math, but is this correct?

The next phase is getting these to render in online Help....

-Katie
Cosmin Duna
Site Admin
Posts: 120
Joined: Wed Dec 12, 2018 5:33 pm

Re: MathFlow

Post by Cosmin Duna »

Hi Katie,
If I select Insert Equation, LibreOffice Math appears. Here I can create an equation. But how to insert it? What seems to work is to save it as an mml file and then insert it as an image, but not an equation. When I double-click it, it appears in LibreOffice Math, but is this correct?
Yes, is good that your equations are open now in LibreOffice. After you modified or created the equation in LibreOffice Math you should only close this application and your changes will be automatically updated in Oxygen.
The next phase is getting these to render in online Help..
You should edit some parameters into the DITA Map WebHelp transformation scenario. Check this link for more information: https://www.oxygenxml.com/doc/versions/ ... bhelp.html

Regards,
Cosmin
Cosmin Duna
<oXygen/> XML Editor
http://www.oxygenxml.com
KatieKelly
Posts: 20
Joined: Thu Sep 10, 2020 11:22 pm

Re: MathFlow

Post by KatieKelly »

Yes, I've seen this but unfortunately I'm not completely understanding the instructions. Please forgive my ignorance. I was able to find webhelp.fragment.head on the Paremeters tab, but how to point it to a resource file is unclear to me. What is a "resource file?" Or even an "XML resource file." Now I'm digging through the help system to try to find information on how to use "XML Resource files." Cross-references would be helpful here. I could really use some instructions written for a beginner, though.

Thanks much!

-Katie
Cosmin Duna
Site Admin
Posts: 120
Joined: Wed Dec 12, 2018 5:33 pm

Re: MathFlow

Post by Cosmin Duna »

In this case, a resource file is an XML that contains information about the javascript used to process MathML equation. I will add an internal issue to improve the documentation.

Please do the following steps:
1. Create a new XML file and add the following content in it:

Code: Select all

<script type="text/javascript"
  src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
2. Save the file into your project.
3. Go to Parameter tab from your WebHelp Responsive transformation scenario and double click the "webhelp.fragment.head" parameter from the table
4. Use the "Browse" button from the newly opened dialog and choose the file you created at the 1 point.

After these steps, you should view the equations in the published HTML.

Regards,
Cosmin
Cosmin Duna
<oXygen/> XML Editor
http://www.oxygenxml.com
KatieKelly
Posts: 20
Joined: Thu Sep 10, 2020 11:22 pm

Re: MathFlow

Post by KatieKelly »

It's still not working, but I think this is related to how I've entered the equation.

If I select DITA/Insert/Insert Equation, yes, LibreOffice Math appears. Here I am able to create an equation; however, how to insert this into the dita is still not clear to me.

What I've done as a work-around is I've saved it as an mml file, and then I select DITA/Insert/Insert Image. Then I select the mml file I've just created. But I'm inserting it as an image, not an equation.

If I double-click it, it appears in LibreOffice Math.

But something tells me that this is not entirely correct. Yes, LibreOffice Math appears, using Insert Equation, but then once I create the equation, I'm not clear on what exactly the next step is.

I feel like I'm getting closer, so thank you so much!

-Katie
KatieKelly
Posts: 20
Joined: Thu Sep 10, 2020 11:22 pm

Re: MathFlow

Post by KatieKelly »

Actually, the more I look at it, I think I have been inserting equations correctly. So although I've created an xml file with the script you've provided, and have set the webhelp.fragment.head parameter to point to that script, I'm still having no luck. :(

-Katie
Cosmin Duna
Site Admin
Posts: 120
Joined: Wed Dec 12, 2018 5:33 pm

Re: MathFlow

Post by Cosmin Duna »

It's still not working, but I think this is related to how I've entered the equation.
Yes. The equation has to be embedded in the document and when you used the "Insert Image" action you referred an image in the document.

Please do the following steps:
1. Invoke the "Insert Equation" action.
2. Now, a dialog named "Editing MathML" should appear in Oxygen and Libre Office should open:
Editing MathML.PNG
Editing MathML.PNG (68.91 KiB) Viewed 3134 times
. Go to Libre Office and create an equation.
3. Save the equation and close Libre Office.
4. Now the equation should be automatically added in your document and should be embedded in it. You should see the "mathml" element in breadcrumb when selecting the equation like in this image:
mathml.PNG
mathml.PNG (13.35 KiB) Viewed 3134 times
5. Make sure you have set the "webhelp.fragment.head" parameter in your WebHelp Responsive transformation scenario (like I told you in my last replay)
6. Run the WebHelp Responsive transformation scenario.

After those steps, the equation should appear in your output.

Regards,
Cosmin
Cosmin Duna
<oXygen/> XML Editor
http://www.oxygenxml.com
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: MathFlow

Post by chrispitude »

KatieKelly wrote: Tue Oct 06, 2020 2:09 amIf I select DITA/Insert/Insert Equation, yes, LibreOffice Math appears. Here I am able to create an equation; however, how to insert this into the dita is still not clear to me.
Hi Katie,

When you insert a new equation from Oxygen, it opens LibreOffice Math with a temporary MathML file for you to work on. You don't need to worry about where this file is; simply create your equation, save, and close LibreOffice Math, and Oxygen will move the contents of that file into the new equation in your topic for you.
KatieKelly
Posts: 20
Joined: Thu Sep 10, 2020 11:22 pm

Re: MathFlow

Post by KatieKelly »

When you insert a new equation from Oxygen, it opens LibreOffice Math with a temporary MathML file for you to work on. You don't need to worry about where this file is; simply create your equation, save, and close LibreOffice Math, and Oxygen will move the contents of that file into the new equation in your topic for you.
Unfortunately, it's not working quite that way for me. I can create and save the equation in LIbreOffice Math, but I have to insert the equation myself, using Insert Image.

And the the other problem for me is that following the instructions provided above, equations are still not rendering in Webhelp.
KatieKelly
Posts: 20
Joined: Thu Sep 10, 2020 11:22 pm

Re: MathFlow

Post by KatieKelly »

I've figured out what I was doing wrong.

I was Saving As, and then I was creating a name for the mml file and then saving it in a different directory.

For this to work, you must simply click Save. Do not alter the name, to not alter the directory.

Then everything does indeed work. Perhaps it could be added in the documentation that the equations must be saved in whatever the default directory is, like for example C:\Users\User_Name\AppData\Local\Temp\OxygenXMLTemp.

This is actually very exciting to me!

-Katie
KatieKelly
Posts: 20
Joined: Thu Sep 10, 2020 11:22 pm

Re: MathFlow

Post by KatieKelly »

So by the way, if it's not evident, I am presently ecstatic because equations are indeed rendering in Webhelp.

What about for chm files? Which parameter do I change?

Thanks much!

-Katie
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: MathFlow

Post by Radu »

Hi Katie,

I will try to help you further with this.
If you duplicate and edit the default transformation scenario used by Oxygen for converting the DITA Map to CHM, in the Parameters tab there is a transformation scenario there named "args.hdf" which you can set to the location of the XML document containing the Javascript content.
So after running the transformation, the HTML files inside the CHM should now have a reference to the MathJax javascript code. But for example on my side this does not work, when I open the CHM file I get an error about that external script reference. I think CHM in general is quite restricted, it might be possible to download the MathJax Javascript files and add all that Javascript inside the CHM but I'm not sure if that will work, from what I googled this might be possible:

https://groups.google.com/g/mathjax-users/c/nZxEXDmNu5Q

but I was not successful in making this work on my side.
So if you absolutely require MathML equations in the CHM code, you will probably need to either convert the equations to some binary format like PNG and refer in the DITA topics to the PNGs or somehow at publishing time convert the MathMLs to PNG as the HTML output is generated and before it's embedded in the CHM, but we do not have an out of the box solution for this.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply