Skip to content

page style after pagebreak(to: "odd") affects the even numbered page before the break #2162

Closed

Description

@frugal-10191

Description

Some text on page 1
#pagebreak(to: "odd") //we should now be on page 3
#set page(fill: orange) // This sets the file from page 2...
this is some text on page 3

Expected result: Pages 1 and 2 should be white, and page 3 should be orange.

Actual result: Page 1 is white, but page 2 is Orange.

Some text on page 1
#pagebreak()
#pagebreak(to: "odd") //we should no be on page 3
#set page(fill: orange) // This sets the file from page 2...
this is some text on page 3

Putting an explicit page break before the pagebreak(to:"odd") exhibits the correct behaviour (1&2 white, 3 orange)

Some text on page 1
#pagebreak()
#pagebreak(to: "odd", weak: true) //we should no be on page 3
#set page(fill: orange) // This sets the file from page 2...
this is some text on page 3

adding "weak:true" to the page break exhibits the same behaviour as the error case (1 white, 2 and 3 orange)

putting any text between the two pagebreaks ensures that the page colours are correct, but now there is unwanted text.

Reproduction URL

n/a

Operating system

Web app

Typst version

  • I am using the latest version of Typst

Activity

  1. added
    bug
    on Sep 16, 2023
  2. added
    styling
    on Sep 16, 2023
  3. LuxxxLucy commented on Sep 17, 2023

    @LuxxxLucy
    Contributor

    Just checked the code and did some experiment. This is not just fill but any style/attribute in general. Essentially, the pagebreak will creates an empty page, but the style of the empty page (fill, width, height, or any other style) will be identical to the next page instead of the previous page. See the fn layout for PageElem in layout/page.rs, note that the created empty page when clear_to flag is triggered.

    An example as described by @frugal-10191

    Some text on page 1
    #pagebreak(to: "odd") // We should now skip to page 3
    #set page(fill: orange) // This should set the color of the page starting from page 3, but page 2 already is set.
    Some text on page 3
    

    pagebreak-set-style

    I would consider it as a bug to be fixed, as I think it would be natural to assume and expect the empty page to follow the style of the previous page, instead of the style of the next page

  4. Enivex commented on Sep 18, 2023

    @Enivex
    Collaborator

    Seems to be the same issue causing #2095

  5. LuxxxLucy commented on Sep 18, 2023

    @LuxxxLucy
    Contributor

    Seems to be the same issue causing #2095

    Indeed.

  6. laurmaedje commented on Sep 25, 2023

    @laurmaedje
    Member

    Fixed by #2182

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

    bugstyling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions