انتقل إلى المحتوى الرئيسي
الوصفة رقم 71

دليل الوصفات · الفصل 6 · الإطارات والملاحظات

حواشٍ سفلية في أسفل العمود الذي يحيل إليها

علامات [^id] في Markdown تصير حواشي مرقّمة في أسفل العمود الذي يحيل إليها، مع مفاتيح لعمود واحد، وتعليقات في آخر الفصل، وترقيم متصل.

في هذه الصفحة
المُخرَج
Canvas · PDF · عناصر تحكم حية
المستوى
متوسط
Postext
اختُبرت مع Postext 1.65.0
تتطلب ≥ 1.25.0 · postext-pdf ≥ 1.25.0
الترخيص
حُدّثت في 10 أكتوبر 2026
الشيفرة MIT · النص CC BY 4.0
  • نموذج باللغة الإنجليزية: لا توجد طبعة عربية بعد
  • مقاس القص 210 × 280 مم
  • عمودان, فاصل 7 مم بين الأعمدة
  • EB Garamond 10.5/13.5
  • Bodoni Moda
  • IBM Plex Sans Condensed
  • 3 صفحات
  • المستوى
  • Postext 1.65.0
  • أُخرجت في 28 ms
  • أسطر الشيفرة: 164

باختصار

طبعة مدرسية لرواية إسبانية كلاسيكية في عمودين. تبيّن كيف تضع كل حاشية في أسفل العمود الذي يذكرها، فلا يقلب القارئ الصفحة أبدًا ليجدها.

ما الذي ستنضده

طبعة مدرسية من Lazarillo de Tormes، بمقاس 210 × 280 mm في عمودين بخط EB Garamond: المقدمة وبداية الفصل الأول (tratado)، حيث يولد Lázaro في طاحونة على نهر Tormes ويخرج إلى الدنيا مع رجل أعمى. تشرح الحواشي ما كان يعرفه قارئ سنة 1554 ولا يعرفه قارئ اليوم: قرية Tejares، والحملة على جزيرة Los Gelves، والثور الحجري على جسر Salamanca. كل حاشية تقع في أسفل العمود الذي يحيل إليها، بحروف أصغر تحت خط قصير بلون أحمر داكن، فتنزل العين من الرقم إلى الحاشية وتعود من غير أن تقلب صفحة. وفي الطبعة الإنجليزية حواشي Clements Markham نفسه من ترجمته الصادرة سنة 1908.

تجيب هذه الوصفة عن

  • كيف أضيف الحواشي السفلية؟

الجواب المختصر

script.js · الأسطر 42–54في الشيفرة الكاملة
// In the Markdown: `Tejares,[^9]` cites a note (the id may be a word: `[^tejares]`), and
// a paragraph that opens with `[^9]:` anywhere in the chapter defines it. The engine
// numbers the notes in order of citation and keeps each note in the column of the line
// that cites it: a line whose note does not fit under it moves on with the note.
const footnotes = () => ({
  placement: options.placement, // 'column' (the foot of the citing column) or 'chapterEnd'
  numbering: options.numbering, // 'chapter': 1, 2, 3… again under every chapter heading
  fontSize: pt(8.5), // off the baseline grid: the notes stack up from the column's foot
  lineHeight: pt(10.5),
  hangingIndent: em(0.9), // turnover lines align past the number
  spaceBetween: pt(1.5),
  separator: { width: 0.25, lineWidth: pt(0.5), color: col('oxblood') },
});

المكونات

الخطوط
EB Garamond, Bodoni Moda, IBM Plex Sans Condensed (SIL OFL 1.1)
الأصول
لا شيء: كل صورة مرسومة بالشيفرة

طريقة التحضير

#1 · أحِل إلى الحاشية في موضعها، وعرّفها في أي مكان

الإعدادات هي الجواب المختصر أعلاه؛ والباقي Markdown. يطبع natives of Tejares,[^9] رقمًا مرفوعًا ملتصقًا بالفاصلة، والفقرة التي تبدأ بـ[^9]: فيها نص الحاشية. التعريفات تخرج من مجرى النص حيثما كتبتها، لذلك يجمعها هذا المثال كلها في آخر الفصل، كما كانت حواشي Markham في الملف المصدر. تتبع الأرقام ترتيب الإحالة، فيمكن أن تكون معرّفات Markdown كلمات ([^tejares] في الطبعة الإسبانية)، وإعادة ترقيم الفصل لا تعني أبدًا تعديل الحواشي.

