本文へスキップ
レシピ番号95

レシピ集 · 第5章 · 本の構成

バンクーバー方式の医学論文

A4判2段組みの臨床試験報告。上付きの引用番号、番号付きのバンクーバー方式の文献一覧、PDFでリンクとして開くDOIを備えます。

このページの内容
ジャンル
論文・学術書
出力
Canvas · PDF
レベル
中級
Postext
Postext 1.65.0で検証済み
1.65.0以上が必要 · postext-pdf ≥ 1.65.0
ライセンス
2026年10月31日更新
コードMIT · 本文CC BY 4.0
  • 英語の見本:日本語版はまだありません
  • 仕上がり210 × 297 mm
  • 2段, 段間6 mm
  • PT Serif 9.3/12.8
  • Fira Sans
  • Fira Sans Condensed
  • Fira Sans@tnum
  • 3ページ
  • レベル
  • Postext 1.65.0
  • 組版時間298 ms
  • コード180行

かんたんな説明

医学誌のページのように組んだ短い医学研究論文です。著者はコードで文献を引き、Postextは本文に小さな上付きの番号を印刷し、最後に番号付きの文献一覧を作り、各DOIをリンクにします。

できあがり

臨床医学誌の3ページです。パイロット試験を報告する原著論文を、ICMJEの雑誌と同じくA4判2段組みで組みます。1ページ目の上部をティールの誌名帯が横切り、その下に論文種別、3行の題、上付きの所属番号を付けた著者、淡い地色の上の構造化抄録が続きます。著者はBibTeXのキーで引用し、ページには医学系の編集者が求める形が現れます。ピリオドの後の小さな上付きの番号、6–8のようにまとめた連続する文献、6,9のように詰めて組んだ連続しない2つの文献、そしてNLM形式(「Lancet 2016;387(10022):957–67」)で各文献のDOIで終わる番号付きの文献一覧です。PDFでは各番号が該当する文献へ跳び、各DOIが論文を開きます。試験は架空ですが、引用している11件の文献は実在します。

このレシピが答える質問

  • 医学雑誌のように、引用番号を上付きにし、DOIを有効なリンクにするには?
  • APA、IEEEなどの引用スタイルで、文献を引用し参考文献を作るには?

手短な答え

script.js · 29〜49行コード全体で見る
// [@key] prints a raised number in order of first citation. English journals set it after
// the full stop, "control.[@ncdrisc2021]"; Spanish ones before it, "controlada[@ncdrisc2021].".
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
// elsevier-vancouver is the bundled NLM/Vancouver style (citation-sequence). Two edits bring
// its list to the NLM sample references: "1." instead of "[1]", and the issue after the
// volume, 2015;373(22):2103-16.
const vancouver = STYLES['elsevier-vancouver']
  .replace('<text variable="citation-number" prefix="[" suffix="]"/>',
    '<text variable="citation-number" suffix="."/>')
  .replace('<text variable="volume"/>',
    '<group><text variable="volume"/><text variable="issue" prefix="(" suffix=")"/></group>');
const citations = {
  style: 'custom', customStyle: vancouver,
  marker: 'superscript', collapseRanges: true, // raised 1 and 6–8, not [1] and [6–8]
  link: true, // each number jumps to its reference, in the PDF and on screen
  // 7.8 pt: the eleven societies of reference 5, ACC/AHA/…/PCNA, fit one line whole
  bibliography: { fontSize: em(0.84), lineHeight: pt(10.4), entrySpacing: pt(1.6),
    labelWidth: mm(5.5), labelAlign: 'right', // a column for the numbers: 9. and 10. end
    // together, and every entry's text starts at one x, first line and turnovers alike
    doi: 'link' }, // https://doi.org/… printed whole and clickable
};

材料

種類
PT Serif, Fira Sans, Fira Sans Condensed (SIL OFL 1.1)
素材
なし:画像はすべてコードで描画

作り方

#1 · 上付きでリンク付きのバンクーバー方式

