Skip to content

Grid with 1fr doesn't consider spacing of other content #2571

Open

Description

@wrzian

Description

Using grid(row-gutter: 1fr) sets spacing based on the height of the page and not the available space. This works correctly when using stack(spacing: 1fr)

#set page(height: 1.5in, width: auto, margin: .25in)
#let rects = (rect(height: 1em, width: 5em),) * 3

With stack
#stack(..rects, dir: ttb, spacing: 1fr)

#pagebreak()

With grid
#grid(..rects, columns: 1, row-gutter: 1fr)

Typst version

  • I am using the latest version of Typst

Activity

  1. added
    bug
    on Nov 3, 2023
  2. added
    layout
    on Nov 3, 2023
  3. sijow commented on May 22, 2024

    @sijow
    Contributor

    Same problem with the row height rather than gutter:

    #set page("a9", margin: 1cm, flipped: true)
    #lorem(5)
    #grid(rows: 1fr, fill: red)[x]
    

    image

  4. PgBiel commented on Oct 14, 2024

    @PgBiel
    Contributor

    With Typst 0.12 (testing with 0.12.0-rc1), wrapping the grid in a block(height: 1fr) will become available as a workaround, as outlined in the forum post https://forum.typst.app/t/how-can-i-make-a-table-take-up-the-remaining-vertical-space-on-the-page-without-going-over/1074/3:

    #set page(height: 200pt)
    
    Blah
    
    blah
    
    hello
    
    sdfsdf
    
    #block(height: 1fr, grid(columns: (1fr), rows: (1fr,1fr), stroke: black))
    
    sdfsfsfsf

    output: grid properly occupies the remaining space

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