I'm using \newpage
to force my figures to be in the right spot.
I have added \newpage
after the figure chunk. However, the figure caption is ignored when rendering the PDF.
I have tried fig.pos
to force my figures, but it didn't work. I've also tried \clearpage
and \pagebreak
. None of them seem to work. Any idea what I'm doing wrong, or what I need to add to make it work?
Here's an example:
```{r eg, fig.width=4, fig.height=6, echo=FALSE, fig.pos="!H", fig.cap="\\label{fig:eg}Plot example", dev='png'}
plot(c(1:20))
```
\newpage
some text some text
some other figure (with proper caption)
some text
In the PDF version after using the figure label, I only see Figure?? as the caption.