I am using knitr (1.9.5 and 1.9.17) and rmarkdown (0.5.3.1), and would like to hold figure position in the pdf output. The generated pdf file is working fine when chunk opti
The code from Figure position in markdown when converting to PDF with knitr and pandoc helps me, help anyone else find it useful.
---
title: "Example"
author: "Martin"
output: pdf_document
---
```{r}
knitr::knit_hooks$set(plot = function(x, options) {
knitr::hook_plot_tex(x, options)
})
```
```{r myplot, echo=FALSE, results='hide', fig.cap='Test', fig.pos='h'}
library(ggplot2)
ggplot(mtcars, aes(mpg, drat)) + geom_point()
```