Bug 152850

Summary: bad scoping of sqrt after mathml import
Product: LibreOffice Reporter: Philippe <beton.10.pjoyez>
Component: Formula EditorAssignee: Joel Dowdy <joeldowdy12>
Status: RESOLVED FIXED    
Severity: normal CC: aron.budea, dante19031999, ilmari.lauhakangas, rb.henschel, vsfoote
Priority: medium Keywords: bibisected, bisected, regression
Version: 7.1.0.0.alpha0+   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=137234
Whiteboard: target:7.6.0
Crash report or crash signature: Regression By: dante
Bug Depends on:    
Bug Blocks: 118765    

Description Philippe 2023-01-02 20:08:39 UTC
Description:
import of mathml formula has incorrect structure


Steps to Reproduce:
import (eg. by paste from clipboard)
<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><msqrt><mfrac><mi>a</mi><mi>b</mi></mfrac></msqrt><mo>/</mo><mi>c</mi></mrow></math>


Actual Results:
the resulting formula is incorrect in LO Math: the sqrt encompasses the "c"

Expected Results:
the Mathml tag structure is clear : the "c" must remain outside the root.


Reproducible: Always


User Profile Reset: No

Additional Info:
The problem is not with the division by c :  <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><msqrt><mfrac><mi>a</mi><mi>b</mi></mfrac></msqrt><mo>*</mo><mi>c</mi></mrow></math> similarly imports the c under the root.

Version: 7.4.3.2 / LibreOffice Community
Build ID: 40(Build:2)
CPU threads: 4; OS: Linux 6.0; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: en-US
Debian package version: 1:7.4.3-2
Calc: threaded
Comment 1 V Stuart Foote 2023-01-03 14:32:51 UTC
Confirmed.

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: b9e3e20bfd102880d12384892eaeca094c38a519
CPU threads: 8; OS: Windows 10.0 Build 19044; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded


Resulting Starmath is:

{ sqrt frac { a } { b } slash c }

So there is a parsing issue with the mathml msqrt and mfrac functions.


The Starmath markup should probably be parsed as:

{ sqrt { frac { a } { b } }} slash { c }

or

{ sqrt { frac { a } { b }} over { c } }

or maybe even

{ sqrt { frac { a } { b }} wideslash { c } }
Comment 2 Joel Dowdy 2023-01-19 01:41:30 UTC
I'll see if I can fix this!
Comment 3 Buovjaga 2023-02-15 09:27:51 UTC
Bibisected with linux-64-7.1 to d3abe0a1fb2f2b546b164280c5562443dc1f4300
Added frac command. Sould solve tdf#137234.
Comment 4 Commit Notification 2023-02-21 12:11:47 UTC
DowwdyJ committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/ac0e3e11d14d31b66e0f9a08f96d0233ec55951d

tdf#152850: Fix bad scoping of MathML frac command

It will be available in 7.6.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 5 Philippe 2023-02-22 10:50:00 UTC
I confirm that the issue I reported is fixed now. Good job! And thanks for the quick reaction.