在 RMarkdown/Bookdown 中为同一块中的两个图提供不同的说明
Giving two plots in the same chunck different captions in RMarkdown/Bookdown
我有一个生成多个图的函数。当我在 chunck 中调用它时,所有地块都有相同的标题。
问题归结为在同一个块中有两个具有不同标题的图。这有可能吗?
---
title: "Testing"
output:
pdf_document:
latex_engine: pdflatex
---
```{r setup, include=FALSE}
```
``` {r, fig.cap="Same Caption"}
plot(cars$speed)
plot(cars)
```
只需将带有两个标题的向量传递给 fig.cap
:
```{r, fig.cap=c("Caption", "Not the same caption")}
plot(cars$speed)
plot(cars)
```
我有一个生成多个图的函数。当我在 chunck 中调用它时,所有地块都有相同的标题。
问题归结为在同一个块中有两个具有不同标题的图。这有可能吗?
---
title: "Testing"
output:
pdf_document:
latex_engine: pdflatex
---
```{r setup, include=FALSE}
```
``` {r, fig.cap="Same Caption"}
plot(cars$speed)
plot(cars)
```
只需将带有两个标题的向量传递给 fig.cap
:
```{r, fig.cap=c("Caption", "Not the same caption")}
plot(cars$speed)
plot(cars)
```