Skip to content

Configurable table/grid repeated border #6072

@PgBiel

Description

@PgBiel

Description

Right now, any lines at the top and bottom of tables and grids are always repeated:

#set page(width: auto, height: 9em)
#table(
  table.hline(stroke: red),
  [a], 
  [a],
  [a],
  [a],
  [a],
  [a],
  [a],
  [a],
  [a],
  [a],
  table.hline(stroke: blue),
)
3 pages, the lines appear in all of them

Image

Image

Image

While this felt like a good default after the Typst 0.11 table revamp (#3001), some users have requested to be able to turn this off.

Currently, one way to do so is by adding empty cells at the top and bottom of the table.

#set page(width: auto, height: 5.5em)

#let cols = 2
#let workaround-cell = table.cell(colspan: cols, stroke: none, fill: none, inset: 0pt)[]

#table(
  columns: cols,
  workaround-cell,   // !
  table.hline(stroke: red),
  [a], 
  [a],
  [a],
  [a],
  [a],
  [a],
  [a],
  [a],
  [a],
  [a],
  table.hline(stroke: blue),
  workaround-cell,  // !
)
3 pages, lines not repeated

Image

Image

Image

But a convenient API would be nice, e.g. border: auto (default) | none (no repeat).

Use Case

Some tables do not need their top and bottom lines to be repeated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    change requestA proposal for changes to an existing featurelayoutRelated to layout, positioning, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions