In short
A school edition of a classic Spanish novel, in two columns. It shows how to place each note at the bottom of the column that mentions it, so readers never turn the page to find it.
What you'll build
A school edition of Lazarillo de Tormes, 210 × 280 mm in two columns of EB Garamond: the prologue and the start of the first treatise, where Lázaro is born in a mill on the Tormes and goes out into the world with a blind man. The notes explain what a reader of 1554 knew and a reader today does not: the village of Tejares, the expedition to the island of Los Gelves, the stone bull on the bridge of Salamanca. Each one sits at the foot of the column that cites it, set smaller under a short oxblood rule, so the eye drops from the number to the note and back without turning a page. The English edition carries Clements Markham's own notes from his 1908 translation.
This recipe answers
- How do I do footnotes?
The short answer
// In the Markdown: `Tejares,[^9]` cites a note (the id may be a word: `[^tejares]`), and
// a paragraph that opens with `[^9]:` anywhere in the chapter defines it. The engine
// numbers the notes in order of citation and keeps each note in the column of the line
// that cites it: a line whose note does not fit under it moves on with the note.
const footnotes = () => ({
placement: options.placement, // 'column' (the foot of the citing column) or 'chapterEnd'
numbering: options.numbering, // 'chapter': 1, 2, 3… again under every chapter heading
fontSize: pt(8.5), // off the baseline grid: the notes stack up from the column's foot
lineHeight: pt(10.5),
hangingIndent: em(0.9), // turnover lines align past the number
spaceBetween: pt(1.5),
separator: { width: 0.25, lineWidth: pt(0.5), color: col('oxblood') },
});
The notes at the foot of the column that cites them
Ingredients
- Features
- FootnotesSuperscripts and subscriptsOne or two columnsDesigned openersHeading attributesRunning heads and foliosMirrored marginsHeads by page roleParagraph stylesSemantic colour palettePaper colourWidows, orphans and runtsPDF exportAccessible tagged PDF
- Type
- EB Garamond, Bodoni Moda, IBM Plex Sans Condensed (SIL OFL 1.1)
- Assets
- None: every picture is drawn in code
Method
#1 · Cite the note where it belongs, define it anywhere
The configuration is the short answer above; the rest is Markdown. natives of Tejares,[^9] prints a superscript number glued to the comma, and a paragraph that opens with [^9]: holds the note. Definitions leave the flow wherever you write them, so this sample keeps them all at the end of the chapter, the way Markham's notes stood in the source file. The numbers follow the order of citation, so the Markdown ids can be words ([^tejares] in the Spanish edition) and renumbering a chapter never means editing the notes.
#2 · Leave the column room for its notes
Before it sets a line, the layout adds the height of the notes that line cites for the first time, and the rule when it is the column's first note. A line whose note does not fit under it goes to the next column with its paragraph, under the widow and orphan rules, so a number never points at a note on another column. The notes stack up from the foot at their own size and leading, off the baseline grid, while the text above them stays on it; column balancing counts only the text.
#3 · Sink every opener to the same line
const opener = {
enabled: true,
// The sink holds a two-line title and its rule, with ~8 mm to the first line of text,
// so every chapter starts on the same grid line whatever its title's length.
minHeight: pt(LEAD * 10),
slot: { elements: [
{ kind: 'text', id: 'kicker', content: '{attr.kicker}', ...label, fontSize: pt(8.5),
letterSpacing: pt(1.8), color: col('oxblood'), align: 'center',
placement: at('container', 'top', 0, 7) },
{ kind: 'text', id: 'title', content: '{titleText}', fontFamily: 'Bodoni Moda', italic: true,
fontSize: pt(26), lineHeight: 1.1, color: col('ink'), align: 'center',
overflow: 'wrap', // design text ends in an ellipsis by default
placement: { ...at('container', 'top-left', 0, 13),
size: { width: 'fill', height: 'auto' } } },
{ kind: 'rule', id: 'rule', direction: 'horizontal', thickness: pt(0.75), color: col('oxblood'),
placement: { anchor: { to: '#title', edge: 'below' }, // a rule starts at the box's left
offset: { x: mm((MEASURE - 14) / 2), y: mm(4.5) }, size: { width: mm(14) } } },
] },
};
The opener spans both columns and draws the chapter kicker from the heading's kicker attribute. minHeight reserves ten grid lines, enough for a two-line Bodoni title and its rule, so the text of every chapter starts on the same line and the rule never lands on the first line of text.
#4 · Put the book on the verso and the chapter on the recto
const head = (id, content, parity, edge, x, extra = {}) => ({
kind: 'text', id, content, parity, pages: 'body', // never on openers
...label, fontSize: pt(7.5), letterSpacing: pt(1.3), color: col('muted'),
placement: at('page', edge, x, 13), ...extra,
});
const folio = { color: col('oxblood') };
const header = { elements: [
head('verso-folio', '{pageNumber}', 'even', 'top-left', MARGIN.outer,
{ ...folio, align: 'left' }),
head('verso-title', '{title}', 'even', 'top-left', MARGIN.outer + 9, { align: 'left' }),
head('recto-title', '{chapterTitle}', 'odd', 'top-right', -(MARGIN.outer + 9),
{ align: 'right', overflow: 'ellipsis' }),
head('recto-folio', '{pageNumber}', 'odd', 'top-right', -MARGIN.outer,
{ ...folio, align: 'right' }),
] };
// Openers carry a drop folio instead, centred under the text block.
const footer = { elements: [{ ...head('drop-folio', '{pageNumber}', 'all', 'bottom', 0,
{ ...folio, align: 'center', placement: at('page', 'bottom', 0, -11) }), pages: 'opener' }] };
The heads are anchored to the page by parity, with the folio on the outer edge; pages: 'body' keeps them off the openers, which get a centred drop folio. A long chapter title ends in an ellipsis at 120 mm instead of running into the folio.
#5 · Try the other placements
const CHOICES = {
columns: [[2, t({ en: 'Two columns', es: 'Dos columnas' })],
[1, t({ en: 'One column', es: 'Una columna' })]],
placement: [['column', t({ en: 'Column foot', es: 'Pie de columna' })],
['chapterEnd', t({ en: 'End of chapter', es: 'Final del capítulo' })]],
numbering: [['chapter', t({ en: 'Per chapter', es: 'Por capítulo' })],
['document', t({ en: 'Continuous', es: 'Continua' })]],
};
const bar = document.createElement('form');
bar.id = 'options';
bar.ariaLabel = t({ en: 'Footnote options', es: 'Opciones de las notas' });
for (const [key, choices] of Object.entries(CHOICES)) {
const group = bar.appendChild(document.createElement('fieldset'));
for (const [value, text] of choices) {
const input = Object.assign(document.createElement('input'), { type: 'radio', name: key,
value: String(value), checked: options[key] === value });
const item = group.appendChild(document.createElement('label'));
item.append(input, text);
}
}
bar.addEventListener('change', (event) => {
const { name, value } = event.target;
options[name] = name === 'columns' ? Number(value) : value;
config.layout = layoutFor(options.columns); // changed in place: the build sees it
config.footnotes = footnotes();
doc = buildDocument({ markdown }, config); // the fonts are loaded by now
showPages(doc, { title: TITLE });
});
document.getElementById('pages').before(bar);
Each switch builds the chapter again with one option changed. One column sets the notes at the foot of the page, which is the column there. End of chapter sets them after the chapter's last paragraph and drops them to the foot of the column they close, under the same rule. Continuous runs the numbers on from the prologue into the first chapter instead of starting again at 1.
The whole recipe
// ═══ Postext Cookbook · Nº 071 · Footnotes at the foot of the column ══════════════
// https://postext.dev/en/cookbook/novel-footnotes-column-foot
// Code: MIT · Text: Lazarillo de Tormes (1554) and Markham's 1908 translation (PD)
// Fonts: EB Garamond, Bodoni Moda, IBM Plex Sans Condensed (SIL OFL 1.1) · Needs postext ≥ 1.25.0
import { buildDocument, buildDocumentWithFonts, renderPageToCanvas } from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';
const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'novel-footnotes-column-foot';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: oxblood for the kickers, the folios and the notes' rule; ink on warm paper
const palette = {
ink: '#241e1a', // text: a warm near-black
oxblood: '#7d2b1f', // the one accent
muted: '#6f655b', // running heads, colophon
rule: '#c9bdae', // hairlines
paper: '#fbf8f2',
};
// col(id): a colour linked to its palette entry, with the entry's hex beside the id.
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = [
...Object.entries(palette).map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } })),
// The engine's defaults link to main-color: point it at the accent, never the default blue.
{ id: 'main-color', name: 'accent (defaults)', value: { hex: palette.oxblood, model: 'hex' } },
];
// #endregion
const TRIM = { width: 210, height: 280 }; // a school edition: two 82 mm columns
const MARGIN = { top: 23, bottom: 22, inner: 21, outer: 17 }; // mirrored
const MEASURE = TRIM.width - MARGIN.inner - MARGIN.outer; // 172 mm
const LEAD = 13.5; // body leading in pt: the baseline grid
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });
const label = { fontFamily: 'IBM Plex Sans Condensed', fontWeight: 600,
textTransform: 'uppercase' };
// The switches under the title change these and build again (#region live).
const options = { columns: 2, placement: 'column', numbering: 'chapter' };
const layoutFor = (columns) => (columns === 2
? { layoutType: 'double', gutterWidth: mm(7) } : { layoutType: 'single' });
// #region answer: the notes at the foot of the column that cites them
// In the Markdown: `Tejares,[^9]` cites a note (the id may be a word: `[^tejares]`), and
// a paragraph that opens with `[^9]:` anywhere in the chapter defines it. The engine
// numbers the notes in order of citation and keeps each note in the column of the line
// that cites it: a line whose note does not fit under it moves on with the note.
const footnotes = () => ({
placement: options.placement, // 'column' (the foot of the citing column) or 'chapterEnd'
numbering: options.numbering, // 'chapter': 1, 2, 3… again under every chapter heading
/* The option bar over the pages: three pairs of choices, each a segmented switch. */
#options {
display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 18px;
max-width: 1120px; margin: 0 auto; padding: 18px 16px 6px;
font: 600 12px/1.2 "IBM Plex Sans Condensed", system-ui, sans-serif;
letter-spacing: .06em; text-transform: uppercase;
}
#options fieldset {
display: flex; margin: 0; padding: 2px; border: 1px solid #4a433d; border-radius: 999px;
}
#options label {
display: block; padding: 7px 14px; border-radius: 999px; color: #c9bdae; cursor: pointer;
}
#options input { position: absolute; opacity: 0; pointer-events: none; }
#options label:has(input:checked) { background: #7d2b1f; color: #fbf8f2; }
#options label:has(input:focus-visible) { outline: 2px solid #c9bdae; outline-offset: 2px; }
The composed script.js runs as it is: paste it into any page’s module script, or open the recipe on CodePen. Recipe folder on GitHub ↗ (opens in a new tab)
Variations
#Keep chapter-end notes under the text
With placement: 'chapterEnd' the notes stand at the foot of the last column by default; chapterEndAlign: 'text' sets them right under the last paragraph.
placement: options.placement,
+ chapterEndAlign: 'text',#Drop the rule
Without the rule the notes still stand off the text by spaceAbove and spaceBelowRule.
- separator: { width: 0.25, lineWidth: pt(0.5), color: col('oxblood') },
+ separator: { enabled: false },Pitfalls
Pitfall
An opener reserves height down to its lowest page-anchored element
An advanced-design opener reserves the height of its lowest element, and page- or bleed-anchored elements below the heading count too, so decoration at the foot of the page pushes the text to the next page. Give such an element reserve: false (since postext 1.5): it is painted where it is anchored and reserves nothing. Elements that follow the band itself (anchored to its foot, or 'fill' tall) never set its height. Designed openers →
Layout warning · undefinedFootnote
Footnote without a definition
Why. A [^id] marker cites a note that no [^id]: paragraph defines, so the number prints over an empty note.
Fix. Add a [^id]: paragraph with the note, or correct the id of the marker. Docs →
Layout warning · unusedFootnote
Footnote never cited
Why. A [^id]: definition has no marker in the text, so the note is not set.
Fix. Cite it with [^id] where it belongs, or delete the definition. Docs →
- A marker in a caption, a table cell or a heading prints as written: notes are read in paragraphs, list items, quotations and boxes.
- A note is never split across columns: one taller than its column runs past the foot. Keep notes to a few lines, as editors do.
Credits
- Recipe
- Ignacio Ferro
- Text
- La vida de Lazarillo de Tormes, Burgos edition of 1554: the prologue and the beginning of the first treatise · Anonymous · public domain
- The Life of Lazarillo de Tormes, translated by Clements Markham (1908), with his notes: the prologue and the first chapter, abridged · Clements Markham · public domain
- The Spanish notes, adapted from Markham's and written for this edition · Ignacio Ferro · CC BY 4.0
- Fonts
- EB Garamond (SIL OFL 1.1) · Bodoni Moda (SIL OFL 1.1) · IBM Plex Sans Condensed (SIL OFL 1.1)
Edit this write-up ↗ (opens in a new tab)Recipe folder on GitHub ↗ (opens in a new tab)


