PgBiel / typst-tablex

More powerful and customizable tables in Typst
Apache License 2.0
376 stars 13 forks source link

Tablex sometimes could break across pages but sometimes could not #101

Closed yoonghm closed 11 months ago

yoonghm commented 11 months ago

I am not sure if it is already reported. I have an example here, which could work in some documents by removing kind: table.

#import "@preview/tablex:0.0.7": tablex, cellx, rowspanx, colspanx

#set page(
  height: 10cm,
)

#figure(
  tablex(
    columns: 2,
    align: auto,
    auto-vlines: false,
    header-rows: 1,
    map-cells: cell => {
      if cell.y == 0 {
        cell.align = center
        cell.fill = rgb("#d4ebf2")
        cell.content = {
          set text(size: 10pt, fill: black)
          strong(cell.content)
        }
      }
      else if cell.y > 0 and cell.x == 0 {
        cell.content = {
          set text(size: 10pt)
          strong(cell.content)
        }
      }
      else {
        cell.content = {
          set text(size: 10pt)
          cell.content
        }
      }
      cell
    },
    /* Header*/
    cellx(align: center)[Section], cellx(fill: blue, align: center)[Description],
    [*\#*], [*Names end with 'rry'*],
    /* Body */
    [ 1], [Marry],
    [ 2], [Harry],
    [ 3], [Larry],
    [ 4], [Barry],
    [ 5], [Terry],
    [ 6], [Jerry],
    [ 7], [Perry],
    [ 8], [Garry],
    [ 9], [Derry],
    [10], [Sherry],
    [11], [Cherry],
    [12], [Emery],
    [13], [Hilary],
    [14], [Rory],
    [15], [Mallory],
    [16], [Avery],
    [17], [Thierry],
    [18], [Merry]
  ),
  kind: table
)

image

PgBiel commented 11 months ago

Use #show figure: set block(breakable: true)