In breve
Un piccolo libro di poesie con lo spagnolo da una parte e la traduzione inglese accanto. Ogni gruppo di versi della traduzione comincia alla stessa altezza dell’originale.
Che cosa comporrai
Una plaquette bilingue di cinque poesie su una salina del sud della Spagna, 156 × 234 mm, con lo spagnolo a sinistra e la versione inglese del poeta stesso a destra, verso per verso. Vengono prima un frontespizio con un fenicottero e la nota dell’autore; le poesie si aprono sotto un acquerello di vasche rosa, cumuli di sale e fenicotteri all’alba. Ogni poesia sta in un riquadro senza bordo sotto un numerale color robbia in Castoro Titling, lo spagnolo in una colonna e l’inglese nell’altra. L’inglese comincia sulla stessa riga dello spagnolo, e ogni strofa comincia all’altezza del suo originale. Quando un verso inglese è troppo lungo per la sua colonna, il resto va a capo rientrato di 2 em, e la strofa spagnola di fronte finisce con una riga bianca in più.
Questa ricetta risponde a
- Come metto due colonne dentro un riquadro (una colonna di testo accanto a una colonna con una figura)?
- Come compongo poesia: una riga per verso, spazi tra le strofe, rientri sporgenti per i versi che vanno a capo, niente sillabazione?
- Come aggiungo spazio verticale tra due blocchi, se le righe vuote non hanno effetto?
- Come ottengo una buona giustificazione e sillabazione per testi in spagnolo, francese o tedesco?
La risposta breve
// Each poem is a box titled with its numeral, holding one two-column group. breaks="5"
// opens the second column at the group's 5th block, since the Spanish title and its three
// stanzas come before it. A :::space is not a block, so the gaps leave the count alone:
// :::callout{type="poem" title="I"}
// :::columns{count=2 breaks="5"}
// Spanish title, :::space{lines=0.5}, its stanzas in :::verse blocks
// English title, :::space{lines=0.5}, its stanzas in :::verse blocks
// :::
// :::
// Both columns open on the same line, so matching :::space gaps keep the stanzas level.
// keepTogether: false lets a poem that does not fit go on overleaf. A group with breaks is
// cut stream by stream (flow="parallel"): each language goes on in its own column, level.
const poem = {
id: 'poem',
backgroundEnabled: false, // no fill, border or stripe
padding: { top: pt(0), right: pt(0), bottom: pt(0), left: pt(0) },
columnGap: mm(GAP),
titleStyle: { fontFamily: 'Castoro Titling', fontSize: pt(22), fontWeight: 400,
color: col('madder'), gap: pt(4) },
// A box starts on the first grid line at least two lines down, under the picture as under
// a poem (12.3 mm there: its box ends off the grid). The default marginBottom (0.75 em)
// would add to marginTop and open 17.4 mm between poems.
marginTop: pt(LEAD * 2), marginBottom: pt(0),
keepTogether: false, // a long poem goes on overleaf instead of moving whole
};
Ingredienti
- Funzionalità
- Versi riga per rigaColonne in un riquadro o nel testoSpazio verticale esplicitoStili di paragrafoRiquadriSillabazione e lingua del documentoStili di titoloAperture progettateAttributi dei titoliImmagini nei progetti di paginaCopertine, frontespizi e colophonMetadati del documentoBilanciamento delle colonneTestatine e folioTestatine secondo il ruolo della paginaMargini speculariTavolozza di colori semanticaFigure e tabelle come risorseTestatine per sezionePagine su un canvas
- Tipo
- Castoro, Castoro Titling, Tenor Sans (SIL OFL 1.1)
- Risorse
flamingo-680.jpgsalina-1560.jpg- The salt pans at sunrise over the poems, a watercolour (Generated With Diffusion Models, originale)
- The flamingo on the title page, a watercolour (Generated With Diffusion Models, originale)
Preparazione
#1 · Una poesia è un riquadro con un salto di colonna fisso
Il codice è la risposta breve qui sopra. Ogni poesia è un riquadro attorno a un gruppo :::columns; il suo stile elimina il riempimento e il padding e stampa il title del blocco, il numerale (:::columns). Senza breaks, il gruppo taglia dove le sue due colonne risultano pari. Le due metà di queste poesie hanno la stessa altezza, quindi il taglio cade comunque sul titolo inglese; allunga due versi di The Rake finché vanno a capo, e il taglio scende di un blocco e lascia «THE RAKE» al piede della colonna spagnola. breaks="5" indica il blocco che apre la seconda colonna, così il titolo inglese la intesta qualunque sia l’altezza delle due metà.
#2 · Un blocco :::verse per colonna, una riga bianca per ogni cambio di strofa
// Each half of a poem is a :::verse block, a line of verse a line of Markdown and a blank line
// between stanzas. A line too long for its 55 mm column turns over 2 em in, where it cannot
// pass for the next line; the Spanish half then ends that stanza's block and a
// :::space{lines=2} before the next keeps the stanzas level across the gutter.
const verse = { id: 'verse', hangingIndent: em(2) };
// Castoro Titling draws capitals only. A :::space{lines=0.5} in the Markdown sets each title
// off its poem.
const poemTitle = { id: 'poem-title', fontFamily: 'Castoro Titling', fontSize: pt(9.5),
color: col('madder'), firstLineIndent: pt(0) };
Ogni metà di una poesia è un blocco :::verse: un verso per ogni riga del Markdown, in bandiera e mai sillabato, e una riga bianca tra le strofe, che lascia una riga bianca nella colonna (:::verse). Ogni strofa è un blocco, quindi breaks conta le strofe, non i versi. L’inglese each one standing on its own reflection. è troppo lungo per la sua colonna di 55 mm e va a capo rientrato di 2 em; la metà spagnola chiude il suo blocco dopo la strofa di fronte e mette un :::space{lines=2} prima della successiva, così le strofe seguenti cominciano sulla stessa riga. Un :::space non è un blocco, e breaks non lo conta (:::space).

