f"![Version](https://img.shields.io/badge/version-{get_version()}-green)"
fletcher (noun) a maker of arrows
A Typst package for drawing diagrams with arrows, built on top of CeTZ. See the manual for documentation.
f"""
```typ
#import "@preview/fletcher:{get_version()}" as fletcher: diagram, node, edge
```
"""
# These are examples in `docs/example-gallery/*.typ`
'\n'.join(insert_example_block(name) for name in [
"first-isomorphism-theorem",
"flowchart-trap",
"state-machine",
"feynman-diagram",
])
Pull requests are most welcome!
# These are examples in `docs/gallery/*.typ`
insert_example_table([
"commutative",
"algebra-cube",
"ml-architecture",
"io-flowchart",
"digraph",
"node-groups",
"uml-diagram",
])
- Require
typst
version>=0.12.0
. - Update
cetz
dependency to0.3.1
. Note: This may slightly change edge label positions. - Add
loop-angle
option toedge()
(#36).
- Fix nodes which
enclose
absolute coordinates. - Allow CeTZ-style coordinate expressions in node
enclose
option. - Fix crash with polar coordinates.
- Fix edges which bend at 0deg or 180deg (e.g.,
edge("r,r")
oredge("r,l")
) and enhance the way the corner radius adapts to the bend angle. Note: This may change diagram layout from previous versions. - Improve error messages.
- Add marks for crow's foot notation:
n
(many),n?
(zero or more),n!
(one or more),1
(one),1?
(zero or one),1!
(exactly one). - Add
node-shape
option todiagram()
.
- Greatly enhance coordinate system.
- Support CeTZ-style coordinate expressions (relative, polar, interpolating, named coordinates, etc).
- Absolute coordinates (physical lengths) can be used alongside "elastic" coordinates (row/column positions).
- Add
label-angle
option toedge()
. - Add
label-wrapper
option to allow changing the label inset, outline stroke, and so on (#26). - Add
label-size
option to control default edge label text size (#35) - Add
trapezium
node shape. - Disallow string labels to be passed as positional arguments to
edge()
(to eliminate ambiguity). Used named argument or pass content instead.
- Add isosceles triangle node shape (#31).
- Add
fit
anddir
options to various node shapes to adjust sizing and orientation. - Allow more than one consecutive edge to have an implicit end vertex.
- Allow
snap-to
to benone
to disable edge snapping (#32).
- Support fully customisable marks/arrowheads!
- Added new mark styles and tweaked some existing defaults. Note. This may change the micro-typography of diagrams from previous versions.
- Add node groups via the
enclose
option ofnode()
. - Node labels can be aligned inside the node with
align()
. - Node labels wrap naturally when label text is wider than the node. Note: This may change diagram layout from previous versions.
- Add a
layer
option to nodes and edges to control drawing order. - Add node shapes:
ellipse
,octagon
.
- Fixed edge crossing backgrounds being drawn above nodes (#14).
- Add
fletcher.hide()
to hide elements with/without affecting layout, useful for incremental diagrams in slides (#15). - Support
shift
ing edges by coordinate deltas as well as absolute lengths (#13). - Support node names (#8).
- Improve edge-to-node snapping. Edges can terminate anywhere near a node (not just at its center) and will automatically snap to the node outline. Added
snap-to
option toedge()
. - Fix node
inset
being half the amount specified. If upgrading from previous version, you will need to divide nodeinset
values by two to preserve diagram layout. - Add
decorations
option toedge()
for CeTZ path decorations ("wave"
,"zigzag"
, and"coil"
, also accepted as positional string arguments).
- Support custom node shapes! Edges connect to node outlines automatically.
- New
shapes
submodule, containingdiamond
,pill
,parallelogram
,hexagon
, and other node shapes.
- New
- Allow edges to have multiple segments.
- Add
vertices
ancorner-radius
options toedge()
. - Relative coordinate shorthands may be comma separated to signify multiple segments, e.g.,
"r,u,ll"
.
- Add
- Add
dodge
option toedge()
to adjust end points. - Support
cetz:0.2.0
.
- Add ability to specify diagrams in math-mode, using
&
to separate nodes. - Allow implicit and relative edge coordinates, e.g.,
edge("d")
becomesedge(prev-node, (0, 1))
. - Add ability to place marks anywhere along an edge. Shorthands now accept an optional middle mark, for example
|->-|
andhook-/->>
. - Add “hanging tail” correction to marks on curved edges. Marks now rotate a bit to fit more comfortably along tightly curving arcs.
- Add more arrowheads for the sake of it:
}>
,<{
,/
,\
,x
,X
,*
(solid dot),@
(solid circle). - Add
axes
option todiagram()
to control the direction of each axis in the diagram's coordinate system. - Add
width
,height
andradius
options tonode()
for explicit control over size. - Add
corner-radius
option tonode()
. - Add
stroke
option toedge()
replacingthickness
andpaint
options. - Add
edge-stroke
option todiagram()
replacingedge-thickness
.
- Make round-style arrow heads better approximate the default math font.
- Add solid arrow heads with shorthand
<|-
,-|>
and double-bar||-
,-||
. - Add an
extrude
option tonode()
which duplicates and extrudes the node's stroke, enabling double stroke effects.
- Experimental support for customising arrowheads.
- Add right-angled edges with
edge(..., corner: left/right)
.