biblatex bibliografía por capítulo y títulos seg.

biblatex bibliografía por capítulo y títulos seg.

Esta es una continuación de mi pregunta anterior.Forma correcta de incluir capítulos no numerados en una bibliografía por capítulo usando biblatex.

La solución propuesta por Audrey falla cuando uso el titlesecpaquete para modificar los títulos de los capítulos. Aquí hay un 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}}
    {\pretocmd\@makechapterhead
       {#1}{}{\blx@err@patch{\string\@makechapterhead}}%
     \pretocmd\@makeschapterhead
       {#1}{}{\blx@err@patch{\string\@makeschapterhead}}}}
% Save data for bibliography titles
\apptocmd\@makechapterhead
  {\csdef{subbib:\therefsection}{%
     Chapter~\ref{refsection:\therefsection} - \nameref{refsection:\therefsection}}}{}{}
\apptocmd\@makeschapterhead
  {\csdef{subbib:\therefsection}{%
     \nameref{refsection:\therefsection}}}{}{}

\makeatother

\defbibheading{subbibliography}{%
  \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}
\addbibresource{\jobname.bib}

\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

\printbibheading[heading=bibintoc]
\bibbysection[heading = subbibliography]

\end{document}

El resultado en la bibliografía es este:

ingrese la descripción de la imagen aquí

Como podéis ver las referencias a los capítulos han desaparecido. Ni siquiera hay signos de interrogación. Supongo que esto significa que la \csuse{subbib:\therefsection}}parte de la solución de Audrey apunta a nada después de insertar la redefinición del formato del capítulo usando titlesec's \titleformat.

Además, poner la \titleformat{...}redefinición de los títulos de los capítulos antes del parche biblatex termina en el siguiente error argument of \csdef has an extra }.

¿Alguna idea de cómo solucionar esto?

Respuesta1

Es probable que el problema sea agregar las macros de los capítulos. Puede mover las definiciones de secuencia de control para los títulos justo después biblatexdel parche anterior.

\def\blx@refpatch@chapter#1{%
  \ifundef\chapter
    {\blx@err@nodocdiv{chapter}}
    {\pretocmd\@makechapterhead
       {#1\csdef{subbib:\therefsection}{Chapter~\ref{refsection:\therefsection}}}
       {}{\blx@err@patch{\string\@makechapterhead}}%
     \pretocmd\@makeschapterhead
       {#1\csdef{subbib:\therefsection}{\nameref{refsection:\therefsection}}}
       {}{\blx@err@patch{\string\@makeschapterhead}}}}

información relacionada