Bug 164199 - Control of inter-paragraph spacing for same-style paragraphs - beyond suppression
Summary: Control of inter-paragraph spacing for same-style paragraphs - beyond suppres...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Paragraph-Spacing
  Show dependency treegraph
 
Reported: 2024-12-05 22:32 UTC by Eyal Rozenberg
Modified: 2024-12-11 20:26 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Illustration of the insufficiency of the binary control (41.73 KB, application/vnd.oasis.opendocument.text)
2024-12-06 09:49 UTC, Eyal Rozenberg
Details
Illustration of the insufficiency of the binary control (PDF) (45.80 KB, application/pdf)
2024-12-06 09:51 UTC, Eyal Rozenberg
Details
Illustration of the insufficiency of the binary control (42.06 KB, application/vnd.oasis.opendocument.text)
2024-12-06 18:48 UTC, Eyal Rozenberg
Details
Illustration of the insufficiency of the binary control (PDF) (45.42 KB, application/pdf)
2024-12-06 18:48 UTC, Eyal Rozenberg
Details
Zero spacing between PS (192.84 KB, image/png)
2024-12-11 10:21 UTC, Heiko Tietze
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eyal Rozenberg 2024-12-05 22:32:21 UTC
Paragraph styles indicate how much space to add before and after each paragraph; and there is also a binary toggle: "Do not add space between paragraphs of the same style".

So, there is a recognition that inter-paragraph spacing might be different when switching between (a sequence of) paragraphs of different styles, and when continuing from one paragraph to another when both are of the same style; but - why should this intra-sequence-of-paragraphs behavior have only two possibilities:

* No space at all
* Same as when switching paragraph styles

? 

I believe we need another option - the choice of setting some amount of space between consecutive paragraphs of the same style.

Specific use cases:

* Lists of items, each of constituting a paragraph. You wan't to have some spacing between list items - but _more_ spacing between the list and the text surrounding it.
* Code listing: If your line of code somehow overflows and needs to wrap, you want there to be very little space (so line spacing is at most single and maybe even less, e.g. proportional 0.9 or so); and distinguished from this, you set some space between paragraphs, which correspond to actual non-wrapped lines in your code. And, again, you want a larger amount of space between the code listing as a block and the surrounding text.

What we have to do now, as a workaround, is define a triplet of styles, for the first, second and middle paragraphs, which is just annoying.
Comment 1 V Stuart Foote 2024-12-06 01:30:10 UTC
Don't we already have this fully?

Any PS other than 'Single' or 'Proportional at 100%' is applying spacing (as external leading) between paragraphs.  While the base spacing, Single or Proportional at 100%, of the font is always drawn from the font metrics, as designed, and matches its internal leading.

The other PS spacing presets are all as proportional drawn from font metric, except for 'Fixed' and 'Leading' which are specific, and 'At least' spacing which is a "Floor" threshold when multiple font sizes are applied (CS or DF).

Lists Styles do provide spacing between list items, in addition to interline spacing with a multi-line paragraph of a list item. The same spacing before spacing after, or no spacing, as other PS.

