简单来说
一份阿拉伯文学术期刊的五页:论文、脚注、参考文献和索引。索引像阿拉伯文索引那样把الكشيدة排在ك下,而不是冠词ال下。
成品一览
一份虚构阿拉伯文期刊某一期中的五页,开本17 × 24 cm,从第87页开始:一篇研究卡希达两端对齐是否会减慢阅读的论文,正文用12 pt的Amiri,小节标题用Noto Kufi Arabic。脚注排在每页底部,按阿拉伯期刊的习惯每页从«(١)»重新编号;在Markdown里写作[@ayalon2016]的引文也是脚注,用芝加哥注释体和阿拉伯语CSL区域设置排出。后面是参考文献,阿拉伯文著作在前,最后是两栏索引。索引把الكشيدة排在ك下,把الصحف اليومية排在ص下:冠词ال不计入排序。采用芝加哥注释的历史论文用英文做了同样的事。
这道食谱解答
- 阿拉伯文索引怎样在排序时忽略冠词ال?
- 阿拉伯文文章怎样用脚注和参考文献引用来源?
简短回答
// Citations are written [@ayalon2016, 45] in the text; a note style puts each one in a
// footnote, numbered with the author's own [^notes]. The CSL locale is Arabic: ص for a page.
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
const citations = {
style: 'chicago-notes-bibliography', notes: 'footnote', locale: 'ar',
bibliography: { fontSize: em(0.9), lineHeight: pt(17), hangingIndent: em(2),
entrySpacing: pt(2) },
};
const footnotes = {
markerTemplate: '({n})', // «(١)», in the document's digits
numbering: 'page', // from (١) again on every page, as Arabic journals number them
noteNumberPosition: 'inline', // the note opens with (١) on the line, not raised
fontSize: pt(10), lineHeight: pt(18), spaceBetween: pt(2), // 1.8 ×: tanwīn clears the line
textAlign: 'start', // ragged from the right: a Latin title would open wide gaps
separator: { width: 0.3, lineWidth: pt(0.5), color: col('red') }, // on the start side
};
// The index sorts by the word after the article: الكشيدة files under ك, not under ا.
// ignoreArticle is already true for an Arabic index; it is written out to be seen.
const index = {
ignoreArticle: true,
fontFamily: TEXT, fontSize: pt(10.5), lineHeight: pt(16), indent: em(1.2),
main: { bold: true }, // the page that defines the term
groups: { fontFamily: LABEL, fontSize: pt(10), fontWeight: 700, color: col('red') },
};
用料
做法
#1 · 脚注、引文和索引在一处设置
代码见上文的简短回答。脚注设置是阿拉伯文图书需要的三项:markerTemplate: '({n})'加圆括号,numbering: 'page'每页重新编号,noteNumberPosition: 'inline'让脚注以行内的«(١)»开头;数字采用文档的数字系统,分隔线在右侧(脚注)。引文与脚注共用编号。citations.locale: 'ar'给出阿拉伯语的CSL术语,比如期号用عدد。index.ignoreArticle按ال后面的词给条目排序,并合并哈姆宰的各种写法,所以أميري和الأعمدة都排在ا下(目录与索引);阿拉伯文索引默认就打开它,这里写出来是为了让人看到。

