I'm converting a markdown document to a PDF using Pandoc from within R. The default margins of PDFs outputted by Pandoc are too large.
In this post: Set margin size when converting from Markdown to PDF with pandoc, the following code is given to alter margin widths of PDFs:
pandoc -V geometry:margin=1in -o output.pdf input.md
I've using this code in a function from within R,
makePDF <- function(name) {
library(knitr)
knit(paste0(name, ".Rmd"), encoding = "utf-8")
system(paste0("pandoc -o -V geometry:margin=1in ", name, ".pdf ", name, ".md"))
}
but this gives this error:
pandoc: geometry:margin=1inmpAnnual.pdf: openFile: does not exist (No such file or directory)
How can I create a function in R to alter margin widths of PDFs?