Pular para o conteúdo principal
Receita número 43

Receitas · Capítulo 2 · Tipo e texto

Tradução lado a lado, estrofe por estrofe

Cada poema é um boxe sem moldura com duas colunas: uma quebra fixa abre o inglês no título, e :::space deixa cada estrofe na altura do original.

Nesta página
Gênero
Poesia
Saída
Canvas
Postext
Testada com o Postext 1.65.0
Requer ≥ 1.34.0
Licença
Atualizada em 16 de out. de 2026
Código MIT · Texto CC BY 4.0
  • Amostra em inglês: ainda sem edição em português
  • Refile 156 × 234 mm
  • 1 coluna
  • Castoro 10,5/14,5
  • Castoro Titling
  • Tenor Sans
  • 5 páginas
  • Nível
  • Postext 1.57.1
  • Diagramado em 53 ms
  • 164 linhas de código

Em poucas palavras

Um livrinho de poemas com o espanhol de um lado e a tradução inglesa ao lado. Cada estrofe da tradução começa na mesma altura que a do original.

O que você vai compor

Uma plaquete bilíngue de cinco poemas sobre uma salina no sul da Espanha, em 156 × 234 mm, com o espanhol à esquerda e a versão inglesa da própria autora à direita, verso a verso. Abrem o livro uma folha de rosto com um flamingo e a nota da autora; os poemas começam sob uma aquarela de tanques cor-de-rosa, montes de sal e flamingos ao amanhecer. Cada poema fica num boxe sem moldura, sob um numeral cor de garança em Castoro Titling, com o espanhol numa coluna e o inglês na outra. O inglês começa na mesma linha que o espanhol, e cada estrofe começa na altura do original. Quando um verso inglês é longo demais para a coluna, o resto dele continua na linha de baixo com recuo de 2 em, e a estrofe espanhola em frente termina com uma linha em branco a mais.

Esta receita responde a

  • Como coloco duas colunas dentro de um boxe (uma coluna de texto ao lado de uma coluna com figura)?
  • Como componho poesia: um verso por linha, espaço entre estrofes, recuo deslocado nos versos que quebram e sem hifenização?
  • Como acrescento espaço vertical entre dois blocos, se as linhas em branco não fazem nada?
  • Como consigo boa justificação e hifenização em textos em espanhol, francês ou alemão?

A resposta curta

script.js · linhas 28–52no código completo
// Each poem is a box titled with its numeral, holding one two-column group. breaks="5"
// opens the second column at the group's 5th block, since the Spanish title and its three
// stanzas come before it. A :::space is not a block, so the gaps leave the count alone:
//   :::callout{type="poem" title="I"}
//   :::columns{count=2 breaks="5"}
//   Spanish title, :::space{lines=0.5}, its stanzas in :::verse blocks
//   English title, :::space{lines=0.5}, its stanzas in :::verse blocks
//   :::
//   :::
// Both columns open on the same line, so matching :::space gaps keep the stanzas level.
// keepTogether: false lets a poem that does not fit go on overleaf. A group with breaks is
// cut stream by stream (flow="parallel"): each language goes on in its own column, level.
const poem = {
  id: 'poem',
  backgroundEnabled: false, // no fill, border or stripe
  padding: { top: pt(0), right: pt(0), bottom: pt(0), left: pt(0) },
  columnGap: mm(GAP),
  titleStyle: { fontFamily: 'Castoro Titling', fontSize: pt(22), fontWeight: 400,
    color: col('madder'), gap: pt(4) },
  // A box starts on the first grid line at least two lines down, under the picture as under
  // a poem (12.3 mm there: its box ends off the grid). The default marginBottom (0.75 em)
  // would add to marginTop and open 17.4 mm between poems.
  marginTop: pt(LEAD * 2), marginBottom: pt(0),
  keepTogether: false, // a long poem goes on overleaf instead of moving whole
};

Ingredientes

Tipografia
Castoro, Castoro Titling, Tenor Sans (SIL OFL 1.1)
Materiais
  • flamingo-680.jpg
  • salina-1560.jpg
  • The salt pans at sunrise over the poems, a watercolour (Generated With Diffusion Models, original)
  • The flamingo on the title page, a watercolour (Generated With Diffusion Models, original)

Preparo

#1 · Um poema é um boxe com uma quebra de coluna fixa

