typst port of the annotated LaTeX equations
The annotation system allows you to:
- Highlight parts of equations with colored backgrounds
- Add explanatory arrows and labels pointing to specific terms
- Create complex multi-element annotations
- Work in various layout contexts (figures, wrapped text, side-by-side equations)
Important
Margins are adjustable
typst_annotate.typ- The main module containing annotation functionsannotated_equations_typst.typ- Main document combining all examplesexamples/- Individual example files:example_prob_typst.typ- Simple annotation in equationexample_prob2_typst.typ- Complex annotation in figureexample_laplace_typst.typ- Wrapped figure with annotationsexample_overlay_typst.typ- Side-by-side annotated equations
#import "typst_annotate.typ": *
#annotated-equation(
$
y = #mark("m", highlight($m$, color: blue)) x + #mark("b", highlight($b$, color: red))
$,
annotations: (
(
from-label: "m",
content: [slope],
dx: 0pt,
dy: -30pt,
color: blue,
),
(
from-label: "b",
content: [y-intercept],
dx: 0pt,
dy: 30pt,
color: red,
),
)
)To compile the main document:
typst compile annotated_equations_typst.typTo compile individual examples:
typst compile examples/example_prob_typst.typAdds a colored background to content.
Marks content for annotation with a unique label.
Creates an annotation arrow pointing to a marked element.
Helper function that combines equation display with annotations.
The repository includes four examples that demonstrate different annotation scenarios:
- Simple Annotation: Basic highlighting and labeling of equation terms
- Complex Figure: Multiple connected annotations within a figure
- Wrapped Text: Equation with annotations and wrapping text
- Side-by-Side: Two annotated equations displayed side-by-side
MIT License1
Acknowledgments
Footnotes
-
LaTeX/TikZ implementation by Sibin Mohan: https://github.com/synercys/annotated_latex_equations ↩

