How can I suppress header text from showing up in Quarto?

148 Views Asked by At

In my YAML I have it so that the header will get displayed in the top right of the page. How could I make it so that the header in the quarto text will not show up?

\newpage

# Overall Results

This is an example of how I insert the header on the source code.

This is my YAML:

---
title: |
  ![](myimage.png){width=1in}\linebreak
  Title\linebreak\linebreak
  ![](image.png){width=4in}\linebreak\linebreak
  `r Company`\linebreak
subtitle: |
    Quarter Year
format:
  pdf:
    documentclass: scrartcl
    latex_engine: xelatex  
    fig_caption: yes
    fig_crop: no
    fig_width: 6
    fig_height: 4
    number_sections: no
    toc: false
    latex_engine: xelatex
    header-includes:
      - "\\usepackage{fancyhdr}"
      - "\\pagestyle{fancy}"
      - "\\usepackage{fontspec}"
      - "\\newfontfamily\\tfont{Montserrat}"
      - "\\setkomafont{pageheadfoot}{\\tfont}"
      - "\\addtokomafont{disposition}{\\tfont}"  
      - "\\usepackage[left=1in, top=1in, right=1in, bottom=1.0in, headheight=2cm, headsep=0.5cm]{geometry}"
      - "\\fancyheadoffset[R]{1cm}"  
      - "\\fancyfoot[L]{\\includegraphics[width=0.5in]{my_image.png}}"
      - "\\fancyfoot[R]{Company}"
      - "\\renewcommand\\headrulewidth{0pt}"
fontsize: 14pt
mainfont: Myriad Pro
---

In the outputted pdf I am trying to eliminate the redundancy of having the headers show up at the top right of each page through the YAML code and then the headers also showing up at the top left through the output of the quarto text. I would like to suppress the quarto text but obviously I cannot delete them as then the header YAML code would not know what the headers are.

1

There are 1 best solutions below

0
On

This is not a particularly elegant solution, but if you know you will only be exporting to LaTeX and won't be using a table of contents, you can use the following raw LaTeX commands after your YAML.

\newpage

\sectionmark{Overall Results}

This is text to be shown on the page to demonstrate the existence of the header

I gleamed this strategy of creating sections without actually creating the header from this question and solution. You can use that \sectionmark{} to tell fancyhdr what section you are in for each page.

enter image description here

If you wanted to use a table of contents in the future, you'd have to have to add this additional line of LaTeX below the section mark command.

\addcontentsline{toc}{section}{Overall Results}