2017-01-16 47 views
1

我使用RMarkdown基於使用RStudio的投影儀模板獲取PDF演示文稿。我想獲得目錄(TOC)幻燈片;但是,我的TOC幻燈片是空的。使用Rmarkdown投影儀模板的空TOC幻燈片

我需要做什麼讓我的TOC顯示的幻燈片?

我用這個代碼:

--- 
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 

我輸出的圖片: enter image description here

回答

1

默認爲1級標題生成表的內容。您沒有任何在你的幻燈片結構,所以試試這個:

# Topic A 

## Slide 1 topic A 
kdsfj 

# Topic B 
## Slide 1 topic B 
sdjfkl 

enter image description here

enter image description here

+0

謝謝!僅在「slide_level」上定義一個TOC是可能的(或如何),例如,在這種情況下對於第2級? –

+0

據我所知,不符合標準降價。剛剛在SO上找到了這個(http://stackoverflow.com/questions/34814100/table-of-content-in-beamer-generated-with-r-markdown-knitr),這就意味着你可能不得不做一些棘手的事情, renewcommand {\ tableofcontents} {...},但沒有實際的答案。 – PJP

相關問題