Repeat heading when table split onto multiple pages

Hi,

I have a document structure that looks something like this:

= Section 1

#table(columns: 8, [many many cells])

= Section 2

#table(columns: 8, [many many cells])

The tables are big and sometimes split over multiple pages.
I’m wondering if there is a way to have the heading be repeated on those consecutive pages, otherwise it’s hard to see at a glance which table we’re actually looking at.

Thanks!

Here’s how you do it (N.B. no commas between the fields in the table.header row).

#table(
  columns: (3em, 2fr, 1fr, 1fr),
  align: (center, left, left, center),
  inset: 5pt,
  stroke: 0.5pt,

table.header[Date][Summary][Location][Duration],
  [1],[blah],[blah],[blah],
  [2], [], [], [],
  [3], [], [], [],
  [4], [], [], [],
  [5], [], [], [],
  [6], [], [], [],
)

:slight_smile:
Mark

Hey Mark,

I don’t see how this is related to my question, maybe I wasn’t clear enough.

Here’s another example:

#set page(width: 10cm, height: 10cm)

= Section 1

#table(columns: 4, ..range(50).map(it => [#it]))

= Section 2

#table(columns: 4, ..range(50).map(it => [#it]))

This renders two tables which are overflowing onto the next page.
I want the heading “Section 1” to be repeated at the top of page 2 and the heading “Section 2” to be repeated on page 3.

Thanks!

1 Like

Sorry, I read “heading “ as “header”. My bad!

I’d look into Chic-hdr or Hydra packages, as they can put the section heading into the page header, if that would solve your problem.

:slight_smile:
Mark

The core problem is that semantically heading must appear once in the order of the content structure. You want it to repeat multiple times in the flow of the document, not only that but in the middle of a table. I’ve never seen this and doubt anyone would want it either.

For repeating table caption there is Add ability to repeat the caption (or a modified caption) of a multi-page table in subsequent pages · Issue #5057 · typst/typst · GitHub.

Using the caption instead of the heading is totally fine for my use case, I’ll try that.

Thanks!

1 Like