Kurz gesagt
Ein ganzer kurzer Roman auf Katalanisch, gesetzt als kleines Taschenbuch. Wörter werden am Zeilenende so getrennt, wie es katalanische Stilregeln verlangen, auch das doppelte l mit Punkt.
Was Sie setzen
Narcís Ollers El transplantat vollständig, im Text seiner Obres completes (Barcelona, 1928), als Taschenbuch von 12 × 18,5 cm und 32 Seiten. Schmutztitel, ein Frontispiz mit dem Bäcker an seinem Ofen, eine Titelseite in roter kursiver Cormorant Garamond und eine Anmerkung zur Ausgabe gehen den vier Kapiteln voraus. Jedes Kapitel beginnt unter einem zwölf Zeilen hohen Stich mit seiner römischen Zahl in Rot. Der Text, Gentium Book Plus zu 9,85 pt, trennt nach katalanischen Silben, wie es das Institut d’Estudis Catalans verlangt: mindestens zwei Buchstaben auf jeder Seite, keine Trennung zwischen Vokalen im Hiat, keine direkt nach einem Apostroph, und titil·laven trennt als titil- | laven, wobei der Trennstrich den Platz des Mittelpunkts einnimmt. Dialoge stehen mit Geviertstrichen, Zitate in «cometes baixes».
Dieses Rezept beantwortet
- Wie erreiche ich guten Blocksatz und gute Silbentrennung für spanischen, französischen oder deutschen Text?
- Wie gebe ich jedem Kapitel ein eigenes Foto, eine eigene Farbe oder eine eigene Auftaktvariante?
- Wie setze ich nicht nummerierte Grafiken: Ornamente, Vignetten, Logos?
- Wie schreibe ich Dialogstriche, Jahreszahlen am Absatzanfang, Preise und wörtliche Symbole, ohne dass Markdown sie falsch liest?
Die kurze Antwort
const LOCALE = 'ca'; // the exact bundled code: 'ca-ES' resolves to it too (postext ≥ 1.14)
const bodyText = { // config().bodyText
fontFamily: TEXT, fontSize: pt(BODY), lineHeight: pt(LEAD), color: col('ink'),
boldColor: col('ink'), italicColor: col('ink'), referenceColor: col('ink'),
firstLineIndent: mm(4.5), indentAfterHeading: false,
// The defaults justify, hyphenate in config().locale and break by Knuth–Plass. With 'ca'
// the dictionary follows the IEC: two letters on each side (ter-ra, cai-xa), no split in
// a hiatus (cièn-cia) or after an apostrophe (s’ha-via), l·l broken with the hyphen for the
// dot. From 1.30 the face is asked for its Catalan forms too: this one has a single dot.
// compounds: false divides arrossegar-se only at its own hyphen (Llibre d’estil, VI 2.5).
hyphenation: { compounds: false },
// Spaces from 0.7× to 1.6×, then up to 10‰ of tracking; a last line under 22 characters is
// a runt. A line that must keep d’inaugurar-se whole still opens to 1.94× on page 7.
maxWordSpacing: 1.6, minWordSpacing: 0.7, maxJustifyTracking: 10, runtMinCharacters: 22,
hyphenateAcrossColumns: false, // no page ends on a divided word
};
Zutaten
- Funktionen
- Silbentrennung und DokumentspracheOptimaler Zeilenumbruch (Knuth-Plass)Umschläge, Titelseiten und ImpressumGestaltete AuftakteBilder in SeitengestaltungenÜberschriftenformateÜberschriftenattributeText, Linien und Kästen in SeitengestaltungenKapitel, die rechts beginnenKolumnentitel und SeitenzahlenKopfzeilen nach SeitenrolleGespiegelte RänderPapierfarbeAbsatzformateEigene RessourcentypenWitwen, Waisen und kurze AusgangszeilenDokument-MetadatenSemantische FarbpalettePDF-ExportIm PDF eingebettete Schriften
- Schrift
- Gentium Book Plus, Cormorant Garamond, Cormorant SC (SIL OFL 1.1)
- Dateien
cap1-1200.jpgcap2-1200.jpgcap3-1200.jpgcap4-1200.jpgfrontis-1000.jpg- Engraving, frontispiece: the baker at his oven's door (Generated With Diffusion Models, eigener Text)
- Engraving, chapter I: the night train into Barcelona (Generated With Diffusion Models, eigener Text)
- Engraving, chapter II: the village street in autumn (Generated With Diffusion Models, eigener Text)
- Engraving, chapter III: the Rambla at dawn (Generated With Diffusion Models, eigener Text)
- Engraving, chapter IV: the old man by the railway (Generated With Diffusion Models, eigener Text)
Zubereitung
#1 · Katalanisch über seinen Code
Der Code steht oben in der kurzen Antwort. locale: 'ca' wählt die katalanischen Trennmuster, und seit postext 1.14 folgen sie dem Llibre d’estil des IEC (unterstützte Sprachen). Es sind die Muster, die TeX verwendet, mit mindestens zwei Buchstaben auf jeder Seite einer Trennung statt der drei, mit denen das npm-Paket ausgeliefert wird, sodass ter-ra, cai-xa und plu-ja getrennt werden können. Vokale im Hiat bleiben zusammen (cièn-cia, ca-mions), aber ein i zwischen Vokalen eröffnet seine Silbe (fe-ia). Die ela geminada trennt zwischen ihren beiden l: Die Zeile endet auf titil-, die nächste beginnt mit laven, auf keiner Seite steht ein Mittelpunkt, und Knuth-Plass misst die Zeile ohne den Punkt.

compounds: false hält ein Verb und sein Pronomen ganz, bis auf ihren eigenen Bindestrich (arrossegar- | se), was das IEC bevorzugt (Silbentrennung). Das kostet eine zu lockere Zeile: Auf Seite 7 öffnet die Zeile vor d’inaugurar-se ihre Wortabstände auf das 1,88-Fache, obwohl maxJustifyTracking: 10 den Überschuss auf den anderen Zeilen aufnimmt.
#2 · Eine Taschenbuchseite aus ganzen Zeilen
const TRIM = { width: 120, height: 185 }; // mm
const [TOP, INNER, OUTER, LINES] = [18, 16, 15, 29];
const MEASURE = TRIM.width - INNER - OUTER; // 89 mm: about 63 characters of Gentium Book Plus
const page = {
width: mm(TRIM.width), height: mm(TRIM.height), dpi: 150, backgroundColor: col('paper'),
margins: { top: mm(TOP), bottom: mm(TRIM.height - TOP - LINES * LINE),
left: mm(INNER), right: mm(OUTER), mirror: true }, // left is the inner margin on a recto
};
Der Fußsteg ergibt sich aus Endformat, Kopfsteg und LINES, sodass der Satzspiegel 29 Zeilen zu 14 pt fasst und jede volle Seite auf derselben Grundlinie endet. Die Satzbreite von 89 mm fasst etwa 63 Zeichen der Gentium Book Plus. mirror: true hält den Bundsteg von 16 mm auf beiden Seiten einer Doppelseite am Bund (gespiegelte Ränder).
#3 · Ein Auftakt für vier Kapitel
// # II {style="capitol" art="cap2"}: the art attribute names the picture's resource.
const PICTURE = { width: MEASURE, height: 12 * LINE }; // 89 × 59.3 mm: twelve lines, 3:2
const chapter = { id: 'capitol',
breakBefore: { enabled: true, parity: 'any' }, // a chapter opens on the next page, either side
marginBottom: pt(0), // the opener's own height already ends on a line
advancedDesign: { enabled: true, minHeight: pt(16 * LEAD), slot: { elements: [
{ kind: 'image', id: 'art', resourceId: '{attr.art}',
placement: at('container', 'top', 0, 0,
{ width: mm(PICTURE.width), height: mm(PICTURE.height) }) },
// The numeral and its rule hang from the container's top, a fixed drop under the picture.
text('numeral', '{titleText}', DISPLAY, 21, at('container', 'top', 0, PICTURE.height + 4),
{ fontWeight: 600, color: col('vermell'), lineHeight: 1 }),
{ kind: 'rule', id: 'rule', direction: 'horizontal', thickness: pt(0.5), color: col('vermell'),
placement: { ...at('container', 'top', 0, PICTURE.height + 13), size: { width: mm(8) } } },
] } },
};
resourceId: '{attr.art}' zeichnet das Bild, auf das die Überschrift verweist, sodass # II {style="capitol" art="cap2"} Kapitel II unter seinem eigenen Stich eröffnet, mit demselben Stil wie die anderen (Überschriftenattribute). minHeight hält sechzehn Zeilen frei, zwölf für das Bild und vier für die Zahl und ihre Linie, sodass der Text auf der siebzehnten Zeile der Seite beginnt, in jedem Kapitel gleich.
#4 · Vier Seiten vor Kapitel I
const front = (id, elements, { minHeight, ...extra } = {}) => ({ id,
breakBefore: { enabled: true, parity: 'any' }, marginBottom: pt(0),
header: { elements: [] }, footer: { elements: [] }, ...extra,
advancedDesign: { enabled: true, ...(minHeight && { minHeight }), slot: { elements } } });
const FRONTIS = { width: MEASURE, height: MEASURE * 1.5 }; // mm: the engraving is 2:3
const headingStyles = [
front('avantportada', [text('title', '{titleText}', DISPLAY, 19,
at('container', 'top', 0, 9 * LINE), { italic: true, fontWeight: 500, lineHeight: 1 })]),
front('frontis', [
{ kind: 'image', id: 'art', resourceId: '{attr.art}',
placement: at('container', 'top', 0, 0,
{ width: mm(FRONTIS.width), height: mm(FRONTIS.height) }) },
text('legend', '{titleText}', LABEL, 8.5, at('container', 'top', 0, FRONTIS.height + 5),
{ ...caps(8.5, 1.4, 'muted') }),
]),
front('portada', [
text('author', '{author}', LABEL, 10, at('container', 'top', 0, 5 * LINE),
caps(10, 2.2, 'ink')),
text('title', '{titleText}', DISPLAY, 34, at('container', 'top', 0, 8 * LINE),
{ italic: true, fontWeight: 500, color: col('vermell'), lineHeight: 1 }),
text('subtitle', '{subtitle}', DISPLAY, 13, at('container', 'top', 0, 8 * LINE + 17),
{ italic: true, fontWeight: 500 }),
{ kind: 'rule', id: 'rule', direction: 'horizontal', thickness: pt(0.5), color: col('vermell'),
placement: { ...at('container', 'top', 0, 8 * LINE + 29), size: { width: mm(14) } } },
]),
// The note sits low on the verso behind the title, its label a line above it.
front('nota', [text('label', '{titleText}', LABEL, 8.5, at('container', 'top', 0, 13 * LINE),
caps(8.5, 1.4))], { minHeight: pt(15 * LEAD) }),
chapter,
];
Jedes Stück der Titelei ist eine Überschrift der Ebene 1 mit eigenem Stil: # El transplantat {style="portada"} setzt Autor und Untertitel aus dem Frontmatter und die Überschrift als Titel. Jeder Stil wiederholt seinen Seitenumbruch, da ein Stil den seiner Ebene erbt, und leert Kopf- und Fußzeile, sodass diese Seiten weder Kolumnentitel noch Pagina haben. Das Frontispiz fällt auf Seite 2, eine linke Seite, und steht so der Titelseite über die Doppelseite gegenüber.
#5 · Der Autor links, der Titel rechts
const SHIFT = (INNER - OUTER) / 2; // mm: the text block's centre is off the page's centre
const head = (id, content, parity, edge, x, y = 10, pages = 'body') => ({
kind: 'text', id, content, parity, pages, ...caps(8, 1.3, 'muted'),
placement: at('page', edge, x, y),
});
const folio = { fontFamily: TEXT, fontWeight: 400, letterSpacing: pt(0), color: col('ink') };
const header = { elements: [
{ ...head('verso-folio', '{pageNumber}', 'even', 'top-left', OUTER), ...folio },
head('verso-author', '{author}', 'even', 'top', -SHIFT),
head('recto-title', '{title}', 'odd', 'top', SHIFT),
{ ...head('recto-folio', '{pageNumber}', 'odd', 'top-right', -OUTER), ...folio },
] };
const drop = (parity, x) => ({ ...head(`drop-${parity}`, '{pageNumber}', parity, 'bottom', x,
-11, 'opener'), ...folio });
const footer = { elements: [drop('odd', SHIFT), drop('even', -SHIFT)] };
parity setzt den Autor auf die linken und den Titel auf die rechten Seiten; pages: 'body' hält beide von den Kapitelauftakten fern, wo eine Pagina am Fuß mit pages: 'opener' ihren Platz einnimmt. SHIFT rückt jeden Kolumnentitel auf die Mitte des Satzspiegels, einen halben Millimeter neben der Seitenmitte, weil die beiden Stege verschieden sind.
#6 · Fünf Stiche, keine Beschriftungen
const resourceTypes = [{ id: 'gravat', name: 'Gravat', namePlural: 'Gravats', shortLabel: 'Gravat',
captionPrefix: '', numberingTemplate: '{n}', resetOn: 'never', counterFormat: 'decimal' }];
const PICTURES = { // id: [file, width, height, alt text in the book's language]
frontis: ['frontis-1000.jpg', 1000, 1500, 'Un carrer de poble al capvespre. A la porta del forn, '
+ 'on cremen les flames, el forner, gras i somrient, amb davantal blanc i els braços creuats.'],
cap1: ['cap1-1200.jpg', 1200, 800, 'De nit, el tren baixa cap a Barcelona: rengleres de fanals, '
+ 'la muntanya de Montjuïc i la lluna sobre el mar. Un pagès treu el cap per la finestreta.'],
cap2: ['cap2-1200.jpg', 1200, 800, 'Un carrer de poble buit en una nit de tardor. Per la porta '
+ 'baixa de la ferreria, el manyà pica l’enclusa enmig d’una estrella d’espurnes.'],
cap3: ['cap3-1200.jpg', 1200, 800, 'La Rambla a trenc d’alba des d’un balcó. Un fanaler apaga '
+ 'el gas amb la perxa; al fons, els pals dels vaixells del port.'],
cap4: ['cap4-1200.jpg', 1200, 800, 'Capvespre als afores. Un vell de cabells blancs, assegut '
+ 'al caire del desmunt, mira la via del tren, que es perd recta fins a l’horitzó.'],
};
const resources = Object.entries(PICTURES).map(([id, [fileId, w, h, altText]]) => ({
id, typeId: 'gravat', kind: 'bitmap', createdAt: 0, updatedAt: 0, altText,
bitmap: { fileId, format: 'jpeg', width: w, height: h } }));
Die Bilder gehören zu einem Ressourcentyp mit leerem captionPrefix, sodass nichts sie nummeriert oder beschriftet. Jedes wird in seiner Pixelgröße deklariert und vor dem Build unter seiner Datei-ID geladen. Ihr Weiß wurde vor dem Speichern auf das Creme der Seite und ihr Schwarz auf deren Druckfarbe abgebildet, sodass sie als Teil der Seite drucken und nicht wie aufgeklebte Fotografien.
Das ganze Rezept
// ═══ Postext Cookbook · Nº 104 · A Catalan novella, hyphenated by the IEC rules ═══════
// https://postext.dev/en/cookbook/catalan-pocket-novella
// Code: MIT · Text: N. Oller, El transplantat, 1928 (PD, Viquitexts) · Pictures: diffusion models
// Fonts: Gentium Book Plus, Cormorant Garamond, Cormorant SC (OFL) · Needs postext ≥ 1.57.0
import {
buildDocumentWithFonts, 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 (the sample is Catalan in both)
const RECIPE = 'catalan-pocket-novella';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
const palette = {
ink: '#2a2320', // text: a warm near-black, the pictures' ink too
vermell: '#953222', // the one accent: chapter numerals, rules, the title page's title
muted: '#6e6359', // running heads, the edition's note, the colophon
paper: '#f5efe1', // a cream book paper, the pictures' white
};
// Each colour names its palette entry and carries its hex.
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: 'vermell (defaults)', value: { hex: palette.vermell, model: 'hex' } },
];
const [TEXT, DISPLAY, LABEL] = ['Gentium Book Plus', 'Cormorant Garamond', 'Cormorant SC'];
const [BODY, LEAD] = [9.85, 14]; // pt: body and leading, the pitch of every vertical measure
const LINE = (LEAD * 25.4) / 72; // mm: one line, 4.94
const at = (to, edge, x = 0, y = 0, size) => ({ anchor: { to, edge },
offset: { x: mm(x), y: mm(y) }, ...(size && { size }) });
const text = (id, content, fontFamily, size, placement, extra = {}) => ({ kind: 'text', id,
content, fontFamily, fontSize: pt(size), color: col('ink'), align: 'center',
overflow: 'wrap', placement, ...extra }); // a long title takes a second line
const caps = (size, tracking, color = 'vermell') => ({ fontFamily: LABEL, fontSize: pt(size),
fontWeight: 600, letterSpacing: pt(tracking), color: col(color) });
// #region page: a 12 × 18.5 cm pocket book; the text block holds 29 whole lines
const TRIM = { width: 120, height: 185 }; // mm
const [TOP, INNER, OUTER, LINES] = [18, 16, 15, 29];
const MEASURE = TRIM.width - INNER - OUTER; // 89 mm: about 63 characters of Gentium Book Plus
const page = {
width: mm(TRIM.width), height: mm(TRIM.height), dpi: 150, backgroundColor: col('paper'),
margins: { top: mm(TOP), bottom: mm(TRIM.height - TOP - LINES * LINE),
left: mm(INNER), right: mm(OUTER), mirror: true }, // left is the inner margin on a recto
};
// #endregion
// #region answer: Catalan by its own code: l·l breaks as il- | lusió, no word splits its hiatus
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
#Auch Pronomen trennen lassen
Mit dem Standardwert compounds: true trennt d’inaugurar-se innerhalb des Verbs, als d’i- | naugurar-se, und Seite 7 verliert ihre zu lockere Zeile: Keine Zeile des Buches öffnet sich über das 1,6-Fache hinaus. Die Trennung titil- | laven bleibt auf Seite 27. Der Preis ist ein einzelnes i nach dem Apostroph am Zeilenende.
- hyphenation: { compounds: false },
+ hyphenation: { compounds: true },#Jedes Kapitel auf einer rechten Seite beginnen
parity: 'odd' fügt vor einem Kapitel, das auf einer linken Seite beginnen würde, eine Vakatseite ein, wie in einer großzügigeren Ausgabe. Kapitel IV, das auf Seite 26 beginnt, rückt hinter einer Vakatseite auf Seite 27.
- breakBefore: { enabled: true, parity: 'any' }, // a chapter opens on the next page, either side
+ breakBefore: { enabled: true, parity: 'odd' },Häufige Fehler
Häufiger Fehler
Ein Überschriftenformat erbt den Seitenumbruch seiner Ebene
Ein Eintrag in headingStyles übernimmt jedes Feld, das er auslässt, von seiner Überschriftenebene, breakBefore eingeschlossen. Ein Inhaltsverzeichnis oder Impressum, das nach einem :::pagebreak über eine H1 gestaltet wird, erbt die Parität 'odd' und landet hinter einer Vakatseite. Geben Sie einem solchen Format breakBefore: { enabled: false }. Überschriftenformate →
Häufiger Fehler
Attributwerte: kein { oder }; einen Wert mit " in einfache Anführungszeichen setzen
Ein Attributwert endet an der schließenden geschweiften Klammer, kann also kein { oder } enthalten. Ein Wert, der ein doppeltes Anführungszeichen enthält, kommt in einfache Anführungszeichen; ein Dollarzeichen ist unproblematisch. Überschriftenattribute →
- Prüfen Sie l·l in einer Textschrift, bevor Sie sich für sie entscheiden. Ab postext 1.30 ist die
localedes Dokuments auch die Sprache, in der sein Text geformt wird (bis 1.29 war das die Sprache der Seite, die das Buch anzeigte), und jede Schrift antwortet auf Katalanisch auf ihre eigene Weise. Gentium Book Plus hat für alle Sprachen einen Mittelpunkt, 0,17 em zwischen den beiden l. Crimson Pro, in der dieses Buch bis 1.29 gesetzt war, verbreitert den Punkt im Katalanischen auf 0,59 em und reißt in intel·ligent eine Lücke. Alegreya und Literata zeichnen einen engeren Punkt nur dort, wo beide l sie in einem Stück erreichen, sodass il·lustrats in einem Absatz mit Kursiven anders ausfällt als in einem ohne. - Kopieren Sie den Text aus Viquitexts mit seinen Kursiven: Oller kennzeichnet tentu, Ensanxe und palacio als umgangssprachlich oder spanisch, und ein Export als reiner Text verliert sie. Prüfen Sie zweifelhafte Wörter am Scan des Bandes von 1928: Sechsmal hat die Transkription tom-, wo das Verb tornar lautet (tomà, tomaré, tomar), und einmal jom für jorn.
- Mit 6.800 Wörtern machen die fünf Inhaltsdateien und das Kit das zusammengesetzte Skript etwa 69 KB groß. Ein ganzes Buch ist das größte Beispiel, das ein Pen fassen kann; ein längeres Werk gehört in ein Paket im Format
.postext.
Nachweise
- Rezept
- Ignacio Ferro
- Text
- El transplantat, complete, from the Obres completes, vol. VI (Barcelona, 1928), with misprints corrected, no opening ¿ ¡ and today’s dialogue dashes · Narcís Oller · gemeinfrei
- The note to the edition · Postext Cookbook · eigener Text
- Bilder
- Engraving, frontispiece: the baker at his oven's door · Generated With Diffusion Models · eigener Text
- Engraving, chapter I: the night train into Barcelona · Generated With Diffusion Models · eigener Text
- Engraving, chapter II: the village street in autumn · Generated With Diffusion Models · eigener Text
- Engraving, chapter III: the Rambla at dawn · Generated With Diffusion Models · eigener Text
- Engraving, chapter IV: the old man by the railway · Generated With Diffusion Models · eigener Text
- Schriften
- Gentium Book Plus (SIL OFL 1.1) · Cormorant Garamond (SIL OFL 1.1) · Cormorant SC (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)


