本文へスキップ
レシピ番号44

レシピ集 · 第2章 · 文字と本文

校訂版:行番号と行に対応する注

1645年版の本文によるミルトンの『Lycidas』。lineNumbersが詩の行を数えて5行ごとの番号をサイド段に印字し、各注はチップで組んだ行番号から始まります。

このページの内容
ジャンル
詩歌
出力
Canvas
レベル
上級
Postext
Postext 1.65.0で検証済み
1.25.0以上が必要
ライセンス
2026年10月10日更新
コードMIT · 本文CC BY 4.0

1ページ(全9ページ)

  • 英語の見本:日本語版はまだありません
  • 仕上がり138 × 216 mm
  • 1段半組み, 段間4 mm
  • Linden Hill 10.5/14.5
  • Imbue
  • Libre Franklin
  • 9ページ
  • レベル
  • Postext 1.57.1
  • 組版時間71 ms
  • コード168行

かんたんな説明

ミルトンの詩の学術的な校訂版です。5行ごとに余白に行番号が入り、詩のあとの注は、説明する行をその番号で指し示します。

できあがり

ミルトンがエドワード・キングに捧げた哀歌『Lycidas』を、1645年の『Poems』の本文と綴りのまま、138 × 216 mmの小さな校訂版として組みます。最初のページは月桂樹の小枝の下で始まり、背の高いImbueのキャピタルで組んだ表題の下に、ミルトンが1645年に加えた前書きが入ります。続く193行は1行ずつ組まれ、詩節のあいだは1行あけ、短い行は字下げします。5行ごとに、小口側の幅6 mmの段に月桂樹の緑で行番号が入ります。奇数ページでは詩行の右、偶数ページでは左です。詩行には注の合印を付けません。注は詩のあとの2ページを埋め、各注はその行の番号から始まります。番号は余白の番号と同じ緑のLibre Franklinです。

このレシピが答える質問

  • 詩の5行ごとに余白へ行番号を付け、注をその行番号に対応させるには?
  • 詩を組むには(1行に1詩行、連の間のアキ、折り返した行のぶら下げインデント、ハイフネーションなし)?
  • 脚注を付けるには?
  • 幅の広い本文の段と幅の狭いサイド段からなる1段半のレイアウトにするには?
  • 空行を入れても効かないとき、2つのブロックの間に縦のスペースを追加するには?

手短な答え

script.js · 30〜43行コード全体で見る
// The poem is one :::verse block, written as 1645 prints it: a line of verse a line, a blank
// line between verse paragraphs and two spaces before a short line. lineNumbers counts its
// lines of verse (a line that turned over would still count once) and prints the multiples
// of five beside their lines, on their baselines. position 'side' puts them in the side
// column of the one-and-a-half layout, flush with its edge next to the verse.
const lineNumbers = {
  enabled: true,
  count: 'verse', // the lines of :::verse poems; the notes are prose and not counted
  interval: 5,
  restart: 'document', // one count through the poem
  position: 'side',
  fontFamily: LABEL, fontSize: pt(7.5), color: col('laurel'),
};
// Hook-up: lineNumbers in the config; the Markdown goes to buildDocument as it is written.

材料

種類
Linden Hill, Imbue, Libre Franklin (SIL OFL 1.1)
素材
  • laurel-1040.jpg
  • The sprig of bay laurel on the first page, a watercolour (Generated With Diffusion Models, オリジナル)

作り方

#1 · 詩の行を数える

この手順のコードは上の手短な答えにあります。lineNumbersは詩の行を数え、5行ごとにその番号を行の横、行のベースライン上に、月桂樹の緑の7.5 pt Libre Franklinで印字します(行番号)。count: 'verse'は:::verseの詩の行だけを数えるので、本文についての段落や詩のあとの注には番号が付きません。行長に収まらない長い行があっても1行として数え、折り返した部分には番号を付けません。restart: 'document'で、詩全体を通し番号にします。番号はレイアウトが組み終えた行の横に描かれるので、行を動かすことはありません。

#2 · 幅6ミリの溝