#2 · 没有色带的论文刊头
const centred = (y, extra = {}) => ({ anchor: { to: 'container', edge: 'top' },
offset: { y: mm(y) }, size: { width: 'fill' }, ...extra });
const line = (id, content, family, size, colour, y, extra = {}) => ({ kind: 'text', id,
content, fontFamily: family, fontSize: pt(size), color: col(colour), align: 'center',
overflow: 'wrap', placement: centred(y), ...extra });
const masthead = { enabled: true, minHeight: mm(70), slot: { elements: [
line('journal', JOURNAL, LABEL, 9, 'red', 0, { fontWeight: 700 }),
line('issue', '{attr.issue}', LABEL, 8, 'muted', 6),
{ kind: 'rule', id: 'rule', thickness: pt(0.5), color: col('rule'),
placement: centred(13) },
line('title', '{titleText}', TEXT, 22, 'ink', 18, { fontWeight: 700, lineHeight: 1.45 }),
line('author', '{attr.author}', TEXT, 13, 'ink', 45),
line('affiliation', '{attr.affiliation}', TEXT, 10, 'muted', 52),
] } };
论文标题是一级标题,由一个设计绘制:期刊名和期号、一条细线、两行居中的标题和作者。期号那一行用阿拉伯-印度数字输入,因为设计的属性是作者的文字,引擎不会改写。页码从87开始(page.pageNumbering.startAt),页码显示论文在这一期中的位置。
#3 · 从外侧角排起的书眉
const head = (id, content, parity, edge, x) => ({ kind: 'text', id, content, parity,
pages: 'body', fontFamily: LABEL, fontSize: pt(7.5), color: col('muted'), align: edge,
placement: { anchor: { to: 'page', edge: `top-${edge}` }, offset: { x: mm(x), y: mm(13) } } });
const folio = (id, parity, edge, x) => ({ ...head(id, '{pageNumber}', parity, edge, x),
fontWeight: 700, color: col('red') });
const header = { elements: [
folio('r-folio', 'even', 'right', -SIDE.outer),
head('r-head', JOURNAL, 'even', 'right', -(SIDE.outer + 9)),
head('l-head', SHORT_TITLE, 'odd', 'left', SIDE.outer + 9),
folio('l-folio', 'odd', 'left', SIDE.outer),
] };
右页书眉是期刊名,左页是作者和简短标题,页码都在外侧角。页眉元素保持物理位置,所以在这种装订方式下位于右边的偶数页锚定在top-right。
完整食谱
// ═══ Postext Cookbook · Nº 107 · An Arabic research article with notes, citations and an index ═══
// https://postext.dev/en/cookbook/arabic-research-article
// Code: MIT · Text: original Arabic prose (CC BY 4.0) · Pictures: none
// Fonts: Amiri, Noto Kufi Arabic (SIL OFL 1.1) · Needs postext ≥ 1.65.0
import {
buildDocument, withLoadedFonts, renderPageToCanvas, registerCitationEngine,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';
import { createCiteprocEngine, STYLES, LOCALES } from 'https://esm.sh/postext-citeproc';
const LANG = 'en'; // @lang: the language of the frame; the article is Arabic in both editions
const RECIPE = 'arabic-research-article';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: a journal's dark red on a warm white
const palette = {
ink: '#1d1a19', // text
red: '#7d2028', // the accent: the journal's name, section numbers, the notes' rule
rose: '#f1e4e1', // the abstract's ground
rule: '#c8bcb5', // hairlines
muted: '#655d58', // running heads, the colophon
paper: '#fffdfa',
};
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = Object.entries({ ...palette, 'main-color': palette.red })
.map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } }));
// #endregion
const [TEXT, LABEL] = ['Amiri', 'Noto Kufi Arabic'];
const [BODY, LEAD] = [12, 20]; // pt: Amiri, partly vocalised, at 1.67 × the size
const TRIM = { width: 170, height: 240 }; // mm: 17 × 24 cm, the Arab journal
const SIDE = { inner: 22, outer: 18 }; // mm
const JOURNAL = 'مجلة دراسات الكتاب والنشر';
const SHORT_TITLE = 'سلمى الخطيب: أثر الكشيدة في سرعة القراءة'; // the recto's running head
// #region answer: notes «(١)» per page, the citations among them, an index without ال
// Citations are written [@ayalon2016, 45] in the text; a note style puts each one in a
// footnote, numbered with the author's own [^notes]. The CSL locale is Arabic: ص for a page.
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
const citations = {
style: 'chicago-notes-bibliography', notes: 'footnote', locale: 'ar',
bibliography: { fontSize: em(0.9), lineHeight: pt(17), hangingIndent: em(2),
entrySpacing: pt(2) },
};
const footnotes = {
markerTemplate: '({n})', // «(١)», in the document's digits
numbering: 'page', // from (١) again on every page, as Arabic journals number them
noteNumberPosition: 'inline', // the note opens with (١) on the line, not raised
fontSize: pt(10), lineHeight: pt(18), spaceBetween: pt(2), // 1.8 ×: tanwīn clears the line
组合好的script.js可以直接运行:把它粘贴到任何页面的模块脚本中,或在CodePen上打开这道食谱。 GitHub上的食谱文件夹 ↗ (在新标签页中打开)
变化
常见问题
易错点
阿拉伯文书标记为'ar',不要用LANG
食谱的版本是en和es,但阿拉伯文示例在两个版本里都是阿拉伯文:`locale: LANG`会让它从左向右排、左装订、页码印成1 2 3,并把图标注为Figure或Figura。postext 1.30起,这个标记也是文字成形所用的语言(测量、绘制和嵌入都按它进行),所以标记成英文或西班牙文时,Markazi Text这样的字体不画尖角引号(« »)和句点的阿拉伯文字形,断行的位置也随之改变。自己写出标记:'ar'(阿拉伯-印度数字,马什里克惯例),或带地区的'ar-EG'、'ar-SA';马格里布版本用欧洲数字,写'ar-MA'、'ar-DZ'或'ar-TN'。只引用阿拉伯文的拉丁文页面保留自己的locale。 从右向左的文字 →
易错点
阿拉伯文字体需要通过arabic块加载其arabic文件
Fontsource把Amiri、Noto Naskh Arabic或Scheherazade New按子集分成多个文件提供,阿拉伯字母在arabic文件里。loadFonts只获取latin(以及latin-ext),所以屏幕上的阿拉伯文来自系统字体,测量不准;fontsourceProvider交给PDF的也是这个latin文件,印出来是空框。列出kit中的arabic块,在loadFonts之后调用loadArabicFonts(FONTS, markdown),并在FONTS中列出页面用于阿拉伯文的每个字重,再给renderToPdf传fontProvider: arabicPdfProvider。 阿拉伯文字体 →
易错点
标题样式会继承其级别的分页设置
headingStyles中的条目没有写出的字段都取自它所属的标题级别,breakBefore也不例外。在:::pagebreak之后以H1设置样式的目录页或版权页会继承parity 'odd',结果落在一张空白页之后。给这类样式设置breakBefore: { enabled: false }。 标题样式 →
- CSL样式写出的标点属于样式本身:脚注各部分之间的逗号、分号和引号是拉丁标点,如الهاشمي, الحرف العربي。日期和数字来自数据,所以阿拉伯文著作写
issued: {literal: "٢٠١٩"},定位词写成[@hashimi2019, ٧٧];拉丁文著作保留0–9。 - 引用拉丁文著作的脚注或参考文献条目仍是阿拉伯文页面的段落,从右起排,内部从左往右读:引擎把这条文献排成隔离段,网址、引号和句号都留在它结束的地方。
致谢
- 文本
- A research article written in Arabic for the recipe; its journal, author, experiment and Arabic sources are invented · Postext Cookbook · 原创
- 字体
- Amiri (SIL OFL 1.1) · Noto Kufi Arabic (SIL OFL 1.1)


