Sebastian Sauer
Sebastian Sauer

Reputation: 1693

Empty TOC-slide using Rmarkdown beamer template

I am using RMarkdown to get a PDF presentation based on the beamer template using RStudio. I would like to get a table-of-contents (TOC) slide; however, my TOC slide is empty.

What do I need to do get a slide where my TOC is shown?

I used this code:

--- 
title: "test"
output: 
  beamer_presentation:
    toc: true
---


## Topic A
kdsfj

## Topic B
sdjfkl

SessionInfo:

R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.2

locale:
  [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     

 loaded via a namespace (and not attached):
  [1] backports_1.0.4 magrittr_1.5    rprojroot_1.1   htmltools_0.3.5   tools_3.3.2    
  [6] yaml_2.1.14     Rcpp_0.12.8     stringi_1.1.2   rmarkdown_1.3     knitr_1.15.1   
 [11] stringr_1.1.0   digest_0.6.11   evaluate_0.10  

Picture of my output: enter image description here

Upvotes: 1

Views: 788

Answers (1)

PJP
PJP

Reputation: 642

By default the table of contents is generated for level 1 headings. You don't have any in your slide structure, so try this:

# Topic A

## Slide 1 topic A
kdsfj

# Topic B
## Slide 1 topic B
sdjfkl

enter image description here

enter image description here

Upvotes: 1

Related Questions