In short
Five pages of an Arabic academic journal: the article, its footnotes, its list of references and an index. The index files الكشيدة under ك, as Arabic indexes do, not under the article ال.
What you'll build
Five pages from an issue of an imaginary Arabic journal, on 17 × 24 cm, starting at page 87: an article on whether kashida justification slows readers down, set in Amiri at 12 pt with section heads in Noto Kufi Arabic. Its notes sit at the foot of each page and are numbered «(١)», «(٢)» from one on every page, as Arabic journals number them; the citations, written as [@ayalon2016] in the Markdown, are notes too, formatted by the Chicago note style with the Arabic CSL locale. A list of references follows, Arabic works first, and a two-column index closes the piece. The index files الكشيدة under ك and الصحف اليومية under ص: the article ال does not count. The history essay with Chicago notes does the same in English.
This recipe answers
- How do I sort an Arabic index without the article ال?
- How do I cite sources in an Arabic article, with footnotes and a bibliography?
The short answer
// 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') },
};
Notes «(١)» per page, the citations among them, an index without ال
Ingredients
- Features
- Arabic as the document languageIndex sorted without the articleCitations in notesFootnotesCitations in a citation styleBibliography from the referencesBack-of-book indexRight-to-left textArabic fontsDigits of the generated numbersNumbered headingsHeading stylesDesigned openersRunning heads and foliosCallout boxesPDF export
- Also uses
- Paragraphs in the other directionColumn balancingHeading attributesPaper colourHeads by page roleParagraph stylesFonts embedded in the PDFBooks bound on the rightRoman front matterSection geometryUnnumbered chapters
- Type
- Amiri, Noto Kufi Arabic (SIL OFL 1.1)
- Assets
- None: every picture is drawn in code
Method
#1 · Notes, citations and the index in one place
The code is the short answer above. The footnote settings are the three that Arabic books want: markerTemplate: '({n})' for the parentheses, numbering: 'page' to start again on every page, and noteNumberPosition: 'inline' so the note opens with «(١)» on its line; the digits are the document's, and the rule stands on the right (Footnotes). The citations share the notes' numbering. citations.locale: 'ar' gives the CSL terms in Arabic, such as عدد for an issue number. index.ignoreArticle sorts each entry by the word after ال and folds the hamza forms, so أميري and الأعمدة both go under ا (Contents and index); it is on by default for an Arabic index and is written out here to be seen.

#2 · A masthead without a band
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),
] } };
The article's title is the first-level heading, drawn by a design: the journal's name and issue, a hairline, the title in two centred lines and the author. The issue line is typed in Arabic-Indic digits, because a design's attribute is the author's text and the engine does not rewrite it. The page numbering starts at 87 (page.pageNumbering.startAt), so the folios show where the article sits in the issue.
#3 · Running heads from the outer corner
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),
] };
The right-hand pages carry the journal's name and the left-hand ones the author and a short title, each with its folio at the outer corner. Header elements keep their physical sides, so the even page, which is on the right in this binding, anchors to top-right.
The whole recipe
// ═══ 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
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
#Number the notes through the article
Modern Arabic journals often number notes per article instead of per page.
- numbering: 'page', // from (١) again on every page, as Arabic journals number them
+ numbering: 'chapter',#Cite in author and date
- style: 'chicago-notes-bibliography', notes: 'footnote', locale: 'ar',
+ style: 'apa', locale: 'ar',Pitfalls
Pitfall
Tag an Arabic book 'ar', not with LANG
A recipe's editions are en and es, but an Arabic sample is Arabic in both: `locale: LANG` would set it left to right, bind it on the left, number its pages 1 2 3 and caption its figures Figure or Figura. From postext 1.30 the tag is also the language the text is shaped in (measured, painted and embedded), so under an English or Spanish tag a face such as Markazi Text does not draw the Arabic forms of its guillemets and stops, and the lines break elsewhere. Write the tag yourself: 'ar' (Arabic-Indic digits, the Mashriq convention), a region such as 'ar-EG' or 'ar-SA', or 'ar-MA', 'ar-DZ' or 'ar-TN' for a Maghreb edition with European digits. A Latin page that only quotes Arabic keeps its own locale. Right-to-left text →
Pitfall
Arabic faces need their arabic file, through the arabic block
Fontsource serves Amiri, Noto Naskh Arabic or Scheherazade New as one file per subset, and the Arabic letters are in the arabic file. loadFonts fetches only latin (and latin-ext), so on screen the Arabic comes from a system face and measures wrong, and fontsourceProvider hands the PDF that latin file, which prints empty boxes. List the arabic kit block, call loadArabicFonts(FONTS, markdown) after loadFonts, with every weight the pages set in Arabic listed in FONTS, and give renderToPdf fontProvider: arabicPdfProvider. Arabic fonts →
Pitfall
A heading style inherits its level's page break
A headingStyles entry takes every field it leaves out from its heading level, breakBefore included. A contents page or a colophon styled on an H1 after a :::pagebreak inherits parity 'odd' and lands behind a blank page. Give such a style breakBefore: { enabled: false }. Heading styles →
- The punctuation a CSL style writes is the style's: commas, semicolons and quotation marks between the parts of a note are Latin, as in الهاشمي, الحرف العربي. Dates and numbers come from the data, so the Arabic works carry
issued: {literal: "٢٠١٩"}and locators such as[@hashimi2019, ٧٧]; the Latin works keep 0–9. - A note or a reference to a Latin work stays a paragraph of the Arabic page, set from the right, and reads from left to right inside it: the engine sets the reference as an isolate, so its URL, its quotation marks and its full stop stay where it ends.
Credits
- Recipe
- Ignacio Ferro
- Text
- A research article written in Arabic for the recipe; its journal, author, experiment and Arabic sources are invented · Postext Cookbook · original
- Fonts
- Amiri (SIL OFL 1.1) · Noto Kufi Arabic (SIL OFL 1.1)
Edit this write-up ↗ (opens in a new tab)Recipe folder on GitHub ↗ (opens in a new tab)


