Bug 101022 - Export of characters from iGreek and Greek Symbol set generates wrong MathML
Summary: Export of characters from iGreek and Greek Symbol set generates wrong MathML
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
(earliest affected) rc
Hardware: x86 (IA32) Windows (All)
: medium normal
Assignee: Not Assigned
Whiteboard: target:5.3.0
Depends on:
Reported: 2016-07-19 21:13 UTC by Regina Henschel
Modified: 2016-10-23 14:22 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:

Test for italic (5.62 KB, application/vnd.oasis.opendocument.formula)
2016-07-19 21:13 UTC, Regina Henschel

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2016-07-19 21:13:02 UTC
Created attachment 126310 [details]
Test for italic

Open attached document. It has the command
{ital %GAMMA} + %GAMMA + %iGAMMA + {nitalic %iGAMMA}
So you should see first and third character in italic and second and forth character upright.

Export the file to MathML or extract the MathML part from the odf-file and open the result in a browser. You will see for upright characters. The exported source is
   <mstyle mathvariant="italic">
    <mi mathvariant="normal">Γ</mi>
   <mo stretchy="false">+</mo>
   <mi mathvariant="normal">Γ</mi>
   <mo stretchy="false">+</mo>
   <mi mathvariant="normal">Γ</mi>
   <mo stretchy="false">+</mo>
   <mstyle mathvariant="normal">
    <mi mathvariant="normal">Γ</mi>

The mathvariant-attribute explicitly given in the mi-element overrides the inherited value from the mystyle-element. Therefore the structure
   <mstyle mathvariant="italic">
    <mi mathvariant="normal">Γ</mi>
cannot produce an italic GAMMA.

The %iGAMMA characters are exported with attribute mathvariant="normal", but it should be mathvariant="italic".

It seems to me, that the attribute mathvariant="normal" is erroneously always written, without any case distinction.

ODF specifies, that formulas have to be written in MathML. The StarMath annotation is irrelevant for ODF and is not read by other consumers. Therefore the MathML export should not be neglected.

I have used Version:
Build ID: a7567a46e5d2953c320b13eb88a3981c4f9bd1e0
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; 
Locale: de-DE (de_DE)
Comment 1 V Stuart Foote 2016-07-20 00:51:47 UTC
The associated internal StarMath records correctly as annotation -- allowing our correct internal use. 

So, isn't it mostly a broken filter (mathmlexport.cxx) issue on export in composing a matching MathML ODF Formula. 

On reimport do we read the MathML and filter that--or do we instead parse the annotation and recreate formula using that? If the first--would expect a whole lot more complaining as documents would fail on round trip.

None the less, the MathML looks to be broken. To NEW.
Comment 2 Regina Henschel 2016-07-20 10:06:10 UTC
LibreOffice parses the StarMath annotation if available. And yes, MathML filters have a lot of bugs. Since MS Word 2010 use of ODF is possible and MS Word 2010 can parse the MathML of the formula. The complains are so few, because people use .doc format for roundtrip, which uses MathType 3.
Comment 3 Takeshi Abe 2016-07-28 04:47:29 UTC
I have uploaded a possible fix for this issue:
Comments are welcome.
Note that the default value of mi's mathvariant is "italic" when the body consists of a single character: <https://www.w3.org/TR/MathML2/chapter3.html#id.>.
Comment 4 Commit Notification 2016-07-31 20:21:25 UTC
Takeshi Abe committed a patch related to this issue.
It has been pushed to "master":


tdf#101022 Export Greek symbol to MathML with correct mathvariant

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:

Affected users are encouraged to test the fix and report feedback.
Comment 5 Xisco Faulí 2016-09-15 22:46:37 UTC
Is this bug fixed?
If so, could you please close it as RESOLVED FIXED?
Comment 6 Regina Henschel 2016-10-23 14:22:23 UTC
It is fixed in Version:
Build ID: 8a796410ec8f440b4163b15b928347c499da7a8f
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2016-10-20_23:07:21
Locale: de-DE (de_DE); Calc: group