In short
Eight pages of an invented daily newspaper. The first four are news on grey-white paper; the business pages that follow are printed on salmon paper, with narrower columns and their own colours.
What you'll build
Eight pages of The Marrowick Ledger, an invented daily, on the 315 × 470 mm Berliner sheet. Pages 1 to 4 carry the news on grey-white newsprint in five ruled columns, with a red section flag on each page. From page 5 the paper changes. The Business section is printed on salmon stock, as financial pages have been for well over a century: the page turns #f2d3c0, the grid tightens to six columns, the accent turns from red to petrol, and a strip of the day's market closes sits under the section title. Inside it are a markets page with a year of the city's index, a sector chart and four data tables, company news, and a page of share prices. In Folio's 3D view the sheets fold one inside the other and the last four pages come off a salmon stock.
This recipe answers
- How do I show a newspaper in the 3D viewer as folded sheets, with the business pages on salmon paper?
- How do I print a cover, an insert or a plate section on a different paper from the rest of the book?
- How do I set a newspaper page: five columns on a broadsheet, a picture across two of them and a story box across three?
- How do I divide a book into parts or sections, each with its own colour and divider page?
The short answer
// page.backgroundColor links to 'paper', so the section's palette, which turns 'paper' salmon,
// repaints every page of the section: the opener and the pages its copy runs on to.
const business = {
id: 'business',
advancedDesign: { enabled: true, slot: { elements: flagParts } },
// The swap: the page, flags, kickers, the folio line, chart marks and table heads follow.
palette: { paper: palette.salmon, accent: palette.petrol, tint: '#e6bfa8' },
// Six narrower columns, ruled as the news pages are.
layout: { layoutType: 'multiple', columnCount: 6, gutterWidth: mm(4) },
bodyStyle: { fontSize: pt(8.8), lineHeight: pt(LEAD) },
};
// The section front: the same style, with a bigger flag over the market close strip.
const front = () => ({ ...business, id: 'business-front', advancedDesign: { enabled: true, slot: {
elements: [depth(10),
text('title', 'Business', { fontFamily: 'Playfair Display', fontSize: pt(58), fontWeight: 900,
lineHeight: 1, color: col('accent') }, at('container', 'top-left', 0, -1)),
text('tag', FLAG, caps(9, 700, 'accent'),
at('#title', 'right-of', 5, 9)),
rule('top', 3, at('#title', 'below', 0, 2)),
...STRIP().flatMap(([name, value, change], i) => [ // the day's close, from the market data
text(`s${i}`, name, caps(7, 700, 'muted'), at('#top', 'below', (i * WIDE) / 6, 1.8)),
text(`v${i}`, value, sans(13, 700), at(`#s${i}`, 'below', 0, 0.6)),
text(`c${i}`, change, sans(9.5, 600, { color: col(change[0] === '+' ? 'accent' : 'muted') }),
at(`#v${i}`, 'right-of', 1.6, 1))]),
rule('under', 0.5, at('#depth', 'align-bottom', 0, -1.4))] } } });
// hook-up: headingStyles lists both, and the Markdown wraps pages 5–8 in
// :::paper{type="newsprint" shade="#faede6"} ← the stock Folio prints them on
// # Business {style="business-front"} … # Markets {style="business"} … :::
One heading style turns a page into a Business page
Ingredients
- Features
- A different paper for a run of pagesThree or more columnsFolded newspaper (Folio)Newspaper trim sizesFloats across several columnsHeading stylesSection geometryColours per partPaper colourDesigned openersAnchoring design elementsRunning heads and foliosColumn ruleBoxes across the pageFloated boxesColumns in a box or in the textNamed table stylesFigure placementFigures exactly herePaper, binding, desk and light (Folio)
- Also uses
- Callout boxesCitations that place figuresHeading attributesFull-width chapter bandParagraph stylesCustom resource typesFigures and tables as resourcesRunning heads per sectionExplicit vertical space
- Type
- Source Serif 4, Playfair Display, Archivo Narrow (SIL OFL 1.1)
- Assets
apprentices-1536.jpgbakery-1536.jpgbarrier-1800.jpgcartoon-1280.jpgcranes-1800.jpgferry-1536.jpg- The tidal barrier in a storm (page 1) (Generated With Diffusion Models, CC BY 4.0)
- Apprentices welding in the shipyard (page 2) (Generated With Diffusion Models, CC BY 4.0)
- The island ferry leaving Skerra pier (page 3) (Generated With Diffusion Models, CC BY 4.0)
- The editorial cartoon (page 4) (Generated With Diffusion Models, CC BY 4.0)
- Container cranes at dawn (page 5) (Generated With Diffusion Models, CC BY 4.0)
- A bakery production line (page 7) (Generated With Diffusion Models, CC BY 4.0)
- The gate diagram, the port and index charts and the market tables, drawn in code (Ignacio Ferro, CC BY 4.0)
Method
#1 · Two papers in one palette
const palette = {
ink: '#16181b', // text and heavy rules
paper: '#f6f4ef', // the page: grey-white newsprint (salmon in Business)
accent: '#b3261e', // news red: flags, kickers, chart marks (petrol in Business)
tint: '#e8e4da', // box fills (a deeper salmon in Business)
rule: '#9d9a93', // hairlines
muted: '#5c5954', // bylines, the folio line, credits
salmon: '#f2d3c0', // the business stock, and the teaser patches on page 1
petrol: '#0f4c5c', // the business accent
};
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = [
...Object.entries(palette).map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } })),
{ id: 'main-color', name: 'ink (defaults)', value: { hex: palette.ink, model: 'hex' } },
];
Every colour in the configuration links to one of eight palette entries. The news pages use paper (#f6f4ef) for the page and accent (#b3261e) for flags, kickers and chart marks. The Business pages keep those links and change the values: the section palette sets paper to salmon, accent to petrol (#0f4c5c) and tint to a deeper salmon. salmon has an entry of its own as well, for the ear and the teaser strip on page 1, which stay salmon on the white pages.
#2 · One heading style makes a page a Business page
The code is the short answer above. # Markets {style="business"} opens a section, and its pages take the style's palette, layout and bodyStyle: six columns with a 4 mm gutter (45.2 mm each, against 54.6 mm in the news), body at 8.8 pt on the same 11.4 pt leading. The page colour follows the palette as well. page.backgroundColor links to paper, and when a section's palette gives paper another value, every page of the section is painted in it: the page its heading opens and any page its copy runs on to. So the Business pages turn salmon edge to edge, and the column rule, which the style's layout leaves as the document sets it, runs between the six columns as it does between the five.
#3 · Every page opens on a flag
const flagParts = [
depth(3),
rule('bar', 3, at('#depth', 'align-bottom', 0, -1.4)),
text('flag', '{titleText}', { ...caps(12, 700, 'paper'), box: patch('accent', pad(1.3, 3.5)) },
at('#bar', 'above')),
];
const FOLIO = 9; // mm from the top edge
const folioLine = (parity, side, s) => [ // s: +1 on a verso (folio on the left), −1 on a recto
text(`n-${parity}`, '{pageNumber}', { ...sans(11, 700), align: side },
at('page', `top-${side}`, s * M.side, FOLIO)),
text(`t-${parity}`, '{title} · {publishDate}', { ...caps(7.5, 600, 'muted'), align: side },
at(`#n-${parity}`, s > 0 ? 'right-of' : 'left-of', s * 3, 1)),
text(`c-${parity}`, '{chapterTitle}', { ...caps(7.5, 700, 'accent'),
align: s > 0 ? 'right' : 'left' }, at('page', `top-${s > 0 ? 'right' : 'left'}`,
-s * M.side, FOLIO + 1)),
].map((element) => ({ ...element, parity }));
const header = { elements: [...folioLine('even', 'left', 1), ...folioLine('odd', 'right', -1),
{ kind: 'rule', id: 'folio-rule', thickness: pt(0.5), color: col('ink'), placement: {
...at('page', 'top-left', M.side, FOLIO + 5), size: { width: mm(WIDE) } } }] };
The H1 is a page-wide opener with breakBefore parity 'any', so each heading opens the next page whatever its side. Its design is a flag on a 3 pt bar, three grid lines deep. The folio line is a header anchored 9 mm from the top edge: page number, paper and date on the outside, {chapterTitle} on the inside in the accent, which the palette turns petrol on the salmon pages.
#4 · Pictures and charts across k columns
const unnumbered = (id, name, captionStyle) => ({ id, name, shortLabel: name, captionPrefix: '',
numberingTemplate: '', resetOn: 'never', counterFormat: 'decimal', captionStyle });
const resourceTypes = [unnumbered('picture', 'Picture'),
unnumbered('panel', 'Panel', { position: 'above', fontSize: pt(9.5) })];
const res = (id, typeId, kind, body, extra) => ({ id, typeId, kind, [kind]: body,
createdAt: 0, updatedAt: 0, ...extra });
const photo = (id, file, [w, h], placement, resolution) => res(id, 'picture', 'bitmap',
{ fileId: file, format: 'jpeg', width: w, height: h, ...(resolution && { resolution }) },
{ placement, ...CAPTIONS[id] });
const drawing = (id, [w, h], placement) => res(id, 'picture', 'svg',
{ fileId: `${id}.svg`, width: w, height: h }, { placement, ...CAPTIONS[id] });
const data = (id, model, caption, note) => res(id, 'panel', 'table', { model },
{ placement: here, caption, note });
const top = (columns) => ({ position: 'top', columns }); // a float across k columns
const here = { position: 'here' }; // in the flow: in a column, or across a box
const resources = [
photo('barrier', 'barrier-1800.jpg', [1800, 1106], here), // in the banner box: page-wide
photo('welders', 'apprentices-1536.jpg', [1536, 1024], top(3)),
drawing('gate', [1130, 500], top(3)),
photo('ferry', 'ferry-1536.jpg', [1536, 1024], top(4)),
photo('cartoon', 'cartoon-1280.jpg', [1280, 853], top(4), 140),
photo('cranes', 'cranes-1800.jpg', [1800, 750], here),
drawing('throughput', [1130, 700], top(2)),
drawing('mx40', [2910, 1000], here), drawing('sectors', [2910, 880], here),
photo('loaves', 'bakery-1536.jpg', [1536, 1024], top(3)),
// The tables sit where the text names them: no float.
...Object.entries(TABLES).map(([id, [model, caption, note]]) => data(id, model, caption, note)),
...SECTORS.map((_, i) => res(`prices-${i + 1}`, 'panel', 'table',
{ styleId: 'prices', model: pricesTable(i, 21) }, { placement: here })),
];
top(3) is placement: { position: 'top', columns: 3 }: the shipyard photograph takes three of the five news columns, the ferry four, the bakery three of the six Business columns and the port chart two. A float cited from a paragraph in column 1 takes the head of the next columns that are still empty, so these pictures start in column 2 and the story runs down beside them. Such a picture stays with its story only while no other story is set below it on that page: a page-wide story placed after it can carry the picture into its own band or on to the next page. So pages 2 and 3 close on an advertisement floated to the foot rather than on one more story. The photographs that span the whole page sit inline (here) in the banner box under their headline. The tables sit in the flow too, inside page-wide boxes at the foot.
#5 · Headlines, panels, data and adverts are boxes
const none = pad(0, 0);
const banner = { id: 'banner', backgroundEnabled: false, padding: none,
titleStyle: { ...caps(8.5, 700, 'accent'), gap: mm(1.2) }, // the kicker
marginTop: pt(0), marginBottom: pt(LEAD / 2),
body: { fontFamily: 'Source Serif 4', fontSize: pt(13), lineHeight: pt(16.5), textAlign: 'left',
firstLineIndent: pt(0) } };
const story = { ...banner, id: 'story', marginTop: pt(LEAD), padding: { ...none, top: mm(2.5) },
stripe: { enabled: true, side: 'top', width: pt(1), color: col('ink') } };
const boxBody = { fontFamily: 'Archivo Narrow', fontSize: pt(9.5), lineHeight: pt(LEAD),
textAlign: 'left', firstLineIndent: pt(0), paragraphSpacing: true, boldColor: col('accent') };
const briefs = { id: 'briefs', background: col('tint'), padding: pad(2.8, 3),
titleStyle: { ...caps(9, 700, 'accent'), gap: mm(1.5) }, body: boxBody };
const teaser = { ...briefs, id: 'teaser', background: col('salmon'), columnGap: mm(4.5),
body: { ...boxBody, fontSize: pt(10.5), lineHeight: pt(13.5) } };
const panel = { ...story, id: 'panel', marginTop: pt(0), titleStyle: briefs.titleStyle,
stripe: { ...story.stripe, width: pt(2.5), color: col('accent') },
body: { ...boxBody, fontFamily: 'Source Serif 4' } };
const dataBox = { ...story, id: 'data', marginTop: pt(0), columnGap: mm(4.5) };
const ad = { id: 'ad', backgroundEnabled: false, marginTop: pt(LEAD),
border: { enabled: true, color: col('ink'), width: pt(0.75) },
padding: { ...pad(6, 6), top: mm(3) },
titleStyle: { ...caps(6.5, 600, 'muted'), gap: mm(4) },
body: { ...boxBody, fontSize: pt(14), lineHeight: pt(18), boldColor: col('ink') } };
const pullQuote = { ...story, id: 'quote', columns: 2, marginTop: pt(0),
body: { ...banner.body, fontFamily: 'Playfair Display', fontSize: pt(19), lineHeight: pt(23),
italic: true } }; // a pull quote, floated across two columns
const headline = (id, size, look = {}) => ({ id, fontSize: pt(size), lineHeight: pt(size * 1.04),
marginBottom: pt(size * 0.2), ...look });
A headline across the page is a frameless page-wide box holding an H2 in one of three sizes, and a 1 pt rule above it marks the next story. On page 5 the panel The terminal in numbers floats across two of the six columns (columns="2" on its fence), and the pull quote on page 4 does the same through columns: 2 in its style. The data boxes hold two to four tables side by side in a :::columns group, and the advertisements are page-wide boxes floated to the foot, framed in a 0.75 pt rule.
#6 · The stock Folio prints on
The news pages need nothing: folio.paper is newsprint at 45 g/m², and binding: { type: 'folded', cover: 'pages' } nests the two folded sheets with page 1 outside and page 8 as the back. The Business pages sit in one run:
:::paper{type="newsprint" shade="#faede6"}
# Business {style="business-front"}
…
# Share prices {style="business"}
…
:::Each page in the run carries page.paper with that shade, and Folio prints it on that stock. The shade is the page colour taken 60 % of the way to white (README §4): the flat page already paints #f2d3c0, and a full salmon stock under it would tint it twice. The canvas, the HTML and the PDF ignore :::paper and paint the page colour, which is why the section palette sets paper too.
The whole recipe
// ═══ Postext Cookbook · Nº 134 · A business section on salmon newsprint ═══
// https://postext.dev/en/cookbook/business-section-on-salmon
// Code: MIT · Text: original (CC BY 4.0) · Pictures: generated (CC BY 4.0)
// Fonts: Source Serif 4, Playfair Display, Archivo Narrow (SIL OFL 1.1) · Needs postext ≥ 1.65.0
//
// Eight pages: four of news in five columns, then Business on salmon paper in six.
// One heading style carries the change; a :::paper run gives Folio the salmon stock.
import {
buildDocumentWithFonts, renderPageToCanvas, registerResourceImage, inlineSvgFonts,
} from 'https://esm.sh/postext';
const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'business-section-on-salmon';
// ─── 1 · Design ───
// #region palette: newsprint, ink and a news red; the Business section swaps three of them
const palette = {
ink: '#16181b', // text and heavy rules
paper: '#f6f4ef', // the page: grey-white newsprint (salmon in Business)
accent: '#b3261e', // news red: flags, kickers, chart marks (petrol in Business)
tint: '#e8e4da', // box fills (a deeper salmon in Business)
rule: '#9d9a93', // hairlines
muted: '#5c5954', // bylines, the folio line, credits
salmon: '#f2d3c0', // the business stock, and the teaser patches on page 1
petrol: '#0f4c5c', // the business accent
};
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = [
...Object.entries(palette).map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } })),
{ id: 'main-color', name: 'ink (defaults)', value: { hex: palette.ink, model: 'hex' } },
];
// #endregion
const PAGE = { width: 315, height: 470 }; // mm: the 'berliner' preset
const M = { top: 19, bottom: 14, side: 12 }; // mm: narrow newspaper margins, not mirrored
const WIDE = PAGE.width - 2 * M.side; // the text block's width
const LEAD = 11.4; // pt: the body leading, the same in both sections so the grid holds
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });
const text = (id, content, look, placement) => ({ kind: 'text', id, content, align: 'left',
overflow: 'wrap', color: col('ink'), ...look, placement }); // no text ends in an ellipsis
const sans = (size, weight = 400, look = {}) => ({ fontFamily: 'Archivo Narrow',
fontSize: pt(size), fontWeight: weight, ...look });
const caps = (size, weight, colour = 'ink') => sans(size, weight, { color: col(colour),
textTransform: 'uppercase', letterSpacing: pt(size * 0.16) });
const rule = (id, weight, placement) => ({ kind: 'rule', id, thickness: pt(weight),
color: col('ink'), placement: { ...placement, size: { width: 'fill' } } });
const box = (id, style, placement, size) => ({ kind: 'box', id, style, placement: { ...placement,
size } }); // an empty box a whole number of grid lines deep sets an opener's depth:
const depth = (lines) => box('depth', {}, at('container', 'top-left'), { width: 'fill',
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
#Change the paper and keep the grid
A heading style with a palette and no layout keeps the document's five ruled columns and still paints every page of its section: { id: 'weekend', palette: { paper: '#efe6cf' } } puts a weekend supplement on cream newsprint. Wrap its pages in a :::paper run too, with the shade taken 60 % of the way to white, so Folio prints them on a matching stock.
#Make the Business section a pull-out
The eight pages fold as two sheets, one inside the other: pages 1–2 and 7–8 on the outer sheet, 3–6 on the inner one. Folio gives each leaf the stock of its recto, so pages 7–8 come out salmon, though a press would print them on the same sheet as the front page. Move the Business pages to 3–6 and they make up the inner sheet, which a press can run on salmon stock and a reader can pull out whole.
Pitfalls
Pitfall
A page-span heading always opens a new page
A heading whose level or style sets span: 'page' is laid out as an opener at the head of a page, whether or not it has a breakBefore. Placed after other text, or after another opener on the same page, it moves to the next page and leaves the rest of the current one empty. A banner headline across both columns (or both tiers of a vertical page) under a masthead goes into the opener's own design, next to the masthead, or into a :::callout{span="page"} box as a heading without span, as newspaper-front-page sets its banners. Designed openers →
Pitfall
A paper run starts and ends on a new page, and a leaf takes its recto's paper
Text inside :::paper starts on a new page and the text after it does too. A leaf has two pages and one paper, its recto's, so a run that starts on a verso prints that page on the paper of the leaf it shares. Put a page break where a run should start on a recto. A different paper for a run of pages →
Pitfall
cover: 'pages' needs an even page count for the back board
With binding.cover set to 'pages' the first page turns as the front board and the last page as the back board only when it falls on a verso. An odd page count leaves the book with a front cover and no back: pad it to an even count or keep the case. Paper, binding, desk and light (Folio) →
Credits
- Recipe
- Ignacio Ferro
- Text
- Original prose, CC BY 4.0
- Images
- The tidal barrier in a storm (page 1) · Generated With Diffusion Models · CC BY 4.0
- Apprentices welding in the shipyard (page 2) · Generated With Diffusion Models · CC BY 4.0
- The island ferry leaving Skerra pier (page 3) · Generated With Diffusion Models · CC BY 4.0
- The editorial cartoon (page 4) · Generated With Diffusion Models · CC BY 4.0
- Container cranes at dawn (page 5) · Generated With Diffusion Models · CC BY 4.0
- A bakery production line (page 7) · Generated With Diffusion Models · CC BY 4.0
- The gate diagram, the port and index charts and the market tables, drawn in code · Ignacio Ferro · CC BY 4.0
- Fonts
- Source Serif 4 (SIL OFL 1.1) · Playfair Display (SIL OFL 1.1) · Archivo Narrow (SIL OFL 1.1)
Edit this write-up ↗ (opens in a new tab)Recipe folder on GitHub ↗ (opens in a new tab)


