Bug 67327

Summary: Other: maths formula is altered when saved in .doc format
Product: LibreOffice Reporter: TDuell <tduell>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: NEW --- QA Contact:
Severity: normal    
Priority: medium CC: fred.wang, michael.meeks, serval2412
Version: 3.6.7.2 release   
Hardware: Other   
OS: Linux (All)   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=45284
Whiteboard: BSA
i915 platform: i915 features:
Attachments: odt file with maths demonstrates the problem
rendering from master sources/4.1
Screenshot from .doc rendering
rendering from master sources after doc conversion

Description TDuell 2013-07-26 00:05:20 UTC
Problem description: 
I'm using v3.6.7 (download from LO website) on Fedora 19 x86_64. I would normally  be using the package from fedora repo (4.1.0.1) but that crashes on FC19 as do other v4 available from LO site.
Steps to reproduce:
1. ....Write equation, save as .doc (Microsoft Word 97/2000/XP/2003)
2. ....Open saved .doc in LO
3. ....

Current behavior:
The equation is displayed larger, sometimes not displayed in any recognisable form
example...
the equation in original document
vec ar = vec a + vec %alpha X vec r + vec %omega X (vec %omega    X vec r ) 

The equation when the .doc is opened
 size 12{ { vec  {a}} ital "r= {" ital { size 8{a}}}" {X { {୲}} {X left ( {X { vec  {r}} {ω}} \(  \)  right )"} 
newline
{}

Expected behavior:
The equation to be displayed as it was in the original document, before saving as .doc
              
Operating System: Fedora
Version: 3.6.7.2 rc
Comment 1 Julien Nabet 2013-07-27 19:41:39 UTC
Tduell: could you attach the file so we can try to reproduce this?
It could be interesting you submit a bug about your crash for 4.0 version.
Indeed, you must know that 3.6 is at end of life (see https://wiki.documentfoundation.org/ReleasePlan#3.6_release) and 3.6.7 is the last TDF version. So even if there's a bug about this on 3.6.7, there won't be any 3.6.8, a priori, with a fix.
Comment 2 TDuell 2013-07-27 22:51:07 UTC
Created attachment 83107 [details]
odt file with maths demonstrates the problem
Comment 3 TDuell 2013-07-27 22:54:29 UTC
Comment on attachment 83107 [details]
odt file with maths demonstrates the problem

The attached odt file when saved as .doc and reloaded back into LO has the maths displayed incorrectly.
I am now using LO 4.1.0.1 from Fedora 19 repo, and it displays the same behaviour
Comment 4 Julien Nabet 2013-08-03 14:50:31 UTC
Created attachment 83584 [details]
rendering from master sources/4.1

On pc Debian x86-64 with master sources updated today and 4.1 sources updated yesterday, I had this rendering.
Comment 5 Julien Nabet 2013-08-03 14:54:35 UTC
TDuell: thank you for the file attached.
As you may have seen, I uploaded an image showing the rendering. If it doesn't correspond to what you expected, could you attach a screenshot of you expected?
Comment 6 TDuell 2013-08-03 23:13:35 UTC
Created attachment 83596 [details]
Screenshot from .doc rendering

This image is a screenshot of how a saved .doc looks when reloaded back into LO 4.1.
The maths looks good in saved LO .odt, but when saved as .doc and reloaded are rendered distorted.
I have reports that the maths are sometimes unreadable when my .doc are rendered in MS Word.
Comment 7 Julien Nabet 2013-08-04 06:29:15 UTC
Created attachment 83600 [details]
rendering from master sources after doc conversion

TDuell: I reproduced the same problem with 4.1 sources but there's a lot of improvement with master sources (see attachment).
Comment 8 Julien Nabet 2013-08-04 06:33:51 UTC
Frédéric: the last screenshot I attached shows you greatly improved the rendering of math equation after doc conversion. For this case there are still small tweaks to do but I think it could be interesting to cherry-pick the changes you made in 4.1 sources, what do you think?
Comment 9 TDuell 2013-08-04 06:46:00 UTC
(In reply to comment #7)
> Created attachment 83600 [details]
> rendering from master sources after doc conversion
> 
> TDuell: I reproduced the same problem with 4.1 sources but there's a lot of
> improvement with master sources (see attachment).

Yes, that does look much better. Hard to distinguish any change to how it is rendered in .odt.
Thanks for your attention to this issue, hopefully it won't be too long before fixes are available in Fedora repo.
Comment 10 Julien Nabet 2013-08-04 06:48:53 UTC
TDuell: if we cherry-pick changes in 4.1, it could be for soon. But if not, you'll have to wait for 4.2.0, see release plan for future 4.2.0 (https://wiki.documentfoundation.org/ReleasePlan#4.2_release).
Comment 11 TDuell 2013-08-04 06:54:34 UTC
(In reply to comment #10)
> TDuell: if we cherry-pick changes in 4.1, it could be for soon. But if not,
> you'll have to wait for 4.2.0, see release plan for future 4.2.0
> (https://wiki.documentfoundation.org/ReleasePlan#4.2_release).

OK, I understand.
Given that this might affect quite a few collaborating on maths stuff with MS Word users, it would be good for LO credibility if the fixes were out there sooner than later.
Thanks for your help.
Comment 12 Julien Nabet 2013-08-04 06:58:43 UTC
Michael: just in case Frédéric is in vacation, what do you think about a "cherry-pick package" containing Frédéric's changes about the math rendering for 4.1? (for 4.0 too?). If ok, I've got 4.1 and 4.0 sources and could do it then logerrit submit it.
Comment 13 Frédéric Wang 2013-08-04 08:06:17 UTC
(In reply to comment #8)
> Frédéric: the last screenshot I attached shows you greatly improved the
> rendering of math equation after doc conversion. For this case there are
> still small tweaks to do but I think it could be interesting to cherry-pick
> the changes you made in 4.1 sources, what do you think?

The main issue here seems to be the integration of formulas into the document: it seems that incorrect width/height attributes are saved when exported to .doc and then the formula is rendered distorsed when imported back. My work was really on the MathML export of the formula itself, so I'm not sure I fixed anything here. I only modified the XHTML export filter in bug 66645 to remove this kind of attributes and avoid confusing the rendering in browsers, but I'm don't know if this affects export to *.doc file.

I think someone mentioned a fix for baseline alignment of inline formulas on the mailing list, so perhaps the width/height have been fixed at the same time...
Comment 14 Julien Nabet 2013-08-04 10:55:20 UTC
Frédéric: you were right, I cherry-picked the patches I quoted but it didn't change anything.
Sorry for the noise.
Comment 15 Yury 2013-08-05 08:10:21 UTC
Why, that's a good old 

https://bugs.freedesktop.org/show_bug.cgi?id=45284

I'm successfully using locally built LibO with the patch mentioned there. Never needed absolute size in formulas, BTW.
Comment 16 Julien Nabet 2013-08-06 10:20:34 UTC
Yuri: according to what you said, I put fdo#45284 in see also. Thank you for your feedback.
Comment 17 TDuell 2013-12-08 01:26:28 UTC
This problem was solved in the Fedora LO package (4.1.3.2-6), but has re-appeared in the 4.1.3.2-8 Fedora package.
How can this be?

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.