In RStudio I'm trying to use rmarkdown in conjunction with bookdown (mostly for the capabilitites to reference tables and figures) and am running into trouble with the formatting in tables and captions. Please consider the following example:
---
title: "Test"
knit: "bookdown::render_book"
output:
bookdown::pdf_book:
keep_tex: yes
link-citations: true
references:
- type: article-journal
id: WatsonCrick1953
author:
- family: Watson
given: J. D.
- family: Crick
given: F. H. C.
issued:
1953
title: 'Molecular structure of nucleic acids: a structure for deoxyribose
nucleic acid'
container-title: Nature
volume: 171
issue: 4356
page: 737-738
---
```{r setup, include=FALSE}
library(knitr)
opts_chunk$set(echo = TRUE)
```
@WatsonCrick1953
```{r test-table, tidy=FALSE, echo = FALSE}
kable(
data.frame(
Citation = c("@WatsonCrick1953"),
Formatted.String = c("Some--Thing^2^")),
caption = "*Bold* in a caption;"#, booktabs = TRUE
)
```
A detail of the resulting product is:
This has multiple issues:
- "Bold" in the caption isn't rmarkdown formatted
- "^2^" does not produce the expected superscripting (particularly strange, as "--" is understood as en-dash)
- The citation is not understood within the table (in the text, above the table code, it works just fine but is not included in the screen shot)
A further issue is that the currently produced latex does not produce a reference to the "booktabs" package, which is presumably needed to properly use the "booktabs = TRUE" argument to kable (which comes directly from the booktabs documentation and thus ought to work).
Please let me know how I may achieve what I am trying ...
Joh