s

suboutline

@preview

An outline function just for one section and nothing else

v0.3.1
GPL-3.0-only
10 downloads

Package Information

Last Updated
Minimum Typst Version
0.13.0

1. Get the package

Download the package using the TPIX CLI:

tpix get @preview/suboutline:0.3.1

2. Import in your Typst file

Add this to your .typ file:

#import "@preview/suboutline:0.3.1": *

Version History

0.3.10.13.0
be8a5eb10d53...
0.3.00.13.0
5a1058295494...
0.2.00.13.0
89915e234b77...
0.1.0
a829f4cb5b05...

Typst sub-outlines

This package provides the suboutline command that does the same thing as outline but
restricted to the current heading. This is inspired by
minitoc package for LaTeX.

This package is a fork of the
minitoc package, which is no
longer maintained by the original author.

Example

#import "@preview/suboutline:0.3.1": *
#set heading(numbering: "1.1")

#outline()

= Heading 1

#suboutline()

== Heading 1.1

#suboutline()

#lorem(20)

=== Heading 1.1.1

#lorem(30)

== Heading 1.2

#lorem(10)

= Heading 2

#suboutline(target: figure.where(kind: image))

#figure(circle(radius: 1cm), caption: lorem(5))

This produces

Example output showing an outline and local sub-outlines

Usage

The suboutline function has the following signature:

#let suboutline(
  title: none,
  target: heading.where(outlined: true),
  depth: none,
  indent: auto,
  fill: repeat([.], gap: 0.15em),
) = none

This is designed to be as close to the
outline funtions as possible. The
arguments are:

  • title: The title for the local outline. This is the same as for
    outline.title.
  • target: What should be included. This is the same as for
    outline.target.
  • depth: The maximum depth different to include. For example, if depth was 1 in the
    example, "Heading 1.1.1" would not be included.
  • indent: How the entries should be indented. Takes the same types as for
    outline.indent
    and is passed directly to it.
  • fill: Content to put between the numbering and title, and the page number. Same
    types as for
    outline.entry.

Unintended consequences

Because suboutline uses outline, if you apply numbering to the title of outline
with #show outline: set heading(numbering: "1.") or similar, any title in the
sub-outline will be numbered and be a level 1 heading. This cannot be changed with
#show outline: set heading(level: 3) or similar unfortunately.