Aller au contenu principal
Recette numéro 158

Recettes · Chapitre 12 · Manuels scolaires

Une frise chronologique illustrée sur une double page

Un gabarit en double page pour la frise d’un manuel : un bandeau passe le dos, une grille répète une fiche par date, un connecteur rejoint chaque fiche.

Sur cette page
Sortie
Canvas · PDF
Niveau
Avancé
Postext
Testé avec Postext 1.65.0
Nécessite ≥ 1.49.0 · postext-pdf ≥ 1.49.0
Licence
Mis à jour le 21 oct. 2026
Code MIT · Texte CC BY 4.0

p. 48–49 · 1–2 sur 2

  • Exemple en anglais : pas encore d’édition française
  • Format 210 × 280 mm
  • 1 colonne
  • Literata 12,4/17
  • Archivo
  • 2 pages
  • Niveau
  • Postext 1.65.0
  • Mis en page en 126 ms
  • 187 lignes de code

En bref

Deux pages en vis-à-vis d’un manuel d’histoire faites comme une seule : un bandeau coloré traverse le livre, six fiches illustrées y sont suspendues, et le gabarit dessine une seule fiche et un seul trait, quel que soit le nombre de dates.

Ce que vous allez composer

Les pages 48 et 49 d’un manuel d’histoire de collège : La route du papier, mille ans de métier, de l’atelier de Cai Lun à la meule de Keller. La page de gauche s’ouvre sur le titre et deux paragraphes, celle de droite sur un encadré qui raconte comment on fabriquait une feuille à la main. Au milieu court la frise : un bandeau indigo pour l’Asie, un bandeau terre cuite pour l’Europe, qui part de la page de gauche et passe le dos. Dessous, six fiches avec leur dessin, suspendues au bandeau par un anneau et un trait. Le gabarit dessine une fiche asiatique, une fiche européenne et un connecteur par bandeau : une grille pose une fiche pour chaque date du Markdown, et le connecteur retrouve toutes les fiches que la grille a posées. Tous les mots sont dans le Markdown, en espagnol, en anglais et en japonais ; cette page montre l’édition anglaise.

Cette recette répond à

  • Comment mettre en page une frise chronologique sur une double page, avec un bandeau qui passe le dos et des fiches sur les deux pages ?
  • Comment faire qu’une rangée d’encadrés se partage la largeur et que celui au texte le plus long s’élargisse ?

La réponse courte

script.js · lignes 54–81dans le code complet
const pageTemplates = [{
  id: 'timeline',
  spread: true, // two facing pages laid as one sheet; it opens on a verso
  gutter: mm(10), // the band round the spine that frames keep off
  grid: { columns: 2, rows: ROWS, columnGap: mm(2 * PAGE.inner), rowGap: mm(ROW_GAP) },
  frames: [
    { name: 'title', takes: 'h1' },
    { name: 'lead', flow: true, fit: { minScale: 0.8 } },
    { name: 'box', style: 'box', grid: { col: 2, row: 1, rows: 4 }, height: 'fill',
      padding: { right: mm(66) }, fit: { minScale: 0.85 } },
    { name: 'box-picture', layer: 2, width: mm(56), placement: at('#box', 'top-right', -5, 10) },
    { name: 'band-1', style: 'band-asia', grid: { col: 1, row: 5 }, height: mm(BAND) },
    { name: 'band-2', style: 'band-europe', crossGutter: true, width: 'fill', height: mm(BAND),
      padding: { left: mm(2 * PAGE.inner + 4) }, // the colour crosses the fold, the words do not
      placement: at('#band-1', 'right-of') },
    card('asia', 'card-asia'), card('europe', 'card-europe'),
    { name: 'colophon', style: 'colophon', optional: true, width: mm(170),
      placement: at('page', 'bottom-right', -PAGE.outer, -7) },
  ],
  groups: [
    { name: 'opening', kind: 'stack', grid: { col: 1, row: 1, rows: 4 }, gap: mm(4),
      frames: ['title', 'lead'] },
    // A row of cards under each band, as many as the Markdown has: a longer text makes its
    // row taller, and the other cards of the row stretch to the same height.
    row('asia', 1), row('europe', 2),
  ],
  decoration: { elements: [ground(), ticks('band-1', 'asia'), ticks('band-2', 'europe')] },
}];

