I'm writing a long document in which I put chapters into separate files and each chapter has a separate bibliography, for which I use chapterbib
and natbib
.
I would like to customise the pagebackref
capability of hyperref
, which I do as shown in this question. This works fine as long as everything is in one file, e.g.,
\documentclass{report}
\usepackage{natbib}
\usepackage[pdftex,backref,pagebackref]{hyperref}
\renewcommand*{\backref}[1]{}
\renewcommand*{\backrefalt}[4]{%
\ifcase #1
(Not cited.)%
\or
(Cited on page~#2.)%
\else
(Cited on pages~#2.)%
\fi}
\bibliographystyle{chicago}
\begin{document}
\chapter{Some stuff}
\cite{jdoe,jdough}
\chapter{Some stuff}
\cite{jdoe}
\bibliography{refs}
\end{document}
However, once I structure my document into separate files, I run into the following problem:
- If I include the customisation of
\backref
and\backrefalt
, the page numbers in the references always come out as "(Not cited.)". - If I comment out the customisation, the page numbers appear correctly.
Here's the MWE:
\documentclass{report}
\usepackage{chapterbib}
\usepackage[sectionbib]{natbib}
\usepackage[pdftex,backref,pagebackref]{hyperref}
\renewcommand*{\backref}[1]{}
\renewcommand*{\backrefalt}[4]{%
\ifcase #1
(Not cited.)%
\or
(Cited on page~#2.)%
\else
(Cited on pages~#2.)%
\fi}
\begin{document}
\include{chap1}
\include{chap2}
\end{document}
with chap1.tex:
\bibliographystyle{chicago}
\chapter{Some stuff}
\cite{jdoe,jdough}
\bibliography{refs}
and chap2.tex:
\bibliographystyle{chicago}
\chapter{Some stuff}
\cite{jdoe}
\bibliography{refs}
Am I doing something wrong? Is this due to an incompatibility or a bug?