diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/hyperref/backref.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/hyperref/backref.sty | 137 |
1 files changed, 107 insertions, 30 deletions
diff --git a/Master/texmf-dist/tex/latex/hyperref/backref.sty b/Master/texmf-dist/tex/latex/hyperref/backref.sty index a426e60d2b6..3e5ae0f7c20 100644 --- a/Master/texmf-dist/tex/latex/hyperref/backref.sty +++ b/Master/texmf-dist/tex/latex/hyperref/backref.sty @@ -21,7 +21,7 @@ %% given in the file `manifest.txt'. \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{backref} - [2010/01/09 v1.32 Bibliographical back referencing]% + [2010/01/16 v1.33 Bibliographical back referencing]% \newif\ifBR@verbose \@ifundefined{ifHy@verbose}{% \BR@verbosefalse @@ -143,6 +143,7 @@ \ProcessOptions*\relax \newif\ifbackrefparscan \backrefparscantrue +\newif\ifBR@BackrefAlt \def\BR@bibitem{% \ifbackrefparscan \expandafter\@ifnextchar\expandafter[\expandafter @@ -185,16 +186,31 @@ \expandafter\providecommand\csname brc@#1\endcsname{0}% \expandafter\providecommand\csname brcd@#1\endcsname{0}% \csname @safe@activesfalse\expandafter\endcsname - \expandafter\backref\csname br@#1\expandafter\endcsname - \expandafter\backrefalt\csname brc@#1\expandafter\endcsname - \csname brl@#1\expandafter\endcsname - \csname brcd@#1\expandafter\endcsname - \csname brld@#1\endcsname + \ifBR@BackrefAlt + \ifx\backrefentrycount\BR@BackrefEntryCountUnused + \else + \BR@PopulateEntryCount{#1}% + \fi + \expandafter\backrefalt\csname brc@#1\expandafter\endcsname + \csname brl@#1\expandafter\endcsname + \csname brcd@#1\expandafter\endcsname + \csname brld@#1\endcsname + \else + \expandafter\backref\csname br@#1\expandafter\endcsname + \fi \endgroup \par } \@ifundefined{newblock}{\def\newblock{\par}}{} -\providecommand*{\backrefalt}[4]{} +\let\BR@Unused\@empty +\def\BR@BackrefAltUnused#1#2#3#4{\BR@Unused} +\@ifundefined{backrefalt}{% + \let\backrefalt\BR@BackrefAltUnused +}{} +\def\BR@BackrefEntryCountUnused#1#2{\BR@Unused#1} +\@ifundefined{backrefentrycount}{% + \let\backrefentrycount\BR@BackrefEntryCountUnused +}{} \def\backcite#1#2{% \@for\x:=#1\do{% \begingroup @@ -207,12 +223,14 @@ \expandafter\protected@xdef\csname br@\x\endcsname{% \protect\backrefxxx#2% }% - \global\expandafter\let\csname brl@\x\expandafter\endcsname - \csname br@\x\endcsname - \global\expandafter\let\csname brld@\x\expandafter\endcsname - \csname br@\x\endcsname - \expandafter\gdef\csname brc@\x\endcsname{1}% - \expandafter\gdef\csname brcd@\x\endcsname{1}% + \ifBR@BackrefAlt + \global\expandafter\let\csname brl@\x\expandafter\endcsname + \csname br@\x\endcsname + \global\expandafter\let\csname brld@\x\expandafter\endcsname + \csname br@\x\endcsname + \expandafter\gdef\csname brc@\x\endcsname{1}% + \expandafter\gdef\csname brcd@\x\endcsname{1}% + \fi \else \begingroup \@ifundefined{backrefxxxdupe}{}{\let\backrefxxx\backrefxxxdupe}% @@ -239,34 +257,88 @@ \csname br@\x\endcsname, % \protect\backrefxxx#2% }% - \expandafter\protected@xdef\csname brl@\x\endcsname{% - \csname brl@\x\endcsname - \ifnum\@nameuse{brc@\x}=1 % + \ifBR@BackrefAlt + \expandafter\protected@xdef\csname brl@\x\endcsname{% + \csname brl@\x\endcsname + \ifnum\@nameuse{brc@\x}=1 % + \noexpand\backreftwosep + \else + \noexpand\backreflastsep + \fi + \protect\backrefxxx#2% + }% + \count@=\@nameuse{brc@\x}\relax + \advance\count@ by 1 % + \expandafter\xdef\csname brc@\x\endcsname{\the\count@}% + \fi + \fi + \ifBR@BackrefAlt + \expandafter\protected@xdef\csname brld@\x\endcsname{% + \csname brld@\x\endcsname + \ifnum\@nameuse{brcd@\x}=1 % \noexpand\backreftwosep \else \noexpand\backreflastsep \fi \protect\backrefxxx#2% }% - \count@=\@nameuse{brc@\x}\relax + \count@=\@nameuse{brcd@\x}\relax \advance\count@ by 1 % - \expandafter\xdef\csname brc@\x\endcsname{\the\count@}% + \expandafter\xdef\csname brcd@\x\endcsname{\the\count@}% \fi - \expandafter\protected@xdef\csname brld@\x\endcsname{% - \csname brld@\x\endcsname - \ifnum\@nameuse{brcd@\x}=1 % - \noexpand\backreftwosep - \else - \noexpand\backreflastsep - \fi - \protect\backrefxxx#2% - }% - \count@=\@nameuse{brcd@\x}\relax - \advance\count@ by 1 % - \expandafter\xdef\csname brcd@\x\endcsname{\the\count@}% \fi }% } +\def\BR@PopulateEntryCount#1{% + \begingroup + \toks@{}% + \def\backrefsep{% + \toks@\expandafter{\the\toks@\backrefsep}% + }% + \def\backreftwosep{% + \toks@\expandafter{\the\toks@\backreftwosep}% + }% + \def\backreflastsep{% + \toks@\expandafter{\the\toks@\backreflastsep}% + }% + \def\protect{}% + \let\BR@backrefxxx\backrefxxx + \let\backrefxxx\BR@PopulateBackrefxxx + \def\BR@name{#1}% + \csname brl@#1\endcsname + \expandafter\xdef\csname brl@#1\endcsname{\the\toks@}% + \endgroup +} +\def\BR@PopulateBackrefxxx#1#2#3{% + \expandafter\def\expandafter\BR@tempa\expandafter{% + \BR@backrefxxx{#1}{#2}{#3}% + }% + \begingroup + \count@=\z@ + \def\backrefsep{}% + \def\backreftwosep{}% + \def\backreflastsep{}% + \let\backrefxxx\BR@@PopulateBackrefxxx + \csname brld@\BR@name\endcsname + \toks\tw@={\backrefxxx{#1}{#2}{#3}}% + \edef\x{\endgroup + \toks@{% + \the\toks@ + \noexpand\backrefentrycount{% + \the\toks\tw@ + }{\the\count@}% + }% + }% + \x +} +\def\BR@@PopulateBackrefxxx#1#2#3{% + \expandafter\def\expandafter\BR@tempb\expandafter{% + \BR@backrefxxx{#1}{#2}{#3}% + }% + \ifx\BR@tempa\BR@tempb + \advance\count@\@ne + \fi +} \def\@currentHref{} \AtBeginDocument{% \let\BRorg@bibitem\bibitem @@ -287,6 +359,11 @@ }% } \def\BR@starttoc{% + \ifx\backrefalt\BR@BackrefAltUnused + \global\BR@BackrefAltfalse + \else + \global\BR@BackrefAlttrue + \fi \begingroup \makeatletter \@input{\jobname.brf}% |