Quantcast
Channel: Active questions tagged kable - Stack Overflow
Viewing all articles
Browse latest Browse all 108

Including % symbol in table caption of bookdown latex table

$
0
0

I am having trouble including the '%' symbol in the caption of a table produced by the knitr::kable function in a bookdown Rmarkdown document. For example, the following code:

---title: "Test of table caption with percent symbol"output:   bookdown::pdf_document2: default  pdf_document: default---```{r}df = data.frame(id=1:3,names=letters[1:3])knitr::kable(df,caption="This captions has a % symbol",booktabs=TRUE)```

produces the following:

enter image description here

However, if I remove the '%' symbol from the caption or I use pdf_document instead of bookdown::pdf_document2 then the output is formatted correctly.

What is the best solution to be able to include '%' and other symbols special to LaTeX in the figure caption? Also, I need a solution that works for multiple output formats (e.g., DOC and HTML in addition to PDF).


Viewing all articles
Browse latest Browse all 108

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>