Page 1 of 1

Continuous Page Numbering

Posted: Thu Oct 24, 2019 7:32 am
by jmorales
Hi,
We're customizing the CSS for the table of contents for PDF output, and I notice that the page numbering is not working how we would like. We want the pages in the book to be numbered continuously from the title page to the end. So our page footers throughout the book use the following for the page number:
@bottom-right { content: "Page " counter(page) " of " counter(pages);
Using this scheme, the first page of the first chapter is counted as page 4, because the Title page is on page 1, copyright is page 2, and TOC is page 3. But in the TOC, the entry for the first chapter says that the chapter starts on page 1, apparently because the front matter is not being included in the count. Is there some way to get the TOC to display the same page numbers that we're displaying on the page footers?
Thanks!

Continuous Page Numbering

Posted: Fri Oct 25, 2019 3:33 pm
by Dan
The page numbers are reset to one in two cases:
  • On the first topic that follows the TOC
  • On the first topic from the index
To avoid the page counter being reset, you can use in your customization:

Code: Select all

*[class ~= "map/map"] > *[class ~= "toc/toc"] + *[class ~= "topic/topic"],
*[class ~= "index/groups"] {
  counter-reset: none;
}
The index page also changes the format of the page numbers to lower alpha. To switch to decimal, use:

Code: Select all

@page index {
  @bottom-center {
    content: counter(page, decimal)
  }
}

Re: Continuous Page Numbering

Posted: Tue Nov 05, 2019 7:29 am
by jmorales
Thanks, Dan. That solution worked perfectly for me.