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)
如果您愿意在 RMD 文件中使用一些裸露的 LaTeX,那么可以使用geometry包轻松实现这一点。newgeometry只需在包含封面之前和之后定义 a restoregeometry(读起来几乎像英语 \xe2\x80\xa6)。
---\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!\nRun Code Online (Sandbox Code Playgroud)\n\n使用 chunk 选项results="asis"并cat()打印原始 LaTeX 并使用额外的反斜杠转义反斜杠非常重要。
| 归档时间: |
|
| 查看次数: |
2033 次 |
| 最近记录: |