Closed arcruz0 closed 5 months ago
Thanks for the report and diagnostics. In principle, you should be able to use the tabularray_outer
argument to insert the label. However, unlike you, I am unable to make cross-referencing work, even when adding label
.
In this example, the "manual" latex reference works for PDF, but not the other. Both references fail in HTML.
What are you doing differently?
---
title: "Example"
format:
pdf:
keep-tex: true
html: default
---
```{r}
library(tinytable)
Table \ref{tbl-ex-multipage}
@tbl-ex-multipage says...
tt(rbind(mtcars, mtcars), caption = "Example table.") |>
style_tt(tabularray_outer = "label={tbl-ex-multipage}") |>
theme_tt("multipage")
We do we get the same result. My apologies; I checked the cross-referencing on LaTeX, but not on Quarto with the @tbl-
syntax. After experimenting a bit, I couldn't get the the @tbl-
syntax to work in any way (as you predicted in #209—I suppose this is indeed an upstream Pandoc/Quarto issue).
Still, this style_tt()
+ \ref{}
workaround is acceptable for my use-case. So thank you so much!
Good to hear.
Let's leave the issue open until I have a more general solution. Also, please be aware that behavior might change in the future once I find a permanent solution.
Unfortunately, there cannot be a general or cleaner solution for now, because of Quarto-specific reasons explained here: https://github.com/quarto-dev/quarto-cli/discussions/9332
I have improved the documentation and the vignette to provide clearer guidelines for users.
Thanks for raising this!
Hi and thanks for the great package! Please see the following .qmd MRE:
In the rendered PDF, the cross-reference doesn't work (rendering gives the warning: "WARNING: Unable to resolve crossref @tbl-ex-multipage"):
This issue has showed up previously in #209 in connection with Quarto. But I think the problem is not with Quarto, as I can also reproduce in raw LaTeX. Instead, I think the problem's the following. As
multipage
repeats the caption over multiple pages, attaching the label to the caption results in multiple labels being created.If I manually change the output .tex to include a
label={}
argument in thelongtblr
call (instead of using\label{}
inside of the caption argument), then cross-referencing works as expected. Perhaps the issue could be solved with a dedicatedlabel =
argument intt()
, which would resolve to using thelabel={}
argument in themultipage
case? Alternatively,theme_tt()
could parse thett()
object to detach the label from the caption in the .tex output.Many thanks in advance!