跳到主要内容
食谱编号121

排版食谱 · 第6章 · 框与注释

竖排日文的跨页旁注

一叶《たけくらべ》第一章带七条傍注:(1)标在行的右侧,一个跨页两页的注都排在左页的切口一侧。

本页内容
输出
Canvas · PDF
难度
中级
Postext
已用Postext 1.65.0测试
需要≥ 1.25.0 · postext-pdf ≥ 1.25.0
许可证
更新于2026年10月10日
代码MIT · 文本CC BY 4.0

页码二–三 · 第2–3页,共4页

  • 英文样例:尚无中文版本
  • 成品尺寸127 × 188 mm
  • 1栏
  • Shippori Mincho 9.3/16.3
  • Noto Sans JP
  • 4页
  • 难度
  • Postext 1.65.0
  • 排版用时68 ms
  • 126行代码

简单来说

一篇日本古典小说,附有对旧地名的简短解释。小号编号标在正文旁边,打开的两页上的解释都集中在左页的外侧边缘。

成品一览

四六判樋口一葉《たけくらべ》(1895–96)的四页,第一章,附七条注释,讲它所写的旧吉原一带。这些注释是傍注(bōchū),日本古典文库本的旁注:小号的(1)标在所释词语之后、行的右侧,一个跨页两页上引出的注释都排在左页的切口一侧,上面一条长为行长三分之一的线,字号小五分之一。读者不必翻页就能找到每一条注。正文每行42字、共17行,用9.25 pt的Shippori Mincho,保留一葉那一整个长段落和ぎつちよんちよん上的芝麻点。欧洲小说的栏脚注见Nº 071。

这道食谱解答

  • 日文书的注释怎样排:(1)放在章末、页脚,还是跨页排在正文旁边?
  • 脚注怎么做?
  • 日文不用斜体时,怎样加芝麻着重号或旁线?

简短回答

script.js · 第32–48行在完整代码中
// 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' },
};

用料

类型
Shippori Mincho, Noto Sans JP(SIL OFL 1.1)
素材
无:所有图片都用代码绘制

做法

#1 · 把跨页的注释集中在左页切口

代码见上文的简短回答。footnotes.placement: 'spread'把第2、3页上引出的注释排在第3页正文的末尾,在右侧装订的书中就是它的切口一侧;numbering: 'spread'让每个跨页的注释从(1)开始编号(脚注)。在右页引出的注释要等到左页才排;如果注释让左页剩下不到一行正文,其余的注释就留在右页的脚部,JLReq允许这样做。标为ja的文档已经把竖排书的注释编号排成({n}),放在行的右侧,0.7 em,数字直立:这里写出的两行只是展示这一点。numberGap: 'em'在编号后放一个注释字号的全角空格,hangingIndent: em(2)让转行与编号之后的文字对齐。

#2 · 把编号放在日文放它的位置

Markdown在所释词语之后写見返り柳[^1],把注释写成章末的[^1]: …段落。编号跟在所释词语之后;结束一句的编号放在。之前(…先生[^1]。),引擎不让。或编号出现在行首。七条注释是为本食谱写的,用平实的现代日文说明見返り柳和お齒ぐろ溝是什么,大音寺前在哪里,酉の市上卖什么。

#3 · 保留原文的芝麻点

cjk.emphasisMark决定本书中*…*和:dots[…]印出什么:芝麻点,位于竖排行的右侧。ja文档本来就用它;写出来之后,用料列表里会出现着重号这一项。青空文库的文本给ぎつちよんちよん加了傍点,aozora.py把它写成:dots[ぎつちよんちよん]{style=sesame};中文书则把点放在行的下方(着重号、注音与夹注)。

#4 · 从一个跨页开始

script.js · 第52–71行在完整代码中
// 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

本章的第一句在头三行里就引出四条注释。如果在第1页的标题下排正文,这些注释只给正文留下三行的地方:左页只放自己的注释,不放别页的。把书名页单独放在第1页,本章就移到第2页,一个右页,于是第一个跨页同时容纳正文和它的全部注释。书名页是一个一级标题,它的设计占满整页,锚定在成品页面上,所以书名立在页面的中轴上。

#5 · 柱和页码排在切口

script.js · 第75–89行在完整代码中
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书把注释排成后注(後注,kōchū):放在本章正文之后,上面是同样的线,全章连续编号。在这里它们占满第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断行和标点、芝麻着重号、振假名的分布、図和表标签),并关闭断词。lint会让带假名却标记为zh或ko的文本失败。 日文禁则处理 →

易错点

中文字体通过cjk块分片加载

Fontsource把一个中文、日文或韩文字体家族按每个字重约一百个文件提供,每个文件覆盖一段字符范围。loadFonts只获取latin文件,所以屏幕上的汉字来自系统字体,测量不准;fontsourceProvider交给PDF的也是这个latin文件,汉字印出来是空框。列出kit中的cjk块,在loadFonts之后调用loadCjkFonts(FONTS, markdown)(书中用到几种CJK字体时,每种字体调用一次,并传入它所排的文字),并给renderToPdf传fontProvider: cjkPdfProvider:两者都会取用包含文中字符的那些文件。 中日韩字体 →

易错点

右装订的书用showBook显示跨页

在右装订的书中(阿拉伯文、希伯来文或波斯文,竖排中文,或page.binding 'right'),第1页仍是奇数页(recto),但它位于书脊左侧,跨页读作[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)
沙盒PDF