Autype
Back to blog

Updated November 21, 2026

Cross-References and Numbering: Documents That Still Add Up After Every Edit

Hand-typed references go stale on the first re-render. How anchors, render-time numbering, and generated indices keep documents correct after every edit — with four checks.

Document AutomationTutorials#document automation#cross-references#numbering#indices#markdown

A maintenance agreement with six appendices goes out the door. Three weeks later the customer cancels one module, the contract is rendered again — and page 12 still says "see Appendix E, Response times". The response times now live in Appendix D. Nobody typed anything. Nobody overlooked anything. The sentence was correct in the first render and wrong in the second.

Errors like this survive every text review because the sentence reads plausibly. They surface at the customer, in a legal review, or in an audit. This article explains why hand-typed numbers decay in generated documents — and how cross-references, numbering, and indices can come from the source instead of the finished PDF. The examples use Autype; the final checklist applies to any pipeline.

Three ways numbers drift

SymptomCauseHow you notice
"See section 4.2" points at the wrong placeNumber typed by hand, a chapter was inserted laterA reader follows the reference and lands on "Termination" instead of "Warranty"
Figure 3 exists twiceCaption copied with its number, image replacedTwo identical numbers in the document, one missing from the list
Page numbers in the table of contents are wrongContents maintained manually, text added afterwardsThe appendix starts on page 13, the contents say 11
Numbering breaks in one variantTemplate copied per customer, one module removedAppendix A, B, D — C vanished without explanation

All four share a root cause: the number was an editorial decision. It should have been a calculation.

Anchors instead of positions

Autype handles this with anchors. Headings carry an ID in the source; images, charts, tables, and code listings take an anchor attribute. The ID describes the element, not its position:

## Response times {#sec-response}

![Escalation levels for incidents](escalation.png){anchor=fig-escalation caption="Escalation levels"}

:::table{caption="Service levels per module" anchor=tab-sla}
| Module | First response | Restoration |
|---|---|---|
| Basic | 8 business hours | 2 business days |
| Plus | 4 business hours | 1 business day |
:::

The body text then carries a reference rather than a number:

The deadlines in [Table {num}](#tab-sla) apply from receipt of the incident report.

{num} is replaced with the actual table number at render time. If the table moves because a new section was inserted above it, the output changes and the source stays untouched. The anchor tab-sla remains stable even when Table 2 becomes Table 4. The documentation for References & Anchors covers the details.

The idea is not new. LaTeX has used \label and \ref for decades, and the Overleaf documentation notes that local LaTeX runs must compile a document twice before references resolve. The difference is the cost of ownership: a Markdown source with anchor IDs stays readable, and the number is produced in the same step that produces the PDF.

Three ways to write the same reference

How a reference sounds inside a sentence is a style question. Autype offers three modes:

ModeSyntaxOutputFits
Auto[](#sec-response)"Section 2.1 Response times"First mention in body text, where the title helps
Template[Section {num}](#sec-response)"Section 2.1"Sentences that already name the topic in a subordinate clause
Custom[the response times](#sec-response)"the response times"Summaries where a number makes the sentence heavy

The choice affects readability, not correctness. A document that says "see section 3.4" in every other paragraph reads like a regulation. Switch deliberately: numbers where the reader needs them to navigate, plain language where the sentence stumbles otherwise.

Indices built from the content

The same logic applies to the indices. They are not maintained; they are generated. The documentation on automatic indices lists the full set:

DirectiveCollectsRequirement
::tocHeadings up to the configured levelnone
::lofImages and chartsalt text or caption
::lotTablescaption on the table directive
::locCode listingscaption on the code block
::loaAbbreviationsabbreviations marked in the text

Two details decide whether the index is complete. First, anything without a caption stays invisible, so the caption is a contract with the index rather than decoration. Second, diagrams with captions count as figures and appear in the list of figures, not the list of code listings. Teams that mix Mermaid diagrams and code blocks should know this before sign-off.

One point survives in DOCX, as it does in other tools: the table of contents is exported as a field. Word and LibreOffice fill in page numbers only after the fields are updated. That is irrelevant for the PDF and belongs on the checklist for the DOCX.

Validate instead of hope

The most interesting part is error handling. Autype validates references at render time: duplicate anchors and references to anchors that do not exist produce a validation error. A document pointing at a deleted figure is not shipped quietly — it fails.

That is the difference between a warning and a stop. Anyone who has sent a proposal saying "see attachment 2" when no attachment 2 existed understands why it matters.

Four tests cover most of the ground:

TestActionExpected result
Insert a sectionAdd a section before Appendix DLater references and index numbers shift without manual work
Delete a targetRemove a figure that is referencedRender fails with a validation error instead of printing an empty number
Render a variantProduce short and long versions of the contractEach version numbers its own elements — no gaps, no duplicates
Open the DOCXOpen the export and update fieldsThe contents show page numbers that match the file

The third test is the one teams skip. Two variants of a document are two documents. Expecting Appendix C to keep the same number in both asks numbering to do something it cannot: hold two orders at once. What matters is that each version is internally consistent. The article on regression testing PDF and DOCX templates shows how to lock that down further.

Where the limits are

Anchors are local to a document. A reference from one PDF into another is outside this mechanism; that needs a stable identifier in the file name or in the metadata.

Anchor IDs are technical names. If they are quoted in approvals, tickets, or external links, do not rename them. tab-sla stays tab-sla even after the word "SLA" disappears from the heading. The ID is a handle, not a label.

And numbering follows the order inside the document, not the order of the discussion. If the data protection chapter moves to the end, it becomes chapter 7 instead of 3. That is not a bug; it is the point.

When it pays off

Once a document has more than ten internal references, is rendered in variants, or passes through an approval, hand maintenance costs more than the one-time setup. For a two-page letter with a single reference, the effort would be overkill.

A simple rule: if someone who never saw the source will read the rendered document, the numbers have to come from the source. Everything else is a bet that nothing will change. Teams that already automate through the engine will find export and PDF options at autype.com/document-engine, with plans listed at autype.com/pricing.

Sources and retrieval date

Autype: References & Anchors — https://docs.autype.com/markup-reference/references — retrieved 21 November 2026.

Autype: Automatic Indices — https://docs.autype.com/markup-reference/indices — retrieved 21 November 2026.

Overleaf: Cross referencing sections, equations and floats — https://www.overleaf.com/learn/latex/Cross_referencing_sections%2C_equations_and_floats — retrieved 21 November 2026.

Ready to automate your documents?

Start creating business documents with Autype. No credit card required.