Bug 162401 - Writer changes math formula
Summary: Writer changes math formula
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
25.2.0.0 alpha0+
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Visual-Mode-of-Formula-Editor
  Show dependency treegraph
 
Reported: 2024-08-08 17:16 UTC by Dennis Polis
Modified: 2024-08-13 03:13 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Polis 2024-08-08 17:16:12 UTC
Description:
In math I created:
{ ( { - { nitalic ℏ ^ 2 over { 2 m } } nitalic ∇ ^ 2 { ` + V ^ N } ( { bold x , t } ) { ` + sum to { n } from { { j = 1 } } left langle italic ψ _ j mline italic V ^ ee mline italic ψ _ o right rangle } { ` - sum to { n } from { { j = 1 } } { } } langle italic ↕ _ j mline { italic ↕ _ o { } } rangle left langle italic ψ _ j mline italic V ^ ee mline italic ψ _ o right rangle } ) ` ψ _ o ( { bold x , t } ) { ` = ` } i nitalic ℏ { frac { { ∂ ψ _ o ( { bold x , t } ) } } { { ∂ t } } } }
In writer, I set the size to 11 and saved my text. On loading it again, the formula was
 size 12
 { left ( -  {  { hbar  rSup { size 8{2} } }  over  {2m} }  nabla  rSup { size 8{2} } ` ital "+V" rSup { size 8{N} }  left ( ital "x,t" right )`+ Sum cSub { size 8{ ital "j="1} }  cSup { size 8{n} }  { langle ψ rSub { size 8{j} }  mline V rSup { size 8{ ital "ee"} }  rangle 
newline
ψ rSub { size 8{o} }  rangle } ` -  Sum cSub { size 8{ ital "j="1} }  cSup { size 8{n} }  {}  langle ↕ rSub { size 8{j} }  mline ↕ rSub { size 8{o} }  rangle  langle ψ rSub { size 8{j} }  mline V rSup { size 8{ ital "ee"} }  rangle 
newline
ψ rSub { size 8{o} }  rangle  right )`ψ rSub { size 8{o} }  left ( ital "x,t" right )`=`i hbar  {  { partial ψ rSub { size 8{o} }  left ( ital "x,t" right )}  over  { partial t} } } {}
This formula displays with errors.  This has happened more than once. I am using version 25.2.5.2 under Windows 10 on a Dell Latitude E6440.

Steps to Reproduce:
1.Paste formula into Writer document.
2.Save. 
3.Close Writer. Restart and load saved document.

Actual Results:
See above

Expected Results:
An unchanged formula description. There is no reason to change the formula description when it works as written.  The revision is not only wrong, it is longer and harder to follow.


Reproducible: Always


User Profile Reset: No

Additional Info:
build bffef4ea93e59bebbeaf7f431bb02b1a39ee8a59
Comment 1 Regina Henschel 2024-08-08 18:50:27 UTC
I cannot confirm it. Tested with Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: dc9486f2443fa52588b625c0a2a288bff56a7a45
CPU threads: 32; OS: Windows 11 X86_64 (10.0 build 22631); UI render: Skia/Vulkan; VCL: win
Locale: de-DE (de_DE); UI: en-US
Calc: threaded

Do you have enabled Tools > Options > Math > Settings > Miscellaneous Options, Option "Enable visual editing"? If yes, disable it and try again.

You are aware that a Math-object is a separate document with its own setting for font size?

Your report is not detailed enough.
How do you paste the formula to Writer?
a) Save it to .odf file in Math-Module and insert this .odf file as OLE object in Writer?
b) Insert > OLE object > Formula Object. Paste text from Math command window into the formula command window in Writer.
c) Paste text from Math command window to Writer text. Mark the text and click on Formula-Icon in toolbar.
d) Use Autotext Fn, double-click example formula and exchange the example text with the text from Math command window.

