Коротко
Короткая законодательная публикация. Старая редакция закона с зачёркнутыми удалёнными и подчёркнутыми новыми словами, затем весь изменённый раздел в тонированной врезке.
Что получится
Комитетская публикация, какую прилагают к законопроекту: пять страниц показывают, что раздел 102 Закона Сонни Боно о продлении срока авторского права 1998 года сделал с титулом 17 Кодекса США. Сам закон говорит лишь «strike „fifty“ and insert „70“» («вычеркнуть „fifty“ и вставить „70“»); эта публикация даёт прежний закон с каждым изменением на его месте, удалённое зачёркнуто, вставленное подчёркнуто, условные обозначения, какие печатают над такими текстами федеральные и штатные составители, а затем раздел 302 с изменениями в тонированной врезке, с буквой каждого подраздела у края и строками, выровненными под текстом. Испанское издание делает то же с тремя реформами Конституции Испании, опубликованными в BOE в 1992, 2011 и 2024 годах.
Рецепт отвечает на вопросы
- Как показать поправку, в которой удалённые слова зачёркнуты, а вставленные подчёркнуты?
Короткий ответ
// 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 },
];
Ингредиенты
- Возможности
- ЗачёркиваниеПодчёркиваниеАбзацы с втяжкой во врезкеПозиции табуляции и отточиеВрезкиВрезки, которые делятся или не разрываютсяСемантическая палитраОформленные начальные полосыАтрибуты заголовковКолонтитулы и колонцифрыКолонтитулы по роли страницыЗеркальные поляСтили абзацевВисячие и короткие концевые строкиЭкспорт в PDFШрифты, встроенные в PDF
- Шрифты
- Source Serif 4, Source Sans 3 (SIL OFL 1.1)
- Материалы
- Нет: все иллюстрации рисует код
Порядок работы
#1 · Пометить изменение на его месте
Код — в разделе «Короткий ответ» выше. Сами пометки — это Markdown: ~~fifty~~ :underline[70] зачёркивает старое слово и подчёркивает новое (зачёркивание, подчёркивание). Линии не занимают места, поэтому зачёркнутый пункт в шесть строк выключается по формату и переносится так же, как текст вокруг, а на странице 3 весь прежний подраздел 304(b) зачёркнут, и его замена подчёркнута, в одном абзаце. Каждая линия рисуется по метрикам зачёркивания и подчёркивания самого шрифта, цветом слов, поэтому капитель подзаголовка получает свою линию на своей высоте.
#2 · Выставить пункты во врезке с выступом
body.hangingIndent в стиле врезки выставляет каждый её абзац с выступом (типографика внутри врезки): первая строка начинается у внутреннего края, следующие на 7 мм правее. Позиция табуляции на тех же 7 мм приводит текст после «(a)» или «(c)» к этому краю при любой ширине буквы, поэтому в Markdown вы пишете (a):tab In General.—…. Пункты законопроекта и изменённый раздел набраны одинаково и различаются только рамкой: красная линейка над законопроектом, тон под действующим законом. Врезке законопроекта разрешён разрыв (keepTogether: false), и страница 1 кончается двумя его первыми пунктами.
#3 · Полоса для начала
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' } } },
] } };
Тёмно-синяя полоса уходит за верхний край страницы и за оба боковых, а надзаголовок и лид берутся из атрибутов в строке заголовка (атрибуты заголовков). minHeight задаёт, где начинаются условные обозначения, на несколько миллиметров ниже полосы.
#4 · Колонтитулы по чётности
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) })] };
Левая полоса несёт название публикации, правая — ту её часть, которой страница открывается, по первому заголовку второго уровня на ней. pages: 'body' убирает их с начальной полосы, где вместо них опущенная колонцифра.
Рецепт целиком
// ═══ 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 = [
Собранный script.js работает как есть: вставьте его в модульный скрипт любой страницы или откройте рецепт на CodePen. Папка рецепта на GitHub ↗ (открывается в новой вкладке)
Варианты
#Записать вставки как ++text++
С включённым plusUnderline запись ++70++ подчёркивает так же, как :underline[70]; это написание для вставленного текста у Pandoc и markdown-it.
textAlign: 'justify', firstLineIndent: mm(4.5), indentAfterHeading: false,
+ plusUnderline: true, // ++текст++ подчёркивает; C++ в тексте тогда пишется C\+\+#Не разрывать пункты законопроекта
Без keepTogether: false врезка целиком переходит на страницу 2, а страница 1 кончается строкой, которая её вводит.
- padding: pad(2.5, 0), body: clauses, keepTogether: false, // it may run on to the next page
+ padding: pad(2.5, 0), body: clauses,Частые ошибки
- Абзац, который начинается числом с точкой (
2. Solamente…), читается как пункт списка, а обратная косая черта перед точкой печатается. В испанском издании в обычном тексте между цифрой и точкой стоит соединитель слов (U+2060), а во врезке табуляция идёт сразу после точки,1.:tab, чего не принимает ни один маркер списка. - Один цвет не пережил бы ксерокопию, а именно в копиях такие публикации часто и расходятся; зачёркнутое и подчёркнутое читается в чёрно-белом, потому составители их и выбрали.
Источники и лицензии
- Рецепт
- Ignacio Ferro
- Текст
- 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 · общественное достояние
- 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 · общественное достояние
- The editor’s notes, the coding legends and the colophons · Ignacio Ferro · CC BY 4.0
- Шрифты
- Source Serif 4 (SIL OFL 1.1) · Source Sans 3 (SIL OFL 1.1)
Изменить описание рецепта ↗ (открывается в новой вкладке)Папка рецепта на GitHub ↗ (открывается в новой вкладке)


