I'd like to create a PDF using rmarkdown that is A3 (or 11x17, ideally) and in landscape orientation. I can get it to do one or the other by specifying options in the YAML header, but not both at the same time. Here's my best attempt - the classoption values each work individually, but not together:
---
title: "Test"
output:
pdf_document:
toc: true
number_sections: true
documentclass: article
classoption:
landscape
a3paper
---
This question is related, but doesn't have the answer in this case. Thanks in advance for any help you can provide!
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.
Having saved your R Markdown file, it's time to process it and generate a PDF file. You can do this by clicking the Knit PDF button above the text. Your PDF file will be generated and opened as shown below.
When you press “Knit to PDF” in RStudio, it converts your R Markdown document into LaTeX. Download MiKTeX from here: https://miktex.org/download • Run the installer, and restart your computer. Open an R Markdown file in RStudio, and try knitting to PDF. You may be prompted to install some packages.
The following sections dive into the three components of an R Markdown document in more details: the markdown text, the code chunks, and the YAML header.
It doesn't seem to be documented, but you can include more than one classoption
by separating the options with commas or by using a bulleted list with hyphens. Either of the following will work:
---
title: "Test"
output:
pdf_document:
toc: true
number_sections: true
documentclass: article
classoption:
- landscape
- a3paper
---
---
title: "Test"
output:
pdf_document:
toc: true
number_sections: true
documentclass: article
classoption: landscape, a3paper
---
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