Bug 75221 - "Don't add space between paragraphs of the same style" also ignores line spacing
Summary: "Don't add space between paragraphs of the same style" also ignores line spacing
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.2.0.0.beta1
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:5.3.0
Keywords:
: 73629 74888 90712 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-02-19 17:59 UTC by Marcos
Modified: 2020-06-25 08:15 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
Style with double spacing and "Don't add space between paragraphs of the same style" (349.62 KB, image/png)
2014-02-19 17:59 UTC, Marcos
Details
How spacing between paragraphs shouls work when "Don't add space between paragraphs of the same style" is selected. (263.54 KB, image/png)
2014-02-19 19:09 UTC, Marcos
Details
Test file with highlighted problem (18.01 KB, application/vnd.oasis.opendocument.text)
2016-06-20 05:50 UTC, Alexander Polkhovskiy
Details
Example of DOCX file incorrectly imported because of bug (11.27 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2016-08-24 20:45 UTC, Luke
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcos 2014-02-19 17:59:15 UTC
Created attachment 94375 [details]
Style with double spacing and "Don't add space between paragraphs of the same style"

When "Don't add space between paragraphs of the same style" is checked for a style and line spacing for that style is different from "simple", line spacing is ignored between the last line of a paragraph and the first line of next paragraph.
The result isn't coherent with the line spacing defined.
Comment 1 Cor Nouws 2014-02-19 18:19:16 UTC
Hi Marcos,

I cannot reproduce this in 4.2.1.1. Or in any case I do not understand it :)

Can you pls explain which marked distance in your attachment (thanks) is not OK, and should be what?

regards,
Cor
Comment 2 Marcos 2014-02-19 19:09:54 UTC
Created attachment 94378 [details]
How spacing between paragraphs shouls work when "Don't add space between paragraphs of the same style" is selected.
Comment 3 Marcos 2014-02-19 19:10:57 UTC
Hi, Cor.

In the attachment, the arrow that says "space between two paragraphs with style Citação" should be (I think) the same as two lines in those paragraphs. As you can see, line spacing in those paragraphs is Double but the spacing between two paragraphs ignores that.
The way I see it, it would make more sense if the spacing between those two lines that are close to each other was the same that the spacing between any two other lines.
In short, the space in the third arrow should be the same as the second arrow.
That would happen if the option "Don't add space between paragraphs of the same style", instead of remove ALL the spacing, used the default line spacing of that style (ignoring only "space before" and "space after").

Sorry if some of the terms aren't precise. I'm using a Portuguese version and I don't have access to an English one right now.

I have posted another image of how I think it should work so you can compare. Maybe it's a bug, maybe it works like that by design, maybe you can clarify.

Thanks!
Comment 4 Mike Kaganski 2014-04-11 15:12:05 UTC
Reproducible with 4.2.0.0.beta1 - 4.2.3.3 under Win7x64, 4.2.3.3 under Ubuntu 13.10 x64 -> NEW.

Steps to reproduce:
1. Create a new empty text document.
2. Write a paragraph several lines long.
3. Add several other paragraphs one line long.
4. Go to Styles and Formatting, Paragraph Styles, modify current paragraph style to have double line spacing and no spacing above or below the paragraph, and uncheck "Don't add space between paragraphs of the same style" (Idents and Spacing tab) -> OK.
5. See that all lines are spaced evenly.
6. Go to Styles and Formatting, Paragraph Styles, modify current paragraph style to check "Don't add space between paragraphs of the same style" and add some spacing above or below paragraph -> OK.

Expected result: the spacing between lines (of these same-style paragraphs) should stay equal regardless of if they are inside one paragraph or between same-style paragraphs, i.e. they should all be equal to Line Spacing setting.

Actual result: the spacing inside paragraph stays OK, while spacing between adjacent same-style paragraphs become single. This is absolutely inappropriate, because:
- the "Don't add space between paragraphs of the same style" checkbox is grouped with "Above/Below paragraph spacing" settings, and expected to affect only that behaviour;
- the help system further confirms this, saying "Makes any space specified before or after this paragraph not be applied when the preceding and following paragraphs are of the same paragraph style" (see https://help.libreoffice.org/swriter/cui/ui/paraindentspacing/spinED_LEFTINDENT?Language=en-US&System=WIN&Version=4.2#Don.27t_add_space_between_paragraphs_of_the_same_style);
- this wrong behaviour makes this option absolutely unusable in scenarios where non-single-line spacing is used. You just cannot make normal text body with double spacing to look OK when this checkbox is checked!

This is not a minor issue, as it makes this newly introduced feature barely usable. Thus restoring severity to NORMAL.
Comment 5 Bacco 2014-05-11 18:01:56 UTC
I can confirm this issue on

Version: 4.2.0.4
Build ID: 05dceb5d363845f2cf968344d7adab8dcfb2ba71

By the way in the worst possible situation. I am formatting an academic paper, and this behavior is making the task cumbersome and full of kludges. Line-spacing should be respected between paragraphs of same type, no matter the checkbox state.

Additional shame: Installed L.O. to various friends in similar tasks saying that L.O. will be better than the "famous commercial suite", as the suite in question is full of inconsistencies :(
Comment 6 Bacco 2014-05-11 18:04:49 UTC
Please read: "academic work" instead of paper. And the shame on me, not L.O., as I know that bug happens.

PS: "Beware" that my native language is Portuguese ;)
Comment 7 Marcos 2014-05-12 04:45:52 UTC
I can confirm that the bug is still present in version 4.2.4.2.
Comment 8 Marcos 2014-06-16 21:33:01 UTC
The bug persists in version 4.2.5.2.
Comment 9 Marcos 2014-07-25 23:21:45 UTC
I just tested. Bug persists in 4.2.6.2.
Comment 10 Alexander Polkhovskiy 2014-11-22 18:34:41 UTC
Also presents in 4.3.4.1.
Comment 11 QA Administrators 2015-12-20 16:09:15 UTC Comment hidden (obsolete)
Comment 12 Alexander Polkhovskiy 2015-12-21 09:20:22 UTC
The problem still here.
LO v 5.0.4.2
Windows 8.1 x64
Comment 13 Luke 2016-06-19 17:41:49 UTC
Can we get a test document? I cannot reproduce this.
Comment 14 Alexander Polkhovskiy 2016-06-20 05:50:12 UTC
Created attachment 125743 [details]
Test file with highlighted problem

Here you are. LO 5.1.3.2 Windows 8.1 x64.
Comment 15 Luke 2016-06-21 16:48:21 UTC
Added Miklos who was the mastermind behind the implementation for contextual spacing in 3.6, and Andras who was behind the spec.
 
Miklos, 
Could you please take a look at this? It doesn’t appear to match the spec[1] or how it’s implemented with in other word processors. 

[1] https://issues.oasis-open.org/browse/OFFICE-3767
Comment 16 Peter 2016-08-19 09:02:00 UTC
I think this is not a bug but a misconception. Space between paragraphs actually means additional space. The expected functionality is:

Definitions:

nominal_space_above_paragraph = space between lines in paragraph
nominal_space_below_paragraph = 0 (no space)
nominal_space_of_paragraph = nominal_space_above_paragraph
additional_space_above_paragraph
additional_space_below_paragraph

Space between former paragraph1 and following paragraph2 is

space_paragraph1_paragraph2 = nominal_space_of_paragraph2 + additional_space_above_paragraph2 + additional_space_below_paragraph1

When "don't add space" is on

space_paragraph1_paragraph2 = nominal_space_of_paragraph2

I think the importance must be high because when line spacing is not single the all stuff is useless.


PS. In my opinion, the better is:

space_paragraph1_paragraph2 = nominal_space_of_paragraph2 + max(additional_space_above_paragraph2, additional_space_below_paragraph1)
Comment 17 Alexander Polkhovskiy 2016-08-19 09:22:48 UTC
That's it. Usually docs are formatted with 1.5x line spacing. I want to use this feature to add spacing after plain text before next header.
For now, I use spacing before header, but it looks bad when u have two header following each other (e.g. H1 and H2, then plain text) - two spacings are combined. I wanted to work without "spacing before" headers, but need additional spacing after plain text then. In this case I get it inside plain text, and no chance to make it work with this option (no spacing between same style paragraphs).
Comment 18 Cor Nouws 2016-08-19 19:48:24 UTC
(In reply to Alexander Polkhovskiy from comment #17)
> That's it. Usually docs are formatted with 1.5x line spacing. I want to use
> this feature to add spacing after plain text before next header.
> For now, I use spacing before header, but it looks bad when u have two
> header following each other (e.g. H1 and H2, then plain text) - two spacings
> are combined. ....

What about Options > Writer > compatibility > Add spacing between tables and headers (current document) ?
Comment 19 Alexander Polkhovskiy 2016-08-20 19:32:31 UTC
(In reply to Cor Nouws from comment #18)
> (In reply to Alexander Polkhovskiy from comment #17)
> > That's it. Usually docs are formatted with 1.5x line spacing. I want to use
> > this feature to add spacing after plain text before next header.
> > For now, I use spacing before header, but it looks bad when u have two
> > header following each other (e.g. H1 and H2, then plain text) - two spacings
> > are combined. ....
> 
> What about Options > Writer > compatibility > Add spacing between tables and
> headers (current document) ?

It is checked as it is by default. But how should it help me?
Comment 20 Cor Nouws 2016-08-23 11:22:09 UTC
(In reply to Alexander Polkhovskiy from comment #19)

> It is checked as it is by default. But how should it help me?

Check off makes (or should make) that the spacings from H1 and H2 are not combined.
Comment 21 Alexander Polkhovskiy 2016-08-24 16:03:55 UTC
(In reply to Cor Nouws from comment #20)
> (In reply to Alexander Polkhovskiy from comment #19)
> Check off makes (or should make) that the spacings from H1 and H2 are not
> combined.

This settings page really helps to manage problems.
I've unchecked "Add spacing between tables and headers (current document)" and "Sum spacing between paragraphs and tables (current document)". Now it seems to be like I want it to be.
Thank you very much!
Comment 22 Cor Nouws 2016-08-24 16:18:11 UTC
thanks for checking and reporting back!
Comment 23 Luke 2016-08-24 20:45:58 UTC
Created attachment 127010 [details]
Example of DOCX file incorrectly imported because of bug

Cor,
We do not typically close bugs just because someone suggested a workaround. We implemented a feature that's found in MS Word, Google Docs, Kingsoft Writer, and WordPerfect, and gave it the same exact name as found in those other wordprocessors. If we don't behave the same way, it's a bug. If we don't follow our own spec, it's a bug.

I followed the steps in Comment 4 with LibreOffice Writer 5.3, Word 2013, and Kingsoft Writer. Only LibreOffice ignored the double spacing when I unchecked "Don't add space between paragraphs of the same style". In addition when I saved the Word test document as a .doc and .docx, Google Docs and Kingsoft Writer correctly imported both of the documents, while LibreOffice failed on both of them.
Comment 24 Cor Nouws 2016-08-25 10:43:56 UTC
(In reply to Luke from comment #23)

> We do not typically close bugs just because someone suggested a workaround.

Of course we don't - I misinterpreted Alexander's comment apparently: thought that the setting made the problem disappear.
Comment 25 Alexander Polkhovskiy 2016-08-25 11:38:37 UTC
(In reply to Cor Nouws from comment #24)
> Of course we don't - I misinterpreted Alexander's comment apparently:
> thought that the setting made the problem disappear.
Unfortunately, it made only part of the problem disappear, but didn't make the subject work fine. So, it's only a workaround to get particular behavior.
Sorry for my bad English, if my words are not that clear. And thanks for your help!
Comment 26 Cor Nouws 2016-08-25 11:57:05 UTC
(In reply to Alexander Polkhovskiy from comment #25)

> Sorry for my bad English, if my words are not that clear. And thanks for
> your help!

No need to say sorry - might well be that I was a bit to hasty ;\
Thanks for your understanding!
Comment 27 Mike Kaganski 2016-09-06 14:41:23 UTC
A patch submitted to gerrit: https://gerrit.libreoffice.org/28692
Comment 28 Commit Notification 2016-09-08 21:10:36 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ba18832ceeda21f047a664b71a4333a54737e6c8

tdf#75221: make margin collapsing implementation conform OASIS proposal

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 29 Luke 2016-09-14 07:37:46 UTC
Verified FIXED in Version: 5.3.0.0.alpha0+
Build ID: 1013587c03d168b54349b5d47c8359e97acc0ad5

All these interoperability improvements are making a huge difference. Thank you Mike!
Comment 30 Alexander Polkhovskiy 2016-09-14 10:46:33 UTC
I confirm it's fixed in Version: 5.3.0.0.alpha0+
Build ID: ba269f7294e2416659011cbb498a2c6b5f9d5199
Win 8.1 x64
Thank you very much for this work!
Comment 31 Justin L 2017-09-04 19:59:48 UTC
*** Bug 73629 has been marked as a duplicate of this bug. ***
Comment 32 Xisco Faulí 2017-10-27 11:08:39 UTC
*** Bug 74888 has been marked as a duplicate of this bug. ***
Comment 33 Xisco Faulí 2017-10-28 18:24:34 UTC
*** Bug 90712 has been marked as a duplicate of this bug. ***