2

I am working on a thesis that has a bibliography per chapter using natbib and bibunits. Some citations appear in different chapters. hyperref appears to always link to the page of the first occurrence of the specific label. How can I make sure that hyperref 'knows' that it should instead link to the specific reference in the chapter-specific bibliography?

A minimum working example that reproduces these errors:

% main.tex
\documentclass{book}
\usepackage[sort&compress,numbers,sectionbib]{natbib}
\usepackage[globalcitecopy]{bibunits}
\usepackage{hyperref}
\bibliographyunit[\chapter]
\defaultbibliographystyle{plain}
\defaultbibliography{bibliography}

\begin{document}
  \include{chapter1}
  \include{chapter2}
\end{document}
% chapter1.tex
\chapter{}
\citep{article}
\putbib
% chapter2.tex
\chapter{}
\citep{article}
\putbib
% bibliography.bib
@article{article,
    author={Dummy},
    title={Dummy},
    year={2021},
    journal={Dummy}
}

1 Answer 1

1

You can change the destination names and make them unique. But you should then also use the bookmark package to avoid problems with the bookmarks.

\documentclass{book}
\usepackage[sort&compress,numbers,sectionbib]{natbib}
\usepackage[globalcitecopy]{bibunits}
\usepackage{bookmark}
\bibliographyunit[\chapter]
\defaultbibliographystyle{plain}
\defaultbibliography{bibliography}

\renewcommand*{\HyperDestNameFilter}[1]{#1-\thechapter}

\begin{document}
  \include{chapter1}
  
  \include{chapter2}
\end{document}
2
  • 1
    You can redefine where you want, also locally. You only need to ensure that the destination names when the destination is created and when it is used in a link match. Commented Oct 11, 2021 at 18:54
  • 1
    I still cannot seem to fix how to have the entries in the table of contents point to the correct page. You state that the destination names when the destination is created and when it is used in a link need to match, but how do you then hyperref to look book-wide for the Table of Contents? For example, just adding \tableofcontents above the chapters in the example generates hyperlinks to the wrong pages in the TOC. Commented Oct 11, 2021 at 19:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .