Handling headers that change within a chapter and involve paragraphs that span breaks?

Hello, my question concerns alternating headers within the same chapter in Writer.

The document is set up using mirrored pages and all page styles are nearly identical apart from the header. Within a chapter, the left-page header content is the chapter name and the right-page header content is the topic within that chapter. Thus, the topic header changes through each chapter.

I have been inserting a manual page break and changing the page style at each change in topic header. This works okay except when a header change takes place in a paragraph that spans the manual page break. The text alignment in the paragraphs are justified and when the break is inserted, the last line of the paragraph before the break becomes formatted as if it is the end of the paragraph even though it would otherwise span the page and remain justified. To work around this it was suggested elsewhere that I add a line break(?) using shift+Enter at the end of the next-to-the-last row of the paragraph before the break. This works and retains the formatting but it leaves a blank row at the end of the page before the break that is otherwise unnecessary.

My question is: is there a better way of handling this use of headers or is this the best method available?

Thank you.

Rather than using mirrored pages, try using three different page styles.

Use the First Page page style for your first page. Modify this style. In the Page tab of the dialog, set the Page layout to “Only right”. In the Organizer tab, set the Next style to “Left Page”. Make any other changes you want and click OK.

Next, modify the Left Page page style making sure you leave the Next style in the Organizer tab set to “Right Page” and the Page layout in the Page tab set to “Only left”.

Next, modify the Right Page page style making sure you leave the Next style in the Organizer tab set to “Left Page” and the Page layout in the Page tab set to “Only right”.

In the Paragraph Styles area of the Sidebar, there are separate Header Left and Header Right paragraph styles where you can set up different header styling for the left and right pages.

Starting with the First Page page style, you can start typing your document. As the text overflows to the next page, the page style will automatically change to the Left Page page style using the Header Left paragraph style. When text overflows from this page, the page style will automatically change to the Right Page page style using the Header Right paragraph style.

The only manual page breaks you might need are for any pages before the actual first page of your document such as a title page.

Thanks for your answer. I think I understand what you wrote and can set it up. However, I do not yet understand how this helps transitioning between different headers within a chapter. In the case of my question, although the left-hand page header is always the chapter title, the right-hand page header changes within the chapter to denote the separate topics.

For example, the left-hand header may always be “Chapter 1: Interesting Subject” and the right-hand header will step through “Subtopic 1”, “Subtopic 2”, … “Subtopic 5.” I’m confused concerning how to get those header titles in without changing page styles, or by changing page styles and not adding a manual page break.

Perhaps, I need to try your suggestion and see what happens. But if I were to do this in mirrored pages, when I change the header on the right-hand page style, all the right-hand page headers change. That is, unless the break is inserted on the previous left-hand page.

Thank you.

I’m sorry, I didn’t fully understand that you were trying to change the right page header throughout the chapter.

While it is common to have different headers on left hand and right hand pages, it is not common to change the header content from page to page through a chapter.

Have you considered using marginalia to identify the subtopic changes?

If you have a topic heading, you might use a respective “Chapter” field in the header? Othervise, you could use a Set Variable field in the text to define the topic, and Show Variable field in the header, to define the topic dynamically, and use the same page style everywhere.

This is indeed a wrong approach to the problem, breaking text flow with hard breaks, and changing the styles each time … especially inside a paragraph. But then, paragraphs have Last line setting in the paragraph properties dialog’s Alignment tab. But I suggest you to avoid this workaround, and consider the fields in headers that may change dynamically.

1 Like

Thank you. Does the first suggestion require that the topic name appear as text on every right-hand page?

Also, is it possible to set a variable that varies by page number, such that I just need to update the page numbers in the variable definitions if text is inserted later?

I was reading about adding a user-defined variable but don’t see where conditions may be added to define it’s value based upon anything else.

Thank you.