knitr:在 Markdown 中使用带有 fig.cap 的下标

knitr: Using subscript with fig.cap in Markdown

如何在使用 {r fig.cap=""} 时在图形标题中包含下标?

模拟 .Rmd 文件:

---
output:
  pdf_document:
    fig_caption: yes
---

```{r setup, include = FALSE}
library(knitr)
```{r fig.cap = "CO2 Concentration", echo = FALSE}
plot(rnorm(100))

我想在下标中得到 CO2 中的 2。 fig.cap 是最好的方法还是更好的方法?

您可以使用标准 Markdown syntax

---
output:
  pdf_document:
    fig_caption: yes
---

This is ^superscript^  
This is ~subscript~

```{r fig.cap = 'CO~2~ Concentration', echo = FALSE}
plot(rnorm(100))
```