summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/index/bibref.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/index/bibref.sty
Initial commit
Diffstat (limited to 'macros/latex/contrib/index/bibref.sty')
-rw-r--r--macros/latex/contrib/index/bibref.sty117
1 files changed, 117 insertions, 0 deletions
diff --git a/macros/latex/contrib/index/bibref.sty b/macros/latex/contrib/index/bibref.sty
new file mode 100644
index 0000000000..62b985b18f
--- /dev/null
+++ b/macros/latex/contrib/index/bibref.sty
@@ -0,0 +1,117 @@
+%%% ====================================================================
+%%% @LaTeX-style-file{
+%%% filename = "bibref.sty",
+%%% version = "1.0beta",
+%%% date = "29 September 1995",
+%%% time = "14:36:27 EDT",
+%%% author = "David M. Jones",
+%%% address = "MIT Laboratory for Computer Science
+%%% Room NE43-316
+%%% 545 Technology Square
+%%% Cambridge, MA 02139
+%%% USA",
+%%% telephone = "(617) 253-5936",
+%%% FAX = "(617) 253-3480",
+%%% checksum = "21394 117 377 3498",
+%%% email = "dmjones@theory.lcs.mit.edu",
+%%% codetable = "ISO/ASCII",
+%%% keywords = "",
+%%% supported = "yes",
+%%% abstract = "",
+%%% docstring = "The checksum field above contains a CRC-16
+%%% checksum as the first value, followed by the
+%%% equivalent of the standard UNIX wc (word
+%%% count) utility output of lines, words, and
+%%% characters. This is produced by Robert
+%%% Solovay's checksum utility.",
+%%% }
+%%% ====================================================================
+
+%% This is an experimental package to support back references from
+%% reference sections to the pages where individual items are cited.
+%% I.e., the reference section would
+%%
+%% Zofia Adamowicz. A sharp version of the bounded
+%% {Matijasevich} conjecture and the end-extension problem.
+%% Journal of Symbolic Logic}, 57(2):597--616, June 1992. (pages
+%% 1, 3-5, 54)
+%%
+%% if that item were cited on pages 1, 3, 4, 5 and 54.
+%%
+%% To use this feature, you'll need to make a small change to your
+%% BibTeX bibliography style file. In the standard styles, all that
+%% is needed is to modify the function fin.entry as follows:
+%%
+%% FUNCTION {fin.entry}
+%% { add.period$
+%% write$
+%% "\bibref{" cite$ "}" * * write$ % added line
+%% newline$
+%% }
+%%
+%% Then load the bibref package by adding
+%%
+%% \usepackage{bibref}
+%%
+%% to your document preamble, and run LaTeX as normal. After running
+%% LaTeX, invoke makeindex as follows:
+%%
+%% makeindex -s bibref.ist -o <jobname>.bnd <jobname>.bdx
+%%
+%% The next time you run LaTeX, the back-references should magically
+%% appear.
+%%
+%% See plaintst.tex and xplain.bst for an example.
+
+\RequirePackage{index}
+
+\newindex{@bib}{bdx}{bnd}{}
+
+\newcommand{\biblabel}[2]{%
+ \global\@namedef{br@#1}{#2}%
+}
+
+\newcommand{\bibref}[1]{%
+ \unskip\space
+ \@ifundefined{br@#1}{%
+% (\textbf{??})%
+ }{%
+ \edef\reserved@a{\@nameuse{br@#1}}%
+ \afterassignment\@bibref\count@\reserved@a\relax\@nil
+ }%
+}
+
+\def\@bibref#1\@nil{%
+ \if\relax#1%
+ (page~\reserved@a)%
+ \else
+ (pages~\reserved@a)%
+ \fi
+}
+
+\let\@@cite\cite
+
+\renewcommand{\cite}[2][]{%
+ \@for\@citea:=#2\do{%
+ \edef\reserved@a{%
+ \noexpand\index[@bib]{\@citea}%
+ }%
+ \reserved@a
+ }%
+ \def\reserved@a{#1}%
+ \ifx\reserved@a\@empty
+ \@@cite{#2}%
+ \else
+ \@@cite[#1]{#2}%
+ \fi
+}
+
+\renewcommand{\bibliography}[1]{%
+ \if@filesw
+ \immediate\write\@auxout{\string\bibdata{#1}}%
+ \fi
+ \@input@{\jobname.bnd}%
+ \@input@{\jobname.bbl}%
+}
+
+\endinput