-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Latex caption + cross-referencing in bookdown #1800
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
Co-authored-by: olivroy <[email protected]>
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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.R
which 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_captions
as it is not compatible withtbl-cap
. This is not an issue with HTML in quarto; however,tbl-cap
should still be used for cross-referencing.