使用R markdown为每个页面(包括第一!)创建页脚 [英] Creating a footer for every page (including first!) using R markdown

查看:567
本文介绍了使用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.

这篇关于使用R markdown为每个页面(包括第一!)创建页脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