Vai al contenuto principale
Ricetta numero 87

Ricettario · Capitolo 5 · Struttura del libro

Un capitolo di tesi con citazioni APA 7

Un capitolo di dottorato le cui citazioni [@key, p. 33] diventano APA 7 con citeproc-js, con la bibliografia costruita da un blocco BibTeX.

In questa pagina
Output
Canvas · PDF
Livello
Intermedio
Postext
Provata con Postext 1.65.0
Richiede ≥ 1.57.0 · postext-pdf ≥ 1.57.0
Licenza
Aggiornata il 22 ott 2026
Codice MIT · Testo CC BY 4.0
  • Esempio in inglese: non c’è ancora un’edizione italiana
  • Formato 210 × 297 mm
  • 1 colonna
  • Literata 11/16
  • Public Sans
  • 3 pagine
  • Livello
  • Postext 1.57.1
  • Impaginato in 282 ms
  • 118 righe di codice

In breve

Un capitolo di una tesi di dottorato. L’autore scrive un codice breve per ogni fonte; Postext stampa le citazioni e la bibliografia finale nello stile APA.

Che cosa comporrai

Il secondo capitolo di una tesi di dottorato in scienze dell’educazione, la rassegna della letteratura: che cosa dicono vent’anni di studi sulla lettura su carta e su schermo. Il capitolo è composto su una pagina A4 rilegata a sinistra, in Literata con interlinea di 16 pt, sotto una fascia chiara nel blu dell’università. L’autore tiene le fonti in Zotero e incolla l’esportazione in BibTeX; nel testo ogni fonte è una chiave. Postext formatta ogni citazione in APA 7, con l’autore, l’anno e la pagina quando è indicata, scrive «Delgado et al. (2018)» quando il nome fa parte della frase e costruisce la bibliografia nell’ordine e nella forma che lo stile richiede. Quando il relatore chiede Chicago, lo stile è l’unica riga che cambia.

Questa ricetta risponde a

  • Come cito le opere e costruisco la bibliografia in APA, IEEE o un altro stile citazionale?

La risposta breve

script.js · righe 27–39nel codice completo
// Citations are written [@key, p. 33] and formatted by citeproc-js in the chosen CSL
// style; the references come from the BibTeX block at the end of the chapter. Register
// the engine once, before the first build, then the style is one setting.
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
const citations = {
  style: 'apa', // 'chicago-author-date', 'ieee', 'vancouver'… change nothing else
  link: true, // each citation jumps to its entry in the PDF and on screen
  bibliography: {
    // APA asks for a half-inch hanging indent and keeps the list in the text size.
    fontSize: em(1), hangingIndent: mm(12.7), entrySpacing: pt(4),
    doi: 'link', // printed whole, as APA wants, and clickable
  },
};

Ingredienti

Tipo
Literata, Public Sans (SIL OFL 1.1)
Risorse
Nessuna: ogni immagine è disegnata nel codice

Preparazione

#1 · Un motore, uno stile

Il codice è la risposta breve qui sopra. Postext legge le citazioni e lascia la loro forma a un motore di citazione, registrato una volta prima della prima composizione; postext-citeproc incapsula citeproc-js, il motore che usano Zotero e Mendeley, con sedici stili CSL e i loro file di localizzazione. [@mangen2013] dà «(Mangen et al., 2013)», @delgado2018 senza parentesi quadre mette gli autori nella frase e [@ibanez2023, pp. 12–15] mette l’intervallo di pagine tra le parentesi. Con il documento in spagnolo, le stesse chiavi prendono congiunzioni e abbreviazioni dal file di localizzazione spagnolo, perché il motore segue la lingua del documento.

#2 · La bibliografia viene da un blocco BibTeX

L’ultimo blocco del capitolo è :::references{format=bibtex}, che contiene l’esportazione di Zotero incollata, con gli accenti scritti come {\'a}. :::bibliography, più sopra, colloca l’elenco sotto il titolo References; senza, Postext aggiunge l’elenco alla fine. Compaiono solo le opere citate, ordinate come le ordina APA, e ogni citazione nel testo rimanda alla sua voce.

#3 · Un titolo senza numero, rimandi in parole

script.js · righe 106–107nel codice completo
  headingStyles: [{ id: 'references', numbered: false }],
  crossRefs: { section: t({ en: 'Section {n}', es: 'Sección {n}' }) },

Il titolo della bibliografia prende lo stile references, che lo tiene nell’indice ma fuori dalla numerazione, così l’elenco non diventa la sezione 2.4. :ref{id="sec-speed"} stampa «Section 2.2» dall’etichetta di crossRefs e rimanda al titolo; i numeri vengono da startAt=2 sul titolo del capitolo, lo stesso contatore che usano i titoli.

#4 · L’apertura sta in una fascia

script.js · righe 43–68nel codice completo
const BAND = 92; // mm from the trim's top
const opener = {
  enabled: true,
  minHeight: mm(BAND - 28 + 10), // the body starts 10 mm under the band
  slot: { elements: [
    { kind: 'box', id: 'band', style: { backgroundColor: col('tint') },
      placement: { anchor: { to: 'page', edge: 'top-left' },
        size: { width: 'fill', height: mm(BAND) } } },
    { kind: 'text', id: 'label', content: t({ en: 'Chapter', es: 'Capítulo' }),
      fontFamily: LABEL, fontSize: pt(9), fontWeight: 600, letterSpacing: pt(1.8),
      textTransform: 'uppercase',
      color: col('accent'), align: 'left',
      placement: { anchor: { to: 'container', edge: 'top-left' },
        offset: { x: mm(0), y: mm(2) } } },
    { kind: 'text', id: 'number', content: '{number}', fontFamily: TEXT, fontSize: pt(96),
      fontWeight: 300, lineHeight: 0.9, color: col('accent'), align: 'right',
      placement: { anchor: { to: 'container', edge: 'top-right' },
        offset: { x: mm(0), y: mm(-6) },
        size: { width: mm(40), height: 'auto' } } },
    { kind: 'text', id: 'title', content: '{titleText}', fontFamily: TEXT, fontSize: pt(24),
      lineHeight: 1.12, fontWeight: 600, color: col('ink'), align: 'left', overflow: 'wrap',
      placement: { anchor: { to: 'container', edge: 'top-left' },
        offset: { x: mm(0), y: mm(14) },
        size: { width: mm(108), height: 'auto' } } },
  ] },
};

La fascia è un riquadro ancorato al formato rifilato e il testo comincia 10 mm sotto. Il numero è composto in Literata Light a 96 pt sulla destra, dove si legge come una forma e lascia al titolo tutta la giustezza.

script.js · righe 16–21nel codice completo
const palette = {
  ink: '#1b1b1f', accent: '#22406a', tint: '#e6ecf4', rule: '#b9bec8', muted: '#5d6370',
};
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' } }));

La ricetta completa

Sandbox
// ═══ Postext Cookbook · Nº 087 · A thesis chapter cited in APA 7 ═══════════════════
// https://postext.dev/en/cookbook/apa-thesis-with-bibtex
// Code: MIT · Text: original (CC BY 4.0) · Pictures: none
// Fonts: Literata, Public Sans (SIL OFL 1.1) · Needs postext ≥ 1.57.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 = 'apa-thesis-with-bibtex';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: a thesis prints in black; the one colour is the university's
const palette = {
  ink: '#1b1b1f', accent: '#22406a', tint: '#e6ecf4', rule: '#b9bec8', muted: '#5d6370',
};
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 = 'Literata', LABEL = 'Public Sans';
const LEAD = 16; // pt: double spacing is a typewriter habit; 1.45 reads as well and fits more

// #region answer: the citation engine, APA 7 and how its references look
// Citations are written [@key, p. 33] and formatted by citeproc-js in the chosen CSL
// style; the references come from the BibTeX block at the end of the chapter. Register
// the engine once, before the first build, then the style is one setting.
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
const citations = {
  style: 'apa', // 'chicago-author-date', 'ieee', 'vancouver'… change nothing else
  link: true, // each citation jumps to its entry in the PDF and on screen
  bibliography: {
    // APA asks for a half-inch hanging indent and keeps the list in the text size.
    fontSize: em(1), hangingIndent: mm(12.7), entrySpacing: pt(4),
    doi: 'link', // printed whole, as APA wants, and clickable
  },
};
// #endregion

// #region opener: a pale band at the head of the page, the number large and light in it
const BAND = 92; // mm from the trim's top
const opener = {
  enabled: true,
  minHeight: mm(BAND - 28 + 10), // the body starts 10 mm under the band
  slot: { elements: [
    { kind: 'box', id: 'band', style: { backgroundColor: col('tint') },

Lo script.js composto funziona così com’è: incollalo nello script modulo di qualsiasi pagina, oppure apri la ricetta su CodePen. Cartella della ricetta su GitHub ↗ (si apre in una nuova scheda)

Varianti

#Cambia lo stile

Lo stesso capitolo in Chicago autore-data toglie la virgola dopo il nome ed elenca l’anno dopo gli autori.

-  style: 'apa', // 'chicago-author-date', 'ieee', 'vancouver'… change nothing else
+  style: 'chicago-author-date',

#Una bibliografia più piccola del testo

Molte università ammettono la bibliografia un corpo più piccola e con interlinea singola.

-    fontSize: em(1), hangingIndent: mm(12.7), entrySpacing: pt(4),
+    fontSize: em(0.9), lineHeight: pt(13), hangingIndent: mm(12.7), entrySpacing: pt(3),

Errori frequenti

  • APA scrive i titoli di articoli e libri in sentence case, cioè con la sola iniziale maiuscola, e citeproc-js stampa i titoli come li forniscono i dati. Zotero conserva la maggior parte dei titoli in title case, quindi correggili in Zotero o nel BibTeX prima che arrivino sulla pagina.

Crediti

Testo
Testo originale, CC BY 4.0
Font
Literata (SIL OFL 1.1) · Public Sans (SIL OFL 1.1)
SandboxPDF