Page 1 of 1

[Tutorial] Page numbering

PostPosted: Fri Dec 28, 2007 3:56 pm
by Hagar Delest
Have some difficulties putting the page number on your document ? Here are some basics and a link to a detailed tutorial.

Executive summary
- Page number is a field that must be placed either in the header or in the footer.
- Header/footer are configured in the Page style (each has its own tab in the properties of the page style).

- Double-click the page style name in the status bar (bottom of the main window).
- Go to the Header or Footer tab and activate it, click OK.
- Put the cursor in the Header/Footer created and go to Insert>Fields>Page number.

More information on the wiki: Page Numbering in Writer.

There is also a GUI as extension : Pagination extension.

Left/Center/Right alignment
Both the Header and Footer paragraph styles (automatically selected in those areas) have customized tabulations; first is left aligned, second is centered and third is right aligned.
Just hit the Tab key to navigate to the 2nd (middle) and 3rd (right) positions.
NB: if those strings are too long, they may push the next to the next tab slot and ruin the layout. In such case, you can use a table (with no borders) to limit the width of each place. Text will be wrapped in each cell without interfering with the others.

Odd and Even pages alignment
In the Header or Footer tab of the page style properties, you can uncheck the Same content left/right option. Then, you'll be able to have a left aligned page number on even pages (left) and right aligned page number on odd pages (right) without using 2 pages styles.

Numeral and non-numeral formatting
The formatting of the page number is not controlled with its field itself but with the Page style.
See: Changing the number format (wiki).

Common problems
You see a gray background on your page number? No worry, hit Ctrl+F8 or View>Field Shadings. The shading is not printed (disappears in Print Preview). It is just a reminder that this item is a field, a dynamic placeholder.
You see "Page numbers" instead of the actual number? No worry, hit Ctrl+F9 or View>Field Names. This is the identification of the field (replaced by the actual number in Print Preview).

Here is a test file with examples of the methods described in this topic (Original file and its PDF rendering).
Blank pages were exported, it can then be printed as is, directly double sided.
Page numbering test file.odt
(57.56 KiB) Downloaded 974 times
Page numbering test file.pdf
(179.96 KiB) Downloaded 736 times

Showing, hiding or restarting the page number

PostPosted: Fri Dec 28, 2007 10:48 pm
by Hagar Delest
Having pages with or without numbering
As said above, the page number is linked to the page style. Therefore, if you want parts with numbering and some without, you need different page styles.
You can have a look at: [Tutorial] Page styles and headers/footers (and the wiki of course).

Restarting a page number
Never use the Offset feature you can see in the page number field dialog! The ToC is based on the real page numbering and it doesn't take into account the offset feature. Moreover, your last page won't have any numbering if the correction is positive.
  • Go to the first paragraph of the page to be renumbered, right click and select Paragraph to edit its properties (not Edit Paragraph style).
  • Go to the Text Flow tab, in the Breaks section, adjust the page number.
See also: Numbering the first page something other than 1 (wiki).

And for a detailed tutorial with an example: [Example] Document structure and numbering

Total pages number by chapter or section

PostPosted: Sat Dec 29, 2007 1:01 am
by Hagar Delest
How to replace the total pages number by the section pages count?
The target is to have a numbering like p#/S1, p#/S2, p#/S3, ... S1, S2 and S3 being the page count for section 1, section 2, section 3, ... (instead of having the total pages count of the document).

If you have several chapters and want the numbering in each one be like PN/CPN where CPN is the number of pages of the chapter, here is the method:
  • First you've to restart the first page of the chapter at 1 (see previous tip). Note that this can be automated if you use a heading style for example (or any other paragraph style used for the first paragraph).
  • Go to the last page of the chapter, insert a Bookmark 'chapter # end' for example.
  • To display the last page number, which will be the total number of pages of the chapter in fact, place your cursor in the header or footer and insert a field (CTRL + F2) : in the Reference tab, select the bookmarks category and select your 'chapter # end' bookmark, keep the Page format highlighted. Insert and it should be ok.
  • The only thing is to keep in mind there is a bookmark at the end of each chapter. Note that you can insert the bookmarks in sections or in frames. The former can be password protected but the latter can be resized to avoid having a whole line dedicated to the section.
NB: there is an enhancement request for this feature, you can vote for it (up to 2 votes per issue): Issue 36205 - Add a separate page number/count for each page-style.

About (automated) page breaks

PostPosted: Fri Jan 04, 2013 10:51 pm
by Hagar Delest
We've seen that the page style is a key feature for page numbering.

You may use different page styles to customize the different parts of your document. You may have troubles if you use the Next Style field of a page style to control the following one. Especially if you export the document to .doc format because page style is an unknown concept in MS Word.

So only use Manual Page Breaks to change the page styles (Insert menu).
First these breaks are changed to section breaks in .doc, so that the different headers/footers are correctly exported.
Second, you can have strange results when you change a page style through the Styles & Formatting pane or the status bar (applying a new page style somewhere) : you loose some (or all) of the page styles next to the changed one. You can imagine that page style propagation is stopped by "slots". Defining the Next Style for a page style doesn't insert any visual page break. It may be the reason why there are issues linked to that. The "slot" may need a geographical location (i.e. a paragraph to be anchored to), explaining why the Next Style feature cannot insert a manual page break (with a slot) : if you change the layout (margins + font size + ...), the Next Style will be applied to the new next page easily whereas with a localized break, you loose the connection with the page start/end.

The odd and even pages rule

PostPosted: Sat Jan 05, 2013 1:09 am
by Hagar Delest
OpenOffice follows this rule: odd pages are right and even pages are left. It leads to automatically inserted blank pages. Even if printing these pages can be disabled, they kept being counted in the page numbering. It can be very frustrating because not everybody needs to follow that rule for books. The workaround is to use the tip above (Replace total pages number by section pages count).

Enhancement request
I've filed a bug report, you can vote for it (up to 2 votes per isue): Issue 88361 - Disable even=left/odd=right page rule to avoid page numbering issues.