Author diagrams

Keep engineering labels crisp

Use bounded micro-math scripts and Unicode without a browser text-measurement pass.

sheet
4 / 14
rev
v0.5
sections
2
compiled
2

01 / TextCompose scripts without baseline drift

There is no TeX runtime here, and the labels still read like engineering. Grouped _ and ^ scripts nest, and bounded commands such as \Omega, \pi, \theta, \mu, and \infty resolve to glyphs. Each generated tspan carries an explicit baseline correction, so text following a nested script lands back on the parent baseline rather than drifting. Rotation stops at the vector: the label sits outside the rotated group and stays upright.

source:V1 "V_{in}^{AC}" at (100, 150) #blue [type=voltage-ac]
resistor:R1 "10 k\Omega" right-of V1 by 150 #amber [orientation=down]
qgate:Q1 "R_z" right-of R1 by 160 #purple [parameter="\theta/2" phase="e^{i\phi}"]
port:O1 "f_c = \infty" right-of Q1 by 150 #emerald
compiled by @schemd/core → shown in the rail

Width is estimated, never measured — no font is loaded at any point. The estimator is deterministic and deliberately conservative, and a long label grows the component's bounds before placement is validated. That ordering is what lets the whole thing work without an SSR-incompatible getBBox().

02 / QuantumUse polished custom gate rows

qgate is the escape hatch, and it shares hadamard's exact shell — same stub lengths, corner radius, focus treatment, and ports. Its parameter, phase, and matrix rows grow the body deterministically, so a custom operator can wear its own definition without becoming a different kind of object.

prepare:P "|0\rangle" at (80, 130) #blue
hadamard:H "H" right-of P by 110 #cyan
qgate:U "U" right-of H by 130 #purple [parameter="\theta" matrix="[a,b;c,d]"]
measure:M "M_z" right-of U by 140 #emerald

P.out -> H.in #blue [quantum line]
H.out -> U.in #cyan [quantum line]
U.out -> M.in #purple [quantum line]
compiled by @schemd/core → shown in the rail