PgBiel / typst-tablex

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

Repeat-headers breaks inner tables' vlinexs on following pages #34

Closed lf- closed 9 months ago

lf- commented 1 year ago

This is kind of a strange bug I ran into while doing a homework, so please excuse the messy code that has been sanitized.

Built with tablex main 2f80d86, and typst 0.6.0.

Problem: the vlinex of the inner table in the first row of a new page gets vertically shifted:

image

#import "./tablex/tablex.typ": tablex, vlinex, hlinex

#lorem(500)

#let preflist(..args) = {
    let args = args.pos()
    let maxlength = 6
    let parts = args.map(a => a + range(maxlength - a.len()).map(_ => [])).flatten()
    tablex(
        columns: 6,
        auto-lines: false,
        (), vlinex(),
        ..parts
    )
}

#tablex(
    columns: (40pt, 18pt, 18pt, 120pt, 120pt),
    auto-vlines: false,
    header-rows: 1,
    repeat-header: true,
    (), vlinex(), vlinex(), vlinex(), vlinex(), (),
    hlinex(stroke: none),
    [Aaaaa], [$a$], [$a$], [aaaaaaaaaaaaaaaaaa], [aaaaaaaaaaaaaaaaaaaaaaaa],
    [1], [1], [1], [1 blah 1], preflist(
        (1, 1, 1, 1, 1, 1),
        (1, 1, 1, 1, 1),
        (1, 1, 1, 1, 1),
        (1, 1, 1, 1, 1),
        (1, 1, 1, 1, 1, 1),
        (1, 1, 1),
    ),

    [1], [1], [1], [1 blah 1], preflist(
        (1, 1, 1, 1, 1),
        (1, 1, 1, 1, 1),
        (1, 1, 1, 1, 1),
        (1, 1, 1),
        (1, 1, 1, 1, 1),
        (1, 1, 1),
    ),

    [1], [1], [1], [1 blah 1, blah 1], preflist(
        (1, 1, 1, 1, 1),
        (1, 1, 1, 1),
        (1, 1, 1, 1, 1),
        (1, 1),
        (1, 1, 1, 1, 1),
        (1, 1, 1),
    ),

    [1], [1], [1], [1 blah 1], preflist(
        (1, 1, 1, 1, 1),
        (1, 1, 1, 1),
        (1, 1, 1, 1),
        (1, 1),
        (1, 1, 1, 1),
        (1, 1, 1),
    ),

    [1], [1], [1], [1 blah 1], preflist(
        (1, 1, 1, 1),
        (1, 1, 1),
        (1, 1),
        (1, 1),
        (1, 1, 1, 1),
        (1, 1, 1),
    ),

    [1], [1], [1], [1 blah 1, blah 1], preflist(
        (1, 1, 1),
        (1, 1, 1),
        (1, 1),
        (1, 1),
        (1, 1, 1, 1),
        (1, 1),
    ),

    [1], [1], [1], [1 blah 1], preflist(
        (1, 1, 1),
        (1, 1, 1),
        (1, 1),
        (1, 1),
        (1, 1, 1, 1),
        (1, 1),
    ),

    [1], [1], [1], [1 blah 1, blah 1], preflist(
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
    ),

    [1], [1], [1], [1 blah 1], preflist(
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
        (1, 1),
    ),
    hlinex(stroke: none),
)
PgBiel commented 1 year ago

Tablex in tablex always tends to generate problems it seems haha. I guess this is kind of a use case I wasn't anticipating at first (although it makes sense).

I'll eventually perform some local tests, but how do normal tables behave here? And does changing the inset (padding) parameter help?

lf- commented 1 year ago

Not sure! I can't promise to remember to get back to test this: turning off repeat-headers will at least prevent it from happening so I did that.

PgBiel commented 9 months ago

Hey! Turns out this was due to #80, therefore this is now fixed (can't reproduce after f6f7b525d9d725b66bb435342fa2a6a917e640c7). Thanks for reporting!