asciidoctor / asciidoctor-pdf

:page_with_curl: Asciidoctor PDF: A native PDF converter for AsciiDoc based on Asciidoctor and Prawn, written entirely in Ruby.
https://docs.asciidoctor.org/pdf-converter/latest/
MIT License
1.13k stars 500 forks source link

Page numbers for index entries incorrect when toc macro is used in prepress book when page-numbering-start-at is after-toc #2487

Closed mojavelinux closed 5 months ago

mojavelinux commented 5 months ago

When page numbering is configured to start after the toc (i.e., after-toc) in a prepress book, and the TOC is inserted using the toc macro, the page number of each index entry is 1 more than it should be if the the toc ends on a recto (facing) page. The converter is not accounting for the skipped verso page when computing the page number of an index entry.

Here's a reproducible example:

= Book Title
:doctype: book
:media: prepress
:toc: macro

toc::[]

== First Chapter

((apples))

== Second Chapter

((bananas))

[index]
== Index

This example must be used with a theme that configures the page numbering to start after the toc:

extends: default
page-numbering:
  start-at: after-toc

Here's what we expect to see:

A
apples, 1
B
bananas, 3

Here's what we actually see:

A
apples, 2
B
bananas, 4