---
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')
```
I have gone through many documents and am still not able to find a solution. The footer needs caption on the left side and a page number on the right side. But not sure on how to generate automatically the page numbers. I am very new to this rmarkdown and need some help figuring it out.
CodePudding user response:
You can put any HTML tag including the image in the title itself:
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>
R-Markdown file:
---
title: ""
output:
pdf_document:
includes:
in_header: "preamble.tex"
---
\thispagestyle{fancy}

# Title
\lipsum
\lipsum
File 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