Reference to last page in book
Sometimes page numbering must include the total number of pages (e.g. Page
7 of 71
).
As long as we are working in a file (chapter), the system variable Page
Count
with the building block <$lastpagenum>
serves
this purpose.
When we need this information in the chapters of a book, this system variable is not sufficient. It always provides the last page number of the current file:
- If you specify in the numbering property of a file "Continue Numbering from Previous Page in Book" then the Page Count gives you the last page number in the current file.
- If the numbering is specified to "Start with 1" then Page Count provides the number of pages in the current file (which of course is the same as the last page number in this file).
To get a correct numbering in your layout, do the following:
- In the last chapter of your book set up a paragraph format
z-last-page
with an arbitrary appearance. It must not be empty, provide at least a requrired blank (CTRL+space). - In the layout of your chapters set up the page numbering with this contents:
Page # of xxxx
. - The # symbol denotes the system variable
Page Number
.
xxxx
denotes a cross reference to the last file with the format<$lastpage>
referring to the paragraph typez-last-page
.