RPIC

The pic family

pic has been reimplemented several times over four decades. rpic sits consciously inside that lineage: Kernighan’s language is the paradigm, dpic is the practical oracle, and Pikchr is a design reference for modern, opt-in extensions.

The implementations

PIC
Brian W. Kernighan · 1981
dpic
J. D. Aplevich · 1990s–
Pikchr
D. Richard Hipp · 2020
rpicthis project
milkway · 2025
ImplementationC · troff preprocessorC · standaloneC · library / CLIRust · library / CLI / WASM
OutputtroffTikZPSTricksSVGPDF+6SVGSVGPNGPDF
Math in labelsvia troff/eqnvia LaTeX backends; SVG mode prints $…$ literallyplain SVG textnative texlabels — KaTeX-grade, no TeX install
Animationstaticstaticstatic SVGdeclarative animate → flat JSON timeline, played by GSAP (fade · pop · draw · slide · move · highlight · morph, + out · stagger · scroll)
define · copy · sh+ command (raw backend text)removed for securitysh/command tolerated, never executed
for · ifremoved
Variable scopingglobalglobalblock-scoped (new-style)global — dpic semantics
Signature additionsbackend constants; powers circuit_macrosfit, behind, margins, new object typesopt-in: margin · canvas · fit · behind · dot · close · brace · hatch · gradient · opacity · rgb()/hex · font attrs · rotated · class · texlabels · animate
Grammar docCSTR #116dpic manualgrammar.mdLanguage spec

How rpic relates to each

PIC (Kernighan). The language itself — the declarative “walk the plane dropping primitives” paradigm, relative placement, compass corners, ordinals, blocks, macros. rpic treats the original papers as the semantic north star and changes nothing about classic meaning.

gpic (groff). GNU’s C++ reimplementation (1990s) and the most widespread pic today — how most people first meet the language, targeting groff and TeX. Feature-wise it tracks classic PIC (macros, for/if, global variables, math typeset by groff), which is why it sits out of the table: read the PIC column and add small groff-isms. Classic rpic sources run under gpic and vice versa, minus each side’s extensions.

dpic (Aplevich). The modern reference implementation with the richest backend set, and the engine behind circuit_macros. When documents are terse, rpic’s behavior is decided by comparing against dpic -v output — the corpus of 72 manual figures renders at parity, and the compatibility audit tracks every boundary (e.g. command/sh are tolerated but never executed).

Pikchr (Hipp). The web-era reimagining: SVG-only, embeddable, with a documented grammar and pragmatic new features — but it deliberately drops classic constructs (copy, sh, for, if) and changes variable scoping, so it is not a drop-in pic. rpic adopts Pikchr’s best ideas as explicit, opt-in extensions (fit, behind, margins, close) while keeping the classic language intact — the adoption matrix records each decision.

References

Original papers (Brian W. Kernighan)

dpic and circuit_macros (J. D. Aplevich)

Pikchr (D. Richard Hipp)

gpic / groff

rpic’s full credits live in ACKNOWLEDGMENTS.md.