Rmarkdown beamer目录幻灯片,加上灰色不是当前部分

时间:2017-09-04 21:50:49

标签: r latex markdown r-markdown beamer

我想在开头插入一张目录幻灯片,但不是从头开始。

此外,我希望它能够在每个新部分到达时重复播放目录幻灯片,但此时除了当前部分外,所有内容都会变灰,例如见图像。

this其他答案无效,因为toc:true只是在最开始时放入一个目录)

一些答案​​在Latex中存在一些(见here),但我不知道如何在降价中操作这些。更一般地说,我无法将原生beamer乳胶集成到rmarkdown中,所以如果有人可以告诉我如何做到这一点,特别是这个例子,这是有帮助的。

enter image description here

Beamer序言:

output:
  beamer_presentation:
    fig_width: 7
    fig_height: 6
    fig_caption: false
#    keep_tex: true
#    toc: true
    slide_level: 3
    includes:
      in_header: ~/Google Drive/.../.../../latexbeamertheme.r
header-includes:
- \AtBeginSection[]{\begin{frame}\tableofcontents[currentsection]\end{frame}}

1 个答案:

答案 0 :(得分:2)

您可以通过header-includes解决此问题;这就是你如何在我们称之为LaTeX文档中的序言中添加内容的方法。以下是使用我认为您想要完成的内容生成演示文稿的示例代码:

---
title: "Example"
output: beamer_presentation
header-includes:
- \AtBeginSection[]{\begin{frame}\tableofcontents[currentsection]\end{frame}}
---

# Test Section One

----

Test

----

Test


# Test Section Two

----

Test

----

Test

编辑:

如果您希望或需要手动执行此操作,而不是使用header-includes方法,则可以:

---
title: "Example"
output: beamer_presentation
---

# Test Section One

----

\tableofcontents[currentsection]

----

Test

----

Test


# Test Section Two

----

\tableofcontents[currentsection]

----

Test

----

Test