简体   繁体   中英

rmarkdown Table of Contents not being populated

I have a simple test .Rmd script which I am using to generate a PDF file with the rmarkdown render function.

When I set the toc to be true , the second PDF page is a blank white page and I would expect to see 'Slide With Bullets' and 'Slide with R Code and Output' to be in there.

Does anyone know how to format the slide titles so that they appear in the table of contents?

---
title: "test"
author: "test"
date: '2015-10-29'
output: beamer_presentation
toc: true

---

## Slide with Bullets

- Bullet 1
- Bullet 2
- Bullet 3

## Slide with R Code and Output

```{r}
summary(cars)
```

According to the documentation toc only works with level 1 headings. So the code below will create a table of contents to the title slide. I can't get it to work with slides that contain content though. Maybe this is how the table of contents is designed to work???

---
title: "Untitled"
output: 
  beamer_presentation: 
    toc: yes
---

# A Title Slide:

## Slide with Bullets 

- Bullet 1
- Bullet 2
- Bullet 3

## Slide with R Code and Output

```{r}
summary(cars)
```

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM