diff options
author | Karl Berry <karl@freefriends.org> | 2023-09-14 20:25:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-09-14 20:25:24 +0000 |
commit | bdf29fccef93127229dd75857543360f7932afa3 (patch) | |
tree | 9210032eda16d0561d61a678a961c65b5717f66b /Master/texmf-dist/source | |
parent | d6880412cfd3146e7b1f60870c697dd57cb63375 (diff) |
zref (14sep23)
git-svn-id: svn://tug.org/texlive/trunk@68278 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/zref/zref.dtx | 165 |
1 files changed, 92 insertions, 73 deletions
diff --git a/Master/texmf-dist/source/latex/zref/zref.dtx b/Master/texmf-dist/source/latex/zref/zref.dtx index af22a5802ea..2cee7ca9f89 100644 --- a/Master/texmf-dist/source/latex/zref/zref.dtx +++ b/Master/texmf-dist/source/latex/zref/zref.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % File: zref.dtx -% Version: 2022-04-07 v2.34 +% Version: 2023-09-14 v2.35 % Info: A new reference scheme for LaTeX % % Copyright (C) @@ -112,7 +112,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: zref 2022-04-07 v2.34 A new reference scheme for LaTeX (HO)} +\Msg{* Package: zref 2023-09-14 v2.35 A new reference scheme for LaTeX (HO)} \Msg{************************************************************************} \keepsilent @@ -124,11 +124,11 @@ This is a generated file. Project: zref -Version: 2022-04-07 v2.34 +Version: 2023-09-14 v2.35 Copyright (C) 2006-2012 Heiko Oberdiek - 2016-2022 Oberdiek Package Support Group + 2016-2023 Oberdiek Package Support Group This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either @@ -230,7 +230,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{zref.drv}% - [2022-04-07 v2.34 A new reference scheme for LaTeX (HO)]% + [2023-09-14 v2.35 A new reference scheme for LaTeX (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc}[2011/11/22] \setlength{\emergencystretch}{1em} @@ -245,7 +245,7 @@ and the derived files % \GetFileInfo{zref.drv} % % \title{The \xpackage{zref} package} -% \date{2022-04-07 v2.34} +% \date{2023-09-14 v2.35} % \author{Heiko Oberdiek\thanks % {Please report any issues at \url{https://github.com/ho-tex/zref/issues}}} % @@ -852,22 +852,28 @@ and the derived files % warnings. % % \subsection{Module \xmodule{abspage}} -% -% With the help of package \xpackage{atbegshi} -% a new counter |abspage| with absolute page numbers is provided. -% For technical and historical reasons the counter itself is zero based: -% if you use it directly on the first page, e.g -% with |\arabic{abspage}| you will get 0 as value. When using |\zref| -% the first page will be page 1 as expected. -% Also a new property |abspage| is defined and added to the -% main property list. Thus you can reference the absolute -% page number: +% A new property |abspage| is defined and added to the +% main property list. It makes use of the LaTeX count |\ReadonlyShipoutCounter| +% to keep track of the page numbers. +% +% Thus you can reference the absolute page number: % \begin{quote} % |Section \zref{foo} is on page \zpageref{foo}.|\\ % |This is page \zref[abspage]{foo}|\\ % |of \zref[abspage]{LastPage}.| % \end{quote} % The example also makes use of module \xmodule{lastpage}. +% +% For compability also a counter |abspage| is provided +% which is increased at shipout too. +% For technical and historical reasons this counter is zero based: +% if you use it directly on the first page, e.g +% with |\arabic{abspage}| you will get 0 as value. (When using |\zref| to retrieve +% the |abspage| property the first page will be page 1 as expected.). +% It must be noted that the \texttt{perpage} package also provides a |abspage| +% counter which is \emph{not} zero based but gives 1 on the first page if \texttt{zref-abspage} is +% not loaded or loaded after \texttt{perpage}. +% % % \subsection{Module \xmodule{lastpage}} % @@ -1663,7 +1669,7 @@ the height difference of the two baselines is %<*package> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref} - [2022-04-07 v2.34 A new reference scheme for LaTeX (HO)]% + [2023-09-14 v2.35 A new reference scheme for LaTeX (HO)]% % \end{macrocode} % % \subsubsection{Load basic module} @@ -1750,7 +1756,7 @@ the height difference of the two baselines is %<*base> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-base}% - [2022-04-07 v2.34 Module base for zref (HO)]% + [2023-09-14 v2.35 Module base for zref (HO)]% % \end{macrocode} % % \subsubsection{Utilities} @@ -3070,7 +3076,7 @@ the height difference of the two baselines is %<*user> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-user}% - [2022-04-07 v2.34 Module user for zref (HO)]% + [2023-09-14 v2.35 Module user for zref (HO)]% \RequirePackage{zref-base}[2019/11/29] \ifx\ZREF@base@ok Y% \else @@ -3161,7 +3167,7 @@ the height difference of the two baselines is %<*abspage> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-abspage}% - [2022-04-07 v2.34 Module abspage for zref (HO)]% + [2023-09-14 v2.35 Module abspage for zref (HO)]% \RequirePackage{zref-base}[2019/11/29] \ifx\ZREF@base@ok Y% \else @@ -3171,28 +3177,32 @@ the height difference of the two baselines is % % Module \xmodule{abspage} adds a new property \verb|abspage| % to the \verb|main| property list for absolute page numbers. -% These are recorded by the help of package \xpackage{atbegshi}. -% \begin{macrocode} -\RequirePackage{atbegshi}[2011/10/05]% -% \end{macrocode} +% These are recorded by the help of the standard LaTeX shipout hooks. +% The count used as property is the standard LaTeX counter \verb|\ReadonlyShipoutCounter|, +% but we still provide also the counter \verb|abspage| for compability with older +% code. % The counter \verb|abspage| must not go in the clear list % of \verb|@ckpt| that is used to set counters in % \xfile{.aux} files of included \hologo{TeX} files. % \begin{macrocode} \begingroup - \let\@addtoreset\ltx@gobbletwo - \newcounter{abspage}% + \@ifundefined{c@abspage} + {% + \let\@addtoreset\ltx@gobbletwo + \newcounter{abspage}% + }{} \endgroup \setcounter{abspage}{0}% -\AtBeginShipout{% +\AddToHook{shipout/before}{% \stepcounter{abspage}% }% -\zref@newprop*{abspage}[0]{\the\c@abspage}% +\zref@newprop*{abspage}[0]{\the\ReadonlyShipoutCounter}% \zref@addprop\ZREF@mainlist{abspage}% % \end{macrocode} -% Note that counter \verb|abspage| shows the +% Note that counter \verb|\ReadonlyShipoutCounter| +% and \verb|abspage| show the % previous page during page processing. Before -% shipout the counter is incremented. +% shipout the counters are incremented. % Thus the property is correctly written with % deferred writing. If the counter is written % using \cs{zref@wrapper@immediate}, then the number @@ -3209,7 +3219,7 @@ the height difference of the two baselines is %<*counter> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-counter}% - [2022-04-07 v2.34 Module counter for zref (HO)]% + [2023-09-14 v2.35 Module counter for zref (HO)]% \RequirePackage{zref-base}[2019/11/29] \ifx\ZREF@base@ok Y% \else @@ -3254,10 +3264,9 @@ the height difference of the two baselines is %<*lastpage> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-lastpage}% - [2022-04-07 v2.34 Module lastpage for zref (HO)]% + [2023-09-14 v2.35 Module lastpage for zref (HO)]% \RequirePackage{zref-base}[2019/11/29] \RequirePackage{zref-abspage}[2019/11/29] -\RequirePackage{atveryend}[2009/12/07] \ifx\ZREF@base@ok Y% \else \expandafter\endinput @@ -3272,7 +3281,7 @@ the height difference of the two baselines is % the main property list are used. % \begin{macrocode} \zref@newlist{LastPage} -\AfterLastShipout{% +\AddToHook {enddocument/afterlastpage}{% \if@filesw \begingroup \advance\c@page\m@ne @@ -3326,7 +3335,7 @@ the height difference of the two baselines is %<*thepage> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-thepage}% - [2022-04-07 v2.34 Module thepage for zref (HO)]% + [2023-09-14 v2.35 Module thepage for zref (HO)]% \RequirePackage{zref-base}[2019/11/29] \ifx\ZREF@base@ok Y% \else @@ -3350,7 +3359,7 @@ the height difference of the two baselines is % \end{macro} % \begin{macrocode} \zref@addprop{thepage}{pagevalue} -\AtBeginShipout{% +\AddToHook{shipout/before}{% \AtBeginShipoutAddToBox{% \zref@thepage@atbegshi@hook \zref@labelbylist{thepage\the\value{abspage}}{thepage}% @@ -3401,7 +3410,7 @@ the height difference of the two baselines is %<*nextpage> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-nextpage}% - [2022-04-07 v2.34 Module nextpage for zref (HO)]% + [2023-09-14 v2.35 Module nextpage for zref (HO)]% \RequirePackage{zref-base}[2019/11/29] \ifx\ZREF@base@ok Y% \else @@ -3505,7 +3514,7 @@ the height difference of the two baselines is %<*totpages> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-totpages}% - [2022-04-07 v2.34 Module totpages for zref (HO)]% + [2023-09-14 v2.35 Module totpages for zref (HO)]% \RequirePackage{zref-base}[2019/11/29] \ifx\ZREF@base@ok Y% \else @@ -3547,7 +3556,7 @@ the height difference of the two baselines is %<*pagelayout> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-pagelayout}% - [2022-04-07 v2.34 Module pagelayout for zref (HO)]% + [2023-09-14 v2.35 Module pagelayout for zref (HO)]% \RequirePackage{zref-base}[2019/11/29] \ifx\ZREF@base@ok Y% \else @@ -3558,7 +3567,6 @@ the height difference of the two baselines is % \begin{macrocode} \RequirePackage{zref-thepage}[2019/11/29] \RequirePackage{iftex}[2019/11/07]% -\RequirePackage{atveryend}[2010/03/24] % \end{macrocode} % % @@ -3675,7 +3683,7 @@ the height difference of the two baselines is \fi }% }{}% - \AtVeryEndDocument{\ZREF@pl@AtVeryEnd}% + \AddToHook{enddocument/afteraux}{\ZREF@pl@AtVeryEnd}% \fi } % \end{macrocode} @@ -3763,7 +3771,7 @@ the height difference of the two baselines is % \end{macrocode} % \end{macro} % \begin{macrocode} -\AfterLastShipout{% +\AddToHook {enddocument/afterlastpage}{% \ZREF@pl@AfterLastShipout } % \end{macrocode} @@ -3779,7 +3787,7 @@ the height difference of the two baselines is %<*pageattr> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-pageattr}% - [2022-04-07 v2.34 Module pageattr for zref (HO)]% + [2023-09-14 v2.35 Module pageattr for zref (HO)]% \RequirePackage{zref-base}[2019/11/29] \ifx\ZREF@base@ok Y% \else @@ -3842,7 +3850,6 @@ the height difference of the two baselines is % \end{macrocode} % \begin{macrocode} \RequirePackage{zref-abspage}[2019/11/29] -\RequirePackage{atveryend}[2010/03/24] \RequirePackage{pdftexcmds}[2010/04/01] \let\ZREF@temp=Y% \ltx@IfUndefined{pdf@escapehex}{\let\ZREF@temp=N}{} @@ -3883,7 +3890,7 @@ the height difference of the two baselines is \fi }% }{}% - \AtVeryEndDocument{\ZREF@pa@AtVeryEnd}% + \AddToHook{enddocument/afteraux}{\ZREF@pa@AtVeryEnd}% \fi } % \end{macrocode} @@ -3996,7 +4003,7 @@ the height difference of the two baselines is }% }% } -\AfterLastShipout{% +\AddToHook {enddocument/afterlastpage}{% \ZREF@pa@AfterLastShipout } % \end{macrocode} @@ -4011,7 +4018,7 @@ the height difference of the two baselines is %<*marks> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-marks}% - [2022-04-07 v2.34 Module marks for zref (HO)]% + [2023-09-14 v2.35 Module marks for zref (HO)]% \RequirePackage{zref-base}[2019/11/29] \ifx\ZREF@base@ok Y% \else @@ -4117,7 +4124,7 @@ the height difference of the two baselines is %<*runs> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-runs}% - [2022-04-07 v2.34 Module runs for zref (HO)]% + [2023-09-14 v2.35 Module runs for zref (HO)]% % \end{macrocode} % % \begin{macro}{\zruns} @@ -4149,7 +4156,7 @@ the height difference of the two baselines is %<*perpage> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-perpage}% - [2022-04-07 v2.34 Module perpage for zref (HO)]% + [2023-09-14 v2.35 Module perpage for zref (HO)]% \RequirePackage{zref-base}[2019/11/29] \ifx\ZREF@base@ok Y% \else @@ -4352,7 +4359,7 @@ the height difference of the two baselines is %<*titleref> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-titleref}% - [2022-04-07 v2.34 Module titleref for zref (HO)]% + [2023-09-14 v2.35 Module titleref for zref (HO)]% \RequirePackage{zref-base}[2019/11/29] \ifx\ZREF@base@ok Y% \else @@ -4765,7 +4772,7 @@ the height difference of the two baselines is %<*xr> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-xr}% - [2022-04-07 v2.34 Module xr for zref (HO)]% + [2023-09-14 v2.35 Module xr for zref (HO)]% \RequirePackage{zref-base}[2019/11/29] \ifx\ZREF@base@ok Y% \else @@ -5301,7 +5308,7 @@ the height difference of the two baselines is %<*hyperref> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-hyperref}% - [2022-04-07 v2.34 Module hyperref for zref (HO)]% + [2023-09-14 v2.35 Module hyperref for zref (HO)]% \RequirePackage{zref-base}[2019/11/29] \ifx\ZREF@base@ok Y% \else @@ -5331,7 +5338,7 @@ the height difference of the two baselines is %<*savepos> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-savepos}% - [2022-04-07 v2.34 Module savepos for zref (HO)]% + [2023-09-14 v2.35 Module savepos for zref (HO)]% \RequirePackage{zref-base}[2019/11/29] \ifx\ZREF@base@ok Y% \else @@ -5504,7 +5511,7 @@ the height difference of the two baselines is %<*abspos> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-abspos}% - [2022-04-07 v2.34 Module abspos for zref (HO)]% + [2023-09-14 v2.35 Module abspos for zref (HO)]% \RequirePackage{zref-base}[2019/11/29] \ifx\ZREF@base@ok Y% \else @@ -5709,16 +5716,22 @@ the height difference of the two baselines is % % \subsubsection{Media} % +% Ensure that |\stockwidth| and |\stockheight| are defined +% \begin{macrocode} +\@ifundefined{stockwidth}{\newdimen\stockwidth}{} +\@ifundefined{stockheight}{\newdimen\stockheight}{} +% \end{macrocode} +% % \begin{macro}{\ZREF@abspos@media@width} % \begin{macrocode} \edef\ZREF@abspos@media@width{% \ltx@ifundefined{pdfpagewidth}{% \ltx@ifundefined{mediawidth}{% - \ltx@ifundefined{stockwidth}{% - paperwidth% - }{% + \ifdim\stockwidth > \z@ stockwidth% - }% + \else + paperwidth% + \fi }{% mediawidth% }% @@ -5736,21 +5749,21 @@ the height difference of the two baselines is \edef\ZREF@abspos@media@height{% \ltx@ifundefined{pdfpageheight}{% \ltx@ifundefined{mediaheight}{% - \ltx@ifundefined{stockheight}{% - paperheight% - }{% + \ifdim\stockwidth > \z@ stockheight% - }% + \else + paperheight% + \fi }{% mediaheight% }% }{% \noexpand\ifcase\pdfpageheight - \ltx@ifundefined{stockheight}{% - paperheight% - }{% + \ifdim\stockwidth > \z@ stockheight% - }% + \else + paperheight% + \fi \noexpand\else pdfpageheight% \noexpand\fi @@ -5759,11 +5772,11 @@ the height difference of the two baselines is \ifluatex \edef\ZREF@abspos@media@height{% \noexpand\ifcase\pageheight - \ltx@ifundefined{stockheight}{% - paperheight% - }{% + \ifdim\stockwidth > \z@ stockheight% - }% + \else + paperheight% + \fi \noexpand\else pdfpageheight% \noexpand\fi}% @@ -6158,7 +6171,7 @@ the height difference of the two baselines is %<*dotfill> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-dotfill}% - [2022-04-07 v2.34 Module dotfill for zref (HO)]% + [2023-09-14 v2.35 Module dotfill for zref (HO)]% \RequirePackage{zref-base}[2019/11/29] \ifx\ZREF@base@ok Y% \else @@ -6258,7 +6271,7 @@ the height difference of the two baselines is %<*env> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{zref-env}% - [2022-04-07 v2.34 Module env for zref (HO)]% + [2023-09-14 v2.35 Module env for zref (HO)]% \RequirePackage{zref-base}[2019/11/29] \ifx\ZREF@base@ok Y% \else @@ -6798,8 +6811,14 @@ the height difference of the two baselines is % https://github.com/ho-tex/zref/issues/10 % \end{Version} % \begin{Version}{2022-04-07 v2.34} -% \item Updated +% \item use the \texttt{zref@unique} counter in the include hook only if the module needs it +% https://github.com/ho-tex/zref/issues/14 % \end{Version} +% \begin{Version}{2023-09-14 v.2.35} +% \item Define the abspage counter only if it is undefined +% https://github.com/ho-tex/zref/issues/14 +% \item Remove dependency from atveryend. +% \end{Version} % \end{History} % % \PrintIndex |