I am using Prince 12.
Is it possible to create two page counters?
In my use case, I need a page counter for the whole document and another within each chapter. For example, say chapter 2 starts on page 4 of the document, the document page counter would be at "4" and the chapter page counter would be at "1".
Is this possible with Prince?
I am currently doing this in order to get the chapter page counter:
I tried to create a document page counter by doing this:
But that did not work. The "documentPage" counter does not increment on every page, so it always stays at 1.
Is it possible to create two page counters?
In my use case, I need a page counter for the whole document and another within each chapter. For example, say chapter 2 starts on page 4 of the document, the document page counter would be at "4" and the chapter page counter would be at "1".
Is this possible with Prince?
I am currently doing this in order to get the chapter page counter:
<style type="text/css">
.chapter {
page: chapter;
counter-reset: page 1;
prince-page-group: start;
}
.chapter-page::after {content: counter(page);}
</style>
<body>
<div class="chapter" id="chapter-1">
<h1>Chapter 1</h1>
<h2>Page 1</h2>
<div>Chapter page <span class="chapter-page"></span></div>
<div style="page-break-before: always;"></div>
<h2>Page 2</h2>
<div>Chapter page <span class="chapter-page"></span></div>
</div>
<div class="chapter" id="chapter-2">
<h1>Chapter 2</h1>
<h2>Page 1</h2>
<div>Chapter page <span class="chapter-page"></span></div>
<div style="page-break-before: always;"></div>
<h2>Page 2</h2>
<div>Chapter page <span class="chapter-page"></span></div>
</div>
</body>
I tried to create a document page counter by doing this:
<style type="text/css">
body {
page: body;
counter-reset: documentPage 1;
}
@page body {
counter-increment: documentPage;
}
.chapter {
page: chapter;
counter-reset: page 1;
prince-page-group: start;
}
.chapter-page::after {content: counter(page);}
.document-page::after {content: counter(documentPage);}
</style>
<body>
<div class="chapter" id="chapter-1">
<h1>Chapter 1</h1>
<h2>Page 1</h2>
<div>Chapter page <span class="chapter-page"></span></div>
<div>Document page <span class="document-page"></span></div>
<div style="page-break-before: always;"></div>
<h2>Page 2</h2>
<div>Chapter page <span class="chapter-page"></span></div>
<div>Document page <span class="document-page"></span></div>
</div>
<div class="chapter" id="chapter-2">
<h1>Chapter 2</h1>
<h2>Page 1</h2>
<div>Chapter page <span class="chapter-page"></span></div>
<div>Document page <span class="document-page"></span></div>
<div style="page-break-before: always;"></div>
<h2>Page 2</h2>
<div>Chapter page <span class="chapter-page"></span></div>
<div>Document page <span class="document-page"></span></div>
</div>
</body>
But that did not work. The "documentPage" counter does not increment on every page, so it always stays at 1.
Edited by GreenRaccoon23