latexr-markdownfooterbeamer

Rmd: Hide FOOTER on title&content page


I am creating a RMarkdown template of Beamer slides and use the metropolis theme as a basis.

Now I want to add a footer with some text on the left side and the slide number as fraction on the right side. That works. Furthermore, the whole footer should not be shown on the title & content page. How can I control where the foot line is shown?

This is my (minimal working example):

slides.rmd

---
title: "Title"
subtitle:  "Subtitle"
author: "Simon"
institute: "RUB"
date: "September 22, 2021"

output:
  beamer_presentation:
    keep_md: true
    keep_tex: no
    latex_engine: xelatex
    #theme: metropolis
    includes:
      in_header:
          #- toc.tex
    slide_level: 2 # which header level should be printed as slides
    incremental: no
header-includes:
  - \usetheme[numbering=fraction]{metropolis}
  - \definecolor{beaublue}{rgb}{0.74, 0.83, 0.9}
  - \setbeamertemplate{frame footer}{\tiny{\textcolor{beaublue}{Conference 56. Jahrestagung der DGSMP, 2021}}}

---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```


## Content
\tableofcontents[]

# Level I

Test

## Slide with Bullets

- Bullet 1
- Bullet 2
- Bullet 3

# Slide with R Output

```{r cars, echo = TRUE}
summary(cars)
```

I know that it would be possible in Latex via the begingroup & endgroup command combined with the plain-option ({}) used on \setbeamertemplate{footline}:

\documentclass{beamer}

\setbeamertemplate{footline}[frame number]

\begin{document}

\begin{frame}
normal frame
\end{frame}

\begingroup
\setbeamertemplate{footline}{}
\begin{frame}
without footline
\end{frame}
\endgroup

\begin{frame}
normal frame
\end{frame}

\end{document}

But I don't know how to implement it in RMarkdown.


Solution

  • To remove the footline from your title and toc page, you can use the same trick as in https://topanswers.xyz/tex?q=1004#a1198

    Add the following to your header includes:

    \makeatletter
    \def\ps@navigation@titlepage{%
      \setbeamertemplate{footline}{}
      \@nameuse{ps@navigation}
    }
    \addtobeamertemplate{title page}{\thispagestyle{navigation@titlepage}}{}
    \pretocmd{\tableofcontents}{\thispagestyle{navigation@titlepage}}{}{}
    \makeatother
    

    (please also note that the syntax \tiny{...} is wrong. This macro is a switch and does not take an argument. You can instead use {\tiny ...}

    ---
    title: "Title"
    subtitle:  "Subtitle"
    author: "Simon"
    institute: "RUB"
    date: "September 22, 2021"
    
    output:
      beamer_presentation:
        keep_md: true
        keep_tex: no
        latex_engine: xelatex
        #theme: metropolis
        includes:
          in_header:
              #- toc.tex
        slide_level: 2 # which header level should be printed as slides
        incremental: no
    header-includes:
      - \usetheme[numbering=fraction]{metropolis}
      - \definecolor{beaublue}{rgb}{0.74, 0.83, 0.9}
      - \setbeamertemplate{frame footer}{{\tiny\textcolor{beaublue}{Conference 56. Jahrestagung der DGSMP, 2021}}}
      - \makeatletter
      - \def\ps@navigation@titlepage{\setbeamertemplate{footline}{}\@nameuse{ps@navigation}}
      - \addtobeamertemplate{title page}{\thispagestyle{navigation@titlepage}}{}
      - \pretocmd{\tableofcontents}{\thispagestyle{navigation@titlepage}}{}{}
      - \setbeamertemplate{section in toc}{\leavevmode\inserttocsectionnumber. \inserttocsection\par}
      - \makeatother
    ---
    
    ```{r setup, include=FALSE}
    knitr::opts_chunk$set(echo = FALSE)
    ```
    
    
    ## Content
    \tableofcontents[]
    
    # Level I
    
    Test
    
    ## Slide with Bullets
    
    - Bullet 1
    - Bullet 2
    - Bullet 3
    
    # Slide with R Output
    
    ```{r cars, echo = TRUE}
    summary(cars)
    ```