En pocas palabras
Un capítulo de una tesis doctoral. La autora escribe una clave corta para cada fuente; Postext imprime las citas y la lista de referencias del final en estilo APA.
Lo que vas a componer
El segundo capítulo de una tesis doctoral en educación, el estado de la cuestión: lo que dicen veinte años de estudios sobre leer en papel y en pantalla. El capítulo va en A4 encuadernado a la izquierda, en Literata con 16 pt de interlineado, bajo una banda pálida en el azul de la universidad. La autora guarda las fuentes en Zotero y pega la exportación en BibTeX; en el texto, cada fuente es una clave. Postext compone cada cita en APA 7, con el autor, el año y la página cuando la hay, escribe «Delgado et al. (2018)» cuando el nombre forma parte de la frase y monta la lista de referencias en el orden y la forma que pide el estilo. Si el director de tesis pide Chicago, el estilo es la única línea que cambia.
Esta receta responde a
- ¿Cómo cito obras y compongo la bibliografía en APA, IEEE u otro estilo de cita?
La respuesta corta
// 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
},
};
Ingredientes
- Funciones
- Citas en un estilo de citaBibliografía a partir de las referenciasReferencias cruzadasTítulos numeradosEstilos de títuloCapítulos sin númeroAperturas diseñadasCabeceras y foliosPaleta de color semánticaExportación a PDF
- También usa
- Citas que colocan las figurasAtributos de títuloCabeceras según el tipo de páginaFuentes incrustadas en el PDF
- Tipografía
- Literata, Public Sans (SIL OFL 1.1)
- Recursos
- Ninguno: todas las imágenes se dibujan en código
Elaboración
#1 · Un motor, un estilo
El código es la respuesta corta de arriba. Postext lee las citas y deja su redacción a un motor de citas que se registra una vez antes de la primera composición; postext-citeproc envuelve citeproc-js, el motor de Zotero y Mendeley, con dieciséis estilos CSL y sus archivos de idioma. [@mangen2013] da «(Mangen et al., 2013)», @delgado2018 sin corchetes pone los autores dentro de la frase y [@ibanez2023, pp. 12–15] lleva el intervalo de páginas al paréntesis. Con el documento en español, las mismas claves toman los nexos y las abreviaturas del archivo de idioma español, porque el motor sigue el idioma del documento.
#2 · Las referencias salen de un bloque BibTeX
El último bloque del capítulo es :::references{format=bibtex}, con la exportación de Zotero pegada dentro y los acentos escritos como {\'a}. :::bibliography, encima, coloca la lista bajo el título Referencias; sin él, Postext añade la lista al final. Solo aparecen las obras citadas, ordenadas como ordena APA, y cada cita del texto enlaza con su entrada.
#3 · Un título sin número y referencias con palabras
headingStyles: [{ id: 'references', numbered: false }],
crossRefs: { section: t({ en: 'Section {n}', es: 'Sección {n}' }) },
El título de las referencias lleva el estilo references, que lo deja en el índice pero fuera de la numeración, así que la lista no se convierte en la sección 2.4. :ref{id="sec-speed"} imprime «Sección 2.2» con la etiqueta de crossRefs y enlaza con el título; los números salen de startAt=2 en el título del capítulo, el mismo contador que usan los títulos.
#4 · La apertura va en una banda
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 banda es una caja anclada al corte de la página, y el texto empieza 10 mm por debajo. El número va en Literata Light de 96 pt a la derecha, donde se lee como una forma y deja al título toda su medida.
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 receta completa
// ═══ 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 = 'es'; // @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') },
El script.js compuesto funciona tal cual: pégalo como script de módulo en cualquier página o abre la receta en CodePen. Carpeta de la receta en GitHub ↗ (se abre en una nueva pestaña)
Variantes
#Cambia el estilo
El mismo capítulo en Chicago autor-año quita la coma tras el nombre y pone el año detrás de los autores.
- style: 'apa', // 'chicago-author-date', 'ieee', 'vancouver'… change nothing else
+ style: 'chicago-author-date',#Deja la lista más pequeña que el texto
Muchas universidades admiten la lista de referencias un cuerpo por debajo y a espacio sencillo.
- fontSize: em(1), hangingIndent: mm(12.7), entrySpacing: pt(4),
+ fontSize: em(0.9), lineHeight: pt(13), hangingIndent: mm(12.7), entrySpacing: pt(3),Errores frecuentes
- APA escribe los títulos de artículos y libros con mayúscula solo inicial, y citeproc-js imprime los títulos tal como vienen en los datos. Zotero guarda casi todos los títulos con mayúsculas en cada palabra, así que corrígelos en Zotero o en el BibTeX antes de que lleguen a la página.
Créditos
- Receta
- Ignacio Ferro
- Texto
- Texto original, CC BY 4.0
- Fuentes
- Literata (SIL OFL 1.1) · Public Sans (SIL OFL 1.1)
- Código
- MIT, como Postext
Editar este texto ↗ (se abre en una nueva pestaña)Carpeta de la receta en GitHub ↗ (se abre en una nueva pestaña)


