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

دليل الوصفات · الفصل 8 · الجداول

ورقة بيانات: جداول من البيانات ورؤوس مدمجة

جداول مُلصقة بصيغة TSV، تحللها parseTSV وتشكّلها mergeCells وsetAlignment وsetCellBackground؛ وخريطة سجلات تنقسم بين الصفحات وحدها.

في هذه الصفحة
المُخرَج
Canvas · PDF
المستوى
متقدم
Postext
اختُبرت مع Postext 1.65.0
تتطلب ≥ 1.65.0 · postext-pdf ≥ 1.65.0
الترخيص
حُدّثت في 31 أكتوبر 2026
الشيفرة MIT · النص CC BY 4.0
  • نموذج باللغة الإنجليزية: لا توجد طبعة عربية بعد
  • مقاس القص 216 × 279 مم
  • عمودان, فاصل 6 مم بين الأعمدة
  • Fira Sans 9.3/13
  • Fira Mono
  • Fira Sans Condensed
  • Fira Sans Condensed@tnum
  • Fira Sans@tnum
  • 4 صفحات
  • المستوى
  • Postext 1.65.0
  • أُخرجت في 169 ms
  • أسطر الشيفرة: 257

باختصار

ورقة منتج من أربع صفحات لمستشعر حرارة إلكتروني. تُريك كيف تبني جداول من بيانات جدول حسابي، بعناوين مشتركة وجدول طويل يتابع في الصفحة التالية.

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

هذه ورقة البيانات ذات الصفحات الأربع لـ PX-7021، مستشعر حرارة من صانع متخيَّل، Pyxis Microdevices. معظمها جداول، رؤوسها مليئة بالخلايا المدمجة، وخريطة سجلات أطول من عمود. تُفتتح الصفحة الأمامية على شريط بنفسجي عليه رقم القطعة وثلاثة أرقام رئيسية. وفي الصفحة 2 جدول واحد يمتد بعرض الصفحة. يضع رأسه ذو الصفين Value فوق Min وTyp وMax؛ ومجموعات المعاملات مدمجة على امتداد العمود الأول، وكل معامل ثانٍ مظلَّل بالرمادي. تنكسر خريطة السجلات عند أسفل الصفحة 3 وتتابع في الصفحة 4 برأسها مكررًا، بجوار رموز الطلب وفوق رسم الغلاف. والجداول بيانات جدول حسابي مُلصقة بصيغة TSV، لأن Postext لا يحلل جداول Markdown.

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

  • كيف أصنع جدولًا فيه صفوف رأس، وخلايا مدمجة، وعروض أعمدة، ومحاذاة لكل خلية؟
  • كيف أقسّم جدولًا طويلًا عبر الصفحات مع تكرار الرأس وعلامة «تابع»؟
  • كيف أنسّق عدة جداول تنسيقات مختلفة (تعبئة، خلايا مخططة بالتناوب، أطر مستديرة) في مستند واحد؟
  • كيف أبقي المخططات حادة، بنص قابل للتحديد، في ملف PDF (SVG، النسخ الطباعية الأصلية)؟
  • كيف أضيف صورًا وجداول من الشيفرة (موارد) بدل ![]() في Markdown؟

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

