finite is a Typst package for rendering finite automata on top of CeTZ.
For Typst 0.6.0 or later, import the package from the typst preview repository:
#import "@preview/finite:0.3.1": automaton
After importing the package, simply call #automaton()
with a dictionary holding a transition table:
#import "@preview/finite:0.3.1": automaton
#automaton((
q0: (q1:0, q0:"0,1"),
q1: (q0:(0,1), q2:"0"),
q2: (),
))
The output should look like this:
See manual.pdf
for a full manual of the package.
The documentation is created using Mantys, a Typst template for creating package documentation.
To compile the manual, Mantys needs to be available as a local package. Refer to Mantys' manual for instructions on how to do so.
stroke
sets a stroke for the marking.scale
scales the marking by a factor.automaton
command:
label-format
argument to state-format
and input-format
.layout
can now take a dictionary with (state
: coordinate
) pairs to position states.#powerset
command, to transform a NFA into a DFA.#add-trap
command, to complete a partial DFA.#accepts
command, to test a word against an NFA or DFA.transpose-table
and get-inputs
utilities.curve
option to be the height of the arc of the transition.
rest
key to custom layouts.