R Markdown PDF and fancyhdr, how to add header and footer

Viewed 377

I have tried for several days to modify a Rmarkdown PDF file to have both header and footer, also with two logos in the header, However, I just get errors consistently.

the Rmd file with only a yaml header. Only the header is created, with only one logo, and the footer is not created. I would be grateful if I can get some help with this issue.

---
title: "PDF Outpuf File"
output: 
  pdf_document:
    includes:
      in_header: header.tex
    keep_tex: true
---

the header.tex with the following text, in a separate file

\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{eurosym} 
\usepackage{booktabs,xcolor}
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[C]{Google Confidential - \url{www.google.com}}
\fancypagestyle{plain}{\pagestyle{fancy}}
\addtolength{\headheight}{2.0cm}
\lhead{Google - Google PD - \today}
\rhead{\includegraphics[width=4cm]{logo1.png}{logo1.png}}

As you can see here only the header is created

0 Answers
Related