l

labtyp

@preview

Label text and extract to json using typst query

v0.1.0
MIT
Template

Package Information

Last Updated
Authors
evidlabel
Categories
utility

Preview

Template preview

1. Get the package

Download the package using the TPIX CLI:

tpix get @preview/labtyp:0.1.0

2. Initialize from template

Create a new project from this template:

typst init @preview/labtyp:0.1.0

Version History

0.1.0
dceea4ef6161...

labtyp

labtyp is a package that allows using typst for labelling text documents like dialogue threads or legal documents for precise citing.

A json file with the labels in a document can be produced using typst query:

typst query main.typ <lab> > doclabels.json

Which can then be translated into hayagriva or biblatex formats.

labtyp defines 3 commands:

  • lab: creates an in-place label, defined by key, text, note
  • mset: adds metadata that gets assigned to subsequent labels (i.e. labels defined below the current mset command in the document), like the title of the document, date, pagenumber in the original document, this can be expanded with any key
  • Each label ends up being a concatenation of the label information, and the mset information.
  • lablist: prints a table of the labels created

Test document

#import "@preview/labtyp:0.1.0": mset, lab, lablist

#mset(values: (
title: "My Document",
author: "John Doe",
date: "2025-07-31"
))

= Heading
== Subheading
This is some text.

#lab("key", "Highlighted text", "This is a note") // Creates underlined text and footnote

#mset(values: (date: "2025-08-01")) // Redefine date for subsequent labels
= Another Heading
#lab("key2", "More text", "Another note")

= List of Labels
#lablist() // Displays a table of all labels with hyperlinks