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, either in the RStudio GUI or by adding an option to the metadata at the top of the Rmd file. Unfortunately I can't find any instructions how to do this. Is there a way to specify paper size, preferably within the Rmd file itself? I am still using RStudio version 0.98.953 but can upgrade if it would help.
I'd be grateful if someone could point me in the right direction.
To transform your markdown file into an HTML, PDF, or Word document, click the “Knit” icon that appears above your file in the scripts editor. A drop down menu will let you select the type of output that you want. When you click the button, rmarkdown will duplicate your text in the new file format.
Better still, RStudio includes a “Knit” button that enables you to render an . Rmd and preview it using a single click or keyboard shortcut.
The format, by default, will be set to HTML, but you can change it to PDF or Word document by clicking on the small arrow beside the Preview button and selecting “Knit to PDF” or “Knit to Word document”. The most powerful feature of R notebook is that it is interactive.
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
At least in newer versions of the rmarkdown
R package (and Pandoc) you can just set:
---
output: pdf_document
papersize: a4
---
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With