script.js · 47〜63行コード全体で見る
const PT = 25.4 / 72; // mm in a point
const [TRIM_W, TRIM_H] = [138, 216]; // mm
const [TOP, INNER] = [21, 20]; // mm
const LINES = 34; // lines of verse to a page
const BOTTOM = TRIM_H - TOP - LINES * LEAD * PT; // 21.08 mm
const [MEASURE, GUTTER, CHANNEL] = [80, 4, 6]; // mm: the longest line of Lycidas is 78.1 mm
const OUTER = TRIM_W - INNER - MEASURE - GUTTER - CHANNEL; // 28 mm beyond the numbers
const layout = {
  layoutType: 'oneAndHalf',
  sideColumnRole: 'floats', // the side column takes the numbers, never text
  sideColumnSide: 'outer', // right of the verse on a recto, left of it on a verso
  // 6 of 90 mm. The zero is Libre Franklin's widest figure, so '100' (4.9 mm) is the widest number.
  sideColumnPercent: (CHANNEL / (MEASURE + GUTTER + CHANNEL)) * 100,
  gutterWidth: mm(GUTTER),
};
const page = { sizePreset: 'custom', width: mm(TRIM_W), height: mm(TRIM_H), dpi: 150,
  margins: { top: mm(TOP), bottom: mm(BOTTOM), left: mm(INNER), right: mm(OUTER), mirror: true } };

sideColumnRole: 'floats'にすると、oneAndHalfレイアウトの狭い段には本文が入りません(レイアウトの種類)。position: 'side'は番号をこの段に、詩行の側の端にそろえて組みます。4 mmの段間が、行とその番号のあいだのあきになります。sideColumnPercentは版面に対する割合なので、CodePenのサンプルはミリ単位から換算しています。90 mmのうちの6 mmで、いちばん幅のある番号が収まります。Libre Franklinの数字はプロポーショナルで、7.5 ptではゼロが最も幅広く(1が1.2 mmに対して1.8 mm)、詩の中でいちばん幅のある番号は4.9 mmの100です。180と190は4.8 mmです。'outer'は左右対称の余白に従うので、番号は奇数ページでは詩行の右に左そろえで、偶数ページでは左に右そろえで立ちます。どちらのページでも、番号は詩行から同じ距離で始まるか終わります。詩の段は80 mmで、いちばん長い31行目より1.9 mm広いので、どの行も折り返しません。

#3 · 詩全体を1つの:::verseブロックに

script.js · 67〜72行コード全体で見る
// A blank line between verse paragraphs leaves one line of the grid (stanzaSpace, 1). Two
// leading spaces set a short line in 2 em (indentStep, 1 em a space here, against the default
// half em). The verse is ragged, like all the text here; a line too long for the measure would
// turn over and hang 2 em past its own start, but none does at 80 mm.
const verse = { indentStep: em(1) };
const verseStyles = [{ id: 'verse', hangingIndent: em(2) }];

:::verseブロックは、詩を書いたとおりに保ちます。Markdownの1行が詩の1行になり、空行が詩節を分け、行頭の空白がその行の字下げになります(:::verse)。開始行には詩のスタイルとalign=startを指定します。align=startは、詩をいちばん長い行に合わせて中央に置くのではなく、版面の行頭側にそろえます。詩節のあいだにはグリッドの1行分のあきが入ります(stanzaSpace、1行)。4行目をはじめとするミルトンの14の短い行は2つの空白で始まり、indentStep: em(1)でそれが2 emの字下げになります。詩節のあいだのあきはページの先頭では省かれるので、2ページは版面の先頭で15行目から始まり、14行目と15行目のあいだの詩節の区切りは見えません(「よくあるつまずき」を参照)。

#4 · 月桂樹、表題、前書き

script.js · 76〜101行コード全体で見る
const OPENER_LINES = 20; // of the page's 34: the first verse paragraph, 14 lines, takes the rest
const at = (id, edge, y) => ({ anchor: { to: id, edge }, offset: { x: mm(0), y: mm(y) } });
const title = (size, tracking, placement) => ({ kind: 'text', id: 'title', content: '{titleText}',
  fontFamily: DISPLAY, fontWeight: 300, fontSize: pt(size), lineHeight: 1,
  letterSpacing: pt(tracking), textTransform: 'uppercase', color: col('ink'), placement });
const opener = { enabled: true, minHeight: pt(OPENER_LINES * LEAD), slot: { elements: [
  // The laurel ends above the kicker, so the depth comes from the texts: kicker, title and
  // headnote reach down 20 lines. minHeight is a floor at the same depth, so a shorter
  // headnote leaves the verse on line 21.
  { kind: 'image', id: 'laurel', resourceId: 'laurel',
    placement: { anchor: { to: 'page', edge: 'top-right' }, size: { width: mm(104) } } },
  { kind: 'text', id: 'kicker', content: '{author}', fontFamily: LABEL, fontWeight: 500,
    fontSize: pt(8), letterSpacing: pt(1.6), textTransform: 'uppercase', color: col('laurel'),
    placement: at('container', 'top-left', 50) },
  title(66, 2, at('#kicker', 'below', 1)),
  // # Lycidas {headnote="In this Monody …"}: the whole headnote in italic, ragged; at
  // 64 mm no word stands alone.
  { kind: 'text', id: 'headnote', content: '{attr.headnote}', fontFamily: TEXT, italic: true,
    fontSize: pt(9.5), lineHeight: 13 / 9.5, color: col('ink'), align: 'left',
    placement: { ...at('#title', 'below', 3), size: { width: mm(64) } } },
] } };
// The poem opens on a recto. Its design stays in the column, and the laurel, anchored to the
// page's corner, is painted above the text block all the same. With the default
// marginBottom the verse would start on line 22 and send line 14 to page 2.
const poem = { level: 1, breakBefore: { enabled: true, parity: 'odd' },
  advancedDesign: opener, marginBottom: pt(0) };

第1レベルの見出しは、見出し自身の文字の代わりにデザインを印字します(幅と詳細デザイン)。{author}はフロントマターから、前書きは見出しの行に付けた属性# Lycidas {headnote="In this Monody …"}から取ります(見出しの属性)。月桂樹はキッカーより上で終わるので、章扉の深さはその下の文字で決まります。版面の上端から50 mm下のキッカー、表題、4行の前書きで、ページの34行のうち20行分まで下がり、残りを最初の詩節14行が占めます。minHeightは同じ深さの下限です。前書きを3行に削っても詩は21行目から始まります。下限がなければ20行目まで上がります。marginBottom: pt(0)で、見出しの既定の余白をこのあきに入れないようにしています。余白が入ると詩は22行目から始まり、14行目が2ページに送られてしまいます。デザインは段の中に置いたままですが、ページの右上の角に固定した月桂樹は仕上がりの端から描かれます。段の中に置いたデザインを切るのは段の下端だけです。

#5 · 行番号に対応する注

script.js · 105〜124行コード全体で見る
const NOTE = 8.6; // pt: the notes, and the note on the text
const noteStyles = [
  { id: 'textnote', fontSize: pt(NOTE), lineHeight: pt(NOTE * 1.33) },
  // The note on the text ends on the grid, 2.4 mm below its last line; half a line more
  // leaves one blank line before the first note.
  { id: 'note', fontSize: pt(NOTE), lineHeight: pt(NOTE * 1.33), hangingIndent: em(1.6),
    marginTop: pt(LEAD / 2) },
  { id: 'colophon', fontFamily: LABEL, fontSize: pt(7), lineHeight: pt(9.5), color: col('muted'),
    marginTop: pt(LEAD) },
];
// :chip[8]{style="line"}: Linden Hill has no bold, so the number changes face and colour.
// The chip has no fill, outline or side padding, so nothing is drawn around the number.
const chipStyles = [{ id: 'line', backgroundEnabled: false, borderWidth: pt(0), paddingX: pt(0),
  fontFamily: LABEL, fontSize: em(0.9), color: col('laurel') }];
// # Notes {style="notes"} opens the next page under the title's capitals, smaller. A heading
// style keeps the level's break unless it sets its own (gotcha: style-inherits-break). Its
// design stays in the column too, so the title lines up with the notes on either page.
const notesHead = { id: 'notes', breakBefore: { enabled: true, parity: 'any' },
  advancedDesign: { enabled: true,
    slot: { elements: [title(30, 1, at('container', 'top-left', 0))] } } };

