Wit

Additive partials

An additive partial lets many places contribute to one growing node. Prefix a definition with ++#name — and every declaration of that name merges in document order. This is how a table of contents, a bibliography, or a figure list assembles itself as chapters are written and reordered.

The problem it solves

Without additive partials, a bibliography is a second list you maintain by hand, always drifting from the citations. With them, each chapter registers its own entry where the citation lives, and the bibliography is simply the merge of all of them.

The two shapes

Both definition shapes take the + prefix. Block:

source
+#toc
I. The Lamp
toc#

+#toc
II. The Watch
toc#

@toc
result

I. The Lamp II. The Watch

That merges to I. The Lamp II. The Watch. And single-line:

+#bibliography: @weil Simone Weil, Gravity and Grace, 1952 !!

A lone +#name with no sibling is a complete one-entry definition (simple-additive-prefix). Additive defs may carry captures with ::name:: just like ordinary defs (additive-with-captures).

Order and mixing

Contributions merge in document order, and across files inseed the node and additives extend it (mix-normal-and-additive).

Across files

The pattern that makes a self-organising bibliography work: a master file references each chapter and holds a bare @bibliography; each chapter self-registers with +#bibliography.

~ master.wit
reference ./one.wit
reference ./two.wit

@bibliography

~ one.wit
+#bibliography: @weil Simone Weil, Gravity and Grace, 1952 !!

Every referenced file's contributions merge into the one node, in reference order. The reference graph is the scope.

Common mistakes

  • Mixing body shapes across contributions (block vs single-line) — E_PARTIAL_SHAPE_MISMATCH.
  • Declaring a plain #bibliography in the master when chapters already use +#bibliography — unless you mean it as the base.
  • Putting whitespace between the + and the # — write +#name.

See also

Defining nodes

· Multi-file references · Self-organising documents · Glossary & cross-references