# Chapter numbers in bibliography

I am compiling my thesis in LaTeX and I am using the chapterbib package to put separate bibliography lists in each chapter. I would like each bibliography to have its own name, indexed by the chapter number (e.g. "References for Chapter #"), but I am not aware of any way to do this, or if it is doable at all. Has anybody tried it before?

-

## migrated from stackoverflow.comAug 9 '12 at 12:26

This question came from our site for professional and enthusiast programmers.

Welcome to TeX.sx! Your question was migrated here from another stackexchange site. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – Marco Daniel Aug 9 '12 at 12:29

In the documentation you can find:

You can control the titling of the final bibliographies by defining

\newcommand\FinalBibTitles
{References for Chapter \thechapter}


This works only if you use the option gather or duplicate. If you use a standard class like report you have to redefine the standard bibliography environment.

Here a suggestion using xpathch:

% arara: pdflatex
% arara: bibtex: { files :[chap1,chap2] }
% arara: pdflatex
% arara: pdflatex
\RequirePackage{filecontents}
\begin{filecontents*}{chap1.tex}
\chapter{only article}
text \cite{article-minimal}\par
text \cite{article-full}
\bibliographystyle{plain}
\bibliography{xampl}
\end{filecontents*}
\begin{filecontents*}{chap2.tex}
\chapter{only book}
text \cite{book-minimal}\par
text \cite{book-full}
\bibliographystyle{plain}
\bibliography{xampl}
\end{filecontents*}
\documentclass{report}
\usepackage[duplicate]{chapterbib}
\usepackage{xpatch}
\xpatchcmd{\thebibliography}{\bibname}{\bibname{} for Chapter \thechapter}%
{\typeout{*****thebibliography patched******}}
{\typeout{*****thebibliography not patched******}}

\begin{document}
\tableofcontents
\include{chap1}
\include{chap2}
\end{document}


The compilation steps are done by arara which is recommended for such projects.

-
Quicker by 47 seconds! – Ian Thompson Aug 9 '12 at 12:38

Try

\newcommand\FinalBibTitles {References for Chapter \thechapter}


See section 8 of the chapterbib package documentation for details.

-