かんたんな説明
日本の古典的な小説に、古い地名を説明する短い注を付けます。小さな番号は本文の横に置き、開いた2ページ分の説明は左ページの外側の端にまとめます。
できあがり
樋口一葉の『たけくらべ』(1895〜96年)の第1章を、四六判の版として4ページに組みます。作品が描く昔の吉原について、7つの注を付けます。注は傍注(ぼうちゅう)、つまり古典の文庫本で使われる傍らの注です。説明する語のあとの行の右に小さな(1)が立ち、見開きの両ページで引用された注は、左ページの小口側に、行長の3分の1の罫の下に、5分の1小さい文字で組まれます。読者はページをめくらずにどの注にもたどり着けます。本文は9.25 ptのShippori Minchoで1行42字、17行です。一葉の長い1つの段落と、ぎつちよんちよんに打たれたゴマの圏点をそのまま残しています。ヨーロッパの小説で段の下に注を置く例はNo. 071です。
このレシピが答える質問
- 日本語の本で、(1)の注を章末、ページの下、または見開きにわたって本文の横に置くには?
- 脚注を付けるには?
- 日本語のテキストを、イタリックではなくゴマ圏点や傍線で強調するには?
手短な答え
// placement 'spread' gathers the notes cited on the two pages of a spread at the end of the
// left-hand page's text, the fore-edge in a book bound on the right, under a rule a third of
// the line long, and numbers them per spread. The marker (1) stands small at the right of
// the line, its digits upright, and the note opens with its number and a full note-em.
const footnotes = {
placement: 'spread', // 傍注; 'chapterEnd' sets 後注 after the chapter instead
numbering: 'spread',
markerPosition: 'right', markerTemplate: '({n})', // written out: 'ja' sets them so
numberGap: 'em', hangingIndent: em(2), // turnovers clear the number
fontSize: em(0.8), lineHeight: em(1.5),
separator: { width: 1 / 3, lineWidth: pt(0.5), color: col('plum') },
};
// Ichiyō's sesame marks (傍点) over ぎつちよんちよん: the mark Japan uses, right of the line.
const cjk = {
grid: { enabled: true, charsPerLine: CHARS, linesPerPage: LINES },
emphasisMark: { style: 'sesame', position: 'over' },
};
材料
- 機能
- 日本の本の注脚注日本語の圏点(傍点)縦組み右綴じの本ふりがな:漢字に付ける仮名の読み縦組みの中の正立した数字漢数字と仮名の番号行取りの見出し文字グリッド日本語の改行(禁則処理)青空文庫の取り込み中国語・日本語・韓国語のフォント柱とノンブルページの役割ごとの柱見出しスタイルデザインした章扉見開きの余白セマンティックカラーパレットPDFの書き出し
- 種類
- Shippori Mincho, Noto Sans JP (SIL OFL 1.1)
- 素材
- なし:画像はすべてコードで描画
作り方
#1 · 見開きの注を左ページの小口側にまとめる
コードは上の手短な答えにあります。footnotes.placement: 'spread'は、2ページと3ページで引用された注を3ページの本文の最後、つまり右綴じの本ではその小口側に組みます。numbering: 'spread'で、注の番号は見開きごとに(1)から始まります(脚注)。右ページで引用された注は左ページを待ちます。注のせいで左ページに本文が1行も残らなくなる場合は、残りの注は右ページの地に置かれます。JLReqが認めているとおりです。jaのタグを付けた文書では、縦組みの本の合印はすでに行の右に0.7 emの({n})として、数字を正立させて組まれます。明示的に書いた2行はそれを示すためのものです。numberGap: 'em'で番号のあとに注の文字の全角1字分をあけ、hangingIndent: em(2)で折り返し行をその先にそろえます。
#2 · 日本語の慣習どおりの位置に合印を書く
Markdownでは、注が説明する語のあとに見返り柳[^1]と書き、注は章の最後に[^1]: …の段落として書きます。合印は注が説明する語のあとに置きます。文末に来る合印は。の前に置き(…先生[^1]。)、エンジンは。や合印を行頭に置きません。7つの注はこのレシピのために書いたもので、見返り柳とお齒ぐろ溝が何だったか、大音寺前がどこにあったか、酉の市で何が売られていたかを、平易な現代の日本語で説明しています。
#3 · 底本のゴマの圏点を残す
cjk.emphasisMarkは、この本で*…*と:dots[…]が何を印字するかを決めます。縦組みの行の右に打つゴマ点です。jaの文書はすでにゴマ点を使います。明示的に書くと、機能一覧の圏点の項目が有効になります。青空文庫のテキストはぎつちよんちよんに傍点を付けており、aozora.pyはそれを:dots[ぎつちよんちよん]{style=sesame}と書きました。中国語の本では代わりに行の下に点を打ちます(圏点と傍線、ルビ、割注)。
#4 · 見開きで始める
// Page-anchored design on a vertical page: x runs down the page from its top edge, y across
// it leftwards from its right edge. The title stands on the page's axis, the author lower.
const PT = 25.4 / 72; // mm in a point
const page = (down, across) => ({ anchor: { to: 'page', edge: 'top-left' },
offset: { x: mm(down), y: mm(across) } });
const TITLE = 26; // pt
// parity 'any': the story opens on the next page, either side (the default waits for a recto).
const story = { level: 1, breakBefore: { enabled: true, parity: 'any' },
advancedDesign: { enabled: true, minHeight: lines(LINES), slot: { elements: [
{ kind: 'text', id: 'title', content: '{titleText}', fontFamily: MINCHO, fontWeight: 700,
fontSize: pt(TITLE), lineHeight: 1, letterSpacing: pt(TITLE / 2), color: col('ink'),
placement: page(42, 127 / 2 - (TITLE * PT) / 2) },
{ kind: 'rule', id: 'rule', direction: 'horizontal', thickness: pt(0.6), color: col('plum'),
placement: { ...page(42, 127 / 2 + (TITLE * PT) / 2 + 5), size: { width: mm(24) } } },
{ kind: 'text', id: 'author', content: '{author}', fontFamily: MINCHO, fontSize: pt(12),
letterSpacing: pt(4), color: col('ink'),
placement: page(118, 127 / 2 + (TITLE * PT) / 2 + 3) },
] } } };
const section = { level: 2, fontFamily: MINCHO, fontWeight: 700, fontSize: pt(11),
lineSpan: 3, indent: em(7) }; // 3行取り, seven characters down, as the Aozora text marks it
章の最初の文は、最初の3行のうちに4つの注を引用します。1ページの表題の下に組むと、本文には3行分の場所しか残りません。左ページに入るのはその見開きの注だけで、ほかのページの注は入りません。1ページに扉だけを単独で置くと、章は右ページの2ページへ移り、最初の見開きに本文とそのすべての注が収まります。扉は第1レベルの見出しで、そのデザインがページを埋めます。仕上がりに固定しているので、表題はページの中心線上に立ちます。
#5 · 柱とノンブルを小口側に縦に入れる
const foreEdge = (id, content, parity, edge, y, pages) => ({
kind: 'text', id, content, parity, pages, writingMode: 'vertical-rl',
fontFamily: GOTHIC, fontSize: pt(7), letterSpacing: pt(1), color: col('muted'),
overflow: 'clip', placement: { anchor: { to: 'outer', edge }, offset: { y: em(y) } },
});
const header = { elements: [
foreEdge('hashira', '{title}', 'odd', 'top', 2, 'body'),
foreEdge('folio', '{pageNumber}', 'all', 'bottom', -2, 'body'),
] };
// The title page carries the colophon across the foot, in the edition's language.
const footer = { elements: [{ kind: 'text', id: 'colophon', content: '{attr.colophon}',
pages: 'opener', fontFamily: GOTHIC, fontSize: pt(5.5), lineHeight: 1.45,
color: col('muted'), overflow: 'wrap', align: 'center',
placement: { anchor: { to: 'page', edge: 'bottom' }, offset: { y: mm(-6) },
size: { width: mm(100) } } }] };
表題は左ページの小口側の余白に、注の外側に縦に入ります。漢数字のノンブルは、扉を除くすべてのページの下に入ります。
レシピの全体
// ═══ Postext Cookbook · Nº 121 · Notes beside a vertical Japanese text, across the spread ══
// https://postext.dev/en/cookbook/vertical-notes-and-sidenotes
// Code: MIT · Text: 樋口一葉『たけくらべ』, Aozora Bunko 389 (PD); notes CC BY 4.0 · Pictures: none
// Fonts: Shippori Mincho, Noto Sans JP (SIL OFL 1.1) · Needs postext ≥ 1.25.0
import {
buildDocument, withLoadedFonts, renderPageToCanvas, loadVerticalAlternates,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';
const LANG = 'en'; // @lang: the language of the colophon; the story is Japanese in both
const RECIPE = 'vertical-notes-and-sidenotes';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: ink, a muted plum for the note numbers' rule, cream paper
const palette = {
ink: '#211d1b', // the text and the notes
plum: '#6b3a55', // 紫: the rule over the notes, the engine's defaults
muted: '#6b645d', // the hashira and the folios
paper: '#fbf7ef',
};
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: 'defaults', value: { hex: palette.plum, model: 'hex' } },
];
// #endregion
const [MINCHO, GOTHIC] = ['Shippori Mincho', 'Noto Sans JP'];
const [BODY, LEAD, CHARS, LINES] = [9.25, 16.25, 42, 17]; // pt, pt: 四六判 42字 × 17行
const lines = (n) => pt(n * LEAD);
// #region answer: 傍注, the notes of both pages of a spread at the fore-edge of the left one
// placement 'spread' gathers the notes cited on the two pages of a spread at the end of the
// left-hand page's text, the fore-edge in a book bound on the right, under a rule a third of
// the line long, and numbers them per spread. The marker (1) stands small at the right of
// the line, its digits upright, and the note opens with its number and a full note-em.
const footnotes = {
placement: 'spread', // 傍注; 'chapterEnd' sets 後注 after the chapter instead
numbering: 'spread',
markerPosition: 'right', markerTemplate: '({n})', // written out: 'ja' sets them so
numberGap: 'em', hangingIndent: em(2), // turnovers clear the number
fontSize: em(0.8), lineHeight: em(1.5),
separator: { width: 1 / 3, lineWidth: pt(0.5), color: col('plum') },
};
// Ichiyō's sesame marks (傍点) over ぎつちよんちよん: the mark Japan uses, right of the line.
const cjk = {
grid: { enabled: true, charsPerLine: CHARS, linesPerPage: LINES },
emphasisMark: { style: 'sesame', position: 'over' },
};
組み立てたscript.jsはそのまま動きます。任意のページのモジュールスクリプトに貼り付けるか、レシピをCodePenで開いてください。 GitHub上のレシピのフォルダー ↗ (新しいタブで開きます)
アレンジ
#注を章の最後にまとめる
placementを指定しないと、縦組みのjaの本は注を後注(こうちゅう)として組みます。章の本文のあとに、同じ罫の下に、章を通した番号で組まれます。ここでは注が4ページの左半分を埋めます。
- placement: 'spread', // 傍注; 'chapterEnd' sets 後注 after the chapter instead
- numbering: 'spread',
+ placement: 'chapterEnd', // 後注, the default for a vertical ja book
+ numbering: 'chapter',#合印を語の横に置く
markerPosition: 'side'にすると、行間のルビのように、行の横のあきに小さな合印を組みます。合印は行の中の場所をまったく取りません。
- markerPosition: 'right', markerTemplate: '({n})', // written out: 'ja' sets them so
+ markerPosition: 'side', markerTemplate: '{n}',よくあるつまずき
つまずき
日本語のテキストのタグは'ja'。zh-HansやLANGにしない
レシピの版はenとesですが、日本語のサンプルはどちらの版でも日本語です。`locale: LANG`では英語やスペイン語とタグ付けされ、中国語のタグでは中国語の規則で組まれます(開明式の約物、小書きの仮名が行頭に来てもよい、図の代わりに图、PDFでは中国の字形)。postext 1.30以降、このタグはテキストを組む言語(計測、描画、埋め込みに使う言語)でもあるので、'ja'以外のタグでは日本語の字形ではなく別の字形(中国語のタグでは中国の字形)になり、改行の位置も変わります。'ja'と書いてください。日本の地域(JLReqの改行と約物、ゴマの圏点、ルビの間隔、図と表の表示名)が選ばれ、ハイフネーションが切られます。リントは、zhやkoのタグで仮名を含むテキストをエラーにします。 日本語の改行(禁則処理) →
つまずき
中国語の書体はcjkブロックを通じてスライス単位で読み込む
Fontsourceは中国語、日本語、韓国語のファミリーを、ウェイトごとに約100個のファイルとして配信し、各ファイルが文字の範囲を受け持ちます。loadFontsが取得するのはlatinファイルだけなので、画面では漢字がシステムの書体で出て計測が狂い、fontsourceProviderはPDFにそのlatinファイルを渡すため、漢字が空の四角で印字されます。キットのcjkブロックを挙げ、loadFontsのあとにloadCjkFonts(FONTS, markdown)を呼び(本で複数のCJK書体を使うときは、それぞれの書体で組むテキストを渡して書体ごとに1回)、renderToPdfにfontProvider: cjkPdfProviderを渡してください。どちらもテキストの文字を含むファイルを取得します。 中国語・日本語・韓国語のフォント →
つまずき
右綴じの本の見開きはshowBookで表示する
右綴じの本(アラビア語、ヘブライ語、ペルシア語のテキスト、縦組みの中国語、またはpage.binding 'right')でも1ページは奇数ページですが、背の左側に来て、見開きは[3 | 2]と並びます。showPagesはどの本も左綴じとして並べます。bookブロックのshowBook(cjkブロックにも同じ関数があります)はdoc.bindingを読み、見開きを左右反転します。capture.heroでは、見開きは引き続き読む順の[偶数ページ, 奇数ページ]、つまり[2, 3]と指定します。 右綴じの本 →
クレジット
- 本文
- 樋口一葉「たけくらべ」 (Child’s Play, 1895–96), chapter one; Aozora Bunko card 389, from 「日本現代文學全集10 樋口一葉集」 (Kōdansha, 1962), input 青空文庫, proofreading 米田進 and 小林繁雄, converted with aozora.py; the seven notes were written for this recipe (CC BY 4.0) · Higuchi Ichiyō; Aozora Bunko volunteers · パブリックドメイン
- フォント
- Shippori Mincho (SIL OFL 1.1) · Noto Sans JP (SIL OFL 1.1)


