summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/lastpage/lastpagemodern.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/lastpage/lastpagemodern.sty')
-rw-r--r--Master/texmf-dist/tex/latex/lastpage/lastpagemodern.sty54
1 files changed, 43 insertions, 11 deletions
diff --git a/Master/texmf-dist/tex/latex/lastpage/lastpagemodern.sty b/Master/texmf-dist/tex/latex/lastpage/lastpagemodern.sty
index efeedd84bb3..abdec5b0852 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: 2024-04-27 v2.1a
+%% Version: 2024-07-07 v2.1c
%% Info: Refers to last page's name
%%
%% Copyright (C) 2010 - 2024 by
@@ -32,10 +32,9 @@
%%
%% This package was invented by Jeffrey P. Goldberg.
%% I thought that a replacement was needed and therefore created the pageslts package,
-%% https://ctan.org/pkg/pageslts
-%% . Nevertheless, for compatibility with existing documents/packages as well as for
-%% the low amount of resources needed by the lastpage package (no new counter!),
-%% I updated this package.
+%% https://ctan.org/pkg/pageslts. Nevertheless, for compatibility with existing
+%% documents/packages as well as for the low amount of resources needed by the
+%% lastpage package (no new counter!), I updated this package.
%% 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}"
@@ -59,7 +58,7 @@
%%
%% Part of the "lastpage" package
\NeedsTeXFormat{LaTeX2e}[2023-06-01]
-\ProvidesPackage{lastpagemodern}[2024-04-27 v2.1a %
+\ProvidesPackage{lastpagemodern}[2024-07-07 v2.1c %
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";
@@ -94,9 +93,43 @@
\if@nobreak\ifvmode\nobreak\fi\fi%
}
-%% similar to https://tex.stackexchange.com/a/12811/6865
-\def\lastpage@rmpage#1{\expandafter\lastpage@currentH#1\relax}
-\def\lastpage@currentH#1.#2\relax{#2}
+\newcommand{\lastpage@makeHy}{%
+ \gdef\lastpage@Hy{}%
+ \IfPackageLoadedTF{hyperref}{%
+ \ifHy@pageanchor%
+ \@ifundefined{@currentHpage}{%
+ \PackageError{lastpage}{%
+ Kernel command \string\@currentHpage\space is undefined}{%
+ Please contact the lastpage maintainer.}%
+ }{\xdef\lastpage@Hptest{Doc-Start}%
+ \ifx\lastpage@Hptest\@currentHpage\relax%
+ \gdef\lastpage@Hy{\@currentHpage}%
+ \else%
+ \edef\lastpage@Hptest{\@currentHpage}%
+ \ifx\lastpage@Hptest\empty\relax%
+ \else%
+ \gdef\lastpage@Hy{\lastpage@rmpage{\@currentHpage}}%
+ \ifx\lastpage@lastpageHy\empty\relax%
+ \PackageWarningNoLine{lastpage}{%
+ \string\@currentHpage\space is\MessageBreak%
+ \meaning\@currentHpage\MessageBreak%
+ not beginning with "page.",\MessageBreak%
+ \string\lastpage@lastpageHy\space is now let empty.}%
+ \fi%
+ \fi%
+ \fi%
+ }%
+ \fi%
+ }{}%
+ }%
+
+%% Code provided by David Carlisle at https://tex.stackexchange.com/a/721877
+\def\lastpage@rmpage#1{%
+ \expandafter\xlastpage@rmpage\expanded{#1}\xlastpage@rmpage page.%
+ \xlastpage@rmpage\xxlastpage@rmpage{#1}}
+\def\xlastpage@rmpage #1page.#2\xlastpage@rmpage#3\xxlastpage@rmpage#4{%
+ \if$\detokenize{#1}$#2%\else#4
+ \fi}
\newcommand{\lastpage@putl@bel}{%
\IfPackageLoadedTF{pageslts}{\relax}{%
@@ -125,8 +158,7 @@
}%
\protected@iwrite\@auxout{}{%
\string\gdef\string\lastpage@lastpage{\thepage}}%
- \gdef\lastpage@Hy{\IfPackageLoadedTF{hyperref}{%
- \ifHy@pageanchor\lastpage@rmpage{\@currentHpage}\fi}{}}%
+ \lastpage@makeHy%
\protected@iwrite\@auxout{}{%
\string\gdef\string\lastpage@lastpageHy{\lastpage@Hy}}%
\addtocounter{page}{+1}%