[texhax] hyperref \backref (and \backrefalt) broken by chapterbib and natbib

Iván Vera ijvm at hotmail.com
Tue Nov 10 17:35:20 CET 2009

Dear all,

I am using LaTeX to write my PhD thesis since about 3 months now. The mix natbib/chapterbib/hyperref has worked fine. But I report here a problem with back references (backref package of hyperref bundle), i.e. the pointers at the end of each bibliography item that point to the page where that item was referenced. I also use bibtex and pdftex (all hyperlinked of course).

When I set my source for a global bibliography at the end of the document everything works fine. The default pagebackref option of hyperref adds the list of pages where each item was referenced, only within each chapter. Even better, I can get the alternative interface backrefalt to format the backrefs my own way, like:
    \ifcase #1 %
        % case: not cited
        (Not cited).
        % case: cited on exactly one page
        (Cited on page~#2).%
        % case: cited on multiple pages
        (Cited on pages~#2).
So far so good. Now I add the chapterbib package (following all considerations from the manual and some hours of internet),
    \usepackage[english, dutch]{babel} % load after chapterbib
And ALMOST everything works fine. Nice bibliographies per chapter, hyperlinks from main text to references work.
BUT the problem is with the behavior of the backrefs, because they not only point to the reference within the corresponding chapter, but they also point to occurrences of the same item in OTHER chapters. Same behavior with the default\backref or with the alternative \backrefalt interfaces. This is confusing, since if one clicks in this backref one ends up in a page in another chapter where that item has a different numbering (when using numbered bibtex style). At least there should be an option to choose if backreferencing to the same bibitem in another chapter is allowed or not.
I must mention I use the same .bib library for all chapters. A possible way out would be to use different keys in different .bib for each chapter, but I really don't want that option (>100 bibitems per chapter, and my keys are automatically generated by Zotero).

Ok, say one can live with this redundancy of inconsistent backref links. Now we add natbib, to get some sorting of reference numbers,
    \usepackage[square,comma,numbers,sort,sectionbib]{natbib} % if 'sort&compress' check backrefs
    \usepackage{chapterbib} % give sectionbib option to natbib package
    \usepackage[english, dutch]{babel} % load after chapterbib
And voila! the backrefs pointing outside the current chapter for each bibitem are gone, BUT it works ONLY for the standard \backref interface.
The moment I introduce the code for the alternative interface \backrefalt I ALWAYS get the text "(Not cited)." at the end of my references, i.e. the code of \backrefalt is broken. After playing with printing its 4 parameters I see they are either 0 or non-existent.

1) Global bibliography using hyperref (without chapterbib) gives proper backrefs (both \backref and \backrefalt). I also tried including natbib and it also works fine.
2) Bibliographies per chapter using hyperref/chapterbib (without natbib) gives backrefs (both \backref and \backrefalt) that can point outside current chapter. Not desired but I can live with it.
3) Bibliographies per chapter using hyperref/chapterbib/natbib works perfect only with standard \backref interface.
4) Bibliographies per chapter using hyperref/chapterbib/natbib break the functionality of the alternative \backrefalt interface.

So I proceed with my thesis using option 3) of course. I just wonder whom of the developers to address to get the customized backrefs working with the mix hyperref/chapterbib/natbib. Any workaround would be appreciated.


Ivan Vera
PhD researcher (for not too long) at University of Twente, The Netherlands.

PS: I am still kind of newbie with LaTeX, first post on TUG. Sorry if this post makes your life difficult.

Windows Live Hotmail: Your friends can get your Facebook updates, right from Hotmail®.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20091110/eae46f80/attachment-0001.html>

More information about the texhax mailing list