9 Working with sections
Section headings create document structure automatically.
# Introduction
## Background
## Methods
# Results
# ConclusionsQuarto can automatically number sections using:
format:
html:
number-sections: true9.1 How sections are displayed
Each separate .qmd file will appear in the left hand navigation menu as a (numbered) chapter.
Within each .qmd, each heading level will appear in the table of contents (right hand side)
- Heading level 1
#will increment the number (e.g. 1,2,3 etc) - Heading level 2
##will increment the subpoints (e.g. 1.1, 1.2, 1.3 etc) - Heading level 3
###will increment the sub-subpoint (e.g. 1.1.1, 1.1.2, 1.1.3 etc)
9.2 Numbering sections
Sections are numbered by default (# Section heading). You can create a unnumbered heading with {.unnumbered} (e.g. )# Unnumbered section heading {.unnumbered})
9.3 Global defaults
Numbered sections are the default and can be controlled in the yaml
format:
html:
number-sections: true
toc: true
toc-depth: 3
toc-location: right
pdf:
number-sections: true9.4 Labelling sections
Sections can be assigned identifiers.
## Newton's Laws {#sec-newton}You should use - rather than _ in section labels as underscores can confuse Quarto!
9.5 Referencing sections
You can then reference the section elsewhere:
See @sec-newton for an introduction to Newton's Laws.When rendered, Quarto automatically inserts the appropriate section number.