Bug 162043 - [ENHANCEMENT] Make spacing at tops of pages a property of paragraph styles
Summary: [ENHANCEMENT] Make spacing at tops of pages a property of paragraph styles
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.5.2 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: ODF-spec Paragraph-Spacing
  Show dependency treegraph
 
Reported: 2024-07-15 09:36 UTC by ajlittoz
Modified: 2024-07-31 05:11 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Unselective spacing above suppression (13.60 KB, application/vnd.oasis.opendocument.text)
2024-07-15 09:36 UTC, ajlittoz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ajlittoz 2024-07-15 09:36:29 UTC
Created attachment 195310 [details]
Unselective spacing above suppression

Setting "Add paragraph and table spacing at tops of pages" allows to keep _spacing above_ from paragraph style after an "explicit" page break.

This is usually used to offset downwards chapter headings (Heading 1).

Other headings (1-10) do not require a page break. Therefore when page overflow occurs, text or heading is set at the very top of the page (spacing above ignored).

There are however circumstances where a page break is inserted before a heading and spacing above should nevertheless be ignored. Here a use case:

Chapter heading starts a new page (_çpage break before_). It is followed by a legend for a picture (frame anchored to the legend paragraph). Since the size of the frontispiece picture is not constant, legend paragraph style requests a page break _AFTER_.

Next paragraph is a Heading 2 which starts the second page of the chapter. Here _spacing above_ is kept because the paragraph is preceded by a hard page break. When document is laid out for facing pages, it may happen that page 3 also starts with a Heading 2. But the position of this latter Heading 2 results from normal text flow (eventually after taking into account widow/orphan and keep with next controls) and _spacing above_ is suppressed as expected.

This results is a bad visual effect where headings don't align vertically, the one on left page being offset downwards for no obvious reason (to a casual non-technical reader).

This can be solved by transferring the "spacing at tops" into the `Indents & Spacing` tab of paragraph styles.

To preserve compatibility with existing documents, the value of the check box should be the same as that of Tools>Options, LibreOffice Writer>Compatibility.

===
"Bibliography"

This issue is the subject of bug 146881.

I disagree with the suggested workaround in bug 146881 comment 3 because it is not always possible. Also it would break the "smoothness" of the outline, requiring that some *Heading n* to be duplicated for no semantic reason (and this would be akin to some tricky direct formatting if subchapters need to be reordered). Note also that the use case above relies on _page break AFTER_ where you can't specify a new page style.

(By the way, why are page breaks before and after handled differently?)

===
Other consideration(s)

The setting also mentions tables. Tables also have spacing setting in their Table tab. Providing the same fix (new "spacing at tops" checkbox) makes the enhancement consistent.


===
Sample document

I tried to reproduce the behaviour but it is highly dependent on font metrics. If Heading 2 "Spacing above suppressed" is not at top of page 3, vary the amount of text in page 2.

Sample file is made with Liberation Sans and Serif.
Comment 1 Stéphane Guillou (stragu) 2024-07-30 12:06:39 UTC
Regina, I feel like this request has to be judged from the ODF angle. An opinion?
Comment 2 Regina Henschel 2024-07-30 13:40:10 UTC
ODF has not attribute to specify the behavior. LibreOffice writes it in settings.xml as config-item "AddParaTableSpacingAtStart". Settings from setting.xml need not be understandable for other applications.

In XSL-FO the attribute would be space-before.conditionality with value "discard". But ODF has only fo:margin-top, not fo:space-before for paragraphs.

I think the current behavior of LibreOffice is a bug. If the setting is such that margin-top is ignored for the first paragraph of a page, then this must happen regardless of the reason for the page break.
Comment 3 Regina Henschel 2024-07-30 13:51:44 UTC
... But as this is a compatibility setting, the behavior for the case that spacing has to be added, should follow the way it is done in other applications. I have not tested other applications.

Bringing the property "Add paragraph and table spacing at tops of pages" to ODF as regular paragraph attribute, would require a new attribute similar to "conditionality" in XSL-FO. To implement such attribute in LibreOffice (including request to add it to ODF) is a valid enhancement request.
Comment 4 Stéphane Guillou (stragu) 2024-07-31 05:11:53 UTC
Thank you Regina, let's mark as "new" then.