script.js · الأسطر 31–69في الشيفرة الكاملة
const at = (row, column) => ({ row, col: column });
const span = (r0, c0, r1, c1) => ({ start: at(r0, c0), end: at(r1, c1) });
const C = { group: 0, param: 1, symbol: 2, conditions: 3, min: 4, max: 6, unit: 7 }; // columns
function electricalTable(tsv) {
  // headerRows marks the head, two rows here, which a split table would repeat on each part.
  let m = Object.assign(parseTSV(tsv, { headerRows: 2 }), {
    columnWidths: [22, 44, 16, 38, 15, 15, 15, 15] }); // weights: mm of the 180 mm measure
  // 'Parameter' covers two columns and two rows; 'Value' spans Min, Typ and Max. mergeCells
  // marks the covered cells hiddenBy, so no column shifts (gotcha: merged-cells-hiddenby).
  for (const range of [span(0, C.group, 1, C.param), span(0, C.symbol, 1, C.symbol),
    span(0, C.conditions, 1, C.conditions), span(0, C.min, 0, C.max),
    span(0, C.unit, 1, C.unit)]) {
    m = mergeCells(m, range); // 'Value' is centred over its three columns, the rest set left
    m = setAlignment(m, range.start, range.start.col === C.min ? 'center' : 'left', 'middle');
  }
  // Min, Typ and Max go right, over their figures; setAlignment clears a vAlign it is not given.
  for (let c = C.min; c <= C.max; c++) m = setAlignment(m, at(1, c), 'right');
  let zebra = false;
  for (let r = m.headerRowCount; r < m.rows.length; r++) {
    const row = m.rows[r];
    if (row[C.param].content) zebra = !zebra; // a parameter keeps one fill over its conditions
    for (let c = 0; c < row.length; c++) {
      // An empty cell continues the one above: a group, or a parameter and its symbol.
      if (c <= C.symbol && row[c].content) {
        let end = r;
        while (m.rows[end + 1] && !m.rows[end + 1][c].content
          && (c === C.group || !m.rows[end + 1][C.param].content)) end++;
        m = mergeCells(m, span(r, c, end, c));
      }
      // Figures flush right, as datasheets set them (no decimal tab: gap tab-stops).
      m = setAlignment(m, at(r, c), c >= C.min && c <= C.max ? 'right' : 'left', 'middle');
      // tableStyle.bodyAlternateBackground alternates row by row; this fill changes with the
      // parameter, so it is set cell by cell. Each helper returns a new model, cheap at 20 rows.
      if (c === C.group) m = setCellBackground(m, at(r, c), col('tint'));
      else if (zebra) m = setCellBackground(m, at(r, c), col('zebra'));
    }
  }
  return m;
}

المكونات

الخطوط
Fira Sans, Fira Sans Condensed, Fira Mono (SIL OFL 1.1)
الأصول
لا شيء: كل صورة مرسومة بالشيفرة

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

#1 · ألصق البيانات، ثم شكّل الجدول

الشيفرة هي الجواب المختصر أعلاه. تعلّم parseTSV(tsv, { headerRows: 2 }) صفَّي الرأس؛ ولو انقسم الجدول لتكرر كلاهما في كل جزء. مجموع أوزان columnWidths هو 180، أي عرض كتلة النص بالمليمتر، فكل وزن هو عرض عموده في الصفحة. تُبقي mergeCells كل خلية مغطاة في مكانها وتعلّمها بـhiddenBy، فلا يُزاح أي عمود. وتعمل setAlignment خلية خلية وتمحو المحاذاة العمودية حين تُغفلها، فتمرر معظم الاستدعاءات 'middle' من جديد. ويتناوب الرمادي من معامل إلى الذي يليه، فيبقى صفّا Accuracy كلاهما على التعبئة نفسها؛ أما التناوب بحسب الصف، كما يفعل bodyAlternateBackground في نمط الجدول، فكان سيترك الثاني أبيض.

#2 · كل نموذج يصير موردًا

script.js · الأسطر 493–522في الشيفرة الكاملة
const svgResource = (id, caption, altText, [w, h], placement) => ({ id, typeId: 'figure',
  kind: 'svg', caption, altText, placement, createdAt: 0, updatedAt: 0,
  svg: { fileId: `${id}.svg`, width: w * SCALE, height: h * SCALE } }); // fitted to its slot
const table = (id, caption, model, { styleId, placement, note } = {}) => ({ id, typeId: 'table',
  kind: 'table', caption, note, placement, table: { model, styleId }, createdAt: 0, updatedAt: 0 });