コードは前に掲げた手短な答えです。同梱のスタイルのうち、NLMの『Citing Medicine』に従っているのはelsevier-vancouverです(引用順、「Ettehad D, Emdin CA」の形の著者名、6名の後に「et al.」、略記した誌名)。そこでこのファイルを出発点にします。2つの文字列置換で、文献一覧をNLMの見本に合わせます。番号を「[1]」ではなく「1.」とし、号を巻の後に置きます。marker: 'superscript'は、スタイルが何を書くかにかかわらず引用を上付きの番号にし、doi: 'link'は各https://doi.org/のアドレスをリンクのまま保ちます。番号の連続しない2つの文献は「6,9」と詰めて組まれます。カンマの後にスペースがあると、両端そろえの行で伸びてしまうからです。文献一覧では、labelWidthが番号に専用の列を与え、labelAlign: 'right'が「9.」と「10.」の末尾をそろえるので、各項目のテキストは1行目も2行目以降も同じ位置から始まります。AMAスタイルも同梱されており、自分で番号を上付きにしますが、文献一覧の句読点とページ範囲の書き方がバンクーバー方式と異なります。

#2 · 2段にまたがる表題ブロック

script.js · 53〜83行コード全体で見る
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: COND, fontWeight: 600, letterSpacing: pt(1.3),
  textTransform: 'uppercase' };
const JOURNAL = t({ en: 'Almenara Medical Journal', es: 'Revista Médica de Almenara' });
const titleBlock = { enabled: true,
  minHeight: mm(62), // the abstract and the text start under the note, on both columns
  slot: { elements: [
    { kind: 'box', id: 'band', style: { backgroundColor: col('accent') },
      placement: { anchor: { to: 'page', edge: 'top-left' },
        size: { width: 'fill', height: mm(15) } } },
    text('journal', JOURNAL, COND, 9.5, { ...caps, color: col('paper'),
      placement: at('page', 'top-left', INNER, 6) }),
    text('issue', '{attr.issue}', COND, 9.5, { ...caps, color: col('paper'),
      align: 'right', placement: at('page', 'top-right', -OUTER, 6, 60) }),
    text('kind', '{attr.kind}', COND, 9, { ...caps, color: col('accent'),
      placement: at('container', 'top-left', 0, 0, MEASURE) }),
    text('title', '{titleText}', SANS, 19.5, { fontWeight: 600, lineHeight: 1.16,
      placement: at('#kind', 'below', 0, 3, MEASURE - 20) }),
    text('authors', '{attr.authors}', SERIF, 10.5, { inlineMarks: true, // ^1^ → ¹
      placement: at('#title', 'below', 0, 4.5, MEASURE) }),
    text('affiliations', '{attr.affiliations}', SANS, 7.4, { inlineMarks: true,
      lineHeight: 1.35, color: col('muted'), placement: at('#authors', 'below', 0, 2, MEASURE) }),
    { kind: 'rule', id: 'rule', thickness: pt(0.5), color: col('rule'),
      placement: at('#affiliations', 'below', 0, 3, MEASURE) },
    text('note', '{attr.note}', SANS, 7.4, { color: col('muted'),
      placement: at('#rule', 'below', 0, 1.6, MEASURE) }),
  ] },
};

論文の題はただひとつのレベル1見出しで、スタイルはarticleです。このスタイルはページ幅にまたがり、見出しをデザインから描きます。論文種別、著者、所属、注記は見出しの属性から取ります。inlineMarksは属性中の^1^を上付きの所属番号にし、所属の中の\nで機関ごとに改行します。帯は仕上がりに固定してあるので、紙の上端まで届きます。

#3 · 構造化抄録とキーポイントの囲み

script.js · 87〜97行コード全体で見る
const box = (id, bold, more) => ({ id, border: { enabled: false }, snapToGrid: false,
  marginTop: pt(LEAD), marginBottom: pt(LEAD),
  titleStyle: { ...caps, fontSize: pt(8.5), color: col('accent') }, // run-in labels in bold
  body: { fontFamily: SANS, fontSize: pt(8.3), lineHeight: pt(11.2), textAlign: 'left',
    firstLineIndent: pt(0), paragraphSpacing: true, boldColor: col(bold) }, ...more });
