[R] TOC in vignette (knitr::rmarkdown)

Yihui Xie x|e @end|ng |rom y|hu|@n@me
Mon Aug 26 16:59:16 CEST 2019


output:
  rmarkdown::html_vignette:
    toc: true

The syntax is the same for all R Markdown output formats:
https://bookdown.org/yihui/rmarkdown/html-document.html#table-of-contents

Regards,
Yihui
--
https://yihui.name

On Mon, Aug 26, 2019 at 9:32 AM Helmut Schütz <helmut.schuetz using bebac.at> wrote:
>
> Dear all,
>
> I can't figure out how to include a table of contents in a vignette.
>
> What I have now:
> ---
> title: "myPackage"
> subtitle: mySubtitle"
> author: "Me"
> date: "`r Sys.Date()`"
> output: rmarkdown::html_vignette
> vignette: >
>    %\VignetteIndexEntry{replicateBE}
>    %\VignetteEngine{knitr::rmarkdown}
>    %\VignetteEncoding{UTF-8}
> ---
>
> ```{r, include = FALSE}
> knitr::opts_chunk$set(
>    collapse = TRUE,
>    comment = "#>"
> )
> ```
>
> This one works fine in my README.Rdm:
> ---
> title: "myPackage"
> output:
>    github_document:
>      toc: true
>      toc_depth: 4
> ---
>
> Cheers,
> Helmut



More information about the R-help mailing list