我正在尝试在 R bookdown 项目中添加带有子标题的图形,如下所示
---
output:
pdf_document:
extra_dependencies: "subfig"
---
```{r echo=F, out.width = "50%",fig.showtext=TRUE,fig.show='hold',fig.cap="TITULO"}
par(mfrow=c(1,2))
knitr::include_graphics("ts_mult.png")
knitr::include_graphics("ts_ad.png")
```
我得到以下结果
然后我尝试添加子标题(“imagen a”,“imagen b”),如下所示
```{r echo=F, out.width = "50%",fig.showtext=TRUE,fig.show='hold',fig.cap="TITULO",fig.subcap=c("imagen a", "imagen b")}
par(mfrow=c(1,2))
knitr::include_graphics("ts_mult.png")
knitr::include_graphics("ts_ad.png")
```
但这不起作用,并引发以下错误
! Undefined control sequence.
<recently read> \subfloat
Error: LaTeX failed to compile Tesis_AE.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips.
如何正确添加子标题?