biblatex 장별 참고문헌 및 titlesec

biblatex 장별 참고문헌 및 titlesec

이것은 이전 질문에 대한 후속 조치입니다.Biblatex를 사용하여 장별 참고 문헌에 번호가 없는 장을 포함하는 올바른 방법.

titlesec패키지를 사용하여 장 제목을 수정하면 Audrey가 제안한 솔루션이 중단됩니다 . 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}

참고문헌의 결과는 다음과 같습니다.

여기에 이미지 설명을 입력하세요

보시다시피 해당 장에 대한 참조가 사라졌습니다. 물음표조차 없습니다. 나는 이것이 '를 \csuse{subbib:\therefsection}}사용하여 장 형식의 재정의를 삽입한 후 Audrey가 제시한 솔루션의 일부가 아무 것도 가리키지 않는다는 것을 의미한다고 생각합니다 .titlesec\titleformat

또한, \titleformat{...}biblatex 패치가 끝나기 전에 장 제목을 재정의하면 다음 오류가 발생합니다 argument of \csdef has an extra }.

이 문제를 해결하는 방법에 대한 아이디어가 있습니까?

답변1

챕터 매크로를 추가하는 것이 문제일 가능성이 높습니다. biblatex의 앞에 추가된 패치 바로 뒤에 타이틀에 대한 제어 순서 정의를 이동할 수 있습니다 .

\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}}}}

관련 정보