SBH
July 22, 2019, 3:58pm
1
Hi everyone,
I'd like to insert a knitr::kable table into a bookdown document that I'm rendering to pdf_book
. However, it appears that the *asterisk* and _underscore_ markdown methods for italicizing text aren't respected during the render.
Here's my example:
---
title: "test"
output:
bookdown::pdf_book:
keep_tex: yes
---
knitr::opts_chunk$set(echo = TRUE)
df <- data.frame(Standard = "This is standard",
Italics = "*This piece* should be in italics")
knitr::kable(
df, booktabs = TRUE,
caption = 'Testing italics using kable'
)
Here's the output:
joels
July 22, 2019, 4:11pm
2
You can get the markdown italic tags interpreted properly by adding format="markdown"
as an argument to kable
.
knitr::kable(
df, format="markdown",
booktabs = TRUE,
caption = 'Testing italics using kable'
)
Another option would be to use latex markup instead. That also requires adding the escape=FALSE
argument to kable
.
df <- data.frame(Standard = "This is standard",
Italics = "\\emph{This piece} should be in italics")
knitr::kable(
df, booktabs = TRUE, escape=FALSE,
caption = 'Testing italics using kable'
)
1 Like
system
Closed
July 29, 2019, 5:03pm
4
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.