[texhax] hyperref \backref (and \backrefalt) broken by chapterbib and natbib
Iván Vera
ijvm2004 at gmail.com
Thu Nov 12 13:51:52 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 pdflatex.
When I set 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. Even better, I can get the alternative
interface backrefalt to format the backrefs my own way, like:
...
\renewcommand*{\backref}[1]{}
\renewcommand*{\backrefalt}[4]{%
\ifcase #1 %
% case: not cited
(Not cited).
\or
% case: cited on exactly one page
(Cited on page~#2).%
\else
% case: cited on multiple pages
(Cited on pages~#2).
\fi}
...
So far so good. Now I add the chapterbib package (following all
considerations from the manual and some hours of internet),
...
\usepackage[sectionbib]{chapterbib}
\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 item 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 redundant & 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.
IN CONCLUSION:
1) Global bibliography using hyperref (without chapterbib) gives proper
backrefs (both \backref and \backrefalt). I 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
(backrefs only to current chapter) 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 backrefalt working with the
mix hyperref/chapterbib/natbib. Any workaround would be appreciated.
Regards,
Ivan Vera
PhD researcher at University of Twente, The Netherlands.
PS: I am still kind of newbie with LaTeX, first post on texhax.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20091112/47b6618e/attachment.html>
More information about the texhax
mailing list