R Markdown Colored Background

Viewed 105

I have reproduced a simple example of an R Markdown presentation. Basically, I want to achieve a colored page that overlays both the headline and the footline. At the moment, only the headline is overlayed. The approach with a preamble in a tex file is needed in my full example. "Red.jpg" is simply a red image. There may be a better approach to achieve this. The reproducible code is as follows:

---
title: "Untitled"
author: "Author"
date: "21 6 2021"
output:
  beamer_presentation:
    includes:
      in_header: preamble.tex
---

---

\begin{tikzpicture}[remember picture,overlay]
\node at (current page.center) {\includegraphics[width=\paperwidth]{red.jpg}};
\end{tikzpicture}

The code for the preamble is as follows:

\usepackage{tikz}
\setbeamertemplate{headline}{My Title}
\setbeamertemplate{footline}{Author \hfill \insertframenumber}

This really represents a simple MWE, without borthering about spacing of footline etc.

The current result is as follows:

enter image description here

1 Answers

You can use a plain frame without head- or footline:

---
title: "Untitled"
author: "Author"
date: "21 6 2021"
output:
  beamer_presentation
header-includes:
  - \usepackage{tikz}
  - \setbeamertemplate{headline}{My Title}
  - \setbeamertemplate{footline}{Author \hfill \insertframenumber}
---

---

#  {.plain}

\begin{tikzpicture}[remember picture,overlay]
\fill[red] (current page.south west) rectangle (current page.north east);
\end{tikzpicture}

enter image description here

Related