Since 2024, I have been working on marginalia – Typst Universe, a package for creating margin-notes (as inspired by Edward Tufte’s famous style).
I have now finally been able to crack one of the last features missing from my custom #note[]-function: The ability to add labels to them and reference them just like footnotes. ![]()
Also, the anchors now link to the number in the note and vice versa.
#import "@preview/marginalia:0.3.0" as marginalia: note, notefigure, wideblock
#set page(width: 12cm, height: auto)
#show: marginalia.setup.with(
outer: (width: 4cm)
)
Example stolen from the #link("https://typst.app/docs/reference/model/footnote/#example")[footnote documentation]:
You can edit Typst documents online.
#note[https://typst.app/app] <fn> // Simply put a label after the note
Checkout Typst's website. @fn // ...and then reference it.
And the online app. #marginalia.ref(-1) // Alternative: reference notes by offset.
Similarly, you can simply label notefigures now by placing a <label> after the notefigure. ![]()
technical details for the curious
The way this works is by having the output of #note[] be a content “sequence” which contains a dummy #metadata() as its first child, and then inside the contextual content there is labelled metadata with enough information to recreate the anchor.
Then, a custom show: ref rule checks if the target is a sequence with the given dummy metadata as first child, and then uses query to access the labelled metadata that is inside the context block to then create a link to the note.
I’m really proud of this update, go check it out!