const calloutStyles = [
  box('abstract', 'accent', { background: col('tint'), padding: mm(3.5), marginTop: pt(0) }),
  box('keypoints', 'ink', { backgroundEnabled: false, padding: { top: mm(2.5), right: mm(0),
    bottom: mm(1), left: mm(0) }, stripe: { enabled: true, side: 'top', width: pt(2.5),
    color: col('accent') } }),
];

2つの囲みは同じ文字スタイルを共有します。8.3ptのFira Sansで、ラベルは太字の追い込みです。要約的な内容に読者が期待する調子です。抄録には地色を敷き、ラベルをティールにします。キーポイントは2.5ptのストライプの下に置き、ラベルは墨色です。snapToGrid: falseは内側余白を正確に保つので、抄録の囲みはテキストにぴったり沿います。

#4 · 段の頭に置く表1と図1

script.js · 300〜319行コード全体で見る
const resources = () => [
  { id: 'tbl-baseline', typeId: 'table', kind: 'table', createdAt: 0, updatedAt: 0,
    placement: { position: 'top' },
    caption: t({ en: 'Characteristics of the patients at baseline.',
      es: 'Características de los pacientes al inicio.' }),
    note: t({ en: 'Values are mean (SD) or number (%). BP, blood pressure, in mm Hg.',
      es: 'Valores en media (DE) o número (%). PA, presión arterial, en mm Hg.' }),
    table: { model: { headerRowCount: 1, columnWidths: [2.2, 1.1, 1.1],
      rows: parseTSV(baseline).rows.map((row, r) => row.map(({ content }, c) => ({ content,
        ...(r === 0 && { isHeader: true }), ...(c > 0 && { align: 'center' }) }))) } } },
  { id: 'fig-home', typeId: 'figure', kind: 'svg', createdAt: 0, updatedAt: 0,
    placement: { position: 'top' }, svg: { fileId: 'home.svg', width: 850, height: 520 },
    caption: t({ en: 'Mean home systolic pressure by week in the telemonitoring group, with its '
      + '95% confidence interval. The dashed line is the home target of 135\u00a0mm\u00a0Hg.',
    es: 'Presión sistólica domiciliaria media por semana en el grupo de telemonitorización, con '
      + 'su intervalo de confianza del 95\u00a0%. La línea discontinua es el objetivo de '
      + '135\u00a0mm\u00a0Hg.' }),
    altText: t({ en: 'A line falling from 158 mm Hg in week 1 to 135 mm Hg in week 12.',
      es: 'Una línea que baja de 158 mm Hg en la semana 1 a 135 mm Hg en la semana 12.' }) },
];

表は表計算ソフトが書き出すのと同じタブ区切りのテキストから読み込み、見出し行はティールで塗って白い太字のラベルを載せます。2つのリソースはどちらも、それを引用する段落の後で段の頭へフロートします。shortLabelにタイプの正式名を設定すると、:refは論文誌の書き方どおり「(Table 1)」と印刷します。題に付けたnumbered: falseで、番号は1.1ではなく1になります。セルのFira SansにはfigureStyle: 'tabular'を指定し、数字をすべて同じ幅にして、2群の平均値と人数を縦にそろえます。

