Quill is a package for creating quantum circuit diagrams in Typst.
Note, that this package is in beta and may still be undergoing breaking changes. As new features like data types and scoped functions will be added to Typst, this package will be adapted to profit from the new paradigms.
Meanwhile, we suggest importing everything from the package in a local scope to avoid polluting the global namespace (see example below).
Usage
Create circuit diagrams by calling the function quantum-circuit()
with any number of positional arguments — just like the built-in Typst functions table()
or grid()
. A variety of different gate and instruction commands are available and plain numbers can be used to produce any number of empty cells just filled with the current wire mode. A new wire is started by adding the content item [\ ]
.
#{
import "@preview/quill:0.1.0": *
quantum-circuit(
lstick($|0〉$), gate($H$), ctrl(1), rstick($(|00〉+|11〉)/√2$, n: 2), [\ ],
lstick($|0〉$), 1, targ(), 1
)
}
Refer to the user guide for full documentation.
Gallery
Examples
Some show-off examples, loosely replicating figures from Quantum Computation and Quantum Information by M. Nielsen and I. Chuang.