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
Heading counter is always zero until numbering is set #4061
Comments
This is intentional |
Ok, in this case, this should be clearly documented and explained, because it's extremely confusing to stumble upon. Also, what is the reason for this behaviour? |
Let me ask the opposite question: Why would the counter step if numbering is not set? If it did, then I couldn't create unnumbered sections without manually decrementing the counter at the same time. |
I've reopened the issue, as I couldn't find this covered by the documentation. (Though I may have overlooked something) |
Because the counter is defined to be counting things as they occur, not "counting things, but only if you also ask for the number afterwards":
No part of the docs mention the caveat, despite explaining when exactly the heading counter is stepped, and how to reset it. It's not at all clear to me that "I want to keep my unnumbered sections actually devoid of a number, not just not displaying the number" is the correct default, especially when resetting it explicitly covered and possible without any undue work. |
In what situation would you want the counter to keep going, but just not display it? |
@Enivex: when the numbers are shown only for some of the counted items, or not a strict prefix of the heading content. That's how I originally stumbled upon it, I was writing a |
You should step the counter before displaying it. You can check if |
@PgBiel: I don't really understand what you mean by that. If the numbering is |
Description
Repro:
This renders as:
Tested on the web app (as of 2024-05-02), and locally on
0.11.0 (2bf9f95d)
Reproduction URL
No response
Operating system
Web app
Typst version
The text was updated successfully, but these errors were encountered: