かんたんな説明
『不思議の国のアリス』の数ページに、編者の注を横の余白に添えたものです。どの注も説明する行のすぐ横にあり、本文には色つきの文字で印が付いています。
できあがり
『不思議の国のアリス』第7章、狂ったお茶会の冒頭を、156 × 234 mmの一般書の判型で注釈版の3ページに組みます。キャロルの本文はUnnaの両端そろえ1段で、1行およそ66字です。小口側の33 mmの帯に編者の傍注8件を収め、それぞれを注の文字を含む段落の横に置きます。そのため傍注は奇数ページでは右、偶数ページでは左に並びます。語句や言葉遊びについての傍注は緑、歴史についての傍注は赤で、本文中の文字も対応する傍注の色になります。章は真上から見たお茶会のテーブルの水彩画の下で始まり、続いて数字、Rozha Oneの表題、緑のドロップキャップを置いたイタリックのヘッドノートが並びます。この版についての注記は、ヘッドノートの横の余白に置きます。
このレシピが答える質問
- 説明する段落の横に、傍注や注釈を置くには?
- 脚注を付けるには?
- 幅の広い本文の段と幅の狭いサイド段からなる1段半のレイアウトにするには?
- 章扉に著者名の行、リード文、ドロップキャップ付きの導入文を加えるには?
手短な答え
const layout = {
layoutType: 'oneAndHalf', // one text column and a narrower side column
sideColumnPercent: 26, // of the 127 mm between the margins: a 33 mm channel
sideColumnRole: 'floats', // no text runs in it: it holds side boxes and figures
sideColumnSide: 'outer', // at the fore-edge, which mirrored margins move page by page
gutterWidth: mm(4.5), // the text column keeps 127 − 33 − 4.5 = 89.5 mm
};
// A gloss is :::callout{type="note" span="side" title="a · …"} in the Markdown.
// span="side" moves it out of the flow into the channel, level with the block after
// the fence, so the fence goes just before the paragraph that carries its letter.
// Glosses never float. One that meets the gloss above stacks under it. One that would
// run past the column's foot slides up, as far as the gloss above allows, until its
// foot sits on the foot; if it still does not fit, it waits for the next page
// (gotcha: side-box-starts-at-fence).
const gloss = (id, hue) => ({ id,
backgroundEnabled: false, // one device: a hairline over the gloss, in its colour
stripe: { enabled: true, side: 'top', width: pt(0.5), color: col(hue) },
padding: { top: mm(1.5), right: pt(0), bottom: pt(0), left: pt(0) },
// Cormorant SC draws lower case as small capitals: the title needs no textTransform.
titleStyle: { fontFamily: LABEL, fontWeight: 600, fontSize: pt(8.5),
letterSpacing: pt(0.3), color: col(hue), gap: mm(0.8) },
// Face and colours come from bodyText. A box body also inherits its 4 mm first-line
// indent, which a gloss sets back to 0.
body: { fontSize: pt(7.8), lineHeight: pt(10), textAlign: 'left',
firstLineIndent: pt(0) } });
const calloutStyles = [gloss('note', 'lawn'), gloss('context', 'jam')]; // words, history
材料
- 機能
- 欄外の注フロート用の余白段1段半組み見開きの余白囲み上付きと下付きデザインした章扉段抜きの章見出し帯ページデザインのテキスト・罫・ボックスページデザインの画像デザイン要素の基準位置章扉のドロップキャップ見出しの属性柱とノンブルページの役割ごとの柱リソースとしての図と表セマンティックカラーパレット最適な改行(Knuth–Plass)インラインのチップ
- 種類
- Unna, Rozha One, Cormorant SC (SIL OFL 1.1)
- 素材
tea-table-1560.jpg- The tea-table seen from above, a watercolour (Generated With Diffusion Models, オリジナル)
作り方
#1 · 小口側を傍注に充てる
コードは前出の手短な答えにあります。1段半組みでは、sideColumnPercent: 26で左右の余白のあいだの127 mmのうち33 mmをサイド段に割り当て、4.5 mmの段間を引いた89.5 mmが本文に残ります。sideColumnRole: 'floats'はキャロルの本文をサイド段に流さないための設定で、サイド段にはspan: 'side'で置いたものだけが入ります。脚注は段の地で罫の下に待っていますが、余白の傍注は説明する行と同じ高さに立ち、本文の段から行を奪いません。2つの傍注スタイルは細罫と見出しの色だけが違うので、読者は読む前に語句の注か歴史の注かを見分けられます。
#2 · ページを見開きにして、帯を小口に追従させる
const PT = 25.4 / 72; // mm in a point
const [TRIM_W, TRIM_H] = [156, 234]; // mm
const [TOP, BOTTOM, INNER, OUTER] = [22, 22, 15, 14]; // mm: 38 lines of text
const page = { width: mm(TRIM_W), height: mm(TRIM_H), dpi: 150,
backgroundColor: col('paper'),
// left is a recto's inner margin; mirror swaps the sides on a verso, and 'outer' moves
// the channel with them: right on a recto, left on a verso.
margins: { top: mm(TOP), bottom: mm(BOTTOM), left: mm(INNER), right: mm(OUTER),
mirror: true } };
const CONTENT_W = TRIM_W - INNER - OUTER; // 127 mm
const SIDE_W = CONTENT_W * layout.sideColumnPercent / 100; // 33 mm: the glosses' measure
const TEXT_W = CONTENT_W - SIDE_W - layout.gutterWidth.value;
mirror: trueで偶数ページごとに左右の余白が入れ替わり、sideColumnSide: 'outer'で帯もそれに合わせて動きます。こうして傍注は81ページと83ページでは右に、82ページでは左に並びます。天と地の余白を22 mmにすると190 mmが残り、14 ptの行が38行入ります。傍注もそれぞれこのグリッドの行から始まります。
#3 · 説明する段落の前で傍注を囲む
const bodyText = { // justified and hyphenated (en-us) by default
// Copy-fitted to the 89.5 mm column: at 9.5 pt '“Have some wine,” the March Hare said in
// an encouraging tone.' fits one line. At 10.4 pt every measure from 77 to 93 mm left
// it a short last line: 'couraging tone.', 'aging tone.', 'ing tone.' or 'tone.'.
fontFamily: TEXT, fontSize: pt(9.5), lineHeight: pt(LEAD), color: col('ink'),
boldColor: col('ink'), italicColor: col('ink'), firstLineIndent: mm(4),
// The chapter's first paragraph is set flush, though the fences of glosses a and b stand
// between the heading and it: a box that leaves the flow is not the block after a heading.
indentAfterHeading: false,
// Unna's space is narrow, 0.22 em. At the default 0.6 the line breaker set 'Alice felt
// dreadfully puzzled. The Hatter’s remark seemed to have' with its spaces at 0.69.
minWordSpacing: 0.75,
// The dictionary divides the heroine's name, 'said Al-' | 'ice indignantly' on page 81.
// The list keeps it whole wherever it stands; every other word is divided as before.
hyphenation: { exceptions: ['Alice'] } };
:::calloutの囲みにspan="side"を付けた囲みは本文の流れから外れ、囲みのあとに続くブロックと同じ高さで帯の中に立ちます。そこで、下の例のように、各傍注は注の文字を含む段落の直前に書きます。傍注aとbは第1段落の横に置くので、その囲みは見出しと第1段落のあいだに入ります。本文の流れから外れた囲みは見出しの次のブロックとして数えられないので、indentAfterHeading: falseだけでこの段落は字下げなしになります。本文は段に合わせて文字量を調整しています。9.5 ptでは“Have some wine,”で始まる段落が89.5 mmの1行に収まりますが、10.4 ptでは77 mmから93 mmまでどの行長でも“ing tone.”や“tone.”のような短い最終行が残りました。Unnaの語間は0.22 emと狭く、minWordSpacingが既定の0.6のままでは、83ページの1行で語間がその幅の0.69まで詰められていました。minWordSpacing: 0.75にするとその行は出なくなります。81ページでは辞書が主人公の名前を“Al-”と“ice”に分けていたので、その段落は:::paragraphs{style="whole"}で囲んでいます。hyphenation: falseのスタイルで、分割は“together”に入力したソフトハイフン(U+00AD)の1か所だけです。
:::callout{type="context" span="side" title="c · Hair"}
Tenniel drew Alice with long, loose hair. …
:::
“Your hair wants cutting,”:chip[^c^]{style="context"} said the Hatter. …#4 · 各文字を傍注の色で印刷する
// A letter in the text is a chip named after its gloss's type, :chip[^a^]{style="note"}:
// the Markdown has no mark for coloured text, and a chip style sets a colour. With no
// fill, outline, padding or gap the chip adds no width, so the lines break as they would
// with a plain ^a^.
const letter = (id, hue) => ({ id, backgroundEnabled: false, borderWidth: pt(0),
paddingX: pt(0), gap: pt(0), color: col(hue), bold: true });
const chipStyles = [letter('note', 'lawn'), letter('context', 'jam')];
Markdownには文字に色を付ける記法がありませんが、チップのスタイルは文字色を指定できます。そこで各文字を、傍注の種類と同じ名前のスタイルを付けたチップにします。:chip[^c^]{style="context"}は赤いcを印刷し、その赤は傍注cの細罫と見出しの赤と同じです。塗り、輪郭、内側余白、間隔のないチップは幅を増やさないので、どの行も素の^c^のときと同じ位置で改行されます。
#5 · お茶会のテーブルの下で章を始める
const HEADPIECE = 72; // mm: the depth of the painting at the head of the page
const HEADNOTE = { size: 9.8, lead: LEAD }; // pt: the headnote keeps the body's leading
const CAPS = { text: 0.597, initial: 0.56 }; // cap heights, em: Unna and Rozha One
// The initial's size: its capital runs from the first line's cap height down to the
// last baseline it spans. At the default size it stops short of the first line's capitals.
const dropSize = (lines) => pt(((lines - 1) * HEADNOTE.lead + CAPS.text * HEADNOTE.size)
/ CAPS.initial);
const below = (id, y, width) => ({ anchor: { to: `#${id}`, edge: 'below' },
offset: { y: mm(y) }, size: { width } });
// The opener reserves the height of its lowest element, rounded up to the grid, and the
// heading's default bottom margin adds one blank line: with a four-line headnote the
// text starts on line 23. The kicker, the title and the headnote hang below the painting.
const opener = { enabled: true, slot: { elements: [
// An image element draws a resource without number or caption. It hangs from the
// trim's corner, over the top margin and both side margins.
{ kind: 'image', id: 'headpiece', resourceId: 'tea-table',
placement: { anchor: { to: 'page', edge: 'top-left' },
size: { width: mm(TRIM_W) } } },
// The numeral comes from the heading line,
// # A Mad Tea-Party {num="VII" headnote="…" …}: the excerpt stands alone, so
// {chapterNumber} would count its one heading and print 1.
{ kind: 'text', id: 'kicker', content: 'Chapter {attr.num}', fontFamily: LABEL,
fontWeight: 600, fontSize: pt(9), letterSpacing: pt(2), textTransform: 'uppercase',
color: col('jam'), align: 'left',
placement: { anchor: { to: 'container', edge: 'top-left' },
offset: { y: mm(HEADPIECE - TOP + 8) } } }, // 8 mm under the painting's foot
{ kind: 'text', id: 'title', content: '{titleText}', fontFamily: DISPLAY,
fontSize: pt(40), lineHeight: 1.05, color: col('ink'), align: 'left', // wraps when longer
placement: below('kicker', 2, 'fill') },
// The drop cap opens the headnote, the editor's voice, italic and ragged; Carroll's
// text opens in the flow, justified.
{ kind: 'text', id: 'headnote', content: '{attr.headnote}', fontFamily: TEXT,
italic: true, fontSize: pt(HEADNOTE.size),
lineHeight: pt(HEADNOTE.lead), color: col('ink'),
align: 'left',
dropCap: { lines: 2, fontFamily: DISPLAY, fontSize: dropSize(2), color: col('lawn'),
gap: mm(1.5) },
placement: below('title', 5, mm(TEXT_W)) },
// The note on this edition stands in the channel, level with the headnote's top.
{ kind: 'text', id: 'edition-label', content: 'This edition', fontFamily: LABEL,
fontWeight: 600, fontSize: pt(8.5), letterSpacing: pt(0.3), color: col('muted'),
align: 'left', placement: { anchor: { to: '#headnote', edge: 'right-of' },
offset: { x: layout.gutterWidth }, size: { width: mm(SIDE_W) } } },
{ kind: 'text', id: 'edition', content: '{attr.source}', fontFamily: TEXT,
fontSize: pt(7.5), lineHeight: pt(10), color: col('muted'), align: 'left',
placement: { anchor: { to: '#edition-label', edge: 'below' }, offset: { y: mm(0.8) },
size: { width: mm(SIDE_W) } } },
] } };
見出しのデザイン枠はページ全体に広げ、画像が仕上がり線まで届くようにします。肩見出し、表題、ヘッドノートは画像の下に固定します。章扉が確保する領域はそのうちいちばん下の要素までで、グリッドの行に切り上げられます。見出しの既定の下余白で空き行が1行加わります。ヘッドノートが4行なら本文は23行目から始まり、5行目があれば24行目に下がります。数字、ヘッドノート、この版についての注記は見出しの属性{num="VII" headnote="…" source="…"}から取ります。数字をここから取るのは、抜粋がそれだけで1つの文書になるため、{chapterNumber}では1が印刷されてしまうからです。ドロップキャップは左そろえのイタリックで組んだ編者のヘッドノートの頭に置き、キャロルの本文はその下の流れで両端そろえで始まります。dropSize()は頭文字の大きさを決め、その上端をヘッドノート1行目の大文字にそろえます。
#6 · 説明する内容で傍注の色を分ける
const palette = {
ink: '#1f1b1a', // text: a warm near-black
lawn: '#1e6f6b', // glosses on words and jokes, the drop cap
jam: '#b23a48', // glosses on history, the kicker
muted: '#6e645b', // running heads, the note on this edition
paper: '#f8f3e6', // the page, and the tablecloth
};
// col(id): a colour linked to its palette entry, with the entry's hex beside the id.
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const entry = (id, hex, name = id) => ({ id, name, value: { hex, model: 'hex' } });
const colorPalette = [
...Object.entries(palette).map(([id, hex]) => entry(id, hex)),
// The engine's defaults link to 'main-color': aimed at the green, nothing prints blue.
entry('main-color', palette.lawn, 'lawn (defaults)'),
];
芝生の緑は語句、言い回し、言葉遊びについての傍注を、ジャムの赤は人物、日付、本文の来歴についての傍注を示します。同じpaletteオブジェクトでjamに新しい値を与えると、歴史についての傍注、その文字、肩見出しの色が一度に変わります。上の水彩画も、同じ芝生の緑とジャムの赤を基準に選んでいます。
レシピの全体
// ═══ Postext Cookbook · Nº 032 · Annotated classic with margin glosses ════════════
// https://postext.dev/en/cookbook/annotated-classic-glosses
// Code: MIT · Text: Lewis Carroll (PD), glosses (CC BY 4.0) · Headpiece: diffusion models
// Fonts: Unna, Rozha One, Cormorant SC (SIL OFL 1.1) · Needs postext ≥ 1.28.0
// The mad tea-party as an annotated edition: the text keeps to one column, and its glosses stand
// in the outer margin beside the lines they explain, changing sides with the spread.
import {
buildDocumentWithFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';
const LANG = 'en'; // @lang: the language of the sample document ('en')
const RECIPE = 'annotated-classic-glosses';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: a lawn green and a jam red on cream paper
const palette = {
ink: '#1f1b1a', // text: a warm near-black
lawn: '#1e6f6b', // glosses on words and jokes, the drop cap
jam: '#b23a48', // glosses on history, the kicker
muted: '#6e645b', // running heads, the note on this edition
paper: '#f8f3e6', // the page, and the tablecloth
};
// col(id): a colour linked to its palette entry, with the entry's hex beside the id.
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const entry = (id, hex, name = id) => ({ id, name, value: { hex, model: 'hex' } });
const colorPalette = [
...Object.entries(palette).map(([id, hex]) => entry(id, hex)),
// The engine's defaults link to 'main-color': aimed at the green, nothing prints blue.
entry('main-color', palette.lawn, 'lawn (defaults)'),
];
// #endregion
const [TEXT, DISPLAY, LABEL] = ['Unna', 'Rozha One', 'Cormorant SC'];
const LEAD = 14; // body leading in pt: the grid of every page
// #region answer: a float-only channel at the fore-edge, and two gloss styles for it
const layout = {
layoutType: 'oneAndHalf', // one text column and a narrower side column
sideColumnPercent: 26, // of the 127 mm between the margins: a 33 mm channel
sideColumnRole: 'floats', // no text runs in it: it holds side boxes and figures
sideColumnSide: 'outer', // at the fore-edge, which mirrored margins move page by page
gutterWidth: mm(4.5), // the text column keeps 127 − 33 − 4.5 = 89.5 mm
};
// A gloss is :::callout{type="note" span="side" title="a · …"} in the Markdown.
// span="side" moves it out of the flow into the channel, level with the block after
// the fence, so the fence goes just before the paragraph that carries its letter.
// Glosses never float. One that meets the gloss above stacks under it. One that would
// run past the column's foot slides up, as far as the gloss above allows, until its
// foot sits on the foot; if it still does not fit, it waits for the next page
組み立てたscript.jsはそのまま動きます。任意のページのモジュールスクリプトに貼り付けるか、レシピをCodePenで開いてください。 GitHub上のレシピのフォルダー ↗ (新しいタブで開きます)
アレンジ
#傍注をどのページでも右に置く
画面で1ページずつ読む版なら、見開きの設定を切ります。すると'outer'はどのページでも右端を指し、柱は仕上がり線に固定されているので位置が変わりません。
- mirror: true } };
+ mirror: false } };#長い注はページの地に送る
余白に収まらない長い注は脚注にします。本文に[^1]を書き、段落の下にその定義[^1]:を書くと、Postextは本文の段の地に、短い罫の下の89.5 mm幅で組みます。傍注は帯に残ります。それらの注のスタイルは引用した段の地に置く脚注で扱います。
よくあるつまずき
つまずき
サイド段の囲みは、囲みを開く位置の次のブロックと同じ高さから始まる
postext 1.4.1では、span: 'side'の囲みは、囲みを開く位置で本文が達した高さの次のグリッド行から、すでにある囲みがあればその下に、サイド段に置かれます。注釈は説明する段落の直前で開いてください。段落のあとで開くと、注釈は次の段落の横から始まります。段の末尾を越える囲みは、上の囲みが許す範囲で、下端が段の末尾にそろうまで上にずれます。それでも収まらない囲みは、次のページのサイド段まで待ちます。 欄外の注 →
- 傍注はMarkdownに書いた順に上から積み重なるので、長い傍注は次の傍注を押し下げます。81ページでは2つの文字がどちらも第1段落の2行目にあり、傍注aは段落と同じ高さから、傍注bはその下、文字から5行下から始まります。文字が近くに集まる箇所では傍注を短くしてください。
クレジット
- 本文
- Alice’s Adventures in Wonderland (1865), the opening of chapter VII, “A Mad Tea-Party” · Lewis Carroll · パブリックドメイン
- The headnote, the eight glosses and the note on this edition · Ignacio Ferro · CC BY 4.0
- 画像
- The tea-table seen from above, a watercolour · Generated With Diffusion Models · オリジナル
- フォント
- Unna (SIL OFL 1.1) · Rozha One (SIL OFL 1.1) · Cormorant SC (SIL OFL 1.1)


