Vai al contenuto principale
Ricetta numero 113

Ricettario · Capitolo 5 · Struttura del libro

Un taḥqīq: note per pagina e preliminari in abjad

Pagine preliminari numerate أ ب ج د, il testo da ١, le note del curatore numerate (١) da capo su ogni pagina e un indice che ordina i nomi senza l’articolo ال.

In questa pagina
Output
Canvas · PDF
Livello
Avanzato
Postext
Provata con Postext 1.65.0
Richiede ≥ 1.25.0 · postext-pdf ≥ 1.25.0
Licenza
Aggiornata il 10 ott 2026
Codice MIT · Testo MIT

pp. د–١ · 4–5 di 11

  • Esempio in inglese: non c’è ancora un’edizione italiana
  • Formato 170 × 240 mm
  • 1 colonna
  • Amiri 13/22,5
  • Aref Ruqaa
  • 11 pagine
  • Livello
  • Postext 1.65.0
  • Impaginato in 432 ms
  • 165 righe di codice

In breve

L’inizio della Muqaddima di Ibn Khaldūn come edizione critica araba moderna: pagine dell’introduzione numerate con lettere, il testo con cifre e note a piè di pagina che ricominciano da uno su ogni pagina.

Che cosa comporrai

Undici pagine di un’edizione critica araba moderna, un taḥqīq, della prima sezione della Muqaddima di Ibn Khaldūn, sull’eccellenza della storia. Le pagine preliminari sono numerate con lettere abjad, come fanno le edizioni del Cairo e di Beirut: un frontespizio أ, il suo colophon ب, poi l’introduzione del curatore ج e د. Il testo riparte da ١ sul recto successivo. Le note del curatore stanno al piede di ogni pagina, numerate (١), (٢), (٣) e ricominciando su ogni pagina, sotto un breve filetto a destra; spiegano le parole rare, identificano le persone e i luoghi che Ibn Khaldūn nomina e danno la sura e il versetto di ogni citazione del Corano. Un indice dei nomi chiude il libro, ordinato come gli indici arabi, senza l’articolo ال. Le note e l’introduzione sono scritte per questa ricetta.

Questa ricetta risponde a

  • Come numero le pagine preliminari di un libro arabo con le lettere abjad (أ، ب، ج)?
  • Come numero le note a piè di pagina arabe per pagina, tra parentesi: (١)?

La risposta breve

script.js · righe 33–48nel codice completo
// The page counter starts in abjad letters: the title page is أ, its back ب, the editor's
// introduction ج and د. Before the text, two directives in the Markdown count again from 1,
// in the document's digits (١ ٢ ٣ in an `ar` document), on the next odd page:
//   :::pagebreak{parity="odd"}
//   :::numbering{format="arabic-indic" startAt=1}
// {pageNumber} prints each page's own label, so one footer and one header serve both runs.
const pageNumbering = { format: 'abjad', startAt: 1 }; // أ ب ج د هـ و ز ح…
// The editor's notes: numbered again on every page, written «(١)», raised after the word in
// the text and on the line at the head of the note. The rule over the notes and each note's
// number stand on the start side, the right, because the page runs right to left.
const footnotes = {
  numbering: 'page', markerTemplate: '({n})', noteNumberPosition: 'inline',
  fontSize: pt(10.5), lineHeight: pt(18.5), color: col('ink'), textAlign: 'justify',
  spaceAbove: pt(14), spaceBelowRule: pt(6),
  separator: { width: 0.28, lineWidth: pt(0.6), color: col('rule') },
};

Ingredienti

Tipo
Amiri, Aref Ruqaa (SIL OFL 1.1)
Risorse
Nessuna: ogni immagine è disegnata nel codice

Preparazione

#1 · Due serie di folio e note per pagina

Il codice è la risposta breve qui sopra. page.pageNumbering comincia il libro in 'abjad', le lettere in ordine abjad, con هـ per cinque. Prima del testo due direttive fanno ripartire il conteggio dalla pagina dispari successiva nelle cifre del documento (:::numbering, Cifre e stili numerali). Le note usano numbering: 'page', un markerTemplate di '({n})' e noteNumberPosition: 'inline', così il richiamo è in apice nel testo e la nota si apre con il suo numero sulla riga (Note a piè di pagina).

