Insert logo in upper left corner of Rmakrdown output

I am currently compiling a pdf output from Rmarkdown and have run into a problem of how to insert the header on first page only. I have gotten the following YAML from this website to get the headers but now I'm stuck on how to keep it for first page only.

---
title: My Title
output: pdf_document
header-includes:
  \usepackage{fancyhdr}
  \pagestyle{fancy}
  \fancyhf{}
  \addtolength{\headheight}{1.0cm}
  \rhead{My Department} \lhead{\includegraphics[width=2cm]{logo.png}} 
  \rfoot{\thepage} 
  \renewcommand{\headrulewidth}{1pt}
  \fancypagestyle{plain}{\pagestyle{fancy}} 
---

I dont need any header for other pages. There are some answers on this website for first page headers only but they put the logo in title and the document does not look good as I need logo in header not just above title.

You could try to change the standard (pandoc?) template. I recently changed computers, so I have no example readily available.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.