Kurz gesagt
Zwei gegenüberliegende Seiten eines Geschichtsbuchs, gesetzt wie eine: Ein farbiges Band läuft über die Buchmitte, sechs Bildkarten hängen daran, und die Vorlage zeichnet nur eine Karte und eine Linie, wie viele Daten es auch sind.
Was Sie setzen
Die Seiten 48 und 49 eines Geschichtsbuchs für die Mittelstufe: Der Weg des Papiers, tausend Jahre Handwerk von Cai Luns Werkstatt bis zu Kellers Schleifstein. Die linke Seite beginnt mit dem Titel und zwei Absätzen, die rechte mit einem Kasten darüber, wie ein Bogen von Hand geschöpft wurde. Durch die Mitte läuft die Zeitleiste: ein indigoblaues Band für Asien und ein terrakottafarbenes für Europa, das auf der linken Seite beginnt und über den Bund läuft. Darunter hängen sechs Karten mit je einem Bild an einem Ring und einem Strich vom Band. Die Vorlage zeichnet eine asiatische Karte, eine europäische und einen Verbinder je Band: Ein Raster legt für jedes Datum im Markdown eine Karte an, und der Verbinder findet jede Karte, die das Raster gelegt hat. Jedes Wort steht im Markdown, auf Spanisch, Englisch und Japanisch; diese Seite zeigt die englische Ausgabe.
Dieses Rezept beantwortet
- Wie setze ich eine Zeitleiste über eine Doppelseite, mit einem Band über den Bund und Karten auf beiden Seiten?
- Wie lasse ich eine Reihe von Kästen ihre Breite teilen, sodass der mit dem längsten Text breiter wird?
Die kurze Antwort
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')] },
}];
Zutaten
- Funktionen
- Vorlagen für DoppelseitenRaster, die Rahmen wiederholenVerbinder zwischen RahmenZusammengesetzte SeitenRahmen, die in einer Gruppe wachsenAn Rahmen verankertes DekorNummerierte KastenreiterKästenGestaltungselemente verankernKolumnentitel und SeitenzahlenGespiegelte RänderNummerierte ListenChinesische, japanische und koreanische SchriftenSemantische FarbpaletteSeiten auf einem CanvasPDF-Export
- Nutzt außerdem
- Abbildungen genau hierIm PDF eingebettete SchriftenEigene RessourcentypenAbbildungen und Tabellen als Ressourcen
- Schrift
- Literata, Archivo, Noto Serif JP, Noto Sans JP (SIL OFL 1.1)
- Dateien
forma-800.jpgv105-1000.jpgv1150-1000.jpgv1282-1000.jpgv1844-1000.jpgv610-1000.jpgv751-1000.jpg- A Han court official watches a craftsman lift a bamboo mould from a vat. (Generated With Diffusion Models, eigener Text)
- A monk shows two Japanese courtiers how to hold a papermaking mould. (Generated With Diffusion Models, eigener Text)
- Papermakers by a canal in Samarkand, sheets drying on a wall. (Generated With Diffusion Models, eigener Text)
- A paper workshop below the castle of Xàtiva. (Generated With Diffusion Models, eigener Text)
- A Fabriano mill with its water wheel; a sheet held up to the light. (Generated With Diffusion Models, eigener Text)
- A craftsman grinds a spruce log against a stone into wood pulp. (Generated With Diffusion Models, eigener Text)
- Two hands lift a papermaker's mould from a vat of pulp. (Generated With Diffusion Models, eigener Text)
Zubereitung
#1 · Ein Bogen für zwei Seiten
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 macht die Vorlage zu einem Blatt, so breit wie beide Seiten, und der Seitenblock sagt dasselbe mit spread. Eine Doppelseite beginnt auf einer linken Seite, deshalb übergibt der Build continuation: { pageIndexOffset: 1, pageNumbering: { startAt: 48 } }: Seite 1 dieses Auszugs ist Seite 48 des Buchs, eine linke Seite, und keine Vakatseite steht davor. Das Raster hat eine Spalte pro Seite, getrennt durch den doppelten Innenrand, sodass nur das Band in die Nähe des Falzes kommt. Das zweite Band setzt crossGutter und einen linken Innenabstand von 36 mm: Seine Farbe läuft vom Ende des ersten Bands über den Bund, seine Wörter beginnen auf der rechten Seite, wo sie gelesen werden.
#2 · Eine Karte, von einem Raster wiederholt
// 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] } });
Eine Gruppe mit kind: 'grid' und repeat: { frames: ['asia'] } legt den Rahmen asia einmal für jeden :::frame{slot="asia"} der Seite an, drei pro Reihe, in der Zelle col: 1 des Vorlagenrasters, Zeilen 6 bis 12. Die Kopien heißen #asia[1], #asia[2] und #asia[3], und jede übernimmt das label ihres eigenen Blocks, das Datum auf ihrem Reiter. Eine Karte ist mindestens minHeight hoch und darüber auto: Wird ein Text länger, wie der von 1844 auf Spanisch und Japanisch, wächst seine Reihe, und die anderen Karten der Reihe strecken sich auf dieselbe Höhe (rowAlign steht standardmäßig auf 'stretch'). Ein viertes Datum im Markdown beginnt eine zweite Reihe unter der ersten; die Vorlage bleibt, wie sie ist.
#3 · Ein Verbinder je Band
// `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) };
}
Die Striche sind ein connector je Band in der Dekoration (decoration) der Vorlage. routing: 'tree' verbindet ein Elternelement mit vielen Kindern; mit trunk: 0 zeichnet er keinen eigenen Balken, nur einen geraden Strich vom Fuß des Bands zur Mitte der Oberkante jeder Karte, und startCap: 'ring' setzt einen Ring an den Kopf jedes Strichs, 2,4 mm unter dem Band (gap). Der Ring ist ein hohler Punkt in der Stärke der Linie, außen 3,6 mm breit (capSize), und der Strich endet an seinem Rand, sodass im Loch der cremefarbene Grund zu sehen ist. #asia[*] meint jede Karte, die das Raster auf der Seite gelegt hat: Ein Datum, das im Markdown hinzukommt oder wegfällt, bringt seinen Strich mit oder nimmt ihn mit. Verbinder werden nach den Rahmen gesetzt, sodass die Striche die Karten auch dann treffen, wenn eine Reihe wächst. Auch der cremefarbene Grund ist Dekoration, ein Rechteck, das am Fuß des Anschnitts verankert ist und dessen Höhe bis zum Fuß von #band-1 reicht (size: { height: { to: '#band-1', edge: 'bottom' } }): Er folgt dem Band.
#4 · Bilder in ihrer Druckgröße
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] } };
}));
Die Vignetten sind 1.000 px breit bei 550 ppi, also 46 mm auf der Seite, und ein Bild wird nie vergrößert. Die drei gleichen Spalten des Rasters sind auf jeder Seite 56,3 mm breit, sodass jedes Bild in seiner eigenen Größe in den 3,5 mm Innenabstand seiner Karte passt und der Rest der Karte Text ist.
Das ganze Rezept
// ═══ 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
Das zusammengesetzte script.js läuft unverändert: Fügen Sie es in das Modulskript einer beliebigen Seite ein, oder öffnen Sie das Rezept auf CodePen. Ordner des Rezepts auf GitHub ↗ (öffnet sich in einem neuen Tab)
Varianten
#Vier Karten pro Reihe
Mit columns: 4 trägt jedes Band vier Daten nebeneinander; die Karten werden schmaler, ihre Texte länger, und die Reihen wachsen nach unten.
-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),#Pfeile statt Ringe
endCap: 'arrow' setzt eine Pfeilspitze dorthin, wo jeder Strich seine Karte trifft, und startCap: 'none' nimmt die Ringe weg.
Häufige Fehler
- Ein Raster legt eine Zelle pro Eintrag an, und ein Eintrag ist ein eigener
:::frame{slot="asia"}-Block: Die Texte zweier Karten in einem Block ergeben eine Karte. #asiaohne[*]ist der Kasten des Rasters, nicht seine Karten: Ein Verbinder dorthin zeichnet einen einzigen Strich zur Mitte der Reihe.- Eine Größe, die bis zum Rand eines anderen Elements reicht, wird vom Bezugspunkt des Elements aus gezählt: Der Grund ist am Fuß des Anschnitts verankert und wächst bis
#band-1nach oben. Ein Rand hinter dem Bezugspunkt ergibt eine Höhe von 0.
Nachweise
- Rezept
- Ignacio Ferro
- Text
- The paper road, a double-page timeline written for this recipe in Spanish, English and Japanese · Postext Cookbook · CC BY 4.0
- Bilder
- A Han court official watches a craftsman lift a bamboo mould from a vat. · Generated With Diffusion Models · eigener Text
- A monk shows two Japanese courtiers how to hold a papermaking mould. · Generated With Diffusion Models · eigener Text
- Papermakers by a canal in Samarkand, sheets drying on a wall. · Generated With Diffusion Models · eigener Text
- A paper workshop below the castle of Xàtiva. · Generated With Diffusion Models · eigener Text
- A Fabriano mill with its water wheel; a sheet held up to the light. · Generated With Diffusion Models · eigener Text
- A craftsman grinds a spruce log against a stone into wood pulp. · Generated With Diffusion Models · eigener Text
- Two hands lift a papermaker's mould from a vat of pulp. · Generated With Diffusion Models · eigener Text
- Schriften
- Literata (SIL OFL 1.1) · Archivo (SIL OFL 1.1) · Noto Serif JP (SIL OFL 1.1) · Noto Sans JP (SIL OFL 1.1)
- Code
- MIT, wie Postext
Diesen Text bearbeiten ↗ (öffnet sich in einem neuen Tab)Ordner des Rezepts auf GitHub ↗ (öffnet sich in einem neuen Tab)


