vincentarelbundock / tinytable

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

tbl-subcap doesn't work with Quarto #261

Open grantmcdermott opened 1 month ago

grantmcdermott commented 1 month ago

Hey @vincentarelbundock, I ran into this minor bug today. Here's a simple MWE that borrows from the knitr-based example from the Quarto docs.

This (i.e., the original) works:

```{r}
#| label: tbl-example
#| tbl-cap: "Example"
#| tbl-subcap: 
#|   - "Cars"
#|   - "Pressure"
#| layout-ncol: 2

library(knitr)
kable(head(cars))
kable(head(pressure))

But replacing `knitr` with `tinytable` causes the sub-captions to disappear.
#| label: tbl-example
#| tbl-cap: "Example"
#| tbl-subcap: 
#|   - "Cars"
#|   - "Pressure"
#| layout-ncol: 2

library(tinytable)
tt(head(cars))
tt(head(pressure))


Sorry for not digging deeper. I'm strapped for time atm. Loving tinytable, though ;-)
vincentarelbundock commented 1 month ago

Hmm, this is going to be difficult. I have no idea how Quarto decides where to insert subcaptions in the HTML/LaTeX code. They almost certainly hard-coded regex inserts based on the default kable() output, and they don't support tabularray.

I'll look into it when I have time, but it may require upstream changes.

grantmcdermott commented 1 month ago

Cool cool. No rush from my side.