如何在 R Studio 中更改 pandoc 选项

问题描述:

在 R Studio 中安装包 rmarkdown,您可以使用 Rmd 文件创建 docx 文档并按下 Knit Word 按钮.

Installing package rmarkdown in R Studio you can create docx documents using a Rmd-file and pressing the Knit Word button.

调用的命令是:

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS hallo.utf8.md --to docx --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures
--output hallo.docx --highlight-style tango

问题

如何添加其他选项?我想补充:

How to add other options? I want to add:

--filter ./pandoc-word-pagebreak

获得:

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS hallo.utf8.md --to docx --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --filter ./pandoc-word-pagebreak
    --output hallo.docx --highlight-style tango

你可以在你的 yaml 前端使用 pandoc_args:

You can use pandoc_args in your yaml front matter:

---
title: "Mytitle"
output:
  word_document:
    pandoc_args: [ 
      "--filter", "./pandoc-word-pagebreak" 
    ]
---

查看文档此处