How can I change paper size when using Knit PDF in RStudio?

前端 未结 2 1891

By default the PDF documents created by the Knit PDF are US Letter size. Instead I would like to create A4 size documents. I have a feeling this should simple to change, eit

相关标签:
2条回答
  • 2020-12-28 15:27

    At least in newer versions of the rmarkdown R package (and Pandoc) you can just set:

    ---
    output: pdf_document
    papersize: a4
    ---
    
    0 讨论(0)
  • 2020-12-28 15:33

    OK, so I figured it out. In the .Rmd file's header, options documentclass and classoption get written into the preamble of the resulting .tex file. The article document class accepts a number of paper size options including a4paper. The header in the .Rmd file will then look something like this:

    ---
    title: "Title"
    author: "Name"
    date: "Date"
    output:
      pdf_document
    documentclass: article
    classoption: a4paper
    ---
    

    For more information see: http://rmarkdown.rstudio.com/pdf_document_format.html

    0 讨论(0)
提交回复
热议问题