本文介绍了在RStudio中使用Knit PDF时,如何更改纸张尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,由编织PDF"创建的PDF文档为US Letter大小.相反,我想创建A4尺寸的文档.我觉得应该在RStudio GUI中或通过在Rmd文件顶部的元数据中添加一个选项来简单地更改它.不幸的是,我找不到任何说明如何执行此操作.有没有一种方法可以指定纸张尺寸,最好在Rmd文件本身中?我仍在使用RStudio 0.98.953版,但可以升级,如果有帮助的话.

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.

推荐答案

好的,所以我知道了.在.Rmd文件的标题中,选项documentclassclassoption被写入生成的.tex文件的序言中. article文档类接受许多纸张尺寸选项,包括a4paper. .Rmd文件中的标题将如下所示:

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
---

有关更多信息,请参见: http://rmarkdown.rstudio.com/pdf_document_format.html

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

这篇关于在RStudio中使用Knit PDF时,如何更改纸张尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 10:51
查看更多