当我尝试使用 RStudio 中的 RMarkdown 编织pdf时,此代码会产生错误。
如何在 fig.caption 中写一个希腊字母,例如$ \ beta $?
---
title: "Untitled"
author: "SB"
date: "Thursday, January 29, 2015"
output:
pdf_document:
fig_caption: yes
---
```{r var, echo=FALSE, fig.cap="Cars variation rate between year $t$ and $t-1$ for $0 < \beta < 1$"}
plot(cars)
```
答案 0 :(得分:2)
在R中,字符串内的所有反斜杠都需要加倍。 "\\"
变为\
。
试试这个:
---
title: "Untitled"
author: "SB"
date: "Thursday, January 29, 2015"
output:
pdf_document:
fig_caption: yes
---
```{r var, echo=FALSE, fig.cap="Cars variation rate between year $t$ and $t-1$ for $0 < \\beta < 1$"}
plot(cars)
```