2016-04-28 17 views
2

私はRmarkdownとknitrを使って書いている補足資料に挿入したい非常に大きな系統樹を持っています。私はページ間でツリーを分割することを嫌い、とにかく誰もがこれを印刷するのではないかと疑うので、私が生成しているpdfの真ん中に大きなページがあると思った。Rmarkdown文書内のページサイズを変更する

それ以外のA4文書では1ページのページサイズをどのように変更するのですか?私はknitrには新しく、グローバルな用紙サイズのオプションを見つけましたが、Wordのセクションに相当するものを設定する方法を見つけるのには苦労しています。

(更新)他に誰かが提案していますか?私はpdfpagesパッケージを試しましたが、これはページに同じくらい小さい数字が貼り付けられているpdfのサイズになります。つまり、20インチのPDFファイルを作成して\ includepdfを使用してページを貼り付けると、 20inページではるかに小さい数字で(20ページの上記のejectコマンドと同じです)。 knitrのように見えるか、Latexはページサイズに関係なくグラフィックスに特定のサイズを強制します。何か案は?ここで再現可能な例を示します。

--- 
title: "Test" 
output: 
    pdf_document: 
     latex_engine: xelatex 
header-includes: 
- \usepackage{pdfpages} 
--- 

```{r setup, include=FALSE} 
require(knitr) 
knitr::opts_chunk$set(echo = FALSE, 
         warning=FALSE, 
         message=FALSE, 
         dev = 'pdf', 
         fig.align='center') 
``` 

```{r mtcars, echo=FALSE} 
library(ggplot2) 
pdf("myplot.pdf", width=20, height=20) 
ggplot(mtcars, aes(mpg, wt)) + geom_point() 
dev.off() 
``` 

#Here's some text on a normal page, the following page is bigger but has a tiny figure. 

\newpage 

\includepdf[fitpaper=true]{myplot.pdf} 

答えて

3

あなたはこのよう\ejectpageを使用することができるはずです。

--- 
output: pdf_document 
--- 
```{r setup, include=FALSE} 
knitr::opts_chunk$set(echo = TRUE) 
``` 

## R Markdown 

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>. 

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this: 

```{r cars} 
summary(cars) 
``` 

## Including Plots 

You can also embed plots, for example: 

```{r pressure, echo=FALSE} 
plot(pressure) 
``` 

Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot. 

\eject \pdfpagewidth=20in \pdfpageheight=20in 
```{r mtcars} 
library(ggplot2) 

ggplot(mtcars, aes(mpg, wt)) + geom_point() 
``` 
\eject \pdfpagewidth=210mm \pdfpageheight=297mm 

Back 

(私はいくつかの理由でミリメートルでA4の高さを思い出すことができます)

enter image description here

+0

実際にこれを見ていると、チャンクオプションを変更しても、新しいページサイズを埋めることができません。検索する内容を知ったので、これだけではないようです... http://tex.stackexchange.com/questions/306447/draw-with-pstricks-on-a-large- paper-size Rを使って図を適切なサイズのPDFに書き込んで、ページを貼り付ける必要があるかもしれないと思います。 – JimmyK

+0

argh!謝罪します。私はこれが簡単だと思った(私はよく知っているべきだった...これは結局ラテックスです)。 – hrbrmstr

関連する問題