2017-08-02 82 views
1

我正在嘗試添加已經在PDF中創建的封頁。在封面頁中更改頁邊空白尺寸

```{r echo=FALSE,out.width='8.27in',out.height='11.69in'} 
knitr::include_graphics('CoverPage.pdf') 
``` 

我想改變第一頁只的邊緣。你能幫我解決這個問題嗎?

下進行嘗試,但它改變了整個文檔的頁邊距:

geometry: "left=3cm,right=3cm,top=2cm,bottom=2cm" 

回答

2

如果你的罰款與您的RMD文件中的一些裸露乳膠,那麼可以很容易地使用geometry package實現。在包含封面之前只需定義一個newgeometry,之後再定義restoregeometry(幾乎像英文一樣)。

--- 
output: 
    pdf_document 
--- 
```{r, echo = FALSE, results = "asis"} 
cat("\\newgeometry{left=3cm,right=3cm,top=2cm,bottom=2cm}") 
knitr::include_graphics("CoverPage.pdf") 
cat("\\restoregeometry") 
``` 

\clearpage 

Note the position of the page number. Restoring the margins was successful! 

它使用塊選項results="asis"cat()打印原料乳膠和一個額外的反斜槓逃脫反斜線是很重要的。