Skip to content

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

Closed

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

Activity

  1. added
    bug
    on Sep 17, 2023
  2. laurmaedje commented on Sep 18, 2023

    @laurmaedje
    Member

    Same as #2134, this was caused by #1929 and is unfortunately not fixed by #2141. Bit of a similar issue as the second snippet in #1929 (comment). Like you said, the explicit page leads to stuff around it being deleted.

  3. added
    layout
    on Sep 18, 2023
  4. added and removed
    layout
    on Nov 14, 2023
  5. added
    introspection
    and removed on Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugintrospection

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions