باختصار
كتيّب شعري صغير فيه الإسبانية في جهة وترجمتها الإنجليزية بجانبها. كل مجموعة أبيات في الترجمة تبدأ على مستوى الأبيات الأصلية نفسها.
ما الذي ستنضده
ديوان صغير ثنائي اللغة من خمس قصائد عن ملّاحة في جنوب إسبانيا، بمقاس 156 × 234 مم، الإسبانية فيه على اليسار والنسخة الإنجليزية التي كتبها الشاعر نفسه على اليمين، سطرًا بسطر. تأتي أولًا صفحة عنوان عليها طائر نحام ثم كلمة المؤلف، وتبدأ القصائد تحت لوحة مائية لبرك وردية وأكوام ملح وطيور نحام عند الشروق. كل قصيدة في إطار بلا حدود تحت رقم بلون الفوّة (madder) بخط Castoro Titling، الإسبانية في عمود والإنجليزية في الآخر. يبدأ النص الإنجليزي على السطر الذي يبدأ عليه الإسباني، ويبدأ كل مقطع على مستوى أصله. وإذا طال سطر إنجليزي عن عموده رُحِّل باقيه إلى السطر التالي بإزاحة 2 em، وانتهى المقطع الإسباني المقابل بسطر فارغ إضافي.
تجيب هذه الوصفة عن
- كيف أضع عمودين داخل إطار (عمود نص بجانب عمود شكل)؟
- كيف أنضد الشعر: سطر لكل بيت، وفراغ بين المقاطع، ومسافة بادئة معلّقة للأسطر الملتفّة، وبلا تقسيم كلمات؟
- كيف أضيف فراغًا رأسيًّا إضافيًّا بين كتلتين، إذا لم تُجدِ الأسطر الفارغة شيئًا؟
- كيف أحصل على ضبط أسطر وتقسيم كلمات جيدين لنص إسباني أو فرنسي أو ألماني؟
الجواب المختصر
// 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
};
المكونات
- الميزات
- الشعر سطرًا سطرًاأعمدة داخل الإطار أو النصمسافة عمودية صريحةأنماط الفقراتإطارات التنبيهتقسيم الكلمات ولغة المستندأنماط العناوينصفحات افتتاح مصمَّمةسمات العنوانالصور في تصاميم الصفحةالأغلفة وصفحات العنوان وبيانات النشرالبيانات الوصفية للمستندموازنة الأعمدةالترويسات وأرقام الصفحاتالترويسات بحسب دور الصفحةهوامش متناظرةلوحة ألوان دلاليةالأشكال والجداول بوصفها مواردترويسات لكل قسمصفحات على اللوحة (Canvas)
- الخطوط
- Castoro, Castoro Titling, Tenor Sans (SIL OFL 1.1)
- الأصول
flamingo-680.jpgsalina-1560.jpg- The salt pans at sunrise over the poems, a watercolour (Generated With Diffusion Models, أصلي)
- The flamingo on the title page, a watercolour (Generated With Diffusion Models, أصلي)
طريقة التحضير
#1 · القصيدة إطار فيه فاصل عمود ثابت
الشيفرة هي الجواب المختصر أعلاه. كل قصيدة إطار (callout) يضمّ مجموعة :::columns، ويُسقط نمطه التعبئة والحشوة ويطبع title الخاص بالتوجيه، أي الرقم (:::columns). من دون breaks تنقسم المجموعة حيث يتساوى طول عموديها. نصفا هذه القصائد بالارتفاع نفسه، فيقع القطع على العنوان الإنجليزي على أي حال؛ لكن إن أطلت بيتين من The Rake حتى يُرحَّلا، نزل القطع كتلة واحدة وبقي THE RAKE في أسفل العمود الإسباني. يحدّد breaks="5" الكتلة التي تفتح العمود الثاني، فيتصدّره العنوان الإنجليزي أيًّا كان ارتفاع النصفين.
#2 · كتلة :::verse لكل عمود، وسطر فارغ لكل فاصل بين مقطعين
// 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) };
كل نصف من القصيدة كتلة :::verse: بيت في كل سطر من Markdown، غير مضبوط ولا يُقسم بالواصلة، وسطر فارغ بين المقطعين يترك سطرًا فارغًا في العمود (:::verse). كل مقطع كتلة، فيعدّ breaks المقاطع لا الأبيات. السطر الإنجليزي each one standing on its own reflection. أطول من عموده البالغ 55 مم، فيُرحَّل باقيه بإزاحة 2 em؛ ويُغلق النصف الإسباني كتلته بعد المقطع المقابل ويضع :::space{lines=2} قبل المقطع التالي، فتبدأ المقاطع التالية على السطر نفسه. و:::space ليس كتلة، فلا يعدّه breaks (:::space).

