Author diagrams

Keep engineering labels crisp

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

sheet
3 / 13
rev
v0.4
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" at (330, 150) #amber [orientation=down]
qgate:Q1 "R_z" at (570, 150) #purple [parameter="\theta/2" phase="e^{i\phi}"]
port:O1 "f_c = \infty" at (800, 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" at (260, 130) #cyan
qgate:U "U" at (470, 130) #purple [parameter="\theta" matrix="[a,b;c,d]"]
measure:M "M_z" at (690, 130) #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