LoginSignup
1
2

More than 5 years have passed since last update.

TeXのchapterbibが動かなかったときのメモ

Posted at

はじめに

TeXで論文の編集作業をしていたときに、章毎にリファレンスをつけてほしいと言われたものの、なかなか時間がかかったので、備忘録としてメモ。

環境
- Mac OS X
- TeX live 2015

もともとbibtexを使って、\printbibliographyでリファレンスを巻末に表示させていた。
これを章毎にリファレンスを表示させるように変更する。

問題(chapterbibで試行錯誤)

インターネットで検索すると、chapterbib.styをインストールしたあと、
メインのTeXファイルのプリアンブルに

\usepackage[sectionbib]{chapterbib}

と書いて、\include されているファイル内に

\chapter{Ch 1}
...
\bibliographystyle{ plain }
\bibliography{ ch1-ref }

と書いてコンパイルすると章毎にリファレンスをつけられると、多くの記事を見たのだが、
コンパイル時に

! Package biblatex Error: '\bibliographystyle' invalid.
! LaTeX Error: Can be used only in preamble.

このようなエラーが出てうまくできず...
原因を色々調べてみると、もともと自分が使っていたbibtexと、使おうとしていたchapterbibが共存できなそう。

解決策(bibtex)

インターネットで検索すると、それらしい記事を発見

こちらによると、\chapterの終わりに

\printbibliography[segment=\therefsegment,heading=subbibliography]

として、各章の終わりにかけば良いとのこと。
これでやっとできた!
さらに、最初のプリアンブルでオプションを指定することで、表示方法を変更できた。

\usepackage[
    defernumber=true,
    firstinits=true,
    refsegment=chapter
]{biblatex}
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2