The numeric part of the auxiliary filename corresponds to the reference section counter (the same value returned by \therefsection
). The filename suffix (-blx
) corresponds to \blxauxsuffix
. This can be redefined with \renewcommand
in the preamble. The filename prefix is hardcoded as \jobname
.
You could patch biblatex
internals to add chapter filenames, but these need to be defined in the preamble. So hooking into \include
is too late. One workaround is to specify an ordered list of chapter filenames in the preamble.
Here's an example that replaces the reference section number with chapter filenames. The chapter filenames are passed to a new command \blxauxprefix
as a comma-separated list.
\documentclass{report}
\usepackage[backend=bibtex,refsection=chapter]{biblatex}
\makeatletter
\def\blxauxprefix#1{%
\defcounter{listcount}{0}%
\def\do##1{\stepcounter{listcount}\csgdef{blxauxprefix:\the\c@listcount}{-##1}}%
\docsvlist{#1}}
\patchcmd{\blx@refsection@bibtex}
{\jobname\the\c@refsection\blxauxsuffix}
{\jobname\csuse{blxauxprefix:\the\c@refsection}\blxauxsuffix}{}{}
\patchcmd{\blx@bblfile@bibtex}
{\jobname\the\c@refsection\blxauxsuffix}
{\jobname\csuse{blxauxprefix:\the\c@refsection}\blxauxsuffix}{}{}
\apptocmd{\include}
{\ifcsstring{blxauxprefix:\the\c@refsection}{#1}{}
{\blx@warning{%
'aux' file prefix does not match \MessageBreak
'\@backslashchar include' filename #1}}}{}{}
\makeatother
\blxauxprefix{chap1,chap2}
\begin{filecontents}{chap1.tex}
\chapter{First chapter}
\cite{ctan}
\end{filecontents}
\begin{filecontents}{chap2.tex}
\chapter{Second chapter}
\cite{companion,knuth:ct}
\end{filecontents}
\addbibresource{biblatex-examples.bib}
\defbibheading{subbibliography}{\section*{%
\ifnumgreater{\therefsection}{0}
{References for Chapter \ref{refsection:\therefsection}}
{References before chapters}}}
\begin{document}
\cite{markey}
\include{chap1}
\include{chap2}
\printbibheading
\bibbysection[heading=subbibliography]
\end{document}