Pagina ١: le note ripartono da (١), sotto un filetto sul lato d’inizio della pagina.

#2 · Un indice che salta l’articolo

script.js · righe 52–60nel codice completo
// Marks in the text, `:index[المسعودي]`, `:index[الطّبريّ]{term="الطبري"}`. With
// ignoreArticle, المسعودي files under م and الطبري under ط; ابن الكلبي stays under ا.
// It is the default when the index sorts in Arabic: written out here to say so.
const index = { ignoreArticle: true, fontFamily: NASKH, fontSize: pt(11), lineHeight: pt(17),
  color: col('ink'), groups: { fontFamily: NASKH, fontWeight: 700, fontSize: pt(13),
    color: col('accent'), marginTop: pt(8) } };
const indexStyle = { id: 'index', numbered: false, toc: false, span: 'page',
  breakBefore: { enabled: true, parity: 'any' },
  layout: { layoutType: 'double', gutterWidth: mm(10) } }; // two columns under the title

I nomi sono segnati nel testo, :index[المسعودي], e :::index li stampa alla fine. Con ignoreArticle, المسعودي va sotto م e الطبري sotto ط, mentre ابن إسحاق resta sotto ا; un rimando «vedi» manda إسرائيل a يعقوب (Sommario e indice). I numeri di pagina nell’indice sono le etichette delle pagine, quindi un nome dell’introduzione riporta ج.

#3 · Testatine sopra un filetto

script.js · righe 88–110nel codice completo
// Running heads are physical. In a book bound on the right the verso (even) is the right
// page: its outer edge, the folio's, is the right one, and its text block starts INNER mm
// from the left edge; the recto (odd) mirrors it.
const HEAD_Y = 14; // mm from the trim
const blockX = (parity) => (parity === 'even' ? INNER : OUTER); // the text block's left edge
const heads = (parity, content) => [
  text(`${parity}-head`, content, NASKH, 10.5,
    { ...at('top-left', blockX(parity), HEAD_Y, 'page'), size: { width: mm(MEASURE) } },
    { color: col('muted'), parity, pages: 'body' }),
  text(`${parity}-folio`, '{pageNumber}', NASKH, 11.5, parity === 'even'
    ? at('top-right', -OUTER, HEAD_Y, 'page') : at('top-left', OUTER, HEAD_Y, 'page'),
  { parity, pages: 'body', align: parity === 'even' ? 'right' : 'left' }),
  { ...rule(`${parity}-rule`, HEAD_Y + 7, MEASURE, 'top-left', 'page', blockX(parity)),
    parity, pages: 'body' },
];
const header = { elements: [...heads('even', '{title}'), ...heads('odd', '{chapterTitle}')] };
const dropFolio = (pages) => text(`folio-${pages}`, '{pageNumber}', NASKH, 11.5,
  at('bottom', 0, -12, 'page'), { pages });
const footer = { elements: [dropFolio('opener')] }; // on the openers, under the text
// Front matter: no running heads, the abjad folio centred at the foot of every page.
const front = { id: 'front', numbered: false, toc: false,
  breakBefore: { enabled: true, parity: 'any' }, header: { elements: [] },
  footer: { elements: [dropFolio('all')] }, advancedDesign: titleOnly(22) };

Il verso riporta il titolo del libro e il recto la sezione, sopra un filetto sottile largo quanto la gabbia del testo, con il numero di pagina all’estremità esterna. In un libro rilegato a destra il verso è la pagina di destra, quindi il suo numero di pagina va in alto a destra (Ordine delle pagine e rilegatura a destra). Le aperture e le pagine preliminari ricevono invece un numero di pagina centrato al piede.

#4 · Un frontespizio e il suo colophon

