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

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

APA 7で引用する博士論文の一章

[@key, p. 33]と書いた引用をciteproc-jsがAPA 7の形に整え、文献一覧をBibTeXのブロックから組む博士論文の一章です。

このページの内容
出力
Canvas · PDF
レベル
中級
Postext
Postext 1.65.0で検証済み
1.57.0以上が必要 · postext-pdf ≥ 1.57.0
ライセンス
2026年10月22日更新
コードMIT · 本文CC BY 4.0

1ページ(全3ページ)

  • 英語の見本:日本語版はまだありません
  • 仕上がり210 × 297 mm
  • 1段
  • Literata 11/16
  • Public Sans
  • 3ページ
  • レベル
  • Postext 1.57.1
  • 組版時間282 ms
  • コード118行

かんたんな説明

博士論文の一章です。著者は出典ごとに短いコードを書き、Postextが本文中の引用と章末の文献一覧をAPAの書式で組みます。

できあがり

教育学の博士論文の第2章、先行研究のレビューです。紙で読むことと画面で読むことについて、20年分の研究が何を示してきたかをまとめています。左綴じのA4判に、Literataを行送り16ptで組み、大学の青を淡くした帯を章頭に敷きます。著者は文献をZoteroで管理し、書き出したBibTeXをそのまま貼り込みます。本文では、出典ひとつがひとつのキーです。Postextはすべての引用をAPA 7の形に整え、著者名と年、指定があればページを入れます。著者名が文の一部になるときは「Delgado et al. (2018)」と書き、文献一覧もこのスタイルが求める順序と形で組みます。指導教員にChicagoで、と言われたら、書き換えるのはスタイルを指定する1行です。

このレシピが答える質問

  • APA、IEEEなどの引用スタイルで、文献を引用し参考文献を作るには?

手短な答え

script.js · 27〜39行コード全体で見る
// Citations are written [@key, p. 33] and formatted by citeproc-js in the chosen CSL
// style; the references come from the BibTeX block at the end of the chapter. Register
// the engine once, before the first build, then the style is one setting.
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
const citations = {
  style: 'apa', // 'chicago-author-date', 'ieee', 'vancouver'… change nothing else
  link: true, // each citation jumps to its entry in the PDF and on screen
  bibliography: {
    // APA asks for a half-inch hanging indent and keeps the list in the text size.
    fontSize: em(1), hangingIndent: mm(12.7), entrySpacing: pt(4),
    doi: 'link', // printed whole, as APA wants, and clickable
  },
};

材料

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

作り方

#1 · 引用エンジンとスタイルをひとつずつ

コードは上の手短な答えにあります。Postextは引用を読み取り、その文言は引用エンジンに任せます。エンジンは最初のビルドの前に一度だけ登録します。postext-citeprocはZoteroやMendeleyが使うエンジンciteproc-jsを包んだもので、CSLスタイル16種とそのロケールファイルを備えています。[@mangen2013]は「(Mangen et al., 2013)」になり、角括弧のない@delgado2018は著者名を文中に置きます。[@ibanez2023, pp. 12–15]ではページ範囲が括弧の中に入ります。エンジンは文書のロケールに従うので、文書がスペイン語なら、同じキーでも接続語や略語はスペイン語のロケールファイルから取られます。

#2 · 文献一覧はBibTeXのブロックから

