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 | |
|---|---|---|---|---|
| Implementation | C · troff preprocessor | C · standalone | C · library / CLI | Rust · library / CLI / WASM |
| Output | troff | TikZPSTricksSVGPDF+6 | SVG | SVGPNGPDF |
| Math in labels | ✓via troff/eqn | ◐via LaTeX backends; SVG mode prints $…$ literally | ✗plain SVG text | ✓native texlabels — KaTeX-grade, no TeX install |
| Animation | ✗static | ✗static | ✗static SVG | ✓declarative 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 security | ✓sh/command tolerated, never executed |
| for · if | ✓ | ✓ | ✗removed | ✓ |
| Variable scoping | global | global | block-scoped (new-style) | global — dpic semantics |
| Signature additions | — | backend constants; powers circuit_macros | fit, behind, margins, new object types | opt-in: margin · canvas · fit · behind · dot · close · brace · hatch · gradient · opacity · rgb()/hex · font attrs · rotated · class · texlabels · animate |
| Grammar doc | CSTR #116 | dpic manual | grammar.md | Language 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)
- PIC — A Language for Typesetting Graphics. Software—Practice & Experience, vol. 12, no. 1, pp. 1–21, 1982. doi:10.1002/spe.4380120102
- PIC — A Graphics Language for Typesetting, Revised User Manual. Bell Labs Computing Science Technical Report #116, 1984 (rev. 1991). troff.org archive
dpic and circuit_macros (J. D. Aplevich)
- dpic home & manual: ece.uwaterloo.ca/~aplevich/dpic
- Source: gitlab.com/aplevich/dpic
- circuit_macros: gitlab.com/aplevich/circuit_macros
Pikchr (D. Richard Hipp)
- Home: pikchr.org
- Grammar: pikchr.org/…/grammar.md
- Differences from legacy pic: pikchr.org/…/differences.md
gpic / groff
- Making Pictures with GNU pic (Eric S. Raymond), shipped with groff: gnu.org/software/groff
rpic’s full credits live in ACKNOWLEDGMENTS.md.