I'm trying to add a figure with sub captions in a R bookdown project as follows
---
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")
```
and I get the following result
then I tried to add the subcaptions ("imagen a", "imagen b") as follows
```{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")
```
but that didn't work and it throws the following error
! Undefined control sequence.
<recently read> \subfloat
Error: LaTeX failed to compile Tesis_AE.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips.
How can I correctly add the subcaptions?