TOC Widows and Orphans

I am getting page breaks in aesthetically unpleasing places in my Table of Contents. I am using chapter headings and each chapter is divided into sections. In my TOC I get blocks of text, where the chapter heading is formatted by Contents 1 followed by the section headings formatted by Contents 2. I get one or two orphaned lines from each chapter entry with each page break.

I should be able to fit about three chapters of TOC into a page so there is no need to break the chapter sections. I could not get what I wanted with the Contents 2 Text Flow settings. Do not split paragraph, Orphan control and Widow control seem to have no effect. I guess each TOC entry is a separate one-line paragraph as none of my entries need a second line. Is there some other way to do what I want?

I have Keep with next paragraph selected for Contents 1, and that seems to be working.

I am using Libre Office 7.0.5.2 on MacOS 11.3.

As you noticed, widow and orphan control is local to a paragraph. And, yes, every TOC entry is a paragraph. As it is usually only one line long, widow and orphan will have no effect.

Your specification seems to be: page breaks in the TOC should happen whenever possible only before Contents 1 so that the dependent Contents 2 are on the same page.

Grouping entries is done with Keep with next paragraph. Contents 1 should be so flagged so that it does not appears alone at bottom of page.

You should also set this attribute on Contents 2 to create an “atomic” block of level-2 entries.

However, this will also “glue” the transition Contents 2Contents 1. Therefore you must also add page breaks. A page break should occur before a Contents 1 when needed. This means you must manually tweak the TOC.

When you create the TOC (or right-click and Edit index), uncheck Protected against manual changes. You now have two options:

  • you configure Text Flow in Contents 1 to force a page break before.

    When the TOC is built or updated, you remove the extraneous page breaks

  • you don’t configure an automatic page break

    When the TOC is built or updated, you add manually the needed page breaks

Choose between both options the one resulting in least manual operation.

Note that TOC tuning must be redone every time you update it.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.

Thanks. This works but - as you mention - it is reset when the document is updated, and I may have to be careful with the page numbering. I think my effective answer is “no, you can’t”, which is good to know. I may come back to this before sending the .pdf to the printer.