Em poucas palavras
Um ensaio famoso sobre por que muitos resultados de pesquisa não se confirmam, composto como separata de sete páginas. Um só script gera a edição inglesa e uma tradução espanhola, cada qual com hifenização, vírgula decimal e rótulos.
O que você vai compor
Uma separata de sete páginas do ensaio de John Ioannidis Why Most Published Research Findings Are False (PLoS Medicine, 2005), resumido e composto numa página de 210 × 280 mm em duas colunas. Uma faixa azul-marinho abre a primeira página, com as curvas da própria fórmula do ensaio desenhadas em tom tênue atrás do título. As três fórmulas vêm em destaque e são numeradas; as tabelas 2×2 têm uma fórmula em cada célula, com α e β de verdade; a Figura 1 é calculada pela Eq. (2), e a última coluna da Tabela 4 pela mesma equação. O mesmo script compõe uma tradução espanhola com hifenização espanhola, vírgula decimal nas tabelas e figuras, aspas « » e rótulos em espanhol. Fecham o texto 33 referências no estilo Vancouver, refeitas em BibTeX a partir da lista do artigo.
Esta receita responde a
- Como publico um mesmo artigo em dois idiomas a partir de um só script, com a tipografia de cada idioma?
- Como faço uma tabela com linhas de cabeçalho, células mescladas, larguras de coluna e alinhamento por célula?
- Como componho matemática (em linha, em destaque, equações) e a mantenho vetorial no PDF?
- Como recomponho com o Postext um artigo de acesso aberto do arXiv ou do PubMed Central, mantendo citações, figuras e linha de licença?
A resposta curta
// The Cookbook composes the pen once per edition: content.<LANG>.md and each named slot
// replace the @content markers. What else follows the language is set here.
const edition = {
// Hyphenation patterns and the words the engine writes (Tabla, Continúa) follow the locale.
locale: t({ en: 'en-us', es: 'es' }),
// Table 1 / Tabla 1, Figure 1 / Figura 1, counted through the essay; tables caption above.
resourceTypes: defaultResourceTypes(LANG).map((type) => ({ ...type, shortLabel: type.name,
numberingTemplate: '{n}', resetOn: 'never',
...(type.id === 'table' && { captionStyle: { position: 'above' } }) })),
// Vancouver numbers in brackets, [2–4]; the CSL locale writes the list's words (2nd ed.,
// 2.ª ed.). The titles of the works stay in English in both editions.
citations: { style: 'elsevier-vancouver', locale: t({ en: 'en-US', es: 'es-ES' }),
marker: 'brackets', collapseRanges: true,
bibliography: { fontSize: em(0.78), lineHeight: pt(9.4), entrySpacing: pt(0.8),
labelWidth: mm(6.4), doi: 'hide' } },
};
// The numbers the script writes (Table 4's PPV, the figure axes) take the edition's decimal
// sign, 0.85 or 0,85. Formulas keep their symbols; content.es.md writes 0{,}05 inside $…$
// so that TeX sets no space after the comma.
const number = (x, digits = 2) => x.toLocaleString(t({ en: 'en-US', es: 'es-ES' }),
{ minimumFractionDigits: digits, maximumFractionDigits: digits });
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
await initMathEngine(); // before the tables are built (gotcha: math-bundle)
Ingredientes
- Funcionalidades
- MatemáticaTabelas a partir de dadosHifenização e idioma do documentoEstilo de tabelaFigura e Tabela no seu idiomaCitações em um estilo de citaçãoBibliografia a partir das referênciasFiguras e tabelas como recursosCitações que posicionam as figurasLegendas numeradasPosicionamento de figurasEstilo de legendaAberturas desenhadasAtributos de títuloBoxes na largura da páginaBoxesBoxes flutuantesColunas curtas preenchidasChips no textoExportação para PDF
- Também usa
- Colunas num boxe ou no textoEquilíbrio de colunasEstilos de títuloCabeços por tipo de páginaEstilos de parágrafoFontes incorporadas ao PDFTipos de recurso personalizadosSobrescritos e subscritosCapítulos sem número
- Tipografia
- Gelasio, Sofia Sans Semi Condensed (SIL OFL 1.1)
- Materiais
- Nenhum: todas as imagens são desenhadas em código
Preparo
#1 · Um script, duas edições
O código está na resposta curta, mais acima. As Receitas montam o script uma vez para cada língua e põem content.en.md ou content.es.md onde está a marca @content; cada espaço nomeado (content.corollaries.es.md, content.resources.es.md) segue a mesma regra, e um espaço sem arquivo em espanhol usa o inglês, e é assim que as duas edições compartilham um único arquivo BibTeX. Todo o resto que muda com a língua passa por LANG: locale escolhe os padrões de hifenização ('es' é o código que hifeniza o espanhol), defaultResourceTypes(LANG) escreve Tabla e Figura, a localidade CSL escreve as palavras da lista de referências, e toLocaleString dá vírgula decimal aos números que o script calcula. A tradução segue a ortotipografia espanhola: aspas « », 0,05 no texto e 0{,}05 dentro de uma fórmula, para que o TeX não trate a vírgula como pontuação e ponha um espaço depois dela. Para publicar um artigo seu em duas línguas, mantenha um arquivo por língua para o texto e as legendas, e reúna qualquer outra diferença num único objeto como edition.
#2 · Fórmulas dentro das células
// A cell, a caption or a note sets $…$ as the text does (postext ≥ 1.19): MathJax paths at
// the cell's 8 pt, on the baseline of its line and aligned with the cell, vector in the PDF.
// The faces' latin files have no α or β (gotcha: latin-subset); the formulas need none.
const [CELL_PT, PAD] = [8, 1]; // cell type (pt), cell padding (mm)
function tableModel(tsv, widths, headerRows, merges = [], right = []) {
let model = { ...parseTSV(tsv, { headerRows }), columnWidths: widths };
model.rows.forEach((_, row) => right.forEach((c) => {
model = setAlignment(model, { row, col: c }, 'right'); // the numbers, the PPV and their heads
}));
for (const range of merges) model = mergeCells(model, range); // gotcha: merged-cells-hiddenby
return model;
}
// "Research finding" over both header rows, "True relationship" over Yes, No and Total.
const twoByTwo = (tsv) => tableModel(tsv, [1.1, 1.6, 1.6, 2.5], 2, [
{ start: { row: 0, col: 0 }, end: { row: 1, col: 0 } },
{ start: { row: 0, col: 1 }, end: { row: 0, col: 3 } }]);
// Table 4's last column is computed from Eq. (2), α = 0.05: two significant figures, as in 2005.
const ppv = (power, R, u, alpha = 0.05) => (power * R + u * (1 - power) * R)
/ (R + alpha - (1 - power) * R + u - u * alpha + u * (1 - power) * R);
const read = (s) => Number(s.replace(',', '.'));
const odds = (s) => s.split(':').map((x) => Number(x.replace(/\D/g, ''))).reduce((a, b) => a / b);
const ppvRows = (tsv) => tsv.split('\n').map((line, r) => {
const [power, R, u, example, head] = line.split('\t');
const p = ppv(read(power), odds(R), read(u)); // 0.0010: as many decimals as 2 figures need
return [power, R, u, example, r ? number(p, 1 - Math.floor(Math.log10(p))) : head].join('\t');
}).join('\n');
Desde o postext 1.19, uma célula de tabela compõe $…$ como o texto, de modo que uma célula que no TSV diz $c(1-\beta)R/(R+1)$ é uma fórmula: traçados do MathJax no corpo de 8 pt das células, na linha de base da linha da célula, de modo que Yes, No e as fórmulas ficam na mesma linha, e contornos vetoriais no PDF. Os arquivos latin da Fontsource não têm letras gregas, e as fórmulas não precisam delas. Legendas e notas também aceitam matemática: a legenda da Tabela 4 chama o poder de 1 − β, e a nota dela supõe α = 0,05, como o artigo de 2005 imprime. setAlignment alinha à direita os números da Tabela 4, e mergeCells junta Research finding sobre as duas linhas de cabeçalho e True relationship sobre três colunas; ele também escreve as células ocultas de que uma célula mesclada precisa.
#3 · Legendas e tabelas do espaço nomeado, números da fórmula
const parsed = blocks.trim().split(/\n\s*\n/).map((block) => {
const fields = {};
const tsv = block.split('\n').filter((line) => {
const m = /^(id|caption|note|alt): (.*)$/.exec(line);
if (m) fields[m[1]] = m[2];
return !m;
}).join('\n');
return { ...fields, tsv };
});
const tables = parsed.filter((b) => b.tsv).map(({ id, caption, note, tsv }) => {
const model = id === 'tbl-ppv'
? tableModel(ppvRows(tsv), [0.8, 0.95, 0.75, 3.8, 1.05], 1, [], [0, 1, 2, 4])
: twoByTwo(tsv);
return { id, typeId: 'table', kind: 'table', createdAt: 0, updatedAt: 0, caption, note,
table: { model }, placement: { position: 'auto', ...(id !== 'tbl-ppv' && { span: 'page' }) } };
});
const figures = parsed.filter((b) => !b.tsv).map(({ id, caption, note, alt }) => ({ id,
typeId: 'figure', kind: 'svg', createdAt: 0, updatedAt: 0, caption, note, altText: alt,
placement: { position: 'auto', span: 'page' },
svg: { fileId: `${id}.svg`, width: FIG_W * 10, height: FIG_H * 10 } }));
const resources = [...tables, ...figures,
{ id: 'band-art', typeId: 'figure', kind: 'svg', createdAt: 0, updatedAt: 0,
svg: { fileId: 'band-art.svg', width: 1400, height: BAND * 10 } }];
const tableStyle = { rules: 'horizontal', borderColor: col('rule'), borderWidth: pt(0.5),
headerBackground: col('navy'), headerColor: col('paper'), headerBold: true,
headerFontFamily: SANS, headerFontSize: pt(CELL_PT), bodyFontFamily: SANS,
bodyFontSize: pt(CELL_PT), bodyColor: col('ink'), cellPadding: mm(PAD) };
const captionStyle = { fontFamily: SANS, fontSize: pt(8.2), color: col('ink'), labelBold: true,
labelColor: col('accent'), gap: mm(2), note: { fontSize: pt(7), color: col('muted') } };
As tabelas, legendas, notas e textos alternativos ficam em content.resources.<lang>.md, um bloco para cada um, de modo que quem traduz só mexe em arquivos de texto, e cada edição leva só a própria língua. A coluna de PPV da Tabela 4 não é digitada: ppv() a calcula com o poder, R e u de cada linha, e os nove valores batem com os impressos em 2005 até dois algarismos significativos. As tabelas flutuam com position: 'auto', e assim a Tabela 1 pode ocupar o pé da página que a cita em vez de se acumular com os outros flutuantes na página seguinte.
#4 · A Figura 1 traçada pela Eq. (2)
const R2 = (x) => Math.round(x * 100) / 100;
// Each label names the label face: loadSvg embeds it for the canvas (inlineSvgFonts), and the
// PDF asks the provider for it.
const mix = (f) => `#${[1, 3, 5].map((i) => Math.round(parseInt(palette.navy.slice(i, i + 2), 16)
* (1 - f) + parseInt(palette.accent.slice(i, i + 2), 16) * f).toString(16).padStart(2, '0'))
.join('')}`; // navy for the first curve, vermilion for the last
const label = (x, y, s, size, extra = '', fill = palette.muted) => `<text x="${R2(x)}" `
+ `y="${R2(y)}" font-size="${size}" font-family="${SANS}" fill="${fill}" ${extra}>${s}</text>`;
const line = (points, stroke, width, extra = '') => `<path d="M${points.map(([x, y]) =>
`${R2(x)} ${R2(y)}`).join('L')}" fill="none" stroke="${stroke}" stroke-width="${width}" `
+ `${extra}/>`;
// Three panels, power 0.80, 0.50 and 0.20; PPV in % against R from 0 to 1, one curve per value.
function panels(curve, values, name, digits, dashed) {
const [pw, top, plotH, left] = [52, 12, 34, 8]; // panel width, plot top and height, y labels
let out = '';
[0.8, 0.5, 0.2].forEach((power, p) => {
const x0 = p * (pw + (FIG_W - 3 * pw) / 2) + left;
const X = (R) => x0 + R * (pw - left - 2);
const Y = (v) => top + plotH * (1 - v);
const trace = (f) => Array.from({ length: 101 }, (_, k) => [X(k / 100), Y(f(k / 100))]);
out += label(x0 - left, 4, `${'ABC'[p]} <tspan font-weight="400">${t({ en: 'Power',
es: 'Potencia' })} ${number(power)}</tspan>`, 3.4, '', palette.navy);
if (!p) out += label(x0 - left, top - 4, t({ en: 'PPV (%)', es: 'VPP (%)' }), 2.8);
for (const v of [0, 0.2, 0.4, 0.6, 0.8, 1]) {
out += line([[X(0), Y(v)], [X(1), Y(v)]], palette.rule, v ? 0.15 : 0.3)
+ label(X(0) - 1.4, Y(v) + 1, v * 100, 2.6, 'text-anchor="end"')
+ label(X(v), Y(0) + 3.6, number(v, v % 1 ? 1 : 0), 2.6, 'text-anchor="middle"');
}
if (dashed) out += line(trace((R) => dashed(power, R)), palette.muted, 0.35,
'stroke-dasharray="1 0.8"');
values.forEach((value, i) => {
out += line(trace((R) => curve(power, R, value)), mix(i / (values.length - 1)), 0.6);
});
out += label(X(0.5), Y(0) + 8, `${t({ en: 'Pre-study odds', es: 'Razón previa' })}, `
+ '<tspan font-style="italic">R</tspan>', 2.9, 'text-anchor="middle"');
});
const key = values.map((value, i) => line([[48 + i * 24, 57.8], [54 + i * 24, 57.8]],
mix(i / (values.length - 1)), 0.8) + label(56 + i * 24, 58.8, `<tspan font-style="italic">`
+ `${name}</tspan> = ${number(value, digits)}`, 2.9)).join('');
return `<svg xmlns="http://www.w3.org/2000/svg" width="${FIG_W * 10}" height="${FIG_H * 10}" `
+ `viewBox="0 0 ${FIG_W} ${FIG_H}">${out}${key}</svg>`;
}
// Eq. (3): n independent studies of equal power, no bias.
const teams = (power, R, n, alpha = 0.05) => (R * (1 - (1 - power) ** n))
/ (R + 1 - (1 - alpha) ** n - R * (1 - power) ** n);
const bandArt = () => `<svg xmlns="http://www.w3.org/2000/svg" width="1400" height="${BAND * 10}" `
+ `viewBox="0 0 140 ${BAND}">${Array.from({ length: 10 }, (_, i) => line(Array.from(
{ length: 81 },
(_, k) => [10 + k * 1.6, 92 - 76 * ppv(0.8, k / 80, i / 10)]), palette.mist, 0.5,
`stroke-opacity="${R2(0.5 - i * 0.04)}"`)).join('')}</svg>`;
Cada painel é um laço sobre R de 0 a 1 que passa pela mesma ppv() que preenche a Tabela 4. Traçar as curvas pela fórmula revela algo que a figura de 2005 esconde: as curvas dela correspondem a u = 0; 0,05; 0,20 e 0,80, enquanto a legenda diz 0,05; 0,20; 0,50 e 0,80. Esta versão desenha os valores da legenda, acrescenta a curva sem viés em tracejado, e a nota da legenda explica isso. Os rótulos são texto que indica a fonte dos rótulos: loadSvg passa o desenho por inlineSvgFonts, que incorpora essa fonte para o canvas, e o PDF os compõe na fonte que o provedor fornece.
#5 · Uma primeira página e um boxe para um ensaio
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 = 700) => ({ fontWeight, letterSpacing: pt(size * 0.18),
textTransform: 'uppercase' });
const BAND = 100; // mm from the top of the trim to the foot of the band
const titleBlock = { enabled: true, minHeight: mm(BAND + 12 - TOP), slot: { elements: [
{ kind: 'box', id: 'band', style: { backgroundColor: col('navy') },
placement: { anchor: { to: 'bleed', edge: 'top-left' },
size: { width: 'fill', height: mm(BAND + 3) } } }, // + the 3 mm bleed
{ kind: 'image', id: 'curves', resourceId: 'band-art', // Eq. (2), faint, for u = 0 to 0.9
placement: at('page', 'top-left', 128, 46, 76) }, // under the title, clear of the text
text('kicker', '{attr.kicker}', SANS, 8, 'mist', at('page', 'top-left', INNER, 20, 120),
caps(8)),
text('title', '{titleText}', SANS, 36, 'paper', at('#kicker', 'below', 0, 6, 150),
{ fontWeight: 800, lineHeight: 1.02 }),
text('author', '{attr.author}', SERIF, 13, 'paper', at('#title', 'below', 0, 8, 150)),
text('affiliation', '{attr.affiliation}', SANS, 8, 'mist', at('#author', 'below', 0, 1.6, 150),
{ lineHeight: 1.35 }),
text('source', '{attr.source}', SANS, 7.4, 'muted', at('page', 'top-left', INNER, BAND + 4,
MEASURE), { lineHeight: 1.35 }),
] } };
O título é o único de nível 1; o estilo dele, essay, ocupa a largura da página e desenha a faixa, o chapéu, o autor, as filiações e a linha de procedência a partir dos atributos do título, por isso a edição espanhola só troca palavras. O resumo é um boxe na largura da página sobre um fundo de cor. O Boxe 1, o exemplo resolvido, flutua para o pé de uma página atravessando as duas colunas e compõe o texto em duas colunas dentro do boxe. Os corolários mantêm a forma do artigo, com o enunciado em negrito no começo do parágrafo: :chip[Corollary 1]{style="corollary"} põe antes de cada um um pequeno rótulo vermelhão.
const calloutStyles = [
{ id: 'summary', span: 'page', background: col('tint'), marginTop: pt(0),
marginBottom: pt(LEAD), padding: { top: mm(4), right: mm(6), bottom: mm(4), left: mm(6) },
titleStyle: { fontFamily: SANS, fontSize: pt(8), ...caps(8), color: col('accent'),
gap: mm(1.5) },
body: { fontSize: pt(9.4), lineHeight: pt(13), firstLineIndent: pt(0) } },
{ id: 'box', span: 'page', placement: 'bottom', columnGap: mm(GUTTER),
backgroundEnabled: false, border: { enabled: false },
stripe: { enabled: true, side: 'top', width: pt(2.5), color: col('navy') },
padding: { top: mm(2.5), right: mm(0), bottom: mm(1), left: mm(0) },
marginTop: pt(LEAD), marginBottom: pt(LEAD),
titleStyle: { fontFamily: SANS, fontSize: pt(9), fontWeight: 700, color: col('navy'),
gap: mm(1.2) },
body: { fontFamily: SANS, fontSize: pt(8.4), lineHeight: pt(11.2), firstLineIndent: mm(3) } },
// The journal's first-page note (competing interests, abbreviation) floated to the foot of
// the first column under a hairline, as PLoS Medicine sets it.
{ id: 'note', placement: 'bottom', backgroundEnabled: false, border: { enabled: false },
stripe: { enabled: true, side: 'top', width: pt(0.5), color: col('rule') },
padding: { top: mm(1.6), right: mm(0), bottom: mm(0), left: mm(0) },
marginTop: pt(LEAD), marginBottom: pt(0),
body: { fontFamily: SANS, fontSize: pt(7.6), lineHeight: pt(10.4), color: col('muted'),
boldColor: col('ink'), textAlign: 'left', firstLineIndent: pt(0) } },
];
// :chip[Corollary 1]{style="corollary"}: a label in the sans and the accent, no frame.
const chipStyles = [{ id: 'corollary', fontFamily: SANS, fontSize: em(0.86), bold: true,
color: col('accent'), backgroundEnabled: false, borderWidth: pt(0), paddingX: em(0),
gap: em(0.35) }];
const paragraphStyles = [{ id: 'colophon', fontFamily: SANS, fontSize: pt(7.6),
lineHeight: pt(10.4), color: col('muted'), boldColor: col('ink'), textAlign: 'left',
firstLineIndent: pt(0), spaceBetween: pt(3) }];
A nota da primeira página da revista, com os conflitos de interesse e a abreviatura, é um quadro de estilo note com placement: 'bottom': ele desce para o pé da primeira coluna que tem espaço para ele, sob um fio fino, e na página 1 da edição em inglês as duas colunas terminam na mesma altura. headings.balancing.fillShortColumns deixa um parágrafo ocupar uma linha a mais, e assim as duas colunas de referências da última página terminam niveladas.
A receita completa
// ═══ Postext Cookbook · Nº 141 · A metascience essay in English and Spanish ═══════
// https://postext.dev/en/cookbook/bilingual-metascience-essay
// Code: MIT · Text: J. P. A. Ioannidis, PLoS Med 2005 (CC BY) · Figures: drawn in code (CC BY 4.0)
// Fonts: Gelasio, Sofia Sans Semi Condensed (SIL OFL 1.1) · Needs postext ≥ 1.65.0
import {
buildDocumentWithFonts, prepareFonts, renderPageToCanvas, registerResourceImage,
registerCitationEngine, defaultResourceTypes, initMathEngine, parseTSV, mergeCells, setAlignment,
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 = 'bilingual-metascience-essay';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: a navy for the furniture, one vermilion accent, every colour linked
const palette = { ink: '#1c1d24', navy: '#22305a', accent: '#b8442a', tint: '#eceff5',
rule: '#b4bccb', muted: '#5a6070', mist: '#c3cde6', paper: '#ffffff' };
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = Object.entries({ ...palette, 'main-color': palette.navy })
.map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } }));
// #endregion
const [SERIF, SANS] = ['Gelasio', 'Sofia Sans Semi Condensed'];
// mm: the 210 × 280 trim, head, foot, inner and outer margins, and the gutter
const [TRIM_W, TRIM_H, TOP, BOTTOM, INNER, OUTER, GUTTER] = [210, 280, 22, 22, 19, 17, 6];
const MEASURE = TRIM_W - INNER - OUTER; // 174 mm across both columns
const [BODY, LEAD] = [9.4, 13]; // pt
const [FIG_W, FIG_H] = [MEASURE, 60]; // mm: Figures 1 and 2, across both columns
// #region answer: one script, two editions: LANG picks the text, the language and the numbers
// The Cookbook composes the pen once per edition: content.<LANG>.md and each named slot
// replace the @content markers. What else follows the language is set here.
const edition = {
// Hyphenation patterns and the words the engine writes (Tabla, Continúa) follow the locale.
locale: t({ en: 'en-us', es: 'es' }),
// Table 1 / Tabla 1, Figure 1 / Figura 1, counted through the essay; tables caption above.
resourceTypes: defaultResourceTypes(LANG).map((type) => ({ ...type, shortLabel: type.name,
numberingTemplate: '{n}', resetOn: 'never',
...(type.id === 'table' && { captionStyle: { position: 'above' } }) })),
// Vancouver numbers in brackets, [2–4]; the CSL locale writes the list's words (2nd ed.,
// 2.ª ed.). The titles of the works stay in English in both editions.
citations: { style: 'elsevier-vancouver', locale: t({ en: 'en-US', es: 'es-ES' }),
marker: 'brackets', collapseRanges: true,
bibliography: { fontSize: em(0.78), lineHeight: pt(9.4), entrySpacing: pt(0.8),
labelWidth: mm(6.4), doi: 'hide' } },
};
// The numbers the script writes (Table 4's PPV, the figure axes) take the edition's decimal
O script.js montado funciona como está: cole-o como script de módulo em qualquer página ou abra a receita no CodePen. Pasta da receita no GitHub ↗ (abre em uma nova aba)
Variações
#Elevar os números de citação
Revistas médicas costumam compor os números de Vancouver sobrescritos.
- marker: 'brackets', collapseRanges: true,
+ marker: 'superscript', collapseRanges: true,#Imprimir os DOIs
O BibTeX desta receita não guarda os DOIs, para não passar do tamanho do script. Mantenha-os em seu arquivo e imprima-os como links.
- labelWidth: mm(6.4), doi: 'hide' } },
+ labelWidth: mm(6.4), doi: 'link' } },#Compor as tabelas numa coluna
Uma tabela 2×2 com fórmulas mais curtas cabe numa coluna: retire o span: 'page' dela, como a Tabela 4, que não o tem. Veja Artigo em duas colunas com equações numeradas para uma tabela numa coluna.
Erros comuns
Erro comum
Matemática precisa de await initMathEngine() antes da primeira composição
Fórmulas diagramadas antes de o motor de matemática estar rodando saem como caixas cinza no lugar da fórmula. Importe initMathEngine de https://esm.sh/postext com os outros símbolos e aguarde-o com await antes da primeira composição; um documento com matemática composto sem ele imprime um aviso no console. Desde o postext 1.5, o MathJax vem dentro do pacote postext como um único módulo que initMathEngine baixa, então a importação simples funciona a partir de uma CDN e ?bundle não é necessário (até a 1.4, todos os símbolos tinham de vir de https://esm.sh/postext?bundle). Importe de uma única URL: duas URLs carregam dois motores. Matemática →
Erro comum
Os arquivos do Fontsource cobrem letras, não símbolos
O kit incorpora o arquivo latin do Fontsource de cada fonte e, quando o texto usa esses caracteres, o arquivo latin-ext para č, ł, † e o arquivo greek para α, χ (em uma família que o tenha: Lora e Gelasio não têm), na tela e no PDF. Símbolos como →, ≈, ✓ e ★ não estão em nenhum desses arquivos e somem no PDF: desenhe-os, componha-os como matemática ou escolha uma fonte cujos arquivos os tenham. Fontes incorporadas ao PDF →
Erro comum
Um $ solto abre matemática: escreva \$
O cifrão abre matemática em linha, então um preço como $40 inicia uma fórmula. Escreva \$40. Escapes e caracteres literais →
- Onde a lista de 2005 para em cinco autores e et al., o BibTeX termina a lista com
and others, eelsevier-vancouverimprime et al. no lugar (desde o postext 1.19; versões anteriores imprimiam um coautor chamado others). - As páginas não coincidem entre as edições: o texto espanhol é mais longo, por isso a Tabela 4 cai uma página depois. A captura publica as páginas 1, 2, 3, 5, 6 e 7 das duas, para manter as imagens das páginas dentro do limite de tamanho e ainda mostrar a Tabela 4 em cada uma.
Créditos
- Receita
- Ignacio Ferro
- Texto
- “Why Most Published Research Findings Are False”, PLoS Medicine 2(8): e124 (2005), doi:10.1371/journal.pmed.0020124, open access under the Creative Commons Attribution License; abridged, tables and figures redrawn; Spanish translation made for the Cookbook · John P. A. Ioannidis · CC BY
- Fontes
- Gelasio (SIL OFL 1.1) · Sofia Sans Semi Condensed (SIL OFL 1.1)
- Código
- MIT, como o Postext
Editar este texto ↗ (abre em uma nova aba)Pasta da receita no GitHub ↗ (abre em uma nova aba)


