diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/oberdiek/zref-xr.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/oberdiek/zref-xr.sty | 263 |
1 files changed, 181 insertions, 82 deletions
diff --git a/Master/texmf-dist/tex/latex/oberdiek/zref-xr.sty b/Master/texmf-dist/tex/latex/oberdiek/zref-xr.sty index 1fde34c1017..946ba4b5a4a 100644 --- a/Master/texmf-dist/tex/latex/oberdiek/zref-xr.sty +++ b/Master/texmf-dist/tex/latex/oberdiek/zref-xr.sty @@ -35,21 +35,46 @@ %% zref-totpages.sty, zref-user.sty, zref-xr.sty, %% zref-example.tex, zref-example-lastpage.tex, %% zref-example-nextpage.tex, zref-test1.tex, -%% zref-test-runs.tex. +%% zref-test-runs.tex, zref-test-titleref-memoir.tex. %% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-xr}% - [2010/04/08 v2.10 Module xr for zref (HO)]% -\RequirePackage{zref-base}[2010/04/08] + [2010/04/17 v2.12 Module xr for zref (HO)]% +\RequirePackage{zref-base}[2010/04/17] \@ifundefined{ZREF@baseok}{\endinput}{} \RequirePackage{keyval} +\RequirePackage{kvoptions}[2010/02/22] \zref@newprop{url}{}% \zref@newprop{externaldocument}{}% \providecommand*{\zref@xr@ext}{% \ltx@ifundefined{XR@ext}{pdf}{\XR@ext}% }% \newif\ifZREF@xr@zreflabel +\SetupKeyvalOptions{% + family=ZREF@XR,% + prefix=ZREF@xr@% +} +\DeclareBoolOption[true]{tozreflabel} +\DeclareBoolOption[false]{toltxlabel} +\DeclareBoolOption{verbose} +\define@key{ZREF@XR}{ext}{% + \def\zref@xr@{#1}% +} +\newcommand*{\zxrsetup}{% + \setkeys{ZREF@XR}% +}% \newcommand*{\zexternaldocument}{% + \zref@ifpropundefined{title}{% + \zref@newprop{title}{}% + }{}% + \zref@ifpropundefined{anchor}{% + \zref@newprop{anchor}{% + \ltx@ifundefined{@currentHref}{}{\@currentHref}% + }% + }{}% + \zref@ifpropundefined{url}{% + \zref@newprop{url}{}% + }{}% \begingroup \csname @safe@actives@true\endcsname \makeatletter @@ -86,15 +111,30 @@ Label \ifZREF@xr@zreflabel (zref) \fi import from `\ZREF@xr@file'% }% \def\ZREF@xr@found{0}% - \def\ZREF@xr@ignored{0}% + \def\ZREF@xr@ignored@empty{0}% + \def\ZREF@xr@ignored@zref{0}% + \def\ZREF@xr@ignored@ltx{0}% \ZREF@xr@processfile \closein\@inputcheck \begingroup \let\on@line\@empty \PackageInfo{zref-xr}{% - Statistics for `\ZREF@xr@file': % - \ZREF@xr@found\space found, % - \ZREF@xr@ignored\space ignored% + Statistics for `\ZREF@xr@file':\MessageBreak + \ZREF@xr@found\space + \ifZREF@xr@zreflabel zref\else LaTeX\fi\space + label(s) found% + \ifnum\ZREF@xr@ignored@empty>0 % + ,\MessageBreak + \ZREF@xr@ignored@empty\space empty label(s) ignored% + \fi + \ifnum\ZREF@xr@ignored@zref>0 % + ,\MessageBreak + \ZREF@xr@ignored@zref\space doublicated zref label(s) ignored% + \fi + \ifnum\ZREF@xr@ignored@ltx>0 % + ,\MessageBreak + \ZREF@xr@ignored@ltx\space doublicated latex label(s) ignored% + \fi }% \endgroup \fi @@ -110,7 +150,7 @@ \expandafter\ZREF@xr@processline\ZREF@xr@line..\ZREF@nil \ifeof\@inputcheck \else - \expandafter\ZREF@xr@procesfile + \expandafter\ZREF@xr@processfile \fi }% \long\def\ZREF@xr@processline#1#2#3\ZREF@nil{% @@ -131,76 +171,146 @@ {\filename@area\the\toks@}% }% \fi - \ifeof\@inputcheck - \else - \expandafter\ZREF@xr@processfile - \fi }% \def\ZREF@xr@process@zreflabel\zref@newlabel#1#2#3\ZREF@nil{% - \def\ZREF@xr@refname{Z@R@\ZREF@xr@prefix#1}% + \edef\ZREF@xr@refname{Z@R@\ZREF@xr@prefix#1}% \edef\ZREF@xr@found{\the\numexpr\ZREF@xr@found+1\relax}% \def\x{#2}% - \@ifundefined{\ZREF@xr@refname}{% - \let\ZREF@xr@list\x - \ifx\ZREF@xr@list\@empty - \PackageWarningNoLine{zref-xr}{% - Label `#1' without properties ignored\MessageBreak - in file `\ZREF@xr@file'% + \edef\ZREF@xr@tempname{$temp$}% + \edef\ZREF@xr@temprefname{Z@R@\ZREF@xr@tempname}% + \let\ZREF@xr@list\x + \ifx\ZREF@xr@list\@empty + \PackageWarningNoLine{zref-xr}{% + Label `#1' without properties ignored\MessageBreak + in file `\ZREF@xr@file'% + }% + \edef\ZREF@xr@ignored@empty{% + \the\numexpr\ZREF@xr@ignored@empty+1\relax + }% + \else + \expandafter\ZREF@xr@checklist\x\ZREF@nil + \expandafter\let\csname\ZREF@xr@temprefname\endcsname\x + \expandafter\ltx@LocalAppendToMacro + \csname\ZREF@xr@temprefname\expandafter\endcsname + \expandafter{% + \expandafter\externaldocument\expandafter{% + \ZREF@xr@externalfile }% - \edef\ZREF@xr@ignored{\the\numexpr\ZREF@xr@ignored+1\relax}% - \else - \expandafter\ZREF@xr@checklist\x\ZREF@nil - \expandafter\global\expandafter\let - \csname \ZREF@xr@refname\endcsname\x - \expandafter\g@addto@macro - \csname\ZREF@xr@refname\expandafter\endcsname\expandafter{% - \expandafter\externaldocument\expandafter{% - \ZREF@xr@externalfile - }% + }% + \ZREF@xr@urlcheck\ZREF@xr@tempname + \ifZREF@xr@tozreflabel + \@ifundefined{\ZREF@xr@refname}{% + \ifZREF@xr@verbose + \PackageInfo{zref-xr}{% + Import to zref label `\ZREF@xr@tempname#1'% + }% + \fi + \global\expandafter + \let\csname\ZREF@xr@refname\expandafter\endcsname + \csname\ZREF@xr@temprefname\endcsname + }{% + \ZREF@xr@zref@ignorewarning{\ZREF@xr@prefix#1}% }% \fi - \ZREF@xr@urlcheck{\ZREF@xr@prefix#1}% - }{% - \ZREF@xr@ignorewarning{\ZREF@xr@prefix#1}% - }% + \ifZREF@xr@toltxlabel + \ZREF@xr@tolabel{\ZREF@xr@tempname}{\ZREF@xr@prefix#1}% + \fi + \fi }% \def\ZREF@xr@process@label\newlabel#1#2#3[#4]#5\ZREF@nil{% \def\ZREF@xr@refname{Z@R@\ZREF@xr@prefix#1}% \edef\ZREF@xr@found{\the\numexpr\ZREF@xr@found+1\relax}% \def\x{#2}% - \@ifundefined{\ZREF@xr@refname}{% - \expandafter\ZREF@xr@scanparams - \csname\ZREF@xr@refname\expandafter\endcsname - \x{}{}{}{}{}\ZREF@nil - \ifx\\#4\\% - \else - % ntheorem knows an optional argument at the end of \newlabel - \zref@ifpropundefined{theotype}{% - \zref@newprop{theotype}{}% - }{}% - \expandafter\g@addto@macro - \csname\ZREF@xr@refname\endcsname{\theotype{#4}}% - \fi - \expandafter\g@addto@macro - \csname\ZREF@xr@refname\expandafter\endcsname\expandafter{% - \expandafter\externaldocument\expandafter{% - \ZREF@xr@externalfile - }% + \edef\ZREF@xr@tempname{$temp$}% + \edef\ZREF@xr@temprefname{Z@R@\ZREF@xr@tempname}% + \expandafter\ZREF@xr@scanparams + \csname\ZREF@xr@temprefname\expandafter\endcsname + \x{}{}{}{}{}\ZREF@nil + \ifx\\#4\\% + \else + % ntheorem knows an optional argument at the end of \newlabel + \zref@ifpropundefined{theotype}{% + \zref@newprop{theotype}{}% + }{}% + \expandafter\ltx@LocalAppendToMacro + \csname\ZREF@xr@temprefname\endcsname{\theotype{#4}}% + \fi + \expandafter\ltx@LocalAppendToMacro + \csname\ZREF@xr@temprefname\expandafter\endcsname\expandafter{% + \expandafter\externaldocument\expandafter{% + \ZREF@xr@externalfile }% - \ZREF@xr@urlcheck{\ZREF@xr@prefix#1}% - }{% - \ZREF@xr@ignorewarning{\ZREF@xr@prefix#1}% }% + \ZREF@xr@urlcheck{\ZREF@xr@prefix#1}% + \ifZREF@xr@tozreflabel + \@ifundefined{\ZREF@xr@refname}{% + \ifZREF@xr@verbose + \PackageInfo{zref-xr}{% + Import to zref label `\ZREF@xr@prefix#1'% + }% + \fi + \global\expandafter + \let\csname\ZREF@xr@refname\expandafter\endcsname + \csname\ZREF@xr@temprefname\endcsname + }{% + \ZREF@xr@zref@ignorewarning{\ZREF@xr@prefix#1}% + }% + \fi + \ifZREF@xr@toltxlabel + \ZREF@xr@tolabel{\ZREF@xr@tempname}{\ZREF@xr@prefix#1}% + \fi } \def\ZREF@xr@zref@newlabel{\zref@newlabel}% \def\ZREF@xr@newlabel{\newlabel}% \def\ZREF@xr@@input{\@input}% -\def\ZREF@xr@ignorewarning#1{% +\def\ZREF@xr@relax{\relax}% +\def\ZREF@xr@tolabel#1#2{% + \ifZREF@xr@verbose + \PackageInfo{zref-xr}{% + Import to LaTeX label `#2'% + }% + \fi + \expandafter\xdef\csname r@#2\endcsname{% + {% + \ltx@ifundefined{M@TitleReference}{% + \ltx@ifundefined{TR@TitleReference}{% + \zref@extractdefault{#1}{default}{}% + }{% + \noexpand\TR@TitleReference + {\zref@extractdefault{#1}{default}{}}% + {\zref@extractdefault{#1}{title}{}}% + }% + }{% + \noexpand\M@TitleReference + {\zref@extractdefault{#1}{default}{}}% + {\zref@extractdefault{#1}{title}{}}% + }% + }% + {\zref@extractdefault{#1}{page}{}}% + \ltx@ifpackageloaded{nameref}{% + {\zref@extractdefault{#1}{title}{}}% + {\zref@extractdefault{#1}{anchor}{}}% + {\zref@extractdefault{#1}{url}{}}% + }{}% + }% +} +\def\ZREF@xr@zref@ignorewarning#1{% + \PackageWarningNoLine{zref-xr}{% + Zref label `#1' is already in use\MessageBreak + in file `\ZREF@xr@file'% + }% + \edef\ZREF@xr@ignored@empty{% + \the\numexpr\ZREF@xr@ignored+1% + }% +}% +\def\ZREF@xr@ltx@ignorewarning#1{% \PackageWarningNoLine{zref-xr}{% - Label `#1' is already in use\MessageBreak + LaTeX label `#1' is already in use\MessageBreak in file `\ZREF@xr@file'% }% - \edef\ZREF@xr@ignored{\the\numexpr\ZREF@xr@ignored+1\relax}% + \edef\ZREF@xr@ignored@ltx{% + \the\numexpr\ZREF@xr@ignored@ltx+1% + }% }% \def\ZREF@xr@checklist#1#2#3\ZREF@nil{% \ifx\@undefined#1\relax @@ -208,58 +318,52 @@ \fi \ifx\\#3\\% \else - \@ReturnAfterFi{% + \ltx@ReturnAfterFi{% \ZREF@xr@checklist#3\ZREF@nil }% \fi }% -\long\def\@ReturnAfterFi#1\fi{\fi#1}% \def\ZREF@xr@checkkey#1#2\@nil{% \zref@ifpropundefined{#2}{% \zref@newprop{#2}{}% }{}% }% \def\ZREF@xr@scanparams#1#2#3#4#5#6#7\ZREF@nil{% - \global\let#1\@empty + \let#1\@empty \ZREF@foundfalse \ZREF@xr@scantitleref#1#2\TR@TitleReference{}{}\ZREF@nil \ifZREF@found \else - \g@addto@macro#1{\default{#2}}% + \ltx@LocalAppendToMacro#1{\default{#2}}% \fi % page - \g@addto@macro#1{\page{#3}}% + \ltx@LocalAppendToMacro#1{\page{#3}}% % nameref title \ifZREF@found \else \ifx\\#4\\% \else - \zref@ifpropundefined{title}{% - \zref@newprop{title}{}% - }{}% - \g@addto@macro#1{\title{#4}}% + \def\ZREF@xr@temp{#4}% + \ifx\ZREF@xr@temp\ZREF@xr@relax + \else + \ltx@LocalAppendToMacro#1{\title{#4}}% + \fi \fi \fi % anchor \ifx\\#5\\% \else - \zref@ifpropundefined{anchor}{% - \zref@newprop{anchor}{}% - }{}% - \g@addto@macro#1{\anchor{#5}}% + \ltx@LocalAppendToMacro#1{\anchor{#5}}% \fi \ifx\\#6\\% \else - \zref@ifpropundefined{url}{% - \zref@newprop{url}{}% - }{}% - \g@addto@macro#1{\url{#6}}% + \ltx@LocalAppendToMacro#1{\url{#6}}% \fi }% \def\ZREF@xr@scantitleref#1#2\TR@TitleReference#3#4#5\ZREF@nil{% \ifx\\#5\\% \else - \g@addto@macro#1{% + \ltx@LocalAppendToMacro#1{% \default{#3}% \title{#4}% }% @@ -270,7 +374,8 @@ \zref@ifrefcontainsprop{#1}{anchor}{% \zref@ifrefcontainsprop{#1}{url}{% }{% - \expandafter\g@addto@macro\csname Z@R@#1\expandafter\endcsname + \expandafter + \ltx@LocalAppendToMacro\csname Z@R@#1\expandafter\endcsname \expandafter{% \expandafter\url\expandafter{\ZREF@xr@url}% }% @@ -278,12 +383,6 @@ }{% }% }% -\define@key{ZREF@XR}{ext}{% - \def\zref@xr@ext{#1}% -}% -\newcommand*{\zxrsetup}{% - \setkeys{ZREF@XR}% -}% \endinput %% %% End of file `zref-xr.sty'. |