Typst package for drawing diagrams with arrows, built on top of CeTZ.
1,114
stars
640
commits
Typst
primary language
Aug 11, 2026
updated
fletcher (noun) a maker of arrows
A Typst package for drawing diagrams with arrows, built on top of CeTZ.
See the manual for documentation or ask the community for help.
#import "@preview/fletcher:0.5.9" as fletcher: diagram, node, edge
#diagram(cell-size: 15mm, $
G edge(f, ->) edge("d", pi, ->>) & im(f) \
G slash ker(f) edge("ur", tilde(f), "hook-->")
$)
// https://xkcd.com/1195/
#import fletcher.shapes: diamond
#set text(font: "Comic Neue", weight: 600) // testing: omit
#diagram(
node-stroke: 1pt,
node((0,0), [Start], corner-radius: 2pt, extrude: (0, 3)),
edge("-|>"),
node((0,1), align(center)[
Hey, wait,\ this flowchart\ is a trap!
], shape: diamond),
edge("d,r,u,l", "-|>", [Yes], label-pos: 0.1)
)
#set text(10pt)
#diagram(
node-stroke: .1em,
node-fill: gradient.radial(blue.lighten(80%), blue, center: (30%, 20%), radius: 80%),
spacing: 4em,
edge((-1,0), "r", "-|>", `open(path)`, label-pos: 0, label-side: center),
node((0,0), `reading`, radius: 2em),
edge(`read()`, "-|>"),
node((1,0), `eof`, radius: 2em),
edge(`close()`, "-|>"),
node((2,0), `closed`, radius: 2em, extrude: (-2.5, 0)),
edge((0,0), (0,0), `read()`, "--|>", bend: 130deg),
edge((0,0), (2,0), `close()`, "-|>", bend: -40deg),
)
#diagram($
e^- edge("rd", "-<|-") & & & edge("ld", "-|>-") e^+ \
& edge(gamma, "wave") \
e^+ edge("ru", "-|>-") & & & edge("lu", "-<|-") e^- \
$)
Pull requests are most welcome!
"[", "]", "(", ")", "bracket", "parenthesis" (#102).cylinder, brace, bracket, paren and stretched-glyph node shapes (#99, #109).(segment, position) (#107, #112, @deffi).cetz dependency to 0.3.4 fixing bugs with typst version 0.13.1 (#89, #90, #91).typst version >=0.13.0.cetz dependency to 0.3.3.floating option to edge() to make certain objects not affect the diagram's bounds (#38).debug annotations "floating" so they don't affect diagram size and layout.cetz dependency to 0.3.2. line style for empty stroke (#70).label-side for corner edges (#74).label-pos option of edge() (#61).axes options (#62, #66).edge(<a.east>, ..).stroke: none set on polyline edges (#60, @SillyFreak).axes options (#62, #66).typst version >=0.12.0.cetz dependency to 0.3.1. Note: This may slightly change edge label positions.loop-angle option to edge() (#36).enclose absolute coordinates.enclose option.edge("r,r") or edge("r,l")) and enhance the way the corner radius adapts to the bend angle. Note: This may change diagram layout from previous versions.n (many), n? (zero or more), n! (one or more), 1 (one), 1? (zero or one), 1! (exactly one).node-shape option to diagram().label-angle option to edge().label-wrapper option to allow changing the label inset, outline stroke, and so on (#26).label-size option to control default edge label text size (#35)trapezium node shape.edge() (to eliminate ambiguity). Used named argument or pass content instead.fit and dir options to various node shapes to adjust sizing and orientation.snap-to to be none to disable edge snapping (#32).enclose option of node().align().layer option to nodes and edges to control drawing order.ellipse, octagon.fletcher.hide() to hide elements with/without affecting layout, useful for incremental diagrams in slides (#15).shifting edges by coordinate deltas as well as absolute lengths (#13).snap-to option to edge().inset being half the amount specified. If upgrading from previous version, you will need to divide node inset values by two to preserve diagram layout.decorations option to edge() for CeTZ path decorations ("wave", "zigzag", and "coil", also accepted as positional string arguments).shapes submodule, containing diamond, pill, parallelogram, hexagon, and other node shapes.vertices an corner-radius options to edge()."r,u,ll".dodge option to edge() to adjust end points.cetz:0.2.0.& to separate nodes.edge("d") becomes edge(prev-node, (0, 1)).|->-| and hook-/->>.}>, <{, /, \, x, X, * (solid dot), @ (solid circle).axes option to diagram() to control the direction of each axis in the diagram's coordinate system.width, height and radius options to node() for explicit control over size.corner-radius option to node().stroke option to edge() replacing thickness and paint options.edge-stroke option to diagram() replacing edge-thickness.<|-, -|> and double-bar ||-, -||.extrude option to node() which duplicates and extrudes the node's stroke, enabling double stroke effects.edge(..., corner: left/right).Typst
97.8%
Nushell
2.2%
Typst package for drawing diagrams with arrows, built on top of CeTZ.
1,114
stars
640
commits
Typst
primary language
Aug 11, 2026
updated
fletcher (noun) a maker of arrows
A Typst package for drawing diagrams with arrows, built on top of CeTZ.
See the manual for documentation or ask the community for help.
#import "@preview/fletcher:0.5.9" as fletcher: diagram, node, edge
#diagram(cell-size: 15mm, $
G edge(f, ->) edge("d", pi, ->>) & im(f) \
G slash ker(f) edge("ur", tilde(f), "hook-->")
$)
// https://xkcd.com/1195/
#import fletcher.shapes: diamond
#set text(font: "Comic Neue", weight: 600) // testing: omit
#diagram(
node-stroke: 1pt,
node((0,0), [Start], corner-radius: 2pt, extrude: (0, 3)),
edge("-|>"),
node((0,1), align(center)[
Hey, wait,\ this flowchart\ is a trap!
], shape: diamond),
edge("d,r,u,l", "-|>", [Yes], label-pos: 0.1)
)
#set text(10pt)
#diagram(
node-stroke: .1em,
node-fill: gradient.radial(blue.lighten(80%), blue, center: (30%, 20%), radius: 80%),
spacing: 4em,
edge((-1,0), "r", "-|>", `open(path)`, label-pos: 0, label-side: center),
node((0,0), `reading`, radius: 2em),
edge(`read()`, "-|>"),
node((1,0), `eof`, radius: 2em),
edge(`close()`, "-|>"),
node((2,0), `closed`, radius: 2em, extrude: (-2.5, 0)),
edge((0,0), (0,0), `read()`, "--|>", bend: 130deg),
edge((0,0), (2,0), `close()`, "-|>", bend: -40deg),
)
#diagram($
e^- edge("rd", "-<|-") & & & edge("ld", "-|>-") e^+ \
& edge(gamma, "wave") \
e^+ edge("ru", "-|>-") & & & edge("lu", "-<|-") e^- \
$)
Pull requests are most welcome!
"[", "]", "(", ")", "bracket", "parenthesis" (#102).cylinder, brace, bracket, paren and stretched-glyph node shapes (#99, #109).(segment, position) (#107, #112, @deffi).cetz dependency to 0.3.4 fixing bugs with typst version 0.13.1 (#89, #90, #91).typst version >=0.13.0.cetz dependency to 0.3.3.floating option to edge() to make certain objects not affect the diagram's bounds (#38).debug annotations "floating" so they don't affect diagram size and layout.cetz dependency to 0.3.2. line style for empty stroke (#70).label-side for corner edges (#74).label-pos option of edge() (#61).axes options (#62, #66).edge(<a.east>, ..).stroke: none set on polyline edges (#60, @SillyFreak).axes options (#62, #66).typst version >=0.12.0.cetz dependency to 0.3.1. Note: This may slightly change edge label positions.loop-angle option to edge() (#36).enclose absolute coordinates.enclose option.edge("r,r") or edge("r,l")) and enhance the way the corner radius adapts to the bend angle. Note: This may change diagram layout from previous versions.n (many), n? (zero or more), n! (one or more), 1 (one), 1? (zero or one), 1! (exactly one).node-shape option to diagram().label-angle option to edge().label-wrapper option to allow changing the label inset, outline stroke, and so on (#26).label-size option to control default edge label text size (#35)trapezium node shape.edge() (to eliminate ambiguity). Used named argument or pass content instead.fit and dir options to various node shapes to adjust sizing and orientation.snap-to to be none to disable edge snapping (#32).enclose option of node().align().layer option to nodes and edges to control drawing order.ellipse, octagon.fletcher.hide() to hide elements with/without affecting layout, useful for incremental diagrams in slides (#15).shifting edges by coordinate deltas as well as absolute lengths (#13).snap-to option to edge().inset being half the amount specified. If upgrading from previous version, you will need to divide node inset values by two to preserve diagram layout.decorations option to edge() for CeTZ path decorations ("wave", "zigzag", and "coil", also accepted as positional string arguments).shapes submodule, containing diamond, pill, parallelogram, hexagon, and other node shapes.vertices an corner-radius options to edge()."r,u,ll".dodge option to edge() to adjust end points.cetz:0.2.0.& to separate nodes.edge("d") becomes edge(prev-node, (0, 1)).|->-| and hook-/->>.}>, <{, /, \, x, X, * (solid dot), @ (solid circle).axes option to diagram() to control the direction of each axis in the diagram's coordinate system.width, height and radius options to node() for explicit control over size.corner-radius option to node().stroke option to edge() replacing thickness and paint options.edge-stroke option to diagram() replacing edge-thickness.<|-, -|> and double-bar ||-, -||.extrude option to node() which duplicates and extrudes the node's stroke, enabling double stroke effects.edge(..., corner: left/right).Typst
97.8%
Nushell
2.2%