باختصار
بحث مشهور في علم الأحياء، مختصر ومنضّد من جديد كمقال في مجلة. يأتي قسم الطرائق بعد النص بحرف أصغر، وتتابع مراجعه العدّ من حيث توقف النص الرئيسي.
ما الذي ستنضده
خمس صفحات من مقال في مجلة لعلوم الحياة على A4: بحث Jumper وزملائه Highly accurate protein structure prediction with AlphaFold، مختصرًا من Nature بترخيص CC BY 4.0. يفتتح شريط أزرق الصفحة الأولى فوق العنوان، ثم المؤلفون الأربعة والثلاثون جميعًا بحرف 7.4 pt مع أرقام انتماء مرفوعة، ثم الملخص بخط عريض بعرض الصفحة. وتحته الشكل 1 بعرض الصفحة: مخطط أعمدة لدقة CASP14 التي يذكرها النص، والسلسلة الرئيسية للهدف T1049 مرسومة من PDB وفي داخلها نموذج AlphaFold ملونًا بحسب درجة الثقة. يستشهد النص بأرقام Nature المرفوعة. ويُختم النص الرئيسي بالمراجع 1–35. ثم يأتي قسم الطرائق بحرف 8.2 pt، والعمل الذي يُستشهد به فيه أول مرة يأخذ الرقم التالي، فتبدأ قائمته الخاصة من 36 كما في المجلة.
تجيب هذه الوصفة عن
- كيف أنضّد قسم الطرائق في مقالة علمية بحرف أصغر بعد النص الرئيس، مع استمرار ترقيم استشهاداته؟
- كيف أعيد تنضيد ورقة بحثية مفتوحة الوصول من arXiv أو PubMed Central بـPostext، مع استشهاداتها وأشكالها وسطر ترخيصها؟
- كيف أنضد أرقام الاستشهادات علوية وأجعل معرّفات DOI روابط فعّالة، كما تفعل المجلات الطبية؟
- كيف أضيف شكلًا بتعليق مرقّم وأحيل إليه في النص («انظر الشكل 3.2»)؟
الجواب المختصر
// [@key] prints a raised number in order of first citation, so a work the Methods cite for
// the first time takes the next number after the main text's last, and one cited again
// keeps its number. Nature prints two lists, and :::bibliography{scope=new} lists only the
// works no earlier list printed: the same block after the main text and after the Methods
// sets references 1–35, then 36–55.
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
const citations = {
style: 'nature', // raised 1–4, "Nature 577, 706–710 (2020)." entries
bibliography: { fontSize: em(0.8), lineHeight: pt(9.6), entrySpacing: pt(0.8),
labelWidth: mm(5), labelAlign: 'right' }, // 9. and 10. end together
};
const references = '### References\n\n:::bibliography{title="" scope=new}';
// "# Methods {style=\"methods\"}" opens a section that runs to the end of the article: an H1
// that breaks nothing, names no running chapter and sets its body two sizes down.
const methods = { id: 'methods', numbered: false, runningChapter: false,
breakBefore: { enabled: false }, fontFamily: SANS, fontSize: pt(11.5), lineHeight: pt(LEAD),
fontWeight: 700, color: col('ink'), marginTop: pt(LEAD), marginBottom: pt(LEAD / 2),
bodyStyle: { fontSize: pt(8.2), lineHeight: pt(SMALL) } };
المكونات
- الميزات
- أنماط العناوينالاستشهادات بأسلوب توثيققائمة المراجع من البيانات المرجعيةالنص المرتفع والمنخفضصفحات افتتاح مصمَّمةسمات العنوانإطارات التنبيهإطارات بعرض الصفحةالترويسات وأرقام الصفحاتالترويسات بحسب دور الصفحةأشكال في هذا الموضع بالضبطنمط التعليقسطور المصدر والحقوقنمط الجدولتعليقات مرقّمةأنماط الفقراتلوحة ألوان دلاليةالتصدير إلى PDFالخطوط المضمَّنة في PDF
- تستخدم أيضًا
- استشهادات تضع الأشكال«شكل» و«جدول» بلغتكأنواع موارد مخصّصةالأشكال والجداول بوصفها مواردفصول بلا أرقام
- الخطوط
- Noto Serif, Noto Sans (SIL OFL 1.1)
- الأصول
- Fig. 1b, experimental Cα coordinates of PDB 6Y4F (Jiang et al. 2020), drawn in code (Worldwide Protein Data Bank, CC0 1.0)
- Fig. 1b, AlphaFold DB model AF-B4EUK6-F1 (AlphaFold Monomer v2.0) and its pLDDT, superposed and drawn in code (DeepMind Technologies Limited and EMBL-EBI, AlphaFold Protein Structure Database, CC BY 4.0)
طريقة التحضير
#1 · قائمتا مراجع بترقيم واحد
الشيفرة هي الجواب المختصر أعلاه. تُرقَّم الاستشهادات بترتيب أول ورود لها، فلا يلزم أي إعداد لمتابعة العدّ: يأخذ jackhmmer الذي يُستشهد به أول مرة في الطرائق الرقم 36، ويحتفظ حقل قوى Amber الذي ذُكر من قبل في النص برقمه 30. وتأتي القائمتان من :::bibliography{scope=new}، التي لا تطبع إلا الأعمال التي لم تطبعها قائمة سابقة. يضع البرنامج الكتلة نفسها بعد المناقشة وبعد الطرائق: تنضد الأولى المراجع من 1 إلى 35، والثانية من 36 إلى 55، ولا يتكرر Amber. عنوان الطرائق عنوان من المستوى الأول بنمط خاص به؛ يضبط bodyStyle فيه القسم على 8.2 pt بتباعد أسطر 10.8 pt، ويُبقيه breakBefore: { enabled: false } في العمود، ويُبقي runningChapter: false عنوان المقال في الترويسات. ولبحثك أنت، الصق ما تصدّره من ملف .bib في كتلة :::references{format=bibtex}، واستشهد بـ[@key] ملاصقًا للكلمة، وغيّر nature إلى نمط مجلتك.
#2 · كتلة عنوان تتسع لأربعة وثلاثين مؤلفًا
const text = (id, content, family, size, extra) => ({ kind: 'text', id, content, align: 'left',
fontFamily: family, fontSize: pt(size), color: col('ink'), overflow: 'wrap', ...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 = { fontFamily: SANS, fontWeight: 600, letterSpacing: pt(1.4),
textTransform: 'uppercase' };
const titleBlock = { enabled: true,
minHeight: mm(50),
slot: { elements: [
{ kind: 'box', id: 'band', style: { backgroundColor: col('accent') },
placement: { anchor: { to: 'page', edge: 'top-left' },
size: { width: 'fill', height: mm(14) } } },
text('kicker', '{attr.kicker}', SANS, 8.5, { ...caps, color: col('paper'),
placement: at('page', 'top-left', INNER, 5.6, 120) }),
text('title', '{titleText}', SANS, 23, { fontWeight: 700, lineHeight: 1.12,
placement: at('container', 'top-left', 0, 1, MEASURE - 30) }),
text('authors', '{attr.authors}', SANS, 7.4, { inlineMarks: true, lineHeight: 1.42,
placement: at('#title', 'below', 0, 4, MEASURE) }),
{ kind: 'rule', id: 'rule', thickness: pt(0.5), color: col('rule'),
placement: at('#authors', 'below', 0, 3, MEASURE) },
text('source', '{attr.source}', SANS, 7, { color: col('muted'),
placement: at('#rule', 'below', 0, 1.6, MEASURE) }),
] },
};
قائمة المؤلفين سمة واحدة من سمات العنوان، authors="John Jumper^1,4^, Richard Evans^1,4^, …"، منضدة بخط Noto Sans بحجم 7.4 pt على كامل عرض السطر، حيث تشغل الأسماء الأربعة والثلاثون خمسة أسطر. ترفع inlineMarks أرقام الانتماء. وتنتقل الانتماءات وملاحظة المساهمة المتساوية إلى آخر المقال تحت Author information، كما تطبعها Nature، فتبقى في الصفحة الأولى مساحة للملخص والشكل. لا يُحذف أي مؤلف: ترويسة الصفحات الزوجية وحدها تختصر القائمة إلى Jumper et al.
#3 · الملخص بعرض الصفحة والشكل 1 تحته
const resources = () => [
{ id: 'fig1', typeId: 'figure', kind: 'svg', createdAt: 0, updatedAt: 0,
placement: { position: 'here', span: 'page' },
svg: { fileId: 'fig1.svg', width: 1780, height: 640 },
caption: '**AlphaFold produces highly accurate structures.** **a**, Median accuracy on the '
+ 'CASP14 domains of AlphaFold and of the next best method, as r.m.s.d.~95~ over Cα atoms '
+ '(backbone) and over all atoms, with 95% confidence intervals; the dashed line is the '
+ 'width of a carbon atom, about 1.4 Å. **b**, CASP14 target T1049 (PDB 6Y4F): the '
+ 'experimental Cα trace (grey) and the AlphaFold model of the same chain, coloured by '
+ 'its per-residue confidence (pLDDT).',
note: 'Redrawn for this edition. a, from the values given in the text (the original plots '
+ 'the top 15 of 146 entries). b, from PDB 6Y4F (CC0) and AlphaFold DB model '
+ 'AF-B4EUK6-F1, AlphaFold Monomer v2.0 (CC BY 4.0), superposed on 134 Cα atoms; the '
+ 'original shows the CASP14 prediction.',
altText: 'Bars: AlphaFold 0.96 and 1.5 Å, next best 2.8 and 3.5 Å. Two backbones that '
+ 'lie almost on top of each other.' },
{ id: 'tbl-timings', typeId: 'table', kind: 'table', createdAt: 0, updatedAt: 0,
placement: { position: 'here' },
caption: '**Inference times.** One model on one V100 GPU, by protein length.',
note: 'Compiled for this edition from the timings given in ‘Inference regimen’.',
table: { model: { headerRowCount: 1, columnWidths: [1, 1.3, 1.3], rows: [
['Residues', 'With ensembling (CASP14)', 'Without ensembling'],
['256', '4.8 min', '0.6 min'], ['384', '9.2 min', '1.1 min'],
['2,500', '18 h', '2.1 h'],
].map((row, r) => row.map((content, c) => ({ content, ...(r === 0 && { isHeader: true }),
...(c > 0 && { align: 'right' }) }))) } } },
];
الملخص إطار بـspan: 'page' بلا حدود، ونصه بخط Noto Sans نصف العريض. ويليه الشكل 1 بـ::resource{id="fig1"}، وموضعه { position: 'here', span: 'page' } ينضده عبر العمودين في تلك النقطة؛ ويبدأ عمودا النص تحت تعليقه. يبدأ التعليق بجملة عريضة كما في تعليقات Nature؛ ويجعل captionPrefix في النوع وlabelSeparator في نمط التعليق التسمية تُقرأ Fig. 1 |. ويُدرج الجدول 1 في موضعه من الطرائق بـposition: 'here' ويبقى في عموده.
#4 · السلسلة الرئيسية لبروتين مرسومة من إحداثيات مفتوحة
// PDB 6Y4F chain A, residues 25–158: Cα x, y in tenths of Å, depth z in Å (CC0)
const EXP = [
-56,-91,-6,-36,-77,-3,-4,-98,-2,26,-81,-1,63,-86,-1,95,-73,1,116,-100,2,146,
-79,3,159,-46,2,187,-34,4,209,-6,3,211,10,0,187,17,-3,182,53,-2,185,46,2,
167,14,3,148,-4,6,122,-28,4,109,-58,6,76,-67,4,45,-89,4,11,-79,3,-2,-114,
3,-37,-116,1,-64,-95,0,-87,-117,-2,-124,-110,-2,-135,-80,-5,-161,-95,-7,-158,
-74,-10,-173,-41,-9,-141,-20,-9,-148,15,-8,-128,31,-5,-105,55,-7,-106,82,-4,
-144,80,-3,-156,116,-3,-122,132,-2,-126,155,1,-102,131,3,-88,98,2,-68,72,4,
-58,37,3,-23,33,4,6,10,5,32,28,2,59,21,0,68,31,-4,89,62,-3,96,70,-7,102,
52,-10,65,59,-11,53,41,-8,39,71,-6,38,70,-2,64,79,0,59,86,4,33,60,5,42,
36,8,7,42,9,-29,48,8,-55,21,9,-88,39,8,-105,69,6,-122,57,3,-134,87,1,-170,
78,2,-167,42,1,-180,38,-3,-165,5,-4,-132,-13,-3,-150,-42,-2,-161,-18,1,-125,
-6,1,-114,-43,2,-141,-49,4,-129,-20,6,-92,-30,6,-98,-66,7,-120,-57,10,-94,
-33,11,-62,-52,11,-54,-89,11,-36,-104,8,-8,-109,7,3,-73,8,40,-75,9,67,-51,
10,93,-26,9,92,8,7,119,30,5,128,47,2,151,77,2,149,93,-2,152,82,-5,173,52,
-6,150,22,-6,162,-13,-8,144,-44,-6,119,-43,-9,109,-8,-8,106,-15,-4,72,-24,
-3,53,-20,0,15,-23,0,-19,-8,1,-20,28,-1,-48,53,-1,-38,89,0,-52,122,1,-25,
128,3,-19,107,7,18,115,7,47,129,5,57,121,1,26,112,-1,28,122,-4,-9,117,-5,
-8,83,-3,-9,51,-5,-13,14,-5,-49,3,-4,-61,-14,-8,-50,-50,-8,-19,-46,-6,8,
-72,-7,43,-65,-6,67,-94,-5,43,-121,-6,32,-148,-3,-6,-157,-3,-17,-192,-4,-23,
-216,-1,
];
// AlphaFold DB AF-B4EUK6-F1, the same residues superposed on 6Y4F (CC BY 4.0)
const MODEL = [
-57,-93,-6,-37,-77,-3,-5,-98,-2,25,-82,-1,63,-87,-1,94,-74,1,112,-103,3,144,
-84,3,158,-50,2,189,-34,4,209,-2,3,212,16,0,187,21,-3,181,57,-2,181,48,2,
166,13,2,148,-4,5,122,-29,4,110,-58,6,76,-66,4,46,-88,4,12,-79,3,0,-115,3,
-37,-113,2,-64,-95,0,-87,-118,-2,-125,-110,-2,-136,-81,-4,-162,-95,-7,-155,
-74,-10,-173,-42,-9,-141,-22,-9,-146,14,-8,-126,31,-5,-102,55,-7,-106,83,-4,
-143,81,-4,-156,117,-3,-122,132,-2,-123,157,1,-101,132,3,-86,98,2,-68,72,4,
-58,36,3,-22,32,4,7,8,4,32,26,2,61,20,0,67,31,-4,89,62,-3,95,73,-7,100,
56,-10,64,67,-11,52,44,-8,40,74,-6,38,68,-2,65,77,0,59,84,4,35,56,5,45,
30,8,10,37,9,-25,47,8,-54,21,9,-86,40,8,-105,69,6,-120,56,3,-132,87,1,
-169,78,2,-166,42,0,-177,37,-3,-163,3,-4,-130,-15,-3,-150,-42,-2,-162,-17,1,
-125,-5,1,-114,-42,2,-142,-47,5,-129,-15,7,-93,-28,6,-103,-62,8,-122,-46,11,
-90,-26,12,-62,-52,11,-59,-89,10,-37,-104,7,-8,-110,7,3,-74,8,40,-74,9,66,
-48,10,95,-26,9,95,7,7,124,30,6,127,45,2,147,78,2,145,92,-1,153,87,-5,172,
54,-6,147,26,-7,158,-6,-8,145,-39,-7,117,-42,-10,105,-7,-8,106,-14,-5,72,
-24,-3,54,-21,0,16,-25,0,-18,-8,0,-19,27,-1,-48,52,-1,-37,88,0,-51,122,1,
-26,127,4,-23,104,7,15,108,7,45,124,5,57,120,2,26,111,-1,31,123,-4,-7,116,
-5,-5,83,-3,-8,51,-5,-12,14,-5,-48,2,-5,-62,-14,-8,-53,-52,-8,-20,-47,-6,5,
-74,-7,39,-66,-5,64,-95,-5,99,-89,-7,117,-72,-4,146,-94,-2,178,-75,-3,190,
-46,-1,
];
// The model's per-residue pLDDT, read from its B-factor column
const PLDDT = [
87,89,87,87,83,87,82,84,85,84,82,79,81,86,90,89,93,93,94,95,92,95,87,90,
93,87,89,88,82,75,87,92,97,98,98,98,98,98,98,98,98,99,99,99,99,99,98,96,
94,93,90,84,87,89,95,95,96,97,98,98,98,98,98,98,99,99,99,98,98,98,98,97,
97,98,98,98,98,98,98,97,98,98,96,95,89,96,97,96,96,96,96,94,93,91,88,86,
82,73,67,61,61,69,83,89,96,97,98,99,99,98,98,97,96,97,96,96,95,95,96,97,
97,96,97,94,87,90,84,82,69,65,64,61,55,53,
];
const n2 = (v) => +v.toFixed(2);
// The figure names Noto Sans on its root; loadSvg embeds the faces its labels set
// (inlineSvgFonts), so the canvas and the PDF draw them in the page's own sans.
const label = (x, y, s, size = 2.5, extra = '') => { // ink unless extra sets a fill
const fill = extra.includes('fill') ? '' : `fill="${palette.ink}" `;
return `<text x="${n2(x)}" y="${n2(y)}" font-size="${size}" ${fill}${extra}>${s}</text>`;
};
// a: median r.m.s.d.95 with its 95% interval, as the text gives them
const ACCURACY = [
{ group: 'Backbone', af: [0.96, 0.85, 1.16], next: [2.8, 2.7, 4.0] },
{ group: 'All-atom', af: [1.5, 1.2, 1.6], next: [3.5, 3.1, 4.2] },
];
function bars() {
const [L, B, T, H] = [9, 54, 8, 4.5]; // axis left, baseline, top, Å at the top
const y = (v) => B - (v / H) * (B - T);
let s = label(0, 3.2, 'a', 3.6, 'font-weight="700"');
for (const v of [0, 1, 2, 3, 4]) {
s += `<path d="M${L} ${n2(y(v))}H58" stroke="${palette.rule}" stroke-width="0.15"/>`
+ label(L - 1.5, y(v) + 0.9, v, 2.5, 'text-anchor="end"');
}
s += label(1.6, 31, 'r.m.s.d.<tspan font-size="1.8" dy="0.6">95</tspan><tspan dy="-0.6"> (Å)'
+ '</tspan>', 2.5, 'text-anchor="middle" transform="rotate(-90 1.6 31)"');
ACCURACY.forEach(({ group, af, next }, g) => {
const x0 = L + 4 + g * 24;
[[af, palette.accent], [next, palette.rule]].forEach(([[m, lo, hi], fill], k) => {
const x = x0 + k * 10;
s += `<rect x="${x}" y="${n2(y(m))}" width="8" height="${n2(B - y(m))}" fill="${fill}"/>`
+ `<path d="M${x + 4} ${n2(y(lo))}V${n2(y(hi))}M${x + 2.6} ${n2(y(lo))}h2.8M${x + 2.6} `
+ `${n2(y(hi))}h2.8" stroke="${palette.ink}" stroke-width="0.3" fill="none"/>`
+ label(x + 4, B - 1.4, m.toFixed(m < 1 ? 2 : 1), 2.3, // inside the bar's foot
`text-anchor="middle" fill="${k ? palette.ink : palette.paper}"`);
});
s += label(x0 + 9, B + 4, group, 2.6, 'text-anchor="middle"');
});
let dash = '';
for (let x = L; x < 57; x += 2.4) dash += `M${n2(x)} ${n2(y(1.4))}h1.4`;
s += `<path d="${dash}" stroke="${palette.ink}" stroke-width="0.3"/>`
+ `<path d="M${L} ${B}H58" stroke="${palette.ink}" stroke-width="0.35"/>`
+ `<rect x="${L + 2}" y="59.3" width="2.6" height="2.6" fill="${palette.accent}"/>`
+ label(L + 5.5, 61.6, 'AlphaFold') + `<rect x="${L + 22}" y="59.3" width="2.6" `
+ `height="2.6" fill="${palette.rule}"/>` + label(L + 25.5, 61.6, 'Next best method');
return s;
}
// b: both chains as smooth Cα traces, far segments first
const BANDS = [[90, '#0053d6', 'pLDDT > 90'], [70, '#65cbf3', 'pLDDT 70–90'],
[50, '#ffdb13', 'pLDDT 50–70'], [0, '#ff7d45', 'pLDDT < 50']];
const band = (p) => BANDS.find(([min]) => p > min);
function trace(xyz, cx, cy, k) {
const pt = (i) => [cx + xyz[3 * i] * k, cy - xyz[3 * i + 1] * k, xyz[3 * i + 2]];
const n = xyz.length / 3;
return Array.from({ length: n - 1 }, (_, i) => {
const [p0, p1, p2, p3] = [pt(Math.max(i - 1, 0)), pt(i), pt(i + 1), pt(Math.min(i + 2, n - 1))];
const c1 = [0, 1].map((a) => p1[a] + (p2[a] - p0[a]) / 6);
const c2 = [0, 1].map((a) => p2[a] - (p3[a] - p1[a]) / 6);
return { i, z: (p1[2] + p2[2]) / 2, d: `M${n2(p1[0])} ${n2(p1[1])}C${n2(c1[0])} `
+ `${n2(c1[1])} ${n2(c2[0])} ${n2(c2[1])} ${n2(p2[0])} ${n2(p2[1])}` };
});
}
function backbone() {
const [cx, cy, k] = [103, 32, 0.142]; // mm per tenth of an Å
const exp = trace(EXP, cx, cy, k);
const model = trace(MODEL, cx, cy, k);
const width = (z) => 1 + z / 40;
let s = label(66, 3.2, 'b', 3.6, 'font-weight="700"');
// the experiment as a grey band, then the model on top of it: where they agree, the model's
// colour runs inside the band
for (const [segs, halo, wide, colour] of [[exp, 2.4, 1.6, () => palette.rule],
[model, 1.3, 0.75, (i) => band(Math.min(PLDDT[i], PLDDT[i + 1]))[1]]]) {
for (const { i, z, d } of [...segs].sort((a, b) => a.z - b.z)) {
const w = width(z);
s += `<path d="${d}" stroke="${palette.paper}" stroke-width="${n2(w * halo)}" `
+ `fill="none"/><path d="${d}" stroke="${colour(i)}" ` // a butt halo: no notch at joins
+ `stroke-width="${n2(w * wide)}" fill="none" stroke-linecap="round"/>`;
}
}
const legend = [[palette.rule, 'Experiment (PDB 6Y4F)'], ...BANDS.slice(0, 3)
.map(([, c, t]) => [c, `Model: ${t}`])];
legend.forEach(([c, t], j) => {
s += `<path d="M138 ${44 + j * 4.6}h5" stroke="${c}" stroke-width="${j ? 1 : 1.6}" `
+ 'stroke-linecap="round"/>' + label(145, 44.9 + j * 4.6, t, 2.4);
});
return s + label(138, 39, 'T1049 · residues 25–158', 2.5, 'font-weight="700"');
}
const figure1 = () => '<svg xmlns="http://www.w3.org/2000/svg" width="1780" height="640" '
+ `viewBox="0 0 178 64" font-family="${SANS}">${bars()}${backbone()}</svg>`;
قُرئت الإحداثيات مرة واحدة عند كتابة الوصفة، من مدخل PDB 6Y4F (CC0) ومن نموذج البروتين نفسه في AlphaFold Database (CC BY 4.0)، ثم طوبقت على ذرات Cα وأُديرت على المحاور الرئيسية للبنية التجريبية. يحفظها البرنامج في ثلاث مصفوفات قصيرة. كل خط سلسلة من مقاطع بيزييه تمر بمواقع Cα، تُرسم من الأبعد إلى الأقرب مع هالة بلون الورق، فيظهر العمق دون تظليل. وألوان النموذج هي فئات pLDDT التي تستعملها AlphaFold Database، مقروءة من عمود عامل B في ملفه.
#5 · الحروف اليونانية والحروف المشكولة في PDF
تقسم Fontsource كل خط إلى ملفات بحسب نظام الكتابة. تقرأ kitFonts(FONTS) النص الذي تتلقاه، فتحمّل ملف latin-ext لكل خط حين ينضد Ž أو Š، والملف اليوناني حين ينضد α أو χ؛ وتضمّن fontsourceProvider الملفات نفسها في PDF بحسب الحروف التي ينضدها كل خط. لا تحتاج Cα وχ وŽídek وŠali إلى شيفرة خاصة: تمرر الوصفة markdown، وفيه كل كتل المحتوى، ودالة توفير الخطوط في الأدوات.
الوصفة كاملة
// ═══ Postext Cookbook · Nº 139 · A protein paper with a Methods section ════════════
// https://postext.dev/en/cookbook/protein-paper-methods-section
// Code: MIT · Text: Jumper et al. 2021, abridged (CC BY 4.0) · Figures: drawn in code
// Fonts: Noto Serif, Noto Sans (SIL OFL 1.1) · Needs postext ≥ 1.34.0
import {
buildDocumentWithFonts, renderPageToCanvas, registerCitationEngine, registerResourceImage,
defaultResourceTypes, 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 = 'protein-paper-methods-section';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: near-black text and one deep blue, the blue of confident pLDDT
const palette = { ink: '#161b22', accent: '#0b4ea2', tint: '#e9eff8', rule: '#b3bdcb',
muted: '#59636f', paper: '#ffffff' };
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' } }));
// #endregion
const [SERIF, SANS] = ['Noto Serif', 'Noto Sans'];
const [TRIM_W, TRIM_H, TOP, BOTTOM, INNER, OUTER, GUTTER] = [210, 297, 22, 22, 18, 16, 6];
const MEASURE = TRIM_W - INNER - OUTER;
const LEAD = 12.6; // pt: 9.3 pt type in two columns of 85 mm
const SMALL = 10.8; // pt: the Methods, at 8.2 pt
// #region answer: Methods in smaller type, with a second reference list that numbers on
// [@key] prints a raised number in order of first citation, so a work the Methods cite for
// the first time takes the next number after the main text's last, and one cited again
// keeps its number. Nature prints two lists, and :::bibliography{scope=new} lists only the
// works no earlier list printed: the same block after the main text and after the Methods
// sets references 1–35, then 36–55.
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
const citations = {
style: 'nature', // raised 1–4, "Nature 577, 706–710 (2020)." entries
bibliography: { fontSize: em(0.8), lineHeight: pt(9.6), entrySpacing: pt(0.8),
labelWidth: mm(5), labelAlign: 'right' }, // 9. and 10. end together
};
const references = '### References\n\n:::bibliography{title="" scope=new}';
// "# Methods {style=\"methods\"}" opens a section that runs to the end of the article: an H1
// that breaks nothing, names no running chapter and sets its body two sizes down.
const methods = { id: 'methods', numbered: false, runningChapter: false,
breakBefore: { enabled: false }, fontFamily: SANS, fontSize: pt(11.5), lineHeight: pt(LEAD),
fontWeight: 700, color: col('ink'), marginTop: pt(LEAD), marginBottom: pt(LEAD / 2),
bodyStyle: { fontSize: pt(8.2), lineHeight: pt(SMALL) } };
// #endregion
يعمل ملف script.js المجمّع كما هو: الصقه في سكربت الوحدة (module) لأي صفحة، أو افتح الوصفة على CodePen. مجلد الوصفة على GitHub ↗ (يفتح في تبويب جديد)
تنويعات
#إبقاء الطرائق بحجم النص
بعض المجلات تنضد الطرائق بحرف النص نفسه؛ احذف نمط المتن في القسم وأبقِ العنوان.
- bodyStyle: { fontSize: pt(8.2), lineHeight: pt(SMALL) } };
+};#الترقيم بين قوسين معقوفين
بعض مجلات المجال نفسه تطبع [1] على السطر.
- style: 'nature', // raised 1–4, "Nature 577, 706–710 (2020)." entries
+ style: 'nature', marker: 'brackets',#قائمة واحدة في الآخر
المجلات التي تطبع كل المراجع بعد الطرائق، مثل Science، تُبقي الكتلة الثانية وحدها.
-const markdown = [/* @content */ '', references, /* @content:methods */ '', references,
+const markdown = [/* @content */ '', /* @content:methods */ '', references,#استعمال قائمة فانكوفر
لمجلة طبية، ابدأ من نمط NLM المرفق، كما يفعل المقال الطبي بأسلوب فانكوفر.
أخطاء شائعة
خطأ شائع
ملفات Fontsource تغطي الحروف لا الرموز
تضمّن العُدّة ملف latin من Fontsource لكل خط، ومعه ملف latin-ext للحروف č وł و†، وملف greek للحروف α وχ (في عائلة تضمه: لا يضمه Lora ولا Gelasio)، حين يستعملها النص، على الشاشة وفي PDF. أما رموز مثل → و≈ و✓ و★ فليست في أي من هذه الملفات فتغيب عن PDF: ارسمها، أو اكتبها رياضيات، أو اختر خطًا تضمها ملفاته. الخطوط المضمَّنة في PDF →
- تذكر Nature خمسة مؤلفين على الأكثر، وتختصر القائمة الأطول إلى المؤلف الأول يليه et al. وحيث تفعل ذلك قائمة البحث نفسه، اكتب
and othersفي مدخل BibTeX ({Senior, Andrew W. and others}) فيطبع النمط Senior, A. W. et al.؛ وفي CSL-YAML اختم القائمة بـ"others". - يغير
bodyStyleفي نمط العنوان حجم حرف النص وتباعد أسطره، لا الشبكة الأساسية: عناوين الطرائق الفرعية تستعملsnapToGrid: false، وإلا لقفز السطر الذي تحت كل منها إلى السطر التالي من شبكة النص الرئيسي.
الحقوق
- الوصفة
- Ignacio Ferro
- النص
- “Highly accurate protein structure prediction with AlphaFold”, Nature 596, 583–589 (2021), doi:10.1038/s41586-021-03819-2, PMC8371605, abridged (the sections ‘Interpreting the neural network’ and ‘Related work’, the description of Fig. 2, parts of other sections and of the Methods, the Supplementary information and the peer review note cut; pointers to omitted figures removed; references renumbered by first citation); Fig. 1 redrawn in code (panels c–e omitted), Figs. 2–5 omitted; Table 1 compiled from the Methods text · John Jumper, Richard Evans, Alexander Pritzel, Tim Green, Michael Figurnov, Olaf Ronneberger, Kathryn Tunyasuvunakool, Russ Bates, Augustin Žídek, Anna Potapenko, Alex Bridgland, Clemens Meyer, Simon A. A. Kohl, Andrew J. Ballard, Andrew Cowie, Bernardino Romera-Paredes, Stanislav Nikolov, Rishub Jain, Jonas Adler, Trevor Back, Stig Petersen, David Reiman, Ellen Clancy, Michal Zielinski, Martin Steinegger, Michalina Pacholska, Tamas Berghammer, Sebastian Bodenstein, David Silver, Oriol Vinyals, Andrew W. Senior, Koray Kavukcuoglu, Pushmeet Kohli, Demis Hassabis · CC BY 4.0
- الصور
- Fig. 1b, experimental Cα coordinates of PDB 6Y4F (Jiang et al. 2020), drawn in code · Worldwide Protein Data Bank · CC0 1.0
- Fig. 1b, AlphaFold DB model AF-B4EUK6-F1 (AlphaFold Monomer v2.0) and its pLDDT, superposed and drawn in code · DeepMind Technologies Limited and EMBL-EBI, AlphaFold Protein Structure Database · CC BY 4.0
- الخطوط
- Noto Serif (SIL OFL 1.1) · Noto Sans (SIL OFL 1.1)
- الشيفرة
- MIT، مثل Postext
حرّر هذا الشرح ↗ (يفتح في تبويب جديد)مجلد الوصفة على GitHub ↗ (يفتح في تبويب جديد)


