Chapter Heading Flexible Style (Centered) and TOC

How do I make Heading 1 for my chapter as in the picture here. But also show “CHAPTER 1INTRODUCTION” in the TOC?

Filetype: odt
Version: 7.0.6.2
Build ID: 00(Build:2)
CPU threads: 4; OS: Linux 5.12; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
7.0.6-3
Calc: threaded

For other readers, I summarize your specification.

  • heading

Heading in centered with two lines: first line contains “Chapter 1”, second line “Introduction” with a large vertical spacing between both lines

  • TOC

Corresponding entry should be “Chapter 1 Introduction” on a single line

You must remember that entries in TOC are simply a copy of the heading paragraphs. This means that semantically a heading, whether written on several lines or not, must be made of a single paragraph. Unfortunately as you didn’t enable View>Formatting Marks I have no idea on how you vertically spaced your heading.

Here is how it must be handled. Your heading is entered as:

Chapter 1Shift+EnterIntroductionEnter

Shift+Enter is a line break. It does not create a paragraph break as does Enter. Consequently everything typed is a single paragraph.

Assign style Heading 1 to this paragraph. Customize it to fit your needs, e.g. uppercase or small caps and center-aligned. To space the line, tune Line Spacing in Indents & Spacing. I hope for you you’ll never need 3 lines or the result will be awfully ugly. In this case another trick is possible provided you know what a character style is.

In the TOC, a line break turns into a space. So, everything is on a single line. You can tune the appearance of the entry customizing Contents 1.

EDIT

In case “Chapter 1” is provided by Tools>Chapter Numbering (again, I can’t tell from the screenshot because View>Field Shadings was no enabled), the line break can be added automatically. In the Position tab, you can set Number followed by New Line.

I remind you that "Chapter " (with a space) can be added automatically by defining as Separator Before in Numbering tab.

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. This option is offered in recent Writer releases. I don’t remember if it was already there in 7.0.x.