Not seeing what more is needed, or how it would be worked into UI.
Comment 2 Heiko Tietze 2024-12-06 07:26:20 UTC
(In reply to Eyal Rozenberg from comment #0)
> * Lists of items, each of constituting a paragraph. You wan't to have some
> spacing between list items - but _more_ spacing between the list and the
> text surrounding it.
Use equal spacing before and after for the surrounding paragraphs (body text) and none for the list (list content).

> * Code listing: If your line of code somehow overflows and needs to wrap,
Line wrapping is not a line break; and Writer is not an IDE.

The use cases appear to be artificial, and I miss the part where the existing features don't allow to achieve a certain goal.

Beyond all that, we are bound to the document standard. And in particular this spacing and indentation is well-defined and will likely not change. => NAB
Comment 3 Eyal Rozenberg 2024-12-06 08:41:42 UTC
(In reply to Heiko Tietze from comment #2)
> (In reply to Eyal Rozenberg from comment #0)
> > * Lists of items, each of constituting a paragraph. You wan't to have some
> > spacing between list items - but _more_ spacing between the list and the
> > text surrounding it.
> Use equal spacing before and after for the surrounding paragraphs (body
> text) and none for the list (list content).

But I _do_ want spacing for the list. I literally said that.


> > * Code listing: If your line of code somehow overflows and needs to wrap,
> Line wrapping is not a line break; and Writer is not an IDE.
> 
> The use cases appear to be artificial,

I encounter it several times each year personally.

> and I miss the part where the
> existing features don't allow to achieve a certain goal.

We need inter-paragraph spacing between paragraphs of the same style, and different spacing from paragraphs of a different style.

> Beyond all that, we are bound to the document standard. And in particular
> this spacing and indentation is well-defined and will likely not change.

That's a non-argument. If ODF does not currently support this, support can be added. ODF is not a static standard; and in fact, we've already agreed in principle on much more fundamental changes to it than this (w.r.t. making language an aspect of content rather than style and breaking the language group trichotomy).
Comment 4 Eyal Rozenberg 2024-12-06 09:35:32 UTC
(In reply to V Stuart Foote from comment #1)
> Don't we already have this fully?

No; but perhaps I've not explained the ask well enough.

> Any PS other than 'Single' or 'Proportional at 100%' is applying spacing (as
> external leading) between paragraphs.

"Single" or "Proportional" is line spacing. Yes, line spacing is also applied to the last line of the paragraph; but if you take that into account, then there are four kinds of inter-line spaces you need to control for a PS MyStyle: Between the baselines of

1. a last line of a non-MyStyle paragraph and the first line of a MyStyle paragraph.
2. consecutive lines within the same MyStyle paragraph.
3. a last line of a MyStyle paragraph and the first line of the next MyStyle paragraph.
4. a last line of a MyStyle paragraph and the first line of a non-MyStyle paragraph.

So, we need 4 different values to be able to set all of these independently. Right now, the value of (3.) is either equal to (2.) or equal to (2.)+(4.). In my descrption of the bug I complained about how (3.)-(2.) is either 0 or equal to (4.).
Comment 5 Eyal Rozenberg 2024-12-06 09:49:44 UTC
Created attachment 197976 [details]
Illustration of the insufficiency of the binary control

Heiko, Stuart - please have a look at the illustrating document.
Comment 6 Eyal Rozenberg 2024-12-06 09:51:09 UTC
Created attachment 197977 [details]
Illustration of the insufficiency of the binary control (PDF)

Same document as a PDF
Comment 7 V Stuart Foote 2024-12-06 15:07:02 UTC
(In reply to Eyal Rozenberg from comment #5)
> Created attachment 197976 [details]
> Illustration of the insufficiency of the binary control
> 
> Heiko, Stuart - please have a look at the illustrating document.

But your Style1 and nested list Style2 inherit from Default PS. They'll have the linked interparagraph spacing. Try each with a different source PS.
Comment 8 Eyal Rozenberg 2024-12-06 18:48:11 UTC
Created attachment 197991 [details]
Illustration of the insufficiency of the binary control

I'm not sure I quite followed Stuart's comment, but - making the 4 styles be siblings rather than having some inherit from Default PS. Also, fixed the correspondence between the text and the styles in some paragraphs.
Comment 9 Eyal Rozenberg 2024-12-06 18:48:32 UTC
Created attachment 197992 [details]
Illustration of the insufficiency of the binary control (PDF)

PDF of attachment 197991 [details].
Comment 10 V Stuart Foote 2024-12-07 13:01:10 UTC
(In reply to Eyal Rozenberg from comment #8)
> Created attachment 197991 [details]
> Illustration of the insufficiency of the binary control
> 
> I'm not sure I quite followed Stuart's comment, but - making the 4 styles be
> siblings rather than having some inherit from Default PS. Also, fixed the
> correspondence between the text and the styles in some paragraphs.

The interline spacing is cumulative--e.g. Style1 0.2cm below + Style2 0.2cm above = 0.4cm

Simply set Style2 PS Above/Below paragraph spacing to 0.1cm and Style1 PS Above/Below paragraph spacing to 0.3cm.  You'll get the same 0.4cm between Style1 and the List in Style2, with distinct spacing between list items.

Not seeing an issue to this.
Comment 11 Eyal Rozenberg 2024-12-07 14:24:42 UTC
(In reply to V Stuart Foote from comment #10)
> Simply set Style2 PS Above/Below paragraph spacing to 0.1cm and Style1 PS
> Above/Below paragraph spacing to 0.3cm.  You'll get the same 0.4cm between
> Style1 and the List in Style2, with distinct spacing between list items.

No, that's not a solution. The spacing of Style 1 cannot be set so as to accommodate lists of Style 2. Is it a certain way because that's what appropriate for Style 1 in other contexts. Not to mention the space between consecutive paragraphs of Style 1.
Comment 12 Regina Henschel 2024-12-08 00:50:02 UTC
(In reply to Eyal Rozenberg from comment #0)
> Paragraph styles indicate how much space to add before and after each
> paragraph; and there is also a binary toggle: "Do not add space between
> paragraphs of the same style".

> 
> So, there is a recognition that inter-paragraph spacing might be different
> when switching between (a sequence of) paragraphs of different styles, and
> when continuing from one paragraph to another when both are of the same
> style; but - why should this intra-sequence-of-paragraphs behavior have only
> two possibilities:
> 
> * No space at all
> * Same as when switching paragraph styles
> 
> ? 

That toggle exists for interoperability with MS Word.

> 
> I believe we need another option - the choice of setting some amount of
> space between consecutive paragraphs of the same style.

The space between paragraphs is given by the paragraph style.

> 
> Specific use cases:
> 
> * Lists of items, each of constituting a paragraph. You wan't to have some
> spacing between list items - but _more_ spacing between the list and the
> text surrounding it.

For that purpose there are the paragraph styles "List N Start", "List N Cont" and "List N End". They are intended that the user can set the desired distances.

> * Code listing: If your line of code somehow overflows and needs to wrap,
> you want there to be very little space (so line spacing is at most single
> and maybe even less, e.g. proportional 0.9 or so); and distinguished from
> this, you set some space between paragraphs, which correspond to actual
> non-wrapped lines in your code. And, again, you want a larger amount of
> space between the code listing as a block and the surrounding text.

Then use different styles for the code and for the text.

> 
> What we have to do now, as a workaround, is define a triplet of styles, for
> the first, second and middle paragraphs, which is just annoying.

When determine the distance between paragraphs of same style by a special setting, you would still have to think about the distance above the first paragraph and the distance below the end paragraph of such text portion. But you are right in regard of the number of needed styles. The questions is, whether that is worth the developer effort.
Comment 13 Regina Henschel 2024-12-08 01:04:17 UTC
(In reply to V Stuart Foote from comment #10)
> The interline spacing is cumulative--e.g. Style1 0.2cm below + Style2 0.2cm
> above = 0.4cm

If paragraph A has a setting margin below of 3mm and paragraph B has a setting margin above of 2mm, then the distance is not the sum 5mm but it is the maximum of 2mm and 3mm. Search for term "collapsing margins", e.g. section 8.3.1 in the for ODF still relevant https://www.w3.org/TR/CSS2/box.html.
Comment 14 Eyal Rozenberg 2024-12-08 17:54:28 UTC
(In reply to Regina Henschel from comment #12)
> That toggle exists for interoperability with MS Word.

Well, I would say it exists because it's an important feature... we may have noticed that because MS Word had it and we didn't.

> The space between paragraphs is given by the paragraph style.

The suggestion is to distinguish between the space between paragraphs of the same style, as opposed the space to paragraphs of another style (below and above).

> For that purpose there are the paragraph styles "List N Start", "List N
> Cont" and "List N End". They are intended that the user can set the desired
> distances.

That's exactly what we should fix. Currently, we would need to artifically create 3 styles, while in fact - it is a single style. Moreover, with that style applied, we would need to change list items' style whenever we rearrange items in the list.

Without the "Do not add space etc." toggle, we would need the 3 styles even for the no-inter-paragraph-style case.

> But
> you are right in regard of the number of needed styles. The questions is,
> whether that is worth the developer effort.

IIANM, I believe most of the work has already been done for supporting the toggle. We already need to have special handling based on whether two paragraphs are of the same or of different styles. The extension from a toggle to a numeric option would require _some_ work, but I should think it is not _that_ much work.
Comment 15 Heiko Tietze 2024-12-11 10:21:36 UTC
Created attachment 198056 [details]
Zero spacing between PS

I still don't understand what is missing. Besides the solution with List Start/Cont/End you can use the zero space option. This is vanilla Body Text (language set to None) with a derived PS that has enabled the option (plus some indentation but that's irrelevant).
Comment 16 Regina Henschel 2024-12-11 12:27:33 UTC
It seems, that in current Adobe InDesign it is possible to set the spacing between paragraphs of same style not only to zero (as in Word and LO) but to other values too. You can set e.g. before 6pt, after 8pt, in between 3pt. But I have not got InDesign to verify those answers I have found in Internet [e.g. section 'Adjust paragraph spacing' in https://helpx.adobe.com/indesign/using/formatting-paragraphs.html]

I think, that it is a valid request to implement such feature in LibreOffice.
Comment 17 Heiko Tietze 2024-12-11 12:59:47 UTC
(In reply to Regina Henschel from comment #16)
> I think, that it is a valid request to implement such feature in LibreOffice.

=> NEW (personally not in favor of this)
Comment 18 Eyal Rozenberg 2024-12-11 20:26:36 UTC
(In reply to Heiko Tietze from comment #15)
> I still don't understand what is missing. Besides the solution with List
> Start/Cont/End

That's just the thing. This feature precludes the need to have 3 styles instead of one. When you style your documents, and you want certain lists to have a certain appearance, part of that appearance is the inter-list-item vertical spacing, which is essentially the inter-paragraph vertical spacing; and another part is the separation between that list and its surrounding. Right now, you can't express both of these with a single style. Think, specifically, about creating document templates and associating a paragraph style with a list style. You want the user to set the single paragraph style, and have everything, including the spacing aspects I mentioned, just work. It wouldn't "just work" if we needed three styles - and the user would have to be much more profcifient and go to a lot of trouble to get the effect the template author wanted.