Bug 79695 - FILEOPEN: MS Word 2013 ODF shows red question marks after formula
Summary: FILEOPEN: MS Word 2013 ODF shows red question marks after formula
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on: 99984
Blocks: MSO-Formats
  Show dependency treegraph
 
Reported: 2014-06-05 18:07 UTC by Firas Hanife
Modified: 2019-10-24 02:40 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
LibO 4.2 vs Word 2013 (149.98 KB, image/png)
2014-06-05 18:37 UTC, Yousuf Philips (jay) (retired)
Details
example docx with formuls (17.95 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2017-10-14 06:48 UTC, Roman Kuznetsov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Firas Hanife 2014-06-05 18:07:11 UTC
Opening the file from attachment 93106 [details] I noticed that some formulas were not properly recognized and consequently some "¿" were shown instead. (bug 74262)

You can see them on page 29 and 30.

Reproduced with 4.1.6.2, 4.2.4.2 and 4.3.0.0.beta1.
Comment 1 Yousuf Philips (jay) (retired) 2014-06-05 18:37:03 UTC
Created attachment 100483 [details]
LibO 4.2 vs Word 2013

Confirmed in Linux Mint LibO 3.3.0 so inherited from OOo. MS Word 2013 doesnt show these question marks, but has a series of '}'.
Comment 2 Yousuf Philips (jay) (retired) 2014-06-05 18:37:47 UTC
The MS Word 2013 pdf export can be found in attachment 100262 [details].
Comment 3 QA Administrators 2015-06-08 14:43:12 UTC Comment hidden (obsolete)
Comment 4 Yousuf Philips (jay) (retired) 2015-06-09 08:46:03 UTC
Red question marks still present.

Version: 5.1.0.0.alpha1+
Build ID: 587006cac508616f486aea45e265a170bcccdc87
TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:master, Time: 2015-06-06_00:16:39
Comment 5 Xisco Faulí 2016-04-21 13:40:03 UTC
This issue can be also reproduced with attachment #82092 [details]
Comment 6 Xisco Faulí 2016-04-21 13:41:05 UTC
Reproduced in

Version: 5.2.0.0.alpha0+
Build ID: 3dca8575d63db50b0120fbff09bbfcd056fa3732
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; 
TinderBox: Win-x86@39, Branch:master, Time: 2016-04-20_05:07:29
Locale: es-ES (es_ES)
Comment 7 Regina Henschel 2016-04-21 18:50:47 UTC
A docx document is not helpful here, because it uses "http://schemas.openxmlformats.org/officeDocument/2006/math", which requires a different filter.

This is about the MathML import filter. Our own MathML is not imported from the pure MathML but from the embedded annotation, which contains the StarMath string. The part, which can read pure MathML, is in a bad state. The internal model is designed for StarMath and lacks many properties needed for MathML.

The attached document is far too large. The formulas might have different problems and it would be good, to make a single issue for each problem, if not already existing.

I have looked at the formula in the lower part of page 13. It is OLE-object "18" in the navigator. I can identify some problems:

(1) StarMath does not allow an empty matrix cell. LibreOffice should insert a small space or an empty string for StarMath in such cases.

(2) The brace for the case distinction is a <mml:mo>{</mml:mo>. It is imported as lbrace. That is bad, because it does not preserve the default "stretchy" attribute of this operator and prevents setting a closing "right none", which is needed for StarMath, because it requires balanced brackets. LibreOffice should use a "left lbrace" and insert a "right none", when the enclosed element is closed and no bracket follows.
 
(3) The source uses <mml:mo>∣</mml:mo> to represent the lines of the abs function, where the ∣ is the unicode symbol "DIVIDES". A literal translation would result in StarMath operator "divides", which does not fit well in this context.
StarMath itself uses the unicode symbol "VERTICAL LINE" for the lines of the abs function and imports them as "left lline" and "right lline" in case the annotation is missing.
I don't know a save algorithm to detect whether a true "divides" is intended or not.
The operators have no mathematical meaning in Presentation MathML, so it is not a direct fault, but it is at least bad style by Microsoft.
Comment 8 Regina Henschel 2016-05-13 19:13:15 UTC
(In reply to Regina Henschel from comment #7)
 
> (1) StarMath does not allow an empty matrix cell. LibreOffice should insert
> a small space or an empty string for StarMath in such cases.

I was wrong here.

https://www.w3.org/TR/MathML2/chapter3.html#presm.reqarg
"3.1.3.1 Inferred mrows
The elements listed in the following table as requiring 1* argument (msqrt, mstyle, merror, menclose, mpadded, mphantom, mtd, and math) actually accept any number of arguments. However, if the number of arguments is 0, or is more than 1, they treat their contents as a single inferred mrow formed from all their arguments."

Therefore in case of an empty cell neither small space nor empty string has to be used but an empty row element, which will result in {} in StarMath.
Comment 9 Regina Henschel 2016-05-21 20:56:18 UTC
If have written bug 99984 for the sub problem of empty table cells.
Comment 10 QA Administrators 2017-05-22 13:40:54 UTC Comment hidden (obsolete)
Comment 11 Roman Kuznetsov 2017-10-13 16:44:57 UTC
This bug repro in 5.4.2 and 6.0 alpha0, because nobody didn't fix it =(

Takeshi, you improve filter MathML in version 5.3. Do you have any opinion about this bug?
Comment 12 Roman Kuznetsov 2017-10-14 06:48:09 UTC
Created attachment 136966 [details]
example docx with formuls
Comment 13 QA Administrators 2018-10-23 02:47:58 UTC Comment hidden (obsolete)
Comment 14 Regina Henschel 2018-10-23 10:40:48 UTC
The formulae have still a problem with the equal sign. StarMath does not allow a missing operand in a line. Therefore a {} needs to be added. And I see some order problems, where a "=}" is generated, but it needs to be a "}=".

Tested in Version: 6.2.0.0.alpha1+ (x64)
Build ID: 22beeb3ee7d199b6b15636c532d3ad9f75da1a2b
CPU threads: 8; OS: Windows 10.0; UI render: GL; VCL: win; 
Locale: en-US (en_US); Calc: threaded
Comment 15 QA Administrators 2019-10-24 02:40:46 UTC Comment hidden (spam)