Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I insert page number to rmarkdown beamer slides?

How can I show page numbers (preferably like 4/10, 5/10 etc.) on an rmarkdown beamer presentation?

like image 969
ilker_arslan Avatar asked Nov 20 '14 20:11

ilker_arslan


People also ask

How do I add page numbers in R markdown?

Page numbering is straightforward. You can use \pagenumbering{gobble} for pages without numbering, \pagenumbering{roman} for roman page numbering and \pagenumbering{arabic} for normal page numbering. Just include the argument wherever you want the have the page numbering changed. Default page numbering is arabic.

How do you make slides in Beamer?

To start our presentation we need to set the document class to beamer . Next we'll select a theme using the \usetheme command; for our example we'll use the Boadilla theme. Just like any other LaTeX document we need to enclose our document in the document environment.


1 Answers

In the front matter of the document, you can include a .tex file with extra commands as shown in RStudio's documentation here.

I created a new .tex file that I called "header_pagenrs.tex" which only includes the top 2 lines from @user4281727's answer:

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

Then I referenced this file at the top of my .Rmd file:

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

If this still gives you errors, you might also be missing some required TeX packages (a separate problem from RStudio and rmarkdown).

like image 56
civilstat Avatar answered Sep 20 '22 06:09

civilstat