summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/oberdiek/zref-xr.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/oberdiek/zref-xr.sty')
-rw-r--r--Master/texmf-dist/tex/latex/oberdiek/zref-xr.sty164
1 files changed, 119 insertions, 45 deletions
diff --git a/Master/texmf-dist/tex/latex/oberdiek/zref-xr.sty b/Master/texmf-dist/tex/latex/oberdiek/zref-xr.sty
index 8d8d3a6c407..468ae836c32 100644
--- a/Master/texmf-dist/tex/latex/oberdiek/zref-xr.sty
+++ b/Master/texmf-dist/tex/latex/oberdiek/zref-xr.sty
@@ -28,9 +28,10 @@
%% This work consists of the main source file zref.dtx
%% and the derived files
%% zref.sty, zref.pdf, zref.ins, zref.drv, zref-base.sty,
-%% zref-abspage.sty, zref-counter.sty, zref-dotfill.sty,
-%% zref-hyperref.sty, zref-lastpage.sty, zref-marks.sty,
-%% zref-nextpage.sty, zref-perpage.sty, zref-runs.sty,
+%% zref-abspage.sty, zref-abspos.sty, zref-counter.sty,
+%% zref-dotfill.sty, zref-hyperref.sty, zref-lastpage.sty,
+%% zref-marks.sty, zref-nextpage.sty, zref-pageattr.sty,
+%% zref-pagelayout.sty, zref-perpage.sty, zref-runs.sty,
%% zref-savepos.sty, zref-thepage.sty, zref-titleref.sty,
%% zref-totpages.sty, zref-user.sty, zref-xr.sty,
%% zref-example.tex, zref-example-lastpage.tex,
@@ -40,13 +41,37 @@
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zref-xr}%
- [2010/04/23 v2.15 Module xr for zref (HO)]%
-\RequirePackage{zref-base}[2010/04/23]
-\@ifundefined{ZREF@baseok}{\endinput}{}
+ [2010/05/01 v2.17 Module xr for zref (HO)]%
+\RequirePackage{zref-base}[2010/05/01]
+\ifx\ZREF@base@ok Y%
+\else
+ \expandafter\endinput
+\fi
\RequirePackage{keyval}
\RequirePackage{kvoptions}[2010/02/22]
\zref@newprop{url}{}%
+\zref@newprop{urluse}{}%
\zref@newprop{externaldocument}{}%
+\def\ZREF@xr@NewPropAnchor{%
+ \ltx@ifpackageloaded{zref-hyper}{%
+ }{%
+ \zref@newprop{anchor}{%
+ \ltx@ifundefined{@currentHref}{}{\@currentHref}%
+ }%
+ }%
+ \global\let\ZREF@xr@NewPropAnchor\relax
+}
+\def\ZREF@xr@NewPropTitle{%
+ \ltx@ifpackageloaded{zref-title}{%
+ }{%
+ \zref@newprop{title}{}%
+ }%
+ \global\let\ZREF@xr@NewPropTitle\relax
+}
+\def\ZREF@xr@NewPropTheotype{%
+ \zref@newprop{theotype}{}%
+ \global\let\ZREF@xr@NewPropTheotype
+}
\providecommand*{\zref@xr@ext}{%
\ltx@ifundefined{XR@ext}{pdf}{\XR@ext}%
}%
@@ -61,35 +86,57 @@
\define@key{ZREF@XR}{ext}{%
\def\zref@xr@{#1}%
}
+\DeclareBoolOption[false]{urluse}
\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}{}%
- }{}%
+\newcount\ZREF@xr@URL
+\ZREF@xr@URL=\ltx@zero
+\def\ZREF@xr@AddURL#1{%
\begingroup
- \csname @safe@actives@true\endcsname
- \makeatletter
- \@ifstar{%
- \ZREF@xr@zreflabelfalse
- \@testopt\ZREF@xr@externaldocument{}%
- }{%
- \ZREF@xr@zreflabeltrue
- \@testopt\ZREF@xr@externaldocument{}%
+ \def\ZREF@temp{#1}%
+ \count@=\ltx@one
+ \ZREF@xr@@AddUrl
+ \endgroup
+}
+\def\ZREF@xr@@AddUrl{%
+ \ifnum\count@>\ZREF@xr@URL
+ \global\advance\ZREF@xr@URL by\ltx@one
+ \xdef\ZREF@xr@theURL{\romannumeral\ZREF@xr@URL}%
+ \global\expandafter\let
+ \csname Z@U@\ZREF@xr@theURL\endcsname\ZREF@temp
+ \@PackageInfo{zref-xr}{%
+ \ltx@backslashchar Z@U@\ZREF@xr@theURL:\MessageBreak
+ \ZREF@temp\MessageBreak
}%
+ \else
+ \expandafter
+ \ifx\csname Z@U@\romannumeral\count@\endcsname\ZREF@temp
+ \xdef\ZREF@xr@theURL{\romannumeral\count@}%
+ \else
+ \expandafter\expandafter\expandafter\ZREF@xr@@AddUrl
+ \fi
+ \fi
+}
+\ZREF@IfDefinable\zexternaldocument\def{%
+ {%
+ \ZREF@xr@NewPropAnchor
+ \ZREF@xr@NewPropTitle
+ \begingroup
+ \csname @safe@actives@true\endcsname
+ \makeatletter
+ \@ifstar{%
+ \ZREF@xr@zreflabelfalse
+ \@testopt\ZREF@xr@externaldocument{}%
+ }{%
+ \ZREF@xr@zreflabeltrue
+ \@testopt\ZREF@xr@externaldocument{}%
+ }%
+ }%
}%
\def\ZREF@xr@externaldocument[#1]#2{%
\def\ZREF@xr@prefix{#1}%
- \let\ZREF@xr@filelist\@empty
+ \let\ZREF@xr@filelist\ltx@empty
\edef\ZREF@xr@externalfile{#2}%
\edef\ZREF@xr@file{\ZREF@xr@externalfile.aux}%
\filename@parse{#2}%
@@ -97,6 +144,11 @@
}%
\def\ZREF@xr@graburl[#1]{%
\edef\ZREF@xr@url{#1}%
+ \ifZREF@xr@urluse
+ \expandafter\ZREF@xr@AddURL\expandafter{\ZREF@xr@url}%
+ \expandafter\def\expandafter\ZREF@xr@url
+ \expandafter{\csname Z@U@\ZREF@xr@theURL\endcsname}%
+ \fi
\ZREF@xr@checkfile
\endgroup
}%
@@ -109,7 +161,8 @@
}%
\else
\PackageInfo{zref-xr}{%
- Label \ifZREF@xr@zreflabel (zref) \fi import from `\ZREF@xr@file'%
+ Label \ifZREF@xr@zreflabel (zref) \fi
+ import from `\ZREF@xr@file'%
}%
\def\ZREF@xr@found{0}%
\def\ZREF@xr@ignored@empty{0}%
@@ -118,7 +171,7 @@
\ZREF@xr@processfile
\closein\@inputcheck
\begingroup
- \let\on@line\@empty
+ \let\on@line\ltx@empty
\PackageInfo{zref-xr}{%
Statistics for `\ZREF@xr@file':\MessageBreak
\ZREF@xr@found\space
@@ -130,19 +183,25 @@
\fi
\ifnum\ZREF@xr@ignored@zref>0 %
,\MessageBreak
- \ZREF@xr@ignored@zref\space doublicated zref label(s) ignored%
+ \ZREF@xr@ignored@zref\space
+ duplicated zref label(s) ignored%
\fi
\ifnum\ZREF@xr@ignored@ltx>0 %
,\MessageBreak
- \ZREF@xr@ignored@ltx\space doublicated latex label(s) ignored%
+ \ZREF@xr@ignored@ltx\space
+ duplicated latex label(s) ignored%
\fi
}%
\endgroup
\fi
- \ifx\ZREF@xr@filelist\@empty
+ \ifx\ZREF@xr@filelist\ltx@empty
\else
- \edef\ZREF@xr@file{\expandafter\@car\ZREF@xr@filelist\@nil}%
- \edef\ZREF@xr@filelist{\expandafter\@cdr\ZREF@xr@filelist\@nil}%
+ \edef\ZREF@xr@file{%
+ \expandafter\ltx@car\ZREF@xr@filelist\@nil
+ }%
+ \edef\ZREF@xr@filelist{%
+ \expandafter\ltx@cdr\ZREF@xr@filelist\ltx@empty\@nil
+ }%
\expandafter\ZREF@xr@checkfile
\fi
}%
@@ -159,11 +218,13 @@
\toks@{#2}%
\ifZREF@xr@zreflabel
\ifx\x\ZREF@xr@zref@newlabel
- \expandafter\ZREF@xr@process@zreflabel\ZREF@xr@line...\ZREF@nil
+ \expandafter
+ \ZREF@xr@process@zreflabel\ZREF@xr@line...\ZREF@nil
\fi
\else
\ifx\x\ZREF@xr@newlabel
- \expandafter\ZREF@xr@process@label\ZREF@xr@line...[]\ZREF@nil
+ \expandafter
+ \ZREF@xr@process@label\ZREF@xr@line...[]\ZREF@nil
\fi
\fi
\ifx\x\ZREF@xr@@input
@@ -180,7 +241,7 @@
\edef\ZREF@xr@tempname{$temp$}%
\edef\ZREF@xr@temprefname{Z@R@\ZREF@xr@tempname}%
\let\ZREF@xr@list\x
- \ifx\ZREF@xr@list\@empty
+ \ifx\ZREF@xr@list\ltx@empty
\PackageWarningNoLine{zref-xr}{%
Label `#1' without properties ignored\MessageBreak
in file `\ZREF@xr@file'%
@@ -230,14 +291,12 @@
\ifx\\#4\\%
\else
% ntheorem knows an optional argument at the end of \newlabel
- \zref@ifpropundefined{theotype}{%
- \zref@newprop{theotype}{}%
- }{}%
+ \ZREF@xr@NewPropTheotype
\expandafter\ltx@LocalAppendToMacro
\csname\ZREF@xr@temprefname\endcsname{\theotype{#4}}%
\fi
\expandafter\ltx@LocalAppendToMacro
- \csname\ZREF@xr@temprefname\expandafter\endcsname\expandafter{%
+ \csname\ZREF@xr@temprefname\expandafter\endcsname\expandafter{%
\expandafter\externaldocument\expandafter{%
\ZREF@xr@externalfile
}%
@@ -292,7 +351,11 @@
\ltx@ifpackageloaded{nameref}{%
{\zref@extractdefault{#1}{title}{}}%
{\zref@extractdefault{#1}{anchor}{}}%
- {\zref@extractdefault{#1}{url}{}}%
+ \zref@ifrefcontainsprop{#1}{urluse}{%
+ {\zref@extractdefault{#1}{urluse}{}}%
+ }{%
+ {\zref@extractdefault{#1}{url}{}}%
+ }%
}{}%
}%
}%
@@ -332,7 +395,7 @@
}{}%
}%
\def\ZREF@xr@scanparams#1#2#3#4#5#6#7\ZREF@nil{%
- \let#1\@empty
+ \let#1\ltx@empty
\ZREF@foundfalse
\ZREF@xr@scantitleref#1#2\TR@TitleReference{}{}\ZREF@nil
\ifZREF@found
@@ -360,7 +423,17 @@
\fi
\ifx\\#6\\%
\else
- \ltx@LocalAppendToMacro#1{\url{#6}}%
+ \ifZREF@xr@urluse
+ \ZREF@xr@AddURL{#6}%
+ \expandafter\ltx@LocalAppendToMacro\expandafter#1%
+ \expandafter{%
+ \expandafter\urluse\expandafter{%
+ \csname Z@U@\ZREF@xr@theURL\endcsname
+ }%
+ }%
+ \else
+ \ltx@LocalAppendToMacro#1{\url{#6}}%
+ \fi
\fi
}%
\def\ZREF@xr@scantitleref#1#2\TR@TitleReference#3#4#5\ZREF@nil{%
@@ -380,7 +453,8 @@
\expandafter
\ltx@LocalAppendToMacro\csname Z@R@#1\expandafter\endcsname
\expandafter{%
- \expandafter\url\expandafter{\ZREF@xr@url}%
+ \csname url\ifZREF@xr@urluse use\fi
+ \expandafter\endcsname\expandafter{\ZREF@xr@url}%
}%
}%
}{%