用R markdown/knitr生成的投影仪中的内容表

avr*_*iis 3 markdown r rstudio knitr

根据这个问题,我在使用be mark类文档生成目录时遇到问题,我在RStudio中用R markdown和knitr制作了这个文档.

我的YAML标题如下所示:

---
params:
  x: !r x
author: "Author"
date: "Januar 2016"
graphics: yes
fontsize: 10pt
output:
  beamer_presentation:
    includes:
      in_header: in_header.tex
    keep_tex: yes
    latex_engine: xelatex
    slide_level: 1
    template: body.tex
    toc: true
classoption: aspectratio=169
---
Run Code Online (Sandbox Code Playgroud)

我在使用中发现body.tex默认模板投影仪在这里(我需要做索姆adjustsments的扉页,所以这就是为什么我已经明确地提到了它).

我用这个文档渲染

render(input = "file_name.Rmd",
         params = list(x = i),
         output_file = "file_name.beamer.pdf"
         )
Run Code Online (Sandbox Code Playgroud)

但是,生成的pdf中只显示空白页面而没有TOC.我试过多次运行渲染.

sco*_*coa 7

目录列出了部分,而不是单个页面.但是你的文档中没有任何部分:自从你使用以来slide_level: 1,所有1级标题都是幻灯片.

如果您在文档中添加部分,您将获得一个toc.这将是正确的用途.就像是:

---
output:
  beamer_presentation:
    slide_level: 2
    toc: true
---

# Section 1

## Slide 1
Slide content

## Slide 2
Slide content
Run Code Online (Sandbox Code Playgroud)

如果你真的想要获得个人幻灯片列表作为内容表,可能有一种方法可以\renewcommand{\tableofcontents}{...}在你的序言中做到这一点,但tex.stackexchange.com更适合这个问题.