使用R markdown为每个页面(包括第一个!)创建页脚

low*_*rul 5 latex yaml pandoc rstudio r-markdown

我想添加问题使用R markdown为每个页面创建页脚:除了以下所有页面之外,我如何为文档的第一页执行此操作?

在RStudio中,这段代码:

---
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]
Run Code Online (Sandbox Code Playgroud)

在pg1的底部生成这个:

PG1

这个(奇怪的是,这不应该在左边因为\fancyfoot[LE,RO]{\thepage}?)在pg2的底部:

PG2

这在pg3的底部:

PG3

Wer*_*ner 5

使用

---
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]
Run Code Online (Sandbox Code Playgroud)

这应该覆盖plain页面样式 - 在第一页上使用 - 的问题\maketitle相当于fancy.