Closed elipousson closed 7 months ago
Could supply a fully reproducible (but still minimal) example. Perhaps a simple .qmd
with a simple table?
There's no logic at all in the tinytable
codebase to detect whether a table is referenced elsewhere in a document. Thus, my strong intuition is that this is a Quarto or knitr
issue, rather than tinytable
.
It would still be useful to have a clean example so we can escalate and report upstream if necessary.
Another good diagnostic step would be to try a file with tinytable
-generated table, and another one with exactly the same table, but with raw Typst code rather than tinytable
generation. If the same problem subsist, then we confirm that this is not tinytable
's "fault".
Here is an reproducible Quarto document (also here):
---
format: typst
---
```{r}
library(tinytable)
x <- mtcars[1:4, 1:5]
tt(x, caption = "Table caption")
#| tbl-cap: "Table caption"
tt(x)
See @tbl-tiny
#| label: tbl-tiny
#| tbl-cap: "Table caption"
tt(x)
After submitting the issue, I realized it was likely an issue with Quarto – happy to report over there if you can help me sort out the origin of the issue.
Raw typst output for reference:
@elipousson so there are two distinct problems.
First, the caption
argument in tt()
does not interact well with Quarto. I'm not sure if there's a solution for that and will need to investigate.
The second issue seems more clearly to fall in Quarto's remit. The problem is that:
label
chunk option is defined, Quarto wraps the Typst code in a #figure
block.label
chunk option is not defined, Quarto does not wrap the code in a #figure
block.The second behavior is probably incorrect in cases where the user supplies a tbl-cap
option explicitly. I believe this should be reported as an Issue on the Quarto repository.
You can see this by inspecting the raw .typ
file left over when rendering this notebook:
---
format:
typst:
keep-typ: true
---
```{r}
library(tinytable)
x <- mtcars[1:2, 1:2]
#| tbl-cap: "Fist table without label"
tt(x)
#| label: tbl-tiny
#| tbl-cap: "Second table with label"
tt(x)
This is a Quarto bug, so I reported it upstream: https://github.com/quarto-dev/quarto-cli/issues/9369
Thanks again for the report.
When using a Typst output format,
{tinytable}
appears to ignore thetbl-cap
code block option unless the table is referenced elsewhere in the document.