A simple Typst package for creating and managing abbreviations. While more complex packages exist, this one prioritizes ease of use and adapts to any language (English, French, German, etc.) by letting you customize the abbreviation-list title.
Installation
Import from Typst Universe
To import the library from Typst Universe, add this to your document:
#import "@preview/abbrev:0.1.2": *
Local use
To use the library locally, download lib.typ and place it in your document’s directory (or any location of your choice). Then, into your document, import all (i.e. *) from lib.typ.
Usage
Step 1: Define abbreviations
Start by defining all your abbreviations in a dictionary:
#define-abbreviations((
"GPU": "Graphics Processing Unit",
"XML": "Extensible Markup Language",
"CPU": "Central Processing Unit",
))
Step 2: Use abbreviations in your document
-
Short form (shows the abbreviation):
#abbr("GPU")Output:
GPU
-
Full form (shows the complete text):
#abbr("GPU", form: "full")Output:
Graphics Processing Unit
-
With a suffix (e.g., plural):
#abbr("GPU", suffix: "s")Output:
GPUs
Step 3: Display the abbreviation list
Generate an abbreviation list anywhere in your document:
#abbreviation-outline(
title: [Abbreviations],
)
Output:
The default title is “List of abbreviations” — customize it as needed. For example, in French: title: [Liste des abréviations].
Example
See example.typ for a complete working example. To view the compiled output, choose one of the following:
- Compile with the package: Run
typst compile example.typand ensure the import statement is#import "@preview/abbrev:0.1.2": *. - Compile locally: Run
typst compile example.typafter placinglib.typin the same directory asexample.typand updating the import statement to importlib.typ. - Use GitHub Actions: Select the latest passed workflow run and download the
pdf-outputartifact (a ZIP file containing the PDF).