Skip to content

Element with no content followed by pad can force breakable block to create an empty frame #4234

Closed as not planned

Description

@MDLC01

Description

This bug has a similar effect as #2297, which was fixed by #2517. Sadly, the fix does not work in the specific case where the element with no content is directly followed by a pad element (which happens somewhat often given that block used pad under the hood to make inset work).

Example

#set page(height: 3cm, margin: 0.5cm)

Not enough space remaining on this page to fit the whole block.

#block(stroke: 1pt)[
  #counter("dummy").update(1)
  #pad(left: 1cm, top: 1cm, rect(height: 1cm, fill: gray))
]

An empty frame is created for the counter update.

Typst produces the same output without an explicit pad:

#set page(height: 3cm, margin: 0.5cm)

Not enough space remaining on this page to fit the whole block.

#block(stroke: 1pt)[
  #counter("dummy").update(1)
  #block(inset: (left: 1cm, top: 1cm), rect(height: 1cm, fill: gray))
]

Note that removing the counter update removes the undesired rectangle.

Reproduction URL

No response

Operating system

No response

Typst version

  • I am using the latest version of Typst

Activity

  1. added
    bug
    on May 23, 2024
  2. added
    layout
    on May 24, 2024
  3. laurmaedje commented on Jun 14, 2024

    @laurmaedje
    Member

    Related: #2914

  4. laurmaedje commented on Jul 5, 2024

    @laurmaedje
    Member

    I'll close this in favor of #2914. There are various ways to reproduce this problem by adding things into the block that aren't visible, but still produce a non-empty or non-zero-sized frame. Needs a more general solution.

  5. added
    duplicate
    on Jul 5, 2024
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

    bugduplicatelayout

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions