Bug 89714 - Orphan and widow control should be on by default
Summary: Orphan and widow control should be on by default
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Justin L
QA Contact:
URL:
Whiteboard: target:5.1.0
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-27 10:27 UTC by rbruenner
Modified: 2016-10-25 19:17 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
ODF text document to demonstrate orphan widow function (13.32 KB, application/vnd.oasis.opendocument.text)
2015-03-02 13:23 UTC, V Stuart Foote
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rbruenner 2015-02-27 10:27:27 UTC
In all paragraph styles, widow and orphan control should be enabled by default.  Orphaned text on the top or bottom of a page is simply bad looking and bad typography. Users unaware of this setting unnecessarily produce documents with mediocre typography. There is no obvious reason why it should be off as it is now.

After installing LO, you always have to remember to activate widow and orphan control on all paragraph styles and save the new document template as default.
However, when opening an HTML page in Writer, it does not respect this setting. You have to manually re-enable widow and orphan control before you are going to save as odt file - each and every time.

Cheers
Comment 1 Cor Nouws 2015-02-27 11:26:32 UTC
hi rbruenner,

thanks for the issue. Sounds good.

Should it be activated in Text Body or in Standard?
Reason for the question: how would inheritance influence other styles that are derived from Standard? Didn't look in details, but maybe it's not always desired?

Cheers,
Cor
Comment 2 rbruenner 2015-02-27 12:00:01 UTC
Hi Cor,

fine that you find it useful.

I would say that it should be applied to both, Standard and Text Body, and it should be inherited to all other styles as well.

A long header text that is wrapped in two lines looks especially ugly when there is a page break in between. The same is true for list items, table cells, index entries, table of contents items, etc. Off my head, I simply cannot imagine a situation where an orphaned line with a few words does not look bad. Of course, if the user does not want widow and orphan control (to save space for printing), he/she should be able to go ahead and change this. I am just talking about the default, out-of-the-box-behaviour. It should be quality typography by default - and widow/orphan control is one big step in this direction.

Since, in my opinion, it is (almost) always desired, the default should be exactly the other way round as it is at the moment.

Cheers
Rüdiger
Comment 3 Cor Nouws 2015-02-27 13:16:31 UTC
Hi Rüdiger,

Thanks for the comprehensive explanation!
Set to New

Ciao,
Cor
Comment 4 V Stuart Foote 2015-02-27 15:34:12 UTC
So the control is in the Paragraph dialog

Format -> Paragraph -> Text flow: Options stanza

"Orphan control" checkbox w/default 2 lines
"Widow control"  checkbox w/default 2 lines

What line settings would be used if by default is set enabled? 

Also, aren't the two mutually exclusive? Orphan controls page break at end of page, while Widow controls page break at top of page.

Orphan: Specifies the minimum number of lines in a paragraph before a page break.
Widow: Specifies the minimum number of lines in a paragraph in the first page after the break. If both checked active and both at default of 2--what happens?
Comment 5 rbruenner 2015-03-02 06:20:07 UTC
(In reply to V Stuart Foote from comment #4)
> 
> What line settings would be used if by default is set enabled? 
> 
I think that the current default setting of 2 lines is suitable.


> Also, aren't the two mutually exclusive? Orphan controls page break at end
> of page, while Widow controls page break at top of page.
> 
No, they are not. They are meant for two different things.

> Orphan: Specifies the minimum number of lines in a paragraph before a page
> break.
> Widow: Specifies the minimum number of lines in a paragraph in the first
> page after the break. If both checked active and both at default of 2--what
> happens?

I also cannot remember which of both applies to the paragraph start or paragraph end. Here is what I have looked up.

Widow: If your paragraph does not fit on the page and the last line would go to the top of the next page, this setting causes the previous line also to go on the new page so that the "widowed" line (consisting probably of only one or two words) does not stand alone on top of the page.
Orphan: If only one line of your new paragraph just fits on the bottom of the page while the rest of the paragraph goes to the next page, this setting prevents that "orphaned" line on the bottom of the page and causes the paragraph to go completely to the next page.
Both settings control the page break that would happen after the first or before the last line of a paragraph, respectively.

Please also refer to Wikipedia (https://en.wikipedia.org/wiki/Widows_and_orphans)

In the past, I have always checked both options in the Paragraph dialog and it has always worked perfectly.

Cheers,
Rüdiger
Comment 6 V Stuart Foote 2015-03-02 13:23:54 UTC
Created attachment 113824 [details]
ODF text document to demonstrate orphan widow function

Attached is a silly two page document can use to demonstrate effect of Orphan and Widow settings.

Select all text in document and use Format -> Paragraph -> Text flow to select either/or both Orphan or Widow.

Not sure which gets priority when both are checked active, but they don't seem to conflict. I'd agree with change that both Orphan and Widow text flow should be checked on by default.
Comment 7 rbruenner 2015-03-02 14:47:05 UTC
> Not sure which gets priority when both are checked active, but they don't
> seem to conflict. I'd agree with change that both Orphan and Widow text flow
> should be checked on by default.

Fine that we agree on this aspect.

I do not believe that both settings interact in a non-predictable way. In the past 10 or more years, I never noticed any problems having both checked so I presume that the code is already working properly. It is probably best to view both features as algorithms to alter the position of the page break within a paragraph. And they both work in the same way: move an additional line (in the case of n = 2) to the next page when the respective constraint is violated.

There is only one case where they both perform changes: a paragraph covering 3 lines and the need to put a page break within the paragraph (orphan-lines + widow-lines - 1 as a general formula) This causes either 2 lines on the first, and 1 line on the second page or vice versa.

However, both cases resolve cleanly:
2 + 1 case:
a) widow rule applies moving one line to the new page
b) then, orphan rule kicks in moving the first line to the new page as well

1 + 2 case:
orphan rule applies moving the first line to the next page.

Result is the same: the entire 3-line paragraph is completely moved to the next page instead of leaving either an orphan or a widow.


Cheers,
Rüdiger
Comment 8 Bernard Moreton 2015-07-03 09:41:58 UTC
The original report (widow+orphan control should be on by default) is important, perhaps especially for users who do not use styles.  

The default line values should be those used in style/paragraph formatting (2 in both cases). MAYBE this could be included in LO defaults, at Writer level or above, so that those who want these controls off can set them off globally.
Comment 9 Justin L 2015-11-05 05:27:26 UTC
proposed change to implement 2-line widow/orphans by default at https://gerrit.libreoffice.org/19794
-only affects new documents.
-widow/orphan setting is saved in the .odt styles setting.

Existing documents can easily be affected by this change, so care is needed.  Up to now, ODT files do not contain ANY widow/orphan style information IF the defaults were not modified.  So the true "default setting" still needs to be disabled widow/orphans in order to properly render old documents.  (sw/source/core/bastyp/init.cxx seems to be where the default is defined.)

Ensuring that widow/orphan settings are always included in the document's saved .odt styles ensures backward compatibility.

Widow/Orphans are default in MS Word since at least 2003.  The number of lines is hard-coded to 2/not-user-adjustable in that version.  So definitely 2 is the best number to choose.
Comment 10 Justin L 2015-11-06 05:06:59 UTC
From the ESC minutes:

* Widow / Orphan controls on by default (Justin)
        "I would like to request that someone give official endorsement
          to turning on widow/orphan controls by default for new
          documents.  I expect this probably fits ESC better than UI
          group.
        + replied on the list, pretty old feature & stable (Miklos)
            + just a UX decision if it should be on/off.
        + not entirely UX (Bubli)
            + changes ODF export around styles (are they default styles)
        + from the bug report (JMux)
            + default value currently not saved in the doc.
            + all old documents without this would get it on load.
            + he intends that only new docs get it (Lionel)
        + Can we store this 'on/off' setting for Microsoft docs ? (Michael S)
            + by default on since MS Word 2003 - so improves interop (Lionel)
                + all for it in general; no opinion on implementation.
        + not necessary for UX to discuss it (Kendy)
        => as long as it doesn't break old docs - happy for it to go in
           with the new more interoperable default.
Comment 11 Commit Notification 2015-11-12 15:44:52 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#89714 - enable Widow/Orphan in default style

It will be available in 5.1.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 12 Robert Sadler 2016-03-02 12:20:27 UTC
Well, I'm sorry, but I cannot agree with this decision.

I suppose it is alright to prettify documents for "ignorant" users by turning widows/orphans on as the default; however, for someone like me who uses LibreOffice for typesetting print and PDF documents it is now something that I must always remember to turn off when starting a new document.

The reason why widows/orphans must be off is because the algorithm just frankly doesn't work as it should be working. Basically all it does now is to move a single line between pages. This is lazily wrong, as one then most times end up with a blank line at the bottom of the page from which the line was moved.

The correct way to prevent widows/orphans is to space the preceding text accordingly to either add or remove a line of text. Unfortunately this functionality is completely beyond computers (at this stage) and must be done manually. Thus keep it off by default.