#2 · اترك في العمود مكانًا لحواشيه

قبل أن ينضّد الإخراج سطرًا، يضيف ارتفاع الحواشي التي يحيل إليها ذلك السطر لأول مرة، والخط الفاصل إن كانت أول حاشية في العمود. السطر الذي لا تتسع حاشيته تحته ينتقل إلى العمود التالي مع فقرته، وفق قواعد الأسطر الأرامل واليتيمة، فلا يشير رقم أبدًا إلى حاشية في عمود آخر. تتراكم الحواشي من الأسفل بحجمها وتباعد أسطرها الخاصين بها، خارج شبكة خطوط الأساس، بينما يبقى النص فوقها عليها؛ وموازنة الأعمدة لا تحسب إلا النص.

#3 · أنزل كل صفحة افتتاح إلى السطر نفسه

script.js · الأسطر 58–76في الشيفرة الكاملة
const opener = {
  enabled: true,
  // The sink holds a two-line title and its rule, with ~8 mm to the first line of text,
  // so every chapter starts on the same grid line whatever its title's length.
  minHeight: pt(LEAD * 10),
  slot: { elements: [
    { kind: 'text', id: 'kicker', content: '{attr.kicker}', ...label, fontSize: pt(8.5),
      letterSpacing: pt(1.8), color: col('oxblood'), align: 'center',
      placement: at('container', 'top', 0, 7) },
    { kind: 'text', id: 'title', content: '{titleText}', fontFamily: 'Bodoni Moda', italic: true,
      fontSize: pt(26), lineHeight: 1.1, color: col('ink'), align: 'center',
      overflow: 'wrap', // design text ends in an ellipsis by default
      placement: { ...at('container', 'top-left', 0, 13),
        size: { width: 'fill', height: 'auto' } } },
    { kind: 'rule', id: 'rule', direction: 'horizontal', thickness: pt(0.75), color: col('oxblood'),
      placement: { anchor: { to: '#title', edge: 'below' }, // a rule starts at the box's left
        offset: { x: mm((MEASURE - 14) / 2), y: mm(4.5) }, size: { width: mm(14) } } },
  ] },
};

تمتد صفحة الافتتاح على العمودين وترسم السطر التمهيدي للفصل من السمة kicker في العنوان. يحجز minHeight عشرة أسطر من الشبكة، وهي تكفي لعنوان من سطرين بخط Bodoni مع خطه، فيبدأ نص كل فصل على السطر نفسه ولا يقع الخط أبدًا على السطر الأول من النص.

#4 · ضع اسم الكتاب على الصفحة الزوجية واسم الفصل على الفردية

script.js · الأسطر 80–97في الشيفرة الكاملة
const head = (id, content, parity, edge, x, extra = {}) => ({
  kind: 'text', id, content, parity, pages: 'body', // never on openers
  ...label, fontSize: pt(7.5), letterSpacing: pt(1.3), color: col('muted'),
  placement: at('page', edge, x, 13), ...extra,
});
const folio = { color: col('oxblood') };
const header = { elements: [
  head('verso-folio', '{pageNumber}', 'even', 'top-left', MARGIN.outer,
    { ...folio, align: 'left' }),
  head('verso-title', '{title}', 'even', 'top-left', MARGIN.outer + 9, { align: 'left' }),
  head('recto-title', '{chapterTitle}', 'odd', 'top-right', -(MARGIN.outer + 9),
    { align: 'right', overflow: 'ellipsis' }),
  head('recto-folio', '{pageNumber}', 'odd', 'top-right', -MARGIN.outer,
    { ...folio, align: 'right' }),
] };
// Openers carry a drop folio instead, centred under the text block.
const footer = { elements: [{ ...head('drop-folio', '{pageNumber}', 'all', 'bottom', 0,
  { ...folio, align: 'center', placement: at('page', 'bottom', 0, -11) }), pages: 'opener' }] };

