I have an Rmd file and want to convert it into a PDF with knitr-pandoc-latex. Here's a small example that works as intended:
---
title: "Minimal Working Example"
author: Author Psaroudakis
date: "August 27th 2018"
output: pdf_document
---
```{r boxplot, dev='pdf'}
boxplot(mtcars$disp ~ mtcars$cyl)
```
that is knitted to:
---
title: "Minimal Working Example"
author: Author Psaroudakis
date: "August 27th 2018"
output: pdf_document
---
```r
boxplot(mtcars$disp ~ mtcars$cyl)
```
![plot of chunk boxplot](figure/boxplot-1.pdf)
which can be easily turned into a PDF with pandoc. But if I want to resize the plot with out.width
, knitr turns it into HTML code, but I want to create a PDF, not a HTML page!
…
```{r boxplot, dev='pdf', out.width='50%'}
boxplot(mtcars$disp ~ mtcars$cyl)
```
is rendered to:
---
title: "Minimal Working Example"
author: Author Psaroudakis
date: "August 27th 2018"
output: pdf_document
---
```r
boxplot(mtcars$disp ~ mtcars$cyl)
```
<embed src="figure/boxplot-1.pdf" title="plot of chunk boxplot" alt="plot of chunk boxplot" width="50%" type="application/pdf" />
Does anybody have a solution for this? I've tried opts_knit$set(out.format="latex");
but it didn't make any difference. Thank you in advance!