[英]Reduce top margin when creating PDF from Rmarkdown using knitr
[英]Reduce title margins when creating PDF from Rmarkdown using knitr
我正在使用 knitr + Rmarkdown 创建 PDF 文档。 我在 yaml 标头中设置了geometry: margin=0.1in
。 此页边距适用于文档的正文,但标题距离文档顶部很远,正文也是如此。 这是一个截图:
这是在屏幕截图中创建文档的 Rmd 代码:
---
title: "test"
output:
pdf_document:
latex_engine: xelatex
geometry: margin=0.1in
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
a bunch of text to demonstrate that the margin applies only to the body text of
this document, while the title (above) remains quite far from the top of the
document, and this is messing up my plan to make a document that's only one page
in length
我需要这份文件有一页的长度。 标题的巨大利润搞砸了。 如何减少标题、文档顶部和正文之间的空白?
注:由于原因,我这里只能使用xelatex乳胶引擎。
使用 LaTeX 代码,您可以:
使用\vspace{-1cm}
减少标题和文本之间的空间
使用 YAML title
中的相同代码减少上边距
这是你的例子:
---
title: \vspace{-1.5cm} test
output:
pdf_document:
latex_engine: xelatex
geometry: margin = 0.1in
---
\vspace{-1cm}
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
a bunch of text to demonstrate that the margin applies only to the body text of
this document, while the title (above) remains quite far from the top of the
document, and this is messing up my plan to make a document that's only one page in length
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.