Status: proposal.
Written for someone deciding what to build next in the figure system, or deciding whether a proposal already considered here is worth re-opening. The first section lists what exists. Every open subsection after it is sized to become one feature request on its own. Nothing here has been measured on the corpus unless a section says so explicitly and names the artefact that holds the number.
Scope decision that shapes everything. This project will mostly be used to write technical books in engineering, computer science and software engineering, optimising for the tutorial and textbook-chapter genres, without restricting the thesis-chapter genre. Several proposals that would be correct for a life-sciences or an empirical-results pipeline are wrong here. They are recorded in Considered and set aside instead of deleted, so nobody has to re-derive the argument.
Each row was once a proposal on this page, or the reason for one. The page that documents it now is in the last column. A proposal that duplicates one of these is not worth filing.
| Item | What exists | Documented in |
|---|---|---|
| Scaffolds | Eleven known-good scaffolds in assets/tikz/, one per layout, each with its ASCII twin and a % cg-layout: line: pipeline, map, layered stack, control loop, branching tree, hub-and-spoke network, zoned spine, state machine, comparison, sequence and timeline |
assets/tikz/README.md |
| Sequence diagram (was II.2) | The sequence layout: lifelines, level messages, dashed replies |
TIKZ-STYLE.md |
| State machine (was II.4) | The state-machine layout in pure TikZ (cgstate, cgaccept, cgstart), with a transition table as its twin |
TIKZ-STYLE.md |
| Comparison and timeline | Two more layouts: matched parts in two panels, and events placed by fraction along a time axis | TIKZ-STYLE.md |
| Exemplars (part of VI.4) | Seven finished figures in assets/tikz/exemplars/, laid out to the render's 453pt |
assets/tikz/README.md |
| House style block | assets/tikz/cg-figstyle.tex: the Okabe-Ito palette, a Line and a Text shade per hue that clear WCAG 3:1 and 4.5:1, node roles, zone cards, edges, tags and compact spacing. Every figure carries it |
TIKZ-STYLE.md |
| Domain shapes (was V.2) | Five house pics (store, docs, funnel, chip, shield), each drawn into a named cgwell. They travel inside the house block, so a figure stays one self-contained file |
TIKZ-STYLE.md |
figure sync |
Stamps and refreshes the house block in figure files, and refuses to touch a block edited by hand | CLI.md |
figure new and figure look |
Start a figure from a scaffold; see it alone on the render's page, or on the draft's own page | CLI.md |
figure check |
36 numbered rules (28 objective, 8 advisory) with reasoned % cg-allow: exceptions. It covers routing (was VI.5: c1 to c7), contrast, the type floor, off-palette colours and tints, wording, and agreement between a figure and its twin |
figure-checks/README.md |
| Element counts (most of VI.3) | Node and edge counts, height and slack, reported beside each layout's reference range and never as a cap | figure-checks/SIZE.md |
| Per-layout reference files (was II.0) | One file per layout with its anti-patterns and reference ranges, and a pattern-to-layout router, under .claude/skills/figure-drawer/references/ rather than docs/figures/ |
FIGURE-DRAWER.md |
| Taste gate and anti-patterns (was VI.6) | Questions the skill answers before drawing anything, and a named anti-pattern list per layout | FIGURE-DRAWER.md |
The figure-drawer skill |
One skill that every genre hands a figure to | FIGURE-DRAWER.md |
| Panels, numbering and captions | Panel letters in both forms; the renderer numbers figures; prose points via <!-- figureref: name -->; a figure with no caption is reported |
WRITING-STANDARDS.md ยง10 |
Millimetres inside a pic |
Relative placement governs composition; explicit coordinates are allowed inside a pic definition |
TIKZ-STYLE.md |
| The twin as a representation | A twin is the clearest 7-bit form of the information, not a tracing: state-machine.txt is a transition table |
assets/tikz/README.md |
| Source-figure crops | Source-PDF figure crops, and draft figures <citekey> to look at them while drafting |
CLI.md |
The open parts below have to preserve three properties:
md, docx and html output render only the twin
(WRITING-STANDARDS.md ยง10).figure check compiles the
figure with LuaLaTeX and reads back where every node and line landed.
It never moves anything.figure check exits 0 whatever it finds, and
the feature-request template carries a standing checkbox against
promoting a new check into one.And these facts about the tree:
figureref,
equationref and tableref. There is no listing or algorithm class.\usepackage{tikz} plus the union of the
\usetikzlibrary names its figure files ask for (#781),
conditionally, via header-includes in core/draft/render_output/_pandoc.py.
fvextra is added by the same mechanism for a draft with a code block.\usetikzlibrary is legal in the document body, so figure files
name the libraries they need and the renderer hoists them into the
preamble; loading one inside the figure float is #781's bug, since
a float is a group. \usepackage is not body-legal at all, which makes
any new package a renderer change and not a figure-file change.pgfplots, no matplotlib, no data file and no axis
anywhere in the figure path._pandoc.py sets
--resource-path so the PDF and DOCX writers can resolve Markdown's
image syntax pointed at a raster file. What is missing is the
contract, not the plumbing: such an image gets no number, no
marker, no twin, no caption check.The eleven layouts cover connection (pipeline, stack, loop, tree, hub, spine, state machine), comparison (map, comparison) and order in time (sequence, timeline). Three forms that carry much of the load in a CS or SE textbook are still not expressible:
Two further observations change the problem for this domain, and both make it easier:
Illustration craft is not the bottleneck here. A cell has no canonical visual form, which is why a life-sciences textbook needs a trained illustrator. A red-black tree rotation, a TCP header, a five-stage pipeline and a UML sequence diagram all have conventional, agreed renderings made of lines and text. These figures are natively TikZ-shaped. The reachable ceiling in this domain is far higher than in biology and needs no illustrator, no licensed art and no raster.
The ASCII twin stops being a constraint. ASCII diagrams are a native idiom in this field; RFC 793's TCP header is one. Box-and-pointer diagrams, layered stacks, bit-field layouts and state machines all render faithfully in 7-bit. The rule that would cap a biology pipeline is nearly free here, and the roadmap below should be read as endorsing it, not working around it.
A code listing is typographically handled: _pandoc.py detects
has_code_block and loads fvextra with breaklines so an over-wide
verbatim line wraps instead of running into the margin. But a listing
cannot be numbered or referenced. In a technical book, "Listing 4.2
shows the retry loop" is as frequent as "Figure 4.2 shows". With no
class, an author either hand-numbers it, which is the failure the
figure and equation numbering contracts existed to eliminate, or writes
"the code above", which breaks the moment a page splits or a section is
reordered.
The same argument holds for a pseudocode algorithm, which in this
literature is a distinct artefact from both a listing and a figure.
WRITING-STANDARDS.md already has to reason about pseudocode as a
special case (the seven-line pseudocode listing that is the shortest
false positive for one of its checks), which is a sign the concept is
already relied on without being a first-class artefact class.
Add listingref and algorithmref alongside the three existing classes,
with the identical contract:
<!-- listingref: name --> /
<!-- algorithmref: name -->.md route can express the distinction
at all.It is a correctness gap, not a quality one. It is also the smallest item on this roadmap, and Parts III and IV both want a stable marker vocabulary underneath them.
Each subsection below is one new row in TIKZ-STYLE.md's metaphor table
plus one scaffold in assets/tikz/, and each is independently
fileable. tests/core/figure/test_tikz_scaffolds.py already enforces that the table,
the directory and the per-layout reference files agree, so a row cannot
ship without a scaffold and a reference file.
Common requirements for all of them:
% cg-layout: line, and reports no finding from figure check.pic definition.(name), so a finding can name it.\usetikzlibrary load sits at the top of the figure file, above
the tikzpicture, which is where the renderer reads it from (#781)
and what makes the scaffold compile standalone.chitragupta/core/figure/_rules.py, with the reason.The form. One structure, N snapshots, differences marked. The single most common figure in the algorithms literature and the highest-value addition on this roadmap.
Why it is not just panels. Panel lettering letters panels as siblings. A snapshot is not a sibling: it has an ordinal, a predecessor, and a delta from it. The figure's whole meaning is the difference between adjacent frames, and a reader needs to see which nodes changed.
Mechanism. The sound version is a pic (see Part V) drawn once per
frame with a per-frame highlight set, laid out left to right or in
wrapped rows, with the changed elements taking the accent colour. Without
pic reuse the author redraws the structure N times by hand and the
frames drift, which is the defect this metaphor exists to prevent. This
subsection therefore depends on Part V and should not be filed before
it.
Twin strategy. N ASCII frames stacked vertically, each with its ordinal, and the changed elements marked with a character instead of a colour. This works, and is arguably clearer than the TikZ form.
Element counts do not apply here. Whatever reference range a pipeline's scaffold sets, a DP-table trace legitimately has forty cells. The per-metaphor range is the point; a single global budget would be wrong for exactly this metaphor.
Open question. Whether the highlight-the-delta step can be derived instead of hand-specified. Given frames as data (Part III), the delta is a set difference, so a derived trace could mark its own changes. That is the strongest single argument for Part III.
The form. A packet header, a struct, a stack frame, a page-table entry. Fields drawn to scale so width carries meaning.
Mechanism. This is closer to a table with geometry than to a diagram.
The bytefield package does it natively and is the obvious candidate,
but it is a \usepackage, which makes this a renderer change on the
same conditional header-includes pattern as tikz and fvextra. A pure
TikZ matrix-based scaffold avoids the dependency at the cost of doing
the width arithmetic by hand. Decide which before filing; the
bytefield route is probably right but it changes the shape of the
issue.
Twin strategy. Native and excellent. This is exactly what RFC-style ASCII diagrams do best.
A geometric check this metaphor uniquely permits. A bit-field figure
makes a claim no other metaphor makes: width is the encoding. That
claim is checkable. Given the declared bit width in each field's label,
figure check could compare each field's drawn width against its share of the
total and report the discrepancy. Two details decide whether it is
useful:
This is the strongest deterministic figure check on the roadmap and is a better version of Part IV's correspondence idea, because it compares the figure against itself and not against prose.
Correspondence opportunity. A bit-field figure usually depicts a struct or a spec table that also appears in the chapter as code. Field names and widths are checkable against it. See Part IV.
The form. One axis is time, the other is a resource or an instruction. Pipeline stage diagrams, scheduler traces, Gantt-shaped occupancy.
Mechanism. A matrix of cells, or pgfgantt if a dependency is
acceptable. The matrix route probably suffices and keeps the
dependency list flat.
Twin strategy. Native. A character grid is the conventional ASCII form for this and appears in architecture texts directly.
The form. Linked structures with real pointer arrows: linked lists, trees with parent pointers, SICP environment diagrams, CS:APP stack frames.
Mechanism. positioning plus fit, with a pic per cell (Part V).
The distinguishing requirement is that an arrow must start from a
specific compartment of a node instead of from the node's edge, which
means named sub-anchors, which means the cell wants to be a pic with
declared anchors.
Twin strategy. Native, and a long-standing idiom.
The form. Labels sitting outside the drawing, connected by hairlines to precise anchor points; and a magnified inset of one region with connecting lines to its source.
Why it is here even though it came from the biology discussion. It generalises. A datapath schematic with labelled buses, a screenshot with callouts, a code listing with leader lines pointing at specific tokens are all the same form, and none of the eleven layouts can express it because text lives inside boxes.
It is a primitive, not a metaphor. Annotation
composes with every other metaphor instead of competing with them. A
sequence diagram can carry a callout; so can a bit-field. Filing it as a
new row in the selection table would be a category error and would
push authors to choose it instead of the right metaphor. It belongs in
Part V's library as an annotation pic, with a line in the shared rules
instead of a metaphor row of its own.
Mechanism. pin and the quotes library for leader lines; TikZ's
spy library for the magnification callout. Both ship in
texlive-pictures.
Twin strategy. A label list with each label's relation to the object. Not character art.
Budget. Two callouts per figure is a reasonable starting reference range; past that the labels are competing with the drawing. Report, never gate.
The form. Items placed in four cells formed by two named axes. The
map layout covers two axes already; a quadrant names the four cells
and gives each a meaning of its own.
Status. Planned with the comparison, state-machine, sequence and timeline scaffolds, and deferred because no figure in the reference book needs it yet (#1060).
In this domain a figure usually depicts something that also exists as text elsewhere in the chapter: a transition table, a grammar, a struct definition, pseudocode, a spec, a real import graph. Instead of asking an author or a model to draw the automaton, derive it from the transition table. Instead of hand-drawing a DP-table trace, run the algorithm and emit the frames.
This is the same move the project already made for citekeys: stop generating the artefact, derive it from a source of truth, and refuse to guess. A derived figure is regenerable, auditable, and cannot drift from the text.
No life-sciences pipeline can do this, because there is no ground truth to derive from. This one has ground truth on nearly every page. It is the most distinctive feature available here and the reason to prefer this roadmap over "draw prettier boxes".
| Source of truth | Derived figure | Notes |
|---|---|---|
| Transition table | State machine (the state-machine layout) |
Fully determined. The obvious first one |
| Struct / spec table | Bit-field layout (II.3) | Widths and names both come from the source, and II.3's width check then verifies the derivation against its own source |
| Frame list or algorithm run | State sequence (II.1) | Also derives the per-frame delta highlight, which is otherwise hand-specified and error-prone |
| Grammar (BNF) | Parse tree / railroad diagram | Well-trodden ground; many existing generators to read first |
| Message log or protocol spec | Sequence diagram (the sequence layout) |
Ordering is the whole content and is machine-readable |
| Real source imports | Dependency graph | Needs the reduction ladder below before it is worth filing |
A real import graph is too dense to be a teaching figure without a
filtering story. Here is one, borrowed wholesale in shape from
diagram-design's import path.
A fixed reduction ladder, applied in a fixed order until the figure falls inside its metaphor's reference range: drop decorative and unconnected elements, then merge duplicates, then collapse leaf clusters into a single labelled node, then drop infrastructure that every node touches. Fixed order matters more than the specific rungs: it makes the reduction deterministic and therefore re-runnable, which is the whole reason a derived figure is worth more than a drawn one.
Every derivation emits a ledger naming what it merged, collapsed and dropped, and what it kept in full. Something like:
Derived: dependency graph from src/chitragupta/review/
Reduction: 41 source modules โ 9 drawn
Collapsed: 6 leaf modules under review.figure_layout โ one node
Merged: _probe.py + _probe_util.py (always co-imported)
Dropped: 4 test-only modules; stdlib imports
Kept in full: the render_output โ _pandoc โ figure path
The ledger is worth more for a derived figure than for an imported one, because it is the audit trail that makes the derivation trustworthy to a reader who did not run it. It also partly answers the idempotence problem below: a regeneration whose ledger is unchanged produced the same figure, and a ledger diff is readable in a way a TikZ diff is not.
Where the ledger lives needs deciding. Beside the figure as
figures/<n>.ledger, or as a comment block inside the .tex. The second
keeps the fragment-portability property; the first is easier to diff. Pin
this before the first derivation ships.
figures/<n>.tex and its twin, which then go through figure check,
the caption check and numbering unchanged. It must not become a
parallel figure path with its own rules.Figureโtext divergence is the characteristic defect of technical books.
The figure shows five pipeline stages and the prose says four. The state
machine has a transition the table lacks. The struct diagram is one field
out of date. All three are invisible to every check this project has:
figure check measures geometry and compares the figure with its own
ASCII twin, never with the prose; the verbatim tiers scan prose and never
see inside a figure file; and the caption check only asks whether a
caption exists.
No other domain offers this affordance. Nobody can validate a life-sciences illustration against ground truth. Here you frequently can, because the figure's labels are identifiers that appear in the adjacent listing, table or prose.
A review aid that reports, per figure, the two-way set difference:
Both directions matter. The first catches a stale or invented label; the second catches a figure that has fallen behind the text.
figure check's nothing-measurable does.figure check's twin rules already
extract a node label's first line, zone titles and legend entries
from the source; the same extraction is the starting point here.figureref marker, or the whole chapter. The first is tighter and
probably right, but a figure referenced from two sections breaks the
assumption.page_table, pageTable and
"page table" are the same identifier to a reader. Deciding this wrong
makes the check useless in either direction.The house block already carries five pics, each standing for a
conventional shape whose node label says the same thing
(TIKZ-STYLE.md).
They travel inside the block, so every figure stays one self-contained
file. What is still missing is the structural vocabulary a CS book draws
over and over.
pic libraryA set of reusable TikZ pics for structures, not icons. Candidate
vocabulary for this domain: a memory cell with named compartments, a
queue, a stack frame, a node-with-pointer-slots, a clock tick, a
lifeline, a labelled bus, a register, and the annotation callout
promoted out of II.7.
pic pays out in every
figure that uses it, across a whole book. Nothing else on this
roadmap has that property.\pic{cell} at (head.east) correctly is easy. Placing forty control
points blind is not.A shared library is state across figures, which cuts against the rule
that a figure file must be self-contained and \input-able into a
foreign thesis. assets/ is already copied into a project by
chitragupta init, so shipping the library as a single file the figure
\inputs keeps it beside a scaffolded draft with nothing to download.
But a figure lifted out of the project and dropped into someone else's
document now needs two files instead of one, and the fragment-portability
property is real and deliberate. Options, in rough order of preference:
pics travel today, at the cost of a
larger block in every figure.pic definitions into the figure at authoring time,
trading duplication for portability.This decision should be made before any structural pic ships,
because reversing it means rewriting every figure that used it.
The test for adding a pic is the one the house shapes already pass:
the twin must be able to say the same thing in words. A drum labelled
page table and the twin's [page table] carry the same proposition,
so the shape is a rendering choice. A shape carrying meaning the label
does not is a twin violation, whatever it is drawn with.
Cheap items that raise the quality of existing figures without a new layout.
The caption-presence check asks only that a caption exists. A good
technical caption is self-contained and states the takeaway as well as
the subject: "the write path, showing where the fsync barrier falls"
instead of "the write path". Captions currently escape HOUSE-STYLE.md's
objective function entirely, because they live in markers and not in
prose.
Proposal. A caption-shape aid reporting a caption under some word count, or one that names its subject without asserting anything. Report, never gate; a very short caption is sometimes right. This is the highest ratio of informativeness gained to code written on the whole roadmap, because it raises figure quality without drawing anything.
To settle: whether the prose objective function can be applied to caption text directly, or whether captions need their own smaller predicate.
TIKZ-STYLE.md names the defect precisely (\footnotesize inside a
picture scaled to 0.8). figure check's type-below-floor reports text
set below the 12pt body size, read from the glyphs, but it measures the
figure at its natural size. The scale a draft applies, and the column it
lands in, are not measured.
Proposal. Report it as a number: "smallest label prints at 4.2 pt at an 84 mm column". That turns a documented defect into a measurement, with no threshold and no verdict.
It depends on Part X. The target column width is a property of the output, and the figure file does not know it. Part X's named output targets supply it.
figure check reports node and edge counts, height and slack beside the
range each layout's scaffold and exemplars measure, as advisory reports
that never cap a figure
(figure-checks/SIZE.md). Distinct colours and
words of text are not counted.
To settle: whether "distinct colours used" should count palette members only or every colour expression appearing in the source. The second is easier and noisier.
assets/tikz/exemplars/ holds seven finished figures for eleven layouts.
Skeletons produce skeletal figures: an author who copies a three-node
pipeline tends to ship a three-node pipeline.
Proposal. One finished figure per layout: fully labelled, real content from this domain, at final column width, with a caption that states a takeaway. The scaffold stays the starting point; the exemplar becomes the target. The reference ranges VI.3 reports are measured from the scaffold and its exemplars, so each new exemplar also widens its layout's range.
It needs no new code. tests/core/figure/test_tikz_scaffolds.py already keeps
the exemplars compiling and fitting the render's width.
No pgfplots, no matplotlib, no data file, no axis anywhere. Benchmark
curves, latency distributions, complexity growth and scaling plots cannot
be drawn at all.
Lower than it would be for a thesis or results pipeline. A teaching figure is usually explanatory, not evidential, and a complexity curve is often illustrative, not measured. It matters for the thesis-chapter genre and for any book chapter reporting real benchmarks, which is enough to keep it on the roadmap but not enough to put it first.
\usetikzlibrary is body-legal so
figure files name their own libraries, but \usepackage{pgfplots} is
not. It needs a conditional header-includes in _pandoc.py, which is
architecturally identical to what the tikz header-includes change did,
to the library union #781 added beside it, and to what already
exists for fvextra. Precedented and small.figures/<n>.dat, drawn with
\addplot table. The numbers become diffable and auditable, which
most published figures are not..txt output is more informative than the plot and is what a screen
reader wants. Here the twin requirement helps instead of limiting.
This is the same principle as the state-machine layout's
transition-table twin.scripts/install_full_pipeline.sh needs a line. texlive-pictures
covers the tikz libraries; do not assume it covers this.TIKZ-STYLE.md names three defects that are hard to measure: chaotic
routing, illegible or inconsistent type, and literal copying. A vision
model is not needed for the first two:
figure check's connector
rules c1 to c7 measure it
(figure-checks/CONNECTORS.md).type-below-floor, and becomes arithmetic at final scale once the
output target is known. See VI.2 and Part X.What remains, and is beyond geometry, is informativeness:
whether the figure teaches the thing it is supposed to teach, and the
twin-equivalence test the style doc frames as reading the .txt and
asking whether the point still arrives. That is a smaller and better-posed
job than "look at the figure and judge it", and it should be filed that
way.
pypdfium2 is already a declared dependency of the enrich extra
(added for the crop work), so rasterising a compiled figure needs no
new package. figure look already writes a 300 dpi PNG of each
figure, which is the obvious input.adapters pins transformers to
>=4.57.6,<4.58.0, a single-patch window, and most current
vision-language models want newer. Importing one into the enrich venv
turns the next poetry lock into a fight.Captioning source-PDF figures at parse time. A measured decision rejected
that on the grounds that it puts generated text in the corpus layer,
which may not call an LLM (docs/ARCHITECTURE.md: "LAYER 1 ยท CORPUS โ
deterministic, no LLM, safe unattended"). That rejection stands.
Nor does it belong anywhere in Part III. A derived figure that consults a model is a generated figure with extra steps, and loses the property that makes derivation worth building.
plans/651-multimodal-drafting-access.md measured 8,769 figure crops
and 497 figures.json indices on the real 497-PDF corpus, then with
zero consumers. draft figures <citekey> now surfaces a source's
crops to a drafting skill; page-image retrieval is the route still open.
Two routes that respect the layer boundary:
retrieval.search() reads exactly one artefact,
content/parsed/<citekey>.txt. colpali-engine is the mature option.Both are separate features from anything in Parts IโVII and should be filed against the multimodal-drafting-access issue, not here.
bench/bench_figure_similarity.py has run, and
plans/659-figure-similarity-tier.md records the recommendation.
Summarised here so the roadmap is complete.
The hole. TIKZ-STYLE.md states it directly: a figure can launder
borrowed material past every detector in PLAGIARISM.md, because a
citekey is deliberately kept out of figure files and the draft gate does
not follow \input. Three individually-correct decisions compose into
it. The originality rule for figures is the only rule in the project with
no mechanical support of any kind.
The proposal. Rasterise the compiled draft figure, screen against the
8,769 corpus crops with a perceptual hash, then rank by image-embedding
similarity. sentence-transformers, chromadb and pypdfium2 are all
already declared. Report the top few candidates with their citekey and
the source paper's own figure number, which _docling_figures.py already
captures.
Ranked, never banded. PLAGIARISM-DESIGN.md measured 16 long runs
across a 178,077-word book, found all 14 actionable ones to be false
positives at 15โ29 words, and found the only genuine planted lift at 18
words, inside that range. No threshold separated them, and the declined
overlap-gate decision forbids
guessing one. There is no reason image similarity behaves better.
Domain-specific warning. In CS and SE the canonical
figures are common property. Everyone draws the OSI stack, the five-stage
pipeline and the standard red-black rotation the same way, legitimately.
The false-positive floor will be worse in this domain than the
biology framing implied, and that expectation should be written into
bench/bench_figure_similarity.py before it runs instead of discovered
afterwards. An outcome where the floor swallows the planted case is a
valid result and should close the issue, the way bench_overlap_gate.py
killed a proposed gate on its own numbers and the way C4 and C6 left the
roadmap.
A self-inflicted floor this roadmap creates. A structural pic
library (V.1) means every figure using the shared memory-cell pic shares
pixel-identical regions with every other one. That is the library working
as intended and it is indistinguishable from copying at the pixel level.
It needs handling by construction, not by threshold: the screen
should exclude regions drawn from the shared library before hashing,
instead of trying to tolerate them afterwards. This is a further
argument for benching Part IX before V.1 ships.
Part XI makes the mechanism cheaper. A rendered raster per figure is exactly what the screen needs, so if Part XI lands first, Part IX inherits the rasterisation path instead of building its own.
Small, and it unblocks two other items.
Partly built (epic #1140). The two pages this repository already
sets are recorded once, measured, in chitragupta/core/page.py: draft render's A4 article and book-assembler's A4 book. figure check and
figure look measure a figure under a book's drafts directory against
the book's 437.5pt text block, and every other figure against the
article's 453pt.
Named targets beyond those two (A5, A6, letter, two-column, slide), a
project setting and a per-draft target are parked on the epic.
Several checks want to know the size at which a figure will be printed,
and no artefact holds that number. VI.2 cannot report an effective type
size without a column width. figure check's width finding takes its
target from --width, defaulting to the text width of the figure's
page, the article's 453pt or a book's 437.5pt. Part XI's PNG branch
needs a width and a resolution before it can rasterise anything. Each of
those items has independently parked on "where does the target width
come from", which is a sign the answer belongs in one place, not three.
A small, closed set of named output targets, declared once per project instead of per figure, each fixing a column width and a base type size. Something like: a single-column book page, a wide or full-bleed page, a two-column paper, a slide. The names matter less than the properties: the set is small, it is closed, it lives in project configuration, and every size-dependent check reads it.
diagram-design does the same thing with a size dial whose options
also drive the type ramp, so a projected slide gets larger node labels
than an inline document figure. The idea to take from it is that
the target changes type size as well as the frame: a figure scaled
down to fit is a different figure from one authored for that width.
figure check reports so
it does not go unnoticed.\input into a
foreign thesis lands in a column of unknown width. The target is a
property of this project's output and the figure should not hard-code
it into geometry; it informs the checks, not the drawing.It is a handful of constants and a config key, and it is a prerequisite for VI.2 and for Part XI's PNG branch. Filing it as a shared dependency avoids three issues each inventing their own answer.
Today md, docx and html output render only the
ASCII twin. The TikZ form reaches the PDF and nowhere else. This part
proposes rendering each figure to SVG or PNG and shipping that image
alongside the twin in the non-PDF outputs.
figure look already compiles each figure on the page it prints on
and writes it as a cropped PDF and a 300 dpi PNG.pypdfium2 is already declared in the enrich extra._pandoc.py already sets --resource-path so the PDF and DOCX writers
resolve Markdown image syntax pointed at a file on disk.As with raster images generally, what is missing is the contract, not the plumbing.
The obvious argument, that html readers should see the picture, is true but weak. The stronger one is that this removes a conflict the twin currently has to absorb.
The twin is asked to do two incompatible jobs: be the clearest 7-bit representation of the information, and be visually adequate as the sole figure in md, html and docx. Those pull opposite ways. The state-machine layout's twin is a transition table because a table is more precise than the picture, and a transition table standing alone in an html export, where the reader's browser could have shown the diagram, is a worse export. Ship both and each form does one job: the twin is the precise representation, the image is the picture. The principle behind that twin and VII's data-table twin stops being a compromise.
Once the image is what a reader sees in md and html, nobody except screen-reader users depends on the twin, and an artefact nobody looks at rots. Six months of stale twins would be invisible.
The mitigation must be structural, not cultural: the twin
becomes the image's alternative text. alt in html, the alt-text field
in docx, image plus fenced twin in Markdown. That makes the twin a
required input to the image instead of a substitute for it, so it cannot
rot without the image visibly losing its accessible name, which is
itself checkable.
figure check and figure look are optional. Rendering
images makes LuaLaTeX plus a converter a prerequisite for producing any
output at all. This is an architecture decision, not a feature
decision, and it is the largest single question in this part. The
answer is a documented fallback: with no TeX available, emit
the twin exactly as today and say so. Degraded output, reported, not
a failure..tex, and treat the cache as build output, not source. The
same instinct keeps golden images out of diagram-design's repo:
nothing to re-record means nothing to go stale.dvisvgm configurations default
to paths, which silently destroys that property. Verify it instead of
assuming it. PNG is the safer choice for docx, where SVG support across
Word and the pandoc writer is jointly unreliable.figureref machinery, with the renderer still
assigning the number and the caption still pandoc-visible per the
caption-visibility fix. That is the real work here, and it is larger
than the rendering step.PERFORMANCE.md. Hash-keyed caching should
make this negligible after a first pass, but that needs measuring
instead of assuming.A rendered raster per figure is exactly what Part IX's similarity screen needs. If this lands first, Part IX inherits the path instead of building one.
SVG-first with a PNG branch for docx; twin-as-alt-text mandatory, not conventional; TeX-absent falling back to today's behaviour with a report; renders cached by content hash and never committed; the whole thing routed through the existing figure numbering contract.
Depends on Part X for the PNG branch, which is unanswerable without a target width. The SVG branch does not.
Less pressing in this domain than in biology, because CS figures are line art and the Okabe-Ito palette suits them well. The distinction is still worth recording: the palette and the greyscale test govern semantic colour, where a hue encodes a variable. Depictive colour, where a thing simply looks like something, encodes nothing and the greyscale test does not apply to it. Almost nothing in this domain is depictive, so the practical answer is to keep the rule as it stands and note the distinction only if a real case appears.
This project maintains a provenance spine and is proposing, in Part IX, a checker for figures that borrow without attribution. A roadmap that silently adopted another project's design rules while building that checker would be a poor look. So, explicitly:
Source. cathrynlavery/diagram-design,
MIT licensed. An agent skill that produces self-contained HTML with
inline SVG for editorial and product diagrams, with brand-matched design
tokens.
Relationship: ideas, not a dependency. Nothing from it is vendored, imported or installed, and there is no reason to. The output substrate is wrong (HTML/SVG on a 4-pixel grid versus TikZ compiled by LuaLaTeX and measured in millimetres); the palette model is wrong (brand-matched tokens versus a fixed Okabe-Ito palette that must travel inside the figure file); and the generation model is wrong for Part III (an LLM picks the type and the cuts, where a derivation must be deterministic). What transfers is design reasoning, a few hundred words of it, embedded in a repository whose bulk is coordinates for a different medium.
What was taken, and where it landed:
| Idea | Landed in |
|---|---|
| Connector rules stated precisely enough to check: label-to-line clearance, fanned attach points, no transit over non-endpoint boxes, no coincident strokes, orthogonal elbows | figure check's c1 to c7, and the consequent narrowing of Part VIII |
| Named output sizes that fix both frame and type ramp | Part X, unblocking VI.2 |
| A complexity budget expressed per diagram type | figure check's per-layout reference ranges, deliberately as a report and not a budget |
| A fixed degrade ladder and a fidelity ledger for reductions | Part III, answering the dependency-graph filtering question |
| A pre-output taste gate distinct from post-hoc linting | the figure-drawer skill's taste gate |
| Anti-patterns as a named table with a "why it fails" column | each layout's reference file |
| One reference document per type, loaded only when chosen, with a sync check | the skill's references/layouts/ |
| A geometric check that verifies an encoding's own claim, measured as relative error | II.3's field-width check, and VII's bar lengths |
| Bounding-box geometry is an unreliable oracle for clipping and clearance | the connector rules' bench, which set their thresholds over this repository's own figures |
| Behaviour patterns kept separate from layout types so the type count does not inflate | II.7 demoted from a metaphor to a primitive |
| No golden images in the repository, so there is nothing to re-record and nothing to go stale | Part XI's hash-keyed render cache, treated as build output, not source |
| The six connector rules as numbered rules, with the lone edge attached at the side's midpoint | figure check's c1 to c6 |
| Every geometric rule ships with a checker and fixtures in both polarities (its ADR 0005) | figure check's tests and rule examples |
| SKILL.md as a router under a byte cap, with a check that moved sections keep their links (its ADR 0004) | the figure-drawer skill |
A second source.
INTO-CPS-Association/DTaaS,
the update-docs-diagrams agent skill on its feature/distributed-demo
branch. It restyles and exports drawio diagrams. Taken, as ideas only:
one idempotent command per step with the skill reduced to running them;
exceptions recorded with a reason instead of a rule silently skipped;
WCAG contrast thresholds of 4.5:1 for text and 3:1 for lines; and a last
look at every changed image. All four landed in figure new, figure check's cg-allow and contrast rules, and figure look. Its dark
variant has no counterpart in print and was not taken.
What was rejected, and why, so nobody re-derives it: brand-token onboarding (this project has a fixed palette by design, for greyscale legibility); the 4-pixel grid (a print artefact has no pixel grid); a target density of 4/10 (correct for editorial diagrams, wrong for a DP trace); motion and animation (print); the no-shadows / max-radius aesthetic (tied to a web look, and this project's figures are line art already); and its export path (Playwright and Chromium for a project that compiles PDFs).
A footnote: that project's own "when not to use this" list sends quick unicode diagrams to a different tool. That tool's job is this project's ASCII twin, which is mandatory here. Its taste rules were never designed to survive a twin requirement, which is the main reason its aesthetic guidance transfers so much less well than its mechanical guidance.
Third-party art. None is proposed. Heroicons was evaluated and set aside; the argument is in the table below, and it is worth reading before anyone proposes an icon set again, because the technical fit is good enough to be tempting.
Recorded with the argument, so nobody re-derives it.
| Proposal | Why not |
|---|---|
| Licensed vector art libraries for life-sciences (Bioicons ~3,000 CC0/CC-BY icons, Servier Medical Art CC BY 4.0, NIH BioArt public domain, PhyloPic) | Correct answer for a life-sciences pipeline, irrelevant here. The attribution machinery would have been a good fit for this project's provenance spine, which is the only reason it was considered at all |
| A general icon library for CS figures, e.g. Heroicons (MIT, ~300 icons) | Set aside twice. The technical fit is real: Heroicons' 24px outline set is M/L/C/A/Z path data, which is the subset TikZ's \path svg {...} parses natively, so an icon converts to a pic with no new package, no raster and a diffable source. But feasibility is not a reason. Because the ASCII twin cannot render an icon, an icon must be strictly redundant with its node's text label, and a mark that adds no proposition is a mark the TikZ form also loses nothing by deleting. Set against that: a Part IX false-positive source needing whitelisting by construction, exclusions in VI.3's counts and Part IV's label extraction, stroke rescaling tied to Part X, a silent axis flip (SVG's y-axis points down), and a vendored subset with a licence notice to carry. Five ongoing obligations across four other parts, bought for pre-attentive scanning in one metaphor family. Worse, it would be the first proposal to make the twin strictly poorer by design, which is a precedent later proposals would argue from. Coverage is also UI-shaped (no page table, no pipeline hazard, no red-black node), and upstream declines new-icon contributions, so there is no route to a domain icon. What survives is the five house-drawn shapes in the house block (TIKZ-STYLE.md) |
| Generated raster illustration | Non-deterministic, non-diffable, non-editable, and factually unreliable in exactly the domain where a mislabelled figure is worse than no figure. Fails the properties SOUL.md is built on. The narrower "generate a base plate and trace it" version reintroduces the originality problem of Part IX and still needs an illustrator |
| Bezier organic form, gradients, translucency | Illustrator craft. Reachable in TikZ in principle, but a cell membrane's curve requires hand-placed control points and this domain has no organic objects to draw. Dropped entirely |
detikzify or image-to-TikZ synthesis |
The inverse of Part IX: it automates producing the artefact that check exists to catch |
| Vision captioning of source figures at parse time | Rejected on measurement. Puts generated text in the corpus layer, which may not call an LLM |
| Nature-style data density as the benchmark | Wrong target for tutorials and textbook chapters. A teaching figure is explanatory, not evidential. Tufte and the algorithms literature are the better references. Part VII keeps the quantitative capability for the thesis genre without making density the goal |
| A figure-similarity gate | See Part IX. Advisory and ranked only. The declined overlap-gate decision forbids guessing a threshold and the measured evidence says none exists |
Adopting diagram-design as a dependency or an invoked skill |
See Borrowed, with attribution. Wrong output substrate, wrong palette model, and an LLM in a path Part III needs to be deterministic. The design reasoning was worth taking; nothing else was |
| A hard complexity budget with numeric caps | Correct for editorial diagrams, wrong for a textbook. A forty-cell DP trace is not over budget, it is a DP trace. figure check reports the count against a per-layout reference range instead, and nothing gates on it |
Ordered by a mix of certainty, size and what unblocks what.
pics. Compounding, and a prerequisite for
II.1. Settle the portability question first.bytefield) and carries the width-encoding check. II.7 ships
as a primitive inside 5, not as a layout. II.8 waits for a figure
that needs it.pic library plants a known false-positive source.Following the bench self-check convention
(plans/356-bench-self-check-convention.md), and the
precedent of bench_overlap_gate.py, which killed a proposed gate on its
own numbers:
pics as a known negative, since V.1 would
create that floor deliberately.bench_embed_model_compare.py. A CLIP-class model trained on natural
images may be weak on line art, which is an empirical question, not a
guess.PERFORMANCE.md's "What a review pass costs".