如何让 TOC 出现在 RMarkdown Revealjs 幻灯片中?

How to make TOC show up in RMarkdown Revealjs slides?

我正在努力通过 RMarkdown 和 revealjs 包创建 HTML 包含 table 内容的幻灯片。我在文件的 YAML 部分设置了 toc: true,但目录根本没有出现,如以下屏幕截图所示。我错过了什么?

一个工作示例

---
title: |
  | <big> Week 1: Introduction </big>
subtitle: |
  | `r emo::ji("aesculapius")` Medical School `r emo::ji("aesculapius")`
author: | 
  | <big> Hoge Fuga </big>
institute: "Hoo-Bar U"
date: "Update: `r format(Sys.time(), '%Y/%b/%e')`"
output: 
  revealjs::revealjs_presentation:
    base_format: "function(..., number_sections) bookdown::html_book(...)"
    theme: moon
    pandoc_args: 
      - "--from"
      - "markdown+autolink_bare_uris+tex_math_single_backslash-implicit_figures"
      - "--highlight=breezedark"
    transition: default
    background_transition: zoom
    center: true
    incremental: false
    number_sections: true
    toc: true
    toc_depth: 3
    fig_caption: TRUE
    self_contained: true
    reveal_options:
      slideNumber: true
      previewLinks: true
      width: 1280 
      height: 960
      margin: 0.1
always_allow_html: yes
link-citations: yes
---

<style>
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@100;300;400;500;700;900&display=swap');
</style>

```{css css-settings, echo=FALSE}
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
  /*text-transform: none;*/
  font-family: 'Roboto', 'Noto Sans JP', sans-serif;
}

.reveal .slide {
  text-align:left;
  font-family: 'Roboto', 'Noto Sans JP', sans-serif;
  /*vertical-align:top;*/
  /*background-color:aliceblue;*/
}

```

# Course Overview

## Basic infomation

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras vitae metus dolor. 
Morbi volutpat eros et justo iaculis, vel viverra magna tempus. Donec dapibus interdum aliquet. 
Ut tristique nibh quis eleifend suscipit. 

## Course objective

Nulla facilisi. Vivamus elit lacus, varius vel convallis id, tincidunt at erat. 
Etiam eget egestas eros, at scelerisque sapien. 
Aliquam dignissim sed sem in scelerisque. 


## Course contents

> - Mauris hendrerit lobortis vehicula. 
> - Sed sed condimentum neque, in rhoncus quam. 
> - Suspendisse tempor risus lorem, quis tincidunt elit maximus vitae. 

## Tentative schedule

Fusce at vestibulum odio. 
Pellentesque cursus rutrum nulla, ut tincidunt est pulvinar sed. 
Aliquam erat volutpat. 



# Self-introduction session

## Intoroduce yourself to the classmates

You:

> 1. work in a four-member group I assign you randomly;
> 2. tell the group members four things (characteristics) of yourself;
>     - three are **true** `r emo::ji("heavy_check_mark")` statements of yourself
>     - one is **false** `r emo::ji("x")` 
> 3. answer to questions your group members ask; 
>     - colleagues try to guess which of four statements is false `r emo::ji("thinking")`
>     - colleagues need to predict which is a lie in two or three minutes
> 4. can tell which is false after collegues correctly guess or the time has come;
> 5. listen to others self-introduction `r emo::ji("ear")`;
> 6. ask them some questions to guess which statement is false `r emo::ji("microphone")`;
>     - Do NOT hesitate! `r emo::ji("rofl")`
> 7. also report others' characterstics in a Google Forms page `r emo::ji("memo")`
>     - https://forms.gle/this-is-an-example

Session 信息

R version 3.6.2 (2019-12-12)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

如果您使用 menu 插件,您可以通过单击左下角的图标访问目录。不过不确定这是否是您真正想要的。

---
title: "Untitled"
output: 
  revealjs::revealjs_presentation:
    self_contained: false
    reveal_plugins: ["menu"]
    reveal_options:
      menu:
        numbers: true
---

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

## R Markdown

This is an R Markdown presentation. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document.

## Slide with Bullets

- Bullet 1
- Bullet 2
- Bullet 3

## Slide with R Output

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

## Slide with Plot

```{r pressure}
plot(pressure)
```