Hey everyone!
I’m excited to announce the release of mannot v0.3.0, the Typst package for marking and annotating elements within your math blocks!
This new version brings some exciting changes and improvements:
Flexible Leader Lines: The
annot
function now supports direct, straight leader lines (in addition to elbow-shaped ones). Also, you can customize your arrowheads using tiptoe package.
CeTZ Annotations: Unleash the power of graphical annotations with CeTZ canvas support using the new
annot-cetz
function.
Your feedback is always appreciated!
Links
- Github: GitHub - ryuryu-ymj/mannot: A package for marking and annotating in math blocks in Typst.
- Universe: mannot – Typst Universe
Examples
#import "@preview/mannot:0.3.0": *
#set page(width: auto, height: auto, margin: (left: 4cm, top: 2cm, rest: 1cm), fill: white)
#set text(24pt)
$
markul(p_i, tag: #<p>) = markrect(
exp(- mark(beta, tag: #<beta>, color: #red) mark(E_i, tag: #<E>, color: #green)),
tag: #<Boltzmann>, color: #blue,
) / markhl(sum_j exp(- beta E_j), tag: #<Z>)
#annot(<p>, pos: bottom + left)[Probability of \ state $i$]
#annot(<beta>, pos: top + left, dy: -1.5em, leader-connect: "elbow")[Inverse temperature]
#annot(<E>, pos: top + right, dy: -1em)[Energy]
#annot(<Boltzmann>, pos: top + left)[Boltzmann factor]
#annot(<Z>)[Partition function]
$
#import "@preview/mannot:0.3.0": *
#import "@preview/cetz:0.3.4"
#set page(width: auto, height: auto, margin: (y: 2cm, bottom: 1cm), fill: white)
#set text(size: 24pt, fill: black)
#let rmark = mark.with(color: red)
#let bmark = mark.with(color: blue)
#let pmark = mark.with(color: purple)
$
( rmark(a x, tag: #<ax>) + bmark(b, tag: #<b>) )
( rmark(c x, tag: #<cx>) + bmark(d, tag: #<d>) )
= rmark(a c x^2) + pmark((a d + b c) x) + bmark(b d)
$
#annot-cetz(
(<ax>, <b>, <cx>, <d>),
cetz,
{
import cetz.draw: *
set-style(mark: (end: "straight"))
bezier-through("ax.south", (rel: (x: 1, y: -.5)), "cx.south", stroke: red)
bezier-through("ax.south", (rel: (x: 1, y: -1)), "d.south", stroke: purple)
bezier-through("b.north", (rel: (x: .6, y: .5)), "cx.north", stroke: purple)
bezier-through("b.north", (rel: (x: .6, y: 1)), "d.north", stroke: blue)
},
)
#import "@preview/mannot:0.3.0": *
#import "@preview/cetz:0.3.4"
#set page(width: auto, height: auto, margin: (x: 4cm, top: 2cm, bottom: 1cm), fill: white)
#set text(size: 24pt, fill: black)
#let markhl = markhl.with(stroke: 1pt)
$
markhl(1 mark(., tag: #<sep>) 23, tag: #<mantissa>, color: #red)
mark(
mark(times, tag: #<prd>)
mark(10, tag: #<base>)^mark(4, tag: #<exp>),
tag: #<pow>,
)
$
#{
let annot = annot.with(leader-tip: tiptoe.triangle, leader-toe: none)
annot(<mantissa>, pos: left, dx: -.5em, dy: -1em, annot-text-props: (size: .9em))[mantissa]
let annot = annot.with(leader-stroke: .03em, leader-tip: none, leader-toe: none)
annot(<sep>, pos: bottom + left, dx: -.5em)[decimal \ separator]
annot(<prd>, pos: top, dx: -1em, dy: -1.2em)[product]
annot(<base>, pos: top, dy: -1em)[base]
annot(<exp>, pos: top + right, dx: 1em)[exponent]
annot-cetz(
<pow>,
cetz,
{
import cetz.draw: *
cetz.decorations.flat-brace(
"pow.south-west",
"pow.south-east",
flip: true,
name: "brace",
stroke: blue,
)
content("brace.south", anchor: "north", text(blue, .9em)[power])
},
)
}