我正在使用 R 中的 Pandoc 将 Markdown 文档转换为 PDF。Pandoc 输出的 PDF 的默认边距太大。
在这篇文章中:使用 pandoc 从 Markdown 转换为 PDF 时设置边距大小,给出了以下代码来更改 PDF 的边距宽度:
pandoc -V geometry:margin=1in -o output.pdf input.md
我在 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"))
}
但这给出了这个错误:
pandoc: geometry:margin=1inmpAnnual.pdf: openFile: does not exist (No such file or directory)
如何在 R 中创建一个函数来更改 PDF 的边距宽度?