0

I'm currently having an issue with latex in Rmarkdown (using fancyhdr package). I am trying to make a data report with a certain template style. This is a screenshot of the pdf at its current stage and as you can see the title "Equity1" (entire page body) is higher up than in the page 2.

Screenshot of PDF

These are the codes on my YAML of Rmarkdown

---
output: 
  pdf_document:
    latex_engine: pdflatex
header-includes:|
  \usepackage{graphicx}
  \usepackage{fancyhdr}
  \pagestyle{fancy}
  \newcommand{\helv}{%
    \fontfamily{phv}\fontseries{b}\fontsize{9}{11}\selectfont}
  \fancyhead[R]{\includegraphics[width=3cm]{logo.png}}
  \fancyhead[L]{\textbf\selectfont\sffamily{Daily Report}}
  \fancyfoot[L]{\textbf\selectfont\sffamily{NOT INTENDED FOR FORWARDING}}
  \renewcommand{\headrulewidth}{0.4pt}
  \renewcommand{\footrulewidth}{0.4pt}
classoption: a4paper
---

And these are in the rest of the codes:


> ## \selectfont\sffamily{EQUITY 1}
> 
> ```{r}
> # content page 1 
> ```  
> \newpage

> ## \selectfont\sffamily{EQUITY 2} 
> ```{r}
> # content page 2 
> ```

I was wondering if I made a mistake in my YAML or in my code later on? (I am using LateX through rMarkdown because I am trying to have it available as a PDF for my output).

Thank you for your help!

  • You will get a warning in the log file about the headheight. Read the warning and act accordingly. – Johannes_B Apr 1 at 5:13
  • @Johannes_B when you mean act according, I was wondering how to code it in Tex. The error code says: Package Fancyhdr Warning: \headheight is too small (12.0pt): Make it at least 32.08571pt. How should I go by creating a headheight of 32pt? – k8a_s Apr 1 at 6:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.