// A float takes the first free slot after its first :ref; the logo is never cited, only drawn.
const resources = [
  svgResource('logo', '', 'Pyxis Microdevices', LOGO),
  svgResource('pinout', 'Pin configuration, 8-pin DFN, top view.', 'The package from above: '
    + 'pins 1 to 4 down the left side, 5 to 8 up the right.', PINOUT),
  svgResource('circuit', 'Typical application, bus address 48h.', 'The sensor with a 100 nF '
    + 'capacitor, address pins to ground, and SDA, SCL and ALERT pulled up to a host.', CIRCUIT),
  svgResource('outline', 'Package outline and land pattern, 8-pin DFN, in mm.', 'Top, bottom '
    + 'and side views of the 2 × 2 mm body, and the land pattern with its two vias.', OUTLINE,
  { position: 'bottom', span: 'page' }), // a strip across the foot of a page
  table('electrical', 'Electrical characteristics, *V*~DD~ = 1.6 V to 5.5 V and *T*~A~ = −40 °C '
    + 'to 125 °C unless noted', electricalTable(electrical), { styleId: 'electrical',
    placement: { position: 'top', span: 'page' }, note: 'Typical values at 3.3 V and 25 °C. '
      + '^1^ Tested at 25 °C and 50 °C, the rest by characterization. ^2^ Characterized, not '
      + 'tested in production. ^3^ One conversion a second, bus idle.' }),
  // No placement: these float to the first free slot after their reference and split there.
  table('pins', 'Pin functions', groupedTable(pins, [9, 16, 10, 52]), { styleId: 'grouped',
    note: 'Types: P power, G ground, I input, O open-drain output, I/O open-drain input and '
      + 'output.' }),
  table('registers', 'Register map', groupedTable(registers, [9, 17, 11, 50]), {
    styleId: 'grouped', note: 'Reset values apply at power-on and after a general-call reset.' }),
  table('ordering', 'Order codes', Object.assign(parseTSV(ordering, { headerRows: 1 }), {
    columnWidths: [23, 29, 18, 17] }), { styleId: 'ordering',
    note: 'WLCSP-4: fixed address 48h, no ALERT output.' }),
];

كل جدول ورسم مورد له تعليق، وتضيف الجداول ملاحظة ونمطًا مسمّى. تقبل التعليقات والملاحظات الخط المائل والأرقام السفلية والمرفوعة: يذكر الجدول الكهربائي شروط اختباره بـ*V*~DD~ في التعليق ويرقّم حواشيه بـ^1^ في الملاحظة. يأخذ العنصر العائم أول موضع شاغر بعد أول :ref له. يُستشهد بالجدول 1 في الصفحة 1 ويوضع عبر رأس صفحة، فيفتتح الصفحة 2. ويوضع المخطط عبر أسفل صفحة، وتحتفظ الجداول الأخرى بالتموضع الافتراضي، عنصرًا عائمًا بعرض عمود واحد. والجدول الموضوع here يبقى في النص؛ وإذا لم يتسع له ما بقي من عموده انقسم هو أيضًا بين الصفوف.

#3 · دع الجدول الطويل ينقسم وحده

script.js · الأسطر 73–87في الشيفرة الكاملة
function groupedTable(tsv, columnWidths) {
  let m = Object.assign(parseTSV(tsv, { headerRows: 1 }), { columnWidths });
  const codes = [0, 2]; // Pin and Type, Addr. and Reset: short codes, centred, in a bare chip
  // A TSV cell holds no line break: the data writes \n, and a line opening with • is a list.
  m.rows = m.rows.map((row, r) => row.map((cell, c) => ({ ...cell,
    content: r > 0 && row[1].content && codes.includes(c) ? `:chip[${cell.content}]{style="code"}`
      : cell.content.replaceAll('\\n', '\n') })));
  for (let r = 0; r < m.rows.length; r++) {
    const last = m.rows[r].length - 1;
    if (r >= m.headerRowCount && !m.rows[r][1].content) { // a lone first cell heads a group
      m = setCellBackground(mergeCells(m, span(r, 0, r, last)), at(r, 0), col('tint'));
    } else for (const c of codes) m = setAlignment(m, at(r, c), 'center');
  }
  return m; // no split code: the engine cuts it between rows and repeats the head
}

يخرج جدول الأطراف وخريطة السجلات كلاهما من groupedTable. الصف الذي لم تُملأ منه إلا خليته الأولى يُدمج عبر الجدول ويُظلَّل بالبنفسجي بوصفه رأس مجموعة. خلية TSV لا تتسع لكسر سطر، فتكتب البيانات \n وتحوّله الدالة إلى كسر؛ والسطر الذي يبدأ بـ• يُنضَّد عندئذ بندًا في قائمة. وتوضع الرموز القصيرة في نمط الشارة code، الذي لا تعبئة له ولا حدّ ولا حشوة جانبية، وينضّدها بحرف Fira Mono بحجم 0.9 em. وحين لا يتسع جدول عائم للعمود الفارغ المعروض عليه، يقطعه المحرّك بين الصفوف ويضع بقيته في الموضع الشاغر التالي، تحت الرأس المكرر، مع (continued) بعد التعليق. ويأتي سطر continuesMarker، “Continued on the next page”، تحت الجزء الأول، وتنتظر الملاحظة الجزء الأخير (الجداول الأطول من الصفحة).

#4 · أسلوب واحد للدار، ونسخة لكل جدول

script.js · الأسطر 191–206في الشيفرة الكاملة
  tableStyle: { headerBackground: col('brand'), headerColor: col('paper'), headerFontFamily: COND,
    headerFontSize: pt(8.5), bodyFontSize: pt(8), rules: 'horizontal', borderColor: col('rule'),
    borderWidth: pt(0.5), cellPadding: mm(1.3) },
  tableStyles: [ // a resource picks one with table.styleId
    // White rules cut the fills apart and show where each merge and each group ends.
    { id: 'electrical', borderColor: col('paper'), borderWidth: pt(1.4), cellPadding: mm(1.1),
      figureStyle: 'tabular' }, // Fira's tnum: the digits of Min, Typ and Max line up
    // Written out although it is the default: 'clip' and 'hide' cut a table taller than the page.
    { id: 'grouped', overflow: 'split', continuedSuffix: '(continued)',
      continuesMarker: 'Continued on the next page' },
    // A compact list in the condensed face, boxed by a rounded outer frame.
    { id: 'ordering', headerBackground: col('tint'), headerColor: col('brand'),
      rules: 'outer', borderRadius: mm(1.5), bodyFontFamily: COND },
  ],
  captionStyle: { fontFamily: COND, fontSize: pt(9.5), labelColor: col('brand'), gap: mm(2),
    note: { fontSize: pt(7.5), color: col('muted') } },

يتضمّن tableStyle ما تشترك فيه الجداول كلها. وكل مدخل في tableStyles لا يضبط إلا ما تغيّره جداوله، ويختار المورد أحدها بـtable.styleId. يستبدل الجدول الكهربائي بالخطوط الرمادية الرفيعة خطوطًا بيضاء بسماكة 1.4 pt، تقطع تعبئاته بعضها عن بعض وتُظهر أين ينتهي كل دمج. ويأخذ جدول رموز الطلب حدًّا خارجيًا مستدير الزوايا وحرف Fira Sans Condensed، فتتسع أعمدته الأربعة في عمود نص واحد. ويطلب figureStyle: 'tabular' في أسلوب الجدول الكهربائي من Fira Sans الخاصية tnum، أي أرقامًا متساوية العرض، فتصطف أرقام Min وTyp وMax في كل عمود.

#5 · تسميات تبقى نصًا في PDF

script.js · الأسطر 536–541في الشيفرة الكاملة
// label() writes each <text> with font-family="Fira Mono". loadSvg runs the markup through
// inlineSvgFonts, which embeds that face in the SVG, so the canvas draws the labels in it;
// the PDF sets them as real text in the Fira Mono it embeds.
await loadSvg('logo.svg', logo);
const drawings = { pinout: pinout(), circuit: circuit(), outline: outline() }; // by resource id
for (const [id, markup] of Object.entries(drawings)) await loadSvg(`${id}.svg`, markup);

تسميات توزيع الأطراف والدائرة ومخطط الغلاف عناصر <text> تطلب Fira Mono، خط التسميات في المستند. يصل SVG إلى Canvas صورةً، ولذلك تمرّر loadSvg الخاصة بالعدّة الترميز أولًا عبر inlineSvgFonts، فتضمّن في SVG الخطوط التي يذكرها نصه؛ فيرسم Canvas التسميات بخط Fira Mono. أما PDF فينضّد كل <text> نصًا قابلًا للتحديد بالخطوط التي يضمّنها.

