En poques paraules
Un pòster gran per a un congrés científic, sobre els arbres del carrer i la calor. Ensenya a ordenar en columnes requadres de text i gràfics en una sola pàgina molt gran.
Què compondràs
Un pòster de congrés de 600 × 800 mm per a un estudi inventat sobre arbrat viari i calor a la vorera. Una banda verda porta el nom de la trobada, el títol en Bitter a 110 pt, els autors amb les seves filiacions i la marca del Departament de Geografia. Sota un resum a dues columnes, un grup :::columns ocupa tota l'amplada i compon sis panells en tres columnes, cadascun un requadre sota un filet de 6 pt. La columna central comença amb −4,2 °C en taronja a 150 pt; segueixen un mapa de calor de l'aire per illa de cases i hora, amb la seva llegenda de mostres de color, i un gràfic de barres del paviment. Una franja tintada amb xips de paraules clau es recolza al marge inferior. El mateix fitxer compon l'edició anglesa, i el pen ofereix la pàgina com a PNG de 1701 × 2268 px.
Aquesta recepta respon a
- Com poso un requadre que travessi les dues columnes a mitja pàgina, com un tauler de xifres en tres blocs?
- Com poso dues columnes dins d'un requadre (una de text al costat d'una altra amb una figura)?
- Com afegeixo mostres de color com a llegenda en el text, els peus o les notes de taula?
La resposta curta
// The body text runs in two columns and the panels in three: a :::columns group in the
// text, and span="page" lays it across both body columns, the gutter apart.
// :::columns{count=3 breaks="3,4" span="page" marginBottom="0.75em"}
// ← panel 3 opens column 2, panel 4 column 3
// :::callout{type="panel" title="Introduction"} ← each panel is a box in the group
// …
// ::: ← closes the panel; then the other panels
// ::: ← closes the columns group
// marginBottom sets the space under the group: without it the group is followed by a
// line of the summary's paragraph spacing, 38 pt.
// A box in a group takes the width of its column. Its one device is a 6 pt stripe along
// the top.
const panel = { id: 'panel', backgroundEnabled: false,
stripe: { enabled: true, side: 'top', width: pt(6), color: col('canopy') },
padding: { top: mm(5), right: pt(0), bottom: pt(0), left: pt(0) },
titleStyle: { fontFamily: 'Saira Condensed', fontSize: pt(40), fontWeight: 700,
textTransform: 'uppercase', letterSpacing: pt(4), color: col('canopy'), gap: mm(4) },
body: { fontSize: pt(22), lineHeight: pt(30) }, // the rest follows bodyText
marginTop: mm(18) };
const results = { ...panel, id: 'results', // the finding: the same panel, striped in heat
stripe: { ...panel.stripe, color: col('heat') },
titleStyle: { ...panel.titleStyle, color: col('heat') } };
Ingredients
- Funcions
- Columnes en un requadre o al textRequadres a tota l'ampladaObertures dissenyadesAtributs de títolAncoratge d'elements de dissenyImatges als dissenys de pàginaMostres de colorChips en líniaPaleta de color semànticaRequadresFigures just aquíEstils de paràgrafFormat de pàginaPàgines en un canvasPeus numeratsLínies de font i crèditRequadres flotantsRetícula de baseBanda de capítol d'amplada completa
- També fa servir
- Bibliografies i glossarisCites que col·loquen les figuresFigura i Taula en la teva llenguaColor del paperTipus de recurs propisFigures i taules com a recursosEspai vertical explícit
- Tipografia
- Rethink Sans, Bitter, Saira Condensed (SIL OFL 1.1)
- Recursos
- The plan of the street, the heat map, the bar chart and the School of Geography's mark, drawn in code from synthetic data in the poster's palette (Ignacio Ferro, CC BY 4.0)
Elaboració
#1 · Compon el plec a 72 ppp
const SHEET = { width: 600, height: 800, margin: 25 }; // mm: a portrait board, 25 mm all round
const GAP = 12; // mm between the two body columns and between the three panel columns
// The summary's leading is the page's baseline grid: 56 lines fill the 750 mm between the
// margins, so a box floated to the foot of the page ends on the bottom margin.
const LEAD = (((SHEET.height - 2 * SHEET.margin) / 25.4) * 72) / 56; // 37.96 pt
const page = { width: mm(SHEET.width), height: mm(SHEET.height),
// At 72 dpi a point is a pixel: the page is 1,701 × 2,268 px. The default 300 dpi would give
// 7,087 × 9,449 px (268 MB of canvas) for the same line breaks.
dpi: 72, backgroundColor: col('paper'),
margins: { top: mm(SHEET.margin), bottom: mm(SHEET.margin), left: mm(SHEET.margin),
right: mm(SHEET.margin) } }; // one sheet, nothing to mirror
A 300 ppp, el valor per defecte, el pòster talla cada línia al mateix lloc que a 72 ppp, però la pàgina fa 7087 × 9449 px, que un cop pintats ocupen 268 MB (mides de pàgina predefinides). A 72 ppp un punt és un píxel. El visor pinta les miniatures amb renderPageToCanvas i una scale, i renderPage genera el PNG de 1701 × 2268 px que demana la galeria en línia d'un congrés (renderitzar una pàgina en un mapa de bits). L'interlineat reparteix en 56 línies els 750 mm que hi ha entre els marges, així que la franja de paraules clau, flotada al peu de la pàgina, acaba al marge inferior. Amb un interlineat rodó de 38 pt només hi caben 55 línies, i l'última queda 12,7 mm per sobre del marge; la franja ja no cap sota els panells i passa a una segona pàgina.
#2 · Dibuixa la banda del títol des de l'encapçalament
const BAND = 158; // mm from the top edge to the foot of the green field
const type = (id, content, family, size, look, placement) => ({ kind: 'text', id, content,
fontFamily: family, fontSize: pt(size), color: col('paper'), align: 'left',
overflow: 'wrap', lineHeight: 1.2,
...look, placement });
const band = { enabled: true,
// The field ends 133 mm under the top margin; eleven grid lines (147 mm) start the summary
// 14 mm below it.
minHeight: pt(11 * LEAD),
slot: { elements: [
{ kind: 'box', id: 'field', style: { backgroundColor: col('canopy') },
placement: { ...at('page', 'top-left'), size: { width: 'fill', height: mm(BAND) } } },
type('meeting', '{attr.meeting}', 'Saira Condensed', 22, { fontWeight: 600,
textTransform: 'uppercase', letterSpacing: pt(3.5), color: col('tint') },
{ ...at('page', 'top-left', SHEET.margin, 18), size: { width: mm(420) } }),
type('title', '{titleText}', 'Bitter', 110, { fontWeight: 800, lineHeight: 1 },
{ ...at('#meeting', 'below', 0, 7), size: { width: mm(380) } }),
type('authors', '{attr.authors}', 'Rethink Sans', 30, { fontWeight: 700 },
{ ...at('#title', 'below', 0, 7), size: { width: 'fill' } }),
// The affiliation marks are the characters ¹ ² ³, typed in the heading's attributes.
type('affiliations', '{attr.affiliations}', 'Rethink Sans', 21, { color: col('tint') },
{ ...at('#authors', 'below', 0, 2), size: { width: 'fill' } }),
type('number', '{attr.poster}', 'Saira Condensed', 30, { fontWeight: 700,
color: col('canopy'), box: { backgroundColor: col('paper'),
padding: { top: mm(1.5), right: mm(4), bottom: mm(1), left: mm(4) } } },
at('page', 'top-right', -SHEET.margin, 15)),
// The School of Geography's mark, drawn in code.
{ kind: 'image', id: 'mark', resourceId: 'mark',
placement: { ...at('page', 'top-right', -SHEET.margin, 38), size: { width: mm(92) } } },
] } };
L'H1 porta com a atributs la trobada, el número del pòster, els autors i les filiacions, i el seu disseny els compon sobre un rectangle verd de 158 mm d'alt, ancorat a la pàgina (extensió i disseny avançat). El rectangle acaba 133 mm per sota del marge superior. Sense minHeight, el resum començaria a 0,9 mm del verd; un minHeight d'onze línies de la retícula de base el separa 14 mm. Les crides de filiació són els caràcters ¹ ² ³, les úniques xifres volades del rang Latin-1.
#3 · Compon els panells en un grup a tota l'amplada
// The body text runs in two columns and the panels in three: a :::columns group in the
// text, and span="page" lays it across both body columns, the gutter apart.
// :::columns{count=3 breaks="3,4" span="page" marginBottom="0.75em"}
// ← panel 3 opens column 2, panel 4 column 3
// :::callout{type="panel" title="Introduction"} ← each panel is a box in the group
// …
// ::: ← closes the panel; then the other panels
// ::: ← closes the columns group
// marginBottom sets the space under the group: without it the group is followed by a
// line of the summary's paragraph spacing, 38 pt.
// A box in a group takes the width of its column. Its one device is a 6 pt stripe along
// the top.
const panel = { id: 'panel', backgroundEnabled: false,
stripe: { enabled: true, side: 'top', width: pt(6), color: col('canopy') },
padding: { top: mm(5), right: pt(0), bottom: pt(0), left: pt(0) },
titleStyle: { fontFamily: 'Saira Condensed', fontSize: pt(40), fontWeight: 700,
textTransform: 'uppercase', letterSpacing: pt(4), color: col('canopy'), gap: mm(4) },
body: { fontSize: pt(22), lineHeight: pt(30) }, // the rest follows bodyText
marginTop: mm(18) };
const results = { ...panel, id: 'results', // the finding: the same panel, striped in heat
stripe: { ...panel.stripe, color: col('heat') },
titleStyle: { ...panel.titleStyle, color: col('heat') } };
El cos va a dues columnes i els panells a tres, així que la retícula és un grup :::columns{count=3} escrit directament al text, i span="page" l'estén sobre les dues columnes del cos, sota el resum, amb les columnes separades per l'espai entre columnes de la pàgina (:::columns). Si no se li diu res, després d'un grup al text ve una línia de separació entre paràgrafs, aquí 38 pt, i la franja de paraules clau passaria a una segona pàgina; marginBottom="0.75em" a la línia d'obertura ocupa el lloc d'aquesta línia (postext 1.28), i la franja cap al peu de la pàgina. Cada panell és un requadre dins del grup: pren el seu propi estil, els 175 mm d'amplada de la columna i 18 mm de marginTop sota el panell de sobre (el contenidor :::callout). breaks="3,4" porta el tercer panell, Resultados, al cap de la columna central, i el quart, Conclusiones, al de l'última. Sense això, el grup s'equilibra i talla pel panell més proper a cada terç de la pila. Amb aquest text els talls cauen en els mateixos dos panells; l'atribut els fixa per si el text canvia.
#4 · Deixa cada figura al seu panell
// "Figure 1", not "Figure 1.1": the poster has no chapters.
const figureType = { ...defaultResourceTypes(LANG)[0], numberingTemplate: '{n}' };
const resourceTypes = [figureType];
const figure = (id, [width, height], caption, altText) => ({ id, typeId: figureType.id,
kind: 'svg', svg: { fileId: `${id}.svg`, width: width * 10, height: height * 10 },
placement: { position: 'here' }, // stays in its panel, where ::resource puts it; else floats
caption, altText, note: t({ en: 'Synthetic data, generated for this poster.',
es: 'Datos sintéticos, generados para este póster.' }), createdAt: 0, updatedAt: 0 });
Una figura amb posició 'here' es queda al panell on la posa ::resource; amb la col·locació per defecte, els tres dibuixos surten dels seus panells i el pòster passa a dues pàgines. numberingTemplate: '{n}' les numera 1, 2 i 3, mentre que el {h1}.{n} per defecte imprimeix Figura 1.1 sota un títol que és un H1 (tipus de recurs). La nota sota cada peu avisa que les dades són sintètiques.
#5 · Comparteix els colors del mapa de calor amb la seva llegenda
const palette = {
ink: '#102a2c', // text: a green-black
paper: '#f7faf7', // the sheet, and type on the band
canopy: '#2e7d4f', // the band, the stripes and titles of five panels, the tree crowns
tint: '#e6f2ea', // the keyword strip, the park on the plan, lines of type on the band
rule: '#bcd2c4', // buildings on the plan, the chart's grid
muted: '#587068', // the notes under the figures, the axis titles inside them
// The key of Figure 2, the air against the street mean at the same hour. The heat map's
// cells and the :swatch runs of its key read the same four entries.
cool: '#3b82c4', // −1.5 °C or less
mist: '#a9c9e6', // −1.5 to 0 °C
blush: '#f2b492', // 0 to +1.5 °C
heat: '#d9572b', // +1.5 °C or more; also −4.2 °C, the Results panel, the loggers, the sun
};
// Every colour is linked to its palette entry by id.
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = [ // defaults link to 'main-color': point it at the canopy green
...Object.entries(palette).map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } })),
{ id: 'main-color', name: 'canopy (defaults)', value: { hex: palette.canopy, model: 'hex' } },
];
Les cel·les del mapa de calor i les quatre mostres :swatch{color="…"} de la seva llegenda remeten a les mateixes entrades de la paleta, així que un valor nou per a cool canvia alhora el mapa i la llegenda (format en línia). La llegenda és un segon grup :::columns, amb dues entrades per columna, dins del panell de Resultados.
#6 · Compon la xifra principal amb un estil de paràgraf
const paragraphStyles = [
// Paragraph styles apply inside boxes. The figure is written **bold**: that sets it in
// Bitter 700 and in the style's boldColor.
// containerSpacing 'add': the group ends on the style's own space, with no line of
// paragraph spacing under it. −4.2 °C sits on the line that explains it, and a :::space
// sets the gap under the references.
{ id: 'stat', fontFamily: 'Bitter', fontSize: pt(150), lineHeight: pt(130),
boldColor: col('heat'), containerSpacing: 'add' },
{ id: 'refs', fontSize: pt(19), lineHeight: pt(26), hangingIndent: mm(9), spaceBetween: pt(8),
containerSpacing: 'add' },
{ id: 'key', fontSize: pt(19), lineHeight: pt(28) }, // the key of Figure 2
];
const chipStyles = [{ id: 'keyword', background: col('paper'), borderColor: col('canopy'),
borderWidth: pt(1.5), borderRadius: em(1), paddingX: em(0.55), paddingY: em(0.14),
color: col('canopy'), bold: true, gap: em(0.35) }];
const strip = { id: 'strip', background: col('tint'), // one device: a tint
padding: { top: mm(4), right: mm(8), bottom: mm(4), left: mm(8) }, columnGap: mm(GAP),
body: { fontSize: pt(18), lineHeight: pt(24) } };
Els estils de paràgraf s'apliquen dins dels requadres, així que −4,2 °C és un bloc :::paragraphs{style="stat"} en Bitter a 150 pt dins del panell de Resultados (estils de paràgraf). La xifra va en negreta, així que surt en Bitter 700 i en el boldColor de l'estil, el taronja del panell. Un segon estil dona a les referències un sagnat francès de 9 mm. La franja de paraules clau és un requadre tintat amb placement="bottom", que flota al peu de la pàgina sota la retícula.
La recepta completa
// ═══ Postext Cookbook · Nº 059 · Research poster on one big page ══════════════════
// https://postext.dev/en/cookbook/research-poster
// Code: MIT · Text and data: original, synthetic (CC BY 4.0) · Figures: generated in code
// Fonts: Rethink Sans, Bitter, Saira Condensed (SIL OFL 1.1) · Needs postext ≥ 1.28.0
import {
buildDocumentWithFonts, renderPage, renderPageToCanvas, registerResourceImage,
defaultResourceTypes, inlineSvgFonts,
} from 'https://esm.sh/postext';
const LANG = 'es'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'research-poster';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: six colours for the poster, four for the heat map's key
const palette = {
ink: '#102a2c', // text: a green-black
paper: '#f7faf7', // the sheet, and type on the band
canopy: '#2e7d4f', // the band, the stripes and titles of five panels, the tree crowns
tint: '#e6f2ea', // the keyword strip, the park on the plan, lines of type on the band
rule: '#bcd2c4', // buildings on the plan, the chart's grid
muted: '#587068', // the notes under the figures, the axis titles inside them
// The key of Figure 2, the air against the street mean at the same hour. The heat map's
// cells and the :swatch runs of its key read the same four entries.
cool: '#3b82c4', // −1.5 °C or less
mist: '#a9c9e6', // −1.5 to 0 °C
blush: '#f2b492', // 0 to +1.5 °C
heat: '#d9572b', // +1.5 °C or more; also −4.2 °C, the Results panel, the loggers, the sun
};
// Every colour is linked to its palette entry by id.
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = [ // defaults link to 'main-color': point it at the canopy green
...Object.entries(palette).map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } })),
{ id: 'main-color', name: 'canopy (defaults)', value: { hex: palette.canopy, model: 'hex' } },
];
// #endregion
// #region sheet: one 600 × 800 mm page, laid out at 72 dpi
const SHEET = { width: 600, height: 800, margin: 25 }; // mm: a portrait board, 25 mm all round
const GAP = 12; // mm between the two body columns and between the three panel columns
// The summary's leading is the page's baseline grid: 56 lines fill the 750 mm between the
// margins, so a box floated to the foot of the page ends on the bottom margin.
const LEAD = (((SHEET.height - 2 * SHEET.margin) / 25.4) * 72) / 56; // 37.96 pt
const page = { width: mm(SHEET.width), height: mm(SHEET.height),
// At 72 dpi a point is a pixel: the page is 1,701 × 2,268 px. The default 300 dpi would give
// 7,087 × 9,449 px (268 MB of canvas) for the same line breaks.
dpi: 72, backgroundColor: col('paper'),
margins: { top: mm(SHEET.margin), bottom: mm(SHEET.margin), left: mm(SHEET.margin),
right: mm(SHEET.margin) } }; // one sheet, nothing to mirror
L'script.js compost funciona tal com és: enganxa'l com a script de mòdul en qualsevol pàgina o obre la recepta a CodePen. Carpeta de la recepta a GitHub ↗ (s'obre en una pestanya nova)
Variants
#Exporta el pòster digital a 150 ppp
Si el congrés demana un fitxer més gran, surt un PNG de 3543 × 4724 px amb els mateixos talls de línia.
- dpi: 72, backgroundColor: col('paper'),
+ dpi: 150, backgroundColor: col('paper'),Errors freqüents
- Al canvas, Rethink Sans substitueix una xifra sola entre parèntesis, com el fascicle d'11(3), per la xifra en cercle, així que les referències donen només el volum i les pàgines.
- Un requadre a tota l'amplada que tanca el document passa a una pàgina nova si no li queden a sota dues línies del cos. Per això la franja de paraules clau flota amb
placement="bottom", que l'assenta al marge inferior, dins dels 50 mm que queden sota la retícula. containerSpacing: 'add'als estilsstatirefstanca els seus grups:::paragraphsamb l'espai propi de l'estil, i així −4,2 °C queda enganxat a la línia que l'explica; els altres grups del pòster segueixen la regla del document (des de postext 1.28; abans la regla només es podia fixar per a tot el document, ambbodyText.paragraphContainerSpacing). Sota l'última referència aquest espai és elspaceBetweende l'estil, 2,8 mm, de manera que un:::space{lines=0.75}abans de l'agraïment obre 10,8 mm, a prop dels 10,6 mm que separen els altres paràgrafs d'un panell. Sense això, amb el'collapse'del document, després d'un grup ve una línia de la separació entre paràgrafs del panell: l'agraïment no necessita:::space, però la línia que s'afegeix sota −4,2 °C envia la franja de paraules clau a una segona pàgina.
Crèdits
- Recepta
- Ignacio Ferro
- Text
- Text original, CC BY 4.0
- Imatges
- The plan of the street, the heat map, the bar chart and the School of Geography's mark, drawn in code from synthetic data in the poster's palette · Ignacio Ferro · CC BY 4.0
- Fonts
- Rethink Sans (SIL OFL 1.1) · Bitter (SIL OFL 1.1) · Saira Condensed (SIL OFL 1.1)
- Codi
- MIT, com Postext
Editar aquest text ↗ (s'obre en una pestanya nova)Carpeta de la recepta a GitHub ↗ (s'obre en una pestanya nova)


