3

I write many documents using RStudio, including beamer slides from both LaTeX (Sweave/rnw) and Rmarkdown (rmd).

I understand that \setbeamertemplate{footline}[frame number] will add frame numbers to beamer slides. This works when I use LaTeX, but not when I use Rmarkdown. Specifically, the error is:

l.100 \setbeamertemplate{footline}{[}f
Error: pandoc document conversion failed with error 43

How do I fix this? Or more generally, how do I add frame numbers to a beamer document created with Rmarkdown?

Minimal Example:

Sweave/LaTeX (works):

\documentclass{beamer}
\title{Put Title Here}
\setbeamertemplate{navigation symbols}{} 
\setbeamertemplate{footline}[frame number]{}

\begin{document}
\maketitle

\begin{frame}{Title of Slide}
  Slide text
\end{frame}

\end{document}

Rmarkdown (throws pandoc error):

---
title: "Put Title Here"
output: beamer_presentation
header-includes:
  - \setbeamertemplate{navigation symbols}{} 
  - \setbeamertemplate{footline}[frame number]
---

## Slide Title

Slide text

Thank you.

6

Summarising information from the answer https://stackoverflow.com/a/38687577/2777074

Create a new .tex file called header_pagenrs.tex which includes the line

\setbeamertemplate{navigation symbols}{} 
\setbeamertemplate{footline}[frame number]

Then in the .Rmd file:

---
title: "Things and Stuff"
author: "Me"
output:
  beamer_presentation:
    includes:
      in_header: header_pagenrs.tex
---

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.