How can I make table cross-references work in a bookdown document with all of the output formats pdf, docx, and html? Or maybe more specifically, how can I get table cross-refer
Add tab.cap="Your Caption"
to the knitr chunk options:
```{r, test03, echo = FALSE, eval = !knitr::is_latex_output(), tab.cap="My flextable caption!"}
mtcars %>%
head() %>%
flextable() %>%
autofit()
```
Reference to Table \@ref(tab:test03).
See here for more table caption options.
This also adds numbers to tables correctly. If you want your table captions to be in a format designated in your reference document like "Table Caption" or "Caption", you can specify tab.cap.style = "Table Caption"
.