Ingrédients

Typographie
Literata, Archivo, Noto Serif JP, Noto Sans JP (SIL OFL 1.1)
Ressources
  • forma-800.jpg
  • v105-1000.jpg
  • v1150-1000.jpg
  • v1282-1000.jpg
  • v1844-1000.jpg
  • v610-1000.jpg
  • v751-1000.jpg
  • A Han court official watches a craftsman lift a bamboo mould from a vat. (Generated With Diffusion Models, original)
  • A monk shows two Japanese courtiers how to hold a papermaking mould. (Generated With Diffusion Models, original)
  • Papermakers by a canal in Samarkand, sheets drying on a wall. (Generated With Diffusion Models, original)
  • A paper workshop below the castle of Xàtiva. (Generated With Diffusion Models, original)
  • A Fabriano mill with its water wheel; a sheet held up to the light. (Generated With Diffusion Models, original)
  • A craftsman grinds a spruce log against a stone into wood pulp. (Generated With Diffusion Models, original)
  • Two hands lift a papermaker's mould from a vat of pulp. (Generated With Diffusion Models, original)

Préparation

#1 · Une feuille pour deux pages

script.js · lignes 54–81dans le code complet
const pageTemplates = [{
  id: 'timeline',
  spread: true, // two facing pages laid as one sheet; it opens on a verso
  gutter: mm(10), // the band round the spine that frames keep off
  grid: { columns: 2, rows: ROWS, columnGap: mm(2 * PAGE.inner), rowGap: mm(ROW_GAP) },
  frames: [
    { name: 'title', takes: 'h1' },
    { name: 'lead', flow: true, fit: { minScale: 0.8 } },
    { name: 'box', style: 'box', grid: { col: 2, row: 1, rows: 4 }, height: 'fill',
      padding: { right: mm(66) }, fit: { minScale: 0.85 } },
    { name: 'box-picture', layer: 2, width: mm(56), placement: at('#box', 'top-right', -5, 10) },
    { name: 'band-1', style: 'band-asia', grid: { col: 1, row: 5 }, height: mm(BAND) },
    { name: 'band-2', style: 'band-europe', crossGutter: true, width: 'fill', height: mm(BAND),
      padding: { left: mm(2 * PAGE.inner + 4) }, // the colour crosses the fold, the words do not
      placement: at('#band-1', 'right-of') },
    card('asia', 'card-asia'), card('europe', 'card-europe'),
    { name: 'colophon', style: 'colophon', optional: true, width: mm(170),
      placement: at('page', 'bottom-right', -PAGE.outer, -7) },
  ],
  groups: [
    { name: 'opening', kind: 'stack', grid: { col: 1, row: 1, rows: 4 }, gap: mm(4),
      frames: ['title', 'lead'] },
    // A row of cards under each band, as many as the Markdown has: a longer text makes its
    // row taller, and the other cards of the row stretch to the same height.
    row('asia', 1), row('europe', 2),
  ],
  decoration: { elements: [ground(), ticks('band-1', 'asia'), ticks('band-2', 'europe')] },
}];

spread: true fait du gabarit une seule feuille large comme les deux pages, et le délimiteur de la page l’indique aussi avec spread. Une double page commence sur une page paire : la composition reçoit donc continuation: { pageIndexOffset: 1, pageNumbering: { startAt: 48 } }. La page 1 de cet extrait est la page 48 du livre, une page de gauche, et aucune page blanche ne la précède. La grille a une colonne par page, séparées par deux fois la marge intérieure : seul le bandeau approche donc du pli. Le second bandeau a crossGutter et un retrait gauche de 36 mm : sa couleur part de la fin du premier et passe le dos, ses mots commencent sur la page de droite, là où la mise en page les place.

