باختصار
ورقة شهيرة في تعلّم الآلة أعيد تنضيدها من مصدرها المفتوح، فيها معادلات مرقّمة يمكن الإحالة إليها، ومبرهنات وتمهيديات في إطارات، وبراهين، ومراجع بنظام المؤلف والسنة.
ما الذي ستنضده
ورقة Direct Preference Optimization لرافايلوف وشارما وميتشل وإرمون ومانينغ وفين (NeurIPS 2023)، مختصرة من مصدرها في arXiv ومنضّدة مسودةً بحثية من عشر صفحات بقطع 7 × 10 بوصات. على شريط بلون البرقوق العنوان فوق حزمة من المنحنيات اللوجستية، وهي شكل الوزن الذي يمنحه تدرّج DPO لكل مثال. وتحته عمود واحد رحب من خط Spectral يضم ثلاث عشرة معادلة مرقّمة، والتعريف والتمهيديات والمبرهنة من القسم 5 في إطارات تبدأ بعنوانها على السطر نفسه، ومخطط برهان وبرهانًا كاملًا ينتهيان بمربع، وشكل المسار معادًا رسمه بالشيفرة، وعشرين عملًا مستشهدًا بها بنظام المؤلف والسنة. كل إحالة في النص إلى معادلة أو قضية أو قسم رابط، وكل رقم يأتي من وسم، كما في LaTeX.
تجيب هذه الوصفة عن
- كيف أرقّم المعادلات وأصوغ المبرهنات وأنضّد البراهين في ورقة رياضية، وكيف أحيل إليها؟
- كيف أنضد الرياضيات (مضمّنة، ومعروضة، ومعادلات) وأبقيها متجهية في ملف PDF؟
- كيف أعيد تنضيد ورقة بحثية مفتوحة الوصول من arXiv أو PubMed Central بـPostext، مع استشهاداتها وأشكالها وسطر ترخيصها؟
الجواب المختصر
// \label{eq:x} in a display formula numbers it, on its row of an align; a box opened as
// :::callout{type="lemma" #lem:x} counts as a statement. \eqref{eq:x}, \ref{lem:x} and
// :ref{id="lem:x"} print the number and link to it.
const equationNumbering = { // (1) to (13): one sequence through the paper and its appendix
numberingTemplate: '{n}', resetOn: 'never', format: '({n})' };
// A proof: an italic label with no number, and a □ flush right on its last line, drawn
// from TeX's \square because maths runs (Spectral has no □ of its own).
const proofOf = (label) => ({ endMark: '□',
numbering: { label, counter: false, bold: false, italic: true } });
const statements = [ // a counter per kind, as the paper has it: Definition 1, Lemma 1, Theorem 1
{ id: 'definition', numbering: { label: 'Definition' } },
{ id: 'lemma', numbering: { label: 'Lemma' } }, // counter: 'theorem' would share one sequence
{ id: 'theorem', numbering: { label: 'Theorem' } },
{ id: 'proof', ...proofOf('Proof') },
{ id: 'sketch', ...proofOf('Proof Sketch') },
];
المكونات
- الميزات
- الرياضياتإطارات التنبيهالإحالاتالاستشهادات بأسلوب توثيققائمة المراجع من البيانات المرجعيةالعناوين المرقّمةأنماط العناوينسمات العنوانصفحات افتتاح مصمَّمةالترويسات وأرقام الصفحاتالترويسات بحسب دور الصفحةالأشكال والجداول بوصفها مواردتعليقات مرقّمةنمط التعليقنمط الجدوللوحة ألوان دلاليةسطور المصدر والحقوقموضع الأشكالالتصدير إلى PDF
- تستخدم أيضًا
- إطارات تنقسم أو تبقى كاملةموازنة الأعمدةاستشهادات تضع الأشكالأشكال في هذا الموضع بالضبط«شكل» و«جدول» بلغتكالخروج عن الشبكة عمدًافواصل الصفحات والأعمدةأنماط الفقراتالخطوط المضمَّنة في PDFأنواع موارد مخصّصةالنص المرتفع والمنخفضفواصل الأسطر في العناوينفصول بلا أرقام
- الخطوط
- Spectral, Work Sans, JetBrains Mono (SIL OFL 1.1)
- الأصول
- لا شيء: كل صورة مرسومة بالشيفرة
طريقة التحضير
#1 · ضع وسومًا للمعادلات والقضايا وأحل إليها بمفاتيحها
الشيفرة هي الجواب المختصر أعلاه. منذ postext 1.19 يحتفظ المحرك بعدّادات LaTeX. يرقّم \label{eq:dpo} داخل معادلة معروضة هذه المعادلةَ بترتيب القراءة، برقم لكل سطر موسوم في align ولا رقم لسطر عليه \notag؛ ويجعل resetOn: 'never' العدّ يمضي من (1) عبر الملحق حتى (13)، كما أعيد ترقيم هذه الورقة المختصرة. والإطار الذي يُفتح بـ:::callout{type="lemma" #lem:same-policy} يبدأ بـ«Lemma 2.»، لأن في نمطه numbering: { label: 'Lemma' } وعدّادًا خاصًّا به. وفي النص يطبع \eqref{eq:dpo} الرقم (7)، و\ref{lem:same-policy} الرقم 2، و:ref{id="lem:same-policy"} العبارة Lemma 2، وكلها روابط إلى أهدافها؛ ويحفظ Eq.~\eqref{…} المسافة غير القابلة للكسر كما في LaTeX. وتبدأ التمهيدية المعادة في الملحق بـ***:ref{id="lem:same-preference"} Restated.***، فتأخذ الإحالة عريضَ العنوان الذي حولها. الأقسام لا تحتاج إلى عون: أرقامها من قوالب العناوين، و{startAt=3} يحفظ ترقيم الورقة بعد حذف القسم 2، وcrossRefs.section يكتب «Section 5» بحرف كبير كما في الأصل.
#2 · لكل بيئة إطارها
const box = ({ id, ...numbered }, extra) => ({ id, marginTop: pt(LEAD * 0.6),
marginBottom: pt(LEAD * 0.6), backgroundEnabled: false,
snapToGrid: false, // exact space round a statement, as amsthm's \topsep; one column, no grid
padding: { top: mm(1.8), right: mm(4), bottom: mm(1.8), left: mm(4) },
body: { italic: true, firstLineIndent: pt(0), boldColor: col('ink') }, ...extra, ...numbered });
const stripe = (color) => ({ enabled: true, side: 'left', width: pt(3), color: col(color) });
const proof = { keepTogether: false, // a long proof runs on to the next page
// A proof is upright text with an italic run-in label, set off by space alone.
padding: { top: pt(0), right: pt(0), bottom: pt(0), left: pt(0) },
body: { firstLineIndent: pt(0), italicColor: col('ink') } };
const look = { definition: { stripe: stripe('rule') }, lemma: { stripe: stripe('accent') },
theorem: { backgroundEnabled: true, background: col('tint') }, proof, sketch: proof };
const theoremStyles = [...statements.map((s) => box(s, look[s.id])),
box({ id: 'restated' }, look.lemma)]; // Lemma 1 again in the appendix, with no new number
كل بيئة نمط إطار بأداة واحدة: شريط رمادي للتعريف، وشريط برقوقي للتمهيديات، وأرضية برقوقية فاتحة للمبرهنة. تضع box() هذا المظهر فوق إعدادات الترقيم في الجواب المختصر. يجعل body.italic نص القضية مائلًا كما في نمط plain في amsthm، ويبقى العنوان الذي على السطر نفسه عريضًا قائمًا داخله. البرهان بلا إطار: عنوانه مائل بلا رقم (counter: false)، ويضع endMark: '□' مربعًا في طرف سطره الأخير، يُرسم بـ\square من TeX لأن محرك الرياضيات يعمل، وkeepTogether: false يسمح للبرهان الطويل بأن يمتد إلى الصفحة التالية. ويضمن snapToGrid: false الفراغ نفسه حول كل قضية؛ ففي عمود واحد لا جار له يحاذيه، يُقرأ الفراغ الدقيق أفضل من فراغ مقرَّب إلى شبكة الأسطر.
#3 · استشهد بالمؤلف والسنة من قائمة مراجع الورقة نفسها
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
const citations = { style: 'harvard-cite-them-right', link: true,
bibliography: { fontSize: pt(8.2), lineHeight: pt(10.8), hangingIndent: mm(5),
entrySpacing: pt(1.6), doi: 'link' } };
المراجع BibTeX في كتلة :::references{format=bibtex}، أعيد بناؤها من ملف .bbl للورقة ولم يبقَ فيها إلا الأعمال العشرون التي ما زال النص المختصر يستشهد بها. يكتبها أسلوب Cite Them Right Harvard «(Bong and Rinaldo, 2022)» في النص و«Ouyang, L. et al. (2022)» في القائمة، ويختصر قوائم المؤلفين من أربعة فأكثر إلى الاسم الأول. ويُنتج @ziegler2020finetuning في النص الصيغة السردية Ziegler et al. (2020). وتقع القائمة حيث يقع :::bibliography، بعد القسم 7 وقبل الملحق، كما في الورقة. ويبدأ :::pagebreak قبله الملحقَ في صفحة مستقلة كما تفعل أوراق المؤتمرات؛ ولولاه لترك العرض ذو الأسطر الأربعة في A.1 خمسة أسطر فارغة أسفل آخر صفحة من المراجع.
#4 · العنوان على شريط، والمصدر في أسفل الصفحة
const text = (id, content, family, size, color, placement, extra) => ({ kind: 'text', id,
content, fontFamily: family, fontSize: pt(size), color: col(color), align: 'left',
overflow: 'wrap', placement, ...extra });
const at = (to, edge, x, y, width) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) },
...(width && { size: { width: mm(width), height: 'auto' } }) });
const caps = (size, fontWeight = 600) => ({ fontWeight, letterSpacing: pt(size * 0.18),
textTransform: 'uppercase' });
const BAND = 80; // mm from the trim's top to the foot of the band
const titleBlock = {
enabled: true,
minHeight: mm(BAND + 13 - TOP), // the band, then the byline: the abstract starts under it
slot: { elements: [
{ kind: 'box', id: 'band', style: { backgroundColor: col('accent') },
placement: { anchor: { to: 'bleed', edge: 'top-left' },
size: { width: 'fill', height: mm(BAND + 3) } } }, // + 3 mm of bleed
{ kind: 'image', id: 'curves', resourceId: 'sigmoids', // drawn in code: σ(βu)
placement: at('page', 'top-left', 70, 3, 108) },
text('kicker', '{attr.kicker}', SANS, 7.5, 'mist',
at('page', 'top-left', INNER, 30, 120), caps(7.5)),
text('title', '{titleText}', SERIF, 25, 'paper', at('#kicker', 'below', 0, 3.5, MEASURE),
{ fontWeight: 600, lineHeight: 1.08 }),
text('venue', '{attr.venue}', MONO, 7, 'mist',
at('page', 'top-left', INNER, BAND - 7, 120), { overflow: 'clip' }),
text('authors', '{attr.authors}', SANS, 9.5, 'ink', at('page', 'top-left', INNER, BAND + 6,
MEASURE), { fontWeight: 500, lineHeight: 1.45 }),
text('affiliations', '{attr.affiliations}', SANS, 7.5, 'muted',
at('#authors', 'below', 0, 1.4, MEASURE)),
] },
};
const head = (id, content, parity, edge, x, extra) => text(id, content, SANS, 7.5, 'muted',
at('page', `top-${edge}`, x, 13), { overflow: 'clip', ...caps(7.5, 500), align: edge,
parity, pages: 'body', ...extra });
const folio = { fontWeight: 700, color: col('accent') };
// The running heads are the paper's short forms: checks.contentInConfig allows them (#849).
const RUNNING = ['Rafailov, Sharma, Mitchell, Ermon, Manning & Finn',
'Direct Preference Optimization'];
const header = { elements: [
head('v-folio', '{pageNumber}', 'even', 'left', OUTER, folio),
head('v-title', RUNNING[0], 'even', 'left', OUTER + 9),
head('r-title', RUNNING[1], 'odd', 'right', -(OUTER + 9)),
head('r-folio', '{pageNumber}', 'odd', 'right', -OUTER, folio),
] };
const footer = { elements: [ // the first page: where the text comes from, and its licence
text('source', '{attr.source}', MONO, 6.2, // the H1's attribute, as kicker and venue are
'muted', at('page', 'bottom-left', INNER, -13, MEASURE - 10), { pages: 'opener' }),
text('drop-folio', '{pageNumber}', SANS, 7.5, 'accent', at('page', 'bottom-right', -OUTER, -13),
{ ...folio, align: 'right', pages: 'opener', overflow: 'clip' }),
] };
العنوان هو العنوان الوحيد من المستوى الأول، ونمطه paper يرسم بدلًا منه فتحة من عناصر التصميم: الشريط ينزف من أعلى الصفحة، والعنوان يلتفّ على عرض العمود، والمؤلفون والانتماءات تأتي من سمات العنوان، و¹ و² و* مكتوبة محارف. وعنصر التذييل ذو pages: 'opener' يطبع المصدر والترخيص والتغييرات في الصفحة 1 وحدها، كي تخبر الصفحة الأولى بمصدر النص حتى لو تداولها الناس وحدها.
#5 · أعد رسم الشكل بالشيفرة
const R = (x) => Math.round(x * 100) / 100;
const svg = (w, h, body) => `<svg xmlns="http://www.w3.org/2000/svg" width="${w * PX_PER_MM}" `
+ `height="${h * PX_PER_MM}" viewBox="0 0 ${w} ${h}">${body}</svg>`;
function sigmoids() { // 108 × 24 mm over the kicker: σ(βu) for β from 0.25 to 4
let out = '';
[0.25, 0.4, 0.6, 1, 1.6, 2.5, 4].forEach((beta, i) => {
const pts = Array.from({ length: 105 }, (_, k) => {
const u = (k - 52) / 8; // u from −6.5 to 6.5
return `${k ? 'L' : 'M'}${R(2 + k)} ${R(22 - 20 / (1 + Math.exp(-beta * u)))}`;
}).join('');
out += `<path d="${pts}" fill="none" stroke="${palette.mist}" stroke-width="${R(0.3
+ i * 0.06)}" stroke-opacity="${R(0.25 + i * 0.1)}"/>`;
});
return svg(108, 24, out);
}
function tex(markup, x, y, size, color = 'ink', anchor = 0) { // maths as MathJax paths
const r = renderMath(markup, false, 100);
const k = size / 1000;
return `<g transform="translate(${R(x - anchor * r.viewBox.width * k)} ${R(y)}) scale(${k})" `
+ `fill="${palette[color]}">${r.paths.map((p) => `<path d="${p.d}"/>`).join('')}</g>`;
}
// Each label names its family and weight: loadSvg embeds the Work Sans files they set.
const words = (x, y, s, { size = 2.6, weight = 400, color = 'ink', anchor = 'start' } = {}) =>
`<text x="${R(x)}" y="${R(y)}" font-family="${SANS}" font-weight="${weight}" `
+ `font-size="${size}" fill="${palette[color]}" text-anchor="${anchor}">${s}</text>`;
const rect = (x, y, w, h, stroke, fill = 'paper', r = 1.2) => `<rect x="${x}" y="${y}" `
+ `width="${w}" height="${h}" rx="${r}" fill="${palette[fill]}" stroke="${palette[stroke]}" `
+ 'stroke-width="0.35"/>';
function arrow(points, color) { // a line with a drawn head, never an SVG marker
const [[x1, y1], [x2, y2]] = points.slice(-2);
const a = Math.atan2(y2 - y1, x2 - x1);
const head = [a - 0.45, a + 0.45].map((t) => `${R(x2 - 2 * Math.cos(t))} ${R(y2 - 2
* Math.sin(t))}`);
return `<path d="M${points.map(([x, y]) => `${R(x)} ${R(y)}`).join('L')}" fill="none" `
+ `stroke="${palette[color]}" stroke-width="0.45"/><path d="M${head[0]}L${R(x2)} ${R(y2)}`
+ `L${head[1]}Z" fill="${palette[color]}"/>`;
}
function preferences(x, y, w) { // a prompt and two answers, the preferred one first
const page = (dx) => rect(x + dx, y + 15.5, 6, 7.2, 'rule', 'paper', 0.6)
+ [0, 1, 2].map((l) => `<path d="M${x + dx + 1.2} ${y + 17.6 + l * 1.6}h3.6" `
+ `stroke="${palette.rule}" stroke-width="0.4"/>`).join('');
return rect(x, y, w, 25, 'rule', 'tint')
+ words(x + 2.4, y + 4.6, 'PREFERENCE DATA', { size: 2.1, weight: 600, color: 'muted' })
+ tex('x', x + 2.4, y + 9.8, 3) + words(x + 4.3, y + 9.8, ': “write me a poem about',
{ size: 2.25 }) + words(x + 5.2, y + 13, 'the history of jazz”', { size: 2.25 })
+ page(2.4) + tex('y_w', x + 9.4, y + 20.6, 3) + tex('\\succ', x + 14, y + 20.4, 3, 'accent')
+ page(18.4) + tex('y_l', x + 25.4, y + 20.6, 3);
}
function pipeline() { // 130 × 64 mm: RLHF on the left, DPO on the right
const title = (x, name, sub, color) => words(x, 4, name, { size: 3.2, weight: 600, color })
+ words(x, 8, sub, { size: 2.3, color: 'muted' });
const model = (x, y, w, label, color) => rect(x, y, w, 9, color)
+ words(x + w / 2, y + 5.8, label, { size: 2.6, weight: 600, color, anchor: 'middle' });
const note = (x, y, lines, color, anchor) => lines.map((line, i) => words(x, y + i * 3, line,
{ size: 2.3, color, anchor })).join('');
return svg(MEASURE, 64, title(0, 'RLHF', 'Reinforcement learning from human feedback', 'ochre')
+ preferences(0, 14, 35) // 35 mm: the prompt's first line ends 32.6 mm into the box
+ arrow([[36, 26.5], [48, 26.5]], 'ochre') + note(42, 22.4, ['maximum'], 'ochre', 'middle')
+ note(42, 31.4, ['likelihood'], 'ochre', 'middle')
+ model(49, 22, 25, 'reward model', 'ochre') + model(49, 50, 25, 'LM policy', 'ochre')
+ arrow([[55, 31.5], [55, 49]], 'ochre')
+ note(53.4, 41.6, ['label rewards,', 'reinforcement', 'learning'], 'ochre', 'end')
+ arrow([[68, 49], [68, 31.5]], 'ochre') + note(69.6, 39, ['sample', 'completions'], 'ochre')
+ `<path d="M88 2V62" stroke="${palette.rule}" stroke-width="0.3"/>`
+ title(93, 'DPO', 'Direct preference optimization', 'accent')
+ preferences(93, 14, 37)
+ arrow([[111.5, 39.5], [111.5, 49]], 'accent')
+ note(113.2, 43.4, ['maximum', 'likelihood'], 'accent', 'start')
+ model(99, 50, 25, 'final LM', 'accent'));
}
يُرسم الشكل 1 بصيغة SVG من صناديق الأصل وكلماته. تذكر التسميات خط Work Sans في font-family، وتمرّر loadSvg الرسم إلى inlineSvgFonts في المحرّك، فيضمّن ملفّي Work Sans اللذين تستعملهما، وتكتب tex() التسمية y_w ≻ y_l مسارات MathJax، بالحروف نفسها التي تستعملها المعادلات. رؤوس الأسهم مسارات مرسومة لا علامات SVG، فيبقى الشكل متجهيًا في ملف PDF.
الوصفة كاملة
// ═══ Postext Cookbook · Nº 138 · Machine-learning paper with theorems and proofs ═══
// https://postext.dev/en/cookbook/ml-paper-theorems-proofs
// Code: MIT · Text: Rafailov et al. 2023, arXiv:2305.18290 (CC BY 4.0), abridged · Art: code
// Fonts: Spectral, Work Sans, JetBrains Mono (SIL OFL 1.1) · Needs postext ≥ 1.65.0
// DPO (NeurIPS 2023) re-set as a preprint: numbered equations with labels and references,
// definition, lemma and theorem boxes, proofs that end in a square, author–year citations.
import {
buildDocumentWithFonts, renderPageToCanvas, registerResourceImage, registerCitationEngine,
defaultResourceTypes, initMathEngine, renderMath, inlineSvgFonts,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';
import { createCiteprocEngine, STYLES, LOCALES } from 'https://esm.sh/postext-citeproc';
const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'ml-paper-theorems-proofs';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
const palette = {
ink: '#1d1a22', accent: '#6b2a5f', // text; plum: the band, labels, theorem stripes
ochre: '#a8621c', tint: '#f4edf2', // the RLHF route in Figure 1; the theorem fill
rule: '#cfc3cc', muted: '#675f6b', // hairlines; running heads, notes
mist: '#e3c9dc', paper: '#ffffff', // type and curves on the band; white
};
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = Object.entries({ ...palette, 'main-color': palette.accent })
.map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } }));
const [SERIF, SANS, MONO] = ['Spectral', 'Work Sans', 'JetBrains Mono'];
const [BODY, LEAD] = [9.6, 13.4]; // pt: one column of 130 mm, about 74 characters a line
// mm: a 7 × 10 in trim, as technical books and many preprint series print
const [TRIM_W, TRIM_H, TOP, BOTTOM, INNER, OUTER] = [178, 254, 22, 22, 21, 27];
const MEASURE = TRIM_W - INNER - OUTER;
// #region answer: amsthm in Markdown: numbered equations, theorems and proofs
// \label{eq:x} in a display formula numbers it, on its row of an align; a box opened as
// :::callout{type="lemma" #lem:x} counts as a statement. \eqref{eq:x}, \ref{lem:x} and
// :ref{id="lem:x"} print the number and link to it.
const equationNumbering = { // (1) to (13): one sequence through the paper and its appendix
numberingTemplate: '{n}', resetOn: 'never', format: '({n})' };
// A proof: an italic label with no number, and a □ flush right on its last line, drawn
// from TeX's \square because maths runs (Spectral has no □ of its own).
const proofOf = (label) => ({ endMark: '□',
numbering: { label, counter: false, bold: false, italic: true } });
const statements = [ // a counter per kind, as the paper has it: Definition 1, Lemma 1, Theorem 1
{ id: 'definition', numbering: { label: 'Definition' } },
{ id: 'lemma', numbering: { label: 'Lemma' } }, // counter: 'theorem' would share one sequence
{ id: 'theorem', numbering: { label: 'Theorem' } },
{ id: 'proof', ...proofOf('Proof') },
{ id: 'sketch', ...proofOf('Proof Sketch') },
يعمل ملف script.js المجمّع كما هو: الصقه في سكربت الوحدة (module) لأي صفحة، أو افتح الوصفة على CodePen. مجلد الوصفة على GitHub ↗ (يفتح في تبويب جديد)
تنويعات
#استشهد بالأرقام كما في قالب NeurIPS
تستعمل الورقة الأصلية استشهادات natbib المرقّمة؛ ويطبع IEEE [1] في النص ويرقّم القائمة بترتيب الاستشهاد.
-const citations = { style: 'harvard-cite-them-right', link: true,
+const citations = { style: 'ieee', link: true,#رقّم التمهيديات والمبرهنات معًا
بعض المجلات ترقّم القضايا كلها في سلسلة واحدة (تمهيدية 1، تمهيدية 2، مبرهنة 3)، كما يفعل \newtheorem{lemma}[theorem]. اجعل التمهيديات تعدّ بعدّاد المبرهنات.
- { id: 'lemma', numbering: { label: 'Lemma' } }, // counter: 'theorem' would share one sequence
+ { id: 'lemma', numbering: { label: 'Lemma', counter: 'theorem' } },أخطاء شائعة
خطأ شائع
الرياضيات تحتاج إلى await initMathEngine() قبل البناء الأول
الصيغ التي تُنضَّد قبل أن يعمل محرّك الرياضيات مربعات رمادية نائبة. استورد initMathEngine من https://esm.sh/postext مع سائر الرموز وانتظرها بـ await قبل البناء الأول؛ والمستند الذي فيه رياضيات ويُبنى من دونها يطبع تحذيرًا واحدًا في وحدة التحكم. ومنذ postext 1.5 يأتي MathJax داخل حزمة postext وحدةً واحدة تجلبها initMathEngine، فالاستيراد العادي يعمل من CDN ولا حاجة إلى ?bundle (حتى 1.4 كان يجب أن يأتي كل رمز من https://esm.sh/postext?bundle). استورد من عنوان URL واحد فقط: عنوانان يحمّلان محرّكين. الرياضيات →
خطأ شائع
علامة $ المجرّدة تفتح الرياضيات: اكتب \$
علامة الدولار تفتح رياضيات داخل السطر، فسعرٌ مثل $40 يبدأ صيغة. اكتب \$40. الهروب والمحارف الحرفية →
- لا يرسم
endMarkمربعاته (□ ∎ ■) من TeX إلا حين يعمل محرك الرياضيات. وفي مستند بلاinitMathEngine()تُنضَّد العلامة بخط متن الإطار، وليس في Spectral الحرف □ كسائر ملفات latin في Fontsource، فاختر هناك علامة يملكها الخط. - موازنة الأعمدة تملأ الصفحة التي تتركها معادلة طويلة قصيرةً بإضافة أسطر من الشبكة فوق عناوينها. يُبقي
balancing: { maxLinesPerHeading: 1 }عناوين الورقة قريبة من فراغها المعتاد، وقد تنتهي تلك الصفحة حينئذ قبل أسفلها ببضعة أسطر. - المعادلة التي يكون تعليق
\underbraceفيها أعرض من القوس، مثل تدرّج القسم 4، تحتاج إلى قطع بـaligned؛ وإذا كانت أعرض من العمود تجاوزته إلى اليمين.
الحقوق
- الوصفة
- Ignacio Ferro
- النص
- Abridged from Rafailov, R., Sharma, A., Mitchell, E., Ermon, S., Manning, C. D. and Finn, C. (2023) “Direct Preference Optimization: Your Language Model is Secretly a Reward Model”, Advances in Neural Information Processing Systems 36 (NeurIPS 2023), arXiv:2305.18290v3. Sections 2 and 5.2, most of 6 and appendices A.2–A.4, A.6 and B–E cut, other paragraphs and sentences shortened; section numbers kept, equations renumbered in the abridged order; citations re-set author–year; Figure 1 redrawn · Rafael Rafailov, Archit Sharma, Eric Mitchell, Stefano Ermon, Christopher D. Manning, Chelsea Finn · CC BY 4.0
- الخطوط
- Spectral (SIL OFL 1.1) · Work Sans (SIL OFL 1.1) · JetBrains Mono (SIL OFL 1.1)
- الشيفرة
- MIT، مثل Postext
حرّر هذا الشرح ↗ (يفتح في تبويب جديد)مجلد الوصفة على GitHub ↗ (يفتح في تبويب جديد)


