How to add table of contents in an R Markdown presentation when rendered to ioslides_presentation
?
Something like the following, but in ioslides:
---
title: ""
author: ""
date: ""
output:
html_document:
df_print: paged
number_sections: yes
theme: united
toc: yes
toc_float:
collapsed: yes
smooth_scroll: yes
---
For documents with output ioslides:
---
title: ""
author: ""
date: ""
output:
ioslides_presentation: null
beamer_presentation: default
slidy_presentation: default
---
Since the
toc
sub-option is not supported in RM arkdown ioslides, see e.g. here we have to do a workaround.@ShKlinkenberg provides a solution here. The key is to use a JavaScript script to add this functionality.
The following standalone
.Rmd
example uses @ShKlinkenberg's script:This renders a table of contents as follows: