Book page headers for different chapters

As usual, advices are much better when OP mentions OS name, LO version (full version number with 4 components) and save format. I’ll assume you save .odt.

Headers are one of the properties attached to page styles. One page style can have only one header. Consequently, either you create one page style per chapter, but it soon becomes boring if you have tens of chapters. Or you turn your headers into “dynamic” strings with the help of fields.

The latter solution is generally the preferred one but it requires you follow some discipline. The chapter heading can be captured to be inserted into the header. This is done when you apply Heading n paragraph styles to your headings: Heading 1 for chapter titles, Heading 2 for sub-chapters, etc. There is a dedicated field for each level accessible with Insert>Field>More Fields, Document tab, Heading Type to retrieved the heading with or without the chapter number.

Considering your question, I recommend you read the Writer Guide for basic information about styles and fields. Come back here for more specific help.

EDIT 2024-01-14 (after reading the comments below this answer)

Let me summarise the specification:

  • the book contains (3) parts, the heading of which provide right-page headers
  • every part is structured in chapters (which start on a new page, I assume from the following requirement)
  • chapter start page have no header
  • other page headers are book name on left, part name on right
  • illustrated pages have no header nor footer

My suggestion is then to record the book title in File>Properties, Description tab, Title:. The title can be inserted anywhere appropriate, e.g. in the First Page cover page with Insert>Field>Title and then paragraph-styled Title.

Changing the title in the properties automatically updates all the usages in the document.

Story titles are entered in a page of their own (page style to be defined) in a Heading 1 paragraph. Customise Heading 1 for ample spacing above paragraph, font parameters, centre alignment, automatic page break “before” with switch to your page style.

Using Heading 1 captures the story title in a field.

Your chapters start with a Heading 2 paragraph (chapter title/heading). Customise Heading 2 as usual for the required look and in Text Flow force a page break “before” to Default Page Style.

I use Default Page Style as the target page style but if you prefer any else, it is up to you.

Default Page Style Header tab is configured as:

  • tick Header on to enable headers
  • untick Same content on first page
    This “detaches” the first page from the other headers and will allow you to have an empty header.
  • untick Same content on left and right pages
    This makes left and right headers independent from each other.

Create a chapter, eventually with dummy text so that you have at least 3 pages. This assumes you already have a story name otherwise you’ll see disturbing things (though everything will settle down once you have a story name; it is important to respect the hierarchy Heading 1, Heading 2 to ensure there is data at each level).

  • make sure your header is empty on first chapter page
  • in left header, Insert>Field>Title
  • in right header, type two Tab (to right align the header) and Insert>Field>More Fields, Document tab, Heading Type, Heading contents Format (level should be 1, check)

Regarding pages with pictures, they require a dedicated page style. However, your specification is incomplete. If the images are frontispieces, i.e. a picture preceding a chapter start, usually a left page facing chapter start on right, insertion of this page can be automated. Of course, you can leave it empty if you have no image.

Otherwise, full-page images are quite hard to insert automatically. What I mean here is the “natural” page breaks in your book are not predictable (from an author’s point of view). The location where they happen depends on the edits and text updates. Full-page insertions require manual anchor positioning and you must change manually this position after an update (or at least check that changes didn’t move “too much” the anchor, creating nearly empty pages).

Hi Ajlittoz,
Thank you very much for your help. I didn’t manage to work out the ‘preferred’ solution, but on the way found out how to create the one page style per chapter method. I will copy my notes below.

HEADERS FOR BOOKS: One page style per chapter method

(in LibreOffice 4.1.8)

For the right hand header

(1) Styles

(2) Manage Styles

(3) Page Style (click 4th icon from left on top menu)

(4) Right click on blank space in the box

(5) New (style)

(6) The Page Style box opens up under the Organiser tab.

Give the style a name (e.g. The Road to Concord)

(7) It is important to fill in Next Style line below, which will be the left hand header

when you’ve created it

(8) Still in Page Style, click the Page tab and under Layout Settings and choose Mirror

(9) Still in Page Style, click on the Header tab and click in Header On box.

You can make the left hand header in the same way as above, but for a book it will be the same throughout (e.g. The Silk Roads). Always remember to fill in the Next Style line in the Organiser section, which will be the chapter name (e.g. The Road to Concord or The Road to heaven)

You could choose Left Page which is already a style option, right click on it and Modify it. Modifying involves filling in the Next Style box in the Organiser section, changing Page style to Mirror, and having the Header box ticked under the Header tab.

Once you have created the right and left pages you can enter the appropriate text for the left and right headings in the actual document headers. Once they have been entered they repeat until a different chapter heading is required.

Of course the margins for books will be greater on the inside than on the outside. Adjustments can be made in Page Style under the Page tab.

ADDITIONAL INFO

No Header Pages

No Header or Footer Pages

At the beginning of chapter you will not want any header at all. For pictures you will not want headers or footers.

Create New page styles by right clicking in the blank space as in (4) above.

You can call it Right Page No Header, Blank Top & Bottom etc.

Make changes on the Organisation tab, Page tab, Header and Footer tab as necessary.

You will have to insert Manual pages breaks in some situations. Insert them as often as you can.

There is a much simpler way if all you want is different left/right header. This makes only one page style per chapter instead of two.
And if your header(s) can be retrieved from chapter information/book information, then you end up with only one page style for all chapters.
I am busy right now, so have no time to explain. But if you’re still interested when I am back, I can explain the procedure.

Thanks for your suggestion, and I would be interested.
But there is another problem, which is that at the beginning of the chapter, above the words Chapter 1, Chapter 2 etc, there should be no header at all.
I look forward to hearing further from you when you have time.

Just to clarify my problem
The book is a children’s book containing three stories. Each story has about ten chapters. The page headers on the right side should be the name of the story and the page header on the left should be the name of the book.
The first pages of chapters starting ‘Chapter 1’, ‘Chapter 2’ etc should have no header.
Pages with pictures should no header or footer.

I’ve found a way to have no header pages and no header or footer pages. I’ve added the way to do it as ADDITIONAL INFO to my one page style per chapter method above.

Have you read the update to my answer?

Hi Ajlittoz,
I very much appreciate the further detailed instructions you have given. They are very helpful indeed. It will take me a little while to put them into practice, but I get the idea. I hope other people will benefit from them.

Thank you for alerting me to your update, which I had missed!

HEADERS FOR BOOKS: One page style per chapter method (LABORIOUS!)

ADDITIONAL INFO 2024-01-18

For each new page style you have to adjust settings under the following tabs:

ORGANISER tab: Style Name, Next Style

PAGE tab: Paper Format (size). Layout Setting ( mirror ), Margins (inner & outer etc)

HEADER tab On / Off

FOOTER tab On / Off

It is the Organiser info which needs special mental concentration. This is because you have two think not just one page ahead, but two pages ahead.

Page styles require the Next Style box to be filled in. For each chapter I have 9 page styles.
What comes after the ‘>’ sign is what will appear in the Next Style box. But the style name includes this information.
If you haven’t created the Next Style page yet you have to allow Untitled as an option and then come back to update it.

My page stye names for one chapter (‘Friends’ is the Chapter name)

Friends LEFT > Friends RIGHT
Friends LEFT > Friends RIGHT NoHeader
Friends LEFT NoHeaderNoFooter > Friends RIGHT
Friends LEFT NoHeaderNoFooter > Friends RIGHT NoHeader
Friends LEFT NoHeaderNoFooter > Friends RIGHT NoHeaderNoFooter
Friends RIGHT > Friends LEFT
Friends RIGHT NoHeader > Friends LEFT
Friends RIGHT NoHeader > Friends LEFT NoHeaderNoFooter
Friends RIGHT NoHeaderNoFooter > Friends LEFT NoHeaderNoFooter

NOTE It is important to use Manual page breaks. This allows you to choose what next page to have.

Hi Ajlittoz,

Thank you very much for your instructions. I understood using the Title field, but didn’t manage the Chapter fields. As I wanted to get the first draft of the book to the printer without delay I continued with the laborious 9 pages styles per chapter method.

As there have been 120 views of this topic within the last 6 days it might be worth bringing further clarity to it.

Also, when I go on to the next draft of the book it would be helpful to be able to use your method.

Thanks again.

Your design is somehow contradictory: a page style can have only one “Next” style. Therefore, when you write the Friends LEFT NoHeaderNoFooter can have three possible successor, this can’t be automated through the “Next” field. And you note yourself that you must use manual breaks. Consequently, it is pointless to configure the “Next” parameter.

