Kurz gesagt
Ein bekanntes KI-Paper, gekürzt und neu gesetzt. Beispiel-Prompts und Antworten des Modells stehen nebeneinander in beschrifteten Kästen, jede Antwort mit Haken oder Kreuz; die Diagramme entstehen aus den Zahlen des Papers.
Was Sie setzen
Sieben Seiten eines Preprints zum maschinellen Lernen im Format US Letter: Chain-of-Thought Prompting Elicits Reasoning in Large Language Models von Wei et al., gekürzt nach der arXiv-Fassung unter CC BY 4.0. Auf der ersten Seite steht die bekannteste Abbildung des Papers, als Kästen gesetzt statt als Bild eingefügt: links Standard-Prompting, rechts Chain-of-Thought-Prompting, jeder Prompt in einem Kasten mit dem Etikett Model Input, jede Antwort in einem Kasten mit dem Etikett Model Output, die Beispiele in IBM Plex Mono und die Gedankenkette fett und farbig, mit einem Kreuz an der falschen Antwort und einem Haken an der richtigen. Der Text zitiert wie NeurIPS-Paper, (Brown et al., 2020), aus dem eigenen Literaturverzeichnis des Papers, das als BibTeX neu angelegt ist. Tabelle 2 und zwei Diagramme sind aus den Zahlen neu gezeichnet, die das Paper veröffentlicht.
Dieses Rezept beantwortet
- Wie setze ich die Prompt- und Modellausgabe-Beispiele eines KI-Artikels in Kästen nebeneinander?
- Wie setze ich einen Open-Access-Artikel aus arXiv oder PubMed Central mit Postext neu, mit seinen Zitaten, Abbildungen und seiner Lizenzzeile?
- Wie zitiere ich Werke und erstelle das Literaturverzeichnis nach APA, IEEE oder einem anderen Zitierstil?
Die kurze Antwort
// :::columns{count=2 breaks="4"} inside the "figure" box opens the right column at its fourth
// block; each nested box counts as one block.
const tab = (fill) => ({ fontFamily: SANS, fontSize: pt(7), fontWeight: 600,
color: col('paper'), background: col(fill), position: 'top-left', inset: mm(3),
height: mm(4.2), offset: mm(2.1), paddingX: mm(2.2) }); // straddles the top edge
const exemplar = (id, fill, ink, extra) => ({ id, background: col(fill),
border: { enabled: true, color: col('rule'), width: pt(0.6) }, borderRadius: mm(2.4),
padding: { top: mm(4.4), right: mm(3), bottom: mm(2.6), left: mm(3) },
marginTop: mm(4.2), marginBottom: ZERO, label: tab(ink),
body: { fontFamily: MONO, fontSize: pt(7.8), lineHeight: pt(10.4), color: col('ink'),
boldColor: col(ink), // **…** marks the chain of thought: the highlight of the original
textAlign: 'left', hyphenation: false, paragraphSpacing: true, firstLineIndent: ZERO },
...extra });
const mark = (id) => ({ icon: { kind: 'resource', resourceId: id, size: mm(5.6),
position: 'corner', cornerSide: 'right' } }); // a badge on the top-right corner
const promptBoxes = [
{ id: 'figure', span: 'page', backgroundEnabled: false, border: { enabled: false },
padding: mm(0), columnGap: mm(6), marginTop: ZERO, marginBottom: pt(LEAD),
body: { fontFamily: SANS, fontSize: pt(8.4), lineHeight: pt(11.4), color: col('ink'),
boldColor: col('accent'), textAlign: 'left', paragraphSpacing: true,
firstLineIndent: ZERO } },
exemplar('input', 'tint', 'accent'),
exemplar('right', 'mint', 'green', mark('mark-right')),
exemplar('wrong', 'mint', 'green', mark('mark-wrong')),
];
Zutaten
- Funktionen
- Spalten in einem Kasten oder im TextVerschachtelte KästenNummerierte KastenreiterKastensymbole und EckplakettenKästenZitate in einem ZitierstilLiteraturverzeichnis aus den QuellenQuerverweiseNummerierte ÜberschriftenÜberschriftenformateGestaltete AuftakteEigene RessourcentypenFormat der BildunterschriftTabellen aus DatenTabellenformatFußnotenLinkadressen im DruckKolumnentitel und SeitenzahlenSemantische FarbpalettePDF-Export
- Nutzt außerdem
- Verweise, die Abbildungen platzierenÜberschriftenattributeKopfzeilen nach SeitenrolleAbsatzformateIm PDF eingebettete SchriftenAbbildungen und Tabellen als RessourcenZeilenumbrüche in TitelnKapitel ohne Nummer
- Schrift
- Newsreader, IBM Plex Sans, IBM Plex Mono (SIL OFL 1.1)
- Dateien
- Keine: Jedes Bild wird im Code gezeichnet
Zubereitung
#1 · Abbildung 1 besteht aus drei Kastenformaten
Der Code steht oben in der kurzen Antwort. Die Abbildung ist ein Kasten über die ganze Seitenbreite ohne eigenen Rahmen; darin öffnet :::columns{count=2 breaks="4"} die rechte Spalte beim vierten Block, und jeder verschachtelte Kasten zählt als ein Block. Prompt- und Antwortkästen stammen aus derselben Funktion, die die Kastenstile erzeugt, und unterscheiden sich nur in der Füllung, der Farbe des Etiketts und dem Abzeichen an der Ecke: Ein icon eines Kastens mit position: 'corner' nimmt eine SVG-Ressource auf, und so kommen ✓ und ✗ auf die Seite, obwohl die Schriften des Dokuments diese Glyphen nicht haben. In Ihrem eigenen Paper schreiben Sie jedes Beispiel als einfache Absätze in einen Kasten und markieren die Gedankenschritte mit **…**; boldColor im Kastenstil macht daraus die Hervorhebung.
#2 · Autor-Jahr-Zitationen im Stil von natbib
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
// Chicago author-date writes (Brown et al. 2020); ML venues put a comma before the year.
const AUTHOR_YEAR = '<group delimiter=" ">\n <text macro="author-inline"/>';
const natbib = STYLES['chicago-author-date']
.replace(AUTHOR_YEAR, AUTHOR_YEAR.replace('" "', '", "'));
const citations = { style: 'custom', customStyle: natbib, link: true,
bibliography: { fontSize: em(0.8), lineHeight: pt(10.2), entrySpacing: pt(1.8),
hangingIndent: mm(4), doi: 'text' } };
// The text's two web addresses are links: clickable in the PDF, printed in parentheses on
// paper, `[name census data](https://namecensus.com/)` as "name census data (namecensus.com)".
const links = { print: 'inline', urlDisplay: 'short' };
Tagungen zum maschinellen Lernen verwenden die Autor-Jahr-Form von natbib: ein Komma zwischen Namen und Jahr, et al. ab drei Autoren. Chicago Author-Date ist der mitgelieferte Stil, der dem am nächsten kommt; das Rezept ändert deshalb in dessen CSL eine einzige Gruppe, die Autor und Jahr verbindet, von einem Leerzeichen zu einem Komma. Ihre eigene .bib-Datei übernehmen Sie unverändert: Fügen Sie sie in einen Block :::references{format=bibtex} ein und zitieren Sie mit [@key] für (Brown et al., 2020) und mit @key für Brown et al. (2020). Ein Suffix behält das davor geschriebene Komma und seine Auszeichnung, sodass [@brown2020language, *inter alia*] wie im Paper als (Brown et al., 2020, inter alia) erscheint. Legenden zitieren genauso: Die Legende von Abbildung 4 enthält @jie2022learning und @lan2021mwptoolkit, und beide Werke kommen ohne nocite ins Literaturverzeichnis.
Die beiden Webadressen im Text, die Namensdaten des Zensus in Abschnitt 5 und die Lizenz im Impressum, stehen als Links da, [name census data](https://namecensus.com/). Mit links: { print: 'inline', urlDisplay: 'short' } druckt das Papier jede Adresse in Klammern hinter ihrem Text, ohne https://, und das PDF behält den Link. Eine als reiner Text getippte Adresse sieht gedruckt genauso aus, führt beim Anklicken aber nirgendwohin.
#3 · Der Titelblock
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, y, width = MEASURE) => ({ anchor: { to, edge },
offset: { x: ZERO, y: mm(y) }, size: { width: mm(width), height: 'auto' } });
const titleBlock = { enabled: true, minHeight: mm(58), slot: { elements: [
text('venue', '{attr.venue}', MONO, 7.5, { fontWeight: 500, letterSpacing: pt(0.6),
color: col('accent'), placement: at('container', 'top-left', 0) }),
text('title', '{titleText}', SERIF, 23, { fontWeight: 600, lineHeight: 1.1,
placement: at('#venue', 'below', 5) }),
text('authors', '{attr.authors}', SANS, 9.6, { fontWeight: 500, lineHeight: 1.45,
placement: at('#title', 'below', 6) }),
text('affiliation', '{attr.affiliation}', SANS, 8.6, { color: col('muted'),
placement: at('#authors', 'below', 1.2) }),
{ kind: 'rule', id: 'rule', thickness: pt(0.5), color: col('rule'),
placement: at('#affiliation', 'below', 4) },
text('note', '{attr.note}', SERIF, 8.2, { lineHeight: 1.35,
color: col('muted'), placement: at('#rule', 'below', 2) }),
] } };
Der Titel ist die einzige Überschrift der Ebene 1 im Dokument; ihr Stil reicht über beide Spalten und zeichnet einen gestalteten Block: Tagungszeile, Titel, Autoren in zwei Reihen, Institution und ein Hinweis auf die Kürzung. Autoren und Hinweis sind Attribute der Überschrift, und \n in einem Attribut beginnt eine neue Reihe, wie \\ in einem LaTeX-\author. Für Ihr eigenes Paper ändern Sie die Attribute; die Gestaltung bleibt.
#4 · Abbildungsnummern wie im Original
// Figure 1 is boxes, which the figure counter does not see: number the charts by type.
const numbered = (id, word, n, extra) => ({ id, name: `${word} ${n}`,
shortLabel: `${word} ${n}`, captionPrefix: `${word} ${n}`, numberingTemplate: '',
resetOn: 'never', counterFormat: 'decimal', ...extra });
const resourceTypes = [numbered('mark', 'Mark', ''), numbered('fig2', 'Figure', 2),
numbered('fig4', 'Figure', 4),
numbered('tab2', 'Table', 2, { captionStyle: { position: 'above' } })];
const ACROSS = { position: 'top', span: 'page' }; // a float over both columns
const svg = (id, typeId, file, [width, height], caption, note, altText, placement) => ({
id, typeId, kind: 'svg', createdAt: 0, updatedAt: 0,
placement: placement ?? { position: 'top' }, svg: { fileId: file, width, height },
caption, note, altText });
Die Engine nummeriert Abbildungen in der Reihenfolge ihrer ersten Erwähnung, doch Abbildung 1 ist hier ein Kasten, den der Zähler nie sieht. Deshalb bekommen die neu gezeichneten Diagramme je einen eigenen Ressourcentyp mit der Nummer in der Bezeichnung und leerem numberingTemplate und behalten die Nummern der arXiv-Fassung: Abbildung 2, Abbildung 4 und Tabelle 2. In einem eigenen Paper, in dem jede Abbildung eine Ressource ist, übernimmt ein einziger Typ figure mit numberingTemplate: '{n}' das Zählen.
#5 · Tabelle 2 aus den Daten des Papers
const SETS = ['GSM8K', 'SVAMP', 'ASDiv', 'AQuA', 'MAWPS'];
const RESULTS = [ // model, size, then standard / CoT pairs per benchmark; * CoT beats standard
['UL2', '20B', '4.1 4.4* 10.1 12.5* 16.0 16.9* 20.5 23.6* 16.6 19.1*'],
['LaMDA', '420M', '2.6 0.4 2.5 1.6 3.2 0.8 23.5 8.3 3.2 0.9'],
['', '2B', '3.6 1.9 3.3 2.4 4.1 3.8 22.9 17.7 3.9 3.1'],
['', '8B', '3.2 1.6 4.3 3.4 5.9 5.0 22.8 18.6 5.3 4.8'],
['', '68B', '5.7 8.2* 13.6 18.8* 21.8 23.1* 22.3 20.2 21.6 30.6*'],
['', '137B', '6.5 14.3* 29.5 37.5* 40.1 46.6* 25.5 20.6 43.2 57.9*'],
['GPT', '350M', '2.2 0.5 1.4 0.8 2.1 0.8 18.1 8.7 2.4 1.1'],
['', '1.3B', '2.4 0.5 1.5 1.7 2.6 1.4 12.6 4.3 3.1 1.7'],
['', '6.7B', '4.0 2.4 6.1 3.1 8.6 3.6 15.4 13.4 8.8 3.5'],
['', '175B', '15.6 46.9* 65.7 68.9* 70.3 71.3* 24.8 35.8* 72.7 87.1*'],
['Codex', '–', '19.7 63.1* 69.9 76.4* 74.0 80.4* 29.5 45.3* 78.7 92.6*'],
['PaLM', '8B', '4.9 4.1 15.1 16.8* 23.7 25.2* 19.3 21.7* 26.2 30.5*'],
['', '62B', '9.6 29.9* 48.2 46.7 58.7 61.9* 25.6 22.4 61.8 80.3*'],
['', '540B', '17.9 56.9* 69.4 79.0* 72.1 73.9* 25.2 35.8* 79.2 93.3*'],
];
const cell = (content, extra) => ({ content, align: 'right', ...extra });
const tableRows = () => [
[cell('Model', { isHeader: true, align: 'left', colSpan: 2 }), { content: '',
hiddenBy: { row: 0, col: 0 } }, // gotcha: merged-cells-hiddenby
...SETS.flatMap((set, i) => [cell(set, { isHeader: true, align: 'center', colSpan: 2 }),
{ content: '', hiddenBy: { row: 0, col: 2 + 2 * i } }])],
[cell('', { isHeader: true }), cell('', { isHeader: true }),
...SETS.flatMap(() => [cell('standard', { isHeader: true }), cell('CoT', { isHeader: true })])],
...RESULTS.map(([model, size, values]) => [cell(model ? `**${model}**` : '', { align: 'left' }),
cell(size, { align: 'left' }),
...values.split(' ').map((v) => cell(v.endsWith('*') ? `**${v.slice(0, -1)}**` : v))]),
];
Die Ergebnisse sind einmal erfasst, so wie sie im LaTeX-Quelltext stehen, und speisen sowohl Tabelle 2 als auch Abbildung 4, sodass das Diagramm nicht von der Tabelle abweichen kann. Die Namen der Benchmarks reichen jeweils über zwei Spalten; eine verbundene Zelle braucht dort, wo sie sich ausdehnt, einen mit hiddenBy markierten Platzhalter. Fett markiert die Zellen, in denen Chain-of-Thought-Prompting das Standard-Prompting schlägt, wie die grünen Zellen des Originals.
Das ganze Rezept
// ═══ Postext Cookbook · Nº 137 · An AI preprint with prompt exemplars in boxes ═══════
// https://postext.dev/en/cookbook/ai-preprint-prompt-exemplars
// Code: MIT · Text: Wei et al. 2022, arXiv:2201.11903 (CC BY 4.0) · Charts: drawn in code
// Fonts: Newsreader, IBM Plex Sans, IBM Plex Mono (SIL OFL 1.1) · Needs postext ≥ 1.65.0
import {
buildDocumentWithFonts, renderPageToCanvas, registerCitationEngine, registerResourceImage,
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 = 'ai-preprint-prompt-exemplars';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: a cool ink, a prompt blue, an answer green and a red for the wrong answer
const palette = { ink: '#1b1e24', accent: '#1f5fa6', green: '#21744a', red: '#b3362d',
tint: '#e9f0f8', mint: '#e6f2eb', rule: '#b4bcc8', muted: '#5b6270', 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, MONO] = ['Newsreader', 'IBM Plex Sans', 'IBM Plex Mono'];
// US letter, two columns of 85.5 mm as ML venues print.
const [TRIM_W, TRIM_H, TOP, BOTTOM, SIDE, GUTTER] = [215.9, 279.4, 22, 22, 19, 7];
const MEASURE = TRIM_W - 2 * SIDE;
const COLUMN = (MEASURE - GUTTER) / 2;
const LEAD = 12.8; // pt
const ZERO = pt(0);
// #region answer: Figure 1 as boxes: two columns, a tab on each box, a ✓ or ✗ in the corner
// :::columns{count=2 breaks="4"} inside the "figure" box opens the right column at its fourth
// block; each nested box counts as one block.
const tab = (fill) => ({ fontFamily: SANS, fontSize: pt(7), fontWeight: 600,
color: col('paper'), background: col(fill), position: 'top-left', inset: mm(3),
height: mm(4.2), offset: mm(2.1), paddingX: mm(2.2) }); // straddles the top edge
const exemplar = (id, fill, ink, extra) => ({ id, background: col(fill),
border: { enabled: true, color: col('rule'), width: pt(0.6) }, borderRadius: mm(2.4),
padding: { top: mm(4.4), right: mm(3), bottom: mm(2.6), left: mm(3) },
marginTop: mm(4.2), marginBottom: ZERO, label: tab(ink),
body: { fontFamily: MONO, fontSize: pt(7.8), lineHeight: pt(10.4), color: col('ink'),
boldColor: col(ink), // **…** marks the chain of thought: the highlight of the original
textAlign: 'left', hyphenation: false, paragraphSpacing: true, firstLineIndent: ZERO },
...extra });
const mark = (id) => ({ icon: { kind: 'resource', resourceId: id, size: mm(5.6),
position: 'corner', cornerSide: 'right' } }); // a badge on the top-right corner
const promptBoxes = [
{ id: 'figure', span: 'page', backgroundEnabled: false, border: { enabled: false },
Das zusammengesetzte script.js läuft unverändert: Fügen Sie es in das Modulskript einer beliebigen Seite ein, oder öffnen Sie das Rezept auf CodePen. Ordner des Rezepts auf GitHub ↗ (öffnet sich in einem neuen Tab)
Varianten
#Nach APA zitieren
APA schreibt (Roy & Roth, 2015) und führt bis zu zwanzig Autoren auf, was das Literaturverzeichnis eines Papers über große Modelle selten will.
-const citations = { style: 'custom', customStyle: natbib, link: true,
+const citations = { style: 'apa', link: true,#Das Paper einspaltig setzen
Eine einspaltige Seite im Stil von NeurIPS braucht breitere Seitenränder, damit die Zeilen lesbar lang bleiben; die Kästen über die ganze Seitenbreite nehmen dann die eine Spalte ein.
-const [TRIM_W, TRIM_H, TOP, BOTTOM, SIDE, GUTTER] = [215.9, 279.4, 22, 22, 19, 7];
+const [TRIM_W, TRIM_H, TOP, BOTTOM, SIDE, GUTTER] = [215.9, 279.4, 24, 24, 38, 7];
- layout: { layoutType: 'double', gutterWidth: mm(GUTTER) },
+ layout: { layoutType: 'single' },#Codelistings in Kästen
Für Prompts mit Code darin zeigen die Listing-Kästen aus Codelistings und Tastenkappen Syntaxhervorhebung mit fetten und kursiven Passagen.
Häufige Fehler
Häufiger Fehler
Ein verschachtelter Kasten ignoriert span, placement und snapToGrid
Ein in einen anderen verschachtelter Kasten ignoriert seine Angaben span, placement, snapToGrid und floatBarrier: er fließt immer innerhalb seines Elternkastens, in dessen Innenbreite. Verschachtelte Kästen →
- Ein Kasten über die ganze Seitenbreite kommt in einem zweispaltigen Layout nur dann auf die aktuelle Seite, wenn darunter noch mindestens ein paar Zeilen Grundtext Platz haben. Abbildung 1 steht auf Seite 1, weil das Abstract in 9,3 pt mit knappem Innenabstand gesetzt ist; ein längeres Abstract schiebt die Abbildung auf Seite 2.
Nachweise
- Rezept
- Ignacio Ferro
- Text
- “Chain-of-Thought Prompting Elicits Reasoning in Large Language Models”, NeurIPS 2022, arXiv:2201.11903v6, abridged (sections 3.3, 3.4, 7 and the appendices cut, pointers to omitted figures and appendices removed); Figures 2 and 4 redrawn in code from the paper’s numbers, Figure 1 set as boxes, Table 2 reset · Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Brian Ichter, Fei Xia, Ed H. Chi, Quoc V. Le, Denny Zhou · CC BY 4.0
- Schriften
- Newsreader (SIL OFL 1.1) · IBM Plex Sans (SIL OFL 1.1) · IBM Plex Mono (SIL OFL 1.1)
- Code
- MIT, wie Postext
Diesen Text bearbeiten ↗ (öffnet sich in einem neuen Tab)Ordner des Rezepts auf GitHub ↗ (öffnet sich in einem neuen Tab)


