Sal
Sal

Reputation: 117

Reduce top margin when creating PDF from Rmarkdown using knitr

I'm creating a PDF document using knitr and Rmarkdown but the logo-and-title are far from the top of the document.

How to reduce the top margin on the first page ? Many thanks in advance.

This is my code:

---
title: "Title come here (there is a logo before the title)"

output:
  pdf_document:
header-includes:
  - \usepackage{titling}
  - \pretitle{\begin{center}
  -  \includegraphics[width=1.5in,height=1.5in]{logo.png}\LARGE\\}

---

Upvotes: 0

Views: 1123

Answers (1)

Sal
Sal

Reputation: 117

I found a solution that works (not sure if it's a "clean" solution, but it does the job): I added a negative value in - \setlength{\droptitle}{-1.1in}

---
title: "\\vspace{0.5in} Title here"

output:
  pdf_document:
header-includes:
  - \usepackage{titling}
  - \setlength{\droptitle}{-1.1in}
  - \pretitle{\begin{center}
  -  \includegraphics[height=1.5in]{logo.png}\LARGE\\}
---

Upvotes: 2

Related Questions