I need to format the first page of a pdf output of an R-markdown document. I need the first page to show 1 of X, in the footer. I'm using latex's fancyhdr and lastpage packages, but I can't get this to work in the footer of the first page. I'm only getting 1. But I do get "2 of X", "3 of X" etc in the subsequent pages. How to the change the values in the first page.
date: "`r paste0('Generated on: ',format(Sys.Date(), '%d %B, %Y'))`"
geometry: margin=2cm
output:
pdf_document:
toc: yes
params:
output_params: NA
title: "`r paste0('LCMS Dilution App Report')`"
author: "`r params$output_params$Analysis_Info$Name`"
header-includes:
- \usepackage{lastpage}
- \usepackage{fancyhdr}
- \definecolor{col1}{RGB}{190, 43, 187}
- \fancypagestyle{ttlpage}{\fancyfoot[C]{{\thepage} of \pageref{LastPage}}}
- \thispagestyle{ttlpage}
- \pagestyle{fancy}
- \fancyhead[EL,OL]{\rightmark}
- \fancyhead[EC,OC]{}
- \fancyhead[ER,OR]{LCMS Dilution App}
- \fancyfoot[EL,OL]{\color{col1}{Company Name}}
- \fancyfoot[EC,OC]{\textbf{Company Internal}}
- \fancyfoot[ER,OR]{{\thepage} of \pageref{LastPage}}