# How do I show section and chapter in header and footer [Solved]

I have documents with major sections each of which has a number of chapters. I would like to put the section name in the header and the chapter name in the footer.

My first thought was to make the sections a heading 1 style and the chapters a heading 2 style. But I can't put heading 2 into the footer

Making a new style for each section is not a viable option

Here is a test document.

As you can see in page 4 the footer is 'Section 2' where it should be 'Chapter 3'.

edit retag close merge delete

Sort by » oldest newest most voted

First, let's clear a vocabulary problem. I assume that your "sections" are the main first-level subdivisions of your document and contain then "chapters" as a second-level hierarchy. With this ordering, section heading are "naturally" styled Heading 1 and chapters Heading 2.

The styles are applied to the relevant paragraphs in the text flow.

In the header, you Insert>Fields>Other, tab Document, choosing Type Chapter, Format either Chapter name or another one if you want the number also displayed. Check that Level is 1 to reference the current Heading 1 title.

In the footer, you insert a similar field, but you set Level to 2 to reference the current Heading 2.

But, the captured Heading x is the one active at time of the capture. Said otherwise, you have no problem in the header because the first Heading 1 in the page is used. However, in the footer, you display the last Heading 2 of the page, which may confuse the reader if you have a change in the middle of the page.

Note: when you write

But I can't put heading 2 into the footer

I hope you did not style the text in the footer as Heading 2 . This will never work.

EDIT 2018-03-23

You define your new "sections" with a Heading 1 paragraph. You enabled the Hidden attribute in the style to make it invisible.

As far as I know, the Hidden attribute is meant to remove completely the flagged paragraphs as if they were never inserted. This allows to print several versions of the same document simply by adjusting the attribute. In academics, thinks for instance of the teacher and student books.

Here you attempt a border line usage. I am surprised that it half works, but that may be a side effect of Heading x special properties.

Heading 1: despite being hidden, the heading is entered into the known list of headings but all other effects are disabled as expected (for instance, I added a page break to force your "section" on a new page but it did not work because paragraph is hidden).

Heading 2: bears the page break to right page to force your "chapters" to begin on a new page and, also, enters the heading in the known list.

However, with this scheme, I see two pitfalls.

I experimented with a page ...

more

I meant to say that I tried to put the chapter name level 2 into the footer.

Your explanation of the flow makes a lot of sense. To expand on it a little: a new heading 1 (level 1) will wipe out all the levels 2,3,... Until there is a heading 2, chapter level 2 will show the level 1 or heading 1.

Thanks

( 2018-03-22 15:30:47 +0100 )edit

The problem comes with my last sentence.

What I tried was to make heading 1 non-print and heading 2 force a new right page. The problem is that on the last page of my section 1 the footer shows the heading 1 name for section 2 instead of the heading 2 name of the old heading 2 because a new heading 1 wipes out the heading 2.

I still think that there needs to be a way to change the header and footer without having to go through the kludge of new styles.

( 2018-03-22 16:56:05 +0100 )edit

This should not be a problem. Attach your file in the original question and I'll have a look at it. I think it's only a matter of placing the page break to the right place.

( 2018-03-22 17:15:48 +0100 )edit

You should use Heading 1 for sections and Heading 2 for chapters, but make sure you know where to put page brakes. Think this might help.

Is this what you're looking for: fixed-sectioning.odt?

Write your document with Heading 1 representing sections and do not hide them till the very end, hide them just before printing. Check if that works.

more

I came up with a different solution because the chapters should force a right page unless they immediately follow a section heading.

So: Heading 1 forces a break to a right page and is centered with a next style of Heading 2a Heading 2 forces a break to a right page Heading 2a is the same as Heading 2 and is level 2 but doesn't force a new page

( 2018-03-23 16:15:42 +0100 )edit

Then be kind enough to the community by closing your question.

( 2018-03-23 16:19:31 +0100 )edit