Latex caption + cross-referencing in bookdown#1800
Latex caption + cross-referencing in bookdown#1800rich-iannone merged 16 commits intorstudio:masterfrom
Conversation
olivroy
left a comment
There was a problem hiding this comment.
I am not using bookdown, so can't comment on this, but I made some suggestions in the tests to conform to new test style.
Co-authored-by: olivroy <52606734+olivroy@users.noreply.github.com>
Co-authored-by: olivroy <52606734+olivroy@users.noreply.github.com>
|
Thanks @olivroy. I modified the test to match the new style. |
|
Thanks for working on this and addressing the comments! @rich-iannone I don't have much objection here. If this can help some bookdown users, we may as well go for it! As long as it doesn't break the Quarto workflow which should still be to use |
|
No problem! Yes, it shouldn't break Quarto workflow, as it's disabled in Quarto in the same way as the |
This is a fix for #1610 and #818. This PR adds a caption component to the LaTex outputs and enables cross-referencing in bookdown.
Adding a caption with
tab_caption()results in the following Latex code:
I've updated knitr helper functions in
knitr-utils.Rwhich enables cross-referencing using bookdown. This only works in HTML ifoptions("htmltools.preserve.raw" = FALSE), which was already commented in the code. For the Latex output in Quarto, I've used the functioncheck_quarto()to disable captions created withtab_captionsas it is not compatible withtbl-cap. This is not an issue with HTML in quarto; however,tbl-capshould still be used for cross-referencing.