Em poucas palavras
Um impresso legislativo curto. Mostra a redação antiga de uma lei com as palavras retiradas riscadas e as novas sublinhadas, depois a seção inteira já alterada em um boxe cinza.
O que você vai compor
Um impresso de comissão como os que acompanham um projeto de lei: cinco páginas que mostram o que a seção 102 do Sonny Bono Copyright Term Extension Act, de 1998, fez com o título 17 do United States Code. A lei diz apenas “suprima ‘fifty’ e insira ‘70’”; este impresso compõe a lei como era, com cada alteração marcada no lugar, as supressões tachadas e os acréscimos sublinhados, sob a legenda que os redatores federais e estaduais imprimem acima desses textos, e depois a seção 302 alterada em um boxe tingido, cada letra na borda e as suas linhas recuadas sob o texto. A edição espanhola faz o mesmo com as três reformas da Constituição espanhola, publicadas no BOE em 1992, 2011 e 2024.
Esta receita responde a
- Como mostro uma alteração com as palavras suprimidas tachadas e as acrescentadas sublinhadas?
A resposta curta
// In the text, ~~fifty~~ strikes a deleted word and :underline[70] underlines the new one.
// Both lines are painted from the face's own metrics and take no room, so the struck and
// the inserted words justify and hyphenate like any others. The amended text then sits in
// a box whose paragraphs hang: '(a)', a tab, and every turnover line under the text.
const label = { fontFamily: SANS, fontSize: pt(7.5), fontWeight: 700, letterSpacing: pt(1.1),
textTransform: 'uppercase', color: col('accent') };
const clauses = { fontFamily: SERIF, fontSize: pt(9.5), lineHeight: pt(13), color: col('ink'),
boldColor: col('ink'), italicColor: col('ink'), textAlign: 'left', // a box's measure is short
hangingIndent: HANG, // every line but the first starts 7 mm in (postext ≥ 1.71)
tabStops: [{ position: HANG }] }; // and the tab after the marker takes the text there
const pad = (v, h) => ({ top: mm(v), right: mm(h), bottom: mm(v), left: mm(h) });
const calloutStyles = [
// The coding legend: a red rule down its side, the label face.
{ id: 'legend', backgroundEnabled: false,
stripe: { enabled: true, side: 'left', width: pt(2.5), color: col('accent') },
padding: pad(1.5, 3.5), body: { fontFamily: SANS, fontSize: pt(9), lineHeight: pt(12.5),
color: col('ink'), boldColor: col('accent'), firstLineIndent: pt(0), textAlign: 'left' } },
// The bill's own words: a red rule on top, clauses hung, no tint.
{ id: 'bill', backgroundEnabled: false,
stripe: { enabled: true, side: 'top', width: pt(2.5), color: col('accent') },
padding: pad(2.5, 0), body: clauses, keepTogether: false, // it may run on to the next page
// its title keeps its case: "(b)" stays "(b)"
titleStyle: { ...label, textTransform: 'none', letterSpacing: pt(0.2), fontSize: pt(8.5),
color: col('ink') } },
// The text as amended: a tint, the clauses hung the same way.
{ id: 'amended', background: col('tint'), padding: pad(3.5, 4.5), titleStyle: label,
body: clauses },
];
Ingredientes
- Funcionalidades
- TachadoSublinhadoParágrafos com recuo deslocado em um boxeParadas de tabulação e pontilhadosBoxesBoxes que se dividem ou ficam inteirosPaleta de cores semânticaAberturas desenhadasAtributos de títuloCabeços e fóliosCabeços por tipo de páginaMargens espelhadasEstilos de parágrafoViúvas, órfãs e linhas curtasExportação para PDFFontes incorporadas ao PDF
- Tipografia
- Source Serif 4, Source Sans 3 (SIL OFL 1.1)
- Materiais
- Nenhum: todas as imagens são desenhadas em código
Preparo
#1 · Marque a alteração onde ela acontece
O código está na resposta curta acima. As marcas ficam no Markdown: ~~fifty~~ :underline[70] tacha a palavra antiga e sublinha a nova (tachado, sublinhado). Nenhuma das duas linhas ocupa espaço: uma cláusula tachada de seis linhas se justifica e se hifeniza como o texto ao redor, e na página 3 toda a antiga subseção 304(b) está tachada e a sua substituta sublinhada em um único parágrafo. Cada linha segue as medidas de tachado e de sublinhado da própria fonte, na cor das palavras, de modo que os versaletes de uma rubrica ganham uma linha própria, na altura deles.
#2 · As cláusulas com recuo deslocado no boxe
body.hangingIndent em um estilo de boxe aplica recuo deslocado a todos os parágrafos do boxe (tipografia dentro de um boxe): a primeira linha começa na borda interna e as seguintes 7 mm para dentro. Uma parada de tabulação nos mesmos 7 mm leva o texto que vem depois de “(a)” ou “(c)” até essa borda, qualquer que seja a largura da letra; no Markdown, você escreve (a):tab In General.—…. As cláusulas da lei e a seção alterada compartilham a tipografia e só mudam na moldura: um fio vermelho sobre a lei, um fundo tingido atrás do texto em vigor. O boxe da lei pode se dividir (keepTogether: false), e assim a página 1 termina com as duas primeiras cláusulas.
#3 · Uma faixa para a abertura
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });
const BAND = 66; // mm from the trim top to the foot of the band
const opener = { enabled: true, minHeight: mm(BAND - 22 + 6), marginBottom: pt(0), slot: {
elements: [
{ kind: 'box', id: 'band', style: { backgroundColor: col('band') },
placement: { ...at('bleed', 'top-left'), size: { width: 'fill', height: mm(BAND + 3) } } },
{ kind: 'text', id: 'kicker', content: '{attr.kicker}', ...label, color: col('pale'),
placement: { ...at('container', 'top-left', 0, 6), size: { width: mm(112) } } },
{ kind: 'text', id: 'title', content: '{titleText}', fontFamily: SERIF, fontWeight: 700,
fontSize: pt(30), lineHeight: 1.05, color: col('paper'), align: 'left',
placement: { ...at('#kicker', 'below', 0, 3), size: { width: mm(112), height: 'auto' } } },
{ kind: 'text', id: 'dek', content: '{attr.dek}', fontFamily: SERIF, italic: true,
fontSize: pt(10.5), lineHeight: 1.3, color: col('pale'), align: 'left',
placement: { ...at('#title', 'below', 0, 3.5), size: { width: mm(104), height: 'auto' } } },
] } };
A faixa azul-marinho sangra no alto e dos dois lados, e o chapéu e o olho vêm de atributos da linha do título (atributos de título). minHeight define onde começa a legenda, poucos milímetros abaixo da faixa.
#4 · Cabeços conforme a paridade
const head = (id, content, parity, edge, x, extra = {}) => ({
kind: 'text', id, content, parity, pages: 'body', fontFamily: SANS, fontSize: pt(7.5),
fontWeight: 600, letterSpacing: pt(1.1), textTransform: 'uppercase', color: col('muted'),
placement: { anchor: { to: 'page', edge }, offset: { x: mm(x), y: mm(13) } }, ...extra });
const folio = { fontWeight: 700, color: col('ink') };
const header = { elements: [
head('verso-folio', '{pageNumber}', 'even', 'top-left', OUTER, folio),
head('verso-title', '{title}', 'even', 'top-left', OUTER + 8),
head('recto-title', '{firstMark.h2}', 'odd', 'top-right', -(OUTER + 8)),
head('recto-folio', '{pageNumber}', 'odd', 'top-right', -OUTER, folio),
] };
const footer = { elements: [head('drop-folio', '{pageNumber}', 'all', 'top', 0,
{ ...folio, pages: 'opener', placement: at('container', 'top', 0, 9) })] };
A página par traz o título do impresso e a ímpar a parte em que ela se abre, lida do primeiro título de segundo nível da página. pages: 'body' os mantém fora da abertura, que traz um fólio no pé.
A receita completa
// ═══ Postext Cookbook · Nº 182 · An amendment shown struck through and underlined ═════
// https://postext.dev/en/cookbook/amendment-redline
// Code: MIT · Text: Pub. L. 105-298 and 17 U.S.C. (US Gov., PD); Constitución Española (BOE)
// Fonts: Source Serif 4, Source Sans 3 (SIL OFL 1.1) · Needs postext ≥ 1.73.0
// A comparative print: the law as it stood, each deletion ~~struck through~~ and each
// insertion :underline[underlined], then the amended text in a box whose clauses hang.
import { buildDocumentWithFonts, renderPageToCanvas } from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';
const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'amendment-redline';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: a government-print navy, one red for rules and labels
const palette = {
ink: '#1b1d22', // text: a cool near-black
band: '#1f2b47', // the opener's band: navy
accent: '#a1321f', // labels, stripes, the legend's rule
tint: '#eef0f4', // the box of the amended text
rule: '#c7ccd6', // hairlines
muted: '#5d6370', // running heads, notes, colophon
paper: '#ffffff',
pale: '#c9d2e6', // the kicker and the standfirst on the band
};
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: 'accent (defaults)', value: { hex: palette.accent, model: 'hex' } },
];
// #endregion
const SERIF = 'Source Serif 4', SANS = 'Source Sans 3';
const TRIM = [152, 229], INNER = 20, OUTER = 17; // mm: a 6 × 9 in committee print
const LEAD = 14; // pt: the body leading
const HANG = mm(7); // how far the clauses of a box hang: the width of "(a)" and a space
// #region answer: the marks live in the Markdown; the boxes hang their clauses
// In the text, ~~fifty~~ strikes a deleted word and :underline[70] underlines the new one.
// Both lines are painted from the face's own metrics and take no room, so the struck and
// the inserted words justify and hyphenate like any others. The amended text then sits in
// a box whose paragraphs hang: '(a)', a tab, and every turnover line under the text.
const label = { fontFamily: SANS, fontSize: pt(7.5), fontWeight: 700, letterSpacing: pt(1.1),
textTransform: 'uppercase', color: col('accent') };
const clauses = { fontFamily: SERIF, fontSize: pt(9.5), lineHeight: pt(13), color: col('ink'),
boldColor: col('ink'), italicColor: col('ink'), textAlign: 'left', // a box's measure is short
hangingIndent: HANG, // every line but the first starts 7 mm in (postext ≥ 1.71)
tabStops: [{ position: HANG }] }; // and the tab after the marker takes the text there
const pad = (v, h) => ({ top: mm(v), right: mm(h), bottom: mm(v), left: mm(h) });
const calloutStyles = [
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
#Escreva os acréscimos como ++texto++
Com plusUnderline ativado, ++70++ sublinha como :underline[70], a grafia que Pandoc e markdown-it usam para texto inserido.
textAlign: 'justify', firstLineIndent: mm(4.5), indentAfterHeading: false,
+ plusUnderline: true, // ++texto++ sublinha; C++ no texto passa a ser escrito C\+\+#Mantenha juntas as cláusulas da lei
Sem keepTogether: false, o boxe passa inteiro para a página 2 e a página 1 termina na linha que o apresenta.
- padding: pad(2.5, 0), body: clauses, keepTogether: false, // it may run on to the next page
+ padding: pad(2.5, 0), body: clauses,Erros comuns
- Um parágrafo que começa com um número e um ponto (
2. Solamente…) é lido como item de lista, e uma barra invertida antes do ponto é impressa. A edição espanhola põe um unidor de palavras (U+2060) entre o algarismo e o ponto no texto corrido e, no boxe, escreve a tabulação logo depois do ponto,1.:tab, que nenhum marcador de lista reconhece. - A cor sozinha não sobreviveria a uma fotocópia, que é como esses impressos costumam circular; o tachado e o sublinhado se leem em preto e branco, e foi por isso que os redatores os escolheram.
Créditos
- Receita
- Ignacio Ferro
- Texto
- Section 102 of the Sonny Bono Copyright Term Extension Act (Pub. L. 105-298, 112 Stat. 2827, 1998) and sections 302–304 of title 17, United States Code, as in force in 1997 · United States Congress · domínio público
- Articles 13.2, 49 and 135 of the Spanish Constitution in their 1978 wording and the reforms of 1992, 2011 and 2024 (official texts, not subject to copyright under art. 13 LPI) · Cortes Generales, Boletín Oficial del Estado · domínio público
- The editor’s notes, the coding legends and the colophons · Ignacio Ferro · CC BY 4.0
- Fontes
- Source Serif 4 (SIL OFL 1.1) · Source Sans 3 (SIL OFL 1.1)
- Código
- MIT, como o Postext
Editar este texto ↗ (abre em uma nova aba)Pasta da receita no GitHub ↗ (abre em uma nova aba)


