Header RMarkdown 中的图像和页脚行号

Header image and footer line numbers in RMarkdown

---
title: "An analysis of `r nrow(mtcars)` cars"
---
The title ends up above the header image. 
```{r echo=FALSE, out.width='100%'}
knitr::include_graphics('D:/Users/james/ui.png')
```

翻了很多文档,还是没找到解决办法。页脚左侧需要标题,右侧需要页码。但不确定如何自动生成页码。我对这个 rmarkdown 很陌生,需要一些帮助来弄清楚它。

您可以在标题中放置任何 HTML 标签,包括图片:

HTML

---
title: "<img src='https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/SIPI_Jelly_Beans_4.1.07.tiff/lossy-page1-256px-SIPI_Jelly_Beans_4.1.07.tiff.jpg'><br>Title"
output: html_document
---

<style>
body {
  height: 100vh !important;
}

.footer {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  text-align: center;
}
</style>

# An analysis

Lorem ipsum

<div class="footer">Footer</div>

PDF

R-Markdown 文件:

---
title: ""
output:
  pdf_document:
    includes:
      in_header: "preamble.tex"
---

\thispagestyle{fancy}

![](SIPI_Jelly_Beans_4.1.07.tiff.jpg)

# Title

\lipsum
\lipsum

文件preamble.tex:

\usepackage{lipsum} % for filler text
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{} % clear all header fields
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.4pt}
\fancyfoot{} % clear all footer fields
\fancyfoot[L]{Footer Caption}
\fancyfoot[R]{\thepage}  % page number in "outer" position of footer line