#3 · كلمة المؤلف تُقسَّم بالواصلة وفق لغتها
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 أنماط تقسيم الكلمات. مع 'es' تنكسر في كلمة المؤلف الإسبانية ori-ginal وDuna-liella؛ ومع الأنماط الإنجليزية تنتقل الكلمتان كاملتين إلى السطر التالي، ولا تنكسر في الحالتين إلا arras-traba (اللغات المدعومة). يجوز أن تضيق المسافات بين الكلمات إلى 0.8 من عرضها العادي وأن تتسع إلى 1.35 منه، ولا يتجاوز أي سطر مضبوط في نسختي الكلمة هذا الحد. عنوان الكلمة تصميم عنصره الوحيد هو العنوان، ويقع على بعد 36 مم تحت أعلى كتلة النص، فتبدأ الكلمة على بعد 73 مم من الحافة العليا لصفحتها.
#4 · صفحة العنوان واللوحة المائية عنوانان
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') }),
] } },
};
كل منهما عنوان من المستوى الأول بنمط خاص به (أنماط العناوين): يأخذ تصميم صفحة العنوان {author} من البيانات التمهيدية (frontmatter)، ويأخذ التصميمان {attr.other} من سمات العنوان. اللوحة المائية مربوطة بالحافة العليا للصفحة، فوق كتلة النص، ويحجز العنوان حتى أسفلها، على بعد 84 مم من أعلى الصفحة. يضع النمط marginBottom: pt(0)، فيكون الفراغ تحت اللوحة هو الهامش العلوي للقصيدة نفسها، وهو سطران، وتبدأ القصيدة I على أول سطر من الشبكة يقع تحت اللوحة بسطرين على الأقل.
#5 · الترويسات تسمّي اللغتين
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' })] };
على الصفحة الزوجية العنوان الإسباني وعلى الفردية العنوان الإنجليزي، بترتيب العمودين. يُبعدها pages: 'body' عن الصفحات الثلاث التي تبدأ بعنوان. تأخذ كلمة المؤلف واللوحة المائية رقم صفحة في أسفلها بدلًا منها، ويُفرغ نمط صفحة العنوان ترويستها وتذييلها (عناصر النص).
الوصفة كاملة
// ═══ 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 = 'es'; // @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)
يعمل ملف script.js المجمّع كما هو: الصقه في سكربت الوحدة (module) لأي صفحة، أو افتح الوصفة على CodePen. مجلد الوصفة على GitHub ↗ (يفتح في تبويب جديد)
تنويعات
#وسّع الفاصل بين العمودين
عند 12 مم يضيق كل عمود إلى 53 مم، ويُرحَّل البيت Los turistas paran y hacen fotos: في القصيدة III، فيبدأ مقطعها الثاني تحت مقطع الإنجليزية بسطر؛ أغلق الكتلة الإنجليزية بعد ذلك المقطع وضع :::space{lines=2} قبل التالي لتسويتهما.
-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#زِد إزاحة الأسطر المرحَّلة
عند 3 em تبدأ reflection. في الصفحة 3 أبعد بـem واحد.
-const verse = { id: 'verse', hangingIndent: em(2) };
+const verse = { id: 'verse', hangingIndent: em(3) };أخطاء شائعة
- إذا وضعت
:::spaceقبل العنوان الإنجليزي اختفى: يبدأ العمود الثاني عند الكتلة التي يحددهاbreaks، فيقع الفراغ عند القطع. ضعه بعد العنوان، مثل:::space{lines=0.5}تحت عنوان كل عمود هنا. - عُدّ
breaksابتداءً من العنوان الإسباني: مع عنوان وثلاثة مقاطع يكون العنوان الإنجليزي الكتلة 5. كل مقطع كتلة، فمقطع إسباني إضافي ينقل العنوان الإنجليزي إلى الكتلة 6، ويجب أن ترفعbreaksمعه؛ أما بيت إضافي داخل مقطع فلا يغيّر شيئًا.
الحقوق
- الوصفة
- Ignacio Ferro
- النص
- 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
- الصور
- The salt pans at sunrise over the poems, a watercolour · Generated With Diffusion Models · أصلي
- The flamingo on the title page, a watercolour · Generated With Diffusion Models · أصلي
- الخطوط
- Castoro (SIL OFL 1.1) · Castoro Titling (SIL OFL 1.1) · Tenor Sans (SIL OFL 1.1)
- الشيفرة
- MIT، مثل Postext
حرّر هذا الشرح ↗ (يفتح في تبويب جديد)مجلد الوصفة على GitHub ↗ (يفتح في تبويب جديد)


