Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
MDLC01 opened this issue May 23, 2024 · 1 comment
Open
1 task done
Labels
bug Something isn't working layout Related to layout, positioning, etc.

Comments

@MDLC01
Copy link
Contributor

MDLC01 commented May 23, 2024

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
@MDLC01 MDLC01 added the bug Something isn't working label May 23, 2024
@Enivex Enivex added the layout Related to layout, positioning, etc. label May 24, 2024
@laurmaedje
Copy link
Member

Related: #2914

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working layout Related to layout, positioning, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants