How to display a rotated table over several pages?

Hello,
I have a very large table that I’d like to display on several pages. The following code :

#set page("a4", margin: (
  left: 1cm, 
  bottom: 1cm,
  top: 1cm,
  right: 1cm), 
  flipped: false)


#rotate(
  -90deg,
  reflow: true)[#figure(
 block(width: 100%, breakable: true, (table( 
    columns: (auto, auto, auto, auto, auto, auto, auto, auto, auto,),
    align: (left,left,left,left,left,left,left,left,left,),
    table.header([Type of model and
      outputs], [Model name and/or
      references], [...

gives this:

How can I make the rotated table spread over several pages?
Thank you,
fdekerm

My first thought to address this was instead of rotating the figure, rotate the page with #set page(flipped: true). I tried that and it did not improve the situation:

#set page("a6")
#let numCols = 6
#let numRows = 15

#let testTable = table( 
  columns: (auto,)*numCols,
  align: (left,left,left,left,left,left,left,left,left,),
  
  table.header(..(lorem(2),)*numCols),
  ..(..("data",)*numCols,)*numRows
)

#set page(flipped: true)

#figure(
  block(width: 100%, breakable: true,
    testTable,
  )
)
Output

image

But if the same table is used outside of a figure, it works as expected:

#set page("a6")
#let numCols = 6
#let numRows = 15

#let testTable = table( 
  columns: (auto,)*numCols,
  align: (left,left,left,left,left,left,left,left,left,),
  
  table.header(..(lorem(2),)*numCols),
  ..(..("data",)*numCols,)*numRows
)

preamble text
#set page(flipped: true)

#testTable
Output

And changing orientation of the page works nicely:

Normal orientation
#set page(flipped: true)
#testTable
#set page(flipped: false)
Again, normal orientation
Output

So, it seems figures do not handle spilling into a new page well.

Figures are unbreakable by default (regardless of whether a block(breakable: true) is used in its body). You can use #show figure.where(kind: table): set block(breakable: true) to change this. (Though note that, for now, the figure caption won’t be repeated. There is some discussion and even a PR to change this, but it isn’t done yet.)

See also “Figure Behavior” in Figure Function – Typst Documentation

2 Likes