Difference between revisions of "Documentation/OOo3 User Guides/Writer Guide/Numbering pages"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Preliminaries: fields)
m (Formatting the header)
Line 20: Line 20:
  
 
At this point you should see the (empty) header on the current page.
 
At this point you should see the (empty) header on the current page.
 
===Formatting the header===
 
In OpenOffice.org a header is considered a paragraph and therefore in addition to adding text and fields, you can format the header text using the same techniques you use for formatting text in the main body of the document.
 
 
{{Documentation/Tip| You can define a style for headers so that you can quickly obtain a consistent formatting in case you use several page styles. OpenOffice.org includes three predefined header styles, a generic one, one for left pages and one for right pages.}}
 
  
 
==Simple page numbering==
 
==Simple page numbering==

Revision as of 20:14, 28 May 2010


] This section describes techniques to insert page numbers and related information in a document. Some basic knowledge of page styles, which are fully described in chapters 6 and 7, may be needed to follow some of the examples given.

Preliminaries: fields

OpenOffice.org uses fields to manage page numbers. To insert a page number field, position the cursor where you want to insert the number and choose Insert > Fields > Page Number. The page number appears with a gray background. The gray background denotes a field.

Template:Documentation/Note

The page number field always displays the page number for the page where it is placed. If you see the words “Page number” instead of a number, press Ctrl+F9. This shortcut key toggles OOo between displaying the field’s contents (what the field is for) and the field’s results (what the field creates).

Template:Documentation/Note

Preliminaries: Insert and format a header

For the purpose of this example, we will insert a header in the Default page style pages using manual formatting. See Creating headers and footers.

At this point you should see the (empty) header on the current page.

Simple page numbering

The simplest case is to have the page number at the top of every page and nothing more. To do this, put the cursor on the header and select Insert > Fields > Page Number.

Page number inserted in the header.

Now the correct page number appears on every page.

Combining header text and page number

There are a lot of interesting variations that you can apply without further knowledge of page styles. Here are some suggestions:

  • Right-align the header to make the page number appear on the top-right.
  • Add (type) the word page so the header reads page 1', page 2, and so on. This also requires using the Page Number field.
  • Add the document title so the header reads, for example: Peter's favourite poems, left justified, and page x with right justification, where x is the value of the Page Number field. Consider using a (right-aligned) tab to separate the title from the page number.
  • OOo also has a Page Count field (Insert > Fields > Page Count). Using it, you could, for example, have a header that reads page 2 of 12.

These variations are all illustrated below.

Variations on the simple page numbering method.

Changing the number format

Many more variations are possible. For example, you can set the page number to display in Roman numerals. To do that, you could double-click on the page number and select the desired format; however, a better choice is to specify the format of numbers in the page style as explained here.

In the Styles and Formatting window (press F11 if not already displayed) select the Page Styles icon and right-click on the highlighted entry for the current style. Select Modify, which opens the Page Style dialog box.

On the Page page of the Page Style dialog box, in the Layout settings section, select i, ii, iii, ... from the Format drop-down list.

Variations on the simple page numbering method.

Numbering the first page something other than 1

Sometimes you may want to start a document with a page number greater than 1. For example, you may be writing a book, with each chapter in a separate file. Chapter 1 may start with page 1, but Chapter 2 could begin with page 25 and Chapter 3 with page 51.

Follow these instructions to start the page numbering in a document at a number greater than 1. (These instructions are for a page number in a footer, but you could use a header instead.)

Template:Documentation/Tip

  1. Choose Insert > Footer > [page style] to activate the footer. (If the page style is already checked in the Footer menu, point to it and click OK in the dialog box that appears. Then point to that page style again to select it.)
  2. The cursor is now in the footer. To insert the page number, choose Insert > Fields > Page Number. The page number will be 1.
  3. Click in the first paragraph in the text area or type a paragraph of text.
  4. Choose Format > Paragraph (or right-click and choose Paragraph from the pop-up menu) to display the Paragraph dialog box.
  5. On the Text Flow page, in the Breaks section, select Insert and select Page in the Type drop-down list. Select With Page Style and the page style you are using for the first page of the document.
  6. The Page number field is now active. Type the page number you want to start with. Click OK to close the Paragraph dialog box.

Numbering pages by chapter

Technical documents often include the chapter number with the page number in the header or footer. For example, 1-1, 1-2, 1-3, ...; 2-1, 2-2, 2-3, ...

To set up this type of page numbering in OOo, you need to do three things:

  1. Ensure that your chapter titles are all identified by the same paragraph style, for example, the Heading1 style.
  2. Use Tools > Outline Numbering to tell OOo what paragraph style you are using for Level 1 in your outline, and specify “1,2,3" in the Number box.
  3. Specifying paragraph style and numbering for chapter titles.
  4. Insert the chapter number in your document. To do this:
    1. Place the cursor in the header or footer just before the page number you inserted earlier, and choose Insert > Fields > Other from the menu bar.
    2. On the Fields dialog, go to the Document page. Select Chapter in the Type list, Chapter number in the Format list, and 1 in the Layer box. Click Insert.
    3. Inserting a chapter number field.
    4. Type a hyphen or other punctuation between the chapter number and the page number.