#3 · La nota si sillaba nella sua lingua
const LOCALE = t({ en: 'en-us', es: 'es' }); // the patterns of the edition's language
const bodyText = {
fontFamily: 'Castoro', fontSize: pt(10.5), lineHeight: pt(LEAD), color: col('ink'),
italicColor: col('ink'), firstLineIndent: mm(4.5), indentAfterHeading: false,
minWordSpacing: 0.8, maxWordSpacing: 1.35, // word spaces from 0.8 to 1.35 of normal
// No bold on these pages: ink keeps a **bold** or a :ref added later off the default blue
// (#295AA3). References take boldColor while referenceColor is unset.
boldColor: col('ink'),
};
// The heading prints its title 36 mm down the text block, and the note starts under it.
const notePage = { id: 'note', advancedDesign: { enabled: true, slot: {
elements: [{ kind: 'text', id: 'title', content: '{titleText}', align: 'left',
fontFamily: 'Castoro Titling', fontSize: pt(13), color: col('madder'), overflow: 'wrap',
placement: { anchor: { to: 'container', edge: 'top-left' }, offset: { y: mm(36) } } }],
} } };
locale sceglie i pattern di sillabazione. Con 'es' la nota spagnola divide ori-ginal e Duna-liella; con i pattern inglesi entrambe le parole vanno intere alla riga successiva, e solo arras-traba si divide con l’uno e con l’altro (lingue supportate). Gli spazi tra parole possono restringersi fino a 0,8 e allargarsi fino a 1,35 della loro larghezza normale, e nessuna riga giustificata delle due note si allarga oltre. Il titolo della nota è una grafica il cui unico elemento, il titolo, sta 36 mm sotto il bordo superiore della gabbia del testo, così la nota comincia a 73 mm dal bordo superiore della sua pagina.
#4 · Il frontespizio e l’acquerello sono titoli
const onPage = (y) => ({ anchor: { to: 'page', edge: 'top' }, offset: { y: mm(y) } });
const face = (id, content, font, size, y, extra = {}) => ({ kind: 'text', id, content,
fontFamily: font, fontSize: pt(size), color: col('ink'), align: 'center', overflow: 'wrap',
placement: onPage(y), ...extra });
const tracked = { letterSpacing: pt(2), textTransform: 'uppercase' };
const image = (id, placement) => ({ kind: 'image', id, resourceId: id, placement });
const titlePage = {
id: 'title-page',
header: { elements: [] }, footer: { elements: [] }, // no running head, no folio
advancedDesign: { enabled: true, slot: { elements: [
face('author', '{author}', 'Tenor Sans', 9, 44, { ...tracked, color: col('muted') }),
face('title', '{titleText}', 'Castoro Titling', 34, 58, { lineHeight: 1 }),
face('other', '{attr.other}', 'Castoro', 16, 76, { italic: true, color: col('madder') }),
image('flamingo', { ...onPage(96), size: { width: mm(34) } }),
face('edition', '{attr.edition}', 'Tenor Sans', 8.5, 170, tracked),
face('version', '{attr.version}', 'Castoro', 10.5, 176, { italic: true }),
face('press', '{attr.press}', 'Tenor Sans', 8, 206, { ...tracked, color: col('muted') }),
] } },
};
// The picture of the salt pans runs 84 mm down from the top edge of the page, and the heading
// reserves down to its foot. No margin under it: the poem's own marginTop sets the gap.
const poemsOpener = {
id: 'poems', marginBottom: pt(0),
advancedDesign: { enabled: true, slot: { elements: [
image('salina', { anchor: { to: 'page', edge: 'top-left' }, size: { width: 'fill' } }),
face('title', '{titleText}', 'Castoro Titling', 38, 17, { lineHeight: 1 }),
face('other', '{attr.other}', 'Castoro', 15, 33, { italic: true, color: col('madder') }),
] } },
};
Ciascuno è un titolo di livello 1 con uno stile proprio (stili dei titoli): la grafica del frontespizio prende {author} dal front matter, ed entrambe le grafiche prendono {attr.other} dagli attributi del titolo. L’acquerello è ancorato al bordo superiore della pagina, sopra la gabbia del testo, e il titolo riserva lo spazio fino al suo piede, 84 mm sotto il bordo. Lo stile imposta marginBottom: pt(0), quindi lo spazio sotto l’immagine è il margine superiore di due righe della poesia stessa, e la poesia I comincia sulla prima riga della griglia ad almeno due righe sotto l’immagine.
#5 · Le testatine nominano entrambe le lingue
const edgeAt = (edge, x, y) => ({ anchor: { to: 'page', edge }, offset: { x: mm(x), y: mm(y) } });
const head = (id, content, parity, placement, extra = {}) => ({ kind: 'text', id, content,
parity, pages: 'body', fontFamily: 'Tenor Sans', fontSize: pt(7.5), color: col('muted'),
...tracked, letterSpacing: pt(1.5), placement, ...extra });
const folio = { color: col('ink'), letterSpacing: pt(0) };
const TITLES = ['Sal de agosto', 'August Salt']; // the book's title in its two languages
const header = { elements: [
head('verso-folio', '{pageNumber}', 'even', edgeAt('top-left', OUTER, 12), folio),
head('verso-title', TITLES[0], 'even', edgeAt('top-left', OUTER + 8, 12)),
head('recto-title', TITLES[1], 'odd', edgeAt('top-right', -(OUTER + 8), 12)),
head('recto-folio', '{pageNumber}', 'odd', edgeAt('top-right', -OUTER, 12), folio),
] };
// The note and the picture open their pages ('opener'): a folio at the foot instead.
const footer = { elements: [head('drop-folio', '{pageNumber}', 'all', edgeAt('bottom', 0, -12),
{ ...folio, pages: 'opener' })] };
Il verso riporta il titolo spagnolo e il recto quello inglese, nell’ordine delle colonne. pages: 'body' le tiene lontane dalle tre pagine che si aprono con un titolo. La nota e l’acquerello hanno invece un numero di pagina al piede, e lo stile del frontespizio svuota intestazione e piè di pagina (elementi di testo).
La ricetta completa
// ═══ Postext Cookbook · Nº 043 · Facing translation, stanza by stanza ═══════════════════
// https://postext.dev/en/cookbook/bilingual-facing-verse
// Code: MIT · Text: original (CC BY 4.0) · Salt pans and flamingo: diffusion models
// Fonts: Castoro, Castoro Titling, Tenor Sans (SIL OFL 1.1) · Needs postext ≥ 1.34.0
import {
buildDocumentWithFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';
const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'bilingual-facing-verse';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
const palette = { // every colour in the config links to one of these
ink: '#1f2430', // the text: a blue-black
madder: '#9a3c52', // the one accent: numerals, poem titles, the other language's title
muted: '#6a6770', // running heads, folios, the author's name, the colophon
paper: '#ffffff',
};
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' } }));
const TRIM_W = 156, TRIM_H = 234; // mm
const TOP = 22, OUTER = 18, INNER = 20; // mm: the text block is 118 mm wide
const LEAD = 14.5; // pt: the leading of the note and of every line of verse
const GAP = 8; // mm between the original and the translation: each column is 55 mm wide
// #region answer: a poem and its translation: a box with two columns and a fixed break
// Each poem is a box titled with its numeral, holding one two-column group. breaks="5"
// opens the second column at the group's 5th block, since the Spanish title and its three
// stanzas come before it. A :::space is not a block, so the gaps leave the count alone:
// :::callout{type="poem" title="I"}
// :::columns{count=2 breaks="5"}
// Spanish title, :::space{lines=0.5}, its stanzas in :::verse blocks
// English title, :::space{lines=0.5}, its stanzas in :::verse blocks
// :::
// :::
// Both columns open on the same line, so matching :::space gaps keep the stanzas level.
// keepTogether: false lets a poem that does not fit go on overleaf. A group with breaks is
// cut stream by stream (flow="parallel"): each language goes on in its own column, level.
const poem = {
id: 'poem',
backgroundEnabled: false, // no fill, border or stripe
padding: { top: pt(0), right: pt(0), bottom: pt(0), left: pt(0) },
columnGap: mm(GAP),
titleStyle: { fontFamily: 'Castoro Titling', fontSize: pt(22), fontWeight: 400,
color: col('madder'), gap: pt(4) },
// A box starts on the first grid line at least two lines down, under the picture as under
// a poem (12.3 mm there: its box ends off the grid). The default marginBottom (0.75 em)
Lo script.js composto funziona così com’è: incollalo nello script modulo di qualsiasi pagina, oppure apri la ricetta su CodePen. Cartella della ricetta su GitHub ↗ (si apre in una nuova scheda)
Varianti
#Allarga l’intercolonna
A 12 mm le colonne si restringono a 53 mm, e Los turistas paran y hacen fotos: va a capo nella poesia III, così la sua seconda strofa comincia una riga sotto l’inglese; chiudi il blocco inglese dopo quella strofa e metti un :::space{lines=2} prima della successiva per allinearle.
-const GAP = 8; // mm between the original and the translation: each column is 55 mm wide
+const GAP = 12; // mm between the original and the translation: each column is 53 mm wide#Rientra di più i versi a capo
A 3 em, reflection. a pagina 3 comincia un em più all’interno.
-const verse = { id: 'verse', hangingIndent: em(2) };
+const verse = { id: 'verse', hangingIndent: em(3) };Errori frequenti
- Un
:::spacemesso prima del titolo inglese sparisce: la seconda colonna si apre al blocco chebreaksindica, e lo spazio cade sul taglio. Mettilo dopo il titolo, come il:::space{lines=0.5}sotto ogni titolo di colonna in questa ricetta. - Conta
breaksdal titolo spagnolo: con un titolo e tre strofe, il titolo inglese è il blocco 5. Ogni strofa è un blocco, quindi una strofa spagnola in più sposta il titolo inglese al blocco 6, ebreaksdeve salire con lui; un verso in più in una strofa non sposta nulla.
Crediti
- Ricetta
- Ignacio Ferro
- Testo
- The poem cycle Sal de agosto and its English version, August Salt, with the author’s note, written for this recipe; the poet Adela Membrives is fictional · Postext Cookbook · CC BY 4.0
- Immagini
- The salt pans at sunrise over the poems, a watercolour · Generated With Diffusion Models · originale
- The flamingo on the title page, a watercolour · Generated With Diffusion Models · originale
- Font
- Castoro (SIL OFL 1.1) · Castoro Titling (SIL OFL 1.1) · Tenor Sans (SIL OFL 1.1)
- Codice
- MIT, come Postext
Modifica questo testo ↗ (si apre in una nuova scheda)Cartella della ricetta su GitHub ↗ (si apre in una nuova scheda)


