Bug 103866 - Formula Vertical Alignment issue
Summary: Formula Vertical Alignment issue
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: Font-Rendering
  Show dependency treegraph
Reported: 2016-11-11 14:45 UTC by Ben
Modified: 2022-04-15 22:26 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:

Misaligned formulas (3.39 KB, image/png)
2016-11-11 14:46 UTC, Ben
Alignment (1.26 KB, image/png)
2016-11-12 14:20 UTC, Ben
odt document with mis-alignment issues (80.77 KB, application/xml)
2017-06-19 22:27 UTC, Ben
PDF document with mis-alignment issues (106.47 KB, application/pdf)
2017-06-19 22:28 UTC, Ben
Vertical mis-alignment in table (1.25 KB, image/png)
2017-07-03 16:20 UTC, Ben
Misalignment in table (1.25 KB, image/png)
2017-07-03 16:26 UTC, Ben
Formula aligment in footnote (4.78 KB, image/png)
2017-07-07 20:44 UTC, Ben
Formula-Text Misalignment (62.10 KB, image/jpeg)
2022-04-14 00:49 UTC, Ben
Screenshot spacing (17.68 KB, image/jpeg)
2022-04-14 01:08 UTC, Ben
Formula Frame Style Screenshot (62.63 KB, image/jpeg)
2022-04-14 16:09 UTC, Ben
Formula Alignment Screenshot (68.47 KB, image/jpeg)
2022-04-14 16:10 UTC, Ben
Formula alignment in odt file (32.81 KB, application/vnd.oasis.opendocument.text)
2022-04-15 20:22 UTC, Ben

Note You need to log in before you can comment on or make changes to this bug.
Description Ben 2016-11-11 14:45:33 UTC
Whenever an inline formula is created, it often does not vertically center with the inline text. Even if even an equal number of subscripts and superscripts are used this often does not completely vertically center the formula relative the surrounding regular text. Manual centering using Alt-up/down key is possible but this is very time-consuming and the results are often not good to get professionally looking results. This issue has been present for many years and has caused much extra editing work of large documents. Other editors like MS Word and LATEX don't have this issue.

Steps to Reproduce:
1. In Writer editor, create text
2. Create a math formula behind it
3. Formula may or may not be vertically aligned with the text (behavior seems random)

Actual Results:  
See attachment

Expected Results:
Formulas that look like the surrounding text in terms of formatting

Reproducible: Always

User Profile Reset: No

Additional Info:

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.35 Safari/537.36
Comment 1 Ben 2016-11-11 14:46:28 UTC
Created attachment 128662 [details]
Misaligned formulas
Comment 2 A (Andy) 2016-11-12 07:24:35 UTC
Reproducible with LO (Win 8.1).  The characters in the math formula (with the same font settings) seem to be about 1 or 1/2 (unfortunately I can not measure it because it is quite small) milimeter lower than the normal text.  Even if it is a small difference you can recognise it with your eyes (see also the attachment).

But I also have the feeling that the rendering of the characters is a little bit different.  If I have the text and the formula in italics then text seems to be more italicised (more slanting) that the formula (take the same character and font settings to test it).
Comment 3 Ben 2016-11-12 14:20:20 UTC

I agree with your observation the rendering of character is a bit different sometimes. I will try to provide more examples.

On my original alignment item; see attachment:
- The first and last P sub 0 are text
- The second one is P sub 0 and is not properly aligned
- The third one is P sub 0 sup 0 and seems to be properly aligned but I have seen cases where this is not so
Comment 4 Ben 2016-11-12 14:20:50 UTC
Created attachment 128693 [details]
Comment 5 Ben 2017-05-17 22:56:40 UTC
Issue still occurs in Version: (x64)
Comment 6 Ben 2017-06-10 21:29:59 UTC
Any idea when the vertical alignment issue of formulas will be resolved? I have a very large document with hundreds of formulas with this issue and am getting close to a publication deadline.
Comment 7 Ben 2017-06-19 22:26:07 UTC
Version: (x64)

