Bug 98827 - LibreOffice should add missing MathML namespace to ill-produced files when importing
Summary: LibreOffice should add missing MathML namespace to ill-produced files when im...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
5.1.1.3 release
Hardware: x86-64 (AMD64) Windows (All)
: low enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: MathML
  Show dependency treegraph
 
Reported: 2016-03-22 20:23 UTC by Ben van der Merwe
Modified: 2023-01-04 14:58 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
formula1.mml (11.09 KB, application/mathml+xml)
2016-03-22 20:23 UTC, Ben van der Merwe
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ben van der Merwe 2016-03-22 20:23:09 UTC
Created attachment 123779 [details]
formula1.mml

Hi,

The attached .mml file, was saved by Notepad++, after the contents were pasted from MadCap Flare 12.

Open the file in Notepad++, select everything and copy. In Libre Math, click Tools, Import MathML from clipboard. Nothing happens.

Click File, Open, and it opens the file in LibreOffice writer.

Now maybe some header or some subtle detail is at play here, but the information here was copied from a well known application. Can LibreOffice be a little bit more forgiving and at least import the MathML here please? Or if not, be detailed about why not.

Ideally I can copy what is shown here in MadCap Flare, paste it in LibreOffice formula editor, edit it, and then copy back the same and paste it back in MadCap Flare. Please make that work. That would be so nice. Maybe some subtle issue is at play here, but people just need to it work.
Comment 1 Ben van der Merwe 2016-03-22 21:14:03 UTC
Note that you can copy the contents of the file from Notepad++ and paste it into this online editor for example:

http://www.wiris.com/editor/demo/en/mathml-latex.html

And that works fine.
Comment 2 Regina Henschel 2016-03-22 22:10:54 UTC
If nothing happens, then LibreOffice is not able to convert it.

In case of the attached file the problem is the missing namespace. It might be possible to tweak the converting process so that a missing namespace is added, but I have not enough time to investigate it now. But you can easily repair such file yourself:

Exchange in the first line
<math>
by
<math xmlns="http://www.w3.org/1998/Math/MathML">

The namespace is mandatory.

I don't now 'MadCap Flare 12', but perhaps you can make it writing the namespace?

BTW, not only LibreOffice is so stringent. Open the mml file in browser SeaMonkey (which has built-in support for MathML), you will notice, that it shows the source in case namespace is missing, and shows the formula, if namespace exists.
BTW 2, SeaMonkey has a tool in its modul 'Composer', where you can enter equations in TeX, and Seamonkey converts them to MathML including the namespace.
Comment 3 Jean-Baptiste Faure 2016-03-23 08:50:55 UTC
Following comment #2, closing as NotOurBug.

Please feel free to reopen if you disagree.

Best regards. JBF
Comment 4 Ben van der Merwe 2016-03-23 15:11:05 UTC
Thank you for looking into this. The problem is that major applications like MadCap Flare generate mathML without the namespace, and it is not obvious to users that it is absent or necessary. Can Math at least tell you "This looks like MathML because it contains <math>, but it is missing the mandatory namespace, please try: <math xmlns="http://www.w3.org/1998/Math/MathML">

Consider my actions: I am trying to edit MathML that MadCap Flare generates. I Google and I find that LibreOffice supports it and hey I am a big LibreOffice fan. I try and paste it in Math or import it, but nothing happens. I get annoyed with LibreOffice and blames it and keeping looking for a tool that does seem to work, and there are some.
Comment 5 Ben van der Merwe 2016-03-23 15:15:49 UTC
I have logged the bug with MadCap Flare. But it would be so nice if my favourite office suite would be a little more helpful. Have it .. just work.
Comment 6 Ben van der Merwe 2016-03-23 15:28:32 UTC
If I read: https://www.w3.org/TR/MathML/chapter2.html, 2.1.2 MathML and Namespaces

Then the section that talks about the namespace says "may" and "should".

Also see: https://www.w3.org/1998/Math/MathML/ which says "should".

More explicitly, see:

http://www.math-it.org/Publikationen/MathML.html

which says:

"The namespace xmlns… may be omitted since HTML5, there it is sufficient to write simply <math> … </math>."

So with respect, I am going to reopen this. I am not trying to be difficult, just trying to make my favourite Office suite even better.
Comment 7 Regina Henschel 2016-03-23 16:49:28 UTC
I accept it as enhancement request. Someone else might have time to work on it.

In regard to SHOULD, please consider, that LibreOffice is no HTML context but XML. The parser needs the namespace. Changing the parser was no option for me, so I have implemented it this way. The need for the namespace is documented in the release notes [1]. But as I already wrote here, it might be possible to tweak the input stream, and your suggestion to inform the user is likely possible too.

[1]https://wiki.documentfoundation.org/ReleaseNotes/5.1#Import_MathML_from_Clipboard