Back referencing from bibliographical citations^{∗}

David Carlisle and Sebastian Rahtz

1998/07/06

Contents

Contents

1 Introduction

2 Usage

3 The macros

1 ⟨∗package⟩

2 \ProvidesPackage{backref}[\filedate:
3 bibliographical back referencing, \fileversion]

What is printed depends on how the 3 available items of information are used (page number, section number, label).

4

5 \long\def\page@backref#1#2#3{#1}
6 \long\def\section@backref#1#2#3{#2}
7 \long\def\hyper@section@backref#1#2#3{\hyperlink{#3}{#2}}
8 \long\def\hyper@page@backref#1#2#3{\hyperlink{page.#1}{#1}}
9 \DeclareOption{pageref}{%
10 \def\backref{pages }%
11 \let\backrefxxx\page@backref

12 }

13 \DeclareOption{ref}{%
14 \def\backref{sections }%
15 \let\backrefxxx\section@backref

16 }

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

17 \DeclareOption{hyperref}{%

∗This file has version number 1.13, last revised 1998/07/06.

18 \def\backref{}\let\backrefxxx\hyper@section@backref

19 }

20 \DeclareOption{hyperpageref}{%
21 \def\backref{}\let\backrefxxx\hyper@page@backref

22 }

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

38 }

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

55 }

56 \def\x@citex[#1]#2{%
57 \old@citex[#1]{#2}%
58 \hy@backout{#2}%

59 }

60 \def\hy@backout#1{%
61 \@bsphack
62 \ifx\@empty\@currentlabel
63  \protected@write\@auxout{}%
64  {\string\@writefile{brf}%
65  {\string\backcite{#1}{{\thepage}{(document)}{Doc-Start}}}}%
66 \else
67 \protected@write\@auxout{}%

68 {\string\@writefile{brf}%
69  {\string\backcite{#1}{{\thepage}{\@currentlabel}{\@currentHref}}}}%
70 \fi
71 \@esphack

72 } 73 ⟨/package⟩