Skip to main content
Recipe number 96

Cookbook · Chapter 5 · Book structure

A humanities essay with MLA works cited

A literary essay whose [@key, 48] citations become MLA 9 author-page references, with a block quotation and a Works Cited list built from BibTeX data.

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
  • Trim 150 × 230 mm
  • 1 column
  • Spectral 10.6/14.4
  • Spectral SC
  • 4 pages
  • Level
  • Postext 1.57.1
  • Laid out in 94 ms
  • 141 lines of code

In short

An essay on a poem by Keats, as a literary journal prints it. The author writes a short code for each source; Postext prints the author and page in brackets and the list of works cited at the end, in MLA style.

What you'll build

An essay from a literary quarterly: four pages on who speaks the last two lines of Keats's "Ode on a Grecian Urn". The page is a 150 × 230 mm journal page set in Spectral, with section heads and running heads in Spectral SC, and the opener sits in a band the colour of black glaze over a strip of red clay, the two colours of an Attic vase. The citations follow MLA 9, the style of most literature and art history departments: the author and the page in brackets, the page alone when the sentence names the author, a short title when two works share an author, and a Works Cited list on its own page. Every citation is a key in the text and the style is one setting.

This recipe answers

  • How do I cite works and build the bibliography in APA, IEEE or another citation style?

The short answer

script.js · lines 32–44in full code
// The text cites with [@keats-letters, 48] → (Keats, Letters 48): MLA prints the author
// and the page, and adds a short title when two works share an author. [-@eliot1932, 230]
// drops the name the sentence already gives → (230). The list is alphabetical, and a
// second work by the same author opens with a dash (MLA's ---) instead of the name.
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
const citations = {
  style: 'modern-language-association', // MLA 9th edition, author-page
  link: true, // a citation jumps to its entry in Works Cited
  bibliography: {
    // MLA's half-inch hanging indent, scaled to a 108 mm measure.
    fontSize: em(0.94), lineHeight: pt(13.4), hangingIndent: em(2.2), entrySpacing: pt(3),
  },
};

MLA 9 author-page citations and a Works Cited list

Ingredients

Type
Spectral, Spectral SC (SIL OFL 1.1)
Assets
None: every picture is drawn in code

Method

#1 · The style is MLA, the data are BibTeX

The code is the short answer above. The citation engine is registered once and citations.style names the bundled MLA style; citeproc-js writes each citation and the list from it. The references sit in a :::references{format=bibtex} block at the end of the essay, written as a reference manager exports them. MLA needs a short title for Keats's two works, and each entry's shorttitle field gives it (in CSL the field is title-short).

#2 · Four kinds of citation

The text cites a work with [@jack1967], which prints "(Jack)" because the essay refers to the book as a whole. With a page, [@keats-letters, 41] prints "(Keats, Letters 41)": two works by Keats are cited, so citeproc adds the short title to tell them apart. When the sentence already names the critic, [-@eliot1932, 230] leaves the name out and prints "(230)". A narrative citation with no page, @stillinger1974 records, prints the name alone, "Stillinger records", with one space after it: MLA has nothing to put in brackets. Once the ode has been cited with its line numbers, later quotations from it carry the numbers alone, typed in plain parentheses, as MLA allows.

#3 · A block quotation with its citation after the full stop

script.js · lines 48–52in full code
// More than four lines of prose go in a Markdown blockquote: in ink, indented, with no
// first-line indent. Its citation follows the final full stop, as MLA asks.
const blockquote = {
  color: col('ink'), italic: false, indent: em(2), firstLineIndent: em(0),
};

The letter on Negative Capability runs to more than four lines of prose, so it is set off as a Markdown blockquote: upright, in ink, indented 2 em with no first-line indent. MLA puts the citation of a block quotation after its final full stop, and the source does the same: …fact and reason. [@keats-letters, 48]. A :::space{lines=0.5} above and below separates the quotation from the paragraphs around it.

#4 · Works Cited on a page of its own

script.js · line 119in full code
  headingStyles: [{ id: 'works-cited', breakBefore: { enabled: true, parity: 'any' } }],

The heading takes a style that breaks to a new page, and :::bibliography{title=""} places the list under it without a second title. The list is alphabetical with a hanging indent, and the second work by Keats opens with a three-em dash in place of his name, as MLA asks for repeated authors. A drop folio prints at the foot of this page and of the opener, where the running heads stand down.

#5 · The opener in two colours of a vase

script.js · lines 56–81in full code
const BAND = 116; // mm from the trim's top
const opener = {
  enabled: true,
  minHeight: mm(BAND - MARGIN.top + 4), // the text starts a line under the band
  slot: { elements: [
    { kind: 'box', id: 'band', style: { backgroundColor: col('glaze') },
      placement: { ...at('page', 'top-left'), size: { width: 'fill', height: mm(BAND) } } },
    { kind: 'box', id: 'foot', style: { backgroundColor: col('clay') },
      placement: { ...at('page', 'top-left', 0, BAND - 3), size: { width: 'fill',
        height: mm(3) } } },
    { kind: 'text', id: 'kicker', content: '{attr.kicker}', fontFamily: LABEL, fontWeight: 600,
      fontSize: pt(9), letterSpacing: pt(1.6), color: col('slip'), align: 'left',
      placement: at('container', 'top-left', 0, 6) },
    { kind: 'text', id: 'title', content: '{titleText}', fontFamily: TEXT, fontWeight: 300,
      italic: true, fontSize: pt(56), lineHeight: 0.95, color: col('paper'), align: 'left',
      overflow: 'wrap', placement: { ...at('container', 'top-left', -1, 30),
        size: { width: mm(110), height: 'auto' } } },
    { kind: 'text', id: 'sub', content: '{attr.sub}', fontFamily: TEXT, fontWeight: 300,
      fontSize: pt(13), lineHeight: 1.25, color: col('paper'), align: 'left', overflow: 'wrap',
      placement: { ...at('container', 'top-left', 0, 66),
        size: { width: mm(96), height: 'auto' } } },
    { kind: 'text', id: 'byline', content: '{attr.byline}', fontFamily: LABEL, fontWeight: 600,
      fontSize: pt(9.5), letterSpacing: pt(1.2), color: col('slip'), align: 'left',
      placement: at('container', 'top-left', 0, 82) },
  ] },
};
script.js · lines 16–23in full code
const palette = {
  ink: '#1f1a17', glaze: '#231c19', clay: '#9a3d22', slip: '#e3a27e', rule: '#c9bdb0',
  muted: '#6b6159', paper: '#fffdf9',
};
// Every colour is linked to its palette entry by id.
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = Object.entries({ ...palette, 'main-color': palette.clay })
  .map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } }));

The band is 116 mm deep and holds the kicker, the title at 56 pt in Spectral Light italic, the subtitle and the byline, all fed from attributes of the heading. The clay strip is a second box anchored 3 mm above the foot of the band.

The whole recipe

Sandbox
// ═══ Postext Cookbook · Nº 096 · A humanities essay with MLA works cited ══════════
// https://postext.dev/en/cookbook/mla-humanities-essay
// Code: MIT · Text: original (CC BY 4.0) · Pictures: none
// Fonts: Spectral, Spectral SC (SIL OFL 1.1) · Needs postext ≥ 1.25.0
import {
  buildDocumentWithFonts, 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 = 'mla-humanities-essay';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: the black glaze and the red clay of an Attic vase
const palette = {
  ink: '#1f1a17', glaze: '#231c19', clay: '#9a3d22', slip: '#e3a27e', rule: '#c9bdb0',
  muted: '#6b6159', paper: '#fffdf9',
};
// Every colour is linked to its palette entry by id.
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = Object.entries({ ...palette, 'main-color': palette.clay })
  .map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } }));
// #endregion
const TEXT = 'Spectral', LABEL = 'Spectral SC';
const TRIM = { width: 150, height: 230 }; // a literary quarterly
const MARGIN = { top: 22, bottom: 22, inner: 19, outer: 21 };
const LEAD = 14.4; // pt
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });

// #region answer: MLA 9 author-page citations and a Works Cited list
// The text cites with [@keats-letters, 48] → (Keats, Letters 48): MLA prints the author
// and the page, and adds a short title when two works share an author. [-@eliot1932, 230]
// drops the name the sentence already gives → (230). The list is alphabetical, and a
// second work by the same author opens with a dash (MLA's ---) instead of the name.
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
const citations = {
  style: 'modern-language-association', // MLA 9th edition, author-page
  link: true, // a citation jumps to its entry in Works Cited
  bibliography: {
    // MLA's half-inch hanging indent, scaled to a 108 mm measure.
    fontSize: em(0.94), lineHeight: pt(13.4), hangingIndent: em(2.2), entrySpacing: pt(3),
  },
};
// #endregion

// #region quotation: a block quotation, set in and upright
// More than four lines of prose go in a Markdown blockquote: in ink, indented, with no

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

#Run the list on after the essay

A journal that sets Works Cited after the last paragraph, without a new page, drops the break from the heading style.

-  headingStyles: [{ id: 'works-cited', breakBefore: { enabled: true, parity: 'any' } }],
+  headingStyles: [{ id: 'works-cited', breakBefore: { enabled: false } }],

#Cite in Chicago author-date

The same essay in Chicago puts the year after the author, "(Brooks 1947, 165)", and the list follows suit.

-  style: 'modern-language-association', // MLA 9th edition, author-page
+  style: 'chicago-author-date',

Pitfalls

  • citeproc-js prints titles as the data give them. MLA uses title case for English titles, so write them that way in the references.

Credits

Text
Fonts
Spectral (SIL OFL 1.1) · Spectral SC (SIL OFL 1.1)
SandboxPDF