Bug 157157 - Underscores in MathType equations in a .DOCX file do not convert correctly
Summary: Underscores in MathType equations in a .DOCX file do not convert correctly
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: bibisected, bisected, regression
Depends on:
Blocks: DOCX-Formula
  Show dependency treegraph
Reported: 2023-09-08 16:04 UTC by NicolasC
Modified: 2023-10-13 17:27 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:

A .docx file with a MathTYpe equation that uses underscores '_' (39.49 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-09-08 16:04 UTC, NicolasC
The example file in Word 2016 and Writer master (86.67 KB, image/png)
2023-09-12 10:56 UTC, Gabor Kelemen (allotropia)
Extended file (13.11 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-09-12 11:25 UTC, Gabor Kelemen (allotropia)

Note You need to log in before you can comment on or make changes to this bug.
Description NicolasC 2023-09-08 16:04:51 UTC
Created attachment 189438 [details]
A .docx file with a MathTYpe equation that uses underscores '_'

Hello everyone.

(I suppose this report is a Document Liberation Project bug ; sorry if this is wrong. I dunno to which component it should be attached)

When you import  a MSword .docx document that has equations that use the MathType using underscores '_', the underscore letters are not converted correctly :

Underscores are handled as 'subscript' (as in Latex) and not as the _ char.

Tested on MacOS only (.docs documents created on the mac), but probably windows-related also.
Bug occurs with LibreOffice or LibreOffice-online, no matter the version (tested 4.X and 7.X).

Thanks for attention !
Comment 1 Gabor Kelemen (allotropia) 2023-09-12 10:56:03 UTC
Created attachment 189515 [details]
The example file in Word 2016 and Writer master

Confirming in 

Version: (X86_64) / LibreOffice Community
Build ID: beaea2e992912b4747d790070b26371f557b1f57
CPU threads: 15; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: threaded
Comment 2 Gabor Kelemen (allotropia) 2023-09-12 11:24:07 UTC
This seemed to be quite decent (but not perfect) looking in 4.4: one line, all text visible, with one underscore slipping below the next character.

In 5.0 it has changed, several lines above each other with some ? marks.

This changed again in 5.4 to the current state when the text is visible only to the first underscore.

So looks like a double regression.
Comment 3 Gabor Kelemen (allotropia) 2023-09-12 11:25:18 UTC
Created attachment 189516 [details]
Extended file

Adding a "normal" equation object in Word 2016, this is also affected the same way.
Comment 4 Gabor Kelemen (allotropia) 2023-09-12 21:34:04 UTC
First change in 5.0 was:


author	Miklos Vajna <vmiklos@collabora.co.uk>	Wed Apr 15 15:41:11 2015 +0200
committer	Miklos Vajna <vmiklos@collabora.co.uk>	Wed Apr 15 17:16:56 2015 +0200

DOCX import: convert MathType to Math if MathTypeToMath is enabled

Second change in 5.4 was:


author	Takeshi Abe <tabe@fixedpoint.jp>	Thu Mar 23 18:45:38 2017 +0900
committer	Takeshi Abe <tabe@fixedpoint.jp>	Thu Mar 23 13:42:53 2017 +0000

starmath: Fix memory leak at double sub/superscripts