Bug 66525 - IMPORT specific formula in a MS Word document is wrong
Summary: IMPORT specific formula in a MS Word document is wrong
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
3.6.3.2 release
Hardware: Other All
: medium major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: DOC-Formula
  Show dependency treegraph
 
Reported: 2013-07-03 00:34 UTC by Mike Kaganski
Modified: 2022-06-16 13:05 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
More formulas to test (33.50 KB, application/msword)
2013-08-11 08:28 UTC, Sergey Pashinin
Details
Formulas to test (35.50 KB, application/msword)
2014-03-04 18:30 UTC, Sergey Pashinin
Details
doc saved in MSO 2016 as docx (27.21 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-03-10 21:49 UTC, paulystefan
Details
doc saved as odt in LO 6.4.1.2 (31.24 KB, application/vnd.oasis.opendocument.text)
2020-03-10 21:51 UTC, paulystefan
Details
docx saved as odt in LO 6.4.1.2 (35.83 KB, application/vnd.oasis.opendocument.text)
2020-03-10 21:52 UTC, paulystefan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2013-07-03 00:34:18 UTC
Testcase: Attachment 81816 [details] from Bug 66463.
Screenshot shownig incorrect rasulting formula: Attachment 80819. Please note the third image showing incorrect curly brace and red question marks.

The internal structure of the imported formula is this:

size 12 {
 alignl {
  stack {
   left lbrace
    {{c}} sup {'} rSub {size 8{1}} left (x right )+ {{c}} sup {'} rSub {size 8{2}} left (x right ) cdot e rSup {size 8{- x}} =0 {} # 
   right none
   left lbrace
    - {{c}} sup {'} rSub {size 8{2}} left (x right )e rSup {size 8{- x}} = {{1} over {e rSup {size 8{x}} +1} } {} # 
   right no
  }
 }
 lbrace
}
{}

Note:
* lbraces positioned incorrectly (inside stack; in each line of the stack; second "left lbrace" is matched by bad-syntax "right no"; extra lbrace in the end without match);
* extra "#" in the end of the second stack line.

Here is the corrected formula:

size 12 {
 left lbrace
  alignl {
   stack {
    {{c}} sup {'} rSub {size 8{1}} left (x right )+ {{c}} sup {'} rSub {size 8{2}} left (x right ) cdot e rSup {size 8{- x}} =0 {} # 
    - {{c}} sup {'} rSub {size 8{2}} left (x right )e rSup {size 8{- x}} = {alignc {1} over {e rSup {size 8{x}} +1} } {}
   }
  }
 right none
}
{}

Note that I intentionally left unnecesary elements (like empty and redundant braces) to keep resemblance. I had to add alignc to the division in the lower line to restore its correct representation.

I suppose that the possible cause of the problem is that there is only one brace in the formula.
A somewhat related is Bug 62178, that discusses the opposite direction problem.

Affected both LO 3.6.3.2 and AOO, so must be an inherited problem. Still present in 4.0.3 and 4.1.0.1.
Comment 1 Mike Kaganski 2013-07-03 00:48:43 UTC
Excuse me, the screenshot is Attachment 81819 [details].
Comment 2 Jacques Guilleron 2013-07-04 13:56:16 UTC
Hi Mike,

Thank you for this quite clear report.
I already met those problems with imported documents with formulas.
I reproduce with LO 4.2.0.0.alpha0+
Build ID: ce0383d2950d3b0da2c457c8a406c1229de53571
& Windows 7 Home Premium

I set status to NEW and Importance to MEDIUM HIGH.

Regards,

Jacques
Comment 3 Sergey Pashinin 2013-08-11 08:28:25 UTC
Created attachment 83929 [details]
More formulas to test

These formulas are also displayed incorrectly for me.
I think this .doc can also be a testcase for bug https://bugs.freedesktop.org/show_bug.cgi?id=66463
Comment 4 Sergey Pashinin 2014-03-04 18:30:06 UTC
Created attachment 95109 [details]
Formulas to test
Comment 5 Jacques Guilleron 2014-06-15 15:19:40 UTC
Still reproduced with LO 4.4.0.0.alpha0+
Build ID: 488f31200094d7237d45545ab227014831a1f8e6
TinderBox: Win-x86@39, Branch:master, Time: 2014-06-15_05:02:39
& Windows 7 Home Premium

Jacques
Comment 6 Yury 2015-04-20 06:54:31 UTC
This is TWO issues in one, actually. One is sizing on msword mathtype objects import (#45284), another is incorrect processing of bracing brace (no pun intended).
Actually, there is the THIRD issue involved -- the automatic re-rendering of all formulas images should be done after importing.
Comment 7 Mike Kaganski 2015-04-20 08:15:23 UTC
(In reply to Yury from comment #6)
> This is TWO issues in one, actually
No, actually here is only ONE issue reported, and its fix awaited: incorrect structure of imported formula (possibly caused by unmatched brace). Other problems that you have mentioned are irrelevant for this specific bug report, though affect the formula. Please don't add irrelevant comments, that may distract developer or make the issue hard to manage. I saw your issue when submitted this one, that's why I haven't create a dupe.

As to "automatic re-rendering of all formulas images should be done after importing", it's questionable. In bug 66463, there's a case when the opposite is preferrable.
Comment 8 QA Administrators 2016-09-20 09:31:53 UTC Comment hidden (obsolete)
Comment 9 Mike Kaganski 2016-09-20 15:42:10 UTC
Still reproducible with Version: 5.2.2.1 (x64)
Build ID: 3c2231d4aa4c68281f28ad35a100c092cff84f5d
Comment 10 Xisco Faulí 2017-09-29 08:50:57 UTC Comment hidden (obsolete)
Comment 11 Roman Kuznetsov 2018-12-19 14:43:11 UTC
still repro in

Version: 6.3.0.0.alpha0+
Build ID: 2b9739b9b009de93efa4f24995469c3bb9d82261
CPU threads: 4; OS: Windows 6.1; UI render: default; VCL: win; 
TinderBox: Win-x86@42, Branch:master, Time: 2018-12-18_23:09:56
Locale: ru-RU (ru_RU); UI-Language: en-US
Calc: threaded
Comment 12 paulystefan 2020-03-10 21:49:12 UTC
Created attachment 158577 [details]
doc saved in MSO 2016 as docx

doc saved in MSO 2016 as docx


load docx more errors in formulas in LO 6.4.1.2 x64 win10-64
Comment 13 paulystefan 2020-03-10 21:51:31 UTC
Created attachment 158578 [details]
doc saved as odt in LO 6.4.1.2

doc saved as odt in LO 6.4.1.2

formulas not ok in design in relation to mso 2016
Comment 14 paulystefan 2020-03-10 21:52:23 UTC
Created attachment 158579 [details]
docx saved as odt in LO 6.4.1.2

docx saved as odt in LO 6.4.1.2

more errors in formula
Comment 15 paulystefan 2020-06-20 19:06:19 UTC
same in LO7.0.0beta2x64 on win10 x64
Comment 16 paulystefan 2021-05-17 12:44:39 UTC
Looks like bug 62178 in the mirror direction.

But the import of Docx is also buggy.

So there a more than one bug or limitation in this example.

There are improvements in 7.2.0 in ms office importers.
Perhaps there is here progress.
Comment 17 paulystefan 2021-08-05 20:55:48 UTC
no positive change for this problem in 

Version: 7.2.0.2 (x64) / LibreOffice Community
Build ID: 614be4f5c67816389257027dc5e56c801a547089
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: de-DE
Calc: CL
Comment 18 paulystefan 2022-06-16 13:05:00 UTC
No formula improvement  for doc and DOCX in 7.3.4.2.

Version: 7.3.4.2 (x64) / LibreOffice Community
Build ID: 728fec16bd5f605073805c3c9e7c4212a0120dc5
CPU threads: 8; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: de-DE
Calc: CL