From e577cb21614559514b4fb48bbd0a9f3cbb78b467 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 7 Oct 2023 20:15:04 +0000 Subject: lastpage (7oct23) git-svn-id: svn://tug.org/texlive/trunk@68473 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/lastpage/README | 2 +- .../doc/latex/lastpage/lastpage-example.pdf | Bin 129330 -> 130402 bytes .../doc/latex/lastpage/lastpage-example.tex | 22 +-- Master/texmf-dist/doc/latex/lastpage/lastpage.pdf | Bin 439739 -> 447012 bytes .../texmf-dist/source/latex/lastpage/lastpage.drv | 7 +- .../texmf-dist/source/latex/lastpage/lastpage.dtx | 206 +++++++++++++++------ .../texmf-dist/source/latex/lastpage/lastpage.ins | 12 +- Master/texmf-dist/tex/latex/lastpage/lastpage.sty | 7 +- .../texmf-dist/tex/latex/lastpage/lastpage209.sty | 5 +- .../texmf-dist/tex/latex/lastpage/lastpage2e.sty | 7 +- .../tex/latex/lastpage/lastpageclassic.sty | 7 +- .../tex/latex/lastpage/lastpagemodern.sty | 58 ++++-- 12 files changed, 227 insertions(+), 106 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/lastpage/README b/Master/texmf-dist/doc/latex/lastpage/README index a22d2498f1c..db1183b2e4f 100644 --- a/Master/texmf-dist/doc/latex/lastpage/README +++ b/Master/texmf-dist/doc/latex/lastpage/README @@ -1,4 +1,4 @@ -README for lastpage package, 2023-07-24, v2.0c +README for lastpage package, 2023-10-06, v2.0d TABLE OF CONTENTS diff --git a/Master/texmf-dist/doc/latex/lastpage/lastpage-example.pdf b/Master/texmf-dist/doc/latex/lastpage/lastpage-example.pdf index 547293f4010..fa09069a0a6 100644 Binary files a/Master/texmf-dist/doc/latex/lastpage/lastpage-example.pdf and b/Master/texmf-dist/doc/latex/lastpage/lastpage-example.pdf differ diff --git a/Master/texmf-dist/doc/latex/lastpage/lastpage-example.tex b/Master/texmf-dist/doc/latex/lastpage/lastpage-example.tex index f11a6ecd723..92b2bd1f13e 100644 --- a/Master/texmf-dist/doc/latex/lastpage/lastpage-example.tex +++ b/Master/texmf-dist/doc/latex/lastpage/lastpage-example.tex @@ -9,7 +9,7 @@ %% This is a generated file. %% %% Project: lastpage -%% Version: 2023-07-24 v2.0c +%% Version: 2023-10-06 v2.0d %% Info: Refers to last page's name %% %% Copyright (C) 2010 - 2023 by @@ -40,7 +40,8 @@ %% %% While this package allows for things like "Page slash thepage{} of slash pageref{LastPage}" %% to get "Page 7 of 9" or "Page VII of IX", -%% the NUMBER of pages is nowadays available via slash @abspage@last from the kernel, +%% the NUMBER of pages is nowadays available from the kernel +%% (slash @abspage@last, slash thetotalpages, slash PreviousTotalPages), %% but with pages for example I to X and then 1 to 10, the number of pages would be "20", %% while the name of the last page is "10". Decide what you need/want! %% @@ -79,7 +80,7 @@ pdfpagelayout=SinglePage% } \@ifpackageloaded{hyperref}{}{\usepackage{url}[2013/09/16]}% v3.4 -\usepackage{lastpage}[2023-07-24]% v2.0c +\usepackage{lastpage}[2023-10-06]% v2.0d \renewcommand{\@evenfoot}{% \normalsize\slshape \today\hfil \upshape % page \thepage{} of \pageref{LastPage}} @@ -91,7 +92,7 @@ \section*{Example for lastpage} \markboth{Example for lastpage}{Example for lastpage} This example demonstrates the use of package\newline -\textsf{lastpage}, v2.0c as of 2023-07-24 (HMM; JPG).\newline +\textsf{lastpage}, v2.0d as of 2023-10-06 (HMM; JPG).\newline The package takes no options.\newline For more details please see the documentation!\newline @@ -116,7 +117,7 @@ trademark owner. There is no intention of infringement; the usage is to the benefit of the trademark owner.\newline \textbf{Tip}: Use \textit{logical page numbers} -for the display of the pdf (in Adobe Acrobat Reader 2023.003.20244: +for the display of the pdf (in Adobe Acrobat Reader 2023.006.20320: Edit $>$ Preferences $>$ Page Display $>$ Page Content and Information: Use logical page numbers)!\newline @@ -164,7 +165,7 @@ The code does not generally work even without hyperref. \addtocounter{page}{8} \edef\here{\thepage} \makeatletter -\ifx\here\lastpage@lastpage\relax foo \else bar \fi +\ifx\here\lastpage@lastpage\relax foo\else bar\fi \makeatother \end{document} \end{verbatim} @@ -178,7 +179,8 @@ Page \thepage{} is (not) page \makeatletter\lastpage@lastpage\makeatother. prints:\newline Page \thepage{} is (not) page \makeatletter\lastpage@lastpage\makeatother. \newline -This can be broken for example by \verb|\pagenumbering{fnsymbol}|. +This can be broken for example by \verb|\pagenumbering{fnsymbol}| +(because then \verb|\edef\here{\thepage}| does not work). \newpage \noindent The page (\verb|\thepage|): \thepage\newline @@ -188,23 +190,21 @@ Last page's name (LastPage): \pageref{LastPage} With modern \LaTeX{} it is possible to say: \begin{quote} \begin{verbatim} -\NeedsTeXFormat{LaTeX2e}[2022-11-01] +\NeedsTeXFormat{LaTeX2e}[2023-06-01] \documentclass{article} \pagenumbering{fnsymbol} \begin{document} \addtocounter{page}{8}% -\makeatletter% \ExplSyntaxOn% \xdef\test{\numexpr\the\g_shipout_readonly_int +1\relax}% \ExplSyntaxOff% -\ifnum \@abspage@last = \test\relax% +\ifnum\PreviousTotalPages=\test\relax% This is the last page.% \else% This is not the last page (or it is but \LaTeX{} needs another compilation run to detect this). \fi -\makeatother \end{document} \end{verbatim} \end{quote} diff --git a/Master/texmf-dist/doc/latex/lastpage/lastpage.pdf b/Master/texmf-dist/doc/latex/lastpage/lastpage.pdf index 064afaac10b..5b6d0028228 100644 Binary files a/Master/texmf-dist/doc/latex/lastpage/lastpage.pdf and b/Master/texmf-dist/doc/latex/lastpage/lastpage.pdf differ diff --git a/Master/texmf-dist/source/latex/lastpage/lastpage.drv b/Master/texmf-dist/source/latex/lastpage/lastpage.drv index e513f8d6ada..cad4a539458 100644 --- a/Master/texmf-dist/source/latex/lastpage/lastpage.drv +++ b/Master/texmf-dist/source/latex/lastpage/lastpage.drv @@ -9,7 +9,7 @@ %% This is a generated file. %% %% Project: lastpage -%% Version: 2023-07-24 v2.0c +%% Version: 2023-10-06 v2.0d %% Info: Refers to last page's name %% %% Copyright (C) 2010 - 2023 by @@ -40,7 +40,8 @@ %% %% While this package allows for things like "Page slash thepage{} of slash pageref{LastPage}" %% to get "Page 7 of 9" or "Page VII of IX", -%% the NUMBER of pages is nowadays available via slash @abspage@last from the kernel, +%% the NUMBER of pages is nowadays available from the kernel +%% (slash @abspage@last, slash thetotalpages, slash PreviousTotalPages), %% but with pages for example I to X and then 1 to 10, the number of pages would be "20", %% while the name of the last page is "10". Decide what you need/want! %% @@ -58,7 +59,7 @@ %% \NeedsTeXFormat{LaTeX2e}[2022-11-01] \ProvidesFile{lastpage.drv}% - [2023-07-24 v2.0c Refers to last page's name (HMM)] + [2023-10-06 v2.0d Refers to last page's name (HMM)] \documentclass{ltxdoc}[2023/03/28]% v2.1j Standard LaTeX documentation class \usepackage{holtxdoc}[2019/12/09]% v0.30 Private additional ltxdoc support (HO) \hypersetup{% diff --git a/Master/texmf-dist/source/latex/lastpage/lastpage.dtx b/Master/texmf-dist/source/latex/lastpage/lastpage.dtx index ce1a71ad79d..f5352a3dbee 100644 --- a/Master/texmf-dist/source/latex/lastpage/lastpage.dtx +++ b/Master/texmf-dist/source/latex/lastpage/lastpage.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % File: lastpage.dtx -% Version: 2023-07-24 v2.0c +% Version: 2023-10-06 v2.0d % Info: Refers to last page's name % % Copyright © 2010 - 2023 by @@ -18,7 +18,8 @@ % % While this package allows for things like "Page \thepage{} of \pageref{LastPage}" % to get "Page 7 of 9" or "Page VII of IX", -% the NUMBER of pages is nowadays available via \@abspage@last from the kernel, +% the NUMBER of pages is nowadays available from the kernel +% (\@abspage@last, \thetotalpages, \PreviousTotalPages), % but with pages for example I to X and then 1 to 10, the number of pages would be "20", % while the name of the last page is "10". Decide what you need/want! % @@ -65,7 +66,7 @@ \input docstrip.tex \Msg{**********************************************************************} \Msg{* Installation *} -\Msg{* Package: lastpage 2023-07-24 v2.0c Refers to last page's name (HMM)*} +\Msg{* Package: lastpage 2023-10-06 v2.0d Refers to last page's name (HMM)*} \Msg{**********************************************************************} \keepsilent @@ -77,7 +78,7 @@ This is a generated file. Project: lastpage -Version: 2023-07-24 v2.0c +Version: 2023-10-06 v2.0d Info: Refers to last page's name Copyright (C) 2010 - 2023 by @@ -108,7 +109,8 @@ Thanks go to Jeffrey P. Goldberg for allowing me to do this. While this package allows for things like "Page slash thepage{} of slash pageref{LastPage}" to get "Page 7 of 9" or "Page VII of IX", -the NUMBER of pages is nowadays available via slash @abspage@last from the kernel, +the NUMBER of pages is nowadays available from the kernel +(slash @abspage@last, slash thetotalpages, slash PreviousTotalPages), but with pages for example I to X and then 1 to 10, the number of pages would be "20", while the name of the last page is "10". Decide what you need/want! @@ -184,7 +186,7 @@ In memoriam %<*driver> \NeedsTeXFormat{LaTeX2e}[2022-11-01] \ProvidesFile{lastpage.drv}% - [2023-07-24 v2.0c Refers to last page's name (HMM)] + [2023-10-06 v2.0d Refers to last page's name (HMM)] \documentclass{ltxdoc}[2023/03/28]% v2.1j Standard LaTeX documentation class \usepackage{holtxdoc}[2019/12/09]% v0.30 Private additional ltxdoc support (HO) \hypersetup{% @@ -237,19 +239,19 @@ In memoriam % \DoNotIndex{\enddocument,\ExplSyntaxOff,\ExplSyntaxOn,\fmtversion} % \DoNotIndex{\g,\gdef,\here,\hfil,\Hy@temp,\Hy@unicodefalse} % \DoNotIndex{\hypersetup,\if@filesw,\if@nobreak,\ifHy@hypertexnames,\ifHy@pageanchor,\ifHy@plainpages} -% \DoNotIndex{\ifnum,\IfPackageAtLeastTF,\IfPackageLoadedTF,\ifvmode,\ifx,\immediate,\input} +% \DoNotIndex{\ifdim,\ifnum,\IfPackageAtLeastTF,\IfPackageLoadedTF,\ifvmode,\ifx,\immediate,\input} % \DoNotIndex{\label,\lastpage,\lastpage-example.tex,\lastpage.dtx,\lastpage.sty,\lastpagee.sty} -% \DoNotIndex{\lastpageclassic.sty,\lastpagemodern.sty,\LaTeX,\listfiles} +% \DoNotIndex{\lastpageclassic.sty,\lastpagemodern.sty,\LaTeX,\LaTeX-kernel,\listfiles} % \DoNotIndex{\makeatletter,\makeatother,\markboth,\mbox,\message,\MessageBreak} -% \DoNotIndex{\NeedsTeXFormat,\newcommand,\newline,\newpage,\nobreak} +% \DoNotIndex{\NeedsTeXFormat,\newcommand,\newcounter,\newline,\newpage,\nobreak} % \DoNotIndex{\noindent,\normalsize,\numexpr,\origenddocument,\PackageError} % \DoNotIndex{\PackageWarning,\pagenumbering,\pageref,\pdfstringdef,\protect,\ProvidesPackage} -% \DoNotIndex{\qquad,\RequirePackage,\section,\slshape,\smallskip,\space,\test,\textbf} +% \DoNotIndex{\qquad,\RequirePackage,\section,\ShowHook,\slshape,\smallskip,\space,\test,\textbf} % \DoNotIndex{\textit,\textquotedblleft,\textquotedblright,\textsf,\texttt,\the,\thepage} -% \DoNotIndex{\today,\upshape,\url,\usepackage,\value,\verb,\write} +% \DoNotIndex{\today,\upshape,\url,\usepackage,\value,\verb,\wd,\write} % % \title{The \xpackage{lastpage} package} -% \date{2023-07-24 v2.0c} +% \date{2023-10-06 v2.0d} % \author{H.-Martin Münch\\\xemail{Martin.Muench at Uni-Bonn.de}\\ % invented by Jeffrey P. Goldberg\\\xemail{jeffrey+news at goldmark.org}} % @@ -264,7 +266,8 @@ In memoriam % \hbox{\textquotedblleft Page} \hbox{|\thepage{}|} of |\pageref{LastPage}|\textquotedblright{} % to get \textquotedblleft Page 7 of 9\textquotedblright{} or % \textquotedblleft Page VII of IX\textquotedblright, -% the \emph{number} of pages is nowadays available via |\@abspage@last| from the kernel, +% the \emph{number} of pages is nowadays available from the kernel +% (|\@abspage@last|, |\thetotalpages|, |\PreviousTotalPages|), % but when more than one page numbering scheme is used % (for example pages I~to X and then 1~to 10, % thus number of pages \hbox{\textquotedblleft 20\textquotedblright ,} @@ -360,8 +363,8 @@ In memoriam % \xpackage{lastpage} package.\bigbreak % % If the total \emph{number} of pages of a document is needed, -% the kernel already gives this by |\makeatletter\@abspage@last\makeatother| -% (needs at least two compiler runs). +% the kernel already gives this by |\makeatletter\@abspage@last\makeatother|, +% |\thetotalpages|, and |\PreviousTotalPages| (needing at least two compiler runs). % \newpage % % \section{Some \textsc{Warnings}\label{sec:warn}} @@ -459,7 +462,8 @@ In memoriam % \textquotedblleft 36\textquotedblright{} as reference to the last page. % While this is correct, the total number of pages is $42$.\newline % If the total \emph{number} of pages of a document is needed, -% the kernel already gives this by |\makeatletter\@abspage@last\makeatother|. +% the kernel already gives this by |\makeatletter\@abspage@last\makeatother|, +% |\thetotalpages|, and |\PreviousTotalPages|. % The \xpackage{pageslts} package puts |\lastpageref{LastPages}| % (with \textbf{s} at the end) at your disposal for remediation, % giving the number of pages and linking to the last page, if linking is provided @@ -473,8 +477,9 @@ In memoriam % scheme of that page).\newline % The \xpackage{pageslts} package puts |\lastpageref{LastPages}| % (with \textbf{s} at the end) at your disposal for remediation: -% \texttt{LastPages} ignores page number manipulation. Also |\@abspage@last| -% from the kernel is not influenced by page number manipulation. +% \texttt{LastPages} ignores page number manipulation. Also |\@abspage@last|, +% |\thetotalpages|, and |\PreviousTotalPages| from the kernel +% are not influenced by page number manipulation. % % \subsection{Page number reset by \texttt{\textbackslash pagenumbering\{\ldots\}}} % At a page numbering change the page number is reset to one. @@ -702,14 +707,16 @@ In memoriam % % \DescribeMacro{LaTeX-kernel}\vspace{-\baselineskip} % \begin{description} -% \item[-] The number of pages is nowadays available via |\@abspage@last| -% from the kernel, but when more than one page numbering scheme is used +% \item[-] The number of pages is nowadays available via |\@abspage@last|, +% |\thetotalpages|, and |\PreviousTotalPages| from the kernel, +% but when more than one page numbering scheme is used % (for example pages I~to X and then 1~to 10, thus number of pages % \hbox{\textquotedblleft 20\textquotedblright ,} but name of the last page % \hbox{\textquotedblleft 10\textquotedblright ),} % or when or the fnsymbol page numbering scheme is used, or another package % has output after this package, or the page numbers exceed a certain range, -% there might be problems. +% there might be issues. (Is the total number of pages wanted? Or is the name +% of the last page sought?) % \end{description} % % \bigskip @@ -749,7 +756,7 @@ In memoriam pdfpagelayout=SinglePage% } \@ifpackageloaded{hyperref}{}{\usepackage{url}[2013/09/16]}% v3.4 -\usepackage{lastpage}[2023-07-24]% v2.0c +\usepackage{lastpage}[2023-10-06]% v2.0d \renewcommand{\@evenfoot}{% \normalsize\slshape \today\hfil \upshape % page \thepage{} of \pageref{LastPage}} @@ -761,7 +768,7 @@ In memoriam \section*{Example for lastpage} \markboth{Example for lastpage}{Example for lastpage} This example demonstrates the use of package\newline -\textsf{lastpage}, v2.0c as of 2023-07-24 (HMM; JPG).\newline +\textsf{lastpage}, v2.0d as of 2023-10-06 (HMM; JPG).\newline The package takes no options.\newline For more details please see the documentation!\newline @@ -786,7 +793,7 @@ trademark owner. There is no intention of infringement; the usage is to the benefit of the trademark owner.\newline \textbf{Tip}: Use \textit{logical page numbers} -for the display of the pdf (in Adobe Acrobat Reader 2023.003.20244: +for the display of the pdf (in Adobe Acrobat Reader 2023.006.20320: Edit $>$ Preferences $>$ Page Display $>$ Page Content and Information: Use logical page numbers)!\newline @@ -834,7 +841,7 @@ The code does not generally work even without hyperref. \addtocounter{page}{8} \edef\here{\thepage} \makeatletter -\ifx\here\lastpage@lastpage\relax foo \else bar \fi +\ifx\here\lastpage@lastpage\relax foo\else bar\fi \makeatother \end{document} \end{verbatim} @@ -848,7 +855,8 @@ Page \thepage{} is (not) page \makeatletter\lastpage@lastpage\makeatother. prints:\newline Page \thepage{} is (not) page \makeatletter\lastpage@lastpage\makeatother. \newline -This can be broken for example by \verb|\pagenumbering{fnsymbol}|. +This can be broken for example by \verb|\pagenumbering{fnsymbol}| +(because then \verb|\edef\here{\thepage}| does not work). \newpage \noindent The page (\verb|\thepage|): \thepage\newline @@ -858,23 +866,21 @@ Last page's name (LastPage): \pageref{LastPage} With modern \LaTeX{} it is possible to say: \begin{quote} \begin{verbatim} -\NeedsTeXFormat{LaTeX2e}[2022-11-01] +\NeedsTeXFormat{LaTeX2e}[2023-06-01] \documentclass{article} \pagenumbering{fnsymbol} \begin{document} \addtocounter{page}{8}% -\makeatletter% \ExplSyntaxOn% \xdef\test{\numexpr\the\g_shipout_readonly_int +1\relax}% \ExplSyntaxOff% -\ifnum \@abspage@last = \test\relax% +\ifnum\PreviousTotalPages=\test\relax% This is the last page.% \else% This is not the last page (or it is but \LaTeX{} needs another compilation run to detect this). \fi -\makeatother \end{document} \end{verbatim} \end{quote} @@ -898,7 +904,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \DescribeMacro{lastpage.sty} % We first need to determine whether we are on \TeX~2.09 or \LaTeX2e.\newline % (That line, which is too long for the documentation, reads:\newline -% |\def\loadlastpage{\ProvidesPackage{lastpage}[2023/07/24 v2.0c lastpage:|\linebreak +% |\def\loadlastpage{\ProvidesPackage{lastpage}[2023/10/06 v2.0d lastpage:|\linebreak % | 2.09 or 2e? (HMM)]\relax\RequirePackage{lastpage2e}}|.) % % \begin{macrocode} @@ -906,7 +912,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook %% Part of the "lastpage" package %% loads either lastpage2.09.sty for TeX 2.09 or lastpage2e.sty for LaTeX 2e %% with code from https://groups.google.com/g/comp.text.tex/c/-Qmhj1ZI4xM -\def\loadlastpage{\ProvidesPackage{lastpage}[2023/07/24 v2.0c lastpage: 2.09 or 2e? (HMM)]\relax\RequirePackage{lastpage2e}} +\def\loadlastpage{\ProvidesPackage{lastpage}[2023/10/06 v2.0d lastpage: 2.09 or 2e? (HMM)]\relax\RequirePackage{lastpage2e}} \begingroup \expandafter \ifx \csname documentclass\endcsname\relax \endgroup \expandafter \input{lastpage209.sty} \else \endgroup \expandafter \loadlastpage @@ -946,7 +952,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook %<*lastpage2e> %% Part of the "lastpage" package \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{lastpage2e}[2023/07/24 v2.0c % +\ProvidesPackage{lastpage2e}[2023/10/06 v2.0d % Decide which 2e lastpage version to use (HMM)] \@ifl@t@r\fmtversion{2022/11/01}{\RequirePackage{lastpagemodern}}{% \RequirePackage{lastpageclassic}} @@ -961,7 +967,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook %<*lastpageclassic> %% Part of the "lastpage" package \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{lastpageclassic}[2023/07/24 v2.0c % +\ProvidesPackage{lastpageclassic}[2023/10/06 v2.0d % Refers to last page's name (HMM; JPG)] %% allows for things like "Page \thepage{} of \pageref{LastPage}" %% to get "Page 7 of 9" @@ -1375,12 +1381,12 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook %<*lastpagemodern> %% Part of the "lastpage" package \NeedsTeXFormat{LaTeX2e}[2022-11-01] -\ProvidesPackage{lastpagemodern}[2023-07-24 v2.0c % +\ProvidesPackage{lastpagemodern}[2023-10-06 v2.0d % Refers to last page's name (HMM; JPG)] %% allows for things like "Page \thepage{} of \pageref{LastPage}" %% to get "Page 7 of 9" or "Page VII of IX"; %% the NUMBER of pages is available via \@abspage@last, but with pages -%% for example I to X and then 1 to 10, the number of pages woud be "20", +%% for example I to X and then 1 to 10, the number of pages would be "20", %% while the name of the last page is "10". Decide what you need/want! % \end{macrocode} @@ -1403,6 +1409,53 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \end{macrocode} % +% People use the label |LastPage| for calculations, for example with +% \begin{quote} +%\begin{verbatim} +%\getrefbykeydefault{LastPage}{page}{0} +%\end{verbatim} +% \end{quote} +% and with +% \begin{quote} +%\begin{verbatim} +%\getpagerefnumber{LastPage} +%\end{verbatim} +% \end{quote} +% (using the \pkg{refcount} package). On the one hand, direct calculations do not work, +% if the page \textquotedblleft number\textquotedblright{} is not +% a plain arabic number (1, 2, 3,\ldots) but |alph| (a, b, c,\ldots), |Alph| (A, B, C,\ldots), +% |roman| (i, ii, iii, iv,\ldots), |Roman| (I, II, III, IV,\ldots), +% |fnsymbol| (foot note symbols: \textasteriskcentered{} (asterisk), \textdagger{} (dagger), +% \textdaggerdbl{} (double dagger), \textsection{} (section symbol),\ldots) or some other fancy name. +% On the other hand, if the page number \emph{is} a plain arabic number, +% calculations do work, if that plain number can be extracted from the label. +% To handle non-numeric page \textquotedblleft number\textquotedblright{} as well as providing +% extractable numeric page numbers, we need to determine (later), whether a page number is numeric or not: +% +% \begin{macro}{\lastpage@gobbleminus} +% \begin{macrocode} +\newcommand\lastpage@gobbleminus[1]{\ifx-#1\else#1\fi} +%% from https://texfaq.org/FAQ-isitanum + +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\newcounter{lastpagecount} + +% \end{macrocode} +% \begin{macro}{\lastpage@IfNumericTF} +% \begin{macrocode} +\newcommand{\lastpage@IfNumericTF}[3]{% +%% similar to https://tex.stackexchange.com/a/17119 +\sbox\z@{\c@lastpagecount=0\lastpage@gobbleminus{#1}\relax}% +\ifdim\wd0>\z@\relax#3% is not numeric +\else#2% is numeric +\fi% +} + +% \end{macrocode} +% \end{macro} +% % \DescribeMacro{\AddToHook\{begindocument/end\}} % \indent |\lastpage@putlabel|, used by older versions of this package, % is redefined e.\,g. by \xpackage{revtex}, \xpackage{frenchle}, @@ -1422,7 +1475,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % % \begin{macro}{\protected@iwrite} % \indent We need an |\immediate\protected@write|. Just |\immediate\write| had led to errors, -% for example when pakets like \pkg{babel-greek} re-defined |\roman|\ % +% for example when packages like \pkg{babel-greek} re-defined |\roman|\ % % (thanks to Ulrike Fischer for the report). % % \begin{macrocode} @@ -1438,6 +1491,42 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook \if@nobreak\ifvmode\nobreak\fi\fi% } +% \end{macrocode} +% \end{macro} +% +% We need two macros for writing numeric and non-numeric page +% \textquotedblleft numbers\textquotedblright{} into the \xfile{aux} file: +% +% \begin{macro}{\lastpage@numeric} +% \begin{macrocode} +\newcommand{\lastpage@numeric}{\protected@iwrite\@auxout{}{% + \string\newlabel{LastPage}{% + {\@currentlabel}% + {\thepage}% + {\@currentlabelname}% + {\IfPackageLoadedTF{hyperref}{\ifHy@pageanchor page.\Hy@temp\fi% + }{\@currentHref}}% + {\@kernel@reserved@label@data}}}% + } + +% \end{macrocode} +% \end{macro} +% \begin{macro}{\lastpage@nonnumeric} +% \begin{macrocode} +\newcommand{\lastpage@nonnumeric}{\protected@iwrite\@auxout{}{% + \string\newlabel{LastPage}{% + {\@currentlabel}% + {\IfPackageLoadedTF{hyperref}{\string\begingroup% + \string\pdfstringdefDisableCommands{\string\let% + \string\TextOrMath\string\@firstoftwo}\thepage% + \string\endgroup% + }{\thepage}}% + {\@currentlabelname}% + {\IfPackageLoadedTF{hyperref}{\ifHy@pageanchor page.\Hy@temp\fi% + }{\@currentHref}}% + {\@kernel@reserved@label@data}}}% + } + % \end{macrocode} % \end{macro} % @@ -1516,18 +1605,10 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % June~2023 (\LaTeX{} release 2023-06-01), % \url{https://www.latex-project.org/news/latex2e-news/ltnews37.pdf}. % +% Here we need to distinguish between numeric page numbers, which shall be extractable, +% and non-numeric ones, which need some protection: % \begin{macrocode} - \protected@iwrite\@auxout{}{\string\newlabel{LastPage}{% - {\@currentlabel}% - {\IfPackageLoadedTF{hyperref}{\string\begingroup% - \string\pdfstringdefDisableCommands{\string\let% - \string\TextOrMath\string\@firstoftwo}\thepage% - \string\endgroup% - }{\thepage}}% - {\@currentlabelname}% - {\IfPackageLoadedTF{hyperref}{\ifHy@pageanchor page.\Hy@temp\fi% - }{\@currentHref}}% - {\@kernel@reserved@label@data}}}% + \lastpage@IfNumericTF{\thepage}{\lastpage@numeric}{\lastpage@nonnumeric}% }{\IfPackageLoadedTF{hyperref}{\protected@iwrite\@auxout{}{% \string\newlabel{LastPage}{{}{\thepage}{}{% \ifHy@pageanchor page.\Hy@temp\fi}{}}}% @@ -1549,7 +1630,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook \protected@iwrite\@auxout{}{\string\gdef\string\lastpage@lastpageHy{\lastpage@Hy}}% % \end{macrocode} % -% \noindent After the writeout we restore the page number again, +% \noindent After the write-out we restore the page number again, % since there might be other things still to be done. % % \begin{macrocode} @@ -1700,7 +1781,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \begin{description} % \item[-] \TeX, \url{https://www.CTAN.org} % -% \item[-] package \xpackage{lastpage}, 2023-07-24, v2.0c, +% \item[-] package \xpackage{lastpage}, 2023-10-06, v2.0d, % \url{https://ctan.org/pkg/lastpage} % \end{description} % @@ -1710,7 +1791,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \begin{description} % \item[-] \TeX-format \LaTeX{}, v2.09 % -% \item[-] package \xpackage{lastpage209}, 2023-07-24, v2.0c, +% \item[-] package \xpackage{lastpage209}, 2023-10-06, v2.0d, % \url{https://ctan.org/pkg/lastpage} % \end{description} % and does not work with \xpackage{hyperref}, which needs \LaTeX2e{}. @@ -1722,7 +1803,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \item[-] \TeX-format \LaTeXe{} 1994/12/01 or newer, % \url{https://www.CTAN.org} % -% \item[-] package \xpackage{lastpage}, 2023-07-24, v2.0c, +% \item[-] package \xpackage{lastpage}, 2023-10-06, v2.0d, % \url{https://ctan.org/pkg/lastpage} % \end{description} % @@ -1733,7 +1814,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \item[-] \TeX-format \LaTeXe{} between 1994/12/01 and 2022/11/01,\newline % \url{https://www.CTAN.org} % -% \item[-] package \xpackage{lastpage}, 2023-07-24, v2.0c, +% \item[-] package \xpackage{lastpage}, 2023-10-06, v2.0d, % \url{https://ctan.org/pkg/lastpage} % \end{description} % and can use @@ -1746,10 +1827,10 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % The |lastpagemodern.sty| for \LaTeXe{} (i.\,e. each document using % the \xpackage{lastpagemodern} package) requires: % \begin{description} -% \item[-] \TeX-format \LaTeXe{} 2022-11-01, better yet 2023-06-01 or newer, +% \item[-] \TeX-format \LaTeXe{} 2022-11-01, better yet 2023-06-01 or newer,\newline % \url{https://www.CTAN.org} % -% \item[-] package \xpackage{lastpage}, 2023-07-24, v2.0c, +% \item[-] package \xpackage{lastpage}, 2023-10-06, v2.0d, % \url{https://ctan.org/pkg/lastpage} % \end{description} % and can use @@ -1762,7 +1843,7 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % The |lastpage-example.tex| requires the same file as all % documents using the \xpackage{lastpage} package, i.\,e. % \begin{description} -% \item[-] package \xpackage{lastpage}, 2023-07-24, v2.0c, +% \item[-] package \xpackage{lastpage}, 2023-10-06, v2.0d, % \url{https://ctan.org/pkg/lastpage}\newline % (Well, it is the example file for this package, and because you are reading the % documentation for the \xpackage{lastpage} package, it can be assumed that you already @@ -1837,10 +1918,10 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \item[-] package \xpackage{totalcount}, 2018/01/21, v1.0a, % \url{https://ctan.org/pkg/totalcount} % -% \item[-] package \xpackage{zref}, 2022-04-07, v2.34, +% \item[-] package \xpackage{zref}, 2023-09-14, v2.35, % \url{https://ctan.org/pkg/zref} % -% \item[-] class \xpackage{memoir}, 2022-11-17, v3.7.19, +% \item[-] class \xpackage{memoir}, 2023-08-21, v3.8.1, % \url{https://ctan.org/pkg/memoir}. % \end{description} % @@ -2046,7 +2127,8 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % and the \Newsgroup{comp.text.tex} and \Newsgroup{de.comp.text.tex} % newsgroups for their help in all things \TeX{}. Thanks for bug reports % to \textsc{Ulrike Fischer} (twice), \textsc{Sebastian Bank}, \textsc{James Hedges}, -% \textsc{Mikhail Titov}, \textsc{Micha\l{} Herman}, and \textsc{Matteo Gamboz}. +% \textsc{Mikhail Titov}, \textsc{Micha\l{} Herman}, \textsc{Matteo Gamboz}, and +% \textsc{James Small}. % Thanks to \textsc{Sven Siegmund} for pointing out a necessary further % explanation in the documentation. % @@ -2181,7 +2263,6 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % pagenumbering scheme. [Fixed since v6.83m as of 2012/11/06.] % \item Documentation update about \textquotedblleft No write access to the % \xfile{aux} file\textquotedblright . -% \item New version of \xpackage{regstats} package available. % \end{Version} % \begin{Version}{2013/01/28 v1.2l} % \item Updated to \TeX{} Live 2012 (for compiling the documentation and example). @@ -2228,6 +2309,11 @@ To see the content of the \texttt{enddocument/afterlastpage}-hook % \item Update of the |\lastpage@putl@bel| code to \pkg{hyperref} 2023-07-08, v7.01b, % which now allows fnsymbol as page numbering scheme. % \end{Version} +% \begin{Version}{2023-10-06 v2.0d} +% \item For plain arabic page numbers only, \pkg{lastpage} again writes the page number +% in a plain format in the label in the \xfile{aux} file, so that it can be extracted +% to perform calculations with it. +% \end{Version} % \end{History} % \bigskip % diff --git a/Master/texmf-dist/source/latex/lastpage/lastpage.ins b/Master/texmf-dist/source/latex/lastpage/lastpage.ins index 31de85ab392..28b9beab6f7 100644 --- a/Master/texmf-dist/source/latex/lastpage/lastpage.ins +++ b/Master/texmf-dist/source/latex/lastpage/lastpage.ins @@ -9,7 +9,7 @@ %% This is a generated file. %% %% Project: lastpage -%% Version: 2023-07-24 v2.0c +%% Version: 2023-10-06 v2.0d %% Info: Refers to last page's name %% %% Copyright (C) 2010 - 2023 by @@ -40,7 +40,8 @@ %% %% While this package allows for things like "Page slash thepage{} of slash pageref{LastPage}" %% to get "Page 7 of 9" or "Page VII of IX", -%% the NUMBER of pages is nowadays available via slash @abspage@last from the kernel, +%% the NUMBER of pages is nowadays available from the kernel +%% (slash @abspage@last, slash thetotalpages, slash PreviousTotalPages), %% but with pages for example I to X and then 1 to 10, the number of pages would be "20", %% while the name of the last page is "10". Decide what you need/want! %% @@ -59,7 +60,7 @@ \input docstrip.tex \Msg{**********************************************************************} \Msg{* Installation *} -\Msg{* Package: lastpage 2023-07-24 v2.0c Refers to last page's name (HMM)*} +\Msg{* Package: lastpage 2023-10-06 v2.0d Refers to last page's name (HMM)*} \Msg{**********************************************************************} \keepsilent @@ -71,7 +72,7 @@ This is a generated file. Project: lastpage -Version: 2023-07-24 v2.0c +Version: 2023-10-06 v2.0d Info: Refers to last page's name Copyright (C) 2010 - 2023 by @@ -102,7 +103,8 @@ Thanks go to Jeffrey P. Goldberg for allowing me to do this. While this package allows for things like "Page slash thepage{} of slash pageref{LastPage}" to get "Page 7 of 9" or "Page VII of IX", -the NUMBER of pages is nowadays available via slash @abspage@last from the kernel, +the NUMBER of pages is nowadays available from the kernel +(slash @abspage@last, slash thetotalpages, slash PreviousTotalPages), but with pages for example I to X and then 1 to 10, the number of pages would be "20", while the name of the last page is "10". Decide what you need/want! diff --git a/Master/texmf-dist/tex/latex/lastpage/lastpage.sty b/Master/texmf-dist/tex/latex/lastpage/lastpage.sty index 991413af18c..7e9d25662b9 100644 --- a/Master/texmf-dist/tex/latex/lastpage/lastpage.sty +++ b/Master/texmf-dist/tex/latex/lastpage/lastpage.sty @@ -9,7 +9,7 @@ %% This is a generated file. %% %% Project: lastpage -%% Version: 2023-07-24 v2.0c +%% Version: 2023-10-06 v2.0d %% Info: Refers to last page's name %% %% Copyright (C) 2010 - 2023 by @@ -40,7 +40,8 @@ %% %% While this package allows for things like "Page slash thepage{} of slash pageref{LastPage}" %% to get "Page 7 of 9" or "Page VII of IX", -%% the NUMBER of pages is nowadays available via slash @abspage@last from the kernel, +%% the NUMBER of pages is nowadays available from the kernel +%% (slash @abspage@last, slash thetotalpages, slash PreviousTotalPages), %% but with pages for example I to X and then 1 to 10, the number of pages would be "20", %% while the name of the last page is "10". Decide what you need/want! %% @@ -59,7 +60,7 @@ %% Part of the "lastpage" package %% loads either lastpage2.09.sty for TeX 2.09 or lastpage2e.sty for LaTeX 2e %% with code from https://groups.google.com/g/comp.text.tex/c/-Qmhj1ZI4xM -\def\loadlastpage{\ProvidesPackage{lastpage}[2023/07/24 v2.0c lastpage: 2.09 or 2e? (HMM)]\relax\RequirePackage{lastpage2e}} +\def\loadlastpage{\ProvidesPackage{lastpage}[2023/10/06 v2.0d lastpage: 2.09 or 2e? (HMM)]\relax\RequirePackage{lastpage2e}} \begingroup \expandafter \ifx \csname documentclass\endcsname\relax \endgroup \expandafter \input{lastpage209.sty} \else \endgroup \expandafter \loadlastpage diff --git a/Master/texmf-dist/tex/latex/lastpage/lastpage209.sty b/Master/texmf-dist/tex/latex/lastpage/lastpage209.sty index 5f06379d259..e35c7856a6e 100644 --- a/Master/texmf-dist/tex/latex/lastpage/lastpage209.sty +++ b/Master/texmf-dist/tex/latex/lastpage/lastpage209.sty @@ -9,7 +9,7 @@ %% This is a generated file. %% %% Project: lastpage -%% Version: 2023-07-24 v2.0c +%% Version: 2023-10-06 v2.0d %% Info: Refers to last page's name %% %% Copyright (C) 2010 - 2023 by @@ -40,7 +40,8 @@ %% %% While this package allows for things like "Page slash thepage{} of slash pageref{LastPage}" %% to get "Page 7 of 9" or "Page VII of IX", -%% the NUMBER of pages is nowadays available via slash @abspage@last from the kernel, +%% the NUMBER of pages is nowadays available from the kernel +%% (slash @abspage@last, slash thetotalpages, slash PreviousTotalPages), %% but with pages for example I to X and then 1 to 10, the number of pages would be "20", %% while the name of the last page is "10". Decide what you need/want! %% diff --git a/Master/texmf-dist/tex/latex/lastpage/lastpage2e.sty b/Master/texmf-dist/tex/latex/lastpage/lastpage2e.sty index 8b983e14ffc..85a86aa898a 100644 --- a/Master/texmf-dist/tex/latex/lastpage/lastpage2e.sty +++ b/Master/texmf-dist/tex/latex/lastpage/lastpage2e.sty @@ -9,7 +9,7 @@ %% This is a generated file. %% %% Project: lastpage -%% Version: 2023-07-24 v2.0c +%% Version: 2023-10-06 v2.0d %% Info: Refers to last page's name %% %% Copyright (C) 2010 - 2023 by @@ -40,7 +40,8 @@ %% %% While this package allows for things like "Page slash thepage{} of slash pageref{LastPage}" %% to get "Page 7 of 9" or "Page VII of IX", -%% the NUMBER of pages is nowadays available via slash @abspage@last from the kernel, +%% the NUMBER of pages is nowadays available from the kernel +%% (slash @abspage@last, slash thetotalpages, slash PreviousTotalPages), %% but with pages for example I to X and then 1 to 10, the number of pages would be "20", %% while the name of the last page is "10". Decide what you need/want! %% @@ -58,7 +59,7 @@ %% %% Part of the "lastpage" package \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{lastpage2e}[2023/07/24 v2.0c % +\ProvidesPackage{lastpage2e}[2023/10/06 v2.0d % Decide which 2e lastpage version to use (HMM)] \@ifl@t@r\fmtversion{2022/11/01}{\RequirePackage{lastpagemodern}}{% \RequirePackage{lastpageclassic}} diff --git a/Master/texmf-dist/tex/latex/lastpage/lastpageclassic.sty b/Master/texmf-dist/tex/latex/lastpage/lastpageclassic.sty index 03101c36897..786ed617876 100644 --- a/Master/texmf-dist/tex/latex/lastpage/lastpageclassic.sty +++ b/Master/texmf-dist/tex/latex/lastpage/lastpageclassic.sty @@ -9,7 +9,7 @@ %% This is a generated file. %% %% Project: lastpage -%% Version: 2023-07-24 v2.0c +%% Version: 2023-10-06 v2.0d %% Info: Refers to last page's name %% %% Copyright (C) 2010 - 2023 by @@ -40,7 +40,8 @@ %% %% While this package allows for things like "Page slash thepage{} of slash pageref{LastPage}" %% to get "Page 7 of 9" or "Page VII of IX", -%% the NUMBER of pages is nowadays available via slash @abspage@last from the kernel, +%% the NUMBER of pages is nowadays available from the kernel +%% (slash @abspage@last, slash thetotalpages, slash PreviousTotalPages), %% but with pages for example I to X and then 1 to 10, the number of pages would be "20", %% while the name of the last page is "10". Decide what you need/want! %% @@ -58,7 +59,7 @@ %% %% Part of the "lastpage" package \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{lastpageclassic}[2023/07/24 v2.0c % +\ProvidesPackage{lastpageclassic}[2023/10/06 v2.0d % Refers to last page's name (HMM; JPG)] %% allows for things like "Page \thepage{} of \pageref{LastPage}" %% to get "Page 7 of 9" diff --git a/Master/texmf-dist/tex/latex/lastpage/lastpagemodern.sty b/Master/texmf-dist/tex/latex/lastpage/lastpagemodern.sty index 5ff8a590ca7..15d28b235b8 100644 --- a/Master/texmf-dist/tex/latex/lastpage/lastpagemodern.sty +++ b/Master/texmf-dist/tex/latex/lastpage/lastpagemodern.sty @@ -9,7 +9,7 @@ %% This is a generated file. %% %% Project: lastpage -%% Version: 2023-07-24 v2.0c +%% Version: 2023-10-06 v2.0d %% Info: Refers to last page's name %% %% Copyright (C) 2010 - 2023 by @@ -40,7 +40,8 @@ %% %% While this package allows for things like "Page slash thepage{} of slash pageref{LastPage}" %% to get "Page 7 of 9" or "Page VII of IX", -%% the NUMBER of pages is nowadays available via slash @abspage@last from the kernel, +%% the NUMBER of pages is nowadays available from the kernel +%% (slash @abspage@last, slash thetotalpages, slash PreviousTotalPages), %% but with pages for example I to X and then 1 to 10, the number of pages would be "20", %% while the name of the last page is "10". Decide what you need/want! %% @@ -58,12 +59,12 @@ %% %% Part of the "lastpage" package \NeedsTeXFormat{LaTeX2e}[2022-11-01] -\ProvidesPackage{lastpagemodern}[2023-07-24 v2.0c % +\ProvidesPackage{lastpagemodern}[2023-10-06 v2.0d % Refers to last page's name (HMM; JPG)] %% allows for things like "Page \thepage{} of \pageref{LastPage}" %% to get "Page 7 of 9" or "Page VII of IX"; %% the NUMBER of pages is available via \@abspage@last, but with pages -%% for example I to X and then 1 to 10, the number of pages woud be "20", +%% for example I to X and then 1 to 10, the number of pages would be "20", %% while the name of the last page is "10". Decide what you need/want! \gdef\lastpage@one{1} @@ -71,6 +72,19 @@ \gdef\lastpage@lastpage{??} \gdef\lastpage@lastpageHy{??} +\newcommand\lastpage@gobbleminus[1]{\ifx-#1\else#1\fi} +%% from https://texfaq.org/FAQ-isitanum + +\newcounter{lastpagecount} + +\newcommand{\lastpage@IfNumericTF}[3]{% +%% similar to https://tex.stackexchange.com/a/17119 +\sbox\z@{\c@lastpagecount=0\lastpage@gobbleminus{#1}\relax}% +\ifdim\wd0>\z@\relax#3% is not numeric +\else#2% is numeric +\fi% +} + \AddToHook{begindocument/end}{\gdef\lastpage@putlabel{\relax}} %% From https://tex.stackexchange.com/a/542425 with thanks to @@ -85,6 +99,30 @@ \if@nobreak\ifvmode\nobreak\fi\fi% } +\newcommand{\lastpage@numeric}{\protected@iwrite\@auxout{}{% + \string\newlabel{LastPage}{% + {\@currentlabel}% + {\thepage}% + {\@currentlabelname}% + {\IfPackageLoadedTF{hyperref}{\ifHy@pageanchor page.\Hy@temp\fi% + }{\@currentHref}}% + {\@kernel@reserved@label@data}}}% + } + +\newcommand{\lastpage@nonnumeric}{\protected@iwrite\@auxout{}{% + \string\newlabel{LastPage}{% + {\@currentlabel}% + {\IfPackageLoadedTF{hyperref}{\string\begingroup% + \string\pdfstringdefDisableCommands{\string\let% + \string\TextOrMath\string\@firstoftwo}\thepage% + \string\endgroup% + }{\thepage}}% + {\@currentlabelname}% + {\IfPackageLoadedTF{hyperref}{\ifHy@pageanchor page.\Hy@temp\fi% + }{\@currentHref}}% + {\@kernel@reserved@label@data}}}% + } + \newcommand{\lastpage@putl@bel}{% \IfPackageLoadedTF{pageslts}{\relax}{% \IfPackageLoadedTF{hyperref}{\ifHy@pageanchor\else% @@ -122,17 +160,7 @@ \fi% }{}% \IfFormatAtLeastTF{2023/06/01}{% - \protected@iwrite\@auxout{}{\string\newlabel{LastPage}{% - {\@currentlabel}% - {\IfPackageLoadedTF{hyperref}{\string\begingroup% - \string\pdfstringdefDisableCommands{\string\let% - \string\TextOrMath\string\@firstoftwo}\thepage% - \string\endgroup% - }{\thepage}}% - {\@currentlabelname}% - {\IfPackageLoadedTF{hyperref}{\ifHy@pageanchor page.\Hy@temp\fi% - }{\@currentHref}}% - {\@kernel@reserved@label@data}}}% + \lastpage@IfNumericTF{\thepage}{\lastpage@numeric}{\lastpage@nonnumeric}% }{\IfPackageLoadedTF{hyperref}{\protected@iwrite\@auxout{}{% \string\newlabel{LastPage}{{}{\thepage}{}{% \ifHy@pageanchor page.\Hy@temp\fi}{}}}% -- cgit v1.2.3