Skip to content

If the first page is an explicit #page call state and counter updates before it are ignored #2172

@freundTech

Description

@freundTech

Description

Take a look at the following snippet:

#let number = counter("part-number")
#part_number.update(10)
#page[#number.display()]

The resulting document has only one page and the number is 0, when it should be 10. The same also happens with states.

My guess is that typst removes the first page if it only contains whitespace to not have an empty page before the first page it the document starts with an explicit #page call, though I have not verified if this is really what's happening.

If this is the reason possible solutions would be to either not threat state/counter updates as whitespace in this context (so the above snippet would start with an "empty" page containing only the update) or to automatically move the update into the page.

Reproduction URL

No response

Operating system

Linux

Typst version

  • I am using the latest version of Typst

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingintrospectionRelated to the introspection category

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions