Bug 146002 - munderover/munder render both argument above if both of them has style
Summary: munderover/munder render both argument above if both of them has style
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
7.2.2.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: MathML
  Show dependency treegraph
 
Reported: 2021-12-02 09:35 UTC by Pavel Lobashov
Modified: 2022-05-06 17:23 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
munderover_bug.zip (52.60 KB, application/zip)
2021-12-02 09:35 UTC, Pavel Lobashov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Lobashov 2021-12-02 09:35:06 UTC
Created attachment 176646 [details]
munderover_bug.zip

Hello there. I'm writing this issue on behalf of ONLYOFFICE DocumentServer team (https://github.com/ONLYOFFICE/DocumentServer)

During the development of our product, we think we found some problems with rendering formulas with <munderover> and <munder> tag in MathML

We got a sample file, named `MUNDEROVER_without_style.odt` with this content in `Object 1/content.xml` file:

```
<?xml version="1.0" encoding="UTF-8"?>
<math display="block" xmlns="http://www.w3.org/1998/Math/MathML">
	<semantics>
		<mrow>
			<munderover>
				<mo stretchy="false">∫</mo>
				<mstyle mathcolor="red">
					<mn>0</mn>
				</mstyle>
				<mn>1</mn>
			</munderover>
			<mstyle mathcolor="green">
				<mi>a</mi>
			</mstyle>
		</mrow>		
	</semantics>
</math>
```

Opening this file in LibreOffice we got ∫ with two limits - 0 is underscript and 1 is overscript
This files renders correctly (See left part of screenshot in attachment)

But as soon as we try to add color to overscript (making XML file like this, only adding <mstyle mathcolor="blue"> around <mn>1</mn> - we got incorrect file render (see right part of attached screenshot)

```
<?xml version="1.0" encoding="UTF-8"?>
<math display="block" xmlns="http://www.w3.org/1998/Math/MathML">
	<semantics>
		<mrow>
			<munderover>
				<mo stretchy="false">∫</mo>
				<mstyle mathcolor="red">
					<mn>0</mn>
				</mstyle>
				<mstyle mathcolor="blue">
					<mn>1</mn>
				</mstyle>
			</munderover>
			<mstyle mathcolor="green">
				<mi>a</mi>
			</mstyle>
		</mrow>		
	</semantics>
</math>
```
In that case, LibreOffice renders this file with both 0 and 1 in overscript

We think it has something to do with the conversion of this formula to StarMath

The file without style has this StarMath style (copied from opened Libreoffice: 
> { int csup 1 csub color red 0 color green a }

File with style has this StarMath:
> { int csup color blue 1 csub color red 0 color green a }

Seems that one pair of quotes is missing

If we change StarMath of second file to:
> { int csup {color blue 1} csub color red 0 color green a }

We got correct integral with both underscript and overscript  and with the correct color

My Eniroment:
Kubuntu 20.04
LibreOffice flatpak 7.2.3.2
Comment 1 Rafael Lima 2022-05-06 17:23:23 UTC
I can confirm this bug in LO 7.4 alpha.

In my opinion, the MathML import should have resulted in:

{ int csup {color blue 1} csub {color red 0} {color green a} }

Whenever there is a "color", "font" or "size" command, it should be enclosed with curly brackets.

System info:
Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: 4351a6ca782e1d2081ba819338ebbf6a2d2ee2b2
CPU threads: 16; OS: Linux 5.13; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Calc: CL