#6 · صفحة الافتتاح والترويسة والتذييل

script.js · الأسطر 96–146في الشيفرة الكاملة
const place = (to, edge, x, y, size) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) },
  ...(size && { size }) });
const inset = (edge, y, size) => // a page corner, moved in by the side margin
  place('page', edge, edge.endsWith('left') ? MARGIN.x : -MARGIN.x, y, size);
const text = (id, content, family, size, color, placement, extra) => ({ kind: 'text', id,
  content, fontFamily: family, fontSize: pt(size), color: col(color), placement, ...extra });
const caps = (size, weight = 600) => ({ fontWeight: weight, letterSpacing: pt(size * 0.16),
  textTransform: 'uppercase' });
const badge = { ...caps(7.5, 700), box: { backgroundColor: col('hazard'),
  padding: { top: pt(1.6), bottom: pt(1.4), left: pt(4), right: pt(4) } } };
const mark = (size, edge, y) => ({ kind: 'image', id: 'mark', resourceId: 'logo', // by id
  placement: inset(edge, y, { width: mm(size) }) });
const maker = (size, color, y) => text('maker', 'Pyxis Microdevices', COND, size, color,
  place('#mark', 'right-of', size / 4, y), caps(size));
const keyFigure = (n, y) => [ // {attr.k1} over its label {attr.k1l}, flush right on the band
  text(`k${n}`, `{attr.k${n}}`, COND, 22, 'paper', inset('top-right', y), { fontWeight: 600 }),
  text(`k${n}l`, `{attr.k${n}l}`, COND, 7, 'tint', inset('top-right', y + 9), caps(7))];
const BAND = 84; // mm: the violet band across the head of page 1
// The band under the top margin and 9 mm or more of white, in whole grid lines (16 here).
const OPENER_LINES = Math.ceil((BAND - MARGIN.y + 9) / (LEAD * 25.4 / 72));
const opener = {
  enabled: true, minHeight: pt(OPENER_LINES * LEAD), // so the columns under it start on the grid
  slot: { elements: [
    { kind: 'box', id: 'band', style: { backgroundColor: col('brand') }, placement: {
      anchor: { to: 'bleed', edge: 'top-left' }, size: { width: 'fill', height: mm(BAND) } } },
    mark(6, 'top-left', 12), maker(8.5, 'paper', 1.7),
    text('doc', 'Datasheet {subtitle} · {publishDate}', MONO, 7.5, 'tint',
      inset('top-right', 13.6)),
    text('kicker', '{attr.kicker}', COND, 9.5, 'tint', inset('top-left', 30), caps(9.5)),
    text('title', '{titleText}', COND, 64, 'paper', place('#kicker', 'below', 0, 0.5),
      { fontWeight: 700, lineHeight: 1 }),
    text('lead', '{attr.lead}', 'Fira Sans', 12, 'paper', place('#title', 'below', 0, 2.5,
      { width: mm(108) }), { lineHeight: 1.32, align: 'left' }), // wraps within its width
    text('status', 'Preliminary', COND, 7.5, 'ink', place('#lead', 'below', 0, 4.5), badge),
    ...[1, 2, 3].flatMap((n) => keyFigure(n, 15 + 15 * n)),
  ] },
};
const header = { elements: [ // body pages only: the opener has its band
  text('running-title', '{chapterTitle}', COND, 9, 'brand', inset('top-left', 10.4),
    { fontWeight: 700, pages: 'body' }),
  text('flag', 'Preliminary', COND, 7.5, 'ink', inset('top-right', 10.2),
    { ...badge, pages: 'body' }),
  { kind: 'rule', id: 'hairline', pages: 'body', thickness: pt(0.5), color: col('rule'),
    placement: inset('top-left', 15.5, { width: mm(TRIM[0] - 2 * MARGIN.x) }) },
] };
const footer = { elements: [ // every page: an image element works in a running slot too
  mark(4.5, 'bottom-left', -9), maker(7, 'ink', 1.2),
  text('folio', '{pageNumber}/{totalPages}', COND, 8, 'brand', inset('bottom-right', -9.6),
    { fontWeight: 700 }),
  text('doc', '{subtitle} ·', MONO, 7, 'muted', place('#folio', 'left-of', -1.5, 0.4)),
] };

