Daniel_D Daniel_D - 2 months ago 39
R Question

Insert a logo in upper right corner of R markdown pdf document

I am getting started with R markdown and I would like to create a new report having our company image

logo.png
in the upper right corner of each page.

Is there a way to code this in the YAML section or need this to be done in a R chunk section?

Answer

Ok, I have found the solution:

---
title:
header-includes: 
   \usepackage{graphicx}
   \usepackage{fancyhdr}
   \pagestyle{fancy}
   \setlength\headheight{28pt}
   \fancyhead[L]{\includegraphics[width=5cm]{GPIM_Logo_300x85.png}}
   \fancyfoot[LE,RO]{GPIM}
output: pdf_document
---
Comments