Skip to main content
Recipe number 121

Cookbook · Chapter 6 · Boxes & notes

Notes beside a vertical Japanese text, across the spread

The first chapter of Ichiyō's Child's Play with seven notes as 傍注: (1) at the right of the line, the notes of both pages at the fore-edge of the left-hand page.

On this page
Output
Canvas · PDF
Postext
Tested with Postext 1.65.0
Needs ≥ 1.25.0 · postext-pdf ≥ 1.25.0
Licence
Updated 10 Oct 2026
Code MIT · Text CC BY 4.0

pp. 二–三 · 2–3 of 4

  • Trim 127 × 188 mm
  • 1 column
  • Shippori Mincho 9.3/16.3
  • Noto Sans JP
  • 4 pages
  • Level
  • Postext 1.65.0
  • Laid out in 68 ms
  • 126 lines of code

In short

A classic Japanese story with short explanations of its old place names. The small numbers sit beside the text, and the explanations for both open pages are gathered at the outer edge of the left page.

What you'll build

Four pages of a 四六判 edition of Higuchi Ichiyō's Child's Play (たけくらべ, 1895–96), its first chapter, with seven notes on the old Yoshiwara quarter it describes. The notes are 傍注 (bōchū), the sidenotes of Japanese classics in paperback: a small (1) stands at the right of the line after the word it explains, and the notes cited on both pages of a spread are set at the fore-edge of the left-hand page, under a rule a third of the line long, in type a fifth smaller. Readers find each note without turning a page. The text, 42 characters down 17 lines in Shippori Mincho at 9.25 pt, keeps Ichiyō's single long paragraph and her sesame marks over ぎつちよんちよん. Notes at the column foot in a European novel are Nº 071.

This recipe answers

  • How do I set the notes of a Japanese book: (1) at the chapter end, at the page foot or beside the text across the spread?
  • How do I do footnotes?
  • How do I mark Japanese text with sesame emphasis dots or a side line instead of italics?

The short answer

script.js · lines 32–48in full code
// 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' },
};

傍注, the notes of both pages of a spread at the fore-edge of the left one

Ingredients

Type
Shippori Mincho, Noto Sans JP (SIL OFL 1.1)
Assets
None: every picture is drawn in code

Method

#1 · Gather the spread's notes at the left page's fore-edge

The code is the short answer above. footnotes.placement: 'spread' sets the notes cited on pages 2 and 3 at the end of page 3's text, which in a book bound on the right is its fore-edge, and numbering: 'spread' starts each spread's notes at (1) (Footnotes). A note cited on the right-hand page waits for the left one; if the notes leave the left page less than one line of text, the rest stay at the foot of the right page, as JLReq allows. A document tagged ja already sets a vertical book's markers as ({n}) at the right of the line, 0.7 em, with digits upright: the two lines written out show it. numberGap: 'em' puts a full note-character after the number and hangingIndent: em(2) lines the turnovers up past it.

#2 · Write the markers where Japanese puts them

The Markdown writes 見返り柳[^1] after the word the note explains and the notes as [^1]: … paragraphs at the end of the chapter. The marker follows the word the note explains; one that ends a sentence goes before its 。 (…先生[^1]。), and the engine never lets 。 or a marker start a line. The seven notes were written for this recipe: what the 見返り柳 and the お齒ぐろ溝 were, where 大音寺前 lay, what was sold at the 酉の市, in plain modern Japanese.

#3 · Keep the source's sesame marks

cjk.emphasisMark decides what *…* and :dots[…] print in this book: sesame dots, at the right of a vertical line. A ja document already uses them; written out, they turn on the kenten in the feature list. The Aozora text marks ぎつちよんちよん with 傍点, and aozora.py wrote it as :dots[ぎつちよんちよん]{style=sesame}; Chinese books put dots under the line instead (Marks, ruby and warichu).

#4 · Open on a spread

script.js · lines 52–71in full code
// 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

The chapter's first sentence cites four notes in its first three lines. Set under a title on page 1, they would leave room for three lines of text: the left-hand page holds its own notes and nobody else's. A title page alone on page 1 moves the chapter to page 2, a right-hand page, so the first spread holds the text and all its notes. The title page is a level-1 heading whose design fills the page, anchored to the trim so the title stands on the page's axis.

#5 · Put the hashira and folios down the fore-edge

script.js · lines 75–89in full code
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) } } }] };

The title runs down the outer margin of the left-hand pages, outside the notes, and the kanji folios at the foot of every page but the title page.

The whole recipe

Sandbox
// ═══ 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' },
};

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)

Variations

#Gather the notes at the chapter's end

Without placement, a vertical ja book sets its notes as 後注 (kōchū): after the chapter's text, under the same rule, numbered through the chapter. Here they fill the left half of page 4.

-  placement: 'spread', // 傍注; 'chapterEnd' sets 後注 after the chapter instead
-  numbering: 'spread',
+  placement: 'chapterEnd', // 後注, the default for a vertical ja book
+  numbering: 'chapter',

#Set the marker beside the word

markerPosition: 'side' sets a smaller marker in the gap beside the line, as interlinear ruby is set, so it takes no room in the line at all.

-  markerPosition: 'right', markerTemplate: '({n})', // written out: 'ja' sets them so
+  markerPosition: 'side', markerTemplate: '{n}',

Pitfalls

Pitfall

Tag a Japanese text 'ja', never zh-Hans or LANG

A recipe's editions are en and es, but a Japanese sample is Japanese in both: `locale: LANG` would tag it English or Spanish, and a Chinese tag would set it by the Chinese rules (Kaiming punctuation, small kana free to start a line, 图 for 図, Chinese glyph forms in the PDF). From postext 1.30 the tag is also the language the text is shaped in (measured, painted and embedded), so any tag but 'ja' gives other glyph forms than the Japanese ones (the Chinese ones under a Chinese tag) and other line breaks. Write 'ja': it picks the Japan region (JLReq line breaking and punctuation, sesame emphasis marks, furigana spacing, 図 and 表 labels) and turns hyphenation off. The lint fails a text with kana under a zh or ko tag. Japanese line breaking (kinsoku) →

Pitfall

Chinese faces load by slices, through the cjk block

Fontsource serves a Chinese, Japanese or Korean family as about a hundred files per weight, each covering a range of characters. loadFonts fetches only the latin file, so on screen the Han characters come from a system face and measure wrong, and fontsourceProvider hands the PDF that latin file, which prints them as empty boxes. List the cjk kit block, call loadCjkFonts(FONTS, markdown) after loadFonts (once per voice, with the text it sets, when the book uses several CJK faces) and give renderToPdf fontProvider: cjkPdfProvider: both take the files that hold the text's characters. Chinese, Japanese and Korean fonts →

Pitfall

A right-bound book shows its spreads with showBook

In a book bound on the right (Arabic, Hebrew or Persian text, vertical Chinese, or page.binding 'right') page 1 is still the recto, but it lies on the left of the spine, and the pairs read [3 | 2]. showPages lays every book out left-bound; showBook from the book block (the cjk block carries the same function) reads doc.binding and mirrors the pairs. capture.hero still names a spread in reading order, [verso, recto]: [2, 3]. Books bound on the right →

Credits

Text
  • 樋口一葉「たけくらべ」 (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 · public domain
Fonts
Shippori Mincho (SIL OFL 1.1) · Noto Sans JP (SIL OFL 1.1)
SandboxPDF