t

tsinswreng-auto-heading

@preview

Automatic heading level management for Typst - create nested headings without manually tracking levels

v0.1.0
MIT

Package Information

Last Updated
Authors
Tsinswreng
Categories
utility

1. Get the package

Download the package using the TPIX CLI:

tpix get @preview/tsinswreng-auto-heading:0.1.0

2. Import in your Typst file

Add this to your .typ file:

#import "@preview/tsinswreng-auto-heading:0.1.0": *

Version History

0.1.0
7cac48eb4b4f...

tsinswreng-auto-heading

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:

  1. Increments the heading level counter
  2. Creates a heading at the appropriate level
  3. Renders the content
  4. 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