Adding a table of contents

Reportistica con R Markdown

Amy Peterson

Head of Core Curriculum at DataCamp

Table of contents

Markdown file with toc

Knit file with toc

Reportistica con R Markdown

TOC depth

Markdown file with TOC depth of 2

Knit file with TOC depth of 2-

Reportistica con R Markdown

Number sections

Markdown file with toc, toc_depth, and number_sections

Knit file with toc, toc_depth, and number_sections

Reportistica con R Markdown

Number sections

Markdown file with headers with two and three hashes

Knit file with toc, toc_depth, and number_sections

Reportistica con R Markdown

TOC float

Markdown file with toc, toc_depth, and toc_float

Creating an HTML file with toc_float

Reportistica con R Markdown

TOC float: collapsed

Markdown file with toc, toc_depth, and toc_float with collapsed false

Creating an HTML file with toc_float with collapsed false

Reportistica con R Markdown

TOC float: smooth scroll

Markdown file with toc, toc_depth, and toc_float with collapsed false and smooth_scroll false

Creating an HTML file with toc_float with collapsed false and smooth_scroll false

Reportistica con R Markdown

Summary

  • toc
  • toc_depth
    • HTML default: 3
    • PDF default: 2
  • number_sections

HTML

  • toc_float
    • collapsed
    • smooth_scroll
Reportistica con R Markdown

Let's practice!

Reportistica con R Markdown

Preparing Video For Download...