注は行番号に対応させるので、詩行には合印を付けません。注は注釈として詩のあとに続き、詩のページの行を奪いません。各注は:chip[8]{style="line"}と書いた行番号で始まり、続いて説明する語句がイタリックで、閉じ角括弧がそのあとに入ります。チップには塗りも輪郭も左右の内側余白もないので、変わるのは書体と色だけです。月桂樹の緑の7.7 pt Libre Franklinです(チップスタイル)。Linden Hillには太字がないので、番号は書体を変えることで目立たせます。注のスタイルは2行目以降を1.6 em字下げし、左側に番号がくっきり見えるようにしています。注は詩と同じく行末不ぞろいで組みます。# Notes {style="notes"}は8ページへ改ページし、その表題を章扉と同じキャピタルの30 ptで組みます。

8ページ。各注はその行の緑の番号で始まります。1〜7ページの詩には合印がありません。

#6 · 奇偶で分ける柱

script.js · 128〜149行コード全体で見る
const HEAD = 13; // mm from the trim to the running heads' baseline
// A design text's first baseline sits 0.8 of a line below the top of its box: 0.96 em at the
// default lineHeight of 1.2, which the running heads keep.
const BASE = 1.2 * 0.8;
const head = (id, parity, content, x, size = 7.5, extra = {}) => ({ kind: 'text', id, parity,
  content, pages: 'body', fontFamily: LABEL, fontWeight: 500, fontSize: pt(size),
  letterSpacing: pt(1.3), textTransform: 'uppercase', color: col('muted'), ...extra,
  placement: { anchor: { to: 'page', edge: parity === 'even' ? 'top-left' : 'top-right' },
    offset: { x: mm(x), y: mm(HEAD - BASE * size * PT) } } });
const folio = { fontFamily: TEXT, fontWeight: 400, letterSpacing: pt(0), color: col('ink') };
const header = { elements: [
  head('verso-folio', 'even', '{pageNumber}', OUTER, 10, folio),
  head('verso-head', 'even', '{author}', OUTER + 9),
  head('recto-head', 'odd', '{chapterTitle}', -(OUTER + 9)), // LYCIDAS, then NOTES
  head('recto-folio', 'odd', '{pageNumber}', -OUTER, 10, folio),
] };
// The two openers carry their folio at the foot instead, at the outer edge of the text block.
const drop = (parity, edge, x) => ({ ...head(`drop-${parity}`, parity, '{pageNumber}', 0, 10,
  folio), pages: 'opener', placement: { anchor: { to: 'page', edge },
  offset: { x: mm(x), y: mm(-12) } } });
const footer = { elements: [drop('odd', 'bottom-right', -OUTER),
  drop('even', 'bottom-left', OUTER)] };

各要素はページに固定し、parityとpages: 'body'で絞り込みます(テキスト要素)。偶数ページには著者名が、奇数ページには{chapterTitle}が入ります。注はそれ自身の見出しで始まるので、柱は詩の上ではLYCIDAS、注の上ではNOTESになります。ノンブルは版面の小口側の端に立ちます。冒頭の2ページ、1ページと8ページでは、代わりにページの下に入ります。

レシピの全体

