更改封面页边距大小

S.P*_*era 2 pdf latex r knitr r-markdown

我正在尝试添加已在 PDF 中创建的封面页。

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

我只想更改第一页的页边距。你能帮我解决这个问题吗?

尝试了以下方法,但它改变了整个文档的边距:

geometry: "left=3cm,right=3cm,top=2cm,bottom=2cm"
Run Code Online (Sandbox Code Playgroud)

CL.*_*CL. 5

如果您愿意在 RMD 文件中使用一些裸露的 LaTeX,那么可以使用geometry轻松实现这一点。newgeometry只需在包含封面之前和之后定义 a restoregeometry(读起来几乎像英语 \xe2\x80\xa6)。

\n\n
---\noutput:\n  pdf_document\n---\n```{r, echo = FALSE, results = "asis"}\ncat("\\\\newgeometry{left=3cm,right=3cm,top=2cm,bottom=2cm}")\nknitr::include_graphics("CoverPage.pdf")\ncat("\\\\restoregeometry")\n```\n\n\\clearpage\n\nNote the position of the page number. Restoring the margins was successful!\n
Run Code Online (Sandbox Code Playgroud)\n\n

使用 chunk 选项results="asis"cat()打印原始 LaTeX 并使用额外的反斜杠转义反斜杠非常重要。

\n