I type a report with Rmarkdown in Rstudio. When converting it in html
with knitr, there is also a markdown
file produced by knitr. I convert this file with pandoc
as follows :
pandoc -f markdown -t docx input.md -o output.docx
The output.docx
file is nice except for one problem: the sizes of the figures are altered, I need to manually resize the figures in Word. Is there something to do, maybe an option with pandoc
, to get the right figures sizes ?
An easy way consists in including a scale factor k
in the individual chunk options:
{r, fig.width=8*k, fig.height=6*k}
and a variable dpi
in the global chunk options:
opts_chunk$set(dpi = dpi)
Then you can set the values of dpi
and k
before knitting the Rmd
file in the global environment:
dpi <<- 96
k <<- 1
or you can set them in a chunk in the Rmd
file (set k
in the first chunk for example).