backref with natbib’s compress option

in a latex document where the citations are handled by natbib and where the compress option is active, citations can end up as [1-4]. if the backref option is active, the items in the bibliography will show on which page they are cited. this does not work in the present case though: only references 1 and 4 will show which page they were cited on, 2 and 3 won’t. this can be fixed by changing natbib.sty:

--- natbib.sty.old 2009-07-23 10:44:10.000000000 -0400
+++ natbib.sty  2009-11-01 17:07:53.309765500 -0500
@@ -408,6 +408,7 @@
         \@ifnum{\NAT@nm=\@tempcnta}{%
          \@ifnum{\NAT@merge>\@ne}{}{\NAT@last@yr@mbox}%
         }{%
+           \Hy@backout{\@citeb\@extra@b@citeb}%
           \advance\@tempcnta by\@ne
           \@ifnum{\NAT@nm=\@tempcnta}{%
             \ifx\NAT@last@yr\relax

found on http://tex.stackexchange.com/questions/13653/hyperref-with-the-backref-page-option

Leave a Reply