O código está na resposta curta, mais acima. Cada poema é um boxe com um grupo :::columns dentro; o estilo dele tira o fundo e o preenchimento e imprime o title da linha de abertura, que é o numeral (:::columns). Sem breaks, o grupo corta onde as duas colunas ficam niveladas. As duas metades destes poemas têm a mesma altura, de modo que o corte cai no título inglês de qualquer maneira; mas alongue dois versos de The Rake até eles não caberem, e o corte desce um bloco e deixa THE RAKE no pé da coluna espanhola. breaks="5" indica o bloco que abre a segunda coluna, e o título inglês a encabeça seja qual for a altura das duas metades.

#2 · Um bloco :::verse por coluna, uma linha em branco por quebra de estrofe

script.js · linhas 56–64no código completo
// Each half of a poem is a :::verse block, a line of verse a line of Markdown and a blank line
// between stanzas. A line too long for its 55 mm column turns over 2 em in, where it cannot
// pass for the next line; the Spanish half then ends that stanza's block and a
// :::space{lines=2} before the next keeps the stanzas level across the gutter.
const verse = { id: 'verse', hangingIndent: em(2) };
// Castoro Titling draws capitals only. A :::space{lines=0.5} in the Markdown sets each title
// off its poem.
const poemTitle = { id: 'poem-title', fontFamily: 'Castoro Titling', fontSize: pt(9.5),
  color: col('madder'), firstLineIndent: pt(0) };

Cada metade de um poema é um bloco :::verse: um verso por linha do Markdown, em bandeira e sem hifenização, e uma linha em branco entre estrofes, que deixa uma linha em branco na coluna (:::verse). Cada estrofe é um bloco, por isso breaks conta estrofes, não versos. O verso inglês each one standing on its own reflection. é longo demais para a coluna de 55 mm e continua na linha de baixo com recuo de 2 em; a metade espanhola fecha o bloco depois da estrofe em frente e põe um :::space{lines=2} antes da seguinte, e as estrofes seguintes começam na mesma linha. Um :::space não é um bloco, e breaks não o conta (:::space).

O poema I na página 3: reflection. passa para a linha de baixo no inglês, e a estrofe espanhola termina com duas linhas em branco em vez de uma.

#3 · A nota é hifenizada na própria língua

script.js · linhas 68–82no código completo
const LOCALE = t({ en: 'en-us', es: 'es' }); // the patterns of the edition's language
const bodyText = {
  fontFamily: 'Castoro', fontSize: pt(10.5), lineHeight: pt(LEAD), color: col('ink'),
  italicColor: col('ink'), firstLineIndent: mm(4.5), indentAfterHeading: false,
  minWordSpacing: 0.8, maxWordSpacing: 1.35, // word spaces from 0.8 to 1.35 of normal
  // No bold on these pages: ink keeps a **bold** or a :ref added later off the default blue
  // (#295AA3). References take boldColor while referenceColor is unset.
  boldColor: col('ink'),
};
// The heading prints its title 36 mm down the text block, and the note starts under it.
const notePage = { id: 'note', advancedDesign: { enabled: true, slot: {
  elements: [{ kind: 'text', id: 'title', content: '{titleText}', align: 'left',
    fontFamily: 'Castoro Titling', fontSize: pt(13), color: col('madder'), overflow: 'wrap',
    placement: { anchor: { to: 'container', edge: 'top-left' }, offset: { y: mm(36) } } }],
} } };

locale escolhe os padrões de hifenização. Com 'es', a nota espanhola divide ori-ginal e Duna-liella; com os padrões ingleses as duas palavras vão inteiras para a linha seguinte, e só arras-traba se divide com ambos (idiomas suportados). Os espaços entre palavras podem encolher até 0,8 e esticar até 1,35 da largura normal, e nenhuma linha justificada das duas notas passa disso. O título da nota é um design de um único elemento, o próprio título, colocado 36 mm abaixo do topo da mancha, e assim a nota começa a 73 mm da borda superior da página.

#4 · A folha de rosto e a aquarela são títulos

script.js · linhas 86–114no código completo
const onPage = (y) => ({ anchor: { to: 'page', edge: 'top' }, offset: { y: mm(y) } });
const face = (id, content, font, size, y, extra = {}) => ({ kind: 'text', id, content,
  fontFamily: font, fontSize: pt(size), color: col('ink'), align: 'center', overflow: 'wrap',
  placement: onPage(y), ...extra });
