typst-tablex icon indicating copy to clipboard operation
typst-tablex copied to clipboard

Easily disable hlines and vlines at the edge of the table?

Open lf- opened this issue 2 years ago • 3 comments

I have tried writing something like the following, but it seems clumsy. Is there a better way to turn off vlines and hlines inside a table? One issue I have is that I can't tell the dimensions of the table from inside map-hlines, so I can't automatically know the end of the table.

#tablex(
    columns: (auto, auto, auto, auto, auto),
    auto-vlines: false,
    map-hlines: h => if (h.y == 0 or h.y == 2) { hlinex(stroke: none) } else { h },
    (), vlinex(), vlinex(), vlinex(), vlinex(), (),
    [a], [$u$], [$v$], [c], [d]
)

lf- avatar Jul 12 '23 01:07 lf-

Does the following work?

#tablex(
    columns: (auto, auto, auto, auto, auto),
    auto-vlines: false,
    hlinex(stroke: none),
    (), vlinex(), vlinex(), vlinex(), vlinex(), (),
    [a], [$u$], [$v$], [c], [d],
    hlinex(stroke: none)
)

PgBiel avatar Jul 12 '23 01:07 PgBiel

Although I agree it'd be nice to be able to tell how far a certain line is from the end of the table when mapping it, so we can consider that a feature request.

PgBiel avatar Jul 12 '23 01:07 PgBiel

Indeed, this works. It is kind of a bodge, but it absolutely works.

lf- avatar Jul 12 '23 02:07 lf-