Skip to main content
Recipe number 98

Cookbook · Chapter 5 · Book structure

An edited volume with a bibliography per chapter

Three essays by three contributors, each a document of its own in buildBundle, each closing on a Chicago author-date list of only the works it cites.

On this page
Output
Canvas · PDF
Postext
Tested with Postext 1.65.0
Needs ≥ 1.28.0 · postext-pdf ≥ 1.28.0
Licence
Updated 11 Oct 2026
Code MIT · Text CC BY 4.0
  • Trim 155 × 235 mm
  • 1 column
  • Libre Caslon Text 9.6/13.8
  • IBM Plex Sans Condensed
  • Libre Caslon Display
  • 10 pages
  • Level
  • Postext 1.57.1
  • Laid out in 545 ms
  • 187 lines of code

In short

A book of essays by different authors. Each essay shows its author under the title and ends with its own list of references, as collected volumes do.

What you'll build

The Working Page, a small collection of essays on the history of printing, edited by two scholars and written by three. Each essay arrives from its contributor as a Markdown file with a BibTeX block of its own, and that is how the book keeps it: a 155 × 235 mm volume in Libre Caslon, a red title page, and chapters that open with a number, a title and the contributor's name. Each chapter closes on its own References list in Chicago author-date, holding only the works that essay cites. Eisenstein's Printing Press as an Agent of Change is cited by two contributors and so appears in both of their lists; Gaskell's New Introduction to Bibliography does the same in chapters 1 and 3.

This recipe answers

  • How do I give each chapter of an edited volume its own author and its own bibliography?
  • How do I cite works and build the bibliography in APA, IEEE or another citation style?

The short answer

script.js · lines 39–55in full code
// Citations are [@key] in the text; each contributor's BibTeX goes in a :::references block
// in their own chapter. Register the engine once, before the first build.
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
const citations = {
  style: 'chicago-author-date', // the humanities' author-date: (Eisenstein 1979)
  bibliography: {
    // 'chapter': a :::bibliography lists the works its own document cites, so a work two
    // contributors cite appears in both lists. 'book' (the default) would print one list,
    // after the last chapter. The scope is per document, not per H1: each essay must be a
    // document of its own in buildBundle (see the chapters region).
    scope: 'chapter',
    title: '', // no bold title paragraph: each chapter has its own ## References heading
    fontSize: em(0.9), lineHeight: pt(12.4), hangingIndent: mm(5), entrySpacing: pt(2.6),
  },
};
// Numbering and disambiguation still see the whole book: two Smiths of 2001 in different
// chapters would print 2001a and 2001b, as one bibliography would.

One list per chapter: scope 'chapter' over a book of separate documents

Ingredients

Type
Libre Caslon Text, Libre Caslon Display, IBM Plex Sans Condensed (SIL OFL 1.1)
Assets
None: every picture is drawn in code

Method

#1 · One document per contributor

script.js · lines 337–340in full code
// A chapter's :::bibliography lists what that document cites; one Markdown file holding all
// three essays would make every list repeat the works of the chapters before it.
const chapters = [front, lowe, okafor, ferrer].map((markdown) => ({ markdown }));
const book = () => buildBundle({ chapters, config: config(), resources: [] });

The scope in the short answer is the scope of a document. buildBundle lays the four documents out as one book, so page numbers, chapter numbers and the contents run straight through, while each :::bibliography collects the citations of its own file. The references stay where the contributor wrote them: a key defined in any chapter counts for the whole book, so one shared entry would have been enough, but self-contained chapters can be swapped or reordered without breaking another essay's list.

#2 · The byline is a heading attribute

script.js · lines 59–65in full code
// # The Compositor's Day {author="Margaret Lowe" short="The Compositor's Day"}
const byline = text('byline', '{attr.author}', { fontFamily: TEXT, italic: true,
  fontSize: pt(12), color: col('ink'), align: 'left' }, below('title', 4));
const versoAuthor = head('verso-author', '{attr.author}', 'even',
  at('page', 'top-left', MARGIN.outer + 8, 13)); // in the running head
const tocAuthor = { enabled: true, attr: 'author', fontFamily: TEXT, fontSize: pt(9.5),
  color: col('muted') }; // a line under each title in the contents (italic by default)

Each essay's title carries author="…" and a short="…" title for the running head. The opener prints the author under the title, the verso running head names the author of the essay the page belongs to, and the contents print the name as a line under each entry. Nothing in the book's front matter lists the contributors twice.

#3 · The opener

script.js · lines 69–81in full code
// Nine lines of reserve and a line of margin under them (the level's marginBottom): ten
// lines, 48 mm, under a one-line title. A two-line title reaches past the reserve, and the
// margin then carries the text a line lower, clear of the rule.
const opener = { enabled: true, minHeight: pt(LEAD * 9), slot: { elements: [
  text('kicker', t({ en: 'Chapter {number}', es: 'Capítulo {number}' }), { ...label,
    fontSize: pt(8.5), letterSpacing: pt(1.7), color: col('accent') },
  at('container', 'top-left', 0, 4)),
  text('title', '{titleText}', { fontFamily: DISPLAY, fontSize: pt(28), lineHeight: 1.08,
    color: col('ink'), align: 'left', overflow: 'wrap' }, below('kicker', 3, { width: 'fill' })),
  byline,
  { kind: 'rule', id: 'rule', direction: 'horizontal', thickness: pt(1.2), color: col('accent'),
    placement: { ...below('byline', 6), size: { width: mm(16) } } },
] } };

Kicker, title and byline stack from the top of the text area, each anchored below the one before, so a two-line title such as chapter 3's pushes the byline and the rule down with it. The reserve sinks the text 48 mm, ten lines, under a one-line title; a two-line title takes one line more, so the rule stays clear of the text and chapter 3 starts a line lower than the other two.

#4 · Running heads for a book with many authors

script.js · lines 85–99in full code
function head(id, content, parity, placement, look = {}) { // hoisted: the byline uses it
  return { ...text(id, content, { ...label, fontWeight: 500, fontSize: pt(7.5),
    letterSpacing: pt(1.1), color: col('muted'), ...look }, placement), parity, pages: 'body' };
}
const folio = { fontWeight: 600, color: col('ink') };
const header = { elements: [
  head('verso-folio', '{pageNumber}', 'even', at('page', 'top-left', MARGIN.outer, 13), folio),
  versoAuthor,
  head('recto-title', '{attr.short}', 'odd', at('page', 'top-right', -(MARGIN.outer + 8), 13),
    { align: 'right' }),
  head('recto-folio', '{pageNumber}', 'odd', at('page', 'top-right', -MARGIN.outer, 13),
    { ...folio, align: 'right' }),
] };
const footer = { elements: [{ ...head('drop-folio', '{pageNumber}', 'all',
  at('container', 'top', 0, 9), { ...folio, align: 'center' }), pages: 'opener' }] };

An edited volume names the contributor on the verso and the chapter on the recto, where a monograph would print the book's title and the chapter. The heads are filtered to pages: 'body', so the openers carry only a drop folio.

#5 · The front matter

script.js · lines 103–133in full code
const bare = { numbered: false, toc: false, header: { elements: [] }, footer: { elements: [] } };
const cover = { enabled: true, slot: { elements: [
  { kind: 'box', id: 'field', style: { backgroundColor: col('accent') },
    placement: { ...at('bleed', 'top-left'), size: { width: 'fill', height: mm(150) } } },
  text('title', '{titleText}', { fontFamily: DISPLAY, fontSize: pt(58), lineHeight: 1,
    color: col('paper'), align: 'left', overflow: 'wrap' },
  { ...at('page', 'top-left', MARGIN.inner, 64), size: { width: mm(118) } }),
  text('subtitle', '{subtitle}', { fontFamily: TEXT, italic: true, fontSize: pt(15),
    color: col('paper'), align: 'left' }, below('title', 5)),
  text('editors', '{attr.editors}', { ...label, fontSize: pt(9), letterSpacing: pt(1.8),
    color: col('accent') }, at('page', 'top-left', MARGIN.inner, 162)),
  text('contributors', '{attr.contributors}', { fontFamily: TEXT, italic: true, fontSize: pt(12),
    color: col('ink'), align: 'left' }, below('editors', 3)),
  text('imprint', '{attr.imprint}', { ...label, fontWeight: 500, fontSize: pt(7.5),
    letterSpacing: pt(1.5), color: col('muted') }, at('page', 'bottom-left', MARGIN.inner, -16)),
] } };
const contentsOpener = { enabled: true, minHeight: mm(40), slot: { elements: [
  text('kicker', '{title}', { ...label, fontSize: pt(8.5), letterSpacing: pt(1.7),
    color: col('accent') }, at('container', 'top-left', 0, 4)),
  text('title', '{titleText}', { fontFamily: DISPLAY, fontSize: pt(28), color: col('ink'),
    align: 'left' }, below('kicker', 3)),
] } };
const contents = {
  levels: [{ level: 1, fontFamily: TEXT, fontSize: pt(12.5), lineHeight: pt(LEAD),
    numberFontFamily: LABEL, numberFontSize: pt(10), numberFontWeight: 600,
    numberColor: col('accent'), numberWidth: mm(6), numberGap: mm(3), marginBottom: pt(LEAD) }],
  pageNumber: { fontFamily: LABEL, fontSize: pt(9), fontWeight: 600, color: col('ink'),
    width: mm(7) },
  leader: { char: '. ', gap: mm(2) },
  subtitle: tocAuthor,
};

The title page and the contents are two unnumbered headings in the first document, with no running heads and no entry in the contents. Their designs read {title} and {subtitle} from the front matter and the editors and contributors from the heading's own attributes.

The whole recipe

Sandbox
// ═══ Postext Cookbook · Nº 098 · An edited volume with a bibliography per chapter ═════
// https://postext.dev/en/cookbook/edited-volume-chapter-bibliographies
// Code: MIT · Text: original (CC BY 4.0) · Pictures: none
// Fonts: Libre Caslon Text & Display, IBM Plex Sans Condensed (OFL 1.1) · Needs postext ≥ 1.28.0
// Three essays by three contributors, each a Markdown document of its own with its own
// BibTeX block, laid out by buildBundle as one volume: every chapter closes on its own list.
import {
  buildBundle, prepareFonts, 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 sample document ('en' | 'es')
const RECIPE = 'edited-volume-chapter-bibliographies';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: printer's red on a warm paper, the rest in ink
const palette = {
  ink: '#211c19', // text: a warm near-black
  accent: '#8e2b1f', // printer's red: the cover field, kickers, the references heading
  rule: '#cdbfb2', // hairlines
  muted: '#6b5f57', // running heads, the contents' contributors, the colophon
  paper: '#fcfaf6', // the page, and the type on the red field
};
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = Object.entries({ ...palette, 'main-color': palette.accent })
  .map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } }));
// #endregion
const TEXT = 'Libre Caslon Text', DISPLAY = 'Libre Caslon Display';
const LABEL = 'IBM Plex Sans Condensed';
const MARGIN = { top: 23, bottom: 22, inner: 20, outer: 18 }; // mm, mirrored
const LEAD = 13.8; // body leading in pt: the baseline grid
const label = { fontFamily: LABEL, fontWeight: 600, textTransform: 'uppercase', align: 'left' };
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });
const below = (id, y, size) => ({ ...at(`#${id}`, 'below', 0, y), ...(size && { size }) });
const text = (id, content, look, placement) => ({ kind: 'text', id, content, ...look, placement });

// #region answer: one list per chapter: scope 'chapter' over a book of separate documents
// Citations are [@key] in the text; each contributor's BibTeX goes in a :::references block
// in their own chapter. Register the engine once, before the first build.
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
const citations = {
  style: 'chicago-author-date', // the humanities' author-date: (Eisenstein 1979)
  bibliography: {
    // 'chapter': a :::bibliography lists the works its own document cites, so a work two
    // contributors cite appears in both lists. 'book' (the default) would print one list,
    // after the last chapter. The scope is per document, not per H1: each essay must be a
    // document of its own in buildBundle (see the chapters region).

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

#One list for the whole volume

Some publishers gather every work into a single bibliography at the back. Change the scope and drop the three ## References headings; the list then follows the last chapter.

-    scope: 'chapter',
-    title: '', // no bold title paragraph: each chapter has its own ## References heading
+    scope: 'book',
+    title: 'Bibliography',

#Cite in APA instead

A volume in the social sciences changes the style and nothing else.

-  style: 'chicago-author-date', // the humanities' author-date: (Eisenstein 1979)
+  style: 'apa',

Pitfalls

Pitfall

A key defined twice keeps its first entry, silently

References count for the whole book: a key written in two chapters keeps the first definition and the second is ignored with no warning. In a book by several authors, prefix each contributor's keys. Bibliography from the references →

Pitfall

Attribute values: no { or }; single-quote a value with "

An attribute value ends at the closing brace, so it cannot hold { or }. A value that contains a double quote goes in single quotes; a dollar sign is fine. Heading attributes →

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 →

  • scope: 'chapter' lists what the document cites before the :::bibliography, not what its H1 section cites. With every essay in one Markdown file, the second list repeats the works of the first essay and the third repeats both.
  • The first definition of a key wins across the book. If two contributors both use smith2001 for different works, the later essay silently cites the earlier contributor's book: give each contributor's keys a prefix, or check the lists against the manuscripts.
  • Disambiguation is worked out for the whole book. Two different works by Smith from 2001 in different chapters can print as 2001a and 2001b, even when a chapter's own list holds only one of them.
  • A subhead that opens a page drops its whole space above by default, and the grid snap then puts the part of a line it needs under it: Whose letters, at the head of page 10, would stand further from its text than What the reader sees lower on the page. headings.columnHeadSpace: 'remainder' keeps that part of a line above the subhead (headings). It suits a book in one column, where no column beside it shows that the subhead starts a little lower.

Credits

Text
Original prose, CC BY 4.0
Fonts
Libre Caslon Text (SIL OFL 1.1) · Libre Caslon Display (SIL OFL 1.1) · IBM Plex Sans Condensed (SIL OFL 1.1)
SandboxPDF