Author diagrams
Write compact math labels
Use nested scripts and common symbols without shipping a TeX runtime.
- sheet
- 3 / 11
- rev
- v0.2
- sections
- 2
- compiled
- 2
01 / ScriptsUse subscripts and superscripts
There is no TeX runtime anywhere in schemd, and the labels still read like engineering. Use _x or ^2 to shift one character, braces when the script is a group: V_{out}, f^{2n}, or the deliberately awkward A_{x_{sub}}.
Scripts nest, and that is the trick worth understanding. Each group carries its own scale and baseline, so when a nested script ends the next run of text drops back onto the parent baseline exactly where the eye expects it — no drift, no manual kerning.
port:VIN "V_{in} = 1 V" at (80, 160) #blue
resistor:R1 "R_{load} = 10 k\Omega" at (335, 160) #amber
capacitor:C1 "C_f e^{x^2}" at (590, 160) #cyan
port:VOUT "A_{x_{sub}} done" at (840, 160) #emerald
VIN.out -> R1.in #blue [line]
R1.out -> C1.in #amber [line]
C1.out -> VOUT.in #emerald [line marker-end=arrow]02 / SymbolsUse the built-in commands or raw Unicode
The common commands are all here — \alpha, \beta, \Delta, \lambda, \mu, \Omega, \omega, \phi, \pi, \sigma, \theta, \cdot, \times, \pm, \le, \ge, \neq, \infty, \sqrt, \rightarrow — and raw Unicode works just as well when we would rather paste the glyph.
For a literal character, escape it: \\, \{, \}, \_, \^. An unknown command is a non-event by design, staying visible as text rather than leaking into markup, and every label is escaped before it reaches the document — so a stray < can never become a tag.
One honest caveat: width is estimated, not measured, because no font is ever loaded. Wide Unicode gets a conservative allowance, but exact glyph metrics belong to whatever font the browser finally paints with.
port:QIN "|\psi_0〉 = |0〉" at (80, 170) #slate
hadamard:H1 "H: |0〉 \rightarrow |+〉" at (330, 170) #purple
qgate:RY1 "R_y(\theta)" at (600, 170) #cyan [parameter="\theta = \pi/2" phase="\phi = \pi/4"]
port:QOUT "|\psi_1〉" at (810, 170) #emerald
QIN.out -> H1.in #slate [line]
H1.out -> RY1.in #purple [line]
RY1.out -> QOUT.in #emerald [line marker-end=arrow]