diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/zref.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/oberdiek/zref.dtx | 233 |
1 files changed, 196 insertions, 37 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/zref.dtx b/Master/texmf-dist/source/latex/oberdiek/zref.dtx index 74a43f088b8..4ca5b6c08d2 100644 --- a/Master/texmf-dist/source/latex/oberdiek/zref.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/zref.dtx @@ -20,7 +20,8 @@ % zref-abspage.sty, zref-counter.sty, zref-dotfill.sty, % zref-hyperref.sty, zref-lastpage.sty, zref-perpage.sty, % zref-savepos.sty, zref-titleref.sty, zref-totpages.sty, -% zref-user.sty, zref-xr.sty, zref-example.tex. +% zref-user.sty, zref-xr.sty, zref-example.tex, +% zref-example-lastpage.tex, zref-test1.tex. % % Distribution: % CTAN:macros/latex/contrib/oberdiek/zref.dtx @@ -68,6 +69,8 @@ % TDS:tex/latex/oberdiek/zref-xr.sty % TDS:doc/latex/oberdiek/zref.pdf % TDS:doc/latex/oberdiek/zref-example.tex +% TDS:doc/latex/oberdiek/zref-example-lastpage.tex +% TDS:doc/latex/oberdiek/test/zref-test1.tex % TDS:source/latex/oberdiek/zref.dtx % %<*ignore> @@ -83,7 +86,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: zref 2008/09/21 v2.2 New reference scheme for LaTeX2e (HO)} +\Msg{* Package: zref 2008/10/01 v2.3 New reference scheme for LaTeX2e (HO)} \Msg{************************************************************************} \keepsilent @@ -114,7 +117,8 @@ and the derived files zref-abspage.sty, zref-counter.sty, zref-dotfill.sty, zref-hyperref.sty, zref-lastpage.sty, zref-perpage.sty, zref-savepos.sty, zref-titleref.sty, zref-totpages.sty, - zref-user.sty, zref-xr.sty, zref-example.tex. + zref-user.sty, zref-xr.sty, zref-example.tex, + zref-example-lastpage.tex, zref-test1.tex. \endpreamble \let\MetaPrefix\DoubleperCent @@ -138,6 +142,9 @@ and the derived files \file{zref-xr.sty}{\from{zref.dtx}{xr}}% \usedir{doc/latex/oberdiek}% \file{zref-example.tex}{\from{zref.dtx}{example}}% + \file{zref-example-lastpage.tex}{\from{zref.dtx}{example-lastpage}}% + \usedir{doc/latex/oberdiek/test}% + \file{zref-test1.tex}{\from{zref.dtx}{test1}}% } \obeyspaces @@ -170,7 +177,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{zref.drv}% - [2008/09/21 v2.2 New reference scheme for LaTeX2e (HO)]% + [2008/10/01 v2.3 New reference scheme for LaTeX2e (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc}[2008/08/11] \begin{document} @@ -179,7 +186,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{1555} +% \CheckSum{1646} % % \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 @@ -200,7 +207,7 @@ and the derived files % \GetFileInfo{zref.drv} % % \title{The \xpackage{zref} package} -% \date{2008/09/21 v2.2} +% \date{2008/10/01 v2.3} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -391,6 +398,11 @@ and the derived files % Adds the property \meta{propname} to the property list \meta{listname}. % The property and list must exist. % +% \begin{declcs}{zref@localaddprop} +% \M{listname} \M{propname} +% \end{declcs} +% Local variant of \cs{zref@addprop}. +% % \begin{declcs}{zref@listexists} % \M{listname} \M{then} % \end{declcs} @@ -735,6 +747,53 @@ and the derived files % |\zpageref{LastPage}| % \end{quote} % +% Since version 2008/10/01 v2.3 the module defines the list |LastPage|. +% In addition to the properties of the main list label |LastPage| also +% stores the properties of this list |LastPage|. The default of this +% list is empty. The list can be used by the user to add additional +% properties for label |LastPage|. +% +% \subsubsection{Example} +% +% \begin{macrocode} +%<*example-lastpage> +\NeedsTeXFormat{LaTeX2e} +\documentclass{report} + % +\newcounter{foo} +\renewcommand*{\thefoo}{\Alph{foo}} + % +\usepackage{zref-lastpage,zref-user}[2008/10/01] + % +\makeatletter +\zref@newprop{thefoo}{\thefoo} +\zref@newprop{valuefoo}{\the\value{foo}} +\zref@newprop{chapter}{\thechapter} +\zref@addprop{LastPage}{thefoo} +\zref@addprop{LastPage}{valuefoo} +\zref@addprop{LastPage}{chapter} +\makeatother + % +\newcommand*{\foo}{% + \stepcounter{foo}% + [Current foo: \thefoo]% +} + % +\begin{document} + \chapter{First chapter} + Last page is \zref{LastPage}.\\% + Last chapter is \zref[chapter]{LastPage}.\\% + Last foo is \zref[thefoo]{LastPage}.\\% + Last value of foo is \zref[valuefoo]{LastPage}.\\% + \foo + \chapter{Second chapter} + \foo\foo\foo + \chapter{Last chapter} + \foo +\end{document} +%</example-lastpage> +% \end{macrocode} +% % \subsection{Module \xoption{totpages}} % % For the total number of pages of a document you need to @@ -1161,13 +1220,13 @@ the height difference of the two baselines is %<*package> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref} - [2008/09/21 v2.2 New reference scheme for LaTeX2e (HO)]% + [2008/10/01 v2.3 New reference scheme for LaTeX2e (HO)]% % \end{macrocode} % % \subsubsection{Load basic module} % % \begin{macrocode} -\RequirePackage{zref-base}[2008/09/21] +\RequirePackage{zref-base}[2008/10/01] % \end{macrocode} % Abort package loading if \xpackage{zref-base} could not be % loaded successfully. @@ -1182,7 +1241,7 @@ the height difference of the two baselines is \def\ZREF@temp#1{% \DeclareOption{#1}{% \AtEndOfPackage{% - \RequirePackage{zref-#1}[2008/09/21]% + \RequirePackage{zref-#1}[2008/10/01]% }% }% } @@ -1242,7 +1301,7 @@ the height difference of the two baselines is %<*base> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-base}% - [2008/09/21 v2.2 Module base for zref (HO)]% + [2008/10/01 v2.3 Module base for zref (HO)]% % \end{macrocode} % % \subsubsection{Utilities} @@ -1444,6 +1503,21 @@ the height difference of the two baselines is % \end{macrocode} % \end{macro} % +% \begin{macro}{\zref@listforloop} +% \begin{macrocode} +\def\zref@listforloop#1#2{% + \expandafter\expandafter\expandafter\@tfor + \expandafter\expandafter\expandafter\zref@prop + \expandafter\expandafter\expandafter:% + \expandafter\expandafter\expandafter=% + \csname Z@L@#1\endcsname + \do{% + #2\zref@prop + }% +} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\zref@addprop} % \cs{zref@addprop} adds the property \verb|#2| to the property % list \verb|#1|, if the property is not already in the list. @@ -1465,6 +1539,41 @@ the height difference of the two baselines is % \end{macrocode} % \end{macro} % +% \begin{macro}{\zref@localaddprop} +% \begin{macrocode} +\def\zref@localaddprop#1#2{% + \zref@listexists{#1}{% + \zref@propexists{#2}{% + \zref@iflistcontainsprop{#1}{#2}{% + \PackageWarning\ZREF@name{% + Property `#2' is already in list `#1'% + }% + }{% + \expandafter\ZREF@l@addto@macro\csname Z@L@#1\endcsname{{#2}}% + }% + }% + }% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ZREF@l@addto@macro} +% \begin{macrocode} +\ifetex@unexpanded + \def\ZREF@l@addto@macro#1#2{% + \global\let\ZREF@gtemp#1% + \g@addto@macro\ZREF@gtemp{#2}% + \let#1\ZREF@gtemp + }% +\else + \def\ZREF@l@addto@macro#1#2{% + \edef#1{% + \etex@unexpanded\expandafter{#1#2}% + }% + }% +\fi +% \end{macrocode} +% \end{macro} +% % \subsubsection{Properties} % % \begin{macro}{\zref@ifpropundefined} @@ -1951,8 +2060,8 @@ the height difference of the two baselines is %<*user> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-user}% - [2008/09/21 v2.2 Module user for zref (HO)]% -\RequirePackage{zref-base}[2008/09/21] + [2008/10/01 v2.3 Module user for zref (HO)]% +\RequirePackage{zref-base}[2008/10/01] \@ifundefined{ZREF@baseok}{\endinput}{} % \end{macrocode} % @@ -2026,8 +2135,8 @@ the height difference of the two baselines is %<*abspage> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-abspage}% - [2008/09/21 v2.2 Module abspage for zref (HO)]% -\RequirePackage{zref-base}[2008/09/21] + [2008/10/01 v2.3 Module abspage for zref (HO)]% +\RequirePackage{zref-base}[2008/10/01] \@ifundefined{ZREF@baseok}{\endinput}{} % \end{macrocode} % @@ -2071,8 +2180,8 @@ the height difference of the two baselines is %<*counter> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-counter}% - [2008/09/21 v2.2 Module counter for zref (HO)]% -\RequirePackage{zref-base}[2008/09/21] + [2008/10/01 v2.3 Module counter for zref (HO)]% +\RequirePackage{zref-base}[2008/10/01] \@ifundefined{ZREF@baseok}{\endinput}{} % \end{macrocode} % @@ -2108,8 +2217,8 @@ the height difference of the two baselines is %<*lastpage> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-lastpage}% - [2008/09/21 v2.2 Module lastpage for zref (HO)]% -\RequirePackage{zref-base}[2008/09/21] + [2008/10/01 v2.3 Module lastpage for zref (HO)]% +\RequirePackage{zref-base}[2008/10/01] \@ifundefined{ZREF@baseok}{\endinput}{} % \end{macrocode} % @@ -2120,13 +2229,20 @@ the height difference of the two baselines is % page number is available, because the properties of % the main property list are used. % \begin{macrocode} +\zref@newlist{LastPage} \AtBeginDocument{% \AtEndDocument{% \if@filesw \clearpage \begingroup \advance\c@page\m@ne - \zref@wrapper@immediate{\zref@label{LastPage}}% + \toks@\expandafter\expandafter\expandafter{% + \expandafter\Z@L@main + \Z@L@LastPage + }% + \expandafter\zref@wrapper@immediate\expandafter{% + \expandafter\ZREF@label\expandafter{\the\toks@}{LastPage}% + }% \endgroup \fi }% @@ -2142,16 +2258,16 @@ the height difference of the two baselines is %<*totpages> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-totpages}% - [2008/09/21 v2.2 Module totpages for zref (HO)]% -\RequirePackage{zref-base}[2008/09/21] + [2008/10/01 v2.3 Module totpages for zref (HO)]% +\RequirePackage{zref-base}[2008/10/01] \@ifundefined{ZREF@baseok}{\endinput}{} % \end{macrocode} % % The absolute page number of the last page is the total % page number. % \begin{macrocode} -\RequirePackage{zref-abspage}[2008/09/21] -\RequirePackage{zref-lastpage}[2008/09/21] +\RequirePackage{zref-abspage}[2008/10/01] +\RequirePackage{zref-lastpage}[2008/10/01] % \end{macrocode} % % \begin{macro}{\ztotpages} @@ -2181,8 +2297,8 @@ the height difference of the two baselines is %<*perpage> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-perpage}% - [2008/09/21 v2.2 Module perpage for zref (HO)]% -\RequirePackage{zref-base}[2008/09/21] + [2008/10/01 v2.3 Module perpage for zref (HO)]% +\RequirePackage{zref-base}[2008/10/01] \@ifundefined{ZREF@baseok}{\endinput}{} % \end{macrocode} % @@ -2194,7 +2310,7 @@ the height difference of the two baselines is % For detecting changed pages module \xoption{abspage} % is loaded. % \begin{macrocode} -\RequirePackage{zref-abspage}[2008/09/21] +\RequirePackage{zref-abspage}[2008/10/01] % \end{macrocode} % % We group the properties for the needed references @@ -2338,8 +2454,8 @@ the height difference of the two baselines is %<*titleref> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-titleref}% - [2008/09/21 v2.2 Module titleref for zref (HO)]% -\RequirePackage{zref-base}[2008/09/21] + [2008/10/01 v2.3 Module titleref for zref (HO)]% +\RequirePackage{zref-base}[2008/10/01] \@ifundefined{ZREF@baseok}{\endinput}{} % \end{macrocode} % @@ -2665,8 +2781,8 @@ the height difference of the two baselines is %<*xr> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-xr}% - [2008/09/21 v2.2 Module xr for zref (HO)]% -\RequirePackage{zref-base}[2008/09/21] + [2008/10/01 v2.3 Module xr for zref (HO)]% +\RequirePackage{zref-base}[2008/10/01] \@ifundefined{ZREF@baseok}{\endinput}{} % \end{macrocode} % \begin{macrocode} @@ -3009,8 +3125,8 @@ the height difference of the two baselines is %<*hyperref> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-hyperref}% - [2008/09/21 v2.2 Module hyperref for zref (HO)]% -\RequirePackage{zref-base}[2008/09/21] + [2008/10/01 v2.3 Module hyperref for zref (HO)]% +\RequirePackage{zref-base}[2008/10/01] \@ifundefined{ZREF@baseok}{\endinput}{} % \end{macrocode} % @@ -3038,8 +3154,8 @@ the height difference of the two baselines is %<*savepos> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-savepos}% - [2008/09/21 v2.2 Module savepos for zref (HO)]% -\RequirePackage{zref-base}[2008/09/21] + [2008/10/01 v2.3 Module savepos for zref (HO)]% +\RequirePackage{zref-base}[2008/10/01] \@ifundefined{ZREF@baseok}{\endinput}{} % \end{macrocode} % @@ -3144,15 +3260,15 @@ the height difference of the two baselines is %<*dotfill> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-dotfill}% - [2008/09/21 v2.2 Module dotfill for zref (HO)]% -\RequirePackage{zref-base}[2008/09/21] + [2008/10/01 v2.3 Module dotfill for zref (HO)]% +\RequirePackage{zref-base}[2008/10/01] \@ifundefined{ZREF@baseok}{\endinput}{} % \end{macrocode} % % For measuring the width of \cs{zdotfill} we use the features % provided by module \xoption{savepos}. % \begin{macrocode} -\RequirePackage{zref-savepos}[2008/09/21] +\RequirePackage{zref-savepos}[2008/10/01] % \end{macrocode} % For automatically generated label names we use the unique % counter of module \xoption{base}. @@ -3232,6 +3348,39 @@ the height difference of the two baselines is %</dotfill> % \end{macrocode} % +% \section{Test} +% +% \subsection{\cs{zref@localaddprop}} +% +% \begin{macrocode} +%<*test1> +\NeedsTeXFormat{LaTeX2e} +\nofiles +\documentclass{article} +\usepackage{zref-base}[2008/10/01] +\usepackage{qstest} +\IncludeTests{*} +\LogTests{log}{*}{*} + +\makeatletter +\begin{qstest}{localaddprop}{localaddprop} + \Expect*{\Z@L@main}*{{default}{page}}% + \zref@newprop{foobar}{FOO}% + \zref@newlist{alist}% + \Expect*{\Z@L@alist}{}% + \begingroup + \zref@localaddprop{main}{foobar}% + \Expect*{\Z@L@main}{{default}{page}{foobar}}% + \zref@localaddprop{alist}{page}% + \Expect*{\Z@L@alist}{{page}}% + \endgroup + \Expect*{\Z@L@main}*{{default}{page}}% + \Expect*{\Z@L@alist}{}% +\end{qstest} +\@@end +%</test1> +% \end{macrocode} +% % \section{Installation} % % \subsection{Download} @@ -3306,6 +3455,8 @@ the height difference of the two baselines is % zref-xr.sty & tex/latex/oberdiek/zref-xr.sty\\ % zref.pdf & doc/latex/oberdiek/zref.pdf\\ % zref-example.tex & doc/latex/oberdiek/zref-example.tex\\ +% zref-example-lastpage.tex & doc/latex/oberdiek/zref-example-lastpage.tex\\ +% test/zref-test1.tex & doc/latex/oberdiek/test/zref-test1.tex\\ % zref.dtx & source/latex/oberdiek/zref.dtx\\ % \end{tabular}^^A % }^^A @@ -3525,6 +3676,14 @@ the height difference of the two baselines is % a broken \cs{zref@listcontainsprop} implemented. Name and % implementation fixed (thanks Ohad Kammar). % \end{Version} +% \begin{Version}{2008/10/01 v2.3} +% \item +% \cs{zref@localaddprop} added (feature request of Ohad Kammar). +% \item +% Module lastpage: list `LastPage' added. Label `LastPage' will use +% the properties of this list (default is empty) along with the +% properties of the main list. +% \end{Version} % \end{History} % % \PrintIndex |