Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I cannot get the correct TOC page number in pdf file with DocBook #2008

Closed
olderflower opened this issue Nov 24, 2023 · 2 comments
Closed

I cannot get the correct TOC page number in pdf file with DocBook #2008

olderflower opened this issue Nov 24, 2023 · 2 comments
Labels
CSS Questions about how to do something with CSS

Comments

@olderflower
Copy link

I use weasyprint to generate my pdf file, I have had a problem at:

docbook/xslTNG#433

so, how can I solve it?

@liZe liZe added the CSS Questions about how to do something with CSS label Dec 4, 2023
@liZe
Copy link
Member

liZe commented Dec 4, 2023

Hi!

I use weasyprint to generate my pdf file, I have had a problem at:

counter-reset: page; sets the 0 value to the page counter, used to get page numbers. So, if you use it in a selector that appears on a page, this page will be page number 0, and 0 will appear in the table of contents.

Moreover, the automatic page counter is created in the page context (not the page content context), and resetting it in the content will create a new counter called page, independent from the page counter automatically created in page context. If you want to override the value of the page counter instead of creating another one, you really should do this in the page context, ie. in an @page rule. Otherwise, the page counter you created in content will always be 0 on all pages, as it’s not automatically incremented, contrary to the page counter in the page context.

Short answer: the "bug" is in the stylesheet as far as I can tell. 😄

so, how can I solve it?

If you don’t want to / can’t change the original stylesheet, you can set counter-reset: none; with the same selector after importing the original stylesheet.

@olderflower
Copy link
Author

When set counter-reset: none; I got the correct result.
thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Questions about how to do something with CSS
Projects
None yet
Development

No branches or pull requests

2 participants