رقم القطعة هو عنوان المستوى الأول، وخانة تصميمه ترسم صفحة الافتتاح: صندوقًا بنفسجيًا يمتد إلى النزف، والشعار، وسطرًا تمهيديًا ومقدمة وثلاثة أرقام رئيسية تُقرأ من سمات العنوان. تعمل عناصر الصور في الخانات المتكررة كما تعمل في صفحات الافتتاح، فيبدأ التذييل بعنصر يحدّد مورد الشعار. ولعناصر الترويسة pages: 'body'، فلا يُطبع أي منها في الصفحة الأمامية.

الوصفة كاملة

Sandbox
// ═══ Postext Cookbook · Nº 010 · Datasheet: tables from data, merged headers ════════
// https://postext.dev/en/cookbook/technical-datasheet
// Code: MIT · Text: original (CC BY 4.0) · Drawings: generated in code (CC BY 4.0)
// Fonts: Fira Sans, Fira Sans Condensed, Fira Mono (SIL OFL 1.1) · Needs postext ≥ 1.65.0
// The datasheet of a fictional sensor. Postext reads no pipe tables, so the tables are data:
// TSV pasted from a spreadsheet, parsed into table models, then merged, aligned and filled.
import {
  buildDocumentWithFonts, prepareFonts, renderPageToCanvas, registerResourceImage,
  defaultResourceTypes, parseTSV, mergeCells, setAlignment, setCellBackground, inlineSvgFonts,
} 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 = 'technical-datasheet';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
const palette = { // eight named colours; every colour in the config links to one of them
  ink: '#16181d', brand: '#5a2a8a', // text; Pyxis violet: the band, table heads, numbers
  tint: '#eee6f5', zebra: '#f3f4f6', // violet wash for groups and pins; every other row
  hazard: '#f2b705', rule: '#c9ccd3', // maximum ratings and the badge; hairlines
  muted: '#5d636d', paper: '#ffffff', // running heads, notes and units; white
};
// Every colour carries its paletteId: change a value in `palette` and all its uses follow.
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = [ // the defaults link to 'main-color', so it is set to the brand violet
  ...Object.entries(palette).map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } })),
  { id: 'main-color', name: 'brand (defaults)', value: { hex: palette.brand, model: 'hex' } },
];

// #region answer: pasted TSV becomes a table: two header rows, merged cells, zebra fills
const at = (row, column) => ({ row, col: column });
const span = (r0, c0, r1, c1) => ({ start: at(r0, c0), end: at(r1, c1) });
const C = { group: 0, param: 1, symbol: 2, conditions: 3, min: 4, max: 6, unit: 7 }; // columns
function electricalTable(tsv) {
  // headerRows marks the head, two rows here, which a split table would repeat on each part.
  let m = Object.assign(parseTSV(tsv, { headerRows: 2 }), {
    columnWidths: [22, 44, 16, 38, 15, 15, 15, 15] }); // weights: mm of the 180 mm measure
  // 'Parameter' covers two columns and two rows; 'Value' spans Min, Typ and Max. mergeCells
  // marks the covered cells hiddenBy, so no column shifts (gotcha: merged-cells-hiddenby).
  for (const range of [span(0, C.group, 1, C.param), span(0, C.symbol, 1, C.symbol),
    span(0, C.conditions, 1, C.conditions), span(0, C.min, 0, C.max),
    span(0, C.unit, 1, C.unit)]) {
    m = mergeCells(m, range); // 'Value' is centred over its three columns, the rest set left
    m = setAlignment(m, range.start, range.start.col === C.min ? 'center' : 'left', 'middle');
  }
  // Min, Typ and Max go right, over their figures; setAlignment clears a vAlign it is not given.
  for (let c = C.min; c <= C.max; c++) m = setAlignment(m, at(1, c), 'right');
  let zebra = false;

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

تنويعات

#خطوط رمادية بين كل الصفوف

تفصل خطوط بسماكة نصف نقطة بلون rule الرمادي من لوحة الألوان بين كل الصفوف، مملوءة كانت أم لا؛ أما الخطوط البيضاء فتختفي حيث يلتقي صفّان غير مملوءين.

-    { id: 'electrical', borderColor: col('paper'), borderWidth: pt(1.4), cellPadding: mm(1.1),
+    { id: 'electrical', borderColor: col('rule'), borderWidth: pt(0.5), cellPadding: mm(1.1),

#ضع تعليقات الجداول على شريط

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

-    ...(type.id === 'table' && { captionStyle: { position: 'above' } }) })),
+    ...(type.id === 'table' && { captionStyle: { position: 'above', backgroundEnabled: true,
+      background: col('ink'), color: col('paper'), labelColor: col('hazard') } }) })),

