Create a footer for every page (including the first!) Using R markdown
I would like to add to the question Create a footer for each page using markdown R : how to do this for the first page of the document in addition to all the following pages?
In RStudio this code:
---
title: "Test"
author: "Author Name"
header-includes:
- \usepackage{fancyhdr}
- \usepackage{lipsum}
- \pagestyle{fancy}
- \fancyhead[CO,CE]{This is fancy header}
- \fancyfoot[CO,CE]{And this is a fancy footer}
- \fancyfoot[LE,RO]{\thepage}
output: pdf_document
---
\lipsum[1-30]
Produces this at the bottom of pg1:
and this (oddly enough, it shouldn't go from the left because of \fancyfoot[LE,RO]{\thepage}
?) at the bottom of pg2:
and this is at the bottom of pg3:
+3
source to share
1 answer
Using
---
title: "Test"
author: "Author Name"
header-includes:
- \usepackage{fancyhdr}
- \usepackage{lipsum}
- \pagestyle{fancy}
- \fancyhead[CO,CE]{This is fancy header}
- \fancyfoot[CO,CE]{And this is a fancy footer}
- \fancyfoot[LE,RO]{\thepage}
- \fancypagestyle{plain}{\pagestyle{fancy}}
output: pdf_document
---
\lipsum[1-30]
which should override the page style plain
- used on the first page with the problem \maketitle
- for the equivalent fancy
.
+4
source to share