title: rmarkdown to pdf: image in headers x margin
body: <p>I am new to markdown and want to produce pdf files with the university (and other) logo on each page. I tried to use fancyheadings, and I have a problem:</p>
  
  <p>Putting the image in the headings works only if I call the image in the document, otherwise the pdf is not produced</p>
  
  <p>NB: I also had to set the heading height otherwise the page 2 would not work with - \setlength{\headheight}{2.4 cm}. </p>
  
  <p>Any suggestions were the problem is?
  (using knit in Rstudio, all freshly installed)</p>
  
  <pre><code>    ---
  title: "Test"
  author: "Author Name"
  header-includes:
  - \usepackage{fancyhdr}
  - \usepackage{lipsum}
  - \pagestyle{fancy}
  - \rhead {\includegraphics{pictures/headers.pdf}}
  - \fancyfoot[CO,CE]{}
  - \setlength{\headheight}{2.4 cm}
  - \fancyfoot[LE,RO]{\thepage}
  geometry: top=2cm, bottom=3cm
  output: pdf_document
  abstract: This is a pandoc test . . .
  ---
  
  \lipsum[1-20]
  ![](./pictures/headers.pdf)
  this line needed or it doesnot make an output ???
  
  \cleardoublepage
  This is an R Markdown document. 
  </code></pre>