Bug 151931 - FILEOPEN DOCX Equations containing just a "+" or "-" sign at the exponent are not imported correctly
Summary: FILEOPEN DOCX Equations containing just a "+" or "-" sign at the exponent are...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.4.2.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:docx
Depends on:
Blocks: DOCX-Formula
  Show dependency treegraph
 
Reported: 2022-11-06 13:01 UTC by afit5
Modified: 2023-12-05 13:04 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Rendering comparison between MS Office and LO (21.31 KB, image/jpeg)
2022-11-06 13:01 UTC, afit5
Details
Problematic DOCX (30.95 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2022-11-06 15:26 UTC, afit5
Details
Rendering comparison of the equation between MS Office and LO (12.01 KB, image/png)
2022-11-06 15:28 UTC, afit5
Details

Note You need to log in before you can comment on or make changes to this bug.
Description afit5 2022-11-06 13:01:40 UTC
Created attachment 183433 [details]
Rendering comparison between MS Office and LO

The equation tool is mainly used to represent mathematical formulas, but other common use cases are physics and chemistry; in this latter case, superscripts plus and minus signs are used to represent ions.

When writing an equation in LO containing a plus or a minus as the exponent, the renderer shows an inverted red question mark, and further parsing of the equation is incorrect

To reproduce: ppen Libreoffice Math and insert any equation with "+" or "-" as the exponent (e.g. "Cl^-")

Expected rendering: attached is a comparison of a problematic equation rendering in Word vs Libreoffice.The formula used in LO Math is the following:

r=d[Cl^-] over dt={k[OCl^-][I^-]} over [OH^-]
Comment 1 Mike Kaganski 2022-11-06 13:42:30 UTC
This is not a bug. Plus and minus are operators in Math; as such, they expect operands. If you need to use them as literals, put the lone signs into quotation marks:

r=d[Cl^"-"] over dt={k[OCl^"-"][I^"-"]} over [OH^"-"]

Alternatively, provide empty operands:

r=d[Cl^-{}] over dt={k[OCl^-{}][I^-{}]} over [OH^-{}]

Generally, see this FAQs:

https://wiki.documentfoundation.org/Faq/Math/002
https://wiki.documentfoundation.org/Faq/Math/106
Comment 2 afit5 2022-11-06 13:55:17 UTC
Thanks, seems like I should have searched more in the documentation before opening the bug. I discovered this behaviour opening a DOCX file in Libreoffice though, so it might still be useful to file a bug for DOCX import, what do you think? I could open a new bug, or edit and transfer this one to the right category
Comment 3 Mike Kaganski 2022-11-06 14:09:05 UTC
Attach a DOCX here, and make it an interoperability issue. Thank you!
Comment 4 afit5 2022-11-06 15:26:04 UTC
Edited and moved
Comment 5 afit5 2022-11-06 15:26:58 UTC
Created attachment 183434 [details]
Problematic DOCX
Comment 6 afit5 2022-11-06 15:28:09 UTC
Created attachment 183435 [details]
Rendering comparison of the equation between MS Office and LO
Comment 7 Mike Kaganski 2022-11-07 05:52:11 UTC
Repro.

My idea would be that we should make sure that the operators introduced in some context (e.g., inside OOXML's <m:sup>...</m:sup>) have all operands defined upon exiting the context, which would require to provide empty operands {} when none had been provided in the XML.
Comment 8 Robert Cabane 2022-11-29 19:41:43 UTC
I agree. Many math documents I receive , typewritten with MS Word, include such bad typos and provoke errors when opened in Writer.
Adding empty arguments when missing would certainly help.
Comment 9 afit5 2023-12-05 13:04:25 UTC
Still reproducible in 7.6.3.2