const tracked = { letterSpacing: pt(2), textTransform: 'uppercase' };
const image = (id, placement) => ({ kind: 'image', id, resourceId: id, placement });
const titlePage = {
  id: 'title-page',
  header: { elements: [] }, footer: { elements: [] }, // no running head, no folio
  advancedDesign: { enabled: true, slot: { elements: [
    face('author', '{author}', 'Tenor Sans', 9, 44, { ...tracked, color: col('muted') }),
    face('title', '{titleText}', 'Castoro Titling', 34, 58, { lineHeight: 1 }),
    face('other', '{attr.other}', 'Castoro', 16, 76, { italic: true, color: col('madder') }),
    image('flamingo', { ...onPage(96), size: { width: mm(34) } }),
    face('edition', '{attr.edition}', 'Tenor Sans', 8.5, 170, tracked),
    face('version', '{attr.version}', 'Castoro', 10.5, 176, { italic: true }),
    face('press', '{attr.press}', 'Tenor Sans', 8, 206, { ...tracked, color: col('muted') }),
  ] } },
};
// The picture of the salt pans runs 84 mm down from the top edge of the page, and the heading
// reserves down to its foot. No margin under it: the poem's own marginTop sets the gap.
const poemsOpener = {
  id: 'poems', marginBottom: pt(0),
  advancedDesign: { enabled: true, slot: { elements: [
    image('salina', { anchor: { to: 'page', edge: 'top-left' }, size: { width: 'fill' } }),
    face('title', '{titleText}', 'Castoro Titling', 38, 17, { lineHeight: 1 }),
    face('other', '{attr.other}', 'Castoro', 15, 33, { italic: true, color: col('madder') }),
  ] } },
};

Cada uma é um título de nível 1 com estilo próprio (estilos de título): o design da folha de rosto pega {author} do front matter, e os dois designs pegam {attr.other} dos atributos do título. A aquarela está ancorada na borda superior da página, acima da mancha, e o título reserva até o pé dela, a 84 mm da borda. O estilo define marginBottom: pt(0), por isso o espaço sob a aquarela é a margem superior do próprio poema, de duas linhas, e o poema I começa na primeira linha da grade que fica pelo menos duas linhas abaixo da imagem.

#5 · Os cabeços nomeiam as duas línguas

script.js · linhas 118–132no código completo
const edgeAt = (edge, x, y) => ({ anchor: { to: 'page', edge }, offset: { x: mm(x), y: mm(y) } });
const head = (id, content, parity, placement, extra = {}) => ({ kind: 'text', id, content,
  parity, pages: 'body', fontFamily: 'Tenor Sans', fontSize: pt(7.5), color: col('muted'),
  ...tracked, letterSpacing: pt(1.5), placement, ...extra });
const folio = { color: col('ink'), letterSpacing: pt(0) };
const TITLES = ['Sal de agosto', 'August Salt']; // the book's title in its two languages
const header = { elements: [
  head('verso-folio', '{pageNumber}', 'even', edgeAt('top-left', OUTER, 12), folio),
  head('verso-title', TITLES[0], 'even', edgeAt('top-left', OUTER + 8, 12)),
  head('recto-title', TITLES[1], 'odd', edgeAt('top-right', -(OUTER + 8), 12)),
  head('recto-folio', '{pageNumber}', 'odd', edgeAt('top-right', -OUTER, 12), folio),
] };
// The note and the picture open their pages ('opener'): a folio at the foot instead.
const footer = { elements: [head('drop-folio', '{pageNumber}', 'all', edgeAt('bottom', 0, -12),
  { ...folio, pages: 'opener' })] };

A página par traz o título espanhol e a ímpar o inglês, na ordem das colunas. pages: 'body' tira os cabeços das três páginas que abrem com um título. A nota e a aquarela levam um fólio no pé no lugar deles, e o estilo da folha de rosto esvazia o cabeçalho e o rodapé (elementos de texto).

A receita completa

