๐Ÿ“ Figures

Status: reference. An element file of the writing standards, listed in the core's index.

Assumes the core, ยง1โ€“9 of WRITING-STANDARDS.md. This file holds ยง10, under the number it had in the core, so a citation reads docs/writing-standards/figures.md ยง10. chitragupta/core/draft/style_figures.py reports its decidable part as draft style findings.

๐Ÿ“ 10. Figures

A draft may include a figure only if it is wholly original. A figure extracted from a source paper carries that paper's own copyright, and citing the paper grants no right to reproduce it. Inserting one into a draft, or closely redrawing one from memory, is the same violation. Reading a source figure for understanding is fine; the boundary is what ends up in the draft.

A figure's ASCII form is a diagram in a code block: box characters, arrows and labels built from + - | / \ > < ^ v, 7-bit characters only. Keep it to about 70 columns so it survives the rendered PDF's monospace block without wrapping.

A code block, not specifically a fenced one. In a Markdown draft you write a fence and the md render keeps it. Where the renderer inlines the ASCII form into a .tex-sourced .md preview, pandoc emits a 4-space indented block instead. That is verified, and it is the shape to expect rather than a defect: every line is shifted by the same four spaces, so the diagram's alignment is intact and ^ \ < > come through literally.

Unicode box-drawing (โ”Œโ”€โ”โ”‚โ””โ”€โ”˜) is excluded. chitragupta's own pdf render runs LuaLaTeX and prints them, but a .tex output or a --fragment is compiled later by the author's own document, and a pdflatex build has no such glyphs set up: it fails the whole build with Unicode character โ”Œ (U+250C) not set up for use with LaTeX. That is verified against a pdflatex build of this project's own render output, and is not a general pandoc claim. One such diagram breaks the build for every other figure in the same draft.

๐ŸŽจ TikZ layout and style

TIKZ-STYLE.md is the full guide to drawing a good TikZ figure: which layout metaphor to commit to before placing a node, the pre-flight defect checklist to check the result against, and the type and line-weight conventions that keep a figure consistent with the surrounding document. Much of it is checked by chitragupta figure check, which reports and is never gated; the rules it applies, and how to read its report, are in figure-checks/README.md.

๐Ÿ–ผ Every figure has two forms

ASCII is what a Markdown reader should see; it is not what a thesis wants. So a figure in this pipeline exists twice: once as a TikZ picture, which sets as vector art at the consuming document's own font and line width, and once as the plain-ASCII diagram above.

The figure-drawer skill draws both forms, for any genre that hands it a figure and for a direct request (FIGURE-DRAWER.md). This section is the contract it follows, and stays the contract for a figure drawn by hand.

Both forms are always sibling files, in every genre, and a draft carries only a marker naming them, with one exception, which is not about figures. thesis-chapter-writer's .tex fragment is what the user \inputs directly into their own real thesis, never touched by this pipeline again once it leaves content/drafts/; a marker-only TikZ would render fine through this pipeline's own renderer and then vanish without warning when the user \inputs the fragment into their thesis. So that genre's TikZ stays inline, via the \input a real thesis resolves for itself; its ASCII, like every other form in every other genre, is a file named by a marker.

content/drafts/<topic>/<draft>.md          marker only
content/drafts/<topic>/figures/<name>.tex  the TikZ picture   (every genre)
content/drafts/<topic>/figures/<name>.txt  the ASCII form     (every genre)

content/drafts/<topic>/<draft>.tex         TikZ inline, via \input   (thesis-chapter-writer only)
content/drafts/<topic>/figures/<name>.tex  the TikZ picture
content/drafts/<topic>/figures/<name>.txt  the ASCII form

A topic directory is mandatory for a draft that carries a figure. A flat content/drafts/<slug>.md puts its figures in content/drafts/figures/, shared with every other flat draft, where two drafts that each name a figure fig1 silently overwrite each other in content/rendered/. Each genre skill settles the draft's path at the start of its process, before a figure is on anyone's mind; deciding on a figure later is a reason to move the draft and its dossier, not a reason to mkdir beside a flat one.

Every draft names both forms with a marker comment. thesis-chapter-writer additionally keeps its TikZ inline, for the reason above, but still marks its ASCII the same way everyone else marks both. The marker is what lets a reader of the draft see that a form exists off the page, and what lets a reviser find every figure by grep rather than by parsing the draft.

One marker, one vocabulary, in both genres: figure:, naming the figure's base name without a suffix. The renderer derives <base>.tex and <base>.txt from it. The two spellings below differ only because a comment in Markdown and a comment in LaTeX are written differently; what you write is the same either way, and no draft names one figure twice.

Markdown drafts (tutorial-writer, textbook-chapter-writer, survey-writer) carry the marker alone, with no fence beside it:

<!-- figure: figures/<name> -->

