如何在R降价bookdown中添加子图

问题描述

我正尝试在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") 
```

我得到以下结果

enter image description here

然后我尝试如下添加子标题(“ imagen a”,“ imagen b”)

```{r  echo=F,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.

如何正确添加子标题?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)