Numbering pages

From Apache OpenOffice Wiki
Jump to: navigation, search

] 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 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.

Documentation note.png The gray background is simply there to denote a field. This background is not printed. If you wish to turn this feature off, choose View > Field Shadings (or press Ctrl+F8).

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).

Documentation note.png For a full introduction to fields, see Chapter 14 (Working with Fields).

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.
  • 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.)

Tip.png Do not set a starting page number that is an even number because you will end up with a blank page before the first page when you print the file or export it as a PDF.

  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. Select With Page Style and specify the page style to use.
  7. Specify the page number to start from and then click OK.

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. Select 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.
Documentation note.png 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.
Documentation note.png Do not delete the bookmark at the end of the document. If you do, the cross-reference will not work.

If a field, such as a cross-reference, does not automatically update, select the text containing the field and press F9.

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).

Defining Borders and Backgrounds

You can apply borders and backgrounds to many elements in Writer. Paragraphs, pages, frames, sections, page styles, paragraph styles, and frame styles can include both borders and backgrounds; character styles, tables of contents, and indexes can include backgrounds only.

The dialog box pages for borders and backgrounds are similar in each case. To illustrate their use, we will define a border and background for a text frame.

Tip.png Page backgrounds fill only the area within the margins, including the header or footer (if any). To extend the background color or graphic into the margins, you need to define a frame of appropriate size and position, anchor it to the page or a paragraph, and send it to the background. For more about anchoring frames, see Chapter 8 (Working with Graphics)


Adding a Border

To begin, select the frame, right-click, and choose Frame from the popup menu. Choose the Borders tab.

Borders have three components: where they go, what they look like, and how much space is left around them.

  • Line arrangement specifies where the borders go. Writer provides five default arrangements but you can just as easily click on the line you want to customize in the User-defined area to get exactly what you want. Each line can be individually formatted.
Frame Dialog Box: Borders Page.
  • Line specifies what the border looks like: the style and color. There are a number of different styles and colors to choose from. The Line Style and Color will apply to those borders highlighted by a pair of black arrows in the User-defined map on the left hand side of the dialog box.
  • Spacing to contents specifies how much space to leave between the border and the contents of the element. Spaces can be specified to the left, right, above, and below. Check Synchronize

to have the same spacing for all four sides. This spacing is like a padding and it is not actored in when calculating the text measurements.

  • Shadow style properties always apply to the whole element. A shadow has three components: where it is, how far from the element it is cast, and what color it is.

Adding Color to the Background

In the Frame dialog box, choose the Background page. Here you can add color or a graphic.

To add color to the background, select from the color grid. You can adjust the transparency of the color to make any text easier to read.

Frame Dialog Box: Background Page showing color choices.

Adding a Graphic to the Background

To add a graphic to the background:

  1. From the As drop-down list on the Background page, select Graphic. The page now displays the graphics options, as shown below.
  2. Click the Browse button. The Find Graphics dialog box opens.
  3. Find the file you want and then click the Open button. The Find Graphics dialog box closes and the selected graphic appears in the preview box on the right-hand side of the Background tab. (If you do not see the graphic, select the Preview option.)
  4. To embed the graphic in your document, deselect Link. To link the graphic to the document but not embed it, select Link. For more about linking graphics, see Chapter 8.
  5. In the Type area, choose how you want the background graphic to appear:
    • To position the graphic in a specific location, select Position and then click the desired location in the position grid.
    • To stretch the graphic to fill the entire background area,select Area.
    • To repeat the graphic across the entire background area,select Tile.
  6. In the Transparency area, you can adjust the transparency of the graphic. This adjustment is often necessary to make any text easier to read.
Frame Dialog Box: Background Page showing graphics options.

Deleting color or graphics from the background

To delete color or graphics from the background:

  1. From the As drop-down list, select Color.
  2. Click No Fill on the color grid.

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