BibLaTeXで節や章ごとの参考文献


ややマニアックだが、LaTeXで、参考文献を節や章ごとに出力する方法のうちの一つ(他にもいろいろありますが)。

先に要点を。

プリアンブルで以下のように書く。本記事では節ごとにしているが、refsegment=chapterとすれば章ごとになる。
本文中での参照順にするには、sorting=noneとすればよい。他のsortingオプションについてはBibLaTeXのリファレンスを参照。

\usepackage[
    sorting=none,
    refsegment=section
]{biblatex}

本文では以下のように参照する(関連部分のみ。全体は記事末尾に)。

\section{First of all}
We have our first citation\cite{firstRef}.
         :
\printbibliography[segment=\therefsegment,heading=subbibliography]

\section{Conclusion}
         :
the second entry\cite{secondRef} in .bib 
         :
\printbibliography[segment=\therefsegment,heading=subbibliography]

\printbibliography

Overleaf環境でのサンプルは以下です。

以下、関連ファイル。

main.tex
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[
    bibencoding=utf8,
    style=numeric, 
    url = false,
    sorting=none,
    refsegment=section
]{biblatex}
\addbibresource{references.bib}

\title{Reference list per section}
\author{boonrew}
\date{August 2020}

\begin{document}
\maketitle

\section{First of all}
We have our first citation\cite{firstRef}.
Next, we get the second\cite{thirdRef} in this section, taking different order in our reference.bib file.

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

\section{Conclusion}
This is the second and final section. In this section, the second entry\cite{secondRef} in .bib and the first one\cite{firstRef} are cited to show the effect of 'sorting=' parameter.

And we have our total refrence list at the last.

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

\printbibliography
\end{document}
reference.bib
@book{firstRef,
  title={The Hitchhiker's Guide to the Galaxy},
  author={Adams, D.},
  isbn={9781417642595},
  url={http://books.google.com/books?id=W-xMPgAACAAJ},
  year={1995},
  publisher={San Val}
}

@book{secondRef,
  title={How to keep to be non-sense},
  author={Foo, B.},
  isbn={478981856X},
  year={2995},
  publisher={Sanity Value}
}

@article{thirdRef,
  title={For the senseless, by the senseless, of the senseless},
  author={Bar, F.},
  url={http://books.google.com/books?id=W-xMPgAACAAJ},
  year={1095},
  pages = {20345,21495},
  publisher={Non non}
}
latexmkrc
$latex = 'platex';
$bibtex = 'pbibtex';
$dvipdf = 'dvipdfmx %O -o %D %S';
$makeindex = 'mendex -U %O -o %D %S';
$pdf_mode = 3; 

おしまい。