简体   繁体   English

使用 R,RStudio Knit to PDF,如何将自定义标志传递给“pdflatex”命令,例如 -interaction=nonstopmode

[英]Using R, RStudio Knit to PDF, how to pass custom flags to the "pdflatex" command such as -interaction=nonstopmode

I am coming to RStudio from the CMD prompt and the pdflatex command.我从 CMD 提示符和 pdflatex 命令来到 RStudio。 From my understanding, RStudio runs behind the scenes:据我了解,RStudio 在幕后运行:

  • pdflatex pdflatex
  • bibtex (if you have natbib going on) bibtex(如果你有 natbib)
  • pdflatex pdflatex

I would like to be able to pass some parameters like "-quiet" or "-interaction=nonstopmode"我希望能够传递一些参数,如“-quiet”或“-interaction=nonstopmode”

在此处输入图片说明

From the command line, these are possible.从命令行,这些都是可能的。

How do I add custom flags to the RStudio implementation of pdflatex?如何将自定义标志添加到 pdflatex 的 RStudio 实现?

You don't say, but I'll assume you're working in R Markdown.你没有说,但我会假设你在 R Markdown 中工作。 For R Markdown, RStudio gets pandoc to call pdflatex .对于 R Markdown,RStudio 让pandoc调用pdflatex From the Pandoc manual, you want to set the Pandoc option --pdf-engine-opt : see https://pandoc.org/MANUAL.html#option--pdf-engine-opt .从 Pandoc 手册中,您想设置 Pandoc 选项--pdf-engine-opt :请参阅https://pandoc.org/MANUAL.html#option--pdf-engine-opt To do this in an RMarkdown document, you put this in the header:要在 RMarkdown 文档中执行此操作,请将其放在标题中:

output:
  pdf_document:
    pandoc_args:  "--pdf-engine-opt=-quiet"

If you want multiple arguments I think you can just include them in the string, but you might need to do it like this:如果您想要多个参数,我认为您可以将它们包含在字符串中,但您可能需要这样做:

output:
  pdf_document:
    pandoc_args:  ["--pdf-engine-opt=-quiet",
                   "--pdf-engine-opt=-interaction=nonstopmode"]

You'll have to try it to see which works for you;你必须尝试一下,看看哪个适合你; both are accepted, but I couldn't tell if they were both being acted on.两者都被接受,但我不知道它们是否都被执行了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM