Chapter name vertically aligned

Hi,

For a book I want to have new chapters in the center of a page (both horizontally and vertically aligned).
What I could find about vertical alignement on Writer is that it is not supported for paragraphs, but I can put my chapter name in a frame which can then be aligned appropriately.

But now (I guess it is because my chapter name is written inside a frame), the field “Chapter name” which I inserted inside my headers (to have the current chapter name in the header) is not set. The chapter has “Heading 1” paragraph style and should set the field “Chapter name”, but it does not. If I put my chapter back outside the frame, the field is properly set.

I would like to know if there is a way to have a chapter aligned in the center of the page text area with the field “Chapter name” correctly set so it can be written in the headers of the following pages.

Thanks,
Sliveer

I am using LibreOffice Writer 7.2.4.1 (x64) for Windows.

Frames don’t work here, because they aren’t part of the text flow. You can use a table though, with one row and one column, cell height set to page height minus top & bottom margins heights, then vertical alignment works, and the Heading 1 will be captured by the TOC. Personally, I’d apply the Golden Ratio here, that really looks much better. In that case, roughly 61% of the remaining space on the page should be below the title and 39% above it. On an A4 page, 29.7 cm high, and a heading of 0.7 cm, you are left with 29 cm, so you can have a Space above of 11.3 cm in the Heading 1 para style definition.

Also see Six years old discussion of the same subject in the AOO forum, with more suggestions.

See sample file.
headingintable.odt (8,8 KB)

There’s one more thing: when your chapter title sits on its own page, there’s no need to suppress the chapter title from appearing in the header of the first real page of a chapter. So you should tick Same content on first page on the Header tab of the Page Style dialog box.

Thank you for your answer!

I actually forgot about the TOC, but strangely it does include the chapter which name is inside a frame (even after updating it manually). I also tried your solution : I added a 1 by 1 table and inserted a Heading 1 chapter inside it, the TOC also included it after updating, but the field Chapter name is still not set : it does not appear in following pages’ headers.

About the golden ratio : I know it is a bit uncommon to have centered text on a book but I would still like to do it for this one.

Edit : I am not sure the link to the AOO forum corresponds to my issue, I understood how to make a text centered in a page, the problem is that the field I am supposed to get from a Heading 1 paragraph is not set.

Works for me. Maybe there’s something wrong with your document.
Can you upload a sample file, with all sensitive information removed, for inspection?

From a new document I don’t have the issue so I guess you’re right : maybe there’s something wrong with my document. (I guess there are multiple wrong things since I don’t know a lot about Writer yet)

Here is a sample with the issue, note that there might be some other issues because I removed a lot of information so let’s focus on the missing field value :
chapter_name_field.odt (16.7 KB)

As you can see I have my Chapter 1 (inside a 1x1 table) properly set inside the TOC, but it does not appear in my right pages header, and then comes Chapter 2 (just as a normal paragraph) and it does appear in headers.

So I don’t know what I got wrong but it seems to only affect frames and tables containing Heading 1 paragraphs (and only for header fields) since normal paragraphs work and TOC also find the values.

Edit : There is no headers in the 2 pages after chapter declaration, it is intended.

Edited my answer. In your uploaded document, you didn’t enable Same content on first page on the Header tab of the page Style dialog box. So the header stays blank there. Didn’t think of that because this feature was added by LibreOffice and I never used it.

I’m not sure I understood your answer there.
The first page of text after my chapter title does not have the chapter name in the header, that is intended, my issue is that the following also don’t have the chapter name in their headers.
If I tick the “same content on first page” in the header section of the page style, then I have a header on the first page (which I don’t want) but the field Chapter name is still empty :
chapter_name_field.odt (15.9 KB)

You have a simpler solution by customising Heading 1.

  • horizontal centering: select Center alignment in Alignment tab
  • page break: request a page break Before in Text Flow tab and untick `Keep with next paragraph
  • vertical centering: it is not possible directly but you can set an adequate spacing Above paragraph in Indents & Spacing tab.

When you enter your chapter heading, press Ctrl+1 (this is a keyboard shortcut to assign Heading 1 to the current paragraph). At end of heading, type Ctrl+Enter to jump to next page. Your paragraph style is automatically reset to Text Body so that you can type chapter text without the need to explicitly set the paragraph style.

I heard of that solution and tried it but if my chapter title is too long then it ends up being on two lines (and it does happen quite often with my book) and only the first line is centered. It makes the title too low on the page.

How can you have only the first line centred? Have you some direct formatting? Do you type tab characters? Is your chapter title numbered? If so, how do you number it?

For better analysis, attach a sample file with the centring problem.

If I set a fixed space above Heading 1 then the first line is what is centered. If my title is longer than one line then the space above the first line stays the same (but it should be smaller)

Here is an example :
two_lines_title.odt (8.8 KB)

The first title is centered using your solution and everything is fine.
But the second one (which is 2 lines long) is not centered, it is too low on the page, because the space above paragraph does not automatically adjust to the paragraph length.

OK, I see. Vocabulary ambiguity. You should have written “vertically no longer centred”.
Unfortunately, if your goal is to precisely vertically center your title, this can’t be done with spacing in a paragraph style. Only @anon87010807’s table suggestion can do it. But using tables puts some burden on Writer and makes the document heavier. This is why I find @anon87010807’s idea of the golden ration appealing: you offset up the title so that you can easily tolerate the deviation from symmetry. Your title are aligned a fixed distance from the top and they develop downwards.

CAUTION! I’ve noticed in your previous sample file a lot of direct formatting. You’ll get more reliable and predictable results if you refrain from using such direct formatting. The fewer direct formatting, the easier to format and the more stable the document.