I'm creating a PDF document using knitr + Rmarkdown. I've set geometry: margin=0.1in
in the yaml header. This margin applies to the body text of the document, but the title is quite far from the top of the document, as well as the body text. Here's a screenshot:
Here's the Rmd code that created the document in the screenshot:
---
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
I need this document to be one page in length. The title's huge margins are messing that up. How can I reduce the whitespace between the title, the top of the document, and the body text?
Note: For reasons, I can only use the xelatex latex engine here.
Using LaTeX code, you can:
reduce the space between the title and the text with \vspace{-1cm}
reduce the top margin with the same code placed in title
in the YAML
Here's your example:
---
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With