In breve
Un breve articolo di ricerca per una conferenza, su due colonne. L’autore dà un codice a ogni fonte; Postext numera le citazioni tra quadre, rimanda alle sezioni per numero e pagina e stampa alla fine l’elenco numerato dei riferimenti.
Che cosa comporrai
Un articolo di due pagine per un piccolo workshop di ingegneria dei documenti, composto come gli atti delle conferenze IEEE compongono i loro: formato US letter, due colonne di tre pollici e mezzo, un carattere tipo Times a 10 pt, sezioni numerate I, II, III in maiuscole centrate. Il titolo, i tre blocchi degli autori, l’abstract e le parole chiave corrono su entrambe le colonne sotto una fascia chiara nel blu del workshop, l’unico colore delle pagine. Gli autori citano con chiavi BibTeX; Postext stampa [1] nell’ordine in cui le opere sono citate per la prima volta, unisce tre opere consecutive come [2]–[4], scrive «Knuth and Plass [1]» quando i nomi fanno parte della frase e costruisce alla fine l’elenco numerato in corpo 8. I rimandi alle sezioni stampano «Section IV, on p. 2» e restano corretti quando il testo si sposta.
Questa ricetta risponde a
- Come cito le opere e costruisco la bibliografia in APA, IEEE o un altro stile citazionale?
- Come rimando a una sezione e alla pagina in cui si trova, mantenendo corretti entrambi quando il libro cambia?
La risposta breve
// [@key] prints [1] in order of first citation, @key in the sentence "Knuth and Plass [1]".
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
// The bundled IEEE style lists [2], [3], [4]; the IEEE editorial guide writes [2]–[4].
// One attribute on the CSL <citation> element makes citeproc-js join the run.
const ieee = STYLES.ieee.replace('<citation>', '<citation collapse="citation-number">');
const citations = {
style: 'custom', customStyle: ieee, // or style: 'ieee' for the file as it ships
link: true,
bibliography: {
fontSize: em(0.8), lineHeight: pt(9.4), // 8 pt on 9.4 pt, two sizes under the text
labelWidth: mm(6), // the [n] column: wide enough for [10], the turnovers align after it
entrySpacing: pt(1.2),
doi: 'text', // printed, not linked: the PDF stays black
},
};
Ingredienti
- Funzionalità
- Citazioni in uno stile citazionaleBibliografia dai riferimentiRimandiTitoli numeratiStili di titoloCapitoli non numeratiAperture progettateRiquadri a tutta larghezzaTavolozza di colori semanticaEsportazione in PDF
- Usa anche
- RiquadriCitazioni che collocano le figureAttributi dei titoliFont incorporati nel PDFA capo nei titoli
- Tipo
- STIX Two Text, Schibsted Grotesk (SIL OFL 1.1)
- Risorse
- Nessuna: ogni immagine è disegnata nel codice
Preparazione
#1 · Lo stile IEEE, con i suoi intervalli
Il codice è la risposta breve qui sopra. Registrato una volta, postext-citeproc formatta ogni [@key] con citeproc-js e lo stile CSL IEEE, numerando le opere nell’ordine in cui sono citate per la prima volta. Il file di stile fornito con il motore elenca tre opere consecutive come [2], [3], [4]; la guida editoriale IEEE le unisce come [2]–[4]. Se aggiungi collapse="citation-number" all’elemento <citation> dello stile e passi il risultato come customStyle, citeproc-js fa lo stesso. labelWidth dà ai numeri dell’elenco una colonna propria, così la seconda riga di una voce comincia sotto la prima parola e non sotto la parentesi.
#2 · Un blocco del titolo su entrambe le colonne
const text = (id, content, size, extra) => ({ kind: 'text', id, content, fontFamily: SERIF,
fontSize: pt(size), color: col('ink'), align: 'center', overflow: 'wrap', ...extra });
const at = (to, edge, x, y, width) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) },
...(width && { size: { width: mm(width), height: 'auto' } }) });
const AUTHOR_W = MEASURE / 3;
const titleBlock = {
enabled: true,
minHeight: mm(64), // venue line, two lines of title and five of author block
slot: { elements: [
{ kind: 'box', id: 'band', style: { backgroundColor: col('tint') }, // from the trim's top
placement: { anchor: { to: 'page', edge: 'top-left' },
size: { width: 'fill', height: mm(TOP + 66) } } },
text('venue', '{attr.venue}', 7.5, { fontFamily: SANS, fontWeight: 600, color: col('accent'),
letterSpacing: pt(1.2), textTransform: 'uppercase',
placement: at('container', 'top-left', 0, 0, MEASURE) }),
{ kind: 'rule', id: 'venue-rule', thickness: pt(0.5), color: col('rule'),
placement: at('#venue', 'below', 0, 2, MEASURE) },
text('title', '{titleText}', 23, { lineHeight: 1.1, placement: at('#venue', 'below', 0, 7,
MEASURE) }),
...['a1', 'a2', 'a3'].map((id, i) => text(id, `{attr.${id}}`, 9.5, { lineHeight: 1.25,
placement: at('#title', 'below', i * AUTHOR_W, 6, AUTHOR_W) })),
] },
};
Il titolo è l’unico titolo di livello 1 del documento, con lo stile paper. Lo stile occupa tutta la larghezza della pagina e disegna il titolo a partire dalla sua grafica: la riga della sede, il titolo e tre blocchi di autori larghi un terzo della giustezza, ciascuno letto da un attributo del titolo in cui \n spezza le righe. La fascia è un riquadro ancorato al formato rifilato, così arriva fino al bordo superiore della carta.
#3 · Abstract e parole chiave in grassetto
const calloutStyles = [{ id: 'abstract', span: 'page', backgroundEnabled: false,
border: { enabled: false }, stripe: { enabled: true, side: 'top', width: pt(0.5),
color: col('rule') },
padding: { top: mm(3), right: mm(14), bottom: mm(1), left: mm(14) },
marginTop: pt(0), marginBottom: pt(LEAD),
body: { fontSize: pt(9), lineHeight: pt(11), fontWeight: 700, firstLineIndent: pt(0),
textAlign: 'justify', paragraphSpacing: true } }];
Un riquadro a tutta larghezza contiene l’abstract e le parole chiave. Il suo corpo è un 9 pt grassetto, come lo compone IEEE, e ***Abstract*—** nel testo dà l’etichetta in corsivo con la sua lineetta. Il filetto sottile sopra è la banda del riquadro, e la spaziatura interna restringe la giustezza a circa cento caratteri.
#4 · Sezioni numerate e rimandi a esse
const levels = [
{ level: 1, breakBefore: { enabled: true, parity: 'any' } }, // any page: no forced recto
{ level: 2, numberingTemplate: '{2:I}.', numberSeparator: ' ', fontSize: pt(9),
lineHeight: pt(LEAD), fontWeight: 400, letterSpacing: em(0.06), textTransform: 'uppercase',
marginTop: pt(LEAD), marginBottom: pt(0) }, // a line above, none below: at a column's head
// the margin above drops and the text still starts on the next grid line
];
const headingStyles = [
{ id: 'paper', numbered: false, span: 'page', advancedDesign: titleBlock },
{ id: 'back', numbered: false }, // Acknowledgment and References: no number
];
const crossRefs = { section: t({ en: 'Section {n}', es: 'sección {n}' }) };
{2:I}. numera le sezioni I., II., III. Un rimando stampa il numero senza il punto, quindi :ref{id="sec:results"} dà «Section IV» dal modello crossRefs, e :ref{id="sec:results" style=page} dà «p. 2». Entrambi sono calcolati sulle pagine impaginate, così seguono il testo se si aggiunge un paragrafo o si sposta una sezione. I titoli dei ringraziamenti e dei riferimenti usano lo stile back e restano senza numero.
const palette = {
ink: '#16181d', accent: '#1d4a7a', tint: '#e9eef5', rule: '#aeb6c2', muted: '#5a606b',
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' } }));
La ricetta completa
// ═══ Postext Cookbook · Nº 088 · A two-column conference paper in IEEE style ═══════
// https://postext.dev/en/cookbook/ieee-conference-paper
// Code: MIT · Text: original (CC BY 4.0) · Pictures: none
// Fonts: STIX Two Text, Schibsted Grotesk (SIL OFL 1.1) · Needs postext ≥ 1.65.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 = 'ieee-conference-paper';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: black type on white, with one blue for the workshop's own marks
const palette = {
ink: '#16181d', accent: '#1d4a7a', tint: '#e9eef5', rule: '#aeb6c2', muted: '#5a606b',
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 [SERIF, SANS] = ['STIX Two Text', 'Schibsted Grotesk'];
// The IEEE conference template in mm: US letter, 0.75 in head, 1 in foot, 0.625 in sides,
// two columns of 3.5 in with 0.25 in between.
const [TRIM_W, TRIM_H, TOP, BOTTOM, SIDE, GUTTER] = [215.9, 279.4, 19, 25.4, 15.9, 6.35];
const MEASURE = TRIM_W - 2 * SIDE;
const LEAD = 12; // pt: 10 pt type on 12 pt, as the template sets it
// #region answer: IEEE numbers, collapsed ranges and a references list with a label column
// [@key] prints [1] in order of first citation, @key in the sentence "Knuth and Plass [1]".
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
// The bundled IEEE style lists [2], [3], [4]; the IEEE editorial guide writes [2]–[4].
// One attribute on the CSL <citation> element makes citeproc-js join the run.
const ieee = STYLES.ieee.replace('<citation>', '<citation collapse="citation-number">');
const citations = {
style: 'custom', customStyle: ieee, // or style: 'ieee' for the file as it ships
link: true,
bibliography: {
fontSize: em(0.8), lineHeight: pt(9.4), // 8 pt on 9.4 pt, two sizes under the text
labelWidth: mm(6), // the [n] column: wide enough for [10], the turnovers align after it
entrySpacing: pt(1.2),
doi: 'text', // printed, not linked: the PDF stays black
},
};
// #endregion
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
#Tieni lo stile così come viene fornito
Senza la modifica, tre opere consecutive si stampano una per una, come alcune riviste preferiscono.
- style: 'custom', customStyle: ieee, // or style: 'ieee' for the file as it ships
+ style: 'ieee',#Scrivi gli intervalli dentro una sola coppia di parentesi
Alcuni stili numerati stampano invece [2–4]. Il marcatore brackets scrive i numeri da sé e unisce quelli consecutivi.
- style: 'custom', customStyle: ieee, // or style: 'ieee' for the file as it ships
+ style: 'ieee', marker: 'brackets', collapseRanges: true,Errori frequenti
- Quando le due colonne dell’ultima pagina non finiscono alla pari, guarda che cosa si trova dove verrebbero tagliate: il motore non lascia un titolo di sezione al piede di una colonna lontano dal suo testo, e rinuncia invece al taglio. Una frase in più o in meno nelle ultime sezioni sposta il taglio oltre il titolo.
- I comandi BibTeX come
{\TeX}non vengono espansi. ScriviThe {TeX}book; le graffe mantengono le maiuscole come sono.
Crediti
- Ricetta
- Ignacio Ferro
- Testo
- Testo originale, CC BY 4.0
- Font
- STIX Two Text (SIL OFL 1.1) · Schibsted Grotesk (SIL OFL 1.1)
- Codice
- MIT, come Postext
Modifica questo testo ↗ (si apre in una nuova scheda)Cartella della ricetta su GitHub ↗ (si apre in una nuova scheda)


