typograph-zx

ZX-calculus and continuous-variable ZX-calculus notation for typograph
Author

Benjamin Cichos

1 Introduction

typograph-zx is ZX-calculus and continuous-variable ZX-calculus notation for typograph: spiders, Hadamards, multipliers, states and effects, and Pauli-web/fault-tolerance edge highlighting. It’s a normal consumer of typograph’s public API — a theme, not a fork or an extension of the engine — built entirely from node-type(), edge-type(), and theme(), the same tools available to any theme.

If you haven’t already, read typograph’s own Core Concepts and Theming chapters first — everything here assumes that model. This site covers only what’s specific to this theme: its constructors, its bundled appearance, and how to extend it.

1.1 Install and import

#import "@preview/typograph:0.1.0" as typ
#import "@preview/typograph-zx:0.1.0" as zx
#let diagram = typ.diagram.with(theme: zx.theme)

Both imports are needed: typograph-zx supplies the semantic constructors and the bundled theme value, but the diagram engine itself — diagram(), edge(), node(), group(), and everything else that isn’t ZX-specific — still comes from typograph directly.

1.2 Quick start

zx-quickstart.typ
// Generates docs/img/zx-quickstart.svg — the typograph-zx quick-start diagram.
//   typst compile --root . --ignore-system-fonts docs/img/zx-quickstart.typ docs/img/zx-quickstart.svg
#import "@preview/typograph:0.1.0" as typ
#import "../../src/lib.typ" as zx
#let diagram = typ.diagram.with(theme: zx.theme)
#set page(width: auto, height: auto, margin: 8pt)

#diagram({
  import zx: z, x
  let a = z(0, 0, label: $alpha$)
  let b = x(1, 0)
  typ.edge(a, b)
  typ.edge(a, (-1, 0))
  typ.edge(b, (2, 0))
})

Quick start diagram

An edge automatically contributes the nodes at its endpoints — see Core Concepts for why. z/x here are typograph-zx’s constructors; edge is typograph’s.

1.3 Where to go next

  • Constructors — every node and edge constructor this theme exports.
  • Theme — the bundled palette, node presets, and edge presets, key by key.
  • Extending — restyling a bundled kind, or adding a new one, in a project-owned theme file built on top of this one.