使用R markdown为每个页面(包括第一!)创建页脚
问题描述:
我想在问题中添加创建一个使用R markdown的每个页面的页脚:除了以下所有页面之外,我该如何在文档的第一页上执行此操作?
I'd like to add to the question Creating a footer for every page using R markdown: how do I do this for the first page of the document in addition to all the following pages?
在RStudio中,此代码:
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]
在pg1的底部产生这个:
Produces this at the bottom of pg1:
,而它在pg2的底部(奇怪的是,由于\fancyfoot[LE,RO]{\thepage}
,它不应该在左边吗?)
and this (oddly, shouldn't this go on the left because of the \fancyfoot[LE,RO]{\thepage}
?) at the bottom of pg2:
这是在pg3的底部:
答
使用
---
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]
应该覆盖plain
页面样式-在第一页上使用发行\maketitle
-与fancy
等价.
which should override the plain
page style - used on the first page with an issue of \maketitle
- to be equivalent to fancy
.