Sandbox
// ═══ Postext Cookbook · Nº 043 · Facing translation, stanza by stanza ═══════════════════
// https://postext.dev/en/cookbook/bilingual-facing-verse
// Code: MIT · Text: original (CC BY 4.0) · Salt pans and flamingo: diffusion models
// Fonts: Castoro, Castoro Titling, Tenor Sans (SIL OFL 1.1) · Needs postext ≥ 1.34.0
import {
  buildDocumentWithFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';

const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'bilingual-facing-verse';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
const palette = { // every colour in the config links to one of these
  ink: '#1f2430', // the text: a blue-black
  madder: '#9a3c52', // the one accent: numerals, poem titles, the other language's title
  muted: '#6a6770', // running heads, folios, the author's name, the colophon
  paper: '#ffffff',
};
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' } }));
const TRIM_W = 156, TRIM_H = 234; // mm
const TOP = 22, OUTER = 18, INNER = 20; // mm: the text block is 118 mm wide
const LEAD = 14.5; // pt: the leading of the note and of every line of verse
const GAP = 8; // mm between the original and the translation: each column is 55 mm wide

// #region answer: a poem and its translation: a box with two columns and a fixed break
// Each poem is a box titled with its numeral, holding one two-column group. breaks="5"
// opens the second column at the group's 5th block, since the Spanish title and its three
// stanzas come before it. A :::space is not a block, so the gaps leave the count alone:
//   :::callout{type="poem" title="I"}
//   :::columns{count=2 breaks="5"}
//   Spanish title, :::space{lines=0.5}, its stanzas in :::verse blocks
//   English title, :::space{lines=0.5}, its stanzas in :::verse blocks
//   :::
//   :::
// Both columns open on the same line, so matching :::space gaps keep the stanzas level.
// keepTogether: false lets a poem that does not fit go on overleaf. A group with breaks is
// cut stream by stream (flow="parallel"): each language goes on in its own column, level.
const poem = {
  id: 'poem',
  backgroundEnabled: false, // no fill, border or stripe
  padding: { top: pt(0), right: pt(0), bottom: pt(0), left: pt(0) },
  columnGap: mm(GAP),
  titleStyle: { fontFamily: 'Castoro Titling', fontSize: pt(22), fontWeight: 400,
    color: col('madder'), gap: pt(4) },
  // A box starts on the first grid line at least two lines down, under the picture as under
  // a poem (12.3 mm there: its box ends off the grid). The default marginBottom (0.75 em)

O script.js montado funciona como está: cole-o como script de módulo em qualquer página ou abra a receita no CodePen. Pasta da receita no GitHub ↗ (abre em uma nova aba)

Variações

#Alargar a medianiz

Com 12 mm, as colunas ficam com 53 mm, e Los turistas paran y hacen fotos: deixa de caber no poema III, de modo que a segunda estrofe começa uma linha abaixo da inglesa; feche o bloco inglês depois dessa estrofe e ponha um :::space{lines=2} antes da seguinte para nivelá-las.

-const GAP = 8; // mm between the original and the translation: each column is 55 mm wide
+const GAP = 12; // mm between the original and the translation: each column is 53 mm wide

#Recuar mais os versos que não cabem

Com 3 em, reflection. na página 3 começa um em mais para dentro.

-const verse = { id: 'verse', hangingIndent: em(2) };
+const verse = { id: 'verse', hangingIndent: em(3) };

Erros comuns

  • Um :::space posto antes do título inglês desaparece: a segunda coluna abre no bloco que breaks indica, e o espaço cai no corte. Ponha-o depois do título, como o :::space{lines=0.5} sob o título de cada coluna aqui.
  • Conte breaks a partir do título espanhol: com um título e três estrofes, o título inglês é o bloco 5. Cada estrofe é um bloco, por isso uma estrofe espanhola a mais leva o título inglês para o bloco 6, e breaks precisa subir junto; um verso a mais dentro de uma estrofe não muda nada.

Créditos

Texto
  • The poem cycle Sal de agosto and its English version, August Salt, with the author’s note, written for this recipe; the poet Adela Membrives is fictional · Postext Cookbook · CC BY 4.0
Imagens
  • The salt pans at sunrise over the poems, a watercolour · Generated With Diffusion Models · original
  • The flamingo on the title page, a watercolour · Generated With Diffusion Models · original
Fontes
Castoro (SIL OFL 1.1) · Castoro Titling (SIL OFL 1.1) · Tenor Sans (SIL OFL 1.1)
Sandbox