summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/oberdiek/zref.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/zref.dtx')
-rw-r--r--Master/texmf-dist/source/latex/oberdiek/zref.dtx563
1 files changed, 420 insertions, 143 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/zref.dtx b/Master/texmf-dist/source/latex/oberdiek/zref.dtx
index 6226af914cd..9a632a0c32a 100644
--- a/Master/texmf-dist/source/latex/oberdiek/zref.dtx
+++ b/Master/texmf-dist/source/latex/oberdiek/zref.dtx
@@ -27,7 +27,7 @@
% 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.
%
% Distribution:
% CTAN:macros/latex/contrib/oberdiek/zref.dtx
@@ -83,6 +83,7 @@
% TDS:doc/latex/oberdiek/zref-example-nextpage.tex
% TDS:doc/latex/oberdiek/test/zref-test1.tex
% TDS:doc/latex/oberdiek/test/zref-test-runs.tex
+% TDS:doc/latex/oberdiek/test/zref-test-titleref-memoir.tex
% TDS:source/latex/oberdiek/zref.dtx
%
%<*ignore>
@@ -100,7 +101,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: zref 2010/04/08 v2.10 New reference scheme for LaTeX2e (HO)}
+\Msg{* Package: zref 2010/04/17 v2.12 New reference scheme for LaTeX2e (HO)}
\Msg{************************************************************************}
\keepsilent
@@ -138,7 +139,7 @@ and the derived files
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.
\endpreamble
\let\MetaPrefix\DoubleperCent
@@ -171,6 +172,7 @@ and the derived files
\usedir{doc/latex/oberdiek/test}%
\file{zref-test1.tex}{\from{zref.dtx}{test1}}%
\file{zref-test-runs.tex}{\from{zref.dtx}{test-runs}}%
+ \file{zref-test-titleref-memoir.tex}{\from{zref.dtx}{test-titleref-memoir}}%
}
\catcode32=13\relax% active space
@@ -206,7 +208,7 @@ and the derived files
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{zref.drv}%
- [2010/04/08 v2.10 New reference scheme for LaTeX2e (HO)]%
+ [2010/04/17 v2.12 New reference scheme for LaTeX2e (HO)]%
\documentclass{ltxdoc}
\usepackage{holtxdoc}[2008/08/11]
\begin{document}
@@ -215,7 +217,7 @@ and the derived files
%</driver>
% \fi
%
-% \CheckSum{2027}
+% \CheckSum{2292}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -236,7 +238,7 @@ and the derived files
% \GetFileInfo{zref.drv}
%
% \title{The \xpackage{zref} package}
-% \date{2010/04/08 v2.10}
+% \date{2010/04/17 v2.12}
% \author{Heiko Oberdiek\\\xemail{heiko.oberdiek at googlemail.com}}
%
% \maketitle
@@ -832,7 +834,7 @@ and the derived files
\newcounter{foo}
\renewcommand*{\thefoo}{\Alph{foo}}
-\usepackage{zref-lastpage,zref-user}[2008/10/01]
+\usepackage{zref-lastpage,zref-user}[2010/04/17]
\makeatletter
\zref@newprop{thefoo}{\thefoo}
@@ -948,7 +950,7 @@ and the derived files
%<<END_EXAMPLE
\documentclass{book}
-\usepackage{zref-nextpage}[2010/04/08]
+\usepackage{zref-nextpage}[2010/04/17]
\znextpagesetup
{\thepage}% next page is unknown
{\thepage\ (#1)}% this page is last page
@@ -1214,8 +1216,17 @@ and the derived files
% \begin{declcs}{zxrsetup}
% |{|\textit{key$_1$=value$_1$, key$_2$=value$_2$, \dots}|}|
% \end{declcs}
-% Currently the key |ext| is defined, this sets the
-% url default extension.
+% The following setup options are available:
+% \begin{description}
+% \item[\xoption{ext}:] It sets the default extension.
+% \item[\xoption{tozreflabel}:] The found references
+% are imported as zref labels. This is enabled by default.
+% \item[\xoption{toltxlabel}:] The found references
+% are imported as \LaTeX\ labels. Packages \xpackage{nameref},
+% \xpackage{titleref} and class \xclass{memoir} are supported.
+% \item[\xoption{verbose}:] List the imported labels in the
+% \xext{log} file. Default is |false|.
+% \end{description}
%
% \begin{declcs}{zref@xr@ext}
% \end{declcs}
@@ -1426,13 +1437,13 @@ the height difference of the two baselines is
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zref}
- [2010/04/08 v2.10 New reference scheme for LaTeX2e (HO)]%
+ [2010/04/17 v2.12 New reference scheme for LaTeX2e (HO)]%
% \end{macrocode}
%
% \subsubsection{Load basic module}
%
% \begin{macrocode}
-\RequirePackage{zref-base}[2010/04/08]
+\RequirePackage{zref-base}[2010/04/17]
% \end{macrocode}
% Abort package loading if \xpackage{zref-base} could not be
% loaded successfully.
@@ -1447,7 +1458,7 @@ the height difference of the two baselines is
\def\ZREF@temp#1{%
\DeclareOption{#1}{%
\AtEndOfPackage{%
- \RequirePackage{zref-#1}[2010/04/08]%
+ \RequirePackage{zref-#1}[2010/04/17]%
}%
}%
}
@@ -1507,7 +1518,7 @@ the height difference of the two baselines is
%<*base>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zref-base}%
- [2010/04/08 v2.10 Module base for zref (HO)]%
+ [2010/04/17 v2.12 Module base for zref (HO)]%
% \end{macrocode}
%
% \subsubsection{Utilities}
@@ -1839,6 +1850,7 @@ the height difference of the two baselines is
\global\@namedef{Z@D@\ZREF@P}{#1}%
\global\expandafter\let\csname Z@X@\ZREF@P\endcsname\ZREF@X
\expandafter\ZREF@@@newprop\csname\ZREF@P\endcsname
+ \expandafter\gdef\csname Z@C@\ZREF@P\endcsname{}%
\zref@setcurrent\ZREF@P
}
\def\ZREF@@@newprop#1{%
@@ -2287,8 +2299,8 @@ the height difference of the two baselines is
%<*user>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zref-user}%
- [2010/04/08 v2.10 Module user for zref (HO)]%
-\RequirePackage{zref-base}[2010/04/08]
+ [2010/04/17 v2.12 Module user for zref (HO)]%
+\RequirePackage{zref-base}[2010/04/17]
\@ifundefined{ZREF@baseok}{\endinput}{}
% \end{macrocode}
%
@@ -2362,8 +2374,8 @@ the height difference of the two baselines is
%<*abspage>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zref-abspage}%
- [2010/04/08 v2.10 Module abspage for zref (HO)]%
-\RequirePackage{zref-base}[2010/04/08]
+ [2010/04/17 v2.12 Module abspage for zref (HO)]%
+\RequirePackage{zref-base}[2010/04/17]
\@ifundefined{ZREF@baseok}{\endinput}{}
% \end{macrocode}
%
@@ -2407,8 +2419,8 @@ the height difference of the two baselines is
%<*counter>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zref-counter}%
- [2010/04/08 v2.10 Module counter for zref (HO)]%
-\RequirePackage{zref-base}[2010/04/08]
+ [2010/04/17 v2.12 Module counter for zref (HO)]%
+\RequirePackage{zref-base}[2010/04/17]
\@ifundefined{ZREF@baseok}{\endinput}{}
% \end{macrocode}
%
@@ -2444,9 +2456,9 @@ the height difference of the two baselines is
%<*lastpage>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zref-lastpage}%
- [2010/04/08 v2.10 Module lastpage for zref (HO)]%
-\RequirePackage{zref-base}[2010/04/08]
-\RequirePackage{zref-abspage}[2010/04/08]
+ [2010/04/17 v2.12 Module lastpage for zref (HO)]%
+\RequirePackage{zref-base}[2010/04/17]
+\RequirePackage{zref-abspage}[2010/04/17]
\RequirePackage{atveryend}[2009/12/07]
\@ifundefined{ZREF@baseok}{\endinput}{}
% \end{macrocode}
@@ -2513,14 +2525,14 @@ the height difference of the two baselines is
%<*thepage>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zref-thepage}%
- [2010/04/08 v2.10 Module thepage for zref (HO)]%
-\RequirePackage{zref-base}[2010/04/08]
+ [2010/04/17 v2.12 Module thepage for zref (HO)]%
+\RequirePackage{zref-base}[2010/04/17]
\@ifundefined{ZREF@baseok}{\endinput}{}
% \end{macrocode}
%
% \begin{macrocode}
\RequirePackage{atbegshi}
-\RequirePackage{zref-abspage}[2010/04/08]
+\RequirePackage{zref-abspage}[2010/04/17]
% \end{macrocode}
% \begin{macrocode}
\zref@newlist{thepage}
@@ -2573,15 +2585,15 @@ the height difference of the two baselines is
%<*nextpage>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zref-nextpage}%
- [2010/04/08 v2.10 Module nextpage for zref (HO)]%
-\RequirePackage{zref-base}[2010/04/08]
+ [2010/04/17 v2.12 Module nextpage for zref (HO)]%
+\RequirePackage{zref-base}[2010/04/17]
\@ifundefined{ZREF@baseok}{\endinput}{}
% \end{macrocode}
%
% \begin{macrocode}
-\RequirePackage{zref-abspage}[2010/04/08]
-\RequirePackage{zref-thepage}[2010/04/08]
-\RequirePackage{zref-lastpage}[2010/04/08]
+\RequirePackage{zref-abspage}[2010/04/17]
+\RequirePackage{zref-thepage}[2010/04/17]
+\RequirePackage{zref-lastpage}[2010/04/17]
\RequirePackage{uniquecounter}[2009/12/18]
% \end{macrocode}
% \begin{macrocode}
@@ -2674,16 +2686,16 @@ the height difference of the two baselines is
%<*totpages>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zref-totpages}%
- [2010/04/08 v2.10 Module totpages for zref (HO)]%
-\RequirePackage{zref-base}[2010/04/08]
+ [2010/04/17 v2.12 Module totpages for zref (HO)]%
+\RequirePackage{zref-base}[2010/04/17]
\@ifundefined{ZREF@baseok}{\endinput}{}
% \end{macrocode}
%
% The absolute page number of the last page is the total
% page number.
% \begin{macrocode}
-\RequirePackage{zref-abspage}[2010/04/08]
-\RequirePackage{zref-lastpage}[2010/04/08]
+\RequirePackage{zref-abspage}[2010/04/17]
+\RequirePackage{zref-lastpage}[2010/04/17]
% \end{macrocode}
%
% \begin{macro}{\ztotpages}
@@ -2713,8 +2725,8 @@ the height difference of the two baselines is
%<*marks>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zref-marks}%
- [2010/04/08 v2.10 Module marks for zref (HO)]%
-\RequirePackage{zref-base}[2010/04/08]
+ [2010/04/17 v2.12 Module marks for zref (HO)]%
+\RequirePackage{zref-base}[2010/04/17]
\@ifundefined{ZREF@baseok}{\endinput}{}
% \end{macrocode}
%
@@ -2817,7 +2829,7 @@ the height difference of the two baselines is
%<*runs>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zref-runs}%
- [2010/04/08 v2.10 Module runs for zref (HO)]%
+ [2010/04/17 v2.12 Module runs for zref (HO)]%
% \end{macrocode}
%
% \begin{macro}{\zruns}
@@ -2849,8 +2861,8 @@ the height difference of the two baselines is
%<*perpage>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zref-perpage}%
- [2010/04/08 v2.10 Module perpage for zref (HO)]%
-\RequirePackage{zref-base}[2010/04/08]
+ [2010/04/17 v2.12 Module perpage for zref (HO)]%
+\RequirePackage{zref-base}[2010/04/17]
\@ifundefined{ZREF@baseok}{\endinput}{}
% \end{macrocode}
%
@@ -2862,7 +2874,7 @@ the height difference of the two baselines is
% For detecting changed pages module \xmodule{abspage}
% is loaded.
% \begin{macrocode}
-\RequirePackage{zref-abspage}[2010/04/08]
+\RequirePackage{zref-abspage}[2010/04/17]
% \end{macrocode}
%
% We group the properties for the needed references
@@ -3006,8 +3018,8 @@ the height difference of the two baselines is
%<*titleref>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zref-titleref}%
- [2010/04/08 v2.10 Module titleref for zref (HO)]%
-\RequirePackage{zref-base}[2010/04/08]
+ [2010/04/17 v2.12 Module titleref for zref (HO)]%
+\RequirePackage{zref-base}[2010/04/17]
\@ifundefined{ZREF@baseok}{\endinput}{}
\RequirePackage{gettitlestring}[2009/12/08]
% \end{macrocode}
@@ -3245,7 +3257,50 @@ the height difference of the two baselines is
}%
% \end{macrocode}
%
-% Class \xpackage{beamer}.
+% \subsubsection{Class \xclass{memoir}}
+%
+% \begin{macrocode}
+ \@ifclassloaded{memoir}{%
+ \ltx@IfUndefined{ifheadnameref}{}{%
+ \def\@chapter[#1]#2{%
+ \ltx@IfUndefined{ch@pt@c}{%
+ \zref@titleref@setcurrent{#1}%
+ }{%
+ \ifx\ch@pt@c\ltx@empty
+ \zref@titleref@setcurrent{#2}%
+ \else
+ \def\NR@temp{#1}%
+ \ifx\NR@temp\ltx@empty
+ \expandafter\zref@titleref@setcurrent
+ \expandafter{\ch@pt@c}%
+ \else
+ \ifheadnameref
+ \zref@titleref@setcurrent{#1}%
+ \else
+ \expandafter\zref@titleref@setcurrent
+ \expandafter{\ch@pt@c}%
+ \fi
+ \fi
+ \fi
+ }%
+ \ZREF@org@@chapter[{#1}]{#2}%
+ }%
+ \ZREF@patch{M@sect}{%
+ \def\M@sect#1#2#3#4#5#6[#7][#8]{%
+ \ifheadnameref
+ \zref@titleref@setcurrent{#8}%
+ \else
+ \zref@titleref@setcurrent{#7}%
+ \fi
+ \ZREF@org@M@sect{#1}{#2}{#3}{#4}{#5}{#6}[{#7}][{#8}]%
+ }%
+ }%
+ }%
+ }{}%
+% \end{macrocode}
+%
+% \subsubsection{Class \xclass{beamer}}
+%
% \begin{macrocode}
\@ifclassloaded{beamer}{%
\ZREF@patch{beamer@section}{%
@@ -3269,7 +3324,8 @@ the height difference of the two baselines is
}{}%
% \end{macrocode}
%
-% Package \xpackage{titlesec}.
+% \subsubsection{Package \xpackage{titlesec}}
+%
% \begin{macrocode}
\@ifpackageloaded{titlesec}{%
\ZREF@patch{ttl@sect@i}{%
@@ -3281,6 +3337,8 @@ the height difference of the two baselines is
}{}%
% \end{macrocode}
%
+% \subsubsection{Package \xpackage{longtable}}
+%
% Package \xpackage{longtable}: some support for its \cs{caption}.
% However \cs{label} inside the caption is not supported.
% \begin{macrocode}
@@ -3294,6 +3352,8 @@ the height difference of the two baselines is
}{}%
% \end{macrocode}
%
+% \subsubsection{Package \xpackage{listings}}
+%
% Package \xpackage{listings}: support for its caption.
% \begin{macrocode}
\@ifpackageloaded{listings}{%
@@ -3309,9 +3369,39 @@ the height difference of the two baselines is
}%
}%
}{}%
-}
% \end{macrocode}
%
+% \subsubsection{Theorems}
+%
+% \begin{macrocode}
+ \ZREF@patch{@opargbegintheorem}{%
+ \def\@opargbegintheorem#1#2#3{%
+ \zref@titleref@setcurrent{#3}%
+ \ZREF@org@@opargbegintheorem{#1}{#2}{#3}%
+ }%
+ }%
+ \@ifpackageloaded{amsthm}{%
+ \begingroup
+ \edef\x{macro:\string#1\string#2[\string#3]}%
+ \@onelevel@sanitize\x
+ \def\y#1->#2\@nil{#1}%
+ \edef\z{\expandafter\y\meaning\@begintheorem->\@nil}%
+ \@onelevel@sanitize\z
+ \expandafter\endgroup
+ \ifx\x\z
+ \ZREF@patch{@begintheorem}{%
+ \def\@begintheorem#1#2[#3]{%
+ \zref@titleref@setcurrent{#3}%
+ \ZREF@org@@begintheorem{#1}{#2}[{#3}]%
+ }%
+ }%
+ \fi
+ }{}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
%
% \begin{macrocode}
%</titleref>
@@ -3324,12 +3414,13 @@ the height difference of the two baselines is
%<*xr>
\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}{}
% \end{macrocode}
% \begin{macrocode}
\RequirePackage{keyval}
+\RequirePackage{kvoptions}[2010/02/22]
% \end{macrocode}
%
% We declare property |url|, because this is added,
@@ -3363,6 +3454,26 @@ the height difference of the two baselines is
\newif\ifZREF@xr@zreflabel
% \end{macrocode}
% \end{macro}
+% \begin{macrocode}
+\SetupKeyvalOptions{%
+ family=ZREF@XR,%
+ prefix=ZREF@xr@%
+}
+\DeclareBoolOption[true]{tozreflabel}
+\DeclareBoolOption[false]{toltxlabel}
+\DeclareBoolOption{verbose}
+\define@key{ZREF@XR}{ext}{%
+ \def\zref@xr@{#1}%
+}
+% \end{macrocode}
+% \begin{macro}{\zxrsetup}
+% \begin{macrocode}
+\newcommand*{\zxrsetup}{%
+ \setkeys{ZREF@XR}%
+}%
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\zexternaldocument}
% In its star form it looks for \cs{newlabel},
% otherwise for \cs{zref@newlabel}.
@@ -3371,6 +3482,17 @@ the height difference of the two baselines is
% |@| to have catcode 11 (letter).
% \begin{macrocode}
\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
@@ -3427,15 +3549,30 @@ the height difference of the two baselines is
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
@@ -3456,7 +3593,7 @@ the height difference of the two baselines is
\expandafter\ZREF@xr@processline\ZREF@xr@line..\ZREF@nil
\ifeof\@inputcheck
\else
- \expandafter\ZREF@xr@procesfile
+ \expandafter\ZREF@xr@processfile
\fi
}%
% \end{macrocode}
@@ -3483,81 +3620,160 @@ the height difference of the two baselines is
{\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@relax{\relax}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\ZREF@xr@tolabel}
+% \begin{macrocode}
+\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}{}}%
+ }{}%
+ }%
+}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\ZREF@xr@ignorewarning}
+% \begin{macro}{\ZREF@xr@zref@ignorewarning}
% \begin{macrocode}
-\def\ZREF@xr@ignorewarning#1{%
+\def\ZREF@xr@zref@ignorewarning#1{%
\PackageWarningNoLine{zref-xr}{%
- Label `#1' is already in use\MessageBreak
+ Zref 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@empty{%
+ \the\numexpr\ZREF@xr@ignored+1%
+ }%
+}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ZREF@xr@ltx@ignorewarning}
+% \begin{macrocode}
+\def\ZREF@xr@ltx@ignorewarning#1{%
+ \PackageWarningNoLine{zref-xr}{%
+ LaTeX label `#1' is already in use\MessageBreak
+ in file `\ZREF@xr@file'%
+ }%
+ \edef\ZREF@xr@ignored@ltx{%
+ \the\numexpr\ZREF@xr@ignored@ltx+1%
+ }%
}%
% \end{macrocode}
% \end{macro}
@@ -3570,12 +3786,11 @@ the height difference of the two baselines is
\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}{}%
@@ -3587,40 +3802,35 @@ the height difference of the two baselines is
% \begin{macro}{\ZREF@xr@scanparams}
% \begin{macrocode}
\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
}%
% \end{macrocode}
@@ -3631,7 +3841,7 @@ the height difference of the two baselines is
\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}%
}%
@@ -3647,7 +3857,8 @@ the height difference of the two baselines is
\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}%
}%
@@ -3658,18 +3869,6 @@ the height difference of the two baselines is
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\zxrsetup}
-% Just one key for setting the default extension is currently used.
-% \begin{macrocode}
-\define@key{ZREF@XR}{ext}{%
- \def\zref@xr@ext{#1}%
-}%
-\newcommand*{\zxrsetup}{%
- \setkeys{ZREF@XR}%
-}%
-% \end{macrocode}
-% \end{macro}
-%
% \begin{macrocode}
%</xr>
% \end{macrocode}
@@ -3683,8 +3882,8 @@ the height difference of the two baselines is
%<*hyperref>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zref-hyperref}%
- [2010/04/08 v2.10 Module hyperref for zref (HO)]%
-\RequirePackage{zref-base}[2010/04/08]
+ [2010/04/17 v2.12 Module hyperref for zref (HO)]%
+\RequirePackage{zref-base}[2010/04/17]
\@ifundefined{ZREF@baseok}{\endinput}{}
% \end{macrocode}
%
@@ -3712,8 +3911,8 @@ the height difference of the two baselines is
%<*savepos>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zref-savepos}%
- [2010/04/08 v2.10 Module savepos for zref (HO)]%
-\RequirePackage{zref-base}[2010/04/08]
+ [2010/04/17 v2.12 Module savepos for zref (HO)]%
+\RequirePackage{zref-base}[2010/04/17]
\@ifundefined{ZREF@baseok}{\endinput}{}
% \end{macrocode}
%
@@ -3815,15 +4014,15 @@ the height difference of the two baselines is
%<*dotfill>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zref-dotfill}%
- [2010/04/08 v2.10 Module dotfill for zref (HO)]%
-\RequirePackage{zref-base}[2010/04/08]
+ [2010/04/17 v2.12 Module dotfill for zref (HO)]%
+\RequirePackage{zref-base}[2010/04/17]
\@ifundefined{ZREF@baseok}{\endinput}{}
% \end{macrocode}
%
% For measuring the width of \cs{zdotfill} we use the features
% provided by module \xmodule{savepos}.
% \begin{macrocode}
-\RequirePackage{zref-savepos}[2010/04/08]
+\RequirePackage{zref-savepos}[2010/04/17]
% \end{macrocode}
% For automatically generated label names we use the unique
% counter of module \xmodule{base}.
@@ -3912,7 +4111,7 @@ the height difference of the two baselines is
\NeedsTeXFormat{LaTeX2e}
\nofiles
\documentclass{article}
-\usepackage{zref-base}[2010/04/08]
+\usepackage{zref-base}[2010/04/17]
\usepackage{qstest}
\IncludeTests{*}
\LogTests{log}{*}{*}
@@ -3942,7 +4141,7 @@ the height difference of the two baselines is
%<*test-runs>
\NeedsTeXFormat{LaTeX2e}
\documentclass{article}
-\usepackage{zref-runs}[2010/04/08]
+\usepackage{zref-runs}[2010/04/17]
\usepackage{qstest}
\IncludeTests{*}
\LogTests{log}{*}{*}
@@ -3965,6 +4164,69 @@ the height difference of the two baselines is
%</test-runs>
% \end{macrocode}
%
+% \subsection{Module \xmodule{titleref}}
+%
+% \begin{macrocode}
+%<*test-titleref-memoir>
+\NeedsTeXFormat{LaTeX2e}
+\documentclass{memoir}
+\usepackage{zref-titleref}[2010/04/17]
+\usepackage{qstest}
+\IncludeTests{*}
+\LogTests{log}{*}{*}
+\begin{document}
+\makeatletter
+\def\List{}
+\def\Label#1{%
+ \zref@label{#1}%
+ \g@addto@macro\List{%
+ \par
+ #1: [\ztitleref{#1}]%
+ }%
+ \mbox{}%
+ \zref@refused{#1}%
+ \zref@ifrefundefined{#1}{%
+ }{%
+ \begingroup
+ \edef\x{\zref@extract{#1}{title}}%
+ \Expect{OK/}*{\expandafter\ltx@carthree\x{}{}{}\@nil}%
+ \endgroup
+ }%
+}
+\def\Test#1{%
+ \csname#1\endcsname*{OK/#1}%
+ \Label{#1*}%
+ \csname#1\endcsname{OK/#1}%
+ \Label{#1}%
+ \csname#1\endcsname[OK/#1-toc]%
+ {WRONG-in-titleref/#1-toc-2}%
+ \Label{#1-toc}%
+ \expandafter\ifx\csname#1\endcsname\part
+ \else
+ \headnamereffalse
+ \csname#1\endcsname[OK/#1-th-toc]%
+ [WRONG-in-titleref/#1-th-toc-2]%
+ {WRONG-in-titleref/#1-th-toc-3}%
+ \Label{#1-th-toc}%
+ \headnamereftrue
+ \csname#1\endcsname[WRONG-in-titleref/#1-th-head-1]%
+ [OK/#1-th-head]%
+ {WRONG-in-titleref/#1-th-head-3}%
+ \Label{#1-th-head}%
+ \fi
+}
+\begin{qstest}{section}{section}
+ \@for\x:=part,chapter,section,subsection,subsubsection\do{%
+ \expandafter\Test\expandafter{\x}%
+ }%
+\end{qstest}
+\newpage
+\List
+\end{document}
+
+%</test-titleref-memoir>
+% \end{macrocode}
+%
% \section{Installation}
%
% \subsection{Download}
@@ -4047,6 +4309,7 @@ the height difference of the two baselines is
% zref-example-nextpage.tex & doc/latex/oberdiek/zref-example-nextpage.tex\\
% test/zref-test1.tex & doc/latex/oberdiek/test/zref-test1.tex\\
% test/zref-test-runs.tex & doc/latex/oberdiek/test/zref-test-runs.tex\\
+% test/zref-test-titleref-memoir.tex & doc/latex/oberdiek/test/zref-test-titleref-memoir.tex\\
% zref.dtx & source/latex/oberdiek/zref.dtx\\
% \end{tabular}^^A
% }^^A
@@ -4319,6 +4582,20 @@ the height difference of the two baselines is
% Module \xmodule{xr} remembers the external document name
% in property `externaldocument'.
% \end{Version}
+% \begin{Version}{2010/04/15 v2.11}
+% \item
+% Module \xmodule{titleref}: Better support of class \xclass{memoir}.
+% \item
+% Module \xmodule{titleref}: Support of theorems.
+% \end{Version}
+% \begin{Version}{2010/04/17 v2.12}
+% \item
+% Module \xmodule{base}: \cs{zref@newprop} ensures global
+% empty default.
+% \item
+% Module \xmodule{xr}: Setup options \xoption{tozreflabel}
+% and \xoption{toltxlabel} added.
+% \end{Version}
% \end{History}
%
% \PrintIndex