script.js · 17〜21行コード全体で見る
const palette = { ink: '#1a1d21', accent: '#0d5c63', tint: '#e5eff0', rule: '#9fb4b6',
  muted: '#566065', 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' } }));

レシピの全体

Sandbox
// ═══ Postext Cookbook · Nº 095 · A medical article in Vancouver style ══════════════
// https://postext.dev/en/cookbook/medical-article-vancouver
// Code: MIT · Text: original (CC BY 4.0) · Chart: generated in code (CC BY 4.0)
// Fonts: PT Serif, Fira Sans, Fira Sans Condensed (SIL OFL 1.1) · Needs postext ≥ 1.65.0
import {
  buildDocumentWithFonts, renderPageToCanvas, registerCitationEngine, registerResourceImage,
  defaultResourceTypes, parseTSV, 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 = 'medical-article-vancouver';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: black text, one clinical teal for the journal's own marks
const palette = { ink: '#1a1d21', accent: '#0d5c63', tint: '#e5eff0', rule: '#9fb4b6',
  muted: '#566065', 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, COND] = ['PT Serif', 'Fira Sans', 'Fira Sans Condensed'];
const [TRIM_W, TRIM_H, TOP, BOTTOM, INNER, OUTER, GUTTER] = [210, 297, 24, 22, 17, 17, 6];
const MEASURE = TRIM_W - INNER - OUTER;
const LEAD = 12.8; // pt: 9.3 pt type, as journals set two columns of A4

// #region answer: Vancouver numbers as superscripts, a "1." list and DOIs that are links
// [@key] prints a raised number in order of first citation. English journals set it after
// the full stop, "control.[@ncdrisc2021]"; Spanish ones before it, "controlada[@ncdrisc2021].".
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
// elsevier-vancouver is the bundled NLM/Vancouver style (citation-sequence). Two edits bring
// its list to the NLM sample references: "1." instead of "[1]", and the issue after the
// volume, 2015;373(22):2103-16.
const vancouver = STYLES['elsevier-vancouver']
  .replace('<text variable="citation-number" prefix="[" suffix="]"/>',
    '<text variable="citation-number" suffix="."/>')
  .replace('<text variable="volume"/>',
    '<group><text variable="volume"/><text variable="issue" prefix="(" suffix=")"/></group>');
const citations = {
  style: 'custom', customStyle: vancouver,
  marker: 'superscript', collapseRanges: true, // raised 1 and 6–8, not [1] and [6–8]
  link: true, // each number jumps to its reference, in the PDF and on screen
  // 7.8 pt: the eleven societies of reference 5, ACC/AHA/…/PCNA, fit one line whole
  bibliography: { fontSize: em(0.84), lineHeight: pt(10.4), entrySpacing: pt(1.6),
    labelWidth: mm(5.5), labelAlign: 'right', // a column for the numbers: 9. and 10. end
    // together, and every entry's text starts at one x, first line and turnovers alike
    doi: 'link' }, // https://doi.org/… printed whole and clickable

組み立てたscript.jsはそのまま動きます。任意のページのモジュールスクリプトに貼り付けるか、レシピをCodePenで開いてください。 GitHub上のレシピのフォルダー ↗ (新しいタブで開きます)

アレンジ

#AMAスタイルを使う

AMAスタイルは自分で番号を上付きにし、文献を「doi:10.1056/…」の形で並べます。編集とマーカーを外してください。

-  style: 'custom', customStyle: vancouver,
-  marker: 'superscript', collapseRanges: true, // raised 1 and 6–8, not [1] and [6–8]
+  style: 'american-medical-association',

#DOIをリンクなしで印刷する

印刷専用のPDFでは、アドレスを黒のただのテキストにします。

-    doi: 'link' }, // https://doi.org/… printed whole and clickable
+    doi: 'text' },

#角かっこの番号

バンクーバー方式の雑誌には、番号を上付きにせず角括弧に入れて書くものもあります。

-  marker: 'superscript', collapseRanges: true, // raised 1 and 6–8, not [1] and [6–8]
+  marker: 'brackets', collapseRanges: true,

よくあるつまずき

つまずき

見出しスタイルのヘッダーは節全体に効く

タイトルのスタイルに書いたheader: { elements: [] }は、章扉だけでなく、次のスタイル付きの見出しまでの柱をすべて消します。最初のページだけで柱を消すには、ヘッダー要素にpages: 'body'を指定してください。 柱とノンブル →

  • 見出しスタイルのheaderは、その見出しが始める節全体に効きます。題にheader: { elements: [] }を付けると、次のスタイル付き見出しまでのすべてのページから柱が消えます。1ページ目に柱を出さないだけなら、柱にpages: 'body'を付ければ足ります。

クレジット

レシピ
Ignacio Ferro
本文
書き下ろしの文章, CC BY 4.0
フォント
PT Serif (SIL OFL 1.1) · Fira Sans (SIL OFL 1.1) · Fira Sans Condensed (SIL OFL 1.1)
SandboxPDF