More issues identified in the attached document. It also ripples over into the PDF document (also attached) where you can see the alignment issues even better.

I also created formulas in a completely new document with the same effect.

In the latest development version, when clicking on some formulas, the mis-alignment issue seemed to be reduced a bit.

I hope this issue gets resolved soon. It has been around for many years and i'm getting close to a publication deadline.
Comment 8 Ben 2017-06-19 22:27:38 UTC
Created attachment 134142 [details]
odt document with mis-alignment issues
Comment 9 Ben 2017-06-19 22:28:16 UTC
Created attachment 134143 [details]
PDF document with mis-alignment issues
Comment 10 Ben 2017-06-24 20:27:26 UTC
Since this also occurs in the PDF, does the odt file store the vertical displacement of each formula? If so, then the rule used to calculate the necessary vertical displacement appears to be incorrect.

Note that I have the math baseline alignment checked. In the past, I had this unchecked and tried to get the alignment manually correct. With the math baseline alignment checked this cannot be done manually.
Comment 11 Ben 2017-07-03 16:18:28 UTC
Issue also occurs in tables. The vertical alignment if off when creating different formulas on the same row on a table, see attachment.
Comment 12 Ben 2017-07-03 16:20:06 UTC
Created attachment 134458 [details]
Vertical mis-alignment in table
Comment 13 Ben 2017-07-03 16:26:45 UTC
Created attachment 134459 [details]
Misalignment in table
Comment 14 Ben 2017-07-03 16:28:25 UTC
This bug already exists since 2001: 16 years
Comment 15 Ben 2017-07-07 20:43:46 UTC
Formula alignment in footnote is also incorrect, even with symmetrical sub+superscript. See attachment.

size 10
setR sup N sub " " 
Comment 16 Ben 2017-07-07 20:44:35 UTC
Created attachment 134535 [details]
Formula aligment in footnote
Comment 17 Ben 2017-10-05 00:01:24 UTC
Can an indication be provided when this issues might be resolved? I'm working on a book and the final editing process has started. This is a pervasive issue that appears across the whole book.
Comment 18 QA Administrators 2018-10-06 02:50:55 UTC Comment hidden (obsolete)
Comment 19 Roman Kuznetsov 2018-10-06 08:10:08 UTC

Build ID: 1aa37aa6bee19099b57555a6d839992b054aa405
CPU threads: 4; OS: Windows 10.0; UI render: GL; 
TinderBox: Win-x86@42, Branch:master, Time: 2018-09-23_10:17:54
Locale: ru-RU (ru_RU); Calc: threaded

I don't see this problem

