Skip to content

sambacha/typst-annotated

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

typst port of the annotated LaTeX equations

Overview

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)

Examples

fig1


Important

Margins are adjustable

fig2

Files

  • typst_annotate.typ - The main module containing annotation functions
  • annotated_equations_typst.typ - Main document combining all examples
  • examples/ - Individual example files:
    • example_prob_typst.typ - Simple annotation in equation
    • example_prob2_typst.typ - Complex annotation in figure
    • example_laplace_typst.typ - Wrapped figure with annotations
    • example_overlay_typst.typ - Side-by-side annotated equations

Usage

Basic Example

#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,
    ),
  )
)

Compiling

To compile the main document:

typst compile annotated_equations_typst.typ

To compile individual examples:

typst compile examples/example_prob_typst.typ

Key Functions

highlight(content, color: red)

Adds a colored background to content.

mark(label, content, color: black)

Marks content for annotation with a unique label.

annotate(from-label, content, ...)

Creates an annotation arrow pointing to a marked element.

annotated-equation(equation-content, annotations: ())

Helper function that combines equation display with annotations.

Examples

The repository includes four examples that demonstrate different annotation scenarios:

  1. Simple Annotation: Basic highlighting and labeling of equation terms
  2. Complex Figure: Multiple connected annotations within a figure
  3. Wrapped Text: Equation with annotations and wrapping text
  4. Side-by-Side: Two annotated equations displayed side-by-side

License

MIT License1

Acknowledgments

Footnotes

  1. LaTeX/TikZ implementation by Sibin Mohan: https://github.com/synercys/annotated_latex_equations

About

colorized annotated equations for typst

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages