knitr kable和“*”

时间:2017-11-07 16:33:13

标签: r knitr kable

我正在尝试生成一个表格,其中“*”作为单元格中的值:

---
title: "Untitled"
author: "James Durant"
date: "November 7, 2017"
output: pdf_document
---

```{r arthmatic, echo=FALSE}
library(knitr)
dfx <- data.frame(
  Operator = c("+", "-", "*", "/", "^", "**", "%%", "%/%"),
  Operation = c("addition", "subtraction", "multiplication", 
                "division", "exponentiation", "exponentiation",
                "modulus", "integer division")
  )
kable(dfx, escape = FALSE)
```

但*和**没有出现在表格中: enter image description here

有什么想法吗?

1 个答案:

答案 0 :(得分:3)

将每个*替换为\\text{*}\\textasteriskcentered