For more information, see "Choosing paragraph styles for outline levels" and "Including chapter or section information in page headers" in Chapter 7 (Working with Styles).

Restarting page numbering

Often you will want to restart the page numbering at 1, for example, on the page following a title page or a table of contents. In addition, many documents have the front matter (such as the table of contents) numbered with Roman numerals and the main body of the document numbered in Arabic numerals, starting with 1.

You can restart page numbering in two ways.

Method 1:

  1. Place the cursor in the first paragraph of the new page.
  2. Choose Format > Paragraph.
  3. On the Text Flow page of the Paragraph dialog box, check Insert in the Breaks area.
  4. In the Type drop-down list, select Page.
  5. In the Position drop-down list, select Before or After to position where you want to insert the page break.
  6. Check With Page Style and specify the page style to use.
  7. Specify the page number to start from and then click OK.

Template:Documentation/Note

Method 2:

  1. Place the cursor in the first paragraph of the new page.
  2. Choose Insert > Manual break.
  3. Page break is the default selected on the Insert Break dialog box.
  4. Choose the required page in the Style drop-down list.
  5. Check Change page number.
  6. Specify the page number to start from and then click OK.
Restarting page numbering after a manual page break.

Example: Restart page numbering: a preface

A standard preface has the following properties:

  • Page numbers are displayed in Roman numerals (i, ii, iii, iv, …).
  • After the preface, the document starts on a Default page.
  • The page number resets to 1, and the number format becomes Arabic (1, 2, 3, 4, ...).

Resetting the page number requires page breaks.

First, let's get the preliminary work done for the Preface style:

  1. Create a new page style and name it Preface.
  2. Set its Next Style to Preface because a preface could span multiple pages.
  3. Add a header to Preface and insert the Page Number field. Make the page numbers display as Roman numerals (i, ii, iii, iv, …):
    • Open the page style window for Preface (if not already open) and click the Header tab. Check Header on under Header.
    • Click the Page tab. Under Layout settings, in the Format drop-down list, set the format to i, ii, iii, .... (See the bottom right of the figure below.) Click OK to close the dialog box.
Set page number format to Roman numerals.

After the preface is written, we are ready to restart the page numbering in the main body of the document to Arabic numerals. Follow these steps:

  1. Make an empty paragraph at the very end of the preface.
  2. Put the cursor on the blank line.
  3. Choose Insert > Manual Break.
  4. Select Page break and choose the Default style.
  5. Select the Change page number check box and set the new value to 1. Click OK to close the dialog box.

These settings are shown below.

Set the new page number to 1 and the page style to Default.

Note: You cannot assign an odd page number to a left page or an even page number to a right page. OOo strongly adheres to the convention that odd page numbers go on right-hand pages and even page numbers on left-hand pages.

This change is also reflected on the status bar. The Page section of the status bar now includes both the total page count and the entry of the page number field.

Page number in the status bar.

Problems with restarting page numbering

Restarting page numbering may lead to two problems.

  • The Statistics page in the document’s Properties (File > Properties) always displays the total number of pages in the document, which may not be what you want to appear in the Page Count field.
  • When page numbering is restarted, OOo always make sure that an odd-numbered page is a right page and an even-numbered page is a left page. It does this by inserting a blank page, if necessary. Sometimes this blank page is not desired, particularly when creating PDFs or when printing single sided.

Solving the page count problem

Suppose you know exactly how many pages are not to be included in the page count. (You want one page to be excluded in the page count for the following example.)

Instead of inserting a Page Count field, you can do the following:

  1. Position the cursor where you want the page count to appear.
  2. Press F2 to open the formula bar, just above the horizontal ruler in the main Writer window.
  3. After the equal sign, type page –1. If you want to exclude several pages, substitute the number of excluded pages for 1 in the formula.
  4. Press Enter to close the formula bar and insert the resulting field into the document.
Formula bar.

If you do not know the total number of pages in advance, then one approach is to create a bookmark on the last page and then insert a cross reference to it.

To create a bookmark on the last page:

  1. Go to the last page (Ctrl+End).
  2. Choose Insert > Bookmark.
  3. In the Insert Bookmark dialog box, type a name for the bookmark, for example LastPage. Click OK.
Inserting a bookmark.

To insert a cross-reference to the last page in the header or footer where you want to refer to the total number of pages:

  1. Position the cursor at the desired location—for example after the space added after of in the header or footer, as in page xx of yy.
  2. Choose Insert > Cross-reference.
  3. On the Cross-references page of the Fields dialog box, select Bookmarks in the Type column and LastPage in the Selection column. LastPage now appears in the Name box.
  4. In the Insert Reference to box, select As page style. Click Insert.

Template:Documentation/Note

Inserting a cross-reference to a bookmark on the last page of a document.

Numbering portrait and landscape pages

To create page numbers on portrait and landscape pages in the same place and orientation:

  1. Refer to “Portrait headers on landscape pages” to create a landscape page style and landscape header or footer styles. When creating the page style, select the Use dynamic spacing option in the Spacing area in the 'Header or Footer pages of the Page Style dialog box.
  2. Insert the page break and choose the landscape page style; do not change the page numbering.
  3. In the relevant header or footer, insert the page number field (Insert > Fields > Page Number).


Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY).
Personal tools