Status: reference.
The rules about a figure's ASCII twin. Every figure exists as a TikZ
picture, <name>.tex, for the PDF and LaTeX renders, and as a 7-bit
ASCII diagram, <name>.txt, beside it. The twin is the only figure the
md, docx and html renders show, so it must name what the TikZ
names (WRITING-STANDARDS.md §10).
README.md explains how to read a report and record an
exception.
The twin is written by hand, so the two drift. These rules read both
files from source, so they hold whether or not the figure compiles.
"Appears in the twin" means every word, as a whole word, in any order,
case aside, after markup is stripped and maths dropped (ASCII cannot
spell \hat{x}). A gloss is never compared: the twin may reword it to
fit. Whether the arrows join the same boxes is yours to check by eye.
Each rule shows a faulty figure, its report line and the fixed one, all
real files in examples/ that
tests/core/figure/test_figure_check_examples.py compiles. TikZ listings show the
picture only. A pair's renders look the same, so this page shows the
twins instead of images.
Each rule below says what it catches and how to fix it.
twin-missingCatches. No <name>.txt beside the figure. Target: figure. The
three comparisons below are then listed under "not measured". This rule
cannot be allowed: a figure without a twin is fixed, never excused.
Faulty: faulty.tex has no faulty.txt beside it.
\node[cgbox, text width=26mm] (parse) {\cglab{Parse}{read the PDF}};
\node[cgkey, text width=26mm, right=8mm of parse] (index) {\cglab{Index}{store passages}};
\draw[cgedge] (parse) -- (index);
twin-missing figure no faulty.txt beside the figure
not measured
t1-labels: no twin
t2-tags: no twin
t3-panels: no twin
Fixed: the same picture, with fixed.txt written beside it.
+--------------+ +================+
| Parse |--># Index #
| read the PDF | # store passages #
+--------------+ +================+
Fix. Write <name>.txt beside the figure (the twin step of the
skill). Cannot be allowed.
t1-labelsCatches. A name in the TikZ that is not in the twin: a node
label's first line (\cglab's name), a zone title or a legend entry.
Target: the node, or the name's text for an unnamed node.
Faulty: the TikZ names the gate Citation gate.
\node[cgbox, text width=26mm] (draft) {\cglab{Draft}{cite from the ledger}};
\node[cgkey, text width=26mm, right=8mm of draft] (gate) {\cglab{Citation gate}{check citekeys}};
\draw[cgedge] (draft) -- (gate);
The twin shortens it to Gate.
+----------------------+ +================+
| Draft |--># Gate #
| cite from the ledger | # check citekeys #
+----------------------+ +================+
t1-labels gate missing "citation"
Fixed: the twin uses the TikZ's words.
+----------------------+ +================+
| Draft |--># Citation gate #
| cite from the ledger | # check citekeys #
+----------------------+ +================+
Fix. Use the TikZ's words for that name in the twin: 4-ch relay
for 4-channel relay drops channel. A gloss is not compared, so
reword those freely.
t2-tagsCatches. A line of a node placed on a \draw or \path (a tag,
whatever its style) that is not in the twin, compared as t1-labels.
Target: the edge, a->b, or the tag's text where it joins no two
names.
Faulty: the TikZ tags the arrow writes passages.
\node[cgbox, text width=26mm] (index) {\cglab{Index}{store passages}};
\node[cgkey, text width=26mm, right=38mm of index] (ledger) {\cglab{Ledger}{one SQLite file}};
\draw[cgedge] (index) -- node[cgtag] {writes passages} (ledger);
The twin's arrow has no tag.
+----------------+ +=================+
| Index |------------------># Ledger #
| store passages | # one SQLite file #
+----------------+ +=================+
t2-tags index->ledger missing "writes"
Only writes is missing: passages is in Index's gloss.
Fixed: the tag goes on the twin's arrow.
writes passages
+----------------+ +=================+
| Index |------------------># Ledger #
| store passages | # one SQLite file #
+----------------+ +=================+
Fix. Put the tag on the twin's arrow, in the TikZ's words.
t3-panelsCatches. The panel letters opening a label line in the TikZ,
(a), (b), that are not the set of (<letter>) tokens in the twin.
Target: figure. Only a letter in parentheses counts, so a) or (A)
is not a panel letter.
Faulty: the TikZ letters its two panels (a) before and (b) after.
\node[cgbox] (draft-a) {draft};
\node[cgnone, below=of draft-a] (gate-a) {no gate};
\node[cgbox, right=16mm of draft-a] (draft-b) {draft};
\node[cgkey] (gate-b) at (draft-b |- gate-a) {gate};
\draw[cgedge] (draft-a) -- (gate-a);
\draw[cgedge] (draft-b) -- (gate-b);
\begin{scope}[on background layer]
\node[cgzone=cgMute, fit=(draft-a)(gate-a)] (panel-a) {};
\node[cgzone=cgMute, fit=(draft-b)(gate-b)] (panel-b) {};
\end{scope}
\node[below=2mm of panel-a, font=\normalsize\bfseries] (label-a) {(a) before};
\node[below=2mm of panel-b, font=\normalsize\bfseries] (label-b) {(b) after};
The twin writes a) and b).
. . . . . . . . . . . . . . . . . . . . . .
: +------------+ : : +------------+ :
: | draft | : : | draft | :
: +------------+ : : +------------+ :
: | : : | :
: v : : v :
: +- - - - - - + : : +============+ :
: | no gate | : : # gate # :
: +- - - - - - + : : +============+ :
. . . . . . . . . . . . . . . . . . . . . .
a) before b) after
t3-panels figure tex (a), (b); twin none
Fixed: the twin's last line.
(a) before (b) after
Fix. Letter the twin's panels as the TikZ's: the same (a), (b).