PgBiel / typst-tablex

More powerful and customizable tables in Typst
MIT License
370 stars 12 forks source link

Using multiple `header-rows` doesn't work when using `tablex` mulitple times #29

Open JKRhb opened 1 year ago

JKRhb commented 1 year ago

Hi there! :)

First of all, thank you for creating this awesome package!

While trying to use two tables in a document with repeating headers that span two rows, I encountered a bug that prevents the second table from being rendered correctly (the repeating header is omitted starting at the second page). The code and screenshot below should illustrate the problem.

Minimal Example

#import "@preview/tablex:0.0.4": tablex

#set page(height: 10em)

#let header = ([*Header*], [*Header*], [*Header*], [*Header*])
#let body = ([This], [is], [a], [Test])

#tablex(
    columns: (auto, auto),
    repeat-header: true,
    header-rows: 2,

    ..header,

    ..body,
    ..body,
    ..body,
)

#pagebreak()

#tablex(
    columns: (auto, auto),
    repeat-header: true,
    header-rows: 2,

    ..header,

    ..body,
    ..body,
    ..body,
)

Result:

image
PgBiel commented 1 year ago

Hello, thanks for the bug report! Upon initial inspection, this seems to be due to certain limits in Typst's introspection features (state, locate and the likes, which are used by tablex). I believe this issue should be fixed when #2 is completed, however (which will enable tablex to depend less on introspection, thus also making it faster). Thanks again for opening the issue!