Back referencing from bibliographical citations^{∗}

David Carlisle and Sebastian Rahtz

1996/09/29

Contents

1 Introduction 1

2 Usage 1

3 The macros 1

Contents

1 Introduction

2 Usage

3 The macros

1 ⟨∗package⟩

 2 \ProvidesPackage{backref}[\filedate:
 3 bibliographical back referencing, \fileversion]
 4 \long\def\page@backref#1#2#3{#1}
 5 \long\def\section@backref#1#2#3{#2}
 6 \long\def\hyper@section@backref#1#2#3{%
 7 \hyperlink{#3}{#1}%
 8 }
 9 \long\def\hyper@page@backref#1#2#3{%
10 \hyperlink{page.#2}{#2}%

11 }

12 \DeclareOption{pageref}{%
13 \def\backref{pages }%
14 \let\backrefxxx\page@backref

15 }

16 \DeclareOption{ref}{%
17 \def\backref{sections }%
18 \let\backrefxxx\section@backref

19 }

∗This file has version number 1.9, last revised 1996/09/29.

Set up back-referencing to be hyper links, by page or section.

20 \DeclareOption{hyperref}{%
21 \def\backref{}\let\backrefxxx\hyper@section@backref

22 }

23 \DeclareOption{hyperpageref}{%
24 \def\backref{}\let\backrefxxx\hyper@page@backref

25 }

26 \ExecuteOptions{pageref}
27 \ProcessOptions
28 \@ifundefined{newblock}{\def\newblock{\par}}{}
29 \def\xbibitem{\@ifnextchar[{\@xlbibitem}{\@xbibitem}}
30 \def\@xlbibitem[#1]#2#3\par{%
31 \oldb[#1]{#2}#3
32 \newblock
33 \backref{\csname br@#2\endcsname}%
34 \par
35 }%
36 \def\@xbibitem#1#2\par{%
37 \oldb{#1}#2
38 \newblock
39 \backref{\csname br@#1\endcsname}%
40 \par

41 }

42 \def\backcite#1#2{%
43 \@for\x:=#1\do{\expandafter\protected@xdef\csname br@\x\endcsname{%
44 \expandafter\ifx\csname br@\x\endcsname\relax\else
45  \csname br@\x\endcsname, \fi\protect\backrefxxx#2}}}
46 \def\@currentHref{}
47 \AtBeginDocument{%
48 \let\oldb\bibitem
49 \let\bibitem\xbibitem
50 \let\oldbibl\thebibliography
51 \def\thebibliography{\@starttoc{brf}{}\oldbibl}
52 \@ifpackageloaded{natbib}{\typeout{** backref set up for natbib ***}%
53 }{%
54 \global\let\old@citex\@citex
55 \global\let\@citex\x@citex

56 } 57 }

58 \def\x@citex[#1]#2{%
59 \old@citex[#1]{#2}%
60 \Hyper@backout{#2}%

61 }

62 \def\Hyper@backout#1{%
63 \def\@nothing{}%
64 \ifx\@nothing\@currentlabel\else
65 \@bsphack
66 \protected@write\@auxout{}%
67 {\string\@writefile{brf}%
68  {\string\backcite{#1}{{\thepage}{\@currentlabel}{\@currentHref}}}}%
69 \@esphack
70 \fi

71 } 72 ⟨/package⟩