الترويسات مربوطة بالصفحة حسب زوجيتها، ورقم الصفحة على الحافة الخارجية؛ ويُبعدها pages: 'body' عن صفحات الافتتاح، التي تأخذ رقم صفحة سفليًا في الوسط. وعنوان الفصل الطويل ينتهي بنقاط حذف عند 120 mm بدلًا من أن يصطدم برقم الصفحة.

#5 · جرّب المواضع الأخرى

script.js · الأسطر 202–230في الشيفرة الكاملة
const CHOICES = {
  columns: [[2, t({ en: 'Two columns', es: 'Dos columnas' })],
    [1, t({ en: 'One column', es: 'Una columna' })]],
  placement: [['column', t({ en: 'Column foot', es: 'Pie de columna' })],
    ['chapterEnd', t({ en: 'End of chapter', es: 'Final del capítulo' })]],
  numbering: [['chapter', t({ en: 'Per chapter', es: 'Por capítulo' })],
    ['document', t({ en: 'Continuous', es: 'Continua' })]],
};
const bar = document.createElement('form');
bar.id = 'options';
bar.ariaLabel = t({ en: 'Footnote options', es: 'Opciones de las notas' });
for (const [key, choices] of Object.entries(CHOICES)) {
  const group = bar.appendChild(document.createElement('fieldset'));
  for (const [value, text] of choices) {
    const input = Object.assign(document.createElement('input'), { type: 'radio', name: key,
      value: String(value), checked: options[key] === value });
    const item = group.appendChild(document.createElement('label'));
    item.append(input, text);
  }
}
bar.addEventListener('change', (event) => {
  const { name, value } = event.target;
  options[name] = name === 'columns' ? Number(value) : value;
  config.layout = layoutFor(options.columns); // changed in place: the build sees it
  config.footnotes = footnotes();
  doc = buildDocument({ markdown }, config); // the fonts are loaded by now
  showPages(doc, { title: TITLE });
});
document.getElementById('pages').before(bar);

كل مفتاح يبني الفصل من جديد مع تغيير خيار واحد. One column (عمود واحد) يضع الحواشي في أسفل الصفحة، وهي العمود في هذه الحالة. End of chapter (آخر الفصل) يضعها بعد آخر فقرة في الفصل وينزلها إلى أسفل العمود الذي تختمه، تحت الخط نفسه. Continuous (متصل) يواصل الأرقام من المقدمة إلى الفصل الأول بدلًا من أن يبدأ من جديد من 1.

الوصفة كاملة

Sandbox
// ═══ Postext Cookbook · Nº 071 · Footnotes at the foot of the column ══════════════
// https://postext.dev/en/cookbook/novel-footnotes-column-foot
// Code: MIT · Text: Lazarillo de Tormes (1554) and Markham's 1908 translation (PD)
// Fonts: EB Garamond, Bodoni Moda, IBM Plex Sans Condensed (SIL OFL 1.1) · Needs postext ≥ 1.25.0
import { buildDocument, 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 = 'novel-footnotes-column-foot';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: oxblood for the kickers, the folios and the notes' rule; ink on warm paper
const palette = {
  ink: '#241e1a', // text: a warm near-black
  oxblood: '#7d2b1f', // the one accent
  muted: '#6f655b', // running heads, colophon
  rule: '#c9bdae', // hairlines
  paper: '#fbf8f2',
};
// col(id): a colour linked to its palette entry, with the entry's hex beside the id.
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' } })),
  // The engine's defaults link to main-color: point it at the accent, never the default blue.
  { id: 'main-color', name: 'accent (defaults)', value: { hex: palette.oxblood, model: 'hex' } },
];
// #endregion
const TRIM = { width: 210, height: 280 }; // a school edition: two 82 mm columns
const MARGIN = { top: 23, bottom: 22, inner: 21, outer: 17 }; // mirrored
const MEASURE = TRIM.width - MARGIN.inner - MARGIN.outer; // 172 mm
const LEAD = 13.5; // body leading in pt: the baseline grid
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });
const label = { fontFamily: 'IBM Plex Sans Condensed', fontWeight: 600,
  textTransform: 'uppercase' };

