Vai al contenuto principale
Ricetta numero 59

Ricettario · Capitolo 1 · Pagina e griglia

Poster scientifico su una sola grande pagina

Un poster di 600 × 800 mm: fascia del titolo su tre colonne di riquadri in un gruppo a tutta pagina, mappa di calore con campioni e −4,2 °C a 150 pt.

  • Esempio in inglese: non c’è ancora un’edizione italiana
  • Formato 600 × 800 mm
  • 2 colonne, Intercolonna di 12 mm
  • Rethink Sans 28/38
  • Bitter
  • Saira Condensed
  • 1 pagina
  • Livello
  • Postext 1.57.1
  • Impaginato in 63 ms
  • 203 righe di codice

In breve

Un grande poster per un convegno scientifico, sugli alberi stradali e il caldo estivo. Mostra come disporre riquadri di testo e grafici in colonne su un’unica pagina molto grande.

Che cosa comporrai

Un poster da convegno per un immaginario studio sugli alberi stradali e il calore dei marciapiedi, composto su un’unica pagina di 600 × 800 mm. Una fascia verde contiene il nome del convegno, il titolo in Bitter a 110 pt, gli autori con i segni di affiliazione e il marchio della School of Geography. Sotto un riassunto a due colonne, un gruppo :::columns attraversa entrambe le colonne del testo e compone sei riquadri in tre colonne, ciascuno un riquadro sotto una striscia di 6 pt. La colonna centrale si apre con −4,2 °C in arancione a 150 pt, poi una mappa di calore dell’aria per isolato e ora, con una legenda di campioni di colore, e un grafico a barre della pavimentazione. Una striscia colorata di chip con le parole chiave sta sul margine inferiore. Lo stesso file compone un’edizione spagnola, e il pen offre la pagina come PNG di 1.701 × 2.268 px.

Questa ricetta risponde a

  • Come compongo un riquadro su entrambe le colonne a metà pagina, come un pannello «in cifre» a tre elementi?
  • Come metto due colonne dentro un riquadro (una colonna di testo accanto a una colonna con una figura)?
  • Come aggiungo campioni di colore come legenda nel testo, nelle didascalie o nelle note di tabella?

La risposta breve

script.js · righe 86–107nel codice completo
// 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') } };

Ingredienti

Tipo
Rethink Sans, Bitter, Saira Condensed (SIL OFL 1.1)
Risorse
  • 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)

Preparazione

#1 · Imposta il foglio a 72 dpi

script.js · righe 38–48nel codice completo
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

Ai 300 dpi predefiniti il poster va a capo in ogni riga dove ci va a 72 dpi, ma la sua pagina misura 7.087 × 9.449 px, ovvero 268 MB di pixel una volta disegnata (preset di formato della pagina). A 72 dpi un punto è un pixel. Il visualizzatore disegna le miniature con renderPageToCanvas e una scale, e renderPage dà il PNG di 1.701 × 2.268 px che chiede la galleria online di un convegno (rendering di una pagina in bitmap). L’interlinea divide i 750 mm tra i margini in 56 righe, così la striscia delle parole chiave fatta flottare al piede della pagina finisce sul margine inferiore. Con un valore tondo di 38 pt ci stanno solo 55 righe, l’ultima a 12,7 mm dal margine; la striscia delle parole chiave non sta più sotto i riquadri e passa a una seconda pagina.

#2 · Disegna la fascia del titolo dal titolo

script.js · righe 53–82nel codice completo
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 ha come attributi il convegno, il numero del poster, gli autori e le affiliazioni, e la sua grafica li colloca sopra un riquadro verde ancorato alla pagina, profondo 158 mm (estensione e grafica avanzata). Il riquadro finisce 133 mm sotto il margine superiore. Senza un minHeight il riassunto comincerebbe 0,9 mm sotto il verde; un minHeight di undici righe della griglia lascia 14 mm. I segni di affiliazione sono i caratteri ¹ ² ³, le sole cifre in apice nell’intervallo Latin-1.

#3 · Componi i pannelli in un gruppo su tutta la pagina

script.js · righe 86–107nel codice completo
// 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') } };

