简体   繁体   中英

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. From my understanding, RStudio runs behind the scenes:

  • pdflatex
  • bibtex (if you have natbib going on)
  • pdflatex

I would like to be able to pass some parameters like "-quiet" or "-interaction=nonstopmode"

在此处输入图片说明

From the command line, these are possible.

How do I add custom flags to the RStudio implementation of pdflatex?

You don't say, but I'll assume you're working in R Markdown. For R Markdown, RStudio gets pandoc to call 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 . To do this in an RMarkdown document, you put this in the header:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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