I am having trouble generating \label{} for plots when using knitr to go from a *.Rmd file to a *.md file via knitr; and then converting to *.pdf via pandoc.
An MWE for my *.Rmdis included below:
```{r Setup, include=FALSE, results="hide", warning=FALSE}
opts_chunk$set(dev="cairo_pdf", fig.lp="fig:", echo=FALSE, results="hide",
message=FALSE, warning=FALSE)
```
```{r mwe-plot, fig.cap = "MWE plot."}
library(ggplot2)
ggplot(mtcars, aes(factor(cyl))) +
geom_bar()
```
I knit:
knit("mwe.Rmd")
Then I use pandoc
pandoc -o mwe.pdf mwe.md
I should be able to cross-reference the plot with Figure \ref{fig:mwe-plot} in my *.Rmd source. But it seems that the \label{fig:mwe-plot} hasn't been created in mwe.tex if I run:
pandoc -o mwe.pdf mwe.md
Thank you!