أخطاء شائعة

خطأ شائع

الخلايا المدمجة تحتاج إلى خلايا نائبة hiddenBy: استخدم mergeCells

تُوزَّع الخلايا بحسب موضعها في مصفوفة الصف، فالخلية المدمجة تحتاج إلى خلايا نائبة معلَّمة بـ hiddenBy حيث تمتد؛ وحذفها، كما يفعل HTML، يزيح كل الأعمدة التالية. ابنِ الدمج بـ mergeCells. ومنذ postext 1.5 يُبلَّغ عن الجدول غير المنتظم الشبكة في doc.contentWarnings تحت raggedTableGrid، ويعلّم parseTSV(text, { headerRows }) صفوف الترويسة. جداول من البيانات →

خطأ شائع

ملفات Fontsource تغطي الحروف لا الرموز

تضمّن العُدّة ملف latin من Fontsource لكل خط، ومعه ملف latin-ext للحروف č وł و†، وملف greek للحروف α وχ (في عائلة تضمه: لا يضمه Lora ولا Gelasio)، حين يستعملها النص، على الشاشة وفي PDF. أما رموز مثل → و≈ و✓ و★ فليست في أي من هذه الملفات فتغيب عن PDF: ارسمها، أو اكتبها رياضيات، أو اختر خطًا تضمها ملفاته. الخطوط المضمَّنة في PDF →

  • الجزء الأول من الجدول المنقسم يترك أسفل عموده للنص حين تتسع تحته ثلاثة أسطر أو أكثر، ويفعل ذلك دائمًا في عمود فيه عنصر عائم أصلًا. ابدأ الجدول الطويل حيث لا يحوي عموده عنصرًا عائمًا آخر، كما تفعل خريطة السجلات، واضبط صفوفه بحيث يبلغ الجزء الأول أسفل العمود.
  • عناصر نص التصميم متوسطة افتراضيًا. وللمقدمة عرض ثابت، فتحتاج إلى align: 'left' لتصطف تحت رقم القطعة.
  • في الصفحة الختامية من الفصل، يرفع Postext العناصر العائمة بعرض الصفحة الموضوعة تحت النص إلى سطر متن واحد تحته، فيقع الشكل bottom هناك تحت آخر سطر من النص بدلًا من أسفل الصفحة. صيغت الصفحة 4 بحيث تملأ أعمدتها، ورُسم المخطط بارتفاع 48.3 مم حتى ينتهي النص فوقه على خط من الشبكة. فلا يبقى للمخطط متسع ليصعد، وينتهي مستويًا مع أسفل الصفحات الأخرى. ويوقف layout.hugClosingFloats: false هذا الرفع.

الحقوق

الوصفة
Ignacio Ferro
النص
نص أصلي, CC BY 4.0
الخطوط
Fira Sans (SIL OFL 1.1) · Fira Sans Condensed (SIL OFL 1.1) · Fira Mono (SIL OFL 1.1)
الشيفرة
MIT، مثل Postext
SandboxPDF