# biblatex per-chapter bibliography and titlesec

This is a follow-up to my previous question Proper way to include unnumbered chapters in a per chapter bibliography using biblatex.

The solution proposed by Audrey breaks when I use the titlesec package to modify the chapter headings. Here's a MWE:

\documentclass{book}

\usepackage{titlesec}
\usepackage{titletoc}

\setcounter{tocdepth}{3}

\usepackage[style = phys,%
sorting=none,%
backend=biber,%
style=numeric,%
hyperref=auto,%
backref = true,%
refsection=chapter,%
%           citereset=chapter,%
dateabbrev=false,%
urldate=comp]{biblatex}

\usepackage{nameref}

\makeatletter
% Extend biblatex's \chapter patch to \chapter*
\def\blx@refpatch@chapter#1{%
\ifundef\chapter
{\blx@err@nodocdiv{chapter}}
% Save data for bibliography titles
{\csdef{subbib:\therefsection}{%
Chapter~\ref{refsection:\therefsection} - \nameref{refsection:\therefsection}}}{}{}
{\csdef{subbib:\therefsection}{%
\nameref{refsection:\therefsection}}}{}{}

\makeatother

\section*{References for \csuse{subbib:\therefsection}}}

\titleformat{\chapter}[hang]
{\bfseries \LARGE \bfseries }{ \thechapter}{0.75em}{}[\vspace{2ex}\titlerule]
\titlespacing*{\chapter}{0cm}{0cm}{0.6cm}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@misc{A01,
author = {Author, A.},
year = {2001},
title = {Alpha},
}
@misc{B02,
author = {Buthor, B.},
year = {2002},
title = {Bravo},
}
@misc{C03,
author = {Cuthor, C.},
year = {2003},
title = {Charlie},
}
\end{filecontents}

\begin{document}

\chapter*{Introduction}
\begin{refsegment}
\cite{A01}
\end{refsegment}
\chapter{Chapter 1}

\cite{A01,B02}

\chapter*{Conclusion}
\begin{refsegment}
\cite{C03}
\end{refsegment}

\backmatter

\end{document}


The result in the bibliography is this:

As you can see the references to the chapters have disappeared. There not even any question marks. I guess this means that the \csuse{subbib:\therefsection}} portion of the solution by Audrey points towards nothing after I insert the redefinition of the chapter format using titlesec's \titleformat.

Also, putting the \titleformat{...} redefinition of the chapter headings before the biblatex patch ends in the following error argument of \csdef has an extra }.

Any ideas how to work around this?

-

Appending the chapter macros is likely the problem. You can move the control sequence definitions for the titles just after biblatex's prepending patch.

\def\blx@refpatch@chapter#1{%
\ifundef\chapter
{\blx@err@nodocdiv{chapter}}