outline
ElementElement functions can be customized with set
and show
rules.
set
and show
rules.A table of contents, figures, or other elements.
This function generates a list of all occurrences of an element in the document, up to a given depth. The element's numbering and page number will be displayed in the outline alongside its title or caption. By default this generates a table of contents.
Example
#outline()
= Introduction
#lorem(5)
= Prior work
#lorem(10)

Alternative outlines
By setting the target
parameter, the outline can be used to generate a
list of other kinds of elements than headings. In the example below, we list
all figures containing images by setting target
to figure.where(kind: image)
. We could have also set it to just figure
, but then the list
would also include figures containing tables or other material. For more
details on the where
selector, see here.
#outline(
title: [List of Figures],
target: figure.where(kind: image),
)
#figure(
image("tiger.jpg"),
caption: [A nice figure!],
)

ParametersParameters are the inputs to a function. They are specified in parentheses after the function name.
title
The title of the outline.
- When set to
auto
, an appropriate title for the text language will be used. This is the default. - When set to
none
, the outline will not have a title. - A custom title can be set by passing content.
The outline's heading will not be numbered by default, but you can
force it to be with a show-set rule:
show outline: set heading(numbering: "1.")
Default: auto
target
The type of element to include in the outline.
To list figures containing a specific kind of element, like a table, you
can write figure.where(kind: table)
.
Default: heading.where(outlined: true)
#outline(
title: [List of Tables],
target: figure.where(kind: table),
)
#figure(
table(
columns: 4,
[t], [1], [2], [3],
[y], [0.3], [0.7], [0.5],
),
caption: [Experiment results],
)

depth
The maximum level up to which elements are included in the outline. When
this argument is none
, all elements are included.
Default: none
#set heading(numbering: "1.")
#outline(depth: 2)
= Yes
Top-level section.
== Still
Subsection.
=== Nope
Not included.

indent
SettableSettable parameters can be customized for all following uses of the function with a set
rule.
set
rule.Whether to indent the sub-elements to align the start of their numbering with the title of their parents. This will only have an effect if a heading numbering is set.
Default: false
#set heading(numbering: "1.a.")
#outline(indent: true)
= About ACME Corp.
== History
#lorem(10)
== Products
#lorem(10)

fill
Content to fill the space between the title and the page number. Can be
set to none
to disable filling.
Default: repeat(body: [.])
#outline(fill: line(length: 100%))
= A New Beginning