Having 9 page styles per chapter is not really author-friendly. I guess your page styles mainly differ in header/footer contents. Can’t these contents be generated with fields? If the answer is affirmative, the same page styles can be used for all chapters, reducing the total number to 9 (instead of 9 × count_of_chapters.

Are you sure you need 9 page styles? I don’t see any logical pattern in your enumeration. I wonder if your xxx NoHeaderyyy are created to hold full page illustrations. You’re then bothered by the separation of your “main” page styles between LEFT and RIGHT versions. This separation with “Next” alternation management is legitimate when the geometric characteristics of the page are radically different. In most of the cases, using a single page style with Same contents on left and right unticked in Header and Footer tabs is largely sufficient and preferable. With such a page style, when you insert a single “orphan” page with a different page style, the “side” of the original style is automatically selected without problem because it is valid for both. This reduces your need from 9 to 3 page styles (and I bet that with a better description of what you’d like this number ends up to 2).

The Book is for children with illustrations

Page Left/Right Type Header Footer
1 R Chapter 1 No Yes
2 L Illustration No No
3 R Text Yes Yes
4 L Illustration No No
5 R Text Yes Yes
6 L Text Yes Yes
7 R Chapter 2 No Yes
8 L Illustration No No
9 R Text Yes Yes
10 L Blank No No
11 R Chapter 3 No Yes
12 L Text Yes Yes

From what I see (a more thorough analysis is needed for an accurate advice), you need 3 page styles:

  • first chapter page, to force right side, “Next” set to running chapter page
  • running chapter page (don’t worry for “Next”; it is automatically idempotent) with separate header/footer; choice of side variant is automatically managed by Writer
  • illustration page, “Next” set to running chapter page but not really important because your page is not necessarily full and you’ll use a manual page break to switch back to chapter text

Blank pages are automatically inserted by Writer where needed.

1 Like

As a non-academic observer of this thread I find descriptions harder to follow than samples. Using @ajlittoz previous comment and what I gleaned from the thread, I created a test document.

I used 3 page styles, MyChapter, MyText, and MyIllustration, for the three page styles described. I did make MyIllustration to be Left Only as it seemed to be a deliberate choice to have illustrations on the left. I did have to Insert > More breaks > Manual breaks to change the page style where the Next style wasn’t right but that isn’t unknown. Entering a new Heading 1 creates a new chapter on a new MyChapter page.

Make sure Book View is enabled to see the automatically generated blank page.
BookPageHeadersDifferentChapters.odt (63.3 KB)

I slipped on this one. If it is really systematic, this could simplify the design, but as I sketched the suggestion, illustrations can go to a right page without change in the page styles.
However, LO in not ideal for this kind of work. IMHO, a positioning option is missing for frames: something I call “deferred insertion”. You’d define a fixed size for the frame and Writer would wait for the first opportunity to layout the frame. Here the frame height is the key factor. If there is not enough space for the frame at the anchor, subsequent text is added until page break is reached. Then the frame is inserted at top of page and standard operation resumes after it. This is a radical change compared to the present feature where a frame is always set in the same page as the anchor.
With such a new positioning option, there is no need for a specific page style for the illustration.
This was my day dream for today.

Yes, it would be nice to have something along those lines but not essential.

To be honest, under normal circumstances, I just insert a big enough frame to cover header and footer if I need an image only / special page. I then insert them image or other contents into the larger frame.

Hi EarnestAI,

Thank you very much for taking an interest in my problems and for doing a mock-up. As you say, a sample is easier to follow than a description. I’ve therefore done a mock-up myself of the first 20 pages, which is attached.

(1) You will see that I have the book title on the left and the chapter title on the right. You show the chapter title on both Left and Right pages. (2) Also I have page numbers on the beginning of chapter pages. If you could adjust your sample that would be really great!

The book title is in black and green, just to show it is a separate page style.

Although I have illustrations on the Left page in the mock-up, I may want to have them on the Right also.

You and Ajlittoz mention frames for graphics. This is a new idea for me and I will investigate. Also I need to learn how to make the first page come on the Right in the preview.
My Adventure Stories - Test 2023-01-19.odt (104.5 KB)

I restyled your sample according to the suggestions in the previous comments. This was quite painful because you have way too much direct formatting. What caused most inconvenience were your abuse of empty paragraphs to vertically space your text and the excess manual page breaks. Start by removing them in your book. This will make the remaining operations easier.

Before I comment on your routine and my adjustments, I guess your document has been in contact with M$ Word because there are Converted9 [9= 1 and 2] page styles and numerous ListLabel 9 character styles which betray a conversion from DOC(X) to ODF and may leave “fossils” very difficult to handle and remove. Also, most of your paragraph styles derived from Standard which is also a Word feature. This Standard paragraph style has messed up the built-in style hierarchy. Expect some difficulties due this (initial?) conversion.

I have not the fonts you used, so my “adaptation” may not be the same as your formatting.


Now deep into the topic.

  • Don’t use Default Paragraph Text for anything in your document
    This style is the ultimate ancestor of all others and forward its attributes to all of them. Consequently when you modify it to tune your main text, this also affects other styles like those for headings, headers. This paragraph style is intended to set common attributes shared all over the document. This allows a quick change if your print shop instructs you that your font face is not available among other possibilities.
  • Your TOC can be automatically generated
    And there is no need for a table. Play with Contents n paragraph styles and the structure line in TOC editing dialog.
    All you have to do is to style adequately the headings. I used Heading 1 for story title and Heading 2 for chapter start. These styles were customised to activate the desired page styles, position the heading in the page, request the desired font, … Note the elimination of empty paragraphs.
    i used chapter autonumbering for Heading 2 for added reliability. Since you don’t intend to enter them into the TOC, no need to have some real content for the chapter heading, not even a space.
    I only had to restore default settings in Tools>Heading Numbering you had messed up.
  • Chapter page styles
    I created Chapter First Page and Chapter Running Page. The reason i separated the first page from the others is motivated by the Illustration page style. The page following this one will be the first of a sequence. Therefore, to avoid “first page” layout, I can’t untick Same contents on first page and must use a different page style.
    Chapter First Page is constrained on right side and this will automatically insert a blank page if needed.
    Chapter Running Page has no side constraint but its header has different contents on right and left pages.
    Now that the outline of your book is correctly structured with Heading n styles, headers can be automatically generated.
    In the left header, I insert a Title field which takes its contents from File>Properties, General, Title entry. BTW, I noticed that what you entered there was different from your title on the cover page. I fixed that. In the right header, I Inserted>Field>More Fields, Document, Heading Type, Heading contents Format, level 1.
  • Illustration page style
    Nothing special with this page style, except I configured its “Next” parameter for Chapter Running Page so that a simple common page break or Ctrl+Enter can be used to return to chapter text instead of a complex manual break.
    To insert an illustration, enter an empty paragraph which is modified (direct formatting) to break to Illustration. Anchor your image to this paragraph. Add an empty paragraph after the image paragraph, making sure you don"t move the anchor (otherwise drag the anchor to the page breaking paragraph). Start the next line of your story. Put the cursor back at the beginning of the line to insert and ordinary page break or Ctrl+Enter.
    It is always a good idea to eliminate empty paragraphs because they are a serious obstacle to “comfortable” layout and formatting tuning through style manipulation.
    For the same purpose, I have customised Graphics frame style, used by default on images. To eliminate any direct formatting on the images, apply Formula to them, then reapply Graphics. By doing so, your images are now under control of Graphics and can be moved, modified, … by adjusting only Graphics and this will affect all of them simultaneously.
  • Styling text
    I styled your text Body Text but did not check carefully the parameters to make it look like your sample. I think they most differ by line spacing (this is especially noticeable at the end of chapter 2 where a widow line appears; resetting to your line spacing should fix the issue; otherwise you’ll have to play with widow/orphan parameters). By setting Spacing Below, I can delete all your empty paragraphs used to space apart the text paragraphs. And this is good because your empty paragraphs sometimes caused a blank page to be generated (because of your numerous manual page breaks).

I have deleted the superfluous page styles but could not do the same for paragraph styles because of the mess introduced by Standard and i didn’t want to spend more time understanding the logic behind your style names. Also we probably don’t use the same LO version (here 7.6.4.1 where Text Body was renamed Body Text starting in 7.6 and this gives me two paragraph families). Apparently, you don’t use character styles but I didn’t detect character direct formatting after my changes to paragraph styles (I must say I was rather brutal in clearing direct formatting all over the document).
I encourage you to study carefully my suggested styles. Don’t hesitate to ask for clarification.


Here is my amended version of your sample file: My Adventure Stories - Test 2023-01-19-ajl.odt (102.9 KB)
Note that despite my addition of a fake story for the purpose of checking the TOC, my file is 3% smaller than yours thanks too direct formatting removal. And if your book is around 100 pages this gain will be even larger with the advantage of higher automation.

2 Likes

Hi Ajlittoz,
Your version is so NEAT in the Page Style section! I haven’t read all your instructions yet, it will take a little while, but I plan to replicate what you have done.
You are right, the text was originally in Word and then opened in LibreOffice.
Thank you VERY MUCH INDEED for your efforts. And also a ‘thank you’ to EarnestAI for his idea of samples. It has really helped. The Page Style section in EarnestAI’s mock-up was also very neat, I have to add.

You might find it easier to follow the styles that ajlittoz used if you filter the Styles pane to Applied Styles at the bottom of the pane.

If you refer to the Writer Guide as you go through ajlittoz’s comments, it could to help understand the reasons for his layout.

Note that some other naming has changed also, e.g. Tools > Heading Numbering was called Chapter Numbering in some previous versions.

Good luck.

Note: As result of this I see there seems to be a bug in LibreOffice 24.2 which doesn’t apply to earlier versions, see
Bug 159294 - Not all active Page Styles show in Applied Styles filter