In short
The opening chapter of a Greek novel from 1914, set as a small paperback. Words are divided at the end of a line the way Greek schoolbooks teach, and the running heads are in capitals, which in Greek carry no accents.
What you'll build
The first chapter of Konstantinos Theotokis's Η τιμή και το χρήμα (Honour and Money, 1914), from the Greek Wikisource, as a 13.5 × 20.5 cm paperback. A title page and a note on the text come first; the chapter opens on a recto under its numeral Αʹ in GFS Didot, sunk ten lines. The text is Literata at 9.7 on 14.2 pt, 31 lines a page, justified and hyphenated by the monotonic Greek patterns. The running heads carry the author over the versos and the title over the rectos, in spaced capitals that lose their accents as Greek capitals should. The note and the colophon follow the edition's language; the novel stays Greek in all three.
This recipe answers
- How do I get good justification and hyphenation for Spanish, French or German text?
- How do I set running heads: book title on the left page, chapter title on the right, page number outside?
- How do I write dialogue dashes, years at a paragraph start, prices and literal symbols without Markdown misreading them?
The short answer
// locale 'el' picks the monotonic patterns, which keep the digraphs and the diphthongs
// whole (μπρά-τσα, ευ-τυ-χί-α) and divide between two consonants the way a Greek school
// grammar does (κάρ-βου-να, αν-θρώ-πους). The same tag gives the Greek labels and tags the
// PDF as Greek. The defaults justify, hyphenate in config().locale and break by Knuth–Plass.
const LOCALE = 'el';
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: em(1.2), indentAfterHeading: false,
// Two letters at least on either side of a break (ξα-νά, not ξ-ανά) and no page that ends
// on a divided word. Greek words run long: spaces from 0.8× to 1.6× of the face's own,
// then up to 12‰ of tracking, and a last line under about eleven letters is a runt.
hyphenation: { leftMin: 2, rightMin: 2 }, hyphenateAcrossColumns: false,
maxWordSpacing: 1.6, minWordSpacing: 0.8, maxJustifyTracking: 12, runtMinCharacters: 22,
};
Monotonic Greek, justified and hyphenated by its own patterns
Ingredients
- Features
- Hyphenation and document languageOptimal line breaking (Knuth–Plass)Running heads and foliosBody typeIndents, alignment and paragraph spacingWidows, orphans and runtsDesigned openersHeading stylesHeading attributesText, rules and boxes in page designsHeads by page roleMirrored marginsPaper colourParagraph stylesDocument metadataSemantic colour palettePDF exportFonts embedded in the PDF
- Also uses
- Running heads per section
- Type
- Literata, GFS Didot (SIL OFL 1.1)
- Assets
- None: every picture is drawn in code
Method
#1 · Name the language: el
The code is the short answer above. locale: 'el' takes the monotonic Greek patterns (hyphenation). They keep the digraphs μπ, ντ, γκ, τσ, τζ and the diphthongs whole and divide between two consonants as a Greek school grammar does: the vdt of page 3 shows εση-κώθηκε and μεσο-φόρι. leftMin and rightMin of 2 forbid a single letter on either side of a break, and hyphenateAcrossColumns: false keeps a page from ending on a divided word. Greek words run long; spaces from 0.8 to 1.6 times the face's own, then up to 12 ‰ of tracking, keep the lines even.
#2 · Running heads in capitals
// textTransform 'uppercase' in a Greek document writes ΚΩΝΣΤΑΝΤΙΝΟΣ ΘΕΟΤΟΚΗΣ for
// Κωνσταντίνος Θεοτόκης: Greek capitals carry no accent, and the engine removes the tonos
// (and keeps a dialytika, ΑΫΠΝΙΑ) as it sets the letters. The Markdown keeps the accents,
// so search and the PDF's text read the words as written.
const caps = (size, tracking, color = 'muted') => ({ fontFamily: TEXT, fontSize: pt(size),
fontWeight: 500, letterSpacing: pt(tracking), textTransform: 'uppercase', color: col(color) });
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 = 11.5, pages = 'body') => ({
kind: 'text', id, content, parity, pages, ...caps(7.5, 1.4), placement: at('page', edge, x, y),
});
const folio = { fontWeight: 400, letterSpacing: pt(0), color: col('ink') }; // digits: no case
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)] };
textTransform: 'uppercase' in a Greek document writes ΚΩΝΣΤΑΝΤΙΝΟΣ ΘΕΟΤΟΚΗΣ for Κωνσταντίνος Θεοτόκης: Greek capitals take no tonos, and the engine drops it as it sets the letters, while a dialytika stays (ΑΫΠΝΙΑ). The Markdown and the PDF's text keep the accented words, so search still finds them. The folios have no case and keep their weight 400.
#3 · A chapter numeral in Didot
// # Α΄ {style="chapter"}: the numeral is the heading's text, a capital and the Greek numeral
// sign ʹ (U+0374), as Greek books number their chapters.
const chapter = { id: 'chapter', breakBefore: { enabled: true, parity: 'odd' },
marginBottom: pt(0), // the opener's own height already ends on a line
advancedDesign: { enabled: true, minHeight: pt(10 * LEAD), slot: { elements: [
text('book', '{title}', TEXT, 8, at('container', 'top', 0, 2 * LINE),
caps(8, 2.2, 'muted')),
text('numeral', '{titleText}', DISPLAY, 30, at('container', 'top', 0, 3.6 * LINE),
{ color: col('accent'), lineHeight: 1 }),
rule('rule', 6.4 * LINE, 10),
] } },
};
The heading # Αʹ {style="chapter"} is the numeral itself: a capital and the Greek numeral sign ʹ, as Greek books number their chapters. The design sets it at 30 pt in GFS Didot under the book's title, with a short rule, and minHeight sinks the text ten lines. breakBefore with parity odd opens the chapter on a recto; a heading style sets its own break side.
The whole recipe
// ═══ Postext Cookbook · Nº 201 · A Greek novel page, hyphenated in monotonic Greek ═══════
// https://postext.dev/en/cookbook/monotonic-greek-novel
// Code: MIT · Text: K. Theotokis, Η τιμή και το χρήμα, 1914 (PD, el.wikisource) · Pictures: none
// Fonts: Literata, GFS Didot (SIL OFL 1.1) · Needs postext ≥ 1.99.1
import { buildDocumentWithFonts, renderPageToCanvas } from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';
const LANG = 'en'; // @lang: the language of the note on the text ('en' | 'es' | 'el')
const RECIPE = 'monotonic-greek-novel';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// Black text on an ivory paper and one blue-grey accent, as the Athens literary presses
// set their novels between the wars.
const palette = {
ink: '#1f1d1b', // text
accent: '#2f4f6b', // chapter numeral, rules, the title on the title page
muted: '#6a645c', // running heads, the note on the text, the colophon
paper: '#fbf8f1', // an ivory book 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 [TEXT, DISPLAY] = ['Literata', 'GFS Didot']; // a text face with Greek; a Greek Didot
const [BODY, LEAD] = [9.7, 14.2]; // pt
const LINE = (LEAD * 25.4) / 72; // mm: one line, 5.01
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });
// Hung under another element, centred on it.
const under = (id, y) => ({ anchor: { to: id, edge: 'below', at: 'center' },
offset: { y: mm(y) } });
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 });
const rule = (id, y, width) => ({ kind: 'rule', id, direction: 'horizontal', thickness: pt(0.5),
color: col('accent'),
placement: { ...at('container', 'top', 0, y), size: { width: mm(width) } } });
// #region page: a 13.5 × 20.5 cm novel; the text block holds 31 whole lines
const TRIM = { width: 135, height: 205 }; // mm
const [TOP, INNER, OUTER, LINES] = [20, 18, 21, 31];
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
};
// 96 mm of measure: about 60 characters of Literata, nine or ten Greek words.
// #endregion
The composed script.js runs as it is: paste it into any page’s module script, or open the recipe on CodePen. Recipe folder on GitHub ↗ (opens in a new tab)
Pitfalls
Pitfall
A heading style inherits its level's page break
A headingStyles entry takes every field it leaves out from its heading level, breakBefore included. A contents page or a colophon styled on an H1 after a :::pagebreak inherits parity 'odd' and lands behind a blank page. Give such a style breakBefore: { enabled: false }. Heading styles →
- A capital that opens a word in running text keeps its tonos, set to its left (Ό,τι, Ή κάνεις). Only a
textTransform: 'uppercase'setting removes accents; the Markdown should always carry them. - GFS Didot has no fleuron ❦ and no italic. An ornament or an emphasis in that face falls back to another font or a slanted Roman; this recipe uses Didot only for the title and the numeral.
- Short lines of dialogue in a 96 mm measure leave the breaker few choices. The capture counts 3 of 97 lines past 1.6 times the normal space, the worst on page 4; a wider measure or a smaller size lowers the count.
Credits
- Recipe
- Ignacio Ferro
- Text
- Η τιμή και το χρήμα (1914), chapter I, complete, from the monotonic transcription of el.wikisource (revision 101144), with one misprint corrected, one opening guillemet restored, elision marks as ’ and each line of dialogue a paragraph · Konstantinos Theotokis · public domain
- The note on the text and the colophon · Postext Cookbook · original
- Fonts
- Literata (SIL OFL 1.1) · GFS Didot (SIL OFL 1.1)
Edit this write-up ↗ (opens in a new tab)Recipe folder on GitHub ↗ (opens in a new tab)