script.js · righe 114–135nel codice completo
const onPage = (y) => at('top', 0, y, 'page');
const blind = { numbered: false, toc: false, span: 'page', runningChapter: false,
  breakBefore: { enabled: true, parity: 'any' }, header: { elements: [] },
  footer: { elements: [] } }; // blind folios: أ and ب count, but do not print
const titlePage = { id: 'title', ...blind, advancedDesign: design([
  text('book', '{attr.book}', NASKH, 14, onPage(44), { color: col('muted') }),
  rule('rule-top', 58, 40, 'top', 'page'),
  text('title', '{titleText}', RUQAA, 44, onPage(64), { fontWeight: 700,
    color: col('accent'), lineHeight: 1.3 }),
  rule('rule-foot', 92, 40, 'top', 'page'),
  text('author', 'تأليف {author}', NASKH, 15, onPage(100), { fontWeight: 700 }),
  text('years', '{attr.years}', NASKH, 12, onPage(110)),
  text('part', '{attr.part}: {subtitle}', NASKH, 13, onPage(132)),
  text('editor', '{attr.editor}', NASKH, 12, onPage(178), { color: col('accent') }),
  text('latin', '{attr.latin}', NASKH, 9.5, { ...onPage(196), size: { width: mm(110) } },
    { color: col('muted'), direction: 'ltr' }), // a Latin line: its own direction
], 0) };
const imprintPage = { id: 'imprint', ...blind, advancedDesign: design([
  text('edition', '{attr.edition}', NASKH, 11, onPage(170)),
  text('imprint', '{attr.imprint}', NASKH, 9, { ...onPage(180), size: { width: mm(100) } },
    { color: col('muted'), lineHeight: 1.45, direction: 'ltr' }),
], 0) };

Il frontespizio e il colophon sul suo retro sono stili di titolo senza nulla nel flusso: le loro righe vengono da attributi del titolo, così le righe latine del colophon, che cambiano con l’edizione, sono un solo attributo nel Markdown.

La ricetta completa

Sandbox
// ═══ Postext Cookbook · Nº 113 · A critical edition (taḥqīq) with notes per page ═══════
// https://postext.dev/en/cookbook/tahqiq-critical-edition
// Code: MIT · Text: Ibn Khaldūn, al-Muqaddima, ar.wikisource (PD) · Pictures: none
// Fonts: Amiri, Aref Ruqaa (SIL OFL 1.1) · Needs postext ≥ 1.25.0
import { buildDocument, withLoadedFonts, 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 = 'tahqiq-critical-edition';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// A modern Cairo taḥqīq: black Naskh on a cream paper, headings and rules in one dark red.
const palette = {
  ink: '#1e1a16', // text and notes: a warm near-black
  accent: '#8a2a1d', // headings, the title, the index letters
  rule: '#8c7a62', // hairlines: the rule under the running heads, the rule over the notes
  muted: '#5e564c', // running heads, the imprint
  paper: '#fbf8f0', // a cream paper
};
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' } })),
  { id: 'main-color', name: 'accent (defaults)', value: { hex: palette.accent, model: 'hex' } },
];
const NASKH = 'Amiri'; // text, notes, headings in bold, running heads, index
const RUQAA = 'Aref Ruqaa'; // display: the title on the title page
const [W, H] = [170, 240]; // mm: 17 × 24 cm, the size of most Cairo and Beirut editions
const [TOP, INNER, OUTER] = [22, 20, 16]; // mm; `left` is the inner margin on both pages
const MEASURE = W - INNER - OUTER; // 134 mm
const [SIZE, LEAD] = [13, 22.5]; // pt: 1.73 ×, so the few vowels marked clear the line above