Sandbox
// ═══ Postext Cookbook · Nº 044 · Critical edition: line numbers and line-keyed notes ═══
// https://postext.dev/en/cookbook/critical-edition-line-numbers
// Code: MIT · Text: Milton, Poems (1645) (PD) · Notes: CC BY 4.0 · Laurel: diffusion models
// Fonts: Linden Hill, Imbue, Libre Franklin (SIL OFL 1.1) · Needs postext ≥ 1.25.0
// Lycidas in the spelling of 1645, with a number beside every fifth line and two pages of
// notes keyed to those numbers, so the verse carries no note markers.
import {
  buildDocumentWithFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';

const LANG = 'en'; // @lang: the language of the sample document ('en')
const RECIPE = 'critical-edition-line-numbers';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// Black text on white, and one laurel green for the apparatus.
const palette = {
  ink: '#1b1b1b', // the text
  laurel: '#3c5a3e', // line numbers, note numbers, the kicker
  muted: '#6a706a', // running heads, the colophon
  paper: '#ffffff',
};
// col(id) carries the hex beside the id of its palette entry.
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' } }));
const [TEXT, DISPLAY, LABEL] = ['Linden Hill', 'Imbue', 'Libre Franklin'];
const LEAD = 14.5; // pt: the leading of the verse, and the grid every page keeps

// #region answer: count the lines, and set every fifth number in the margin
// The poem is one :::verse block, written as 1645 prints it: a line of verse a line, a blank
// line between verse paragraphs and two spaces before a short line. lineNumbers counts its
// lines of verse (a line that turned over would still count once) and prints the multiples
// of five beside their lines, on their baselines. position 'side' puts them in the side
// column of the one-and-a-half layout, flush with its edge next to the verse.
const lineNumbers = {
  enabled: true,
  count: 'verse', // the lines of :::verse poems; the notes are prose and not counted
  interval: 5,
  restart: 'document', // one count through the poem
  position: 'side',
  fontFamily: LABEL, fontSize: pt(7.5), color: col('laurel'),
};
// Hook-up: lineNumbers in the config; the Markdown goes to buildDocument as it is written.
// #endregion

// #region page: a poetry trim, and a channel for the numbers at the fore-edge
const PT = 25.4 / 72; // mm in a point
const [TRIM_W, TRIM_H] = [138, 216]; // mm

組み立てたscript.jsはそのまま動きます。任意のページのモジュールスクリプトに貼り付けるか、レシピをCodePenで開いてください。 GitHub上のレシピのフォルダー ↗ (新しいタブで開きます)

アレンジ

#10行ごとに番号を振る

長い詩はしばしば10行ごとに番号を振ります。幅6 mmの段は変えなくてかまいません。

-  interval: 5,
+  interval: 10,

#番号をいつも詩行の右に置く

サイド段を右に固定すると、番号はどのページでも詩行の右に立ちます。偶数ページでは番号がのど側に来ます。

-  sideColumnSide: 'outer', // right of the verse on a recto, left of it on a verso
+  sideColumnSide: 'right', // right of the verse on every page

よくあるつまずき

つまずき

属性値には{も}も書けない。"を含む値は一重引用符で囲む

属性値は閉じ波かっこで終わるため、{や}を含められません。二重引用符を含む値は一重引用符で囲みます。ドル記号は問題ありません。 見出しの属性 →

つまずき

見出しスタイルはその階層の改ページを受け継ぐ

headingStylesの項目は、指定しなかったフィールドをすべて見出しの階層から受け継ぎ、breakBeforeも例外ではありません。:::pagebreakのあとのH1に付けた目次や奥付のスタイルはparity 'odd'を受け継ぎ、白ページの後ろに置かれます。こうしたスタイルにはbreakBefore: { enabled: false }を指定してください。 見出しスタイル →

  • 詩節のあいだのあきはページの先頭では省かれるので、1ページから2ページへの変わり目にあたる14行目と15行目のあいだの詩節の区切りは見えません。すべての区切りを見せる必要がある版なら、1645年版のように、各詩節の最初の行を字下げしてください。その行の頭に空白を2つ入れます。
  • 番号は、追加したサイドの囲みやサイドのキャプションとサイド段を共有します。それらに重なった番号もそのまま印字され、SandboxがlineNumberOverlapとして知らせます。囲みを動かすか、position: 'outer'で番号を外側の余白に移してください。
  • 注の行番号は、今も手で書いています(:chip[8]{style="line"})。注から行を指して、その番号を印字させることはまだできません。本文を変えたときは、注の番号を余白の番号と照らし合わせてください。

クレジット

レシピ
Ignacio Ferro
本文
  • Lycidas, with its headnote, in the text of Poems of Mr. John Milton (1645), pages 57–65, from the proofread Wikisource transcription of the 1927 facsimile; checked against H. C. Beeching’s Oxford text (Project Gutenberg eBook 1745) · John Milton · パブリックドメイン
  • The note on the text, the notes and the colophon · Ignacio Ferro · CC BY 4.0
画像
  • The sprig of bay laurel on the first page, a watercolour · Generated With Diffusion Models · オリジナル
フォント
Linden Hill (SIL OFL 1.1) · Imbue (SIL OFL 1.1) · Libre Franklin (SIL OFL 1.1)
Sandbox