Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why my pdf r markdown headings are showing up in page header

I am going include a logo in the header part of all my pdf pages.
I have a table of contents in my document as well.
Now when I add commands below I get what I want about the logo, however I also get the #headings in the header parts too. Howcan I avoid showing the heading inside header?

---
title: "my title"
output:
  pdf_document:
    latex_engine: xelatex
    toc: true 
    toc_depth: 4 
    fig_caption: true

header-includes:
  - \usepackage{fancyhdr}
  - \usepackage{multicol}
  - \usepackage{xcolor}
  - \usepackage{graphicx}
  - \usepackage{lscape}
  - \renewcommand{\familydefault}{\sfdefault}
  - \usepackage[debrief, save]{silence} 
  - \WarningFilter{fancyhdr}{\headheight is too small}
  - \WarningFilter{fancyhdr}{\footskip is too small}
  - \usepackage{floatrow}
  - \floatsetup[figure]{capposition=top}
  - \floatsetup[table]{capposition=top}
  - \usepackage{fontspec}
---
\addtolength{\headheight}{1.0cm} 
\pagestyle{fancyplain} 
\lhead{\includegraphics[height=1.2cm]{C:/Path/to/logo/mylogo.png}} 
\renewcommand{\headrulewidth}{0pt}


```{r setup, include=FALSE}
knitr::opts_chunk$set(
    echo = FALSE,
    message = FALSE,
    warning = FALSE
)
```

\newpage

# Cats

cat cat cat

\newpage

# Dogs
 dog dog dog

\newpage

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

To remove the headers title from the header, you can use \fancyhead[RO,RE]{}.

---
title: "my title"
output:
  pdf_document:
    latex_engine: xelatex
    toc: true 
    toc_depth: 4 
    fig_caption: true

header-includes:
  - \usepackage{fancyhdr}
  - \usepackage{multicol}
  - \usepackage{xcolor}
  - \usepackage{graphicx}
  - \usepackage{lscape}
  - \renewcommand{\familydefault}{\sfdefault}
  - \usepackage[debrief, save]{silence} 
  - \WarningFilter{fancyhdr}{\headheight is too small}
  - \WarningFilter{fancyhdr}{\footskip is too small}
  - \usepackage{floatrow}
  - \floatsetup[figure]{capposition=top}
  - \floatsetup[table]{capposition=top}
  - \usepackage{fontspec}
---

\addtolength{\headheight}{1.0cm} 
\pagestyle{fancyplain} 
\lhead{\includegraphics[height=1.2cm]{posit-logo.png}}
\fancyhead[RO,RE]{}
\renewcommand{\headrulewidth}{0pt}


```{r setup, include=FALSE}
knitr::opts_chunk$set(
    echo = FALSE,
    message = FALSE,
    warning = FALSE
)
```

\newpage

# Cats

cat cat cat

\newpage

# Dogs
 dog dog dog

\newpage

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading