TypstDocumentation

outlineElement
Question mark

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)
Preview

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!],
)
Preview

Parameters
Question mark

title
none or auto or content
Settable
Question mark

The title of the outline.

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
string or label or function or location or selector or regular expression
Settable
Question mark

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],
)
Preview

depth
none or integer
Settable
Question mark

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.
Preview

indent
boolean
Settable
Question mark

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)
Preview

fill
none or content
Settable
Question mark

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
Preview