问题
I am creating an R Markdown report and can´t find a way to move my title down the page.
Here is a minimal example, where I would like to move the title down 5cm:
---
title: "This is my title to display at 5cm below the top"
output:
pdf_document:
includes:
in_header: header.tex
---
\thispagestyle{titlepage}
The header.tex
file include some custom styling:
\usepackage{fancyhdr}
\fancypagestyle{titlepage}{
\fancyfoot[LE,RO]{\thepage\ of \pageref{LastPage}}
\fancyfoot[LE,LO]{Project}
\fancyhead[L]{\includegraphics[width=4cm]{logo.png}}
}
Output:
Note that I´m not talking about the margins, just want to move the title so that it is not always at the top of the page.
回答1:
Another option would be to use the titling
LaTeX package which makes it easy to change the styles of the titles. I have included some customisation inline within the header-includes
argument of the YAML:
---
title: "This is my title to display at 5cm below the top"
output: pdf_document
header-includes:
- \usepackage{titling}
- \setlength{\droptitle}{5em}
---
# Content
And then something here...
\newpage
# Next Page
Some more text
Including the LaTeX commands in the YAML is generally okay for small edits like this, but if you want to make further customisations I would recommend keeping them in an a separate
.tex
file as explained in the R Markdown Definitive Guide
回答2:
This will do the trick:
\setlength{\headsep}{5cm}
\thispagestyle{title page}
来源:https://stackoverflow.com/questions/34950851/adjusting-r-markdown-title-position-in-pdf-output