vincentarelbundock / tinytable

Simple and Customizable Tables in `R`
https://vincentarelbundock.github.io/tinytable
GNU General Public License v3.0
211 stars 18 forks source link

Typst: Footnotes #176

Closed vincentarelbundock closed 6 months ago

vincentarelbundock commented 8 months ago

@florence-laflamme how do we add notes at the bottom of a table in Typst?

florence-laflamme commented 8 months ago

From what I've seen, there is no straightforward way to do this. One possible way would be to add a row at the bottom, merge its cells, and suppress its borders. This package: https://github.com/PgBiel/typst-tablex makes it possible.

#import "@preview/tablex:0.0.8": tablex, colspanx, hlinex, vlinex
#figure(
  tablex(
    vlinex(end : 2),
    columns: 4,
    [t], [1], [2], [3],
    [y], [0.3s], [0.4s], [0.8s],
    colspanx(4)[These are notes.],
    hlinex(end: 0),
    vlinex(end : 2),

  ),

  caption: [This is a caption. ],
)
vincentarelbundock commented 8 months ago

The row at the bottom seems like a good solution. Is text wrapped automatically to table width or does the table stretch forever?

florence-laflamme commented 8 months ago

To wrap text automatically you can use fit-spans: (x: true). In my example:

#import "@preview/tablex:0.0.8": tablex, colspanx, hlinex, vlinex
#figure(
  tablex(
    fit-spans: (x: true),
    vlinex(end : 2),
    columns: 4,
    [t], [1], [2], [3],
    [y], [0.3s], [0.4s], [0.8s],
    colspanx(4)[These are very long notes.],
    hlinex(end: 0),
    vlinex(end : 2),

  ),

  caption: [This is a caption. ],
)
vincentarelbundock commented 6 months ago

Fixed in https://github.com/vincentarelbundock/tinytable/pull/240