#2 · Une fiche, répétée par une grille

script.js · lignes 46–50dans le code complet
// Each `:::frame{slot="asia"}` of the page is an item of the `asia` grid: the grid lays the
// card frame once per item, three to a row, and names the copies `#asia[1]`, `#asia[2]`…
const card = (name, style) => ({ name, style, minHeight: mm(CARD) }); // auto above that height
const row = (name, col) => ({ name: `${name}-row`, kind: 'grid', columns: 3, columnGap: mm(5),
  grid: { col, row: 6, rows: ROWS - 5 }, repeat: { frames: [name] } });

Un groupe kind: 'grid' avec repeat: { frames: ['asia'] } pose le bloc asia une fois pour chaque :::frame{slot="asia"} de la page, trois par rangée, dans la cellule col: 1 de la grille du gabarit, rangées 6 à 12. Les copies s’appellent #asia[1], #asia[2] et #asia[3], et chacune prend le label de son propre délimiteur, la date de son onglet. Une fiche mesure au moins minHeight et passe en auto au-delà : quand un texte s’allonge, comme celui de 1844 en espagnol et en japonais, sa rangée grandit et les autres fiches de la rangée s’étirent à la même hauteur (rowAlign vaut 'stretch' par défaut). Une quatrième date dans le Markdown ouvre une seconde rangée sous la première, sans toucher au gabarit.

#3 · Un connecteur par bandeau

script.js · lignes 85–91dans le code complet
// `routing: 'tree'` with `trunk: 0` draws no bar of its own: each drop hangs from the band's
// foot straight down to the middle of a card's top, and `#asia[*]` names every card laid.
function ticks(band, cards) {
  return { kind: 'connector', id: `${cards}-ticks`, routing: 'tree', trunk: 0,
    from: { to: `#${band}`, side: 'bottom', gap: mm(2.4) }, to: { to: `#${cards}[*]`, side: 'top' },
    color: col(cards), width: pt(1), startCap: 'ring', capSize: mm(3.6) };
}

Les traits sont un connector par bandeau dans le décor (decoration) du gabarit. routing: 'tree' relie un parent à plusieurs enfants ; avec trunk: 0, il ne dessine aucune barre à lui, seulement un trait droit du pied du bandeau au milieu du bord supérieur de chaque fiche, et startCap: 'ring' place un anneau en tête de chaque trait, 2,4 mm sous le bandeau (gap). L’anneau est un point creux tracé dans l’épaisseur du trait, de 3,6 mm d’un bord à l’autre (capSize), et le trait s’arrête à son bord : le fond crème se voit dans le creux. #asia[*] désigne toutes les fiches que la grille a posées sur la page : une date ajoutée ou retirée dans le Markdown ajoute ou retire son trait. Les connecteurs sont placés après les blocs : quand une rangée grandit, les traits rejoignent toujours les fiches. Le fond crème est lui aussi du décor, une boîte ancrée au pied du fond perdu dont la hauteur monte jusqu’au pied de #band-1 (size: { height: { to: '#band-1', edge: 'bottom' } }) : elle suit le bandeau.

#4 · Des dessins à leur taille d’impression