章の最後のブロックは:::references{format=bibtex}で、中にZoteroの書き出しを貼り込みます。アクセントは{\'a}のように書きます。その上の:::bibliographyが、References見出しの下に一覧を置きます。これがなければ、一覧は文書の末尾に追加されます。載るのは引用した文献だけで、APAの順序で並び、本文中の引用はどれも一覧の該当項目にリンクします。

#3 · 番号のない見出しと、言葉で書く参照

script.js · 106〜107行コード全体で見る
  headingStyles: [{ id: 'references', numbered: false }],
  crossRefs: { section: t({ en: 'Section {n}', es: 'Sección {n}' }) },

文献一覧の見出しにはreferencesスタイルを使います。このスタイルは見出しを目次に残したまま番号づけから外すので、一覧が2.4節になることはありません。:ref{id="sec-speed"}はcrossRefsのラベルから「Section 2.2」と印字し、見出しにリンクします。番号は章題のstartAt=2から来ており、見出しと同じカウンターを使っています。

#4 · 章頭を帯の中に置く

script.js · 43〜68行コード全体で見る
const BAND = 92; // mm from the trim's top
const opener = {
  enabled: true,
  minHeight: mm(BAND - 28 + 10), // the body starts 10 mm under the band
  slot: { elements: [
    { kind: 'box', id: 'band', style: { backgroundColor: col('tint') },
      placement: { anchor: { to: 'page', edge: 'top-left' },
        size: { width: 'fill', height: mm(BAND) } } },
    { kind: 'text', id: 'label', content: t({ en: 'Chapter', es: 'Capítulo' }),
      fontFamily: LABEL, fontSize: pt(9), fontWeight: 600, letterSpacing: pt(1.8),
      textTransform: 'uppercase',
      color: col('accent'), align: 'left',
      placement: { anchor: { to: 'container', edge: 'top-left' },
        offset: { x: mm(0), y: mm(2) } } },
    { kind: 'text', id: 'number', content: '{number}', fontFamily: TEXT, fontSize: pt(96),
      fontWeight: 300, lineHeight: 0.9, color: col('accent'), align: 'right',
      placement: { anchor: { to: 'container', edge: 'top-right' },
        offset: { x: mm(0), y: mm(-6) },
        size: { width: mm(40), height: 'auto' } } },
    { kind: 'text', id: 'title', content: '{titleText}', fontFamily: TEXT, fontSize: pt(24),
      lineHeight: 1.12, fontWeight: 600, color: col('ink'), align: 'left', overflow: 'wrap',
      placement: { anchor: { to: 'container', edge: 'top-left' },
        offset: { x: mm(0), y: mm(14) },
        size: { width: mm(108), height: 'auto' } } },
  ] },
};

帯は仕上がりに固定した囲みで、本文はその10 mm下から始まります。数字はLiterata Lightの96ptで右に置きます。この大きさでは文字というより形として見え、表題は行長をすべて使えます。

script.js · 16〜21行コード全体で見る
const palette = {
  ink: '#1b1b1f', accent: '#22406a', tint: '#e6ecf4', rule: '#b9bec8', muted: '#5d6370',
};
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º 087 · A thesis chapter cited in APA 7 ═══════════════════
// https://postext.dev/en/cookbook/apa-thesis-with-bibtex
// Code: MIT · Text: original (CC BY 4.0) · Pictures: none
// Fonts: Literata, Public Sans (SIL OFL 1.1) · Needs postext ≥ 1.57.0
import {
  buildDocumentWithFonts, renderPageToCanvas, registerCitationEngine,
} 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 = 'apa-thesis-with-bibtex';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: a thesis prints in black; the one colour is the university's
const palette = {
  ink: '#1b1b1f', accent: '#22406a', tint: '#e6ecf4', rule: '#b9bec8', muted: '#5d6370',
};
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 TEXT = 'Literata', LABEL = 'Public Sans';
const LEAD = 16; // pt: double spacing is a typewriter habit; 1.45 reads as well and fits more

// #region answer: the citation engine, APA 7 and how its references look
// Citations are written [@key, p. 33] and formatted by citeproc-js in the chosen CSL
// style; the references come from the BibTeX block at the end of the chapter. Register
// the engine once, before the first build, then the style is one setting.
registerCitationEngine(createCiteprocEngine({ styles: STYLES, locales: LOCALES }));
const citations = {
  style: 'apa', // 'chicago-author-date', 'ieee', 'vancouver'… change nothing else
  link: true, // each citation jumps to its entry in the PDF and on screen
  bibliography: {
    // APA asks for a half-inch hanging indent and keeps the list in the text size.
    fontSize: em(1), hangingIndent: mm(12.7), entrySpacing: pt(4),
    doi: 'link', // printed whole, as APA wants, and clickable
  },
};
// #endregion

// #region opener: a pale band at the head of the page, the number large and light in it
const BAND = 92; // mm from the trim's top
const opener = {
  enabled: true,
  minHeight: mm(BAND - 28 + 10), // the body starts 10 mm under the band
  slot: { elements: [
    { kind: 'box', id: 'band', style: { backgroundColor: col('tint') },

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

アレンジ

#スタイルを変える

同じ章をChicagoの著者年方式にすると、著者名の後のカンマが消え、年は著者の後に並びます。

-  style: 'apa', // 'chicago-author-date', 'ieee', 'vancouver'… change nothing else
+  style: 'chicago-author-date',

#一覧を本文より小さく組む

多くの大学では、文献一覧を本文より一段小さく、行間を詰めて組むことを認めています。

-    fontSize: em(1), hangingIndent: mm(12.7), entrySpacing: pt(4),
+    fontSize: em(0.9), lineHeight: pt(13), hangingIndent: mm(12.7), entrySpacing: pt(3),

よくあるつまずき

  • APAでは論文や書籍の題名をセンテンスケース(文頭と固有名詞だけ大文字)で書きますが、citeproc-jsは題名をデータのとおりに印字します。Zoteroは題名の多くをタイトルケースで保存しているので、ページに出る前にZoteroかBibTeXの側で直してください。

クレジット

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