Ben, Can you retest your problem yourself?
Comment 20 QA Administrators 2019-10-07 03:03:12 UTC Comment hidden (obsolete)
Comment 21 QA Administrators 2021-10-07 03:53:11 UTC Comment hidden (obsolete)
Comment 22 Ben 2022-04-14 00:49:04 UTC
Created attachment 179544 [details]
Formula-Text Misalignment
Comment 23 Ben 2022-04-14 00:52:04 UTC
The original formula-text vertical misalignment issue still persists. It can be seen on the screen (see screenshot) and is even more pronounced in the Print View after zooming in.
Comment 24 Ben 2022-04-14 01:07:31 UTC
One of the formulas in the Formula-Text Misalignment screenshot: %DELTA t sub 0 sup " ".
See also the newly attached Spacing screenshot.
Comment 25 Ben 2022-04-14 01:08:07 UTC
Created attachment 179545 [details]
Screenshot spacing
Comment 26 Ben 2022-04-14 01:10:52 UTC
Note that the current version of LibreOffice that I use is (x64). The issue has existed since version when I originally reported it.
Comment 27 sdc.blanco 2022-04-14 02:43:01 UTC
Just curious, have you -
   - tried editing the properties of the Formula frames? 
   - used some of the alignment features in the Formula editor (see Math Guide 7.2 at https://documentation.libreoffice.org/en/english-documentation/)
   - searched in http://ask.libreoffice.org, or asked for help there with a specific example?

I ask these innocent questions because the Steps to Reproduce provided in comment 0 seems to indicate a (false) expectation that formulas are always aligned automatically.  If that speculation is true, then maybe you should be pursuing those lines.

On the other hand, if you think there is a specific bug with formula alignment then it may be better to attach an .odt document with an actual example of misalignment, where you explain here in detail how you created the example (e.g., modifications to the formula frame, etc.), and identify precisely what was expected in that example and what does not fit your expectations. I looked at the two recent attachments, but without knowing what you did to create the examples (and what you expect to see), then it is impossible to know if there is a genuine problem with the software, or an honest misunderstanding about how to use it.
Comment 28 Ben 2022-04-14 16:08:31 UTC
Thank you for the suggestions.

I used various options under frame style but it did not have the proper effect (see Frame Style screenshot).

I have tried to apply the formula alignment features (Select Formula, Format, Frame and Object, Properties, Type tab). The As character option is blanked out, The To Character option (see screenshot offers some settable options but none resolved the issue.

I created a new document (File, New, Text document) and tried both options with the same issues. 

It is unclear to me if this is a bug or global property that is improperly set. I would appreciate it if we could set up a screen-sharing session so that we can quickly toggle through various options and determine what is the most likely issue. My email address can be used to communicate. Obviously, I would like to get this issue solved before publishing the material.
Comment 29 Ben 2022-04-14 16:09:26 UTC
Created attachment 179565 [details]
Formula Frame Style Screenshot
Comment 30 Ben 2022-04-14 16:10:06 UTC
Created attachment 179566 [details]
Formula Alignment Screenshot
Comment 31 sdc.blanco 2022-04-14 21:48:55 UTC
(In reply to Ben from comment #28)
Ben --the bugs system here is only for identifying bugs and confirming enhancement ideas, but it requires that the bug submitter gives a clear procedure for how to produce the bug, and a specific identification of what has actually happened compared to the expected behavior of the software.

> It is unclear to me if this is a bug or global property that is improperly
> set. 
Fair enough.  

If you want help from others to solve your formatting problems then http://ask.libreoffice.org is the right place to go. There are knowledgeable persons there, who usually respond quickly, and often are able to identify something as a likely or potential bug (and even suggest to file a report here).  (Some of the bug reports started as a ask.libreoffice.org query)  

In light of the situation, I propose that we Resolve this ticket as INSUFFICIENTDATA (which is the local convention for saying that the bug report was not specific enough to be addressed).  How does that sound?

Meanwhile, as a friendly suggestion, try https://ask.libreoffice.org. 
Pick just one formula that you think is particularly difficult or problematic, and ask for help there about how to format that one formula.  

From understanding that one case, you are likely to gain a better general understanding of how to approach other formula, or you can continue to ask questions there.
Comment 32 sdc.blanco 2022-04-14 22:05:15 UTC Comment hidden (obsolete)
Comment 33 Ben 2022-04-15 20:21:59 UTC
This issue can be further investigated by inspecting the attached .odt file. After trying various changes once again, similar to what people have reported, I do think this is a bug and not a formatting issue. Please check this in both Windows and other environments. Unfortunately, this has literally taken me many days of investigations on the Internet and trying all kinds of workarounds.
Comment 34 Ben 2022-04-15 20:22:47 UTC
Created attachment 179596 [details]
Formula alignment in odt file
Comment 35 sdc.blanco 2022-04-15 22:26:26 UTC
(In reply to Ben from comment #33)
> I do think this is a bug and not a formatting issue. 
You do not need to determine if it is a bug. But, as noted in comment 31, you need to provide sufficient information. The evaluations here are based on the concrete information, not on assertions or intuitions about bugs. Without that information, it is impossible to evaluate the situation.

Cited from:  How to Report Bugs in LibreOffice

All bug reports should have at minimum:
    your Operating System and version of LibreOffice;
    clear reproducible steps;
    expected results;
    observed results; and
    a simple attachment where appropriate.