A Typst package that provides automatic heading level management.
Overview
tsinswreng-auto-heading provides a simple way to create nested headings without manually tracking heading levels. The auto-heading function automatically increments and decrements the heading level as you enter and exit sections.
Usage
#import "@preview/tsinswreng-auto-heading:0.1.0": auto-heading
#let H = auto-heading
#H("Chapter 1")[
This is the content of chapter 1.
#H("Section 1.1")[
This is section 1.1 content.
#H("Subsection 1.1.1")[
This is a subsection.
]
]
#H("Section 1.2")[
This is section 1.2.
]
]
How It Works
The auto-heading(title, content) function:
- Increments the heading level counter
- Creates a heading at the appropriate level
- Renders the content
- Decrements the heading level counter when done
This allows you to nest sections naturally without worrying about the absolute heading level numbers.
License
MIT License