// #region answer: abjad folios for the front matter, Arabic-Indic from the text, notes (١)
// The page counter starts in abjad letters: the title page is أ, its back ب, the editor's
// introduction ج and د. Before the text, two directives in the Markdown count again from 1,
// in the document's digits (١ ٢ ٣ in an `ar` document), on the next odd page:
//   :::pagebreak{parity="odd"}
//   :::numbering{format="arabic-indic" startAt=1}
// {pageNumber} prints each page's own label, so one footer and one header serve both runs.
const pageNumbering = { format: 'abjad', startAt: 1 }; // أ ب ج د هـ و ز ح…
// The editor's notes: numbered again on every page, written «(١)», raised after the word in
// the text and on the line at the head of the note. The rule over the notes and each note's
// number stand on the start side, the right, because the page runs right to left.
const footnotes = {
  numbering: 'page', markerTemplate: '({n})', noteNumberPosition: 'inline',
  fontSize: pt(10.5), lineHeight: pt(18.5), color: col('ink'), textAlign: 'justify',
  spaceAbove: pt(14), spaceBelowRule: pt(6),
  separator: { width: 0.28, lineWidth: pt(0.6), color: col('rule') },
};

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

#Usa i numerali abjad

'arabic-abjad' scrive i numerali abjad additivi invece della semplice serie di lettere: l’undicesima pagina è يا, non ك.

-const pageNumbering = { format: 'abjad', startAt: 1 }; // أ ب ج د هـ و ز ح…
+const pageNumbering = { format: 'arabic-abjad', startAt: 1 }; // … ط ي يا يب

#Numera le note lungo tutta la sezione

numbering: 'chapter' fa proseguire il conteggio delle note da una pagina all’altra, come fanno alcune edizioni più vecchie.

-  numbering: 'page', markerTemplate: '({n})', noteNumberPosition: 'inline',
+  numbering: 'chapter', markerTemplate: '({n})', noteNumberPosition: 'inline',

Errori frequenti

Errore frequente

Assegna a un libro arabo il tag 'ar', non LANG

Le edizioni di una ricetta sono en ed es, ma un esempio arabo è arabo in entrambe: `locale: LANG` lo comporrebbe da sinistra a destra, lo rilegherebbe a sinistra, numererebbe le pagine 1 2 3 e darebbe alle figure didascalie Figure o Figura. Da postext 1.30 il tag è anche la lingua usata per lo shaping del testo (misura, disegno e incorporamento), quindi con un tag inglese o spagnolo un carattere come Markazi Text non disegna le forme arabe delle sue virgolette basse e dei suoi segni di interpunzione, e le righe vanno a capo altrove. Scrivi tu il tag: 'ar' (cifre arabo-indiane, la convenzione del Mashriq), una regione come 'ar-EG' o 'ar-SA', oppure 'ar-MA', 'ar-DZ' o 'ar-TN' per un’edizione del Maghreb con cifre europee. Una pagina latina che si limita a citare l’arabo mantiene la propria lingua. Testo da destra a sinistra →

Errore frequente

I caratteri arabi hanno bisogno del loro file arabic, tramite il blocco arabic

Fontsource serve Amiri, Noto Naskh Arabic o Scheherazade New come un file per sottoinsieme, e le lettere arabe stanno nel file arabic. loadFonts scarica solo latin (e latin-ext), così a schermo l’arabo viene da un font di sistema ed è misurato male, e fontsourceProvider passa al PDF quel file latin, che stampa riquadri vuoti. Elenca il blocco arabic del kit, chiama loadArabicFonts(FONTS, markdown) dopo loadFonts, con ogni peso che le pagine compongono in arabo elencato in FONTS, e passa a renderToPdf fontProvider: arabicPdfProvider. Font arabi →

Errore frequente

:::numbering ha effetto dalla pagina successiva

:::numbering cambia il conteggio a partire dalla prossima pagina che comincia, non da quella corrente. Mettilo subito dopo un :::pagebreak (parity odd prima del primo capitolo) perché la nuova numerazione cominci dove intendi. Pagine preliminari in numeri romani →

Crediti

Testo
  • The opening section of the Muqaddima, “On the excellence of history”, as ar.wikisource gives it (revision 610595), without its notes · Ibn Khaldūn · pubblico dominio
  • The editor’s introduction in Arabic, the notes, the index and the imprint · Postext Cookbook · originale
Font
Amiri (SIL OFL 1.1) · Aref Ruqaa (SIL OFL 1.1)
SandboxPDF