Skip to content

weak pagebreak after page counter update always adds pagebreak #1346

Closed

Description

@azerupi

Description

When adding a pagebreak(weak: true) after an update of the page counter the pagebreak will always be inserted even if the page is empty.

To reproduce:

#counter(page).update(1)

#pagebreak(weak: true)
= Page 1

#pagebreak(weak: true)
= Page 2

I would expect no pagebreak to be inserted as there is no visible content on the page before the pagebreak.

Reproduction URL

No response

Operating system

Linux

Typst version

  • I am using the latest version of Typst

Activity

  1. added
    bug
    on May 27, 2023
  2. maxcrees commented on May 27, 2023

    @maxcrees

    I think the issue is that updating the counter (or any state for that matter) returns a piece of content - this is so the compiler is able to order the various updates with respect to layout order. This piece of content is typically not visible, but results in corner cases like this.

    Because that content is inserted, pagebreak no longer believes the current page is entirely blank (although it appears to be), and thus weakness does not apply.

    I agree that this would be useful to support, but I'm not sure how complex it would be to do so.

  3. added
    layout
    on May 29, 2023
  4. added
    styling
    layout
    and removed
    layout
    styling
    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

    buglayout

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions