Skip to main content
Recipe number 97

Cookbook · Chapter 5 · Book structure

A reading list from a Zotero BibTeX export

A seminar reading list whose references are a Zotero BibTeX export pasted as is, cited in Chicago author-date, with nocite for works the text never cites.

On this page
  • Trim 210 × 280 mm
  • 2 columns, 7 mm gutter
  • Spectral 9.6/13.4
  • IBM Plex Sans Condensed
  • 2 pages
  • Level
  • Postext 1.65.0
  • Laid out in 547 ms
  • 121 lines of code

In short

A university seminar's reading list. The teacher pastes the file Zotero exports; Postext prints the citations and a list that also holds books the text does not mention.

What you'll build

The reading list of a six-week seminar on the history and sociology of science, set on a 210 × 280 mm page in two columns. A deep green field takes the top half of the first page, with the course title in Spectral Light at 50 pt; the text below is the convenor's guide to each week. The references are the seminar's Zotero collection, exported as BibTeX and pasted into the document without touching a line: Zotero's citation keys, its braces around capitals, its {\"o} accents, month = dec, the file, keywords and urldate fields. The text cites eight of the works. The other five, background reading the seminar does not discuss, reach the list through nocite.

This recipe answers

  • How do I use a BibTeX export from Zotero and list works the text never cites?
  • How do I cite works and build the bibliography in APA, IEEE or another citation style?

The short answer

script.js · lines 28–40in full code
// The works come from a :::references{format=bibtex} block: the Zotero export pasted as it
// is. The text cites some of them; `nocite` in the front matter adds the rest by key, and
// `nocite: "@*"` would add the whole export. citeproc-js writes both in the style named.
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
const citations = {
  style: 'chicago-author-date', // '(Gieryn 1983)', 'Shapin and Schaffer (1985)'
  link: true, // a citation jumps to its entry
  bibliography: {
    // includeUncited: true is the same as nocite: "@*", set from the design side.
    fontSize: em(0.94), lineHeight: pt(12.4), hangingIndent: mm(5), entrySpacing: pt(3.5),
    doi: 'link', // Zotero's doi field prints as https://doi.org/…; its url field is dropped
  },
};

Chicago author-date, and a list that holds more than the text cites

Ingredients

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

Method

#1 · Name the style once

The code is the short answer above. The citation engine is registered before the first build and the style is one setting: Chicago author-date writes "(Shapin 1984)" for [@shapin_pump_1984] and "Shapin and Schaffer (1985)" for @shapin_leviathan_1985 in a sentence. The keys are the ones Zotero built from the first author, the first significant word of the title and the year, so gieryn_boundary-work_1983 keeps its hyphen; Postext reads a hyphen or an underscore inside a key as part of it.

#2 · Paste the export as Zotero writes it

The last block of the document holds the export, one entry per work, tab-indented as Zotero writes it:

@article{gieryn_boundary-work_1983,
	title = {Boundary-{Work} and the {Demarcation} of {Science} from {Non}-{Science}: …},
	url = {https://www.jstor.org/stable/2095325},
	doi = {10.2307/2095325},
	urldate = {2026-08-21},
	journal = {American Sociological Review},
	author = {Gieryn, Thomas F.},
	month = dec,
	year = {1983},
	keywords = {demarcation, week 4},
	pages = {781--795},
	file = {JSTOR Full Text PDF:/Users/hps214/Zotero/storage/2HJ8M6PA/Gieryn - 1983 - ….pdf:application/pdf},
}

The reader drops the braces that protect capitals, composes {\"o} and {\'e} into ö and é, turns -- into an en dash and reads month = dec as a bare month name. urldate becomes the access date and language the item's language; file, keywords, abstract and shorttitle are read past, so nothing from your hard disk reaches the page.

#3 · Bring in the works the text does not cite

The front matter lists them by key:

---
title: "Science as a Social Practice"
nocite: "@fleck_genesis_1979, @merton_sociology_1973, @latour_science_1987, @rheinberger_toward_1997, @lopez_pinero_ciencia_1979"
---

The list holds every cited work plus these five, sorted together by author as Chicago asks; nothing marks an entry as uncited. nocite: "@*" lists the whole export, and bibliography.includeUncited: true does the same from the configuration, for a design that always prints the whole library.

#4 · A green field for the card

script.js · lines 44–68in full code
const BAND = 132; // mm from the trim's top to the band's foot
const onBand = { color: col('paper'), align: 'left', overflow: 'wrap' };
const opener = {
  enabled: true,
  minHeight: mm(BAND - TOP + 9), // the columns start 9 mm under the band
  slot: { elements: [
    { kind: 'box', id: 'band', style: { backgroundColor: col('accent') },
      placement: { anchor: { to: 'page', edge: 'top-left' },
        size: { width: 'fill', height: mm(BAND) } } },
    { kind: 'text', id: 'kicker', content: '{attr.kicker}', ...onBand, fontFamily: LABEL,
      fontSize: pt(8.5), fontWeight: 600, letterSpacing: pt(1.7), textTransform: 'uppercase',
      placement: { anchor: { to: 'container', edge: 'top-left' }, offset: { y: mm(14) } } },
    { kind: 'text', id: 'title', content: '{titleText}', ...onBand, fontFamily: TEXT,
      fontSize: pt(50), fontWeight: 300, lineHeight: 1.02,
      placement: { anchor: { to: '#kicker', edge: 'below' }, offset: { y: mm(7) },
        size: { width: mm(150), height: 'auto' } } },
    { kind: 'rule', id: 'rule', direction: 'horizontal', thickness: pt(1), color: col('tint'),
      placement: { anchor: { to: '#title', edge: 'below' }, offset: { y: mm(7) },
        size: { width: mm(18) } } },
    { kind: 'text', id: 'lead', content: '{attr.lead}', ...onBand, fontFamily: TEXT,
      italic: true, fontSize: pt(13), lineHeight: 1.3, color: col('tint'),
      placement: { anchor: { to: '#rule', edge: 'below' }, offset: { y: mm(6) },
        size: { width: mm(128), height: 'auto' } } },
  ] },
};

The band is a box anchored to the trim, 132 mm deep, and the two columns start 9 mm under it. The title, the rule and the standfirst are chained with below anchors, so a longer course title pushes the standfirst down instead of colliding with it.

script.js · lines 15–21in full code
const palette = {
  ink: '#1c211f', accent: '#2d5b48', tint: '#dfe9e2', rule: '#c3cdc6', muted: '#5c6862',
  paper: '#ffffff',
};
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' } }));

The whole recipe

Sandbox
// ═══ Postext Cookbook · Nº 097 · A reading list from a Zotero BibTeX export ═══════
// https://postext.dev/en/cookbook/zotero-bibtex-nocite
// Code: MIT · Text: original (CC BY 4.0) · Pictures: none
// Fonts: Spectral, IBM Plex Sans Condensed (SIL OFL 1.1) · Needs postext ≥ 1.65.0
import {
  buildDocumentWithFonts, renderPageToCanvas, registerCitationEngine,
} from 'https://esm.sh/postext';
import { createCiteprocEngine, STYLES, LOCALES } from 'https://esm.sh/postext-citeproc';

const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'zotero-bibtex-nocite';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: a department green, one tint, everything else in ink
const palette = {
  ink: '#1c211f', accent: '#2d5b48', tint: '#dfe9e2', rule: '#c3cdc6', muted: '#5c6862',
  paper: '#ffffff',
};
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, LABEL] = ['Spectral', 'IBM Plex Sans Condensed'];
const LEAD = 13.4; // pt
const [TOP, OUTER] = [24, 18]; // mm

// #region answer: Chicago author-date, and a list that holds more than the text cites
// The works come from a :::references{format=bibtex} block: the Zotero export pasted as it
// is. The text cites some of them; `nocite` in the front matter adds the rest by key, and
// `nocite: "@*"` would add the whole export. citeproc-js writes both in the style named.
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
const citations = {
  style: 'chicago-author-date', // '(Gieryn 1983)', 'Shapin and Schaffer (1985)'
  link: true, // a citation jumps to its entry
  bibliography: {
    // includeUncited: true is the same as nocite: "@*", set from the design side.
    fontSize: em(0.94), lineHeight: pt(12.4), hangingIndent: mm(5), entrySpacing: pt(3.5),
    doi: 'link', // Zotero's doi field prints as https://doi.org/…; its url field is dropped
  },
};
// #endregion

// #region opener: a green field over the top half, the course in white on it
const BAND = 132; // mm from the trim's top to the band's foot
const onBand = { color: col('paper'), align: 'left', overflow: 'wrap' };
const opener = {
  enabled: true,
  minHeight: mm(BAND - TOP + 9), // the columns start 9 mm under the band

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

#List the whole Zotero collection

When the export is the list, skip the keys: every entry in the block prints, cited or not.

-nocite: "@fleck_genesis_1979, @merton_sociology_1973, @latour_science_1987, …"
+nocite: "@*"

#Change the style

The same keys give a Harvard list (Cite Them Right) with no other change.

-  style: 'chicago-author-date', // '(Gieryn 1983)', 'Shapin and Schaffer (1985)'
+  style: 'harvard-cite-them-right',

Pitfalls

Pitfall

A nocite key that matches nothing is dropped silently

A cited key with no reference raises unknownCitationKey, but a key in nocite that matches no entry is skipped without a warning. Copy the keys from the export and count the entries in the list. Bibliography from the references →

  • A key in nocite that matches no entry is dropped without a warning. Copy the keys from the export rather than typing them, and count the entries on the page.
  • Zotero builds the keys from the data: correct an author's name or a title in Zotero and the next export may change the key, which breaks every citation of it. Pin the keys before the text is written: Zotero reads a line Citation Key: … in an item's Extra field.
  • Zotero exports UTF-8 by default, with the accents as they are. The block here was exported with the Western encoding option, which writes {\"o}; Postext reads both.
  • Chicago's 18th edition leaves out the place of publication, so the address field does not print, and an article with a DOI prints the DOI and not the JSTOR url.

Credits

Text
Original prose, CC BY 4.0
Fonts
Spectral (SIL OFL 1.1) · IBM Plex Sans Condensed (SIL OFL 1.1)
Sandbox