Where do you have set the size to 11 and how do you have done it? Was the size set directly or by style, for a paragraph or for characters, on the text in Writer or inside the Math object?
Comment 2 Dennis Polis 2024-08-09 14:25:09 UTC
I forgot to add that because the receiver of my document does not accept .odt, I saved and loaded the document in .doc format. The change in representation appears to be the result of the conversion process. It does not occur when the document is save and loaded in .odt format.

1 Yes I saved it in Math and inserted it as an odt object by copy and paste.

I set "size 11" at the very beginning in Writer, where the system added "size 12".  See the the sample I provided.
Comment 3 Regina Henschel 2024-08-09 20:55:56 UTC
(In reply to Dennis Polis from comment #2)
> I forgot to add that because the receiver of my document does not accept
> .odt, I saved and loaded the document in .doc format.

That is a very import information. Look at Tools > Option > Load/Save > Microsoft Office. There you will find the option "MathType to LibreOffice Math or reverse. When this option is on, then LibreOffice converts the Math Object to an "Microsoft Equation Editor 3.0" object.
This equation editor needs the font size information directly in the formula text. Thus the basis font size and every font size changes (e.g. limits to integral) are written as "size n" attribute. The information, that it has been a LibreOffice Math object is lost. An therefore on reading the "size n" attributes are retained on loading.
When the option is off, then the Math formula is not converted but embedded as OLE object. Which means, it is still a LibreOffice Math formula on opening.

So this is not a bug.

What will be the best solution for you, depends on what the receiver of your document is expected to do with the document. I think, you should not discuss that here in the bug report but on Ask. https://ask.libreoffice.org/c/english/5
Comment 4 Dennis Polis 2024-08-10 14:46:41 UTC
Thank you for your comment; however, there is a bug. The change in size from 11 to 12 is a side issue.  The main issue can be seen by comparing the formula images produced by the two descriptions included in my report.  The bug is: the loaded description does not produce the formula image produced by the saved description. Display and compare them. The second description contains a number of "?"s -- indicating that Writer cannot parse it.  Whatever the settings, saving and loading a document should not result in a well-formed formula description becoming one that cannot be parsed.
Comment 5 V Stuart Foote 2024-08-10 17:39:41 UTC
What you identify as "description" is the formula 'Command window' where formula input syntax is StarMath [1][2].

There are issues with layout of formulas with the now *enabled by default* Visual editor mode (i.e. bug 160150)

So please disable the 'Enable visual editing' toggle from Tools -> Options -> LibreOffice Math -> Settings and retest the filter export to MathML and roundtrip to MS ww8 or OOXML. The export filter handling to MathML and reduced bracketing should improve.

Please let us know.

=-ref-=
[1] https://help.libreoffice.org/latest/ro/text/smath/main0000.html
[2] MathGuide (7.5) see Appendix A for the StarMath markup, https://nextcloud.documentfoundation.org/s/mQWELLbAX9R52MN  unfortunately the Visual editor mode is not well documented (bug 159989) and the SM/MathML it produces can be rather flawed.
Comment 6 Dennis Polis 2024-08-12 14:31:18 UTC
I disabled visual editing in Math. It did not seem to change the content of the command window. I copied the command window.

I pasted the result into my Writer document into the old command box (where I already had the formula). I saved a copy of my text as a .doc file.

I opened the saved file with my old Word 2003. It was missing the first h-bar, but otherwise correct. (This has happened before and corrected itself when I resized the formula in Word.) However, this time when I clicked on the formula in Word, it crashed. "EQNEDT32.EXE - Fatal Application Exit" "can't find chunk to free" Needless to say, I did not save from Word -- nor have I before.

I closed the Writer window from which I had saved the .doc file and then opened the test file in Writer. As before, the size changed from 11 to 12, but more importantly, it still cannot be parsed. (5 inverted question marks).
Comment 7 QA Administrators 2024-08-13 03:13:50 UTC Comment hidden (obsolete)