// The switches under the title change these and build again (#region live).
const options = { columns: 2, placement: 'column', numbering: 'chapter' };
const layoutFor = (columns) => (columns === 2
  ? { layoutType: 'double', gutterWidth: mm(7) } : { layoutType: 'single' });

// #region answer: the notes at the foot of the column that cites them
// In the Markdown: `Tejares,[^9]` cites a note (the id may be a word: `[^tejares]`), and
// a paragraph that opens with `[^9]:` anywhere in the chapter defines it. The engine
// numbers the notes in order of citation and keeps each note in the column of the line
// that cites it: a line whose note does not fit under it moves on with the note.
const footnotes = () => ({
  placement: options.placement, // 'column' (the foot of the citing column) or 'chapterEnd'
  numbering: options.numbering, // 'chapter': 1, 2, 3… again under every chapter heading

يعمل ملف script.js المجمّع كما هو: الصقه في سكربت الوحدة (module) لأي صفحة، أو افتح الوصفة على CodePen. مجلد الوصفة على GitHub ↗ (يفتح في تبويب جديد)

تنويعات

#أبقِ تعليقات آخر الفصل تحت النص

مع placement: 'chapterEnd' تقف الحواشي افتراضيًا في أسفل العمود الأخير؛ ويضعها chapterEndAlign: 'text' تحت الفقرة الأخيرة مباشرة.

   placement: options.placement,
+  chapterEndAlign: 'text',

#احذف الخط

من غير الخط تبقى الحواشي منفصلة عن النص بمقدار spaceAbove وspaceBelowRule.

-  separator: { width: 0.25, lineWidth: pt(0.5), color: col('oxblood') },
+  separator: { enabled: false },

أخطاء شائعة

خطأ شائع

تحجز الافتتاحية ارتفاعًا يصل إلى أدنى عناصرها المثبّتة على الصفحة

تحجز الافتتاحية ذات التصميم المتقدّم ارتفاع أدنى عناصرها، وتُحتسب كذلك العناصر المثبّتة على الصفحة أو على النزف تحت العنوان، فالزخرفة في أسفل الصفحة تدفع النص إلى الصفحة التالية. أعطِ مثل هذا العنصر reserve: false (منذ postext 1.5): يُرسَم حيث ثُبّت ولا يحجز شيئًا. أما العناصر التي تتبع الشريط نفسه (المثبّتة على أسفله، أو التي ارتفاعها 'fill') فلا تحدّد ارتفاعه أبدًا. صفحات افتتاح مصمَّمة →

تحذير الإخراج · undefinedFootnote

حاشية بلا تعريف

السبب. علامة [^id] تحيل إلى حاشية لا تعرّفها أي فقرة [^id]:، فيُطبع الرقم فوق حاشية فارغة.

الحل. أضف فقرة [^id]: فيها نص الحاشية، أو صحّح معرّف العلامة. التوثيق →

تحذير الإخراج · unusedFootnote

حاشية لا يُحال إليها

السبب. تعريف [^id]: ليس له علامة في النص، فلا تُنضَّد الحاشية.

الحل. أحِل إليها بـ[^id] في موضعها، أو احذف التعريف. التوثيق →

  • العلامة الموضوعة في تعليق أو خلية جدول أو عنوان تُطبع كما كُتبت: الحواشي تُقرأ في الفقرات وعناصر القوائم والاقتباسات والإطارات.
  • الحاشية لا تنقسم أبدًا بين عمودين: الحاشية الأطول من عمودها تتجاوز أسفله. اجعل الحواشي في أسطر قليلة، كما يفعل المحررون.

الحقوق

الوصفة
Ignacio Ferro
النص
  • La vida de Lazarillo de Tormes, Burgos edition of 1554: the prologue and the beginning of the first treatise · Anonymous · ملك عام
  • The Life of Lazarillo de Tormes, translated by Clements Markham (1908), with his notes: the prologue and the first chapter, abridged · Clements Markham · ملك عام
  • The Spanish notes, adapted from Markham's and written for this edition · Ignacio Ferro · CC BY 4.0
الخطوط
EB Garamond (SIL OFL 1.1) · Bodoni Moda (SIL OFL 1.1) · IBM Plex Sans Condensed (SIL OFL 1.1)
الشيفرة
MIT، مثل Postext
SandboxPDF