Including a chapter reference in the header of the first page
The problem
If you use the method described in Step 5. Insert the subdocuments into the master document (putting a page break paragraph into the master document between the subdocuments), and you put a cross-reference to the chapter name and number in the header of the first page of each chapter, then the cross-reference field on the first page will pick up the chapter name and number from the previous chapter. This happens because with this method the first (blank) paragraph on those pages is actually the last paragraph of the previous chapter. The example did not include a cross-reference to the chapter name and number in the header of the first page, so it did not have this problem.
First page footers do not have this problem; they correctly pick up the current chapter’s name and number.
The solution
The cure for this problem is as follows:
- Use File > Templates > Edit to open the template used for the master document and its subdocuments.
- Modify the style for the chapter title (usually Heading 1) to enable a page break before, using the page style you want for the first page of each chapter. Save and close the template.
- When you reopen the master document, it should ask two questions: “Update all links?” and “Your styles don’t match the template. Do you want to update your files?” Be sure to answer Yes to both questions.
- Modify the chapter title style (Heading 1) in the master document file as you did in the template file in step 2. Save the master document.
- Open the Navigator in Master Document view and delete the Text sections between the chapters. Update all links.
The headers on the first page of each chapter will now display the correct chapter name and number.
The problem with the solution—and a workaround
This solution creates another problem, if you want to restart page numbering at 1 on the first page of the first chapter and have pages numbered sequentially through all the chapters.
Normally you would restart numbering by specifying the starting page number when you modify the Heading 1 style to start on a new page. However, if you do that, then each chapter restarts page numbering at 1. (Sometimes this is what you want, but often it is not.)
In this case, you will have to include an “offset” in the page number field—that is, you tell Writer how many pages to subtract to make the first page of the first chapter to be page number 1. Of course, to make this work, you need to know how many pages are in the front matter, and you may not know that until after you have finished the entire book. If you add or delete some pages (for example, if the table of contents grows from 4 pages to 5), you will need to adjust the offset accordingly. Therefore, this adjustment is best made at the end of the project.
Here is how to do it.
- In the master document itself—not in the subdocument—place the cursor just in front of the Page field on the first page of the first chapter. Right-click and choose Fields from the pop-up menu.
- In the Edit Fields dialog box, type a negative even number (–2, –4, etc.) in the Offset box. Click OK to save this change.
Using an offset to start at a different page number.
- You might need to make the same change on the second page of the first chapter.