Background: I'm using the metropolis theme which slides background colour is the same as the default background colour of the displayed code in chunks in beamer.
Problem: I want to change the representation of the chunks output. There should be a different type of representation for source-code & results to distinguish them. The source-codes background should be in a slightly darker grey than the metropolis slides background and the results should be surrounded by a black line as a frame.
What I already tried: This threat answers my question for HTML-outputs (YAML: output: html_document
), but I didn't figured out how to get it working in beamer_presentation
.
This is my "minimal" working example:
---
title: "The Influence of the German Statutory Minimum Wage's Introduction on Individuals' Health"
author: "Simon Ress | Ruhr-Universität Bochum"
institute: "Conference: 56. Jahrestagung der DGSMP, Leipzig, 2021"
date: "September 22, 2021"
output:
beamer_presentation:
keep_md: true
keep_tex: no
latex_engine: xelatex
#theme: metropolis
slide_level: 2 # which header level should be printed as slides
incremental: no
header-includes:
- \usetheme[numbering=fraction]{metropolis}
#Define footer:
- \definecolor{beaublue}{rgb}{0.74, 0.83, 0.9}
- \setbeamertemplate{frame footer}{\tiny{\textcolor{beaublue}{Conference 56. Jahrestagung der DGSMP, 2021 | SIMON RESS}}}
#hide footer on title page:
- |
\makeatletter
\def\ps@titlepage{%
\setbeamertemplate{footline}{}
}
\addtobeamertemplate{title page}{\thispagestyle{titlepage}}{}
\makeatother
#show footer on section's start/title pages:
#overwrite "plain,c,noframenumbering" in section pages definition -> enables footer:
- |
\makeatletter
\renewcommand{\metropolis@enablesectionpage}{
\AtBeginSection{
\ifbeamer@inframe
\sectionpage
\else
\frame[c]{\sectionpage}
\fi
}
}
\metropolis@enablesectionpage
\makeatother
#define footer of section pages:
- |
\makeatletter
\def\ps@sectionpage{%
\setbeamertemplate{frame footer}{\tiny{\textcolor{beaublue}{Conference 56. Jahrestagung der DGSMP, 2021 | SIMON RESS}}}
}
\addtobeamertemplate{section page}{\thispagestyle{sectionpage}}{}
\makeatother
#add secrtion numbers to TOC:
- |
\setbeamertemplate{section in toc}{
\leavevmode%
\inserttocsectionnumber.
\inserttocsection\par%
}
\setbeamertemplate{subsection in toc}{
\leavevmode\leftskip=2.5em\inserttocsubsection\par}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
## Content
\tableofcontents[]
# Slide with R Output
```{r cars, echo = TRUE}
summary(cars)
```