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.14k stars 501 forks source link

after-toc page numbering when using prepress mode #2398

Closed mateibarbu19 closed 1 year ago

mateibarbu19 commented 1 year ago

Hello,

I noticed that when enabling prepress mode, the first chapters page is 2, instead of 1.

Is this a bug, or am I doing something wrong? I tried to follow the source code, but failed due to lack of knowledge.

My source file, source.adoc:

:doctype: book
:reproducible:
:toc: macro
:media: prepress
:pdf-theme: theme.yml

= Interesting Title

[abstract]
.Abstract

Documentation is a distillation of many long adventures.

toc::[]

== The only Chapter

Dear reader, hello!

My theme file, theme.yaml:

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

Run:

asciidoctor-pdf source.adoc
mojavelinux commented 1 year ago

As to to whether this behavior is by design, the answer is yes. But can we change the behavior so that after-toc refers to the first recto page after the toc? I think the answer is also yes. I've submitted a PR with the proposed change.

mojavelinux commented 1 year ago

This change will require a documentation update.

mateibarbu19 commented 1 year ago

Thanks for your help! I will close the issue since any discussions on this matter can follow on the PR.

mojavelinux commented 1 year ago

Actually, the PR will close the issue, so I prefer to keep it open until then. But I should be merging it shortly.

mojavelinux commented 1 year ago

I think it's safe to reclassify this as a bug. The converter already skips the verso page after a chapter, and the toc in a book acts as a chapter. It seems unlikely someone would want to start content on the verso page. So we can think of "after-toc" in a prepress book to mean the first recto page after the last page of the toc.

Another reason I can say that is because the "body" keyword in a prepress book that uses the toc in the default location uses this same logic. So there is already precedence for it.