使用R降价为每个页面创建页脚

问题描述:

我正在用R Markdown编写文档,我希望在编织PDF文档时在每页上都包含一个页脚.有人对如何执行此操作有任何想法吗?

I'm writing a document in R Markdown and I'd like it to include a footer on every page when I knit a PDF document. Does anyone have any idea on how to do this?

是的,已经在这里提出并回答了这个问题:

Yes, this question has been asked and answered here: Adding headers and footers using Pandoc. You just need to sneak a little LaTeX into the YAML header of your markdown document.

此markdown标头可实现此目的:

This markdown header does the trick:

---
title: "Test"
author: "Author Name"
header-includes:
- \usepackage{fancyhdr}
- \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
---

可以在适用于Windows的RStudio版本0.98.1030的Rmd文件中为我工作.