We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question

How can I get the header chapter title to change on the same page as the new chapter?

asked 2020-05-15 16:11:53 +0200

arforte gravatar image

updated 2020-07-21 12:53:18 +0200

Alex Kemp gravatar image

When I add a new chapter title on a page, the chapter title in the header does not change until the next page. How do I get it to change on the same page?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2020-05-15 16:39:01 +0200

ajlittoz gravatar image

The header of page is computed when the page is allocated, i.e. when there is a need to lay out the first paragraph.

The "environment" which is current in this first paragraph is captured, that is the chapter numbering hierarchy. If the first paragraph is styled Heading n, it contributes to the environment. Any Heading n inserted after the first paragraph is not part of the capture, but will be on next page.

Usually, Heading 1 style is configured with a page break before (note this is not the case by default). Consequently, it will be laid out in first position and its heading can be inserted in the header with an adequate field.

If your Heading 1 chapter change may occur anywhere, there is no solution. There is an ugly workaround: have the chapter heading both in the header and in the footer. The header reflects the environment at top of page and the footer at bottom of page.

If you header references a Heading n with n ≥ 2, the case is even more complicated. The first paragraph environment is still used, but you may have yet no Heading n. As a fallback, Writer use a Heading m with the highest m < n.

To be exhaustive, the first page is special. It uses the first Heading n, whatever n.

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) or comment the relevant answer.

edit flag offensive delete link more

answered 2020-05-16 08:57:54 +0200

keme gravatar image

updated 2020-05-16 09:13:45 +0200

It can be done.

As @ajlittoz says, the header reflects current state, or environment, at the top of the page. Footer reflects state at the bottom of the page.

So, you want to use footer info in the header area. A frame anchored in the footer, positioned in header area, can help you with that.

  • Enable page footer.
  • Insert a frame in the footer.
  • Remove frame borders.
  • Insert a chapter field in the frame.
  • Drag the frame to the top of the page.

See this file.

The last step is easiest to perform if you view entire page (reduce zoom level) and disable the page header. When you drag a frame and drop it on an area enabled for text, the anchoring will follow. You want the anchoring to remain in the footer. Drag it in one go, from the footer to outside the text area on top of page.

edit flag offensive delete link more


Excellent. I think however it is better to keep header enabled to have boundary clues for correctly positioning the frame exactly where the standard header would be.

As an improvement, give the frame the same size as the header and style content as Header.

Positioning is better controlled through the frame properties, notably to simulate a standard header by giving exact coordinates. I'd even suggest to create a specific frame style so that it is easier to apply the trick on several page styles.

ajlittoz gravatar imageajlittoz ( 2020-05-16 09:20:35 +0200 )edit

Positioning is better controlled through the frame properties, ...

Quite right. This gives better control of placement and also avoids "unanchoring" the frame.


... better to keep header enabled to have boundary clues ...

Admittedly, visual clues are useful. I see that point. However, there are advantages and disadvantages. As you edit your document you may "click around", and can easily come across a "drag situation" for the frame. If header is enabled, this could spontaneously re-anchor the frame to the header.

Bottom line, "whatever works for you ...". Try different setups and find out which one you are more comfortable with.

keme gravatar imagekeme ( 2020-05-16 09:35:52 +0200 )edit

I see your point about "click around". Then have the header enabled while you tune the frame parameters, mainly the spacing-below distance in the Wrap tab to have the exact same layout as the standard header, then disable it.

Once you have the correct frame style, you need no longer worry about all that. A simple styling action is enough.

ajlittoz gravatar imageajlittoz ( 2020-05-16 10:14:17 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-05-15 16:11:53 +0200

Seen: 53 times

Last updated: May 16 '20