-
Notifications
You must be signed in to change notification settings - Fork 1
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
Table captions cause LaTeX compiling failure #10
Comments
Seems like its related to the underscores in the caption. Are you trying to italicize these words? What happens if you use two asterisks instead (e.g., If this doesn't fix things, my suggestion would be to use LaTeX syntax for italicizing. |
The underscores indeed seem to be the issue. Unfortunately for whatever reason, the asterisks don't render as italics but rather as, e.g., If I try to use LaTeX syntax, I get the following error:
|
Try adding |
You may also need to add some extra backslashes, because R and backslashes don't play nicely together. |
No luck on either case. |
This example works for me: table1 <- tibble::tibble(Taxon = c("_Panthera tigris_", "_Panthera leo_", "_Panthera tigris altaica_",
"_Panthera tigris jacksoni_", "_Panthera tigris sumatrae_",
"_Panthera tigris tigris_", "_Panthera leo krugeri_", "_Panthera leo leo_",
"_Panthera leo massaica_", "_Panthera leo melanochaita_",
"_Panthera leo persica_", "_Panthera leo senegalensis_"),
Origin = c("wild", "wild",
"captive", "captive", "captive", "captive",
"captive", "captive", "captive", "captive", "captive", "captive"))
table1 |>
mutate(
Taxon = str_remove_all(Taxon, '_'),
Taxon = paste0('\\textit{', Taxon, '}')
) |>
knitr::kable(
caption = "Sample sizes of observational data for \\textit{Panthera tigris} and \\textit{Panthera leo}",
escape = FALSE) |
I had to trim down the data because I didn't have access to some required objects for the full data set. But this hopefully will provide some guidance. |
Alright, I'm having a new issue now!
When I try to render, I get the following error:
This is one of the code blocks that throws this error:
I'm also attaching the log file here.
Reynolds_Ashley_R_2023_PhD_thesis.log
If I render the Rmd file outside of the thesis project, the table code blocks run and render just fine, so it seems to be an issue with bookdown/torontodown. I know of this issue and have tried the fixes there, to no avail.
(Not related to the error, but how would I go about removing the chapter title or using an abbreviated title in the header? Most of my chapter titles are too long to fit in the header space, so it looks ugly as of right now)
The text was updated successfully, but these errors were encountered: