6

Is it possible to add an institution and logo to the YAML front matter in R markdown version 2?

I'm looking for something like this

---
title:       "My report"
author:      "me"
institution: "Swansea University"
logo:        "logo.png"
output:
   pdf_document:
   toc: yes
---
Joanne Demmler
  • 1,406
  • 11
  • 31

1 Answers1

1

The answer is to use a template file, but it needs a bit of tweaking for the logo bit:

---
title:       "My report"
author:      "me"
output:
   pdf_document:
   toc: yes
   includes:
     in_header: style.tex
---

Prepare the document "style.tex" in the same folder as your markdown file and make sure you have changed you working directory in R to this folder.

Add the following lines to your "style.tex" file:

\institute{My institute}
\pgfdeclareimage[width=2cm]{logo}{logo.png}
\usebackgroundtemplate{\pgfuseimage{logo}}

Thanks to: Inserting logo into beamer presentation using R Markdown

Community
  • 1
  • 1
Joanne Demmler
  • 1,406
  • 11
  • 31