Pages of the blog

06 January, 2017

Numbering of pages in LibreOffice Writer

If you have an experience of text document editing, you may skip the introductory remarks. I just wanted to say a few words to people who have just started to work in LibreOffice in order to they can understand about what the talk.


Introductory remarks

In order to understand about what will be article, you need to know a few things without which you will have a complicated way-finding in a page layout.
Firstly, what is a page header/footer? A page header/footer - a bar that places at an edge of the main body of text, and contains service information about the text. For example, the chapter title, author, page number. Page headers are placed the top of the page. Page footers are placed the bottom of the page. In some countries there are also a side header. Typically page headers/footers repeat an information on each chapter pages, and there are not on the title page and inserts. But in different countries and in different documents the use rules of headers/footers can vary widely. But in LibreOffice Writer there is no the side header, and this can do complexity, if you need to have such header.
The fact what a normal user got used to call the headers and footers has the exact structure in LibreOffice Writer. It consists a field of indentation from the sheet edge (margins) , the header/footer line (height) and indentation of the header/footer from the main text. All these properties can be found in the page style (or its properties) in tabs Header, Footer and Page. Writer allows us control completely what a normal user calls the footer, unlike many proprietary products.
The page numbering is creating of conventional symbols which indicate the location of a page in text. Page numbers, surprisingly, can be not only Arabic numerals or Roman, but it can be even the letters of the alphabet (and not only the Latin or Cyrillic). In this issue, page numbering is very flexible in LibreOffice Writer, and allows for almost any fantasy of the author. Page numbers are data fields. The theme of the data fields, and their application is very extensive. But for this article, it will be interested to us to know that numbers of pages can be inserted not only in the headers and footers, but also anywhere in the document, except the fields of indentation from the edge of the page.

Add page numbers

To insert numbers of pages in LibreOffice Writer, first you need to create the header/footer for page. You can do this in two ways:
In the main menu:
  • Go to the main menu Insert → Header and Footer → Header and check Default Style. For the footer: Insert → Header and Footer →Footer...