Il testo scorre in due colonne e i riquadri in tre, quindi la griglia è un gruppo :::columns{count=3} aperto direttamente nel testo, e span="page" lo colloca su entrambe le colonne del testo, sotto il riassunto, con l’intercolonna della pagina tra le sue colonne (:::columns). Da solo, un gruppo nel testo è seguito da una riga di spaziatura tra paragrafi, qui 38 pt, e la striscia delle parole chiave passerebbe a una seconda pagina; marginBottom="0.75em" sul blocco prende il posto di quella riga (postext 1.28), e la striscia sta al piede della pagina. Ogni riquadro è un blocco :::callout nel gruppo: prende il suo stile, la larghezza di 175 mm della colonna e 18 mm di marginTop sotto il riquadro precedente (il contenitore :::callout). breaks="3,4" manda il terzo riquadro, Results, in testa alla colonna centrale e il quarto, Conclusions, in testa all’ultima. Senza, il gruppo si bilancia e taglia al riquadro più vicino a ogni terzo della pila. Con questo testo i tagli cadono sugli stessi due riquadri; l’attributo li tiene lì quando il testo cambia.

#4 · Tieni ogni figura nel suo pannello

script.js · righe 156–163nel codice completo
// "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 collocata 'here' resta nel riquadro in cui ::resource la mette; con la collocazione predefinita i tre disegni lasciano i loro riquadri e il poster arriva a una seconda pagina. numberingTemplate: '{n}' li numera 1, 2, 3, dove il {h1}.{n} predefinito stampa Figure 1.1 sotto un titolo che è un H1 (tipi di risorsa). La nota sotto ogni didascalia avverte che i dati sono sintetici.

#5 · Condividi i colori della mappa di calore con la sua legenda

script.js · righe 15–34nel codice completo
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' } },
];

Le celle della mappa di calore e le quattro sequenze :swatch{color="…"} della sua legenda usano le stesse voci della tavolozza, così un nuovo valore per cool ricolora insieme la mappa e la legenda (formattazione in linea). La legenda è un secondo gruppo :::columns, due voci per colonna, nel riquadro Results.

#6 · Componi la cifra principale in uno stile di paragrafo

script.js · righe 111–128nel codice completo
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) } };

Gli stili di paragrafo si applicano anche nei riquadri, quindi −4,2 °C è un blocco :::paragraphs{style="stat"} in Bitter a 150 pt nel riquadro Results (stili di paragrafo). La cifra è scritta in grassetto, quindi si stampa in Bitter 700 e nel boldColor dello stile, l’arancione del riquadro. Un secondo stile dà ai riferimenti un rientro sporgente di 9 mm. La striscia delle parole chiave è un riquadro colorato con placement="bottom", fatto flottare al piede della pagina sotto la griglia.

La ricetta completa

Sandbox
// ═══ 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 = 'en'; // @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

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

#Esporta l’e-poster a 150 dpi

Un convegno che chiede un file più grande riceve un PNG di 3.543 × 4.724 px con le stesse divisioni di riga.

-  dpi: 72, backgroundColor: col('paper'),
+  dpi: 150, backgroundColor: col('paper'),

Errori frequenti

  • Rethink Sans disegna una singola cifra tra parentesi, come il numero del fascicolo in 11(3), come una cifra cerchiata sul canvas, quindi i riferimenti danno solo il volume e le pagine.
  • Un riquadro a tutta larghezza che chiude il documento passa a una nuova pagina a meno che sotto non resti lo spazio di due righe di testo. Per questo la striscia delle parole chiave flotta con placement="bottom", che la colloca sul margine inferiore, nei 50 mm rimasti sotto la griglia.
  • containerSpacing: 'add' sugli stili stat e refs chiude i loro gruppi :::paragraphs sullo spazio proprio dello stile, il che tiene −4,2 °C sulla riga che lo spiega; ogni altro gruppo del poster segue la regola del documento (da postext 1.28; prima la regola si poteva impostare solo per l’intero documento, con bodyText.paragraphContainerSpacing). Sotto l’ultimo riferimento quello spazio è lo spaceBetween dello stile, 2,8 mm, quindi un :::space{lines=0.75} prima dei ringraziamenti apre 10,8 mm, vicino ai 10,6 mm tra gli altri paragrafi di un riquadro. Senza, con il 'collapse' del documento, un gruppo è seguito da una riga della spaziatura tra paragrafi del riquadro: i ringraziamenti non richiedono :::space, ma la riga che aggiunge sotto −4,2 °C spinge la striscia delle parole chiave a una seconda pagina.

Crediti

Testo
Testo originale, CC BY 4.0
Immagini
  • 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
Font
Rethink Sans (SIL OFL 1.1) · Bitter (SIL OFL 1.1) · Saira Condensed (SIL OFL 1.1)
Sandbox