\let\chapterbib@include\include \newcounter{chap@included} \newcommand{\maketocbibitem}{} \newcommand{\@sectionbib@maketocbibitem}{\@auxdowrite{\@print{\@addcontentsline{htoc}}\{0\}\{\@print{\ahrefloc}\{bib:chap\thechap@included\}\{\refname{}\}\}\@print{ }}} \renewcommand{\include}[1] {\stepcounter{chap@included}% \def\chapterbib@include@name{#1}% \chapterbib@include{#1}} \renewcommand{\bibliography}[1]{\maketocbibitem\input{\chapterbib@include@name.bbl}} \let\chapterbib@thebibliography\thebibliography \renewcommand{\thebibliography}[1] {\setcounter{heveabib}{0}\chapterbib@thebibliography{#1}} \renewcommand{\bibtag@hook}[1] {\@ifundefined{chapterbib@include@name}{#1}{#1@\thechap@included}} \newcommand{\sectionbib}[2] {\renewcommand{\@bibliosection}[1]{#1{\aname{bib:chap\thechap@included}{##1}}}% \let\maketocbibitem\@sectionbib@maketocbibitem} \DeclareOption{sectionbib}{\sectionbib{\section*}{section}}% \DeclareOption{draft}{}% \DeclareOption{rootbib}{}% \DeclareOption{duplicate}{}% \DeclareOption{gather}{}% \ProcessOptions*