For --format tex and --format pdf the renderer replaces that marker with \input{figures/<name>.tex}. For every other format, including the Markdown draft's own --format md, it replaces the marker with the .txt contents in a fence. There is no inline diagram left to fall back on, so this substitution runs even when the output format matches the draft's own language.

The .tex draft (thesis-chapter-writer, this pipeline's one LaTeX-sourced genre) keeps its TikZ inline, via the \input a real thesis resolves for itself, with the ASCII marker following it:

\input{figures/<name>.tex}
%figure: figures/<name>

For --format md the renderer substitutes the .txt contents for that \input, in a temp copy. The author does not write a verbatim block by hand: the fragment on disk stays exactly what the user \inputs into their own thesis, and the ASCII appears only in the preview that needs it.

The marker must be a comment, never a second \input. A literal \input{figures/<name>.txt} makes pdflatex read the ASCII art as LaTeX source, and the alphabet above is full of math-mode-only characters:

! Missing $ inserted.        exit=1

That failure lands in the user's own thesis build, where we never see it, because our own render substitutes the line away first. A LaTeX comment is inert to pdflatex, dropped by pandoc, and meaningful only to this pipeline.

๐ŸŽฏ What the pair requires

๐Ÿ”– A caption, and no number you write yourself

A figure has the number-and-reference contract ยง13 gives a table. A Markdown draft writes the figure: marker, then its caption directly below it with no blank line between, the same adjacency ยง11's <!-- single-source: --> and ยง13's own caption-then-marker pair both use:

<!-- figure: figures/delivery-modes -->
One reading path under three delivery modes.

Prose points at it with an inline marker, which stands in for the whole reference phrase; the author writes neither the word "Figure" nor a number:

<!-- figureref: delivery-modes --> shows the same request handled three ways.

The id is derived, not written. The marker's own value already names the figure's base name, so the id is that name with no figures/ prefix: delivery-modes from figures/delivery-modes, the same base name \label{fig:delivery-modes} agrees with. There is no second field to keep in sync with the file name.

A caption describes and does not interpret. It says what the figure plots, over what range and in what units, and leaves the finding to the sentence that cites the figure. Reread the scale as well: an axis that starts above zero or stretches one panel must neither exaggerate a contrast nor hide one. Neither point is checked by draft style; both belong to the ยง6 reread.

A figure with no caption line below it renders unchanged: a bare \input or a bare ASCII fence, no float, no number, and invisible to figureref resolution. The renderer accepts it and the standard does not: draft style reports it as chitragupta.FigureNoCaption.

Never write the number. RENDERING-FLOW.md's "Figure numbering" has the per-format cases: LaTeX-bound output wraps the marker in a real figure float and lets LaTeX's own counter number it (no \renewcommand{\thefigure} is ever written), and every other format gets a number counted at render time, mirroring how ยง13 numbers a table outside LaTeX.

The .tex fragment carries neither marker: thesis-chapter-writer hand-authors a real \begin{figure}...\caption{}...\label{fig:<id>} around its inline \input, the same carve-out ยง13 gives a hand-written \begin{table}. There too, never write \renewcommand{\thefigure}{N.M}: the consuming thesis's own counter has to agree with its own chapter numbering, which is why a number never belongs in a draft.

python -m chitragupta.draft style reports the decidable part of this: a figure marker carrying no caption, a captioned figure no sentence refers to, a figureref naming a figure that does not exist or is not captioned, two figures sharing one id, and a reference sitting outside the figure's own section.

There is no FigureNoId: a figure marker always carries an id by construction, since the id is the base name the marker names, so there is no state for it to catch.

Where tikz.sty is absent, the fallback is the same in every genre and is the ASCII form alone: the ASCII goes inline, in whatever form the draft's own language carries natively (a fenced code block in a Markdown draft, a verbatim environment in a .tex fragment), with no marker and no figures/ files at all. Both forms survive every format such a host can produce: a fence renders straight through Markdown's own formats and, via pandoc, into tex/pdf too; a verbatim block survives pandoc's LaTeX reader into both --format pdf and --format md. Both were verified into both formats through this pipeline's own render path.

There is no equivalent of citation_gate for a figure's originality. Whether a diagram is original, and whether a source figure's own licence would even permit reproducing it, stays a judgement call.

Agreement between the two forms is checked in part by chitragupta figure check, which reports and is never gated. It reports a figure with no .txt beside it (twin-missing), a name in the TikZ that the twin does not carry (t1-labels), an edge tag missing from the twin (t2-tags), and panel letters that differ between the two (t3-panels). Arrow topology is not checked: nothing compares which box an arrow joins in one form against the other, so a rewired arrow leaves the pdf and the Markdown preview disagreeing until someone looks. figure-checks/README.md has the rules. draft-reviser carries the rest of the defence: touch a figure, touch both forms, panel letters included.