script.js · lignes 253–295dans le code complet
const ART = {
  v105: t({ es: 'Un funcionario de la corte Han mira cómo un artesano saca de la tina un molde '
      + 'de bambú lleno de pasta, junto a corteza, trapos y redes viejas.',
    en: 'A Han court official watches a craftsman lift a bamboo mould full of pulp from a vat, '
      + 'beside bark, rags and old nets.',
    ja: '漢の役人が見守るなか、職人が竹のすき枠を漉き舟から引き上げる。そばに樹皮、ぼろ布、古い網。' }),
  v610: t({ es: 'Un monje enseña a dos cortesanos japoneses a sostener el molde sobre una tina, '
      + 'con ramas de kozo en una estera.',
    en: 'A monk shows two Japanese courtiers how to hold the mould over a tub, with kozo '
      + 'branches on a mat.',
    ja: '僧が二人の宮廷人に、桶の上ですき枠を持つ手つきを見せる。むしろの上に楮の枝。' }),
  v751: t({ es: 'Papeleros de Samarcanda junto a un canal; las hojas se secan al sol contra un '
      + 'muro de adobe.',
    en: 'Samarkand papermakers by a canal; the sheets dry in the sun against a mud-brick wall.',
    ja: '水路のそばで働くサマルカンドの紙すき職人。日干しれんがの壁に紙が張られて乾いている。' }),
  v1150: t({ es: 'Un taller de Xàtiva bajo el castillo: un operario golpea trapos en una pila '
      + 'de piedra y las hojas cuelgan de cuerdas.',
    en: 'A workshop in Xàtiva below the castle: a worker pounds rags in a stone trough and the '
      + 'sheets hang on ropes.',
    ja: '城の下のシャティバの工房。職人が石の槽でぼろ布をたたき、紙が綱につるされている。' }),
  v1282: t({ es: 'Un molino de Fabriano con su rueda hidráulica y sus mazos; un papelero mira '
      + 'una filigrana al trasluz.',
    en: 'A Fabriano mill with its water wheel and hammers; a papermaker holds a watermark up '
      + 'to the light.',
    ja: '水車と木づちのあるファブリアーノの製紙場。職人が紙を光にかざして透かしを見ている。' }),
  v1844: t({ es: 'Un artesano aprieta un tronco de abeto contra una muela que gira; debajo se '
      + 'amontonan las fibras.',
    en: 'A craftsman presses a spruce log against a turning grindstone; the fibres pile up '
      + 'below.',
    ja: '職人がトウヒの丸太を回る砥石に押し当て、その下に木の繊維が積もっていく。' }),
  forma: t({ es: 'Dos manos sacan de la tina el molde con una capa fina de fibras.',
    en: 'Two hands lift the mould from the vat with a thin layer of fibres on it.',
    ja: '両手ですき枠を引き上げる。網の上に繊維の薄い層ができている。' }),
};
const SIZE = { forma: [800, 800, 363] }; // pixels and ppi: 56 mm wide; the cards' are 46 mm
const resources = await Promise.all(Object.entries(ART).map(async ([id, altText]) => {
  const px = SIZE[id] ?? [1000, 667, 550];
  const fileId = `${id}-${px[0]}.jpg`;
  await loadImage(fileId, asset(fileId));
  return { id, typeId: 'picture', kind: 'bitmap', caption: '', altText, createdAt: 0,
    updatedAt: 0,
    bitmap: { fileId, format: 'jpeg', width: px[0], height: px[1], resolution: px[2] } };
}));

Les vignettes font 1 000 px à 550 ppp, soit 46 mm sur la page, et une image n’est jamais agrandie. Les trois colonnes égales de la grille font 56,3 mm sur chaque page : chaque dessin tient à sa taille dans les 3,5 mm de marge intérieure de sa fiche, et le reste de la fiche est du texte.

La recette complète

Sandbox
// ═══ Postext Cookbook · Nº 158 · An illustrated timeline across a double page ═══════
// https://postext.dev/en/cookbook/illustrated-timeline-spread
// Code: MIT · Text: original (CC BY 4.0) · Pictures: generated with diffusion models
// Fonts: Literata, Archivo, Noto Serif JP, Noto Sans JP (SIL OFL 1.1) · Needs postext ≥ 1.49.0
import {
  buildDocument, withLoadedFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';

const LANG = 'en'; // @lang: the language of the sample document ('es' | 'en' | 'ja')
const RECIPE = 'illustrated-timeline-spread';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: one ink, an accent for each half of the timeline, a pale ground
const palette = {
  ink: '#22201d', // text
  asia: '#2f4f7a', // indigo: the Asian half of the timeline
  europe: '#a2412a', // terracotta: the European half
  ground: '#f1ebdf', // the cream under the cards
  rule: '#c9bfae', // hairlines and the card borders
  muted: '#6b6359', // running heads and 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' } })),
  { id: 'main-color', name: 'europe (defaults)', value: { hex: palette.europe, model: 'hex' } },
];
// #endregion

const JA = LANG === 'ja';
const SERIF = JA ? 'Noto Serif JP' : 'Literata';
const SANS = JA ? 'Noto Sans JP' : 'Archivo';
// A Western textbook page is 210 × 280 mm; a Japanese one is AB判, 210 × 257 mm.
const PAGE = { w: 210, h: JA ? 257 : 280, top: 22, bottom: 20, inner: 16, outer: 15 };
const ROWS = 12;
const ROW_GAP = 3;
const ROW = (PAGE.h - PAGE.top - PAGE.bottom - (ROWS - 1) * ROW_GAP) / ROWS; // one grid row, mm
const BAND = 9; // the timeline band, in grid row 5
const CARD_TOP = 5 * (ROW + ROW_GAP); // grid row 6
// The drawn height of a card; 16 mm of the area stay free for a longer text.
const CARD = PAGE.h - PAGE.top - PAGE.bottom - CARD_TOP - 16;
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });

// #region cards: one card frame per row, repeated by a grid once for each card of the Markdown
// Each `:::frame{slot="asia"}` of the page is an item of the `asia` grid: the grid lays the
// card frame once per item, three to a row, and names the copies `#asia[1]`, `#asia[2]`…
const card = (name, style) => ({ name, style, minHeight: mm(CARD) }); // auto above that height

Le script.js composé s’exécute tel quel : collez-le dans le script de module de n’importe quelle page, ou ouvrez la recette sur CodePen. Dossier de la recette sur GitHub ↗ (s’ouvre dans un nouvel onglet)

Variantes

#Quatre fiches par rangée

Avec columns: 4, chaque bandeau aligne quatre dates côte à côte ; les fiches sont plus étroites, leurs textes prennent plus de lignes et les rangées grandissent vers le bas.

-const row = (name, col) => ({ name: `${name}-row`, kind: 'grid', columns: 3, columnGap: mm(5),
+const row = (name, col) => ({ name: `${name}-row`, kind: 'grid', columns: 4, columnGap: mm(5),

#Des flèches au lieu des anneaux

endCap: 'arrow' met une pointe de flèche là où chaque trait rejoint sa fiche, et startCap: 'none' retire les anneaux.

Erreurs fréquentes

  • Une grille pose une cellule par élément, et un élément est un délimiteur :::frame{slot="asia"} à lui seul : les textes de deux fiches dans un même délimiteur font une seule fiche.
  • #asia sans [*] désigne la boîte de la grille, pas ses fiches : un connecteur vers elle dessine un seul trait, jusqu’au milieu de la rangée.
  • Une taille qui va jusqu’au bord d’une autre boîte se compte à partir du point d’ancrage de l’élément : le fond est ancré au pied du fond perdu et monte jusqu’à #band-1. Un bord situé derrière l’ancre donne une hauteur de 0.

Crédits

Texte
  • The paper road, a double-page timeline written for this recipe in Spanish, English and Japanese · Postext Cookbook · CC BY 4.0
Images
  • A Han court official watches a craftsman lift a bamboo mould from a vat. · Generated With Diffusion Models · original
  • A monk shows two Japanese courtiers how to hold a papermaking mould. · Generated With Diffusion Models · original
  • Papermakers by a canal in Samarkand, sheets drying on a wall. · Generated With Diffusion Models · original
  • A paper workshop below the castle of Xàtiva. · Generated With Diffusion Models · original
  • A Fabriano mill with its water wheel; a sheet held up to the light. · Generated With Diffusion Models · original
  • A craftsman grinds a spruce log against a stone into wood pulp. · Generated With Diffusion Models · original
  • Two hands lift a papermaker's mould from a vat of pulp. · Generated With Diffusion Models · original
Polices
Literata (SIL OFL 1.1) · Archivo (SIL OFL 1.1) · Noto Serif JP (SIL OFL 1.1) · Noto Sans JP (SIL OFL 1.1)
SandboxPDF