In short
A short research paper for a conference, in two columns. The author writes a code for each source; Postext numbers the citations in brackets, refers to sections by number and page, and prints the numbered list of references at the end.
What you'll build
A two-page paper for a small workshop on document engineering, set the way IEEE conference proceedings set theirs: US letter, two columns of three and a half inches, Times-like type at 10 pt, sections numbered I, II, III in centred capitals. The title, the three author blocks, the abstract and the index terms run across both columns under a pale band in the workshop's blue, the only colour on the pages. The authors cite with BibTeX keys; Postext prints [1] in the order the works are first cited, joins three consecutive works as [2]–[4], writes "Knuth and Plass [1]" when the names are part of the sentence, and builds the numbered list at the end in 8 pt. References to sections print "Section IV, on p. 2" and stay right when the text moves.
This recipe answers
- How do I cite works and build the bibliography in APA, IEEE or another citation style?
- How do I refer to a section and the page it is on, and keep both right when the book changes?
The short answer
// [@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
},
};
IEEE numbers, collapsed ranges and a references list with a label column
Ingredients
- Features
- Citations in a citation styleBibliography from the referencesCross-referencesNumbered headingsHeading stylesUnnumbered chaptersDesigned openersBoxes across the pageSemantic colour palettePDF export
- Also uses
- Callout boxesCitations that place figuresHeading attributesFonts embedded in the PDFLine breaks in titles
- Type
- STIX Two Text, Schibsted Grotesk (SIL OFL 1.1)
- Assets
- None: every picture is drawn in code
Method
#1 · The IEEE style, with its ranges
The code is the short answer above. Registered once, postext-citeproc formats every [@key] with citeproc-js and the IEEE CSL style, numbering the works in the order they are first cited. The style file bundled with the engine lists three consecutive works as [2], [3], [4]; the IEEE editorial guide joins them as [2]–[4]. Adding collapse="citation-number" to the style's <citation> element and passing the result as customStyle makes citeproc-js do it. labelWidth gives the numbers of the list a column of their own, so the second line of an entry starts under the first word, not under the bracket.
#2 · A title block across both columns
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) })),
] },
};
The title is the document's only level-1 heading, with the style paper. The style spans the page and draws the heading from its design: the venue line, the title and three author blocks a third of the measure wide, each read from a heading attribute whose \n breaks the lines. The band is a box anchored to the trim, so it reaches the top edge of the paper.
#3 · Abstract and index terms in bold
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 } }];
A callout that spans the page carries the abstract and the index terms. Its body is 9 pt bold, as IEEE sets it, and ***Abstract*—** in the text gives the italic label with its em dash. The hairline above is the box's stripe, and the padding narrows the measure to about a hundred characters.
#4 · Numbered sections and references to them
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}. numbers the sections I., II., III. A reference prints the number without its stop, so :ref{id="sec:results"} gives "Section IV" from the crossRefs template, and :ref{id="sec:results" style=page} gives "p. 2". Both are worked out from the laid-out pages, so they follow the text if a paragraph is added or a section moves. The Acknowledgment and References heads take the back style and go unnumbered.
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' } }));
The whole recipe
// ═══ 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
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
#Keep the style as it ships
Without the edit, three consecutive works print one by one, which some journals prefer.
- style: 'custom', customStyle: ieee, // or style: 'ieee' for the file as it ships
+ style: 'ieee',#Write the ranges inside one pair of brackets
Some numbered styles print [2–4] instead. The brackets marker writes the numbers itself and joins consecutive ones.
- style: 'custom', customStyle: ieee, // or style: 'ieee' for the file as it ships
+ style: 'ieee', marker: 'brackets', collapseRanges: true,Pitfalls
- When the two columns of the last page do not end level, look at what stands where they would be cut: the engine will not leave a section head at the foot of a column away from its text, and gives up the cut instead. A sentence more or less in the last sections moves the cut past the heading.
- BibTeX commands such as
{\TeX}are not expanded. WriteThe {TeX}book; the braces keep the capitals as they are.
Credits
- Recipe
- Ignacio Ferro
- Text
- Original prose, CC BY 4.0
- Fonts
- STIX Two Text (SIL OFL 1.1) · Schibsted Grotesk (SIL OFL 1.1)
Edit this write-up ↗ (opens in a new tab)Recipe folder on GitHub ↗ (opens in a new tab)