Through the popup on the page:
  1. Click the left mouse button on the margin (top for header and bottom for footer, then the pop-up button will appear beside with it.
  2. Click on this button.
Or in the style of the page:
  1. Right-click on the name of a page style and choose Modify... in the context menu.
  2. Navigate to the required tab: Header or Footer.
  3. Check the box Header on or Footer on.
  4. Click OK.
The header or footer will appear as a result of any of these actions. Now you can insert page numbers:
  • Go to Insert → Page Number or Insert → Fields → Page Number in the main menu.
This method inserts page numbers in all the pages which have the same style. All the pages having a different style, will be left without numbers of pages. In addition, if you create new pages with another style, they also remain without numbering. If you need page numbers, repeat the above described steps.

To not add a number on the first page

Often in larger documents, such as term papers, essays, documentation on the product, the first page is the title page. Naturally numbers on it is meaningless. To make the first page without the number of the page in LibreOffice Writer, you can apply another one style without numbering pages. You can use your style, but in LibreOffice Write has the special style for the title page. This style is called First Page.
  • Place the cursor in the first page and go to the Sidebar → Styles → Page Styles, and then double-click on the First Page style.

Note: If you do not the page break after the First page style, then the next page style is Default Style by default. If you need to another behavior, you can change two ways it:
Into properties of the First Page style: Right-click on the First Page style and go to Modify... In the Organizer tab, select the desired style in the Next Style field. Alternatively, place the cursor at the end of the page where you need the page break, go to the Insert → Manual Break... in main menu, select the Page Break radio button, select the desired style in the Style field, and click OK.
There is a dialog box (Format → Title Page... in main menu), which allows us to do several actions for a document: converting existing pages to title pages or insert new pages as title pages, select the starting point for the numbering page, which goes immediately after the title pages, and has the Edit... button, which allows us to go to editing the selected style for the title page. This dialog box, it may be useful when you already have a "ready" document, and it only need formatting.
In my opinion, this dialog box has a clear view, so I think you can understand it yourself and create a title page required by your circumstances. But note that this dialog does not allows us to apply user styles, but only a few built-in style.


Start page numbering on not first page

Above I have mentioned that the numbering is partially the property of the first paragraph of a page. From a user perspective it may be illogically, but from the position of the document structure, it is very convenient. A paragraph exist always. Even if you have just opened the program (whether MS Word or LibreOffice Writer) and only a blank document opened. Empty first paragraph exist already in it. This paragraph has the style and properties. The page style is the property of the first paragraph. And to attach some of the properties of the page numbering is more convenient to the first paragraph, than to create a lot of new styles for pages. And so, how to number from not the first page (eg, starting of numbering from the second page with number 1):
  1. Place the cursor in the first paragraph of the page, with which the numbering of pages will be changed.
  2. Click the right mouse button on the paragraph and choose Paragraph... in the context menu.
  3. Go to Text Flow tab.
  4. Check Insert and With page style in the Breaks section.
  5. Select Beafore in the Position drop-down list.
  6. Specify the desired number in Page number field.

I would like to notice that a paragraph style has the same tab, with the same fields, but it will not work exactly as you can think. The page numbering will be applied to each paragraph with this style, moreover, the page break is inserted before the paragraph with this style. That is, if you have 20 paragraphs of Text Body style and you apply this way to this style with the start numeration from 4, you get 20 pages are numbered as 4. However, this way with styles can be used for headers when the document has several sections and each section should have its own numbering. But if you need to only get some style which always starts on a new page, you can use this tab without choosing With Page Style box.

Mixed page numbering

Under mixed numbering style is meant when the book pages is numbered in different ways (for example, a part in Arabic numerals, but another part in the Roman alphabet). In LibreOffice Writer mixed style of numbering is done using the tab Page of a page style.
  • Right-click the page style and choose Modify...
  • Go to Page tab and choose a style of page numbering in Format drop-down list under Layout Settings section.

Another way is to use the dialog box of Edit fields:
  • Go in the header or footer with page numbering.
  • Right-click on the page number. There may drop one of two context menus, only in one of they have the necessary menu item. I get the desired menu, if I do the click of the right button mouse on the left side of the number field, almost on the edge.
  • Select Fields... in the context menu.
  • Choose the desired numbering style in the list on the right of Edit fields dialog box. They are there a lot, but usually are used the Arabic or Roman.
  • Click OK.

Please note that Edit fields dialog is a direct formatting and dominates above styles, but its impact can not be removed by means of Clear direct formatting. The only way to remove this influence is to return the default value (As Page Style) in the dialog box Edit Fields. In addition, the change of page numbering by the fields dialog does not change the numbering style in the table of contents. That is, this method can only be used, if this section is not included in the table of contents, or you do not use the table of contents at all.

Numbering alignment on different edges of the page

If you want to use the alignment of the page numbering to different page edges (left and right), this can be achieved by assigning of a style paragraph for the paragraph with the field. The predefined styles already exist. It is styles Left Page and Right Page. And also paragraph styles for numbering the footer and header exist. These styles demand addition setting (for example, Header Right does not align text of the paragraph to the right by default). But, in general, the standard styles often have to bring to mind, so I hope you are using templates. The idea is that use different page styles and different paragraph styles to pages which require the different alignment. If you open style Left Page, you see on Organizer tab in the field Next Style specify Right Page. And on the contrary, in Right Page this field specifies the Left Page. This creates a series of pages with an automatic change of styles. And of course, for one style the numbering style can be one, and for the second it can be different. Now you only have to use the correct paragraph style to a paragraph header or footer (header/footer on the left, right or center).
Another way to use the text alignment button from the toolbar. But as you know, it is a direct formatting of text, with all its consequences.
These methods can also be used when you need to make numbers omitting a page, or the page must have different headers or footers (for example, chapter title and the page number exit on the left page, but the author's name and page number exist on the right).

Insert "page number from the total number of pages"

I know a few ways to do this page numbering in LibreOffice Writer, each of them has its advantages and disadvantages. In general, such documents have to have all the pages are numbered and for it you can use two fields in the document: Page Number and Page Count. That is enough for a typical case:
  1. Enter in the header or footer for editing.
  2. Write the word page.
  3. Go to Insert → Page Number in the main menu.
  4. Type a space, and the word from.
  5. And choose Insert → Fields → Page Count in the main menu.
The method is very simple, but has drawbacks. If you do not include a few pages into the page numbering (for example, there is the title page), or do a page numbering for section, then the specified number of pages show more than you number in fact.
In the latter case, each user works around as wants. Someone puts the empty hidden fields and links to it, someone uses a formula field. I for myself have found the following simple and fairly quick way to accomplish this task: Use bookmarks in the last paragraph of the document and the link to it.
  1. Go to the last numbered page of the document and set the cursor to the last paragraph.
  2. Go to Insert → Bookmark... in the main menu.
  3. In the opened dialog box, if you can specify a name for the bookmark (for example, total pages) and then click Insert button.
  4. Enter in the header or footer.
  5. Go to Insert → Fields → More field... in the main menu
  6. In the dialog that opens, go to Cross-reference tab , select Bookmarks item in Type field, then select Page in Insert reference to field, and select the the name you bookmark that point on the last numbered page in Select field.
  7. Click Insert.
This method indicates the number of actual numbered pages, but as a minus, links to bookmarks are not updated automatically in the latest versions. So you need to check the correctness of the number by eyes, if you do changes of the document.

Numbering landscape pages

Numbering rotated pages (mostly landscape orientation) that the page numbers coincides outwardly with the page numbering of the other pages, in fact in LibreOffice Writer, is a separate issue. To make it in 2 clicks, you should have customized styles and templates. I know two way in order to do this numbering.
At the beginning of this article I wrote about that a field of the page number can be inserted anywhere on the page, except margin where you can not insert anything. The first method can be useful if you insert only one page in document. It has shortcoming in that text can not move freely to another page without breaking the numbering, but it is simple and easy to do without a template.
This bases on inserting of a table with has two columns, if the page has the header or footer, or three columns, if the page contains the header and footer. The width of the columns, which replaces the header/footer must be equal to the height of the header/footer plus indentation from it to the text area. The number text can be rotated with help of this style sitting: go to Position tab in Paragraph Style dialog, and choose degrees under Rotation/Scaling.
Another method is to create a frame in the header or footer, insert the field of the page number in it and exact positioning for it.
  1. Create a header or footer and enter in it.
  2. Go to setting of the page style (right-click on page style and choose Modify...)
  3. Go to Page tab and correct values in Left and/or Right fields under Margins. Indentation needs to be increased so that it is equal the indentation from the page edge, plus the height of the header or footer, plus increased from the header or footer to text area.
  4. Also, you need to decrease the header or footer (Page and Header or Footer tabs)
  5. Go to Insert → Frame → Frame Interactively in main menu.
  6. Draw a small rectangle.
  7. Insert the page number (Insert → Page Number in the main menu)
  8. Correct the paragraph style for this paragraph (or choose a new paragraph style and correct it). Go to setting of the paragraph style on Position tab and and choose degrees under Rotation/Scaling (usually 270).
  9. Align the frame as you need. You can use the exact position if you go to the frame setting in Object... context menu in Type tab.
As you can guess, all pages with this style will be similar numbering.
There are still a lot of little tricks for working with page numbering. But perhaps this is all that is necessary to tell in the first place. And I think that if you study what is described above, more complicated ways to number the pages you can think yourself, taking as a basis the basic "tricks."

Source and additional information: