Bug 152850 - bad scoping of sqrt after mathml import
Summary: bad scoping of sqrt after mathml import
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
(earliest affected)
Hardware: All All
: medium normal
Assignee: Joel Dowdy
Whiteboard: target:7.6.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks: MathML
  Show dependency treegraph
Reported: 2023-01-02 20:08 UTC by Philippe
Modified: 2023-02-22 14:09 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Philippe 2023-01-02 20:08:39 UTC
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: / 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

Version: (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 }


{ 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":


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:

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.