[英]How can I change paper size when using Knit PDF in RStudio?
By default the PDF documents created by the Knit PDF are US Letter size.默认情况下,Knit PDF 创建的 PDF 文档为 US Letter 大小。 Instead I would like to create A4 size documents.
相反,我想创建 A4 大小的文档。 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.
我觉得这应该很容易改变,无论是在 RStudio GUI 中还是通过向 Rmd 文件顶部的元数据添加一个选项。 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?
有没有办法指定纸张大小,最好在 Rmd 文件本身内? I am still using RStudio version 0.98.953 but can upgrade if it would help.
我仍在使用 RStudio 0.98.953 版,但如果有帮助,可以升级。
I'd be grateful if someone could point me in the right direction.如果有人能指出我正确的方向,我将不胜感激。
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.在 .Rmd 文件的标题中,选项
documentclass
和classoption
被写入生成的 .tex 文件的序言中。 The article
document class accepts a number of paper size options including a4paper
. article
文档类接受许多纸张大小选项,包括a4paper
。 The header in the .Rmd file will then look something like this: .Rmd 文件中的标题将如下所示:
---
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有关更多信息,请参阅: http : //rmarkdown.rstudio.com/pdf_document_format.html
At least in newer versions of the rmarkdown
R package (and Pandoc) you can just set:至少在较新版本的
rmarkdown
R 包(和 Pandoc)中,您可以设置:
---
output: pdf_document
papersize: a4
---
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.