Debian Codegraph @

texmf-dist/source/latex/pageslts/pageslts.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: pageslts.dtx
4 % Version: 2025-08-14 v2.0g
5 % Info: Variants of last page labels
6 %
7 % Copyright © 2010 - 2025 by
8 % H.-Martin Münch <Martin dot Muench at Uni-Bonn dot de>
9 % Portions of code copyrighted by other people as marked.
10 %
11 % This package first started as a revision of the lastpage
12 % package of Jeffrey P. Goldberg (jeffrey+news at goldmark dot org),
13 % but I thought a replacement was needed.
14 %
15 % This work may be distributed and/or modified under the
16 % conditions of the LaTeX Project Public License, either
17 % version 1.3c of this license or (at your option) any later
18 % version. This version of this license is in
19 % https://www.latex-project.org/lppl/lppl-1-3c.txt
20 % and the latest version of this license is in
21 % https://www.latex-project.org/lppl.txt
22 % and version 1.3c or later is part of all distributions of
23 % LaTeX version 2005-12-01 or later.
24 %
25 % This work has the LPPL maintenance status "maintained".
26 %
27 % The Current Maintainer of this work is H.-Martin Münch.
28 %
29 % This work consists of the main source file pageslts.dtx,
30 % the README, and the derived files
31 % pageslts.sty, pageslts.pdf,
32 % pageslts.ins, pageslts.drv,
33 % pageslts-example.tex, pageslts-example.pdf.
34 %
35 % "pageslts" is available on CTAN:
36 % https://ctan.org/pkg/pageslts
37 %
38 % Also a TDS.ZIP file is provided that contains all the files
39 % already sorted in a TDS tree:
40 % https://mirror.ctan.org/install/macros/latex/contrib/pageslts.tds.zip
41 %
42 %<*ignore>
43 \begingroup
44 \catcode123=1 %
45 \catcode125=2 %
46 \def\x{LaTeX2e}%
47 \expandafter\endgroup
48 \ifcase 0\ifx\install y1\fi\expandafter
49 \ifx\csname processbatchFile\endcsname\relax\else1\fi
50 \ifx\fmtname\x\else 1\fi\relax
51 \else\csname fi\endcsname
52 %</ignore>
53 %<*install>
54 \input docstrip.tex
55 \Msg{**********************************************************************************}
56 \Msg{* Installation *}
57 \Msg{* Package: pageslts 2025-08-14 v2.0g Refers to special pages' numbers/names (HMM)*}
58 \Msg{**********************************************************************************}
59
60 \keepsilent
61 \askforoverwritefalse
62
63 \let\MetaPrefix\relax
64 \preamble
65
66 This is a generated file.
67
68 Project: pageslts
69 Version: 2025-08-14 v2.0g
70 Info: Variants of last page labels
71
72 Copyright (C) 2010 - 2025 by
73 H.-Martin Muench <Martin dot Muench at Uni-Bonn dot de>
74 Portions of code copyrighted by other people as marked.
75
76 IMPORTANT NOTICE:
77 On the first page backslash pagenumbering should be called
78 (with the appropriate argument out of e.g.
79 * roman - Lowercase Roman numerals: i, ii, iii, iv,...
80 * Roman - Uppercase Roman numerals: I, II, III, IV,...
81 * arabic - Arabic numerals: 1, 2, 3, 4,...
82 * alph - Lowercase letters: a, b, c, d,...
83 * Alph - Uppercase letters: A, B, C, D,...
84 * fnsymbol - Footnote symbols: *, † (ddagger), ‡ (dddagger),
85 § (mathsection),...
86 * silly - from sillypage package
87 * gobble - gobbles the page numbers;
88 maybe backslash thispagestyle{empty} is more useful?
89 ). The command backslash pagenumbering is renewed, but no change
90 should be visible to the output text, because only labels are added.
91 backslash OrigPagenumbering can be used to get the original meaning
92 of backslash pagenumbering, but in that case this package does not
93 see the change in the page numbering scheme and will make mistakes.
94 The package takes options.
95
96 This work may be distributed and/or modified under the
97 conditions of the LaTeX Project Public License, either
98 version 1.3c of this license or (at your option) any later
99 version. This version of this license is in
100 https://www.latex-project.org/lppl/lppl-1-3c.txt
101 and the latest version of this license is in
102 https://www.latex-project.org/lppl.txt
103 and version 1.3c or later is part of all distributions of
104 LaTeX version 2005-12-01 or later.
105
106 This work has the LPPL maintenance status "maintained".
107
108 The Current Maintainer of this work is H.-Martin Muench.
109
110 This package first started as a revision of the lastpage
111 package of Jeffrey P. Goldberg (jeffrey+news at goldmark dot org),
112 but I thought a replacement was needed.
113
114 This work consists of the main source file pageslts.dtx,
115 the README, and the derived files
116 pageslts.sty, pageslts.pdf,
117 pageslts.ins, pageslts.drv,
118 pageslts-example.tex, pageslts-example.pdf.
119
120 In memoriam
121 Claudia Simone Barth + 1996-01-30
122 Tommy Muench + 2014-01-02
123 Hans-Klaus Muench + 2014-08-24
124
125 \endpreamble
126 \let\MetaPrefix\DoubleperCent
127
128 \generate{%
129 \file{pageslts.ins}{\from{pageslts.dtx}{install}}%
130 \file{pageslts.drv}{\from{pageslts.dtx}{driver}}%
131 \usedir{tex/latex/pageslts}%
132 \file{pageslts.sty}{\from{pageslts.dtx}{package}}%
133 \usedir{doc/latex/pageslts}%
134 \file{pageslts-example.tex}{\from{pageslts.dtx}{example}}%
135 }
136
137 \catcode32=13\relax% active space
138 \let =\space%
139 \Msg{************************************************************************}
140 \Msg{*}
141 \Msg{* To finish the installation you have to move the following}
142 \Msg{* file into a directory searched by TeX:}
143 \Msg{*}
144 \Msg{* pageslts.sty}
145 \Msg{*}
146 \Msg{* To produce the documentation run the file `pageslts.drv'}
147 \Msg{* through (pdf)LaTeX, e.g.}
148 \Msg{* pdflatex pageslts.drv}
149 \Msg{* makeindex -s gind.ist pageslts.idx}
150 \Msg{* pdflatex pageslts.drv}
151 \Msg{* makeindex -s gind.ist pageslts.idx}
152 \Msg{* pdflatex pageslts.drv}
153 \Msg{*}
154 \Msg{* At least three runs are necessary e. g. to get the}
155 \Msg{* references right!}
156 \Msg{*}
157 \Msg{* Happy TeXing!}
158 \Msg{*}
159 \Msg{************************************************************************}
160
161 \endbatchfile
162 %</install>
163 %<*ignore>
164 \fi
165 %</ignore>
166 %
167 % \section{The documentation driver file}
168 % The next bit of code contains the documentation driver file for
169 % \TeX , i.\,e., the file that will produce the documentation you
170 % are currently reading. It will be extracted from this file by the
171 % \texttt{docstrip} programme. That is, run \LaTeX{} on \texttt{docstrip}
172 % and specify the \texttt{driver} option when \texttt{docstrip}
173 % asks for options.
174 %
175 % \begin{macrocode}
176 %<*driver>
177 \NeedsTeXFormat{LaTeX2e}[2024-11-01]
178 \ProvidesFile{pageslts.drv}%
179 [2025-08-14 v2.0g Refers to special pages' numbers/names (HMM)]
180 \documentclass[landscape]{ltxdoc}[2024/02/08]% v2.1j Standard LaTeX documentation class
181 \usepackage{geometry}[2020/01/02]% v5.9 Page Geometry
182 \usepackage{holtxdoc}[2019/12/09]% v0.30 Private additional ltxdoc support (HO)
183 \hypersetup{%
184 pdfsubject={Refers to special pages' numbers/names (HMM)},%
185 pdfkeywords={LaTeX, pageslts, pagesLTS, lastpage, page number, page name},%
186 pdfencoding=auto,%
187 pdflang={en},%
188 breaklinks=true,%
189 linktoc=all,%
190 pdfstartview=FitH,%
191 pdfpagelayout=OneColumn,%
192 bookmarksnumbered=true,%
193 bookmarksopen=true,%
194 bookmarksopenlevel=2,%
195 pdfmenubar=true,%
196 pdftoolbar=true,%
197 pdfwindowui=true,%
198 pdfnewwindow=true%
199 }
200 \usepackage{ulem}[2019-11-18]% no version is given in the ulem.sty file
201 \CodelineIndex
202 \hyphenation{created every-thing ignored}
203 \begin{document}
204 \DocInput{pageslts.dtx}%
205 \end{document}
206 %</driver>
207 % \end{macrocode}
208 % \fi
209 %
210 % \GetFileInfo{pageslts.drv}
211 %
212 % \begingroup
213 % \def\x{\#,\$,\^,\_,\~,\ ,\&,\{,\},\%}%
214 % \makeatletter
215 % \@onelevel@sanitize\x
216 % \expandafter\endgroup
217 % \expandafter\DoNotIndex\expandafter{\x}
218 % \expandafter\DoNotIndex\expandafter{\string\ }
219 % \begingroup
220 % \makeatletter
221 % \lccode`9=32\relax
222 % \lowercase{%^^A
223 % \edef\x{\noexpand\DoNotIndex{\@backslashchar9}}%^^A
224 % }%^^A
225 % \expandafter\endgroup\x
226 %
227 % \DoNotIndex{\ ,\",\,,\\,\-,\@Alph,\@alph,\@bsphack,\@ehc,\@ehd,\@esphack,\@ifundefined,\@ne,%
228 % \@currentlabel,\@currentlabelname,\@evenfoot,\@fnsymbol,\@gobble,\@ifl@t@r,%
229 % \@kernel@reserved@label@data,\@oddfoot,\@tempcnta,\addcontentsline,\addtocounter,\AfterLastShipout,%
230 % \Alph,\alph,\alphalph,\AlphAlph,\AlphMult,\alphMult,\AlphMulti,\arabic,\AtEndDocument,\baselineskip,%
231 % \begin,\bigskip,\csname,\dagger,\ddagger,\detokenize,\documentclass,\endinput,%
232 % \empty,\END,\end,\endcsname,\ensuremath,\expanded,\extract,\extract@,\fmtversion,%
233 % \fnsymbol,\fnsymbolmult,\frontmatter,\gdef,\href,\hskip,\hypersetup,\hypertarget,\HyPsd@pageref,%
234 % \if,\if@filesw,\if@nobreak,\ifnum,\ifodd,\ifx,\ifvmode,\IfFormatAtLeastF,\IfFormatAtLeastT,%
235 % \IfPackageAtLeastTF,\IfPackageAtLeastF,\@ifpackageloaded,\IfPackageLoadedT,\IfPackageLoadedF,%
236 % \IfPackageLoadedTF,\IfPackageLoadedWithOptionsF,\immediate,\item,\jobname,\label,\LaTeX,\ldots,%
237 % \linebreak,\lipsum,\listfiles,\loop,\makeatletter,\makeatother,\MessageBreak,\markboth,\mathparagraph,%
238 % \mathsection,\mbox,\meaning,\newcommand,\newline,\newpage,\NeedsTeXFormat,\NewCommandCopy,\newcounter,%
239 % \newlabel,\nobreak,\noindent,\nolinebreak,\number,\numexpr,\options,\PackageError,\PackageInfo,%
240 % \PackageNoteNoLine,\PackageWarning,\PackageWarningNoLine,\pagebreak,\pageref,%
241 % \pagesLTS@tmpA,\pagesLTS@tmpB,\pagesLTS@tmpC,\pagesLTS@tmpD,\pagesLTS@tmpQ,\par,\parindent,%
242 % \phantomsection,\ProvidesPackage,\protect,\qquad,\ref,\renewcommand,\repeat,\RequirePackage,%
243 % \section,\setcounter,\setlength,\smallskip,\space,\subsection,%
244 % \tableofcontents,\textbackslash,\textbf,\textit,\textquotedblleft,\textquotedblright,\textsf,\texttt,%
245 % \texorpdfstring,\textasteriskcentered,\the,\thepage,\thispagestyle,\undefined,\url,\usepackage,%
246 % \value,\verb,\xpagesLTS@rmpage,\xxpagesLTS@rmpage,\SetKeys}
247 %
248 % \newlength\ltsindent
249 % \setlength{\ltsindent}{\parindent}
250 % \setlength{\parindent}{0pt}
251 % \renewcommand{\indent}{\hspace*{\ltsindent}}
252 %
253 % \title{The \xpackage{pageslts} package}
254 % \date{2025-08-14 v2.0g}
255 % \author{H.-Martin Münch\\\xemail{Martin.Muench at Uni-Bonn.de}}
256 %
257 % \maketitle
258 %
259 % \begin{abstract}
260 % \noindent This \LaTeX{} package puts the labels \texttt{LastPage}
261 % (|\AddToHook{enddocument/afterlastpage}|, formerly |\AtEndDocument|)
262 % and \texttt{VeryLastPage} (also |\AddToHook{enddocument/afterlastpage}|,
263 % but formerly |\AfterLastShipout|) into the \xfile{.aux} file,
264 % allowing the user to refer to the last page of a document.
265 % This might be particularly useful in places like headers or footers.
266 % When more than one page numbering scheme is used,
267 % these references do not give the total \textit{number} of pages.
268 % For this case the label \texttt{LastPages} is introduced.
269 % Additionally, at the last page of each page numbering
270 % scheme a label \texttt{pagesLTS.<numbering scheme>} is
271 % placed, where \texttt{<numbering scheme>} is e.\,g.
272 % arabic, roman, Roman, alph, or Alph. For fnsymbol
273 % please use |\lastpageref{pagesLTS.fnsymbol}|
274 % instead of |\pageref{pagesLTS.fnsymbol}|.
275 % When the same numbering scheme is used twice,
276 % the page numbers are either reset to one or continued
277 % automatically, depending on the option given when the package
278 % is called. The command |\theCurrentPage|
279 % prints the current total/absolute page number -- in contrast to
280 % |\thepage|, which gives only the page
281 % \textit{name} in the current page numbering scheme.
282 % |\theCurrentPageLocal| gives the current
283 % number of pages in the current page numbering scheme.
284 % |\thepage| and |\theCurrentPageLocal| are different e.\,g.
285 % when |\addtocounter{page}{|\ldots|}| or
286 % |\setcounter{page}{|\ldots|}| were used.
287 % At the first page of the document a label \texttt{pagesLTS.0} is
288 % created. This label can be referred to, too.
289 % Further labels are provided for special cases.\par
290 %
291 % The \xpackage{alphalph} package is supported,
292 % i.\,e.~page numbers alph or Alph $>26$ and fnsymbol $>9$
293 % can be used (with according options set). Even zero
294 % and negative page numbers can be used with \texttt{arabic},
295 % \texttt{alph}, \texttt{Alph}, \texttt{roman}, \texttt{Roman},
296 % and \texttt{fnsymbol} page numbering (with \xpackage{alphalph} package
297 % and according options).\par
298 %
299 % |\pageref*| and |\lastpageref*|, for using \xpackage{hyperref}
300 % but suppressing links, are supported. -- The name of the \xpackage{pageslts} package
301 % refers to \textbf{L}ast, \textbf{T}otal, and page numbering \textbf{S}chemes pages.
302 % \xpackage{pagesLTS} was a former name of this package.
303 % \end{abstract}
304 %
305 % Right after |\begin{document}| a |\pagenumbering{|\ldots|}| should be called~--
306 % with the appropriate argument out of e.\,g.\newline
307 % arabic (Arabic numerals: 1, 2, 3, 4,\ldots),\newline
308 % roman (Lowercase Roman numerals: i, ii, iii, iv,\ldots),
309 % Roman (Uppercase Roman numerals: I, II, III, IV,\ldots),\newline
310 % alph (Lowercase letters: a, b, c, d,\ldots),
311 % Alph (Uppercase letters: A, B, C, D,\ldots),\newline
312 % fnsymbol (Footnote symbols: $*$, $\dagger $, $\ddagger $, $\mathsection $,\ldots),\newline
313 % gobble (Maybe \verb|\thispagestyle{empty}| is more useful?),\newline
314 % silly (from the \href{https://ctan.org/pkg/sillypage}{\xpackage{sillypage} package}).\bigskip
315 %
316 % This package first started as a revision of the
317 % \xpackage{lastpage} package of \textbf{Jeffrey P. Goldberg} (Thanks!),
318 % but then it was deemed necessary to provide a separate, enhanced package.
319 % After updates of the kernel and the package,
320 % \xpackage{lastpage} now does what it is supposed to do.\bigskip
321 %
322 % Disclaimer for web links: The author is not responsible for any contents
323 % referred to in this work unless he has full knowledge of illegal contents.
324 % If any damage occurs by the use of information presented there, only the
325 % author of the respective pages might be liable, not the one who has referred
326 % to these pages.\pagebreak
327 %
328 % \tableofcontents
329 % \newpage
330 %
331 % \section{Introduction}
332 % This package puts the labels \texttt{LastPage} (|\AddToHook{enddocument/afterlastpage}|,
333 % formerly |\AtEndDocument|; same as the \xpackage{LastPage} package) and \texttt{VeryLastPage}
334 % (also |\AddToHook{enddocument/afterlastpage}|, but formerly |\AfterLastShipout|) into the \xfile{.aux} file,
335 % allowing the user to refer to the last page of a document via |\lastpageref{LastPage}| and
336 % |\lastpageref{VeryLastPage}|. This might be particularly useful in places like headers or footers.
337 % When more than one page numbering scheme is used, these references do not give the total \textit{number}
338 % of pages. For this case the label \texttt{LastPages} is introduced (similar to the label \texttt{TotPages}
339 % of the \xpackage{TotPages} package, but the label \texttt{LastPages} is set later in the document).
340 % Additionally, at the last page of each page numbering scheme a label
341 % \texttt{pagesLTS.<}\textit{numbering scheme}\texttt{>} is placed,
342 % where \texttt{<}\textit{numbering scheme}\texttt{>} is e.\,g.
343 % arabic, roman, Roman, alph, or Alph. For fnsymbol please use
344 % |\lastpageref{pagesLTS.fnsymbol}| instead of |\pageref{pagesLTS.fnsymbol}|.
345 % When the same numbering scheme is used twice, the page numbers are either reset to one
346 % or continued automatically, depending on the option given when the package is called.
347 % The command |\theCurrentPage| prints the current total/absolute page number -- in contrast to |\thepage|,
348 % which gives only the page \textit{name} in the current page numbering scheme. |\theCurrentPageLocal|
349 % gives the current number of pages in the current page numbering scheme. |\thepage| and |\theCurrentPageLocal|
350 % are different e.\,g.~when |\addtocounter{page}{|\ldots|}| or |\setcounter{page}{|\ldots|}| were used.
351 % (See also \LaTeX\ bug~3421: 3rd~page is even (twoside, titlepage, abstract),
352 % \url{https://www.latex-project.org/cgi-bin/ltxbugs2html?category=LaTeX&responsible=anyone&state=anything&keyword=pagenumber&pr=latex%2F3421&search=}.)
353 % At the first page of the document a label \texttt{pagesLTS.0} is created. Also to this label it can be referred.
354 % Further labels are provided for special cases.\bigskip
355 %
356 % The \xpackage{alphalph} package is supported, i.\,e.~page numbers \texttt{alph} or \texttt{Alph} $>26$
357 % and \texttt{fnsymbol} $>9$ can be used (with the according options set). Even zero or negative page
358 % numbers can be used with \texttt{arabic}, \texttt{alph}, \texttt{Alph}, and \texttt{fnsymbol}
359 % page numbering (with \xpackage{alphalph} package and according options), and zero \texttt{roman}
360 % and \texttt{Roman} pages, too.\bigskip
361 %
362 % Right after |\begin{document}| a |\pagenumbering{|\ldots|}| should be called~--
363 % with the appropriate argument out of e.\,g.\newline
364 % arabic (Arabic numerals: 1, 2, 3, 4,\ldots),\newline
365 % roman (Lowercase Roman numerals: i, ii, iii, iv,\ldots),
366 % Roman (Uppercase Roman numerals: I, II, III, IV,\ldots),\newline
367 % alph (Lowercase letters: a, b, c, d,\ldots),
368 % Alph (Uppercase letters: A, B, C, D,\ldots),\newline
369 % fnsymbol (Footnote symbols: $*$, $\dagger $, $\ddagger $, $\mathsection $,\ldots),\newline
370 % gobble (Maybe \verb|\thispagestyle{empty}| is more useful?),\newline
371 % silly (from the \href{https://ctan.org/pkg/sillypage}{\xpackage{sillypage} package}).\bigskip
372 %
373 % This package first started as a revision of the
374 % \xpackage{lastpage} package of \textsc{Jeffrey P. Goldberg} (Thanks!),
375 % but then it became obvious that a replacement was needed to accomplish
376 % what this package does.\bigskip
377 %
378 % \textbf{Trademarks} appear throughout this documentation without any trademark symbol;
379 % they are the property of their respective trademark owner. There is no intention of infringement;
380 % the usage is to the benefit of the trademark owner.\bigskip
381 %
382 % \phantomsection
383 % \DescribeMacro{logical page numbers}\label{logical page numbers}
384 % \textbf{Tip}: For the display of the \xfile{pdf}~file use \textbf{logical page numbers}
385 % together with \xpackage{hyperref}!
386 % \begin{description}
387 % \item [-] In Adobe Acrobat Reader Continuous Release 2024.005.20320 enable:\newline
388 % Edit $>$ Preferences $>$ Categories: Page Display $>$
389 % Page Content and Information: Use logical page numbers
390 %
391 % \item[-] Use the \xpackage{hyperref} package with option |plainpages=false|\,.
392 % \end{description}
393 % The display will be e.\,g.\ \mbox{\textquotedblleft 7 (7 of 9)\textquotedblright ,}
394 % or, in case of Roman instead of arabic numbers,
395 % \mbox{\textquotedblleft VII (7 of 9)\textquotedblright ,} and when different
396 % page numbers are used (see below) e.\,g.~arabic after 10~Roman pages:
397 % \mbox{\textquotedblleft 17 (27 of 30)\textquotedblright .}
398 % Please try this with the compiled \xpackage{pageslts-example} file!
399 %
400 % \section{Usage}
401 % Just load the package by placing
402 % \begin{quote}
403 % |\usepackage[<|\textit{options}|>]{pageslts}|
404 % \end{quote}
405 % in the preamble of your \LaTeX\ source file and place a |\pagenumbering{...}| with appropriate argument
406 % (e.\,g.~arabic, roman, Roman, fnsymbol, alph, or Alph)
407 % right behind |\begin{document}| (see subsubsection~\ref{sss:nopnc})!\bigskip
408 %
409 % For example for various draft forms it is desirable to have a page reference to the last page,
410 % so that e.\,g.\ page footers can contain something like
411 %\textquotedblleft page \mbox{$N$ of $K$\textquotedblright ,} where $N$~is the current page and
412 % $K$~is the last page. Once the package is loaded, anywhere in the text references can be made
413 % to the labels \texttt{LastPage}, \texttt{VeryLastPage}, and \texttt{LastPages}
414 % (most times with |\pageref{...}|, but more save with |\lastpageref{...}|).
415 % In particular one can use the \xpackage{fancyhdr} (\url{https://ctan.org/pkg/fancyhdr}) or
416 % \xpackage{nccfancyhdr} (\url{https://ctan.org/pkg/nccfancyhdr}) package, or
417 % redefinitions of the page headings and footings to get a reference to the last page.\bigskip
418 %
419 % \DescribeMacro{\pageref*}
420 % \DescribeMacro{\lastpageref*}
421 % If the \xpackage{hyperref} package is used, the references are hyperlinked to their targets.
422 % If these hyperlinks shall be suppressed, |\pageref*{...}| and |\lastpageref*{...}| can be used.
423 %
424 % \subsection{Options}
425 % \DescribeMacro{options}
426 % The \xpackage{pageslts} package takes the following options:
427 %
428 % \subsubsection{pagecontinue\label{sss:pagecontinue}}
429 % \DescribeMacro{pagecontinue}
430 % When option \texttt{pagecontinue=false} is \textbf{not} given (i.\,e.~\texttt{pagecontinue}
431 % or \texttt{pagecontinue=true} or no \texttt{pagecontinue} option at all), at each
432 % |\pagenumbering{...}| command the number of the page will be continued
433 % with the page number following the last page of the same page numbering scheme. For example,
434 % if there are V~Roman pages in the frontmatter, some arabic ones in the mainmatter, and then
435 % Roman ones again in the backmatter, the last ones will start with VI instead of~I again.\bigskip
436 %
437 % If you want to start with I (or i, 1, a, A, *,\ldots ) again, set option
438 % \texttt{pagecontinue=false}. If you want to generally continue the numbers,
439 % but for some page numbering scheme do not want this, use \texttt{pagecontinue=true}
440 % and say |\setcounter{page}{1}| after |\pagenumbering{...}| for that page numbering scheme.
441 %
442 % \subsubsection{alphMult, AlphMulti, fnsymbolmult\label{sss:alphalph}}
443 % The page number printed in
444 % \nolinebreak{\texttt{fnsymbol}\footnote{%
445 % \ensuremath {*},%
446 % \ensuremath {\dagger },%
447 % \ensuremath {\ddagger },%
448 % \ensuremath {\mathsection },%
449 % \ensuremath {\mathparagraph },%
450 % \ensuremath {\delimiter "026B30D },%
451 % \ensuremath {**},%
452 % \ensuremath {\dagger \dagger },%
453 % \ensuremath {\ddagger \ddagger }}}
454 % must be $>0$ and $<10$ and those printed in
455 % \nolinebreak{\texttt{alph}\footnote{a, b, c, d, e, f, g, h,%
456 % i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z}} and
457 % \nolinebreak{\texttt{Alph}\footnote{A, B, C, D, E, F, G, H,%
458 % I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z}} must
459 % be $>0$ and $<27$. After page~Z\quad \LaTeX\ \textit{should} continue with
460 % AA, AB, AC,\ldots\ Some people prefer AA, BB, CC,\ldots, but in hexadecimal it is
461 % $AA_{16}=170_{10}$ and $171_{10}=AB_{16}$, whereas $BB_{16}=187_{10}$. In any way
462 % it should continue at all (maybe even with a user option to choose between the two
463 % continuations), but instead only gives an error:\pagebreak
464 % \begin{verbatim}
465 % LaTeX Error: Counter too large
466 % See the LaTeX manual or LaTeX Companion for explanation.
467 % You've lost some text. Try typing <return> to proceed.
468 % If that doesn't work, type X <return> to quit.
469 % \end{verbatim}
470 % But thanks to the \xpackage{alphalph} package these limitation no longer hold.
471 % With his |\erroralph| command now even negative or zero page
472 % \textquotedblleft numbers\textquotedblright\ are possible.\newline
473 % Nevertheless, some \TeX\ capacity will be exceeded well before the
474 % $2\,147\,483\,647^{\textnormal{th}}$ page.\bigskip
475 %
476 % \DescribeMacro{alphMult}
477 % The string option \texttt{alphMult} takes three values: |ab|, |bb|, |0|:
478 % \begin{description}
479 % \item[ab] After page z, the page \textquotedblleft numbers\textquotedblright\ continue with
480 % aa, ab, ac, ad,\ldots, and before a with 0, -a, -b,\ldots, -z, -aa, \mbox{-ab,\ldots .}
481 % \item[bb] After page z, the page \textquotedblleft numbers\textquotedblright\ continue with
482 % aa, bb, cc, dd,\ldots, and before a with 0, -a, -b,\ldots, -z, -aa, \mbox{-bb,\ldots .}
483 % \item[0] (zero) The \xpackage{pageslts} package does nothing, thus the user is free
484 % to define the page \textquotedblleft numbers\textquotedblright\ after~z and before~a.\newline
485 % (But if the user does not do anything at all, the\newline
486 % \ |LaTeX Error: Counter too large|\newline
487 % will appear again.)
488 % \end{description}
489 %
490 % \DescribeMacro{AlphMulti}
491 % The string option \texttt{AlphMulti} takes three values: |AB|, |BB|, |0|:
492 % \begin{description}
493 % \item[AB] After page Z, the page \textquotedblleft numbers\textquotedblright\ continue with
494 % AA, AB, AC, AD,\ldots, and before A with 0, -A, -B,\ldots, -Z, -AA, \mbox{-AB,\ldots .}
495 % \item[BB] After page Z, the page \textquotedblleft numbers\textquotedblright\ continue with
496 % AA, BB, CC, DD,\ldots, and before A with 0, -A, -B,\ldots, -Z, -AA, \mbox{-BB,\ldots .}
497 % \item[0] (zero) The \xpackage{pageslts} package does nothing, thus the user is free
498 % to define the page \textquotedblleft numbers\textquotedblright\ after~Z and before~A.\newline
499 % (But if the user does not do anything at all, the\newline
500 % \ |LaTeX Error: Counter too large|\newline
501 % will appear again.)
502 % \end{description}
503 %
504 % \DescribeMacro{fnsymbolmult}
505 % When option \texttt{fnsymbolmult=false} is \textbf{not} given
506 % (but \texttt{fnsymbolmult} or \texttt{fnsymbolmult=true} or no \texttt{fnsymbolmult} option
507 % at all), after \mbox{5 (\ensuremath {\mathparagraph })} the page
508 % \textquotedblleft number\textquotedblright\ is continued with the doubled
509 % \textquotedblleft number\textquotedblright{} of the first, second, third,\ldots\ page
510 % (\ensuremath{**}, \ensuremath{\dagger\dagger}, \ensuremath{\ddagger\ddagger},
511 % \ensuremath{\mathsection\mathsection}, \ensuremath{\mathparagraph\mathparagraph}),
512 % and after the tenth page the \textquotedblleft number\textquotedblright\ is tripled
513 % (\ensuremath{***}, \ensuremath{\dagger\dagger\dagger},\ldots).
514 % Compile the \textsf{pageslts-example.tex} and see the resulting \xfile{pdf} file.\bigskip
515 %
516 % Before \ensuremath{*} (page~1) the page \textquotedblleft numbers\textquotedblright\ are
517 % continued with 0, \ensuremath{-*}, \ensuremath{-\dagger},\ldots, \ensuremath{-\mathparagraph},
518 % \ensuremath{-**}, \ensuremath{-\dagger\dagger},\ldots\newline
519 % If this is not wanted, set option \texttt{fnsymbolmult=false}, and \xpackage{pageslts}
520 % will do nothing and allow the user to change the page
521 % \textquotedblleft number\textquotedblright . (But if the user does not do anything at all,
522 % the\newline
523 % \ |LaTeX Error: Counter too large|\newline
524 % will appear again.)
525 %
526 % \subsubsection{romanMult, RomanMulti\label{sss:romanMult}}
527 % \DescribeMacro{romanMult}
528 % \DescribeMacro{RomanMulti}
529 % The options \texttt{romanMult(=}\,\texttt{true)} and \texttt{RomanMulti(=}\,\texttt{true)}
530 % expand the |\roman| and |\Roman| page numbering scheme to values below one ($<1$),
531 % i.\,e.~0, -i, -ii, -iii, -iv,\ldots\ and 0, -I, -II, -III, -IV,\ldots, respectively.\newline
532 % Again the \TeX\ capacity will be exceeded well before \mbox{$\pm$ |MAX|\,}%
533 % $ = \pm 2\,147\,483\,647$. If the expansion below~$1$ is not wanted, set options
534 % \texttt{romanMult=false} and/or \texttt{RomanMulti=false}, and \xpackage{pageslts}
535 % will do nothing and allow the user to change the page
536 % \textquotedblleft number\textquotedblright. (But if the user does not do anything at all,
537 % \LaTeX\ will just ignore those values -- not even a warning will be issued!)
538 %
539 % \subsubsection{Arabic page numbers}
540 % \DescribeMacro{Arabic page numbers}
541 % In \LaTeX\ arabic (page) numbers are already possible between |-MAX...MAX|, where
542 % |MAX|\,$ = 2\,147\,483\,647$ (cf.~the \xpackage{alphalph} package), without any expansion necessary.
543 %
544 % \subsection{Labels}
545 % \DescribeMacro{pagesLTS.0}
546 % At the first page a label \texttt{pagesLTS.0} is created. If |\pagenumbering{...}| is used right after
547 % |\begin{document}|, this is much easier for the \xpackage{pageslts} package (and chances for
548 % successful placing of all labels are much higher; \nolinebreak{cf.~subsubsection~\ref{sss:once}).}\bigskip
549 %
550 % \DescribeMacro{LastPage}
551 % |\AddToHook{enddocument/afterlastpage}| (formerly: |\AtEndDocument}| this package defines a label,
552 % \texttt{LastPage}, which the user can refer to with the |\lastpageref{LastPage}| command.
553 % In former times |\pageref{LastPage}| did not work when used together with the \xpackage{hyperref}
554 % package and the |fnsymbol| page numbering scheme. This should work now.\bigskip
555 %
556 % \DescribeMacro{VeryLastPage}
557 % |\AddToHook{enddocument/afterlastpage}| (formerly: |\AfterLastShipout|) the label
558 % \texttt{VeryLastPage} is defined, which the user can also refer to with the
559 % |\lastpageref{VeryLastPage}| command. With the new kernel hooks \texttt{LastPage}
560 % as well as \texttt{VeryLastPage} point to the last page indeed.\bigskip
561 %
562 % \DescribeMacro{LastPages}
563 % \DescribeMacro{page number}
564 % \DescribeMacro{number of pages}
565 % When more than one page numbering scheme is used, neither \texttt{LastPage} nor
566 % \texttt{VeryLastPage} give the total \textbf{number} of pages. For example, for a document
567 % with VI+36 pages, both give \textquotedblleft 36\textquotedblright\ as reference to the last page.
568 % While this is correct, the total number of pages is 42, and this is given by the reference to
569 % \texttt{LastPage\underline{s}}: \nolinebreak{|\lastpageref{LastPage|\underline{|s|}|}|} (note the
570 % \textquotedblleft s\textquotedblright\ at the end). When the page number was manipulated by
571 % |\addtocounter{page}{...}| or |\setcounter{page}{...}|, \texttt{LastPages} ignores this.
572 % (At a page numbering change the page is automatically reset to one (without option
573 % |pagecontinue|). This is done by |\setcounter{page}{1}|, thus this is ignored, too.)\bigskip
574 %
575 % \DescribeMacro{totpages}
576 % |\pageref{totpages}| of the \xpackage{totpages} package is similar to
577 % |\lastpageref{LastPages}|, but while the target for
578 % |\pageref{totpages}| is placed |\AtEndDocument|, the target for
579 % |\lastpageref{LastPages}| is placed in the hook |enddocument/afterlastpage|,
580 % therefore |\lastpageref{LastPages}| is safer to really get the total page number.\bigskip
581 %
582 % \DescribeMacro{\@abspage@last}
583 % Nowadays the kernel provides |\@abspage@last|, which contains the number of pages.\bigskip
584 %
585 % \DescribeMacro{\theCurrentPage}
586 % |\theCurrentPage| gives the current total/absolute page, in contrast to |\thepage|,
587 % which gives only the page \textit{name} in the current page numbering scheme. For example,
588 % when there are Roman VII~pages in the frontmatter and afterwards in the mainmatter you are
589 % at arabic page~9, then |\theCurrentPage| is~16, whereas |\thepage| is~9. When the page
590 % \textquotedblleft number\textquotedblright\ (name) is manipulated by
591 % |\addtocounter{page}{...}| or |\setcounter{page}{...}|, |\theCurrentPage| ignores this.
592 % Because \texttt{CurrentPage} is a normal counter, you can also say e.\,g.~|\Roman{CurrentPage}|
593 % to get the value in Roman page numbering scheme (e.\,g.~VIII for~8).\bigskip
594 %
595 % \phantomsection
596 % \DescribeMacro{\theCurrentPageLocal}
597 % |\theCurrentPageLocal|\label{CurrentPageLocal} gives the current (arabic)
598 % number of pages in the current page numbering scheme. |\thepage| and |\theCurrentPageLocal|
599 % are different e.\,g.~when |\addtocounter{page}{...}| or |\setcounter{page}{...}| were used.\newline
600 % |\theCurrentPageLocal| can be printed in other formats,
601 % e.\,g.~|\roman{pagesLTS.current.local.roman}|, but probably it only makes sense
602 % if page numbering scheme and format are the same,
603 % e.\,g.~|\Roman{pagesLTS.current.local.Roman}| or\newline
604 % |\Alph{pagesLTS.current.local.Alph}|.
605 % \pagebreak
606 % |\number\value{pagesLTS.current.local.|\ldots|}| probably make sense even when combined with
607 % another page numbering scheme. And this is exactly what |\theCurrentPageLocal| does:\newline
608 % |\def\theCurrentPageLocal{\number\value{pagesLTS.current.local.\pagesLTS@pnc}}|.\bigskip
609 %
610 % \DescribeMacro{pagesLTS. page numbering scheme . number }
611 % If you want to refer to the last page of the first, second,\ldots\ use of a
612 % page numbering scheme, you can refer to\linebreak
613 % |pagesLTS.<page numbering scheme>.<number>|, e.\,g.~|\lastpageref{pagesLTS.Roman.1}|,
614 % where |<number>| is the occurrence of the page numbering scheme. For details please see
615 % page~\pageref{pagesLTS.pnscheme.nr}.\bigskip
616 %
617 % \DescribeMacro{\lastpageref}
618 % In former times for pages with the \texttt{fnsymbol} page numbering scheme,
619 % |\lastpageref{...}| instead of |\pageref{...}| had to be used.
620 % |\lastpageref| can be used for all pages.
621 %
622 % \subsection[\texttt{\textbackslash pagenumbering\{\ldots \}}]{%
623 % \texttt{\textbackslash pagenumbering\{\ldots \}}}
624 % \vspace{-1.8\baselineskip}
625 % \DescribeMacro{\pagenumbering}
626 % \subsubsection{If \texttt{\textbackslash pagenumbering\{\ldots \}} is \textbf{not} used\label{sss:nopnc}}
627 % When the \xpackage{pageslts} package is used, but |\pagenumbering{...}| (with an argument like
628 % arabic, roman, Roman, fnsymbol, alph, or Alph) is not used, there should be no problem,
629 % except that you might need more~(!) compiler runs to get all references right, and some
630 % references might even be missing (see below). The \xpackage{pageslts} package tries to determine
631 % the page numbering scheme at the first shipout, but success is not guaranteed. Thus please use
632 % |\pagenumbering{...}| at the beginning of your document!\newline
633 % Without |\pagenumbering{<something>}| (|<something>| e.\,g.~=~arabic) at the beginning of the document,
634 % the page numbers might be given in arabic \textit{by} (class) \textit{default}, but the
635 % \xpackage{pageslts} package does not know about this without |\pagenumbering{arabic}|.~--\newline
636 % The label \texttt{pagesLTS.0} is created at the first page even if no |\pagenumbering{...}| command
637 % is given. Maybe have a look at the \xfile{.aux} file after compiling your document to detect
638 % further labels (of other packages, too).
639 %
640 % \subsubsection{If \texttt{\textbackslash pagenumbering\{\ldots \}} is used once\label{sss:once}}
641 % \DescribeMacro{pagesLTS.0}
642 % At the first page a label \texttt{pagesLTS.0} is created. If |\pagenumbering{...}| is used
643 % right after |\begin{document}|, this is much easier for the \xpackage{pageslts} package
644 % (and chances for successful placing of all labels are much higher).
645 %
646 % \subsubsection{If \texttt{\textbackslash pagenumbering\{\ldots \}} is used more than once}
647 % Everything from the preceding subsubsections applies and additionally the following:\bigskip
648 %
649 % When different page numbering schemes are used, e.\,g.~Roman numbers for the frontmatter
650 % and arabic numbers for the mainmatter, please use |\pagenumbering{...}| for each of them!
651 % Even if you do this, the reference to neither the label \texttt{LastPage} nor the label
652 % \texttt{VeryLastPage} gives the \textbf{total} number of pages, but only the number of pages
653 % of the last used page numbering scheme (which could be exactly what you want,
654 % e.\,g.~if you want to refer to the last page itself and do not want to give the
655 % total number of pages).\bigskip
656 %
657 % \DescribeMacro{LastPages}
658 % For remediation the label \nolinebreak{\texttt{LastPage}\textbf{\underline{s}}} (with
659 % \textquotedblleft s\textquotedblright{} at its end) is introduced. Please then refer
660 % to this label by |\lastpageref{LastPages}| instead of \texttt{LastPage} or
661 % \texttt{VeryLastPage}.\pagebreak
662 %
663 % \DescribeMacro{pagesLTS.arabic}
664 % \DescribeMacro{pagesLTS.roman}
665 % \DescribeMacro{pagesLTS.Roman}
666 % \DescribeMacro{pagesLTS.alph}
667 % \DescribeMacro{pagesLTS.Alph}
668 % \DescribeMacro{pagesLTS.fnsymbol}
669 % \DescribeMacro{pagesLTS.silly}
670 % \DescribeMacro{pagesLTS.gobble}
671 % Additionally, at the last page of each page numbering scheme a label
672 % \texttt{pagesLTS.<numbering scheme>} is placed, where
673 % \texttt{<numbering scheme>} is e.\,g.\ arabic, roman, Roman, alph,
674 % Alph, fnsymbol, silly, gobble,\mbox{\ldots .}\newline
675 % Additional page numbering schemes are unknown for \xpackage{pageslts},
676 % see \autoref{sec:unknown} \nameref{sec:unknown}.
677 % \vspace{5\baselineskip}
678 %
679 % \subsubsection{If the same \texttt{\textbackslash pagenumbering\{\ldots \}}\ %
680 % scheme is used more than once\label{sss:twice}}
681 % Everything from the preceding subsubsections applies and additionally the following:\bigskip
682 %
683 % \DescribeMacro{pagecontinue}
684 % If the same page numbering scheme is used twice (or even more often) in one document
685 % (e.\,g.\ in the frontmatter Roman: I--V, in the mainmatter arabic: 1--20, and in the
686 % backmatter again Roman: VI--X), the second time it is used, the page numbering is either
687 % continued (option \texttt{pagecontinue} or \texttt{pagecontinue=true} or no option
688 % \texttt{pagecontinue}; the default) or reset to one (option \texttt{pagecontinue=false}).
689 % It is even possible to use a~page numbering scheme more than twice.\bigskip
690 %
691 % \phantomsection
692 % \DescribeMacro{pagesLTS. page numbering scheme . number }\label{pagesLTS.pnscheme.nr}
693 % If you want to refer to the last page of the first, second,\ldots\ use of a
694 % page numbering scheme, page~V in the example above, you can refer to
695 % |pagesLTS.<page numbering scheme>.<number>|, e.\,g.~|\lastpageref{pagesLTS.Roman.1}|,
696 % where |<number>| is the occurrence of the page numbering scheme.\bigskip
697 %
698 % If you want to refer to the first page of a page numbering scheme,
699 % just place a label there, e.\,g.
700 % \begin{verbatim}
701 %\pagenumbering{Roman}
702 %\section{Section title\label{RomanSection}}
703 %\end{verbatim}
704 % (You know where you use |\pagenumbering{...}| and this is the \xpackage{pageslts} package,
705 % not the \xpackage{firstpage} package).\bigskip
706 %
707 % When you want to give the number of pages of each \textquotedblleft sector\textquotedblright\ of
708 % the page numbering scheme, you can use\newline
709 % \DescribeMacro{pagesLTS. page numbering scheme . number .local.cnt}
710 % |\lastpages{<page numbering scheme>}{<number>}|,\newline
711 % where |<page numbering scheme>| is e.\,g.~Roman, arabic,\ldots\ and |<number>| the
712 % \textquotedblleft sector\textquotedblright{} number, e.\,g.~|\lastpages{Roman}{2}|.\newline
713 % (Internally, the counter has the format |pagesLTS.<page numbering scheme>.<number>.local.cnt|.)
714 %
715 % If you used the page numbering scheme Roman for three times, you could say
716 % \begin{verbatim}
717 % Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}\newline
718 % There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline
719 % \lastpages{Roman}{1}~pages in the first Roman sector
720 % (\pageref{Roman} -- \lastpageref{pagesLTS.Roman.1}),\newline
721 % \lastpages{Roman}{2}~pages in the second Roman sector
722 % (\pageref{Roman2} -- \lastpageref{pagesLTS.Roman.2}), and\newline
723 % \lastpages{Roman}{3}~pages in the third Roman sector
724 % (\pageref{Roman3} -- \lastpageref{pagesLTS.Roman.3}.
725 % \end{verbatim}%
726 % to get%
727 % \begin{quote}%
728 % Last Roman page (pagesLTS.Roman): VIII\newline
729 % There are 8 pages with Roman numbers:\newline
730 % 3 pages in the first Roman sector (I -- III),\newline
731 % 4 pages in the second Roman sector (IV -- VII), and\newline
732 % 3 pages in the third Roman sector (VIII -- X).
733 % \end{quote}
734 % (see e.\,g.~the compiled \textsf{pageslts-example} file).\bigskip
735 %
736 % If you want to continue one page numbering scheme, but later on (third use of it,
737 % or for another page numbering scheme) want to reset the page number,
738 % just say |\setcounter{page}{1}| there.\bigskip
739 %
740 % In your document the code
741 % \begin{verbatim}
742 % \makeatletter
743 % \renewcommand{\@evenfoot}%
744 % {\normalsize\slshape DRAFT \today\hfil \upshape page {\thepage} (\theCurrentPage) of\ %
745 % \lastpageref{pagesLTS.Roman} + \lastpageref{pagesLTS.arabic}\ = \lastpageref{LastPages} pages%
746 % }
747 % \renewcommand{\@oddfoot}{\@evenfoot}
748 % \makeatother
749 %\end{verbatim}
750 % creates footers like\bigskip
751 %
752 % \textquotedblleft\mbox{\textsl{DRAFT \today}\hspace{1cm}page V (5) of VII + 35 = 42 pages}\textquotedblright\bigskip
753 %
754 % or\bigskip
755 %
756 % \textquotedblleft\mbox{\textsl{DRAFT \today}\hspace{1cm}page 10 (17) of VII + 35 = 42 pages}\textquotedblright\bigskip
757 %
758 % in the compiled document (cf.~the \texttt{pageslts-example} file).\bigskip
759 %
760 % Code like
761 % \begin{verbatim}
762 % This book has \lastpageref{pagesLTS.Roman}+\lastpageref{pagesLTS.arabic} pages %
763 % (\lastpageref{LastPages} pages in total).
764 %\end{verbatim}
765 % produces output like
766 % \begin{quote}
767 % This book has X+85 pages (95 pages in total).
768 % \end{quote}
769 % (when using the \xpackage{hyperref} package, the references are even hyperlinked).\bigskip
770 %
771 % If |\addtocounter{page}{...}| or |\setcounter{page}{...}| have been used, the local version of
772 % \texttt{CurrentPage} can be used, |\theCurrentPageLocal|, see subsection~\ref{CurrentPageLocal}.\bigskip
773 %
774 % \subsection{\xpackage{papermas}(s) package\label{ss:papermas}}
775 % There is a kind of an add-on to this package, the \xpackage{papermas} package,
776 % which can be used to compute the number of sheets of paper needed to print a document
777 % (you can print more than one page of a document on one sheet of paper) as well as the
778 % approximate mass of the printout. \url{https://ctan.org/pkg/papermas}
779 %
780 % \section{A few warnings\label{sec:warn}}
781 % \subsection{Hyperref and repeated page numbers}
782 % When two (or more) different page numbering schemes are used, or the page number is reset,
783 % or for any other reason there are two pages with the same number (maybe in different format,
784 % e.\,g.~$1$ and \textsc{I}), and \xpackage{hyperref} has not been configured right,
785 % this can cause problems. Use \xpackage{hyperref} with \texttt{plainpages=false} and
786 % \texttt{pdfpagelabels=true}, and everything should be fine. More details can be found at
787 % \url{https://texfaq.org/FAQ-pdfpagelabels}.
788 %
789 % \subsection{\xpackage{showkeys} package\label{ssec:showkeys}}
790 % When the \xpackage{showkeys} package has been loaded in \texttt{draft} mode,
791 % in the margin for each label a~box is displayed with the name of the label.
792 % \xpackage{showkeys} accomplishes this by redefining |\label|, but
793 % \xpackage{pageslts} does not always use |\label|, but sometimes writes directly into
794 % the {\nobreak |\jobname|\xfile{.aux}-}\allowbreak file, and this is generally done
795 % \emph{after} the according page has shipped out, therefore no box can be placed
796 % on the \emph{preceding} page. At~least \xpackage{pageslts} gives a warning, that
797 % \xpackage{showkeys} cannot present the respective label.
798 %
799 % \subsection{\xpackage{lastpage} package\label{ssec:lastpage}}
800 % This package first started as a revision of the \xpackage{lastpage} package of
801 % \textsc{Jeffrey P. Goldberg} (jeffrey+news at goldmark dot org), but then I deemed
802 % a replacement necessary to accomplish what this package does. For backward compatibility,
803 % a~label named |LastPage| is provided. Thus |\usepackage{lastpage}| can be replaced by\newline
804 % |\usepackage[pagecontinue=false,alphMult=0,AlphMulti=0,fnsymbolmult=false,romanMult=false,RomanMulti=false%|%
805 % \linebreak{}| ]{pageslts}|,\newline
806 % if the behaviour of the \xpackage{lastpage} package should be simulated.
807 % It is also possible to load both packages (if recent versions are used).
808 %
809 % \subsection{Using an unknown page numbering scheme\label{sec:unknown}}
810 % While at the time of the latest revision of the \xpackage{pageslts} package
811 % no other page numbering schemes (e.\,g.~Greek, Hebraic) were known to the maintainer,
812 % this package in principle works with every scheme which is recognized by the original
813 % |\pagenumbering| command. But the \xpackage{hyperref} package only then works with
814 % special page names, if the references to those pages are given in a certain way,
815 % thus the combination of a new page numbering scheme, the \xpackage{hyperref} and the
816 % \xpackage{pageslts} package might not work.~--
817 % The \xpackage{pageslts} package by itself also works with schemes, which the original
818 % |\pagenumbering{...}| does not recognize, but because the original
819 % |\pagenumbering{...}| is called by the \xpackage{pageslts} package, this might cause
820 % an error. Especially if the last page uses this new page numbering scheme,
821 % you should check everything double (at least).\newline
822 % And if the number format is unknown to \LaTeX , the pages will have no number, and
823 % therefore cannot be referenced. You might be able to help yourself by using the
824 % \xpackage{hyperref} package and manually placing |\phantomsectin|\,s and
825 % \nolinebreak{|\label{|\ldots|}|\,s} or even |\hypertarget|\,s and
826 % \nolinebreak{|\href|\,s.}\pagebreak
827 %
828 % \subsection{Page counter overflow\label{ss:overflow}}
829 % \underline{\textbf{WITHOUT~(!)}} the use of the \xpackage{alphalph} package, the\\[0.6ex]
830 % \textquotedblleft ranges of supported counter values are more or less restricted.
831 % Only \cs{arabic} can be used with any counter value \TeX\ supports.
832 % \begin{quote}
833 % \catcode`\|=12 %
834 % \begin{tabular}{@{}l|l|l|l@{}}
835 % Presentation & Supported & Ignored & Error message\\
836 % command & domain & values & `Counter too large'\\
837 % \hline
838 % \cs{arabic}
839 % & \ttfamily -MAX..MAX & &\\
840 % \cs{roman}, \cs{Roman}
841 % & \ttfamily 1..MAX & \ttfamily -MAX..0 &\\
842 % \cs{alph}, \cs{Alph}
843 % & \ttfamily 1..26 & 0 & \ttfamily -MAX..-1, 27..MAX\\
844 % \cs{fnsymbol}
845 % & \ttfamily 1..9 & 0 & \ttfamily -MAX..-1, 10..MAX\\
846 % \hline
847 % \end{tabular}\\[1ex]
848 % \texttt{MAX} = \texttt{2147483647}
849 % \end{quote}
850 % \textquotedblright\ (\xpackage{alphalph} package manual, 2019/12/09, v2.6,
851 % first table, p.~2).\newline
852 % Please see subsubsections~\ref{sss:alphalph} and \ref{sss:romanMult} for
853 % instructions how to overcome these limitations -- except \mbox{$\pm$MAX:}
854 % When this is exceeded via
855 % |\setcounter{<name>}{| something greater than MAX (or smaller then $-$MAX) |}|,
856 % then the error
857 % \begin{quote}
858 % \begin{verbatim}
859 % ! Number too big.
860 % I can only go up to 2147483647='17777777777="7FFFFFFF,
861 % so I'm using that number instead of yours.
862 % \end{verbatim}
863 % \end{quote}
864 % \vspace{-\baselineskip}
865 % will arise. But if the counter has a value of $2\,147\,483\,647 = {}$MAX,
866 % and |\addtocounter{<name>}{+1}| is tried, no error is issued, but
867 % |\arabic{<name>}| (as well as |\number\value{<name>}|) prints $-2147483648$,
868 % and further |\addtocounter{<name>}{+1}|s give $-2147483647$, $-2147483646$ and so on.\newline
869 % For a counter value of $-2\,147\,483\,647 = -$MAX and |\addtocounter{<name>}{-1}|s
870 % after $-2147483647$ it is printed $-2147483648$, $2147483647$, $2147483646$ and so on
871 % (without any message in the \xfile{log} file about any possible issue).
872 % \newpage
873 %
874 % \section{Alternatives\label{sec:Alternatives}}
875 % There are similar packages, which do (or do not) similar things.
876 % As I neither know what exactly you want to accomplish when using this package
877 % (e.\,g.~page number vs. page name, hyperlinks or not), nor what resources
878 % your system has (e.\,g.~\TeX, \LaTeX2e, $\varepsilon$-\TeX{}, \LaTeX-format as recent
879 % as 2024-11-01 or newer), here is a list of some possible alternatives:
880 % \begin{description}
881 % \item[-]\DescribeMacro{LaTeX-kernel}
882 % The number of pages is nowadays available via |\@abspage@last|,
883 % |\thetotalpages|, and |\PreviousTotalPages| from the kernel,
884 % but when more than one page numbering scheme is used
885 % (for example pages I~to X and then 1~to 10, thus number of pages
886 % \hbox{\textquotedblleft 20\textquotedblright ,} but name of the last page
887 % \hbox{\textquotedblleft 10\textquotedblright ),}
888 % or when or the fnsymbol page numbering scheme is used, or another package
889 % has output after this package, or the page numbers exceed a certain range,
890 % there might be issues. (Is the total number of pages wanted? Or is the name
891 % of the last page sought?)\newline
892 % |\the\ReadonlyShipoutCounter| contains the number of currently shipped out pages,
893 % i.\,e.~current page minus one.
894 %
895 % \item[-]\DescribeMacro{LastPage}
896 % The \xpackage{lastpage} package also provides the \texttt{LastPage} label
897 % (but not \texttt{VeryLastPage} or \texttt{LastPages}). If you only want this and/or
898 % have a quite limited amount of \TeX\ resources, you might want to use that package instead.
899 % It includes versions for older \LaTeX-kernels and even for \mbox{\LaTeX2.09{}.}\newline
900 % \url{https://ctan.org/pkg/lastpage}
901 %
902 % \item[-]\DescribeMacro{totpages}
903 % The \xpackage{totpages} package provides a \texttt{totpages} label similar to
904 % \texttt{LastPages}, but |\AtEndDocument| instead of hook |enddocument/|\linebreak |afterlastpage|.
905 % Therefore you should stay with \xpackage{pageslts}.
906 % The \xpackage{totpages} package additionally computes the number of paper sheets
907 % needed to (double) print the document (with one, two, three,\ldots{} pages on
908 % one sheet of paper) (which can be achieved also with the \xpackage{papermas} package
909 % (see \autoref{ss:papermas}).\newline
910 % \url{https://ctan.org/pkg/totpages}
911 %
912 % \item[-]\DescribeMacro{totalcount}
913 % The \xpackage{totalcount} package provides |\totalpages|.
914 % If there are only arabic page numbers consecutively running from 1 to the last page,
915 % this works. But for example
916 %
917 % \begin{quote}
918 %\begin{verbatim}
919 %\documentclass{article}
920 %\usepackage[page]{totalcount}
921 %\pagenumbering{Roman}
922 %\begin{document}
923 %\addtocounter{page}{49}
924 %Page \thepage{} of \totalpages
925 %\end{document}
926 %\end{verbatim}
927 % \end{quote}
928 %
929 % prints \textquotedblleft Page L of 50\textquotedblright,
930 % where the number of pages is one (and no hyperlink is provided to the
931 % last page even if \xpackage{hyperref} is used).\newline
932 % \url{https://ctan.org/pkg/totalcount}
933 %
934 % \item[-]\DescribeMacro{totcount}
935 % The \xpackage{totcount} package provides the last value of a counter, thus also the value
936 % of the \texttt{page} counter. You do not get a hyperlink to the last page, only the numerical
937 % value of the last page name is given \mbox{(i.\,e.~X+72} pages gives 72 instead of 82
938 % as total number of pages), and the number of pages can be changed for example
939 % by |\addtocounter|.\newline
940 % \url{https://ctan.org/pkg/totcount}
941 %
942 % \item[-]\DescribeMacro{nofm}
943 % \textquotedblleft There is a package \xpackage{nofm.sty} available, but some versions
944 % of it are defective, and most don't work with \xpackage{fancyhdr} because they take over
945 % the complete page layout.\textquotedblright{} (\textsc{Piet van Oostrum}:
946 % Page layout in \LaTeX , March~2, 2004, section~16; fancyhdr.pdf)\newline
947 % \xpackage{nofm} as of 1991/02/25 (without version number), available at\newline
948 % \url{https://mirror.ctan.org/obsolete/macros/latex209/contrib/misc/nofm.sty},\newline
949 % does not work with e.\,g.~\xpackage{hyperref}, redefines |\enddocument|
950 % as well as |\@oddhead|, |\@evenhead|, |\@oddfoot|, and |\@evenfoot|.\newline
951 % If you know the (\url{https://CTAN.org}) location of a
952 % \textbf{working}~(!) version, please send me an e-mail, thanks!
953 %
954 % \item[-]\DescribeMacro{count1to}
955 % The \xpackage{count1to} package \textquotedblleft sets |\count1| to |\count8|
956 % with the values of page to subparagraph. |\count9| is used to flag odd
957 % pages. \ldots\ [T]he code for the TotalPages
958 % label\textquotedblright\ (package manual, 2024-06-13) has been removed
959 % from the current package version.\newline
960 % \url{https://ctan.org/pkg/count1to}
961 %
962 % \item[-]\DescribeMacro{zref}
963 % The \xpackage{zref} package \textquotedblleft implements an extensible referencing
964 % system\textquotedblright\ (package manual, 2023-09-14).\newline
965 % \url{https://ctan.org/pkg/zref}
966 %
967 % \item[-]\DescribeMacro{memoir}
968 % The \xpackage{memoir} \emph{class} provides |\thelastpage| (page number printed
969 % on last page) and |\thelastsheet| (number of pages).
970 % \end{description}
971 %
972 % \bigskip
973 %
974 % \noindent (You programmed or found another alternative,
975 % which is available at \url{https://CTAN.org}?\newline
976 % OK, send an e-mail to me with the name, location at CTAN,
977 % and a short notice, and I will probably include it in the list above.)
978 % \newpage
979 %
980 % \section{Example}
981 % \begin{macrocode}
982 %<*example>
983 \documentclass[british]{article}[2025/01/22]% v1.4n
984 \usepackage{lipsum}[2021-09-20]% v2.7
985 \usepackage[draft]{showkeys}[2024/05/23]% v3.21
986 %% Use final instead of draft to hide the keys. %%
987 \usepackage[pdfpagelabels=true,hyperindex=false]{hyperref}[2024-11-05]% v7.01l
988 \makeatletter
989 \@ifpackageloaded{hyperref}{% Hypertext links for LaTeX
990 \hypersetup{extension=pdf,%
991 plainpages=false,%
992 pdflang={en},%
993 pdftitle={pageslts package example},%
994 pdfauthor={H.-Martin Muench},%
995 pdfsubject={Example for the pageslts package},%
996 pdfkeywords={LaTeX, pageslts},%
997 pdfview=Fit,%
998 pdfstartview=Fit,%
999 pdfpagelayout=SinglePage,%
1000 bookmarksopen=true%
1001 }}{\usepackage{url}[2013/09/16]}% v3.4
1002 \makeatother
1003 \usepackage[pagecontinue=true,alphMult=ab,AlphMulti=AB,fnsymbolmult=true,%
1004 romanMult=true,RomanMulti=true]{pageslts}[2025-08-14]% v2.0g
1005 %% These are the default options. %%
1006
1007 \makeatletter
1008 \renewcommand{\@evenfoot}%
1009 {Page \thepage\ (\theCurrentPage; local: \theCurrentPageLocal) of %
1010 \lastpageref{pagesLTS.roman}(\lastpageref{pagesLTS.roman.local}) + %
1011 \ifpagesLTS@pagecontinue%
1012 \lastpageref{pagesLTS.Roman}(\lastpageref{pagesLTS.Roman.local}) %
1013 \else%
1014 \{\lastpageref{pagesLTS.Roman.1}%
1015 +\lastpageref{pagesLTS.Roman.2}%
1016 +\lastpageref{pagesLTS.Roman.3}%
1017 (\lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=%
1018 \the\numexpr%
1019 \csname [email protected]\endcsname%
1020 +\csname [email protected]\endcsname%
1021 +\csname [email protected]\endcsname%
1022 \relax)\} %
1023 \fi + %
1024 \lastpageref{pagesLTS.arabic}(\lastpageref{pagesLTS.arabic.local}) + %
1025 \lastpageref{pagesLTS.fnsymbol}(\lastpageref{pagesLTS.fnsymbol.local}) + %
1026 \lastpageref{pagesLTS.alph}(\lastpageref{pagesLTS.alph.local}) + %
1027 \lastpageref{pagesLTS.gobble}(\lastpageref{pagesLTS.gobble.local}) + %
1028 \lastpageref{pagesLTS.Alph}(\lastpageref{pagesLTS.Alph.local}) = %
1029 \lastpageref{LastPages} pages.%
1030 }
1031 \renewcommand{\@oddfoot}{\@evenfoot}
1032 \def\pagesLTSexampleArabic{3}
1033 \def\pagesLTSexamplealph{23}
1034 \makeatother
1035 \setlength{\parindent}{0pt}
1036 \listfiles
1037 \begin{document}
1038 \pagenumbering{roman}
1039 %% Note the first \pagenumbering immediately behind \begin{document}! %%
1040 %%\addtocounter{page}{-2} %%
1041 \section*{Example for pageslts}
1042 \addcontentsline{toc}{section}{Example for pageslts}
1043 \markboth{Example for pageslts}{Example for pageslts}
1044
1045 This example demonstrates the most common uses of package\newline
1046 \textsf{pageslts}, v2.0g as of 2025-08-14 (HMM);\newline
1047 \url{https://ctan.org/pkg/pageslts}.\bigskip
1048
1049 The used options were \texttt{pagecontinue=true},
1050 \texttt{alphMult=ab}, \texttt{AlphMulti=AB}, \linebreak
1051 \texttt{fnsymbolmult=true},
1052 \texttt{romanMult=true}, and \texttt{RomanMulti=true}
1053 (the default\linebreak ones).~-- For more details please see the documentation!\bigskip
1054
1055 \label{keys} To hide the \pageref{keys}{\qquad } use option
1056 \texttt{final} instead of \texttt{draft} with the \textsf{showkeys}
1057 package (or remove the package call from the preamble of
1058 this document).\bigskip
1059
1060 \textbf{Hyperlinks or not:} If the \textsf{hyperref} package is loaded,
1061 the references are also hyperlinked:\bigskip
1062 \smallskip
1063 Page \thepage\ (\theCurrentPage; local: \theCurrentPageLocal) of %
1064 \lastpageref{pagesLTS.roman}(\lastpageref{pagesLTS.roman.local}) + %
1065 \makeatletter%
1066 \ifpagesLTS@pagecontinue%
1067 \lastpageref{pagesLTS.Roman}(\lastpageref{pagesLTS.Roman.local}) %
1068 \else%
1069 \{\lastpageref{pagesLTS.Roman.1}%
1070 +\lastpageref{pagesLTS.Roman.2}%
1071 +\lastpageref{pagesLTS.Roman.3}%
1072 (\lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=%
1073 \the\numexpr%
1074 \csname [email protected]\endcsname%
1075 +\csname [email protected]\endcsname%
1076 +\csname [email protected]\endcsname%
1077 \relax)\} %
1078 \fi + %
1079 \makeatother%
1080 \lastpageref{pagesLTS.arabic}(\lastpageref{pagesLTS.arabic.local}) + %
1081 \lastpageref{pagesLTS.fnsymbol}(\lastpageref{pagesLTS.fnsymbol.local}) + %
1082 \lastpageref{pagesLTS.alph}(\lastpageref{pagesLTS.alph.local}) + %
1083 \lastpageref{pagesLTS.Alph}(\lastpageref{pagesLTS.Alph.local}) = %
1084 \lastpageref{LastPages} pages.\bigskip
1085 If the \textsf{hyperref} package is loaded, but the hyperlinks of the
1086 references shall be suppressed, \verb|\pageref*{...}|
1087 and \verb|\lastpageref*{...}| can be used:\\[0.5\baselineskip]
1088 Page \thepage\ (\theCurrentPage; local: \theCurrentPageLocal) of %
1089 \lastpageref*{pagesLTS.roman}(\lastpageref*{pagesLTS.roman.local}) + %
1090 \makeatletter%
1091 \ifpagesLTS@pagecontinue%
1092 \lastpageref*{pagesLTS.Roman}(\lastpageref*{pagesLTS.Roman.local}) %
1093 \else%
1094 \{\lastpageref*{pagesLTS.Roman.1}%
1095 +\lastpageref*{pagesLTS.Roman.2}%
1096 +\lastpageref*{pagesLTS.Roman.3}%
1097 (\lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=%
1098 \the\numexpr%
1099 \csname [email protected]\endcsname%
1100 +\csname [email protected]\endcsname%
1101 +\csname [email protected]\endcsname%
1102 \relax)\} %
1103 \fi + %
1104 \makeatother%
1105 \lastpageref*{pagesLTS.arabic}(\lastpageref*{pagesLTS.arabic.local}) + %
1106 \lastpageref*{pagesLTS.fnsymbol}(\lastpageref*{pagesLTS.fnsymbol.local}) + %
1107 \lastpageref*{pagesLTS.alph}(\lastpageref*{pagesLTS.alph.local}) + %
1108 \lastpageref*{pagesLTS.Alph}(\lastpageref*{pagesLTS.Alph.local}) = %
1109 \lastpageref*{LastPages} pages.\bigskip
1110
1111 \textbf{Trademarks} appear throughout this example without any
1112 trademark symbol; they are the property of their respective
1113 trademark owner. There is no intention of infringement; the
1114 usage is to the benefit of the trademark owner.\bigskip
1115
1116 \textbf{Tip}: Use \textit{logical page numbers} for the display of the pdf
1117 (in Adobe Acrobat Reader Continuous Release 2024.005.20320:\newline
1118 Edit $>$ Preferences $>$ Categories: Page Display $>$
1119 Page Content and Information: Use logical page numbers)!\bigskip
1120
1121 You want negative page numbers? Not only arabic, but even roman,
1122 Roman, alph, Alph or fnsymbol ones? No problem, e.\,g.~just give a\newline
1123 \verb|\addtocounter{page}{|-\textit{some number}\verb|}| in the
1124 source code of this example file (or uncomment the prepared line)!
1125 \newpage
1126 \tableofcontents
1127 \newpage%
1128 \makeatletter%
1129 \def\pagesLTS@tmpC{roman}%
1130 \ifx\pagesLTS@pnc\pagesLTS@tmpC%
1131 \else\pagenumbering{roman}%
1132 %% in case the page numbering is changed before,
1133 %% otherwise pagesLTS.current.local.roman on this page would be undefined
1134 \fi%
1135 \makeatother%
1136 \section{roman}
1137
1138 (\texttt{roman} page numbering was started before,
1139 because the page numbering scheme was needed to start at
1140 the first page, of course.)\bigskip
1141
1142 First page (\verb|\lastpageref{pagesLTS.0}|):
1143 \lastpageref{pagesLTS.0}\bigskip
1144
1145 The page (\verb|\thepage|): \thepage \bigskip
1146
1147 Current page (\verb|\theCurrentPage|),
1148 i.\,e.~counted continuously from the first\linebreak page):~\theCurrentPage \bigskip
1149 You can get this also in other formats:
1150 \roman{CurrentPage}, \Roman{CurrentPage}, \arabic{CurrentPage},
1151 \fnsymbol{CurrentPage}, \alph{CurrentPage}, \Alph{CurrentPage}.
1152
1153 CurrentPageLocal (\verb|\theCurrentPageLocal|),
1154 i.\,e.~counted continuously from the first page of the
1155 current page numbering scheme (if option pagecontinue=false: sector)):
1156 \theCurrentPageLocal\newline
1157 You can get also this in other formats, too:
1158 \roman{pagesLTS.current.local.roman}, \Roman{pagesLTS.current.local.roman},
1159 \arabic{pagesLTS.current.local.roman}, \fnsymbol{pagesLTS.current.local.roman},
1160 \alph{pagesLTS.current.local.roman}, \Alph{pagesLTS.current.local.roman},
1161 but probably it only makes sense if page numbering scheme and format are
1162 the same, e.\,g.\newline
1163 \verb|\Roman{pagesLTS.current.local.Roman}|\newline
1164 or \verb|\Alph{pagesLTS.current.local.Alph}|. \verb|\number\value{...}| could
1165 make sense even if combined with another page numbering scheme.
1166 And this is exactly what \verb|\theCurrentPageLocal| does:\newline
1167 \nolinebreak{\verb|\def\theCurrentPageLocal{\number\value{pagesLTS.current.local.\pagesLTS@pnc}}|.}\bigskip
1168
1169 Last roman page (pagesLTS.roman): \lastpageref{pagesLTS.roman}{\hskip4em }
1170 (There are \lastpageref{pagesLTS.roman.local} pages with roman numbers.)\bigskip
1171
1172 Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}{\hskip3em }%
1173 \makeatletter%
1174 \ifpagesLTS@pagecontinue%
1175 (There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline
1176 \else%
1177 (There are %
1178 \lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=%
1179 \the\numexpr%
1180 \csname [email protected]\endcsname%
1181 +\csname [email protected]\endcsname%
1182 +\csname [email protected]\endcsname%
1183 \relax~pages with Roman numbers:\newline
1184 \fi%
1185 \makeatother%
1186 \lastpages{Roman}{1}~pages in the first Roman sector
1187 (\pageref{Roman}{\hskip3em }-\lastpageref{pagesLTS.Roman.1}{\hskip3em }),\newline
1188 \lastpages{Roman}{2}~pages in the second Roman sector
1189 (\pageref{Roman2}{\hskip3em }-\lastpageref{pagesLTS.Roman.2}{\hskip3em }), and\newline
1190 \lastpages{Roman}{3}~pages in the third Roman sector
1191 (\pageref{Roman3}{\hskip3em }-\lastpageref{pagesLTS.Roman.3}{\hskip3em }).)\bigskip
1192
1193 When the option \texttt{pagecontinue=false} is used with the
1194 \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will
1195 point to the same page as before, but this will have a lower number.
1196 And if that page number was also present in a preceding sector,
1197 the link will go to that page. (Several pages with the same number\ldots)\newline
1198 The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number
1199 of pages in the last sector. To get the total number of Roman pages, %
1200 \begin{verbatim}
1201 \the\numexpr \csname [email protected]\endcsname%
1202 +\csname [email protected]\endcsname%
1203 +\csname [email protected]\endcsname%
1204 \relax%
1205 \end{verbatim}%
1206 would be necessary.\bigskip
1207
1208 Last arabic page (pagesLTS.arabic): \lastpageref{pagesLTS.arabic}{\hskip5em }
1209 (There are only \lastpageref{pagesLTS.arabic.local} pages with arabic numbers,
1210 because an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| was used.)\bigskip
1211
1212 Last fnsymbol page (pagesLTS.fnsymbol): \lastpageref{pagesLTS.fnsymbol}\newline
1213 (better \verb|\lastpageref{pagesLTS.fnsymbol}| than just\newline
1214 \verb|\pageref{pagesLTS.fnsymbol}|!)\newline
1215 (There are \lastpageref{pagesLTS.fnsymbol.local} pages with fnsymbol numbers.)\bigskip
1216
1217 Last alph page (pagesLTS.alph): \lastpageref{pagesLTS.alph}{\hskip4em }
1218 (There are only \lastpageref{pagesLTS.alph.local} pages with alph numbers,
1219 because an \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}| was used.)\bigskip
1220
1221 Last Alph page (pagesLTS.Alph): \lastpageref{pagesLTS.Alph}{\hskip4em }
1222 (There are \lastpageref{pagesLTS.Alph.local} pages with Alph numbers.)\bigskip
1223
1224 Last page's \textit{name} (LastPage): \lastpageref{LastPage}\bigskip
1225
1226 Very last page's \textit{name} (VeryLastPage): \lastpageref{VeryLastPage}\newline
1227 (\texttt{LastPage} and \texttt{VeryLastPage} are now identical, because both are now done
1228 \verb|\AddToHook{enddocument/afterlastpage}| instead of formerly\newline
1229 \verb|\AtEndDocument| and \verb|\AfterLastShipout|, which were different.)\bigskip
1230
1231 Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em }
1232 (=~total number of pages)
1233 \newpage
1234 \pagenumbering{Roman}
1235 \section{Roman\label{Roman}}
1236 \subsection{Common Roman page numbering}
1237
1238 First page (\verb|\lastpageref{pagesLTS.0}|):
1239 \lastpageref{pagesLTS.0}\bigskip
1240
1241 The page (\verb|\thepage|): \thepage\bigskip
1242
1243 Current page (\verb|\theCurrentPage|),
1244 i.\,e.~counted continuously from the first page): \theCurrentPage\bigskip
1245
1246 CurrentPageLocal (\verb|\theCurrentPageLocal|),
1247 i.\,e.~counted continuously from the first page of the
1248 current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip
1249
1250 Last roman page (pagesLTS.roman): \lastpageref{pagesLTS.roman}{\hskip4em }
1251 (There are \lastpageref{pagesLTS.roman.local} pages with roman numbers.)\bigskip
1252
1253 Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}{\hskip3em }%
1254 \makeatletter%
1255 \ifpagesLTS@pagecontinue%
1256 (There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline
1257 \else%
1258 (There are %
1259 \lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=%
1260 \the\numexpr%
1261 \csname [email protected]\endcsname%
1262 +\csname [email protected]\endcsname%
1263 +\csname [email protected]\endcsname%
1264 \relax~pages with Roman numbers:\newline
1265 \fi%
1266 \makeatother%
1267 \lastpages{Roman}{1}~pages in the first Roman sector
1268 (\pageref{Roman}{\hskip3em }-\lastpageref{pagesLTS.Roman.1}{\hskip3em }),\newline
1269 \lastpages{Roman}{2}~pages in the second Roman sector
1270 (\pageref{Roman2}{\hskip3em }-\lastpageref{pagesLTS.Roman.2}{\hskip3em }), and\newline
1271 \lastpages{Roman}{3}~pages in the third Roman sector
1272 (\pageref{Roman3}{\hskip3em }-\lastpageref{pagesLTS.Roman.3}{\hskip3em }).)\bigskip
1273
1274 When the option \texttt{pagecontinue=false} is used with the
1275 \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will
1276 point to the same page as before, but this will have a lower number.
1277 And if that page number was also present in a preceding sector,
1278 the link will go to that page. (Several pages with the same number\ldots)\newline
1279 The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number
1280 of pages in the last sector. To get the total number of Roman pages, %
1281 \begin{verbatim}
1282 \the\numexpr \csname [email protected]\endcsname%
1283 +\csname [email protected]\endcsname%
1284 +\csname [email protected]\endcsname%
1285 \relax%
1286 \end{verbatim}%
1287 would be necessary.
1288 \pagebreak
1289
1290 Last arabic page (pagesLTS.arabic): \lastpageref{pagesLTS.arabic}{\hskip5em }
1291 (There are only \lastpageref{pagesLTS.arabic.local} pages with arabic numbers,
1292 because an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| was used.)\bigskip
1293
1294 Last fnsymbol page (pagesLTS.fnsymbol): \lastpageref{pagesLTS.fnsymbol}\newline
1295 (better \verb|\lastpageref{pagesLTS.fnsymbol}| than just\newline
1296 \verb|\pageref{pagesLTS.fnsymbol}|!)\bigskip
1297
1298 (There are \lastpageref{pagesLTS.fnsymbol.local} pages with fnsymbol numbers.)\bigskip
1299
1300 Last alph page (pagesLTS.alph): \lastpageref{pagesLTS.alph}{\hskip4em }
1301 (There are only \lastpageref{pagesLTS.alph.local} pages with alph numbers,
1302 because an \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}| was used.)\bigskip
1303
1304 Last Alph page (pagesLTS.Alph): \lastpageref{pagesLTS.Alph}{\hskip4em }
1305 (There are \lastpageref{pagesLTS.Alph.local} pages with Alph numbers.)\bigskip
1306
1307 Last page's \textit{name} (LastPage): \lastpageref{LastPage}\bigskip
1308
1309 Very last page's \textit{name} (VeryLastPage): \lastpageref{VeryLastPage}\newline
1310 (\texttt{LastPage} and \texttt{VeryLastPage} are now identical, because both are now done
1311 \verb|\AddToHook{enddocument/afterlastpage}| instead of formerly\newline
1312 \verb|\AtEndDocument| and \verb|\AfterLastShipout|, which were different.)\bigskip
1313
1314 Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em }
1315 (=~total number of pages)
1316
1317 \newpage
1318 \subsection{Last page of first Roman sector}
1319 \verb|\lastpageref{pagesLTS.Roman}| does \textbf{not}
1320 refer to this page (but there: \lastpageref{pagesLTS.Roman}).
1321 When a reference to this page is wanted,\newline
1322 \verb|\lastpageref{pagesLTS.Roman.1}| can be used: \lastpageref{pagesLTS.Roman.1}.\bigskip
1323
1324 There are \lastpages{Roman}{1}~pages (\verb|\lastpages{Roman}{1}|)
1325 in this first Roman sector.\newline
1326 The Roman page numbering scheme is continued later in section~\ref{Roman2})!
1327
1328 \newpage
1329 \pagenumbering{arabic}
1330 \section{arabic}
1331 \subsection{Standard page numbering}
1332
1333 First page (\verb|\lastpageref{pagesLTS.0}|):
1334 \lastpageref{pagesLTS.0}\bigskip
1335
1336 The page (\verb|\thepage|): \thepage \bigskip
1337
1338 Current page (\verb|\theCurrentPage|),
1339 i.\,e.~counted continuously from the first page): \theCurrentPage \bigskip
1340
1341 CurrentPageLocal (\verb|\theCurrentPageLocal|),
1342 i.\,e.~counted continuously from the first page of the
1343 current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip
1344
1345 Last roman page (pagesLTS.roman): \lastpageref{pagesLTS.roman}{\hskip4em }
1346 (There are \lastpageref{pagesLTS.roman.local} pages with roman numbers.)\bigskip
1347
1348 Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}{\hskip3em }%
1349 \makeatletter%
1350 \ifpagesLTS@pagecontinue%
1351 (There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline
1352 \else%
1353 (There are %
1354 \lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=%
1355 \the\numexpr%
1356 \csname [email protected]\endcsname%
1357 +\csname [email protected]\endcsname%
1358 +\csname [email protected]\endcsname%
1359 \relax~pages with Roman numbers:\newline
1360 \fi%
1361 \makeatother%
1362 \lastpages{Roman}{1}~pages in the first Roman sector
1363 (\pageref{Roman}{\hskip3em }-\lastpageref{pagesLTS.Roman.1}{\hskip3em }),\newline
1364 \lastpages{Roman}{2}~pages in the second Roman sector
1365 (\pageref{Roman2}{\hskip3em }-\lastpageref{pagesLTS.Roman.2}{\hskip3em }), and\newline
1366 \lastpages{Roman}{3}~pages in the third Roman sector
1367 (\pageref{Roman3}{\hskip3em }-\lastpageref{pagesLTS.Roman.3}{\hskip3em }).)\bigskip
1368
1369 When the option \texttt{pagecontinue=false} is used with the
1370 \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will
1371 point to the same page as before, but this will have a lower number.
1372 And if that page number was also present in a preceding sector,
1373 the link will go to that page. (Several pages with the same number\ldots)\newline
1374 The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number
1375 of pages in the last sector. To get the total number of Roman pages, %
1376 \begin{verbatim}
1377 \the\numexpr \csname [email protected]\endcsname%
1378 +\csname [email protected]\endcsname%
1379 +\csname [email protected]\endcsname%
1380 \relax%
1381 \end{verbatim}%
1382 would be necessary.
1383 \pagebreak
1384
1385 Last arabic page (pagesLTS.arabic): \lastpageref{pagesLTS.arabic}{\hskip5em }
1386 (There are only \lastpageref{pagesLTS.arabic.local} pages with arabic numbers,
1387 because an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| was used.)\bigskip
1388
1389 Last fnsymbol page (pagesLTS.fnsymbol): \lastpageref{pagesLTS.fnsymbol}\newline
1390 (better \verb|\lastpageref{pagesLTS.fnsymbol}| than just\newline
1391 \verb|\pageref{pagesLTS.fnsymbol}|!)\bigskip
1392
1393 (There are \lastpageref{pagesLTS.fnsymbol.local} pages with fnsymbol numbers.)\bigskip
1394
1395 Last alph page (pagesLTS.alph): \lastpageref{pagesLTS.alph}{\hskip4em }
1396 (There are only \lastpageref{pagesLTS.alph.local} pages with alph numbers,
1397 because an \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}| was used.)\bigskip
1398
1399 Last Alph page (pagesLTS.Alph): \lastpageref{pagesLTS.Alph}{\hskip4em }
1400 (There are \lastpageref{pagesLTS.Alph.local} pages with Alph numbers.)\bigskip
1401
1402 Last page's \textit{name} (LastPage): \lastpageref{LastPage}\bigskip
1403
1404 Very last page's \textit{name} (VeryLastPage): \lastpageref{VeryLastPage}\newline
1405 (\texttt{LastPage} and \texttt{VeryLastPage} are now identical, because both are now done
1406 \verb|\AddToHook{enddocument/afterlastpage}| instead of formerly\newline
1407 \verb|\AtEndDocument| and \verb|\AfterLastShipout|, which were different.)\bigskip
1408
1409 Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em }
1410 (=~total number of pages)
1411
1412 \newpage
1413 \thispagestyle{empty}
1414 \subsection[Empty page style]{Also an empty page style is no problem %
1415 for the current or total page count}
1416
1417 \bigskip
1418
1419 First page (\verb|\lastpageref{pagesLTS.0}|):
1420 \lastpageref{pagesLTS.0}\bigskip
1421
1422 The page (\verb|\thepage|): \thepage \bigskip
1423
1424 Current page (\verb|\theCurrentPage|),
1425 i.\,e.~counted continuously from the first page): \theCurrentPage \bigskip
1426
1427 CurrentPageLocal (\verb|\theCurrentPageLocal|),
1428 i.\,e.~counted continuously from the first page of the
1429 current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip
1430
1431 Last roman page (pagesLTS.roman): \lastpageref{pagesLTS.roman}{\hskip4em }
1432 (There are \lastpageref{pagesLTS.roman.local} pages with roman numbers.)\bigskip
1433
1434 Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}{\hskip3em }%
1435 \makeatletter%
1436 \ifpagesLTS@pagecontinue%
1437 (There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline
1438 \else%
1439 (There are %
1440 \lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=%
1441 \the\numexpr%
1442 \csname [email protected]\endcsname%
1443 +\csname [email protected]\endcsname%
1444 +\csname [email protected]\endcsname%
1445 \relax~pages with Roman numbers:\newline
1446 \fi%
1447 \makeatother%
1448 \lastpages{Roman}{1}~pages in the first Roman sector
1449 (\pageref{Roman}{\hskip3em }-\lastpageref{pagesLTS.Roman.1}{\hskip3em }),\newline
1450 \lastpages{Roman}{2}~pages in the second Roman sector
1451 (\pageref{Roman2}{\hskip3em }-\lastpageref{pagesLTS.Roman.2}{\hskip3em }), and\newline
1452 \lastpages{Roman}{3}~pages in the third Roman sector
1453 (\pageref{Roman3}{\hskip3em }-\lastpageref{pagesLTS.Roman.3}{\hskip3em }).)\newline
1454
1455 When the option \texttt{pagecontinue=false} is used with the
1456 \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will
1457 point to the same page as before, but this will have a lower number.
1458 And if that page number was also present in a preceding sector,
1459 the link will go to that page. (Several pages with the same number\ldots)\newline
1460 The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number
1461 of pages in the last sector. To get the total number of Roman pages, %
1462 \begin{verbatim}
1463 \the\numexpr \csname [email protected]\endcsname%
1464 +\csname [email protected]\endcsname%
1465 +\csname [email protected]\endcsname%
1466 \relax%
1467 \end{verbatim}%
1468 would be necessary.
1469 \pagebreak
1470
1471 Last arabic page (pagesLTS.arabic): \lastpageref{pagesLTS.arabic}{\hskip5em }
1472 (There are only \lastpageref{pagesLTS.arabic.local} pages with arabic numbers,
1473 because an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| was used.)\bigskip
1474
1475 Last fnsymbol page (pagesLTS.fnsymbol): \lastpageref{pagesLTS.fnsymbol}\newline
1476 (better \verb|\lastpageref{pagesLTS.fnsymbol}| than just\newline
1477 \verb|\pageref{pagesLTS.fnsymbol}|!)\bigskip
1478
1479 (There are \lastpageref{pagesLTS.fnsymbol.local} pages with fnsymbol numbers.)\bigskip
1480
1481 Last alph page (pagesLTS.alph): \lastpageref{pagesLTS.alph}{\hskip4em }
1482 (There are only \lastpageref{pagesLTS.alph.local} pages with alph numbers,
1483 because an \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}| was used.)\bigskip
1484
1485 Last Alph page (pagesLTS.Alph): \lastpageref{pagesLTS.Alph}{\hskip4em }
1486 (There are \lastpageref{pagesLTS.Alph.local} pages with Alph numbers.)\bigskip
1487
1488 Last page's \textit{name} (LastPage): \lastpageref{LastPage}\bigskip
1489
1490 Very last page's \textit{name} (VeryLastPage): \lastpageref{VeryLastPage}\newline
1491 (\texttt{LastPage} and \texttt{VeryLastPage} are now identical, because both are now done
1492 \verb|\AddToHook{enddocument/afterlastpage}| instead of formerly\newline
1493 \verb|\AtEndDocument| and \verb|\AfterLastShipout|, which were different.)\bigskip
1494
1495 Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em }
1496 (=~total number of pages)
1497
1498 \newpage
1499 \subsection[addtocounter, setcounter]{Neither %
1500 \texttt{\textbackslash addtocounter\{page\}} nor %
1501 \texttt{\textbackslash setcounter\{page\}} is a problem for the %
1502 current or total page numbers}
1503
1504 (Here is an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}|
1505 in the source code.)
1506 \addtocounter{page}{\pagesLTSexampleArabic}\bigskip
1507
1508 The page (from \verb|\thepage| command): \thepage \bigskip
1509
1510 Current page (from \verb|\theCurrentPage|\ %
1511 command), i.\,e.~counted continuously from the first page): \theCurrentPage \bigskip
1512
1513 CurrentPageLocal (from \verb|\theCurrentPageLocal|\ %
1514 command), i.\,e.~counted continuously from the first page of the
1515 current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip
1516
1517 Last page's number (LastPages): \lastpageref{LastPages}{\hskip3em }
1518 (= total number of pages)
1519
1520 \newpage
1521 \pagenumbering{fnsymbol}
1522 \section{fnsymbol}
1523
1524 Without option \texttt{fnsymbolmult=true} of the \textsf{pageslts} package
1525 (and the help of the \textsf{alphalph} package),
1526 after page~9 (\textquotedblleft \ensuremath {\ddagger \ddagger }\textquotedblright )
1527 (and also for negative page numbers) there would just appear a
1528 \begin{quote}
1529 \begin{verbatim}
1530 LaTeX Error: Counter too large
1531 See the LaTeX manual or LaTeX Companion for explanation.
1532 You've lost some text. Try typing <return> to proceed.
1533 If that doesn't work, type X <return> to quit.
1534 \end{verbatim}
1535 \end{quote}
1536 Now the page numbers after 5 (\ensuremath {\mathparagraph }) are
1537 continued with the doubled \textquotedblleft number\textquotedblright{} of
1538 the first, second, third,\ldots\ page (\ensuremath {**},
1539 \ensuremath {\dagger \dagger }, \ensuremath {\ddagger \ddagger },
1540 \ensuremath {\mathsection \mathsection },
1541 \ensuremath {\mathparagraph \mathparagraph }),
1542 and after the tenth page the \textquotedblleft number\textquotedblright{} is
1543 tripled (\ensuremath {***}, \ensuremath {\dagger \dagger \dagger },\ldots).
1544 Page zero is named 0 and negative pages are just named like the positive ones
1545 with addition of a minus \mbox{sign ($-$).}
1546
1547 \bigskip
1548
1549 For testing purposes, try:
1550
1551 \begin{small}
1552 \begin{verbatim}
1553 \documentclass{article}
1554 \usepackage[plainpages=false,pageanchor=true,pdfpagelabels=true]{hyperref}
1555 \usepackage{pageslts}
1556 \pagenumbering{fnsymbol}
1557 \begin{document}
1558 First page.\newpage
1559 \verb|\lastpageref{pagesLTS.0} | \lastpageref{pagesLTS.0} \par
1560 \verb|\lastpageref{pagesLTS.0.local} | \lastpageref{pagesLTS.0.local} \par
1561 \verb|\lastpageref{LastPage} | \lastpageref{LastPage} \par
1562 \verb|\lastpageref{VeryLastPage} | \lastpageref{VeryLastPage} \par
1563 \verb|\lastpageref{pagesLTS.fnsymbol.1} | \lastpageref{pagesLTS.fnsymbol.1} \par
1564 \verb|\lastpageref{pagesLTS.fnsymbol.1.local} | \lastpageref{pagesLTS.fnsymbol.1.local} \par
1565 \verb|\lastpageref{pagesLTS.fnsymbol} | \lastpageref{pagesLTS.fnsymbol} \par
1566 \verb|\lastpageref{pagesLTS.fnsymbol.local} | \lastpageref{pagesLTS.fnsymbol.local} \par
1567 \verb|\lastpageref{LastPages} | \lastpageref{LastPages} \par
1568 \verb|\pagesLTSlastpage | \pagesLTSlastpage
1569 \newpage
1570 Last page.
1571 \end{document}
1572 \end{verbatim}
1573 \end{small}
1574 \newpage
1575
1576 First page (\verb|\lastpageref{pagesLTS.0}|):
1577 \lastpageref{pagesLTS.0}\bigskip
1578
1579 The page (\verb|\thepage|): \thepage \bigskip
1580
1581 Current page (\verb|\theCurrentPage|),
1582 i.\,e.~counted continuously from the first page): \theCurrentPage \bigskip
1583
1584 CurrentPageLocal (\verb|\theCurrentPageLocal|),
1585 i.\,e.~counted continuously from the first page of the
1586 current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip
1587
1588 Last roman page (pagesLTS.roman): \lastpageref{pagesLTS.roman}{\hskip4em }
1589 (There are \lastpageref{pagesLTS.roman.local} pages with roman numbers.)\bigskip
1590
1591 Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}{\hskip3em }%
1592 \makeatletter%
1593 \ifpagesLTS@pagecontinue%
1594 (There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline
1595 \else%
1596 (There are %
1597 \lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=%
1598 \the\numexpr%
1599 \csname [email protected]\endcsname%
1600 +\csname [email protected]\endcsname%
1601 +\csname [email protected]\endcsname%
1602 \relax~pages with Roman numbers:\newline
1603 \fi%
1604 \makeatother%
1605 \lastpages{Roman}{1}~pages in the first Roman sector
1606 (\pageref{Roman}{\hskip3em }-\lastpageref{pagesLTS.Roman.1}{\hskip3em }),\newline
1607 \lastpages{Roman}{2}~pages in the second Roman sector
1608 (\pageref{Roman2}{\hskip3em }-\lastpageref{pagesLTS.Roman.2}{\hskip3em }), and\newline
1609 \lastpages{Roman}{3}~pages in the third Roman sector
1610 (\pageref{Roman3}{\hskip3em }-\lastpageref{pagesLTS.Roman.3}{\hskip3em }).)\bigskip
1611
1612 When the option \texttt{pagecontinue=false} is used with the
1613 \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will
1614 point to the same page as before, but this will have a lower number.
1615 And if that page number was also present in a preceding sector,
1616 the link will go to that page. (Several pages with the same number\ldots)\newline
1617 The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number
1618 of pages in the last sector. To get the total number of Roman pages, %
1619 \begin{verbatim}
1620 \the\numexpr \csname [email protected]\endcsname%
1621 +\csname [email protected]\endcsname%
1622 +\csname [email protected]\endcsname%
1623 \relax%
1624 \end{verbatim}%
1625 would be necessary.\bigskip
1626
1627 Last arabic page (pagesLTS.arabic): \lastpageref{pagesLTS.arabic}{\hskip5em }
1628 (There are only \lastpageref{pagesLTS.arabic.local} pages with arabic numbers,
1629 because an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| was used.)\bigskip
1630
1631 Last fnsymbol page (pagesLTS.fnsymbol): \lastpageref{pagesLTS.fnsymbol}\newline
1632 (better \verb|\lastpageref{pagesLTS.fnsymbol}| than just\newline
1633 \verb|\pageref{pagesLTS.fnsymbol}|!)\bigskip
1634
1635 (There are \lastpageref{pagesLTS.fnsymbol.local} pages with fnsymbol numbers.)\bigskip
1636
1637 Last alph page (pagesLTS.alph): \lastpageref{pagesLTS.alph}{\hskip4em }
1638 (There are only \lastpageref{pagesLTS.alph.local} pages with alph numbers,
1639 because an \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}| was used.)\bigskip
1640
1641 Last Alph page (pagesLTS.Alph): \lastpageref{pagesLTS.Alph}{\hskip4em }
1642 (There are \lastpageref{pagesLTS.Alph.local} pages with Alph numbers.)\bigskip
1643
1644 Last page's \textit{name} (LastPage): \lastpageref{LastPage}\bigskip
1645
1646 Very last page's \textit{name} (VeryLastPage): \lastpageref{VeryLastPage}\newline
1647 (\texttt{LastPage} and \texttt{VeryLastPage} are now identical, because both are now done
1648 \verb|\AddToHook{enddocument/afterlastpage}| instead of formerly\newline
1649 \verb|\AtEndDocument| and \verb|\AfterLastShipout|, which were different.)\bigskip
1650
1651 Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em }
1652 (=~total number of pages)\bigskip
1653
1654 \lipsum[1-58]
1655
1656 \newpage
1657 \pagenumbering{Roman}
1658 \section{Roman -- again!\label{Roman2}}
1659
1660 The page number starts with \textquotedblleft I\textquotedblright{} again for
1661 option just \texttt{pagecontinue=false}, but for option \texttt{pagecontinue=true},
1662 or with option just \texttt{pagecontinue}, or even just
1663 \nolinebreak{with\textbf{out}} option \texttt{pagecontinue=false}
1664 the page numbers are continued.
1665
1666 This package remembered the
1667 $\number\value{pagesLTS.double.Roman}-1$,
1668 i.\,e.~\the\numexpr\value{pagesLTS.double.Roman}-1\relax, pages
1669 already done in Roman output, and therefore continues with page
1670 \textquotedblleft\Roman{pagesLTS.double.Roman}\textquotedblright{} in
1671 case of option \texttt{pagecontinue}.\newline
1672 If you want to start with \textquotedblleft I\textquotedblright{} all
1673 over again, you will have two pages with the same name,
1674 but nevertheless you can do this by using option \texttt{pagecontinue=false}
1675 or a \verb|\setcounter{page}{1}|\ here (not demonstrated in this example file).\bigskip
1676
1677 There was the question: \textquotedblleft With option \verb|pagecontinue=false|,
1678 how do I get the number of pages in each number block (e.\,g.~in the first Roman section,
1679 second Roman section, third Roman section) with just one command?\textquotedblright
1680 \begin{verbatim}
1681 \makeatletter%
1682 \theCurrentPageLocal~of~\lastpageref*{%
1683 pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}.local}%
1684 \makeatother%
1685 \end{verbatim}
1686 provides this. Here: %
1687 \makeatletter%
1688 \theCurrentPageLocal~of~%
1689 \lastpageref*{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}.local}\newline%
1690 \makeatother%
1691 for \verb|pagecontinue=true| is \verb|4 of 8| (including %
1692 \makeatletter%
1693 $\the\numexpr\csname [email protected]\endcsname -1\relax$ %
1694 from the first Roman section,
1695 $\the\csname [email protected]\endcsname\relax
1696 =\the\numexpr\csname [email protected]\endcsname -1\relax% first section
1697 +1% first page of this second section
1698 $, $\the\numexpr\csname [email protected]\endcsname -1+%
1699 \csname [email protected]\endcsname\relax%
1700 =\the\numexpr\csname [email protected]\endcsname -1\relax+%
1701 \the\numexpr\csname [email protected]\endcsname\relax$)\newline
1702 \makeatother%
1703 and for \verb|pagecontinue=false| is \verb|1 of 5| .\bigskip
1704
1705 \verb|pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}.local| is:
1706 \begin{description}
1707 \item[-] \verb|pagesLTS| just identifies this counter to belong to the pageslts package.
1708 \item[-] \verb|\pagesLTS@pnc| is the Current Page Numbering scheme, i.\,e.~here it would be \verb|Roman|.
1709 \item[-] \verb|\number\value{pagesLTS.pnc.\pagesLTS@pnc}| is the value of counter\newline
1710 \verb|pagesLTS.pnc.\pagesLTS@pnc| printed in arabic numbers (1, 2, 3, ...) -- see below.
1711 \item[-] \verb|local|: Local there are 5 pages with Roman numbering in this example, globally there are
1712 $3+5+4=12$~pages with Roman numbering in this example, and the local numbers are wanted.
1713 \end{description}
1714 The counter \verb|pagesLTS.pnc.\pagesLTS@pnc| gives the number of the\newline
1715 \verb|\pagesLTS@pnc| page numbering scheme currently used, i.\,e.~we have consecutivly\newpage
1716 \begin{verbatim}
1717 pagesLTS.pnc.roman = 1
1718 pagesLTS.pnc.Roman = 1
1719 pagesLTS.pnc.arabic = 1
1720 pagesLTS.pnc.fnsymbol = 1
1721 pagesLTS.pnc.Roman = 2
1722 pagesLTS.pnc.alph = 1
1723 pagesLTS.pnc.Roman = 3
1724 pagesLTS.pnc.Alph = 1
1725 \end{verbatim}
1726 So, \verb|pagesLTS.pnc.Roman| changes from $1$ to $2$ automatically
1727 when doing the second \verb|\pagenumbering{Roman}|,
1728 and changes from $2$ to $3$ for the third\newline
1729 \verb|\pagenumbering{Roman}|.\bigskip
1730
1731 First page (\verb|\lastpageref{pagesLTS.0}|):
1732 \lastpageref{pagesLTS.0}\bigskip
1733
1734 The page (\verb|\thepage|): \thepage \bigskip
1735
1736 Current page (\verb|\theCurrentPage|),
1737 i.\,e.~counted continuously from the first page): \theCurrentPage \bigskip
1738
1739 CurrentPageLocal (\verb|\theCurrentPageLocal|),
1740 i.\,e.~counted continuously from the first page of the
1741 current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip
1742
1743 Last roman page (pagesLTS.roman): \lastpageref{pagesLTS.roman}{\hskip4em }
1744 (There are \lastpageref{pagesLTS.roman.local} pages with roman numbers.)\bigskip
1745
1746
1747 Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}{\hskip3em }%
1748 \makeatletter%
1749 \ifpagesLTS@pagecontinue%
1750 (There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline
1751 \else%
1752 (There are %
1753 \lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=%
1754 \the\numexpr%
1755 \csname [email protected]\endcsname%
1756 +\csname [email protected]\endcsname%
1757 +\csname [email protected]\endcsname%
1758 \relax~pages with Roman numbers:\newline
1759 \fi%
1760 \makeatother%
1761 \lastpages{Roman}{1}~pages in the first Roman sector
1762 (\pageref{Roman}{\hskip3em }-\lastpageref{pagesLTS.Roman.1}{\hskip3em }),\newline
1763 \lastpages{Roman}{2}~pages in the second Roman sector
1764 (\pageref{Roman2}{\hskip3em }-\lastpageref{pagesLTS.Roman.2}{\hskip3em }), and\newline
1765 \lastpages{Roman}{3}~pages in the third Roman sector
1766 (\pageref{Roman3}{\hskip3em }-\lastpageref{pagesLTS.Roman.3}{\hskip3em }).)\bigskip
1767
1768 When the option \texttt{pagecontinue=false} is used with the
1769 \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will
1770 point to the same page as before, but this will have a lower number.
1771 And if that page number was also present in a preceding sector,
1772 the link will go to that page. (Several pages with the same number\ldots)\newline
1773 The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number
1774 of pages in the last sector. To get the total number of Roman pages, %
1775 \begin{verbatim}
1776 \the\numexpr \csname [email protected]\endcsname%
1777 +\csname [email protected]\endcsname%
1778 +\csname [email protected]\endcsname%
1779 \relax%
1780 \end{verbatim}%
1781 would be necessary.\bigskip
1782
1783 Last arabic page (pagesLTS.arabic): \lastpageref{pagesLTS.arabic}{\hskip5em }
1784 (There are only \lastpageref{pagesLTS.arabic.local} pages with arabic numbers,
1785 because an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| was used.)\bigskip
1786
1787 Last fnsymbol page (pagesLTS.fnsymbol): \lastpageref{pagesLTS.fnsymbol}\newline
1788 (\verb|\lastpageref{pagesLTS.fnsymbol}| -- never
1789 \verb|\pageref{pagesLTS.fnsymbol}|!)\newline
1790 (There are \lastpageref{pagesLTS.fnsymbol.local} pages with fnsymbol numbers.)\bigskip
1791
1792 Last alph page (pagesLTS.alph): \lastpageref{pagesLTS.alph}{\hskip4em }
1793 (There are only \lastpageref{pagesLTS.alph.local} pages with alph numbers,
1794 because an \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}| was used.)\bigskip
1795
1796 Last Alph page (pagesLTS.Alph): \lastpageref{pagesLTS.Alph}{\hskip4em }
1797 (There are \lastpageref{pagesLTS.Alph.local} pages with Alph numbers.)\bigskip
1798
1799 Last page's \textit{name} (LastPage): \lastpageref{LastPage}\bigskip
1800
1801 Very last page's \textit{name} (VeryLastPage): \lastpageref{VeryLastPage}\newline
1802 (\texttt{LastPage} and \texttt{VeryLastPage} are now identical, because both are now done
1803 \verb|\AddToHook{enddocument/afterlastpage}| instead of formerly\newline
1804 \verb|\AtEndDocument| and \verb|\AfterLastShipout|, which were different.)\bigskip
1805
1806 Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em }
1807 (=~total number of pages)\bigskip
1808
1809 \lipsum[1-6]
1810
1811 \newpage
1812
1813 \verb|\lastpageref{pagesLTS.Roman}| does \textbf{not}
1814 refer to this page (but there: \lastpageref{pagesLTS.Roman})
1815 for option \texttt{pagecontinue=true}. When a reference to this page is wanted,\newline
1816 \verb|\lastpageref{pagesLTS.Roman.2}| can be used: \lastpageref{pagesLTS.Roman.2}.\newline
1817 When the option \texttt{pagecontinue=false} is used with the
1818 \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will
1819 point to the same page as before, but this will have a lower number.
1820 And if that page number was also present in a preceding sector,
1821 the link will go to that page. (Several pages with the same number\ldots)\newline
1822 The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number
1823 of pages in the last sector. To get the total number of Roman pages, %
1824 \begin{verbatim}
1825 \the\numexpr \csname [email protected]\endcsname%
1826 +\csname [email protected]\endcsname%
1827 +\csname [email protected]\endcsname%
1828 \relax%
1829 \end{verbatim}%
1830 would be necessary.\bigskip
1831
1832 There are \lastpages{Roman}{2}~pages (\verb|\lastpages{Roman}{2}|) in this
1833 second Roman sector.\newline
1834 The Roman page numbering scheme is continued later in section~\ref{Roman3})!
1835
1836 \newpage
1837 \pagenumbering{alph}
1838 \section{alph\label{alph}}
1839
1840 First page (\verb|\lastpageref{pagesLTS.0}|):
1841 \lastpageref{pagesLTS.0}\bigskip
1842
1843 The page (\verb|\thepage|): \thepage \bigskip
1844
1845 Current page (\verb|\theCurrentPage|),
1846 i.\,e.~counted continuously from the first page): \theCurrentPage \bigskip
1847
1848 CurrentPageLocal (\verb|\theCurrentPageLocal|),
1849 i.\,e.~counted continuously from the first page of the
1850 current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip
1851
1852 Last roman page (pagesLTS.roman): \lastpageref{pagesLTS.roman}{\hskip4em }
1853 (There are \lastpageref{pagesLTS.roman.local} pages with roman numbers.)\bigskip
1854
1855 Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}{\hskip3em }%
1856 \makeatletter%
1857 \ifpagesLTS@pagecontinue%
1858 (There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline
1859 \else%
1860 (There are %
1861 \lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=%
1862 \the\numexpr%
1863 \csname [email protected]\endcsname%
1864 +\csname [email protected]\endcsname%
1865 +\csname [email protected]\endcsname%
1866 \relax~pages with Roman numbers:\newline
1867 \fi%
1868 \makeatother%
1869 \lastpages{Roman}{1}~pages in the first Roman sector
1870 (\pageref{Roman}{\hskip3em }-\lastpageref{pagesLTS.Roman.1}{\hskip3em }),\newline
1871 \lastpages{Roman}{2}~pages in the second Roman sector
1872 (\pageref{Roman2}{\hskip3em }-\lastpageref{pagesLTS.Roman.2}{\hskip3em }), and\newline
1873 \lastpages{Roman}{3}~pages in the third Roman sector
1874 (\pageref{Roman3}{\hskip3em }-\lastpageref{pagesLTS.Roman.3}{\hskip3em }).)\bigskip
1875
1876 When the option \texttt{pagecontinue=false} is used with the
1877 \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will
1878 point to the same page as before, but this will have a lower number.
1879 And if that page number was also present in a preceding sector,
1880 the link will go to that page. (Several pages with the same number\ldots)\newline
1881 The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number
1882 of pages in the last sector. To get the total number of Roman pages, %
1883 \begin{verbatim}
1884 \the\numexpr \csname [email protected]\endcsname%
1885 +\csname [email protected]\endcsname%
1886 +\csname [email protected]\endcsname%
1887 \relax%
1888 \end{verbatim}%
1889 would be necessary.\bigskip
1890
1891 Last arabic page (pagesLTS.arabic): \lastpageref{pagesLTS.arabic}{\hskip5em }
1892 (There are only \lastpageref{pagesLTS.arabic.local} pages with arabic numbers,
1893 because an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| was used.)\bigskip
1894
1895 Last fnsymbol page (pagesLTS.fnsymbol): \lastpageref{pagesLTS.fnsymbol}\newline
1896 (better \verb|\lastpageref{pagesLTS.fnsymbol}| than just\newline
1897 \verb|\pageref{pagesLTS.fnsymbol}|!)\bigskip
1898
1899 (There are \lastpageref{pagesLTS.fnsymbol.local} pages with fnsymbol numbers.)\bigskip
1900
1901 Last alph page (pagesLTS.alph): \lastpageref{pagesLTS.alph}{\hskip4em }
1902 (There are only \lastpageref{pagesLTS.alph.local} pages with alph numbers,
1903 because an \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}| was used.)\bigskip
1904
1905 Last Alph page (pagesLTS.Alph): \lastpageref{pagesLTS.Alph}{\hskip4em }
1906 (There are \lastpageref{pagesLTS.Alph.local} pages with Alph numbers.)\bigskip
1907
1908 Last page's \textit{name} (LastPage): \lastpageref{LastPage}\bigskip
1909
1910 Very last page's \textit{name} (VeryLastPage): \lastpageref{VeryLastPage}\newline
1911 (\texttt{LastPage} and \texttt{VeryLastPage} are now identical, because both are now done
1912 \verb|\AddToHook{enddocument/afterlastpage}| instead of formerly\newline
1913 \verb|\AtEndDocument| and \verb|\AfterLastShipout|, which were different.)\bigskip
1914
1915 Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em }
1916 (=~total number of pages)
1917
1918 \newpage
1919
1920 Without option \texttt{alphMult=ab} of the \textsf{pageslts} (and the help of the
1921 \textsf{alphalph} package), after page \textquotedblleft z\textquotedblright{} there
1922 would just appear a
1923 \begin{quote}
1924 \begin{verbatim}
1925 LaTeX Error: Counter too large
1926 See the LaTeX manual or LaTeX Companion for explanation.
1927 You've lost some text. Try typing <return> to proceed.
1928 If that doesn't work, type X <return> to quit.
1929 \end{verbatim}
1930 \end{quote}
1931 Now the page numbers are continued aa, ab, ac,\ldots\ (aa, bb, cc,\ldots\ is
1932 also possible, see the \textsf{pageslts} documentation).\newline
1933 To demonstrate this, we add a\newline
1934 \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}|\newline
1935 in the source code here.
1936
1937 \addtocounter{page}{\pagesLTSexamplealph}
1938
1939 \bigskip
1940
1941 \lipsum[1-18]
1942
1943 \newpage
1944 \pagenumbering{Roman}
1945 \section{Roman - third time!\label{Roman3}}
1946
1947 The page number starts with \textquotedblleft I\textquotedblright{} again for
1948 option just \texttt{pagecontinue=false}, but for option \texttt{pagecontinue=true},
1949 or with option just \texttt{pagecontinue}, or even just
1950 \nolinebreak{with\textbf{out}} option \texttt{pagecontinue=false}
1951 the page numbers are continued.
1952
1953 This package remembered the
1954 $\number\value{pagesLTS.double.Roman}-1$,
1955 i.\,e.~\the\numexpr\value{pagesLTS.double.Roman}-1\relax, pages
1956 already done in%
1957 \begin{description}
1958 \item[-] for \texttt{pagecontinue=false}: the preceding Roman sector,
1959 \item[-] for \texttt{pagecontinue=true}: all Roman sectors,
1960 \end{description}%
1961 and therefore continues with the appropriate page in case of option \texttt{pagecontinue}.\newline
1962 If you want to start with \textquotedblleft I\textquotedblright{} all
1963 over again, you will have two pages with the same name,
1964 but nevertheless you can do this by using option \texttt{pagecontinue=false}
1965 or a \verb|\setcounter{page}{1}|\ here (not demonstrated in this example file).\bigskip
1966
1967 First page (\verb|\lastpageref{pagesLTS.0}|):
1968 \lastpageref{pagesLTS.0}\bigskip
1969
1970 The page (\verb|\thepage|): \thepage \bigskip
1971
1972 Current page (\verb|\theCurrentPage|),
1973 i.\,e.~counted continuously from the first page): \theCurrentPage \bigskip
1974
1975 CurrentPageLocal (\verb|\theCurrentPageLocal|),
1976 i.\,e.~counted continuously from the first page of the
1977 current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip
1978
1979 Last roman page (pagesLTS.roman): \lastpageref{pagesLTS.roman}{\hskip4em }
1980 (There are \lastpageref{pagesLTS.roman.local} pages with roman numbers.)\bigskip
1981
1982 Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}{\hskip3em }%
1983 \makeatletter%
1984 \ifpagesLTS@pagecontinue%
1985 (There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline
1986 \else%
1987 (There are %
1988 \lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=%
1989 \the\numexpr%
1990 \csname [email protected]\endcsname%
1991 +\csname [email protected]\endcsname%
1992 +\csname [email protected]\endcsname%
1993 \relax~pages with Roman numbers:\newline
1994 \fi%
1995 \makeatother%
1996 \lastpages{Roman}{1}~pages in the first Roman sector
1997 (\pageref{Roman}{\hskip3em }-\lastpageref{pagesLTS.Roman.1}{\hskip3em }),\newline
1998 \lastpages{Roman}{2}~pages in the second Roman sector
1999 (\pageref{Roman2}{\hskip3em }-\lastpageref{pagesLTS.Roman.2}{\hskip3em }), and\newline
2000 \lastpages{Roman}{3}~pages in the third Roman sector
2001 (\pageref{Roman3}{\hskip3em }-\lastpageref{pagesLTS.Roman.3}{\hskip3em }).)\bigskip
2002
2003 When the option \texttt{pagecontinue=false} is used with the
2004 \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will
2005 point to the same page as before, but this will have a lower number.
2006 And if that page number was also present in a preceding sector,
2007 the link will go to that page. (Several pages with the same number\ldots)\newline
2008 The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number
2009 of pages in the last sector. To get the total number of Roman pages, %
2010 \begin{verbatim}
2011 \the\numexpr \csname [email protected]\endcsname%
2012 +\csname [email protected]\endcsname%
2013 +\csname [email protected]\endcsname%
2014 \relax%
2015 \end{verbatim}%
2016 would be necessary.\bigskip
2017
2018 Last arabic page (pagesLTS.arabic): \lastpageref{pagesLTS.arabic}{\hskip5em }
2019 (There are only \lastpageref{pagesLTS.arabic.local} pages with arabic numbers,
2020 because an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| was used.)\bigskip
2021
2022 Last fnsymbol page (pagesLTS.fnsymbol): \lastpageref{pagesLTS.fnsymbol}\newline
2023 (better \verb|\lastpageref{pagesLTS.fnsymbol}| than just\newline
2024 \verb|\pageref{pagesLTS.fnsymbol}|!)\bigskip
2025
2026 (There are \lastpageref{pagesLTS.fnsymbol.local} pages with fnsymbol numbers.)\bigskip
2027
2028 Last alph page (pagesLTS.alph): \lastpageref{pagesLTS.alph}{\hskip4em }
2029 (There are only \lastpageref{pagesLTS.alph.local} pages with alph numbers,
2030 because an \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}| was used.)\bigskip
2031
2032 Last Alph page (pagesLTS.Alph): \lastpageref{pagesLTS.Alph}{\hskip4em }
2033 (There are \lastpageref{pagesLTS.Alph.local} pages with Alph numbers.)\bigskip
2034
2035 Last page's \textit{name} (LastPage): \lastpageref{LastPage}\bigskip
2036
2037 Very last page's \textit{name} (VeryLastPage): \lastpageref{VeryLastPage}\newline
2038 (\texttt{LastPage} and \texttt{VeryLastPage} are now identical, because both are now done
2039 \verb|\AddToHook{enddocument/afterlastpage}| instead of formerly\newline
2040 \verb|\AtEndDocument| and \verb|\AfterLastShipout|, which were different.)\bigskip
2041
2042 Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em }
2043 (=~total number of pages)
2044 \newpage
2045 \lipsum[1-3]
2046 \newpage
2047
2048 \lastpageref{pagesLTS.Roman} (\verb|\lastpageref{pagesLTS.Roman}|)
2049 \textbf{does} refers to this page.\newline
2050 Also \verb|\lastpageref{pagesLTS.Roman.3}|
2051 give the right name of the page, but if \verb|pagecontinue=false| was chosen,
2052 it might point to another page with the same name!
2053 \lastpageref{pagesLTS.Roman.3}.\bigskip
2054
2055 \bigskip
2056
2057 There are \lastpages{Roman}{3}~pages (\verb|\lastpages{Roman}{3}|) in this
2058 third Roman sector.
2059
2060 \newpage
2061 \pagenumbering{gobble}
2062 \section{gobble}
2063
2064 Well. You can use \verb|gobble| as page numbering scheme. It gobbles the page numbers,
2065 i.\,e.~there is no page number. Maybe \verb|\thispagestyle{empty}| is more useful?
2066 Do not expect to be able to make working references to pages without page number,
2067 and do expect to get
2068 \begin{verbatim}
2069 pdfTeX warning (ext4): destination with the same identifier
2070 (name{page.}) has been already used, duplicate ignored
2071 <to be read again>
2072 \end{verbatim}
2073
2074 The page (\verb|\thepage|): \thepage{} (There is a nothing between two spaces there.)\bigskip
2075
2076 Current page (\verb|\theCurrentPage|),
2077 i.\,e.~counted continuously from the first page): \theCurrentPage \bigskip
2078
2079 CurrentPageLocal (\verb|\theCurrentPageLocal|),
2080 i.\,e.~counted continuously from the first page of the
2081 current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip
2082
2083 There are \lastpageref*{pagesLTS.gobble.local} pages with gobbled numbers (i.\,e.~without numbers).
2084
2085 \bigskip
2086
2087 For testing purposes, try:
2088
2089 \begin{small}
2090 \begin{verbatim}
2091 \documentclass{article}
2092 \usepackage[plainpages=false,pageanchor=true,pdfpagelabels=true]{hyperref}
2093 \usepackage{pageslts}
2094 \pagenumbering{gobble}
2095 \begin{document}
2096 First page.\newpage
2097 \verb|\lastpageref{pagesLTS.0} | \lastpageref{pagesLTS.0} \par
2098 \verb|\lastpageref{pagesLTS.0.local} | \lastpageref{pagesLTS.0.local} \par
2099 \verb|\lastpageref{LastPage} | \lastpageref{LastPage} \par
2100 \verb|\lastpageref{VeryLastPage} | \lastpageref{VeryLastPage} \par
2101 \verb|\lastpageref{pagesLTS.gobble.1} | \lastpageref{pagesLTS.gobble.1} \par
2102 \verb|\lastpageref{pagesLTS.gobble.1.local} | \lastpageref{pagesLTS.gobble.1.local} \par
2103 \verb|\lastpageref{pagesLTS.gobble} | \lastpageref{pagesLTS.gobble} \par
2104 \verb|\lastpageref{pagesLTS.gobble.local} | \lastpageref{pagesLTS.gobble.local} \par
2105 \verb|\lastpageref{LastPages} | \lastpageref{LastPages} \par
2106 \verb|\pagesLTSlastpage | \pagesLTSlastpage
2107 \newpage
2108 Last page.
2109 \end{document}
2110 \end{verbatim}
2111 \end{small}
2112 \newpage
2113
2114 \pagenumbering{Alph}
2115 \section{Alph}
2116
2117 First page (\verb|\lastpageref{pagesLTS.0}|):
2118 \lastpageref{pagesLTS.0}\bigskip
2119
2120 The page (\verb|\thepage|): \thepage \bigskip
2121
2122 Current page (\verb|\theCurrentPage|),
2123 i.\,e.~counted continuously from the first page): \theCurrentPage \bigskip
2124
2125 CurrentPageLocal (\verb|\theCurrentPageLocal|),
2126 i.\,e.~counted continuously from the first page of the
2127 current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip
2128
2129 Last roman page (pagesLTS.roman): \lastpageref{pagesLTS.roman}{\hskip4em }
2130 (There are \lastpageref{pagesLTS.roman.local} pages with roman numbers.)\bigskip
2131
2132 Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}{\hskip3em }%
2133 \makeatletter%
2134 \ifpagesLTS@pagecontinue%
2135 (There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline
2136 \else%
2137 (There are %
2138 \lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=%
2139 \the\numexpr%
2140 \csname [email protected]\endcsname%
2141 +\csname [email protected]\endcsname%
2142 +\csname [email protected]\endcsname%
2143 \relax~pages with Roman numbers:\newline
2144 \fi%
2145 \makeatother%
2146 \lastpages{Roman}{1}~pages in the first Roman sector
2147 (\pageref{Roman}{\hskip3em }-\lastpageref{pagesLTS.Roman.1}{\hskip3em }),\newline
2148 \lastpages{Roman}{2}~pages in the second Roman sector
2149 (\pageref{Roman2}{\hskip3em }-\lastpageref{pagesLTS.Roman.2}{\hskip3em }), and\newline
2150 \lastpages{Roman}{3}~pages in the third Roman sector
2151 (\pageref{Roman3}{\hskip3em }-\lastpageref{pagesLTS.Roman.3}{\hskip3em }).)\bigskip
2152
2153 When the option \texttt{pagecontinue=false} is used with the
2154 \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will
2155 point to the same page as before, but this will have a lower number.
2156 And if that page number was also present in a preceding sector,
2157 the link will go to that page. (Several pages with the same number\ldots)\newline
2158 The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number
2159 of pages in the last sector. To get the total number of Roman pages, %
2160 \begin{verbatim}
2161 \the\numexpr \csname [email protected]\endcsname%
2162 +\csname [email protected]\endcsname%
2163 +\csname [email protected]\endcsname%
2164 \relax%
2165 \end{verbatim}%
2166 would be necessary.\bigskip
2167
2168 Last arabic page (pagesLTS.arabic): \lastpageref{pagesLTS.arabic}{\hskip5em }
2169 (There are only \lastpageref{pagesLTS.arabic.local} pages with arabic numbers,
2170 because an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| was used.)\bigskip
2171
2172 Last fnsymbol page (pagesLTS.fnsymbol): \lastpageref{pagesLTS.fnsymbol}\newline
2173 (better \verb|\lastpageref{pagesLTS.fnsymbol}| than just\newline
2174 \verb|\pageref{pagesLTS.fnsymbol}|!)\newline
2175
2176 (There are \lastpageref{pagesLTS.fnsymbol.local} pages with fnsymbol numbers.)\bigskip
2177
2178 Last alph page (pagesLTS.alph): \lastpageref{pagesLTS.alph}{\hskip4em }
2179 (There are only \lastpageref{pagesLTS.alph.local} pages with alph numbers,
2180 because an \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}| was used.)\bigskip
2181
2182 Last Alph page (pagesLTS.Alph): \lastpageref{pagesLTS.Alph}{\hskip4em }
2183 (There are \lastpageref{pagesLTS.Alph.local} pages with Alph numbers.)\bigskip
2184
2185 Last page's \textit{name} (LastPage): \lastpageref{LastPage}\bigskip
2186
2187 Very last page's \textit{name} (VeryLastPage): \lastpageref{VeryLastPage}\newline
2188 (\texttt{LastPage} and \texttt{VeryLastPage} are now identical, because both are now done
2189 \verb|\AddToHook{enddocument/afterlastpage}| instead of formerly\newline
2190 \verb|\AtEndDocument| and \verb|\AfterLastShipout|, which were different.)\bigskip
2191
2192 Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em }
2193 (=~total number of pages)
2194 \newpage
2195
2196 Without option \texttt{alphMulti=AB} of the \textsf{pageslts}
2197 (and the help of the \textsf{alphalph} package), after page
2198 \textquotedblleft Z\textquotedblright{} there would just appear~a
2199 \begin{quote}
2200 \begin{verbatim}
2201 LaTeX Error: Counter too large
2202 See the LaTeX manual or LaTeX Companion for explanation.
2203 You've lost some text. Try typing <return> to proceed.
2204 If that doesn't work, type X <return> to quit.
2205 \end{verbatim}
2206 \end{quote}
2207 Now the page numbers are continued AA, AB, AC,\ldots\ (AA, BB, CC,\ldots\ is
2208 also possible, see the \textsf{pageslts} documentation).\newline
2209 This is not demonstrated here, but see section~\ref{alph}.
2210 \newpage
2211
2212 \section{silly}
2213 The sillypage package, \url{https://ctan.org/pkg/sillypage}, provides the
2214 page\-numbering scheme \verb|silly|, which is not demonstrated here
2215 but works with the pageslts package, i.\,e.~the references
2216 all show the right (page) number and link to the right page.\bigskip
2217
2218 This is \textbf{not} demonstrated here (discussing gobbled page numbers
2219 is silly enough), but for testing purposes, try:
2220
2221 \begin{small}
2222 \begin{verbatim}
2223 \documentclass{article}
2224 \usepackage[plainpages=false,pageanchor=true,pdfpagelabels=true]{hyperref}
2225 \usepackage{pageslts}
2226 \usepackage{sillypage}
2227 \pagenumbering{silly}
2228 \begin{document}
2229 First page.\newpage
2230 \verb|\lastpageref{pagesLTS.0} | \lastpageref{pagesLTS.0} \par
2231 \verb|\lastpageref{pagesLTS.0.local} | \lastpageref{pagesLTS.0.local} \par
2232 \verb|\lastpageref{LastPage} | \lastpageref{LastPage} \par
2233 \verb|\lastpageref{VeryLastPage} | \lastpageref{VeryLastPage} \par
2234 \verb|\lastpageref{pagesLTS.silly.1} | \lastpageref{pagesLTS.silly.1} \par
2235 \verb|\lastpageref{pagesLTS.silly.1.local} | \lastpageref{pagesLTS.silly.1.local} \par
2236 \verb|\lastpageref{pagesLTS.silly} | \lastpageref{pagesLTS.silly} \par
2237 \verb|\lastpageref{pagesLTS.silly.local} | \lastpageref{pagesLTS.silly.local} \par
2238 \verb|\lastpageref{LastPages} | \lastpageref{LastPages} \par
2239 \verb|\pagesLTSlastpage | \pagesLTSlastpage
2240 \newpage
2241 Page \theCurrentPage\newpage
2242 Page \theCurrentPage\newpage
2243 Page \theCurrentPage\newpage
2244 Page \theCurrentPage\newpage
2245 Page \theCurrentPage\newpage
2246 Page \theCurrentPage\newpage
2247 Page \theCurrentPage\newpage
2248 Page \theCurrentPage\newpage
2249 Page \theCurrentPage\newpage
2250 Page \theCurrentPage\newpage
2251 Page \theCurrentPage\newpage
2252 Page \theCurrentPage\newpage
2253 Page \theCurrentPage : Last page.
2254 \end{document}
2255 \end{verbatim}
2256 \end{small}
2257 \newpage
2258
2259 \section{The End}
2260
2261 First page (\verb|\lastpageref{pagesLTS.0}|):
2262 \lastpageref{pagesLTS.0}\bigskip
2263
2264 The page (\verb|\thepage|): \thepage \bigskip
2265
2266 Current page (\verb|\theCurrentPage|),
2267 i.\,e.~counted continuously from the first page): \theCurrentPage \bigskip
2268
2269 CurrentPageLocal (\verb|\theCurrentPageLocal|),
2270 i.\,e.~counted continuously from the first page of the
2271 current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip
2272
2273 Last roman page (pagesLTS.roman): \lastpageref{pagesLTS.roman}{\hskip4em }
2274 (There are \lastpageref{pagesLTS.roman.local} pages with roman numbers.)\bigskip
2275
2276 Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}{\hskip3em }%
2277 \makeatletter%
2278 \ifpagesLTS@pagecontinue%
2279 (There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline
2280 \else%
2281 (There are %
2282 \lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=%
2283 \the\numexpr%
2284 \csname [email protected]\endcsname%
2285 +\csname [email protected]\endcsname%
2286 +\csname [email protected]\endcsname%
2287 \relax~pages with Roman numbers:\newline
2288 \fi%
2289 \makeatother%
2290 \lastpages{Roman}{1}~pages in the first Roman sector
2291 (\pageref{Roman}{\hskip3em }-\lastpageref{pagesLTS.Roman.1}{\hskip3em }),\newline
2292 \lastpages{Roman}{2}~pages in the second Roman sector
2293 (\pageref{Roman2}{\hskip3em }-\lastpageref{pagesLTS.Roman.2}{\hskip3em }), and\newline
2294 \lastpages{Roman}{3}~pages in the third Roman sector
2295 (\pageref{Roman3}{\hskip3em }-\lastpageref{pagesLTS.Roman.3}{\hskip3em }).)\bigskip
2296
2297 When the option \texttt{pagecontinue=false} is used with the
2298 \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will
2299 point to the same page as before, but this will have a lower number.
2300 And if that page number was also present in a preceding sector,
2301 the link will go to that page. (Several pages with the same number\ldots)\newline
2302 The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number
2303 of pages in the last sector. To get the total number of Roman pages, %
2304 \begin{verbatim}
2305 \the\numexpr \csname [email protected]\endcsname%
2306 +\csname [email protected]\endcsname%
2307 +\csname [email protected]\endcsname%
2308 \relax%
2309 \end{verbatim}%
2310 would be necessary.\bigskip
2311
2312 Last arabic page (pagesLTS.arabic): \lastpageref{pagesLTS.arabic}{\hskip5em }
2313 (There are only \lastpageref{pagesLTS.arabic.local} pages with arabic numbers,
2314 because an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| was used.)\bigskip
2315
2316 Last fnsymbol page (pagesLTS.fnsymbol): \lastpageref{pagesLTS.fnsymbol}\newline
2317 (better \verb|\lastpageref{pagesLTS.fnsymbol}| than just\newline
2318 \verb|\pageref{pagesLTS.fnsymbol}|!)\bigskip
2319
2320 (There are \lastpageref{pagesLTS.fnsymbol.local} pages with fnsymbol numbers.)\bigskip
2321
2322 Last alph page (pagesLTS.alph): \lastpageref{pagesLTS.alph}{\hskip4em }
2323 (There are only \lastpageref{pagesLTS.alph.local} pages with alph numbers,
2324 because an \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}| was used.)\bigskip
2325
2326 Last gobble page (pagesLTS.gobble: \lastpageref{pagesLTS.gobble}{\hskip4em }
2327 Yes, there is neither page number nor link, because everything got gobbled.
2328 (There is \lastpageref*{pagesLTS.gobble.local} page with gobbled number (i.\,e.~without number).)\bigskip
2329
2330 Last Alph page (pagesLTS.Alph): \lastpageref{pagesLTS.Alph}{\hskip4em }
2331 (There are \lastpageref{pagesLTS.Alph.local} pages with Alph numbers.)\bigskip
2332
2333 Silly page numbers are possible but were not demonstrated in this example.
2334 \newpage
2335
2336 Last page's \textit{name} (LastPage): \lastpageref{LastPage}\bigskip
2337
2338 Very last page's \textit{name} (VeryLastPage): \lastpageref{VeryLastPage}\newline
2339 (\texttt{LastPage} and \texttt{VeryLastPage} are now identical, because both are now done
2340 \verb|\AddToHook{enddocument/afterlastpage}| instead of formerly\newline
2341 \verb|\AtEndDocument| and \verb|\AfterLastShipout|, which were different.)\bigskip
2342
2343 Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em }
2344 (=~total number of pages)
2345 \end{document}
2346 %</example>
2347 % \end{macrocode}
2348 % \pagebreak
2349 % \StopEventually{}
2350 %
2351 % \section{The implementation}
2352 % (This and the source code of the example file are the reasons
2353 % for printing the documentation in landscape format instead of portrait.)\bigskip
2354 %
2355 % We start off by checking that we are loading into \LaTeXe{},
2356 % format version at least 2024-11-01, and announcing the name and version of this package.
2357 %
2358 % \begin{macrocode}
2359 %<*package>
2360 % \end{macrocode}
2361 %
2362 % \begin{macrocode}
2363 \NeedsTeXFormat{LaTeX2e}[2024-11-01]
2364 \ProvidesPackage{pageslts}[2025-08-14 v2.0g Refers to special pages' numbers/names (HMM)]
2365
2366 % \end{macrocode}
2367 %
2368 % A short description of the \xpackage{pageslts} package:
2369 %
2370 % \begin{macrocode}
2371 %% Allows for things like\par
2372 %% |Page \thepage\ (\theCurrentPage; local: \theCurrentPageLocal) of %
2373 %% \lastpageref{pagesLTS.roman}(\lastpageref{pagesLTS.roman.local}) + %
2374 %% \lastpageref{pagesLTS.Roman}(\lastpageref{pagesLTS.Roman.local}) + %
2375 %% \lastpageref{pagesLTS.arabic}(\lastpageref{pagesLTS.arabic.local}) + %
2376 %% \lastpageref{pagesLTS.fnsymbol}(\lastpageref{pagesLTS.fnsymbol.local}) + %
2377 %% \lastpageref{pagesLTS.alph}(\lastpageref{pagesLTS.alph.local}) + %
2378 %% \lastpageref{pagesLTS.Alph}(\lastpageref{pagesLTS.Alph.local}) = %
2379 %% \lastpageref{LastPages} pages.|\par
2380 %% to get\par
2381 %% 'Page d (57; local: 4) of ii(2) + XX(20) + *(1) + 30(30) + e(5) + C(3) = 61 pages.'.
2382
2383 % \end{macrocode}
2384 %
2385 % For the handling of the options we use the kernel commands:
2386 %
2387 % \begin{macrocode}
2388 \DeclareKeys[pagesLTS]
2389 {alphMult .store = \pagesLTS@alphMult ,
2390 alphMult .usage = preamble ,
2391 AlphMulti .store = \pagesLTS@AlphMulti ,
2392 AlphMulti .usage = preamble ,
2393 pagecontinue .if = pagesLTS@pagecontinue ,
2394 pagecontinue .usage = load ,
2395 romanMult .if = pagesLTS@romanMult ,
2396 romanMult .usage = load ,
2397 RomanMulti .if = pagesLTS@RomanMulti ,
2398 RomanMulti .usage = load ,
2399 fnsymbolmult .if = pagesLTS@fnsymbolmult ,
2400 fnsymbolmult .usage = load
2401 }
2402
2403 \SetKeys[pagesLTS]{alphMult=ab,AlphMulti=AB,pagecontinue=true,romanMult=true,RomanMulti=true,fnsymbolmult=true}
2404
2405 \DeclareUnknownKeyHandler[pagesLTS]{%
2406 \PackageError{pageslts}{Unknown option "\CurrentOption"}{%
2407 LaTeX has been asked to set an option called\MessageBreak%
2408 '#1' \if\relax\detokenize{#2}\relax\else with value '#2'\fi\MessageBreak%
2409 but the package "pageslts" has not created an option with this name.\MessageBreak%
2410 Try typing <return> to proceed.\MessageBreak%
2411 If that doesn't work, type X <return> to quit.%
2412 }%
2413 }
2414
2415 \ProcessKeyOptions[pagesLTS]
2416
2417 % \end{macrocode}
2418 %
2419 % This package really does not work with an old \LaTeX{} format
2420 % without hooks, or without \eTeX, or with a \xpackage{pagesLTS.sty} file,
2421 % or with version~2.0 from~1992 of the \xpackage{endfloats} package,
2422 % or \xpackage{hyperref} from 2015 and so on. Assuming that nobody
2423 % would combine those old things with a modern \LaTeX{} format,
2424 % we request a recent format and do not check for the rest.
2425 %
2426 % \begin{macrocode}
2427 \@ifl@t@r\fmtversion{2024-11-01}{}{\PackageError{pageslts}{%
2428 LaTeX format 2024-11-01 or newer needed}{%
2429 Needed LaTeX format version: 2024-11-01 or newer.\MessageBreak%
2430 Found\space\space LaTeX format version: \fmtversion.\MessageBreak%
2431 Please update your TeX distribution!\MessageBreak%
2432 Loading of pageslts package is aborted.}
2433 \expandafter\endinput}
2434
2435 % \end{macrocode}
2436 %
2437 % The \xpackage{undolabl} package (see subsection~\ref{ss:Downloads})
2438 % is needed to overwrite labels, when the same page numbering scheme
2439 % is used twice (or even more often).
2440 %
2441 % \begin{macrocode}
2442 \RequirePackage{undolabl}[2024-12-05]
2443 \IfPackageLoadedTF{undolabl}{\IfPackageAtLeastF{undolabl}{2024-12-05}{%
2444 \PackageError{pageslts}{undolabl package version too old}{%
2445 Required version: 2024-12-05 v1.0n or newer,\MessageBreak%
2446 found version:\space\space\space\space\csname [email protected]\endcsname.%
2447 }}}{\PackageError{pageslts}{undolabl package not loaded}{%
2448 The undolabl package is required by pageslts but was not loaded.}%
2449 }
2450
2451 % \end{macrocode}
2452 %
2453 % For comparisons, zero, one, two and three are defined
2454 % (|\z@|, |\@ne| and so on do not work for this)
2455 % and for the page numbering scheme handling some definitions are made.
2456 %
2457 % \begin{macrocode}
2458 \def\pagesLTS@zero{0}
2459 \def\pagesLTS@one{1}
2460 \def\pagesLTS@two{2}
2461 \def\pagesLTS@three{3}
2462 \def\pagesLTS@ab{ab}
2463 \def\pagesLTS@bb{bb}
2464 \def\pagesLTS@ABi{AB}
2465 \def\pagesLTS@BBi{BB}
2466
2467 % \end{macrocode}
2468 %
2469 % The traditional behaviour is a reset of the page number to one,
2470 % each time the page numbering scheme changes. The option
2471 % |pagecontinue| changes this to a continuation with the
2472 % number/name following the last page number/name of the same
2473 % page numbering scheme. The user is informed accordingly.
2474 %
2475 % \begin{macrocode}
2476 \ifpagesLTS@pagecontinue
2477 \PackageNoteNoLine{pageslts}{Option pagecontinue enabled (maybe by default):\MessageBreak%
2478 The pageslts package will continue the page numbering,\MessageBreak%
2479 when the same page numbering scheme is used twice.\MessageBreak%
2480 If you do not want this, call pageslts with option\MessageBreak%
2481 pagecontinue=false (or use \string\setcounter{page}=1)}
2482 \else
2483 \PackageNoteNoLine{pageslts}{Option pagecontinue is false:\MessageBreak%
2484 The pageslts package was used, but the option\MessageBreak%
2485 pagecontinue was set to false.\MessageBreak%
2486 If you want the page numbers to be continued,\MessageBreak%
2487 when the same page numbering scheme is used twice,\MessageBreak%
2488 please call pageslts with option pagecontinue=true,\MessageBreak%
2489 otherwise the page number is reset to one each time\MessageBreak%
2490 the page numbering scheme is changed}
2491 \fi
2492
2493 % \end{macrocode}
2494 %
2495 % The page number printed in \texttt{alph} or in \texttt{Alph}
2496 % page numbering scheme had to be $>0$ and \mbox{$<27$.}\ %
2497 % Now the \xpackage{alphalph} package allows to extend the
2498 % numbering scheme (not only for pages). Because some users
2499 % prefer aa, ab, ac, ad,\ldots\ and some aa, bb, cc, dd,\ldots,
2500 % both schemes can be chosen via the options.
2501 % The \texttt{fnsymbol} page numbering scheme was restricted to values
2502 % $>0$ and \mbox{$<10$.}\ The \xpackage{alphalph} package allows
2503 % to extend this page numbering scheme, too. Option \texttt{fnsymbolmult}
2504 % can be chosen with the \xpackage{pageslts} package.
2505 % If no extension is wished (or another extension is wished
2506 % and implemented manually), \xpackage{pageslts} can be called with
2507 % options set to 0 (zero) and false: |alphMult=0|, |AlphMulti=0|,
2508 % |fnsymbolmult=false|.
2509 %
2510 % \begin{macrocode}
2511 \ifx\pagesLTS@alphMult\pagesLTS@ab%
2512 \else
2513 \ifx\pagesLTS@alphMult\pagesLTS@bb%
2514 \else
2515 \ifx\pagesLTS@alphMult\pagesLTS@zero%
2516 \PackageNoteNoLine{pageslts}{%
2517 Option alphMult=0 found:\MessageBreak%
2518 The pageslts package was used, but the option\MessageBreak%
2519 alphMult was set to 0 (zero).\MessageBreak%
2520 If you want the page numbers to be extended\MessageBreak%
2521 after z, you have to organize this yourself now.\MessageBreak%
2522 For automatic continuation, please use the\MessageBreak%
2523 alphalph package and call pageslts\MessageBreak%
2524 with option alphMult=ab (for aa, ab, ac, ad,...) or\MessageBreak%
2525 with option alphMult=bb (for aa, bb, cc, dd,...)}
2526 \else
2527 \PackageError{pageslts}{Unknown option value}{%
2528 The pageslts package was used with option\MessageBreak%
2529 alphMult=\meaning\pagesLTS@alphMult .\MessageBreak%
2530 Only values 'ab', 'bb', and '0' (zero) are valid.\MessageBreak%
2531 Now the default 'ab' is being set.}
2532 \SetKeys[pagesLTS]{alphMult=ab}
2533 \fi
2534 \fi
2535 \fi
2536
2537 \ifx\pagesLTS@AlphMulti\pagesLTS@ABi%
2538 \else
2539 \ifx\pagesLTS@AlphMulti\pagesLTS@BBi%
2540 \else
2541 \ifx\pagesLTS@AlphMulti\pagesLTS@zero%
2542 \PackageNoteNoLine{pageslts}{%
2543 Option AlphMulti=0 found:\MessageBreak%
2544 The pageslts package was used, but the option\MessageBreak%
2545 AlphMulti was set to 0 (zero).\MessageBreak%
2546 If you want the page numbers to be extended\MessageBreak%
2547 after Z, you have to organize this yourself now.\MessageBreak%
2548 For automatic continuation, please use the\MessageBreak%
2549 alphalph package and call pageslts\MessageBreak%
2550 with option AlphMulti=AB (for AA, AB, AC, AD,...) or\MessageBreak%
2551 with option AlphMulti=BB (for AA, BB, CC, DD,...)}
2552 \else
2553 \PackageError{pageslts}{Unknown option value}{%
2554 The pageslts package was used with option\MessageBreak%
2555 AlphMulti=\meaning\pagesLTS@AlphMulti .\MessageBreak%
2556 Only values 'AB', 'BB', and '0' (zero) are valid.\MessageBreak%
2557 The default 'AB' is set.}
2558 \SetKeys[pagesLTS]{AlphMulti=AB}
2559 \fi
2560 \fi
2561 \fi
2562
2563 % \end{macrocode}
2564 %
2565 % If |alph| or |Alph| or |fnsymbol| page numbers shall be continued,
2566 % the \xpackage{alphalph} package is required.
2567 %
2568 % \begin{macrocode}
2569 \ifx\pagesLTS@alphMult\pagesLTS@zero\else\RequirePackage{alphalph}[2019/12/09]\fi
2570 \ifx\pagesLTS@AlphMulti\pagesLTS@zero\else\RequirePackage{alphalph}[2019/12/09]\fi
2571 \ifpagesLTS@fnsymbolmult\RequirePackage{alphalph}[2019/12/09]\fi
2572
2573 % \end{macrocode}
2574 %
2575 % For the roman page numbering scheme, it is just the
2576 % choice of an extension by \xpackage{pageslts} or not.
2577 %
2578 % \begin{macrocode}
2579 \ifpagesLTS@romanMult
2580 \PackageNoteNoLine{pageslts}{Option romanMult enabled (maybe by default):\MessageBreak%
2581 The pageslts package will extend the page numbering\MessageBreak%
2582 of the roman scheme below i with\MessageBreak%
2583 0, -i, -ii, -iii, -iv,...\MessageBreak%
2584 If you do not want this, call pageslts with option\MessageBreak%
2585 romanMult=false}
2586 \else
2587 \PackageNoteNoLine{pageslts}{Option romanMult is set to false:\MessageBreak%
2588 The pageslts package was used, but the option\MessageBreak%
2589 romanMult was set to false.\MessageBreak%
2590 If you want the page numbering of the roman scheme\MessageBreak%
2591 to be extended below i,\MessageBreak%
2592 please call pageslts with option romanMult=true,\MessageBreak%
2593 otherwise zero and negative page numbers of the\MessageBreak%
2594 roman scheme will need to be defined otherwise}
2595 \fi
2596
2597 % \end{macrocode}
2598 %
2599 % Same for the Roman page numbering scheme.
2600 %
2601 % \begin{macrocode}
2602 \ifpagesLTS@RomanMulti
2603 \PackageNoteNoLine{pageslts}{Option RomanMulti enabled (maybe by default):\MessageBreak%
2604 The pageslts package will extend the page numbering\MessageBreak%
2605 of the Roman scheme below I with\MessageBreak%
2606 0, -I, -II, -III, -IV,...\MessageBreak%
2607 If you do not want this, call pageslts with option\MessageBreak%
2608 RomanMulti=false}
2609 \else
2610 \PackageNoteNoLine{pageslts}{Option RomanMulti is set to false:\MessageBreak%
2611 The pageslts package was used, but the option\MessageBreak%
2612 RomanMulti was set to false.\MessageBreak%
2613 If you want the page numbering of the Roman scheme\MessageBreak%
2614 to be extended below i,\MessageBreak%
2615 please call pageslts with option RomanMulti=true,\MessageBreak%
2616 otherwise zero and negative page numbers of the\MessageBreak%
2617 Roman scheme will need to be defined otherwise}
2618 \fi
2619
2620 % \end{macrocode}
2621 %
2622 % For the footnotesymbol page numbering scheme, it is also
2623 % just the choice of a extension by \xpackage{pageslts} or not.
2624 %
2625 % \begin{macrocode}
2626 \ifpagesLTS@fnsymbolmult
2627 \PackageNoteNoLine{pageslts}{Option fnsymbolmult enabled (maybe by default):\MessageBreak%
2628 The pageslts package will extend the page numbering\MessageBreak%
2629 of the footnotesymbol scheme using the alphalph\MessageBreak%
2630 package.\MessageBreak%
2631 If you do not want this, call pageslts with option\MessageBreak%
2632 fnsymbolmult=false}
2633 \else
2634 \PackageNoteNoLine{pageslts}{%
2635 Option fnsymbolmult is set to false:\MessageBreak%
2636 The pageslts package was used, but the option\MessageBreak%
2637 fnsymbolmult was set to false.\MessageBreak%
2638 If you want the page numbering of the footnotesymbol\MessageBreak%
2639 scheme to be extended using the alphalph package,\MessageBreak%
2640 please call pageslts with option fnsymbolmult=true,\MessageBreak%
2641 otherwise page numbers of the footnotesymbol scheme\MessageBreak%
2642 greater than nine will need to be defined otherwise}
2643 \fi
2644
2645 % \end{macrocode}
2646 %
2647 % Now defining some variables, place-holders, and abbreviations:
2648 %
2649 % \begin{macrocode}
2650 \def\pagesLTS@pnc{0}
2651 \def\pagesLTS@called{0}
2652 \def\pagesLTS@fns{fnsymbol}
2653 \def\pagesLTS@alph{alph}
2654 \def\pagesLTS@Alph{Alph}
2655 \def\pagesLTS@gobble{gobble}
2656 \def\pagesLTS@silly{silly}
2657 \def\pagesLTS@rerun{0}
2658 \def\pagesLTS@esoFs{0}
2659 \def\pagesLTS@esovFs{0}
2660 \def\pagesLTS@esoSy{0}
2661 \def\pagesLTS@esovSy{0}
2662 \def\pagesLTS@esoGbl{0}
2663 \def\pagesLTS@esovGbl{0}
2664 \def\lastpageref{\lastpagereftxt}
2665 \def\pagesLTS@undolable{none}
2666 \def\pncmissing{0}
2667 \def\pagesLTS@messageNPN{%
2668 The pageslts package was used, but\MessageBreak%
2669 \string\pagenumbering \MessageBreak%
2670 was not called at the beginning of the document\MessageBreak%
2671 (maybe earlier or later).\MessageBreak%
2672 Please use \string\pagenumbering \MessageBreak%
2673 (with an argument like arabic, roman, Roman,\MessageBreak%
2674 fnsymbol, alph, Alph, gobble,\MessageBreak%
2675 or silly (requiring sillypage package))\MessageBreak%
2676 at the beginning of your document!\MessageBreak%
2677 Otherwise your document will probably compile,\MessageBreak%
2678 but the pageslts package might not be able\MessageBreak%
2679 to get all labels for the references\MessageBreak%
2680 to the respective pages right.\MessageBreak%
2681 }
2682
2683 % \end{macrocode}
2684 %
2685 % Defining some new counters (and doing related things):
2686 %
2687 % \begin{macrocode}
2688 \newcounter{CurrentPage}
2689 \setcounter{CurrentPage}{1}
2690 \def\theCurrentPageLocal{\number\value{pagesLTS.current.local.\pagesLTS@pnc}}
2691 % \end{macrocode}
2692 %
2693 % The counter |pagesLTS.pagenr| is for saving into the \xfile{.aux} file
2694 % the total page number of the last page.
2695 %
2696 % \begin{macrocode}
2697 \newcounter{pagesLTS.pagenr}
2698 \setcounter{pagesLTS.pagenr}{1}
2699 % \end{macrocode}
2700 %
2701 % While generally |\pagesLTS@providecounter{pagesLTS.current.local.\pagesLTS@pnc}|
2702 % is used, for the beginning of the document |pagesLTS.current.local.0| is predefined.
2703 % (A~|\pagesLTS@providecounter{pagesLTS.current.local.\pagesLTS@pnc}|
2704 % could be used for this, too, but we know that |pagesLTS.current.local.0|
2705 % was not defined, so we can just do the definition here.)
2706 % And the first local page gets the number one.
2707 %
2708 % \begin{macrocode}
2709 \newcounter{pagesLTS.current.local.0}
2710 \setcounter{pagesLTS.current.local.0}{1}
2711 % \end{macrocode}
2712 %
2713 % And the same again for |pagesLTS.pnc.0|.
2714 %
2715 % \begin{macrocode}
2716 \newcounter{pagesLTS.pnc.0}
2717 % \end{macrocode}
2718 %
2719 % Also a scratch counter is defined, |\pagesLTSlastpage| and |\pagesLTSlastpageHy| are predefined
2720 % \mbox{(e.\,g.}\ for computations in the first compilation run),
2721 % and the obsolete |\pagesLTS.lastpage| points to the new |\pagesLTSlastpage|.
2722 %
2723 % \begin{macrocode}
2724 \newcounter{pagesLTS.tmpcounter}
2725 \def\pagesLTSlastpage{1}
2726 \def\pagesLTSlastpageHy{1}
2727 \def\pagesLTS.lastpage{\pagesLTSlastpage}
2728
2729 % \end{macrocode}
2730 %
2731 % \phantomsection
2732 % \begin{macro}{\xroman}\label{xroman}
2733 % When |\roman{...}| is used with a value $<1$, \LaTeX\ just ignores this
2734 % (see subsection~\ref{ss:overflow}). Here we provide a command
2735 % |\xroman{...}| \nolinebreak{(e\textbf{x}panded} roman),
2736 % which gives the usual |\roman| numbers (i, ii, iii, iv,\ldots)
2737 % for positive values,
2738 % $-\left\vert \ldots \right\vert $ (i.\,e. -i, -ii, -iii, -iv,\ldots)
2739 % for negative values, and 0 for all other values (which should be zero).
2740 %
2741 % \begin{macrocode}
2742 \newcommand{\xroman}[1]{%
2743 \ifnum\value{#1}>0%
2744 \roman{#1}%
2745 \else%
2746 \ifnum\value{#1}<0%
2747 % \end{macrocode}
2748 %
2749 % |\number\value{#1}| gives the arabic number of argument |#1|,
2750 % which is negative here (for example $-7$),
2751 % \textquotedblleft |-|\textquotedblright{} puts another minus
2752 % sign in front of it (for example $--7$), |\number| removes
2753 % all unnecessary preceding zeros, plus and minus signs
2754 % (for example $7$), |\romannumeral| turns it into a |roman|
2755 % number (for example vii), and
2756 % \textquotedblleft |-|\textquotedblright{} puts the minus
2757 % sign back in front of it (for example -vii).
2758 %
2759 % \begin{macrocode}
2760 -\romannumeral\number-\number\value{#1}%
2761 \else%
2762 0%
2763 \fi%
2764 \fi%
2765 }
2766
2767 % \end{macrocode}
2768 % \end{macro}
2769 % \newpage
2770 % \begin{macro}{\XRoman}
2771 % |\XRoman| does the same for uppercase |\Roman| numbers.
2772 % |-\uppercase{\romannumeral\number-\number\value{#1}}| cannot be used,
2773 % because the result in the example is |-\uppercase{vii}| and
2774 % not |-VII|.\footnote{This does not matter for the print out,
2775 % but for the display of the logical page numbers
2776 % as well as the \xfile{.aux} file.} Therefore we have a look
2777 % at \LaTeX's own |\@Roman\FOOcounter|,\newline
2778 % |\def\@Roman#1{\expandafter\@slowromancap\romannumeral #1@}|,\newline
2779 % and use |\@slowromancap|, which is a fully expandable macro,
2780 % to do the trick for this:
2781 % \begin{quote}
2782 % \textquotedblleft |\def\@slowromancap#1{\ifx @#1% then terminate|\newline%
2783 % \hphantom{\textquotedblleft}|\else|\newline%
2784 % \hphantom{\textquotedblleft}|\if i#1I\else\if v#1V\else\if x#1X\else\if l#1L\else\if|\newline%
2785 % \hphantom{\textquotedblleft}|c#1C\else\if d#1D\else \if m#1M\else#1\fi\fi\fi\fi\fi\fi\fi|\newline%
2786 % \hphantom{\textquotedblleft}|\expandafter\@slowromancap|\newline%
2787 % \hphantom{\textquotedblleft}|\fi|\newline%
2788 % \hphantom{\textquotedblleft}|}|\textquotedblright{} %
2789 % (2021/11/08 Version v1.1n \LaTeX{} Kernel File~21: ltcounts.dtx Counters and Lengths).
2790 % \end{quote}
2791 %
2792 % \begin{macrocode}
2793 \newcommand{\XRoman}[1]{%
2794 \ifnum\value{#1}>0%
2795 \Roman{#1}%
2796 \else%
2797 \ifnum\value{#1}<0%
2798 -\expandafter\@slowromancap\romannumeral\number-\number\value{#1}@%
2799 \else%
2800 0%
2801 \fi%
2802 \fi%
2803 }
2804
2805 % \end{macrocode}
2806 % \end{macro}
2807 %
2808 % \begin{macro}{\pagesLTS@providecounter}
2809 % We provide a way to create counters like
2810 % \begin{itemize}
2811 % \item[-] \DescribeMacro{pagesLTS.pnc. page numbering scheme }
2812 % |pagesLTS.pnc.<page numbering scheme>|, e.\,g.~|pagesLTS.pnc.Roman|,
2813 % \item[-] \DescribeMacro{pagesLTS.double. page numbering scheme }
2814 % |pagesLTS.double.<page numbering scheme>|, e.\,g.~|pagesLTS.double.Roman|,
2815 % \item[-] \DescribeMacro{PageCurrentLocal. page numbering scheme }
2816 % |PageCurrentLocal.<page numbering scheme>|, e.\,g.~|PageCurrentLocal.Roman|,
2817 % \end{itemize}
2818 % for all page numbering schemes, even those not supported
2819 % by the current original |\pagenumbering|
2820 % (2020/12/05 Version v1.1a LaTeX Kernel File~33 ltpageno.dtx Page Numbering), which is
2821 % \begin{quote}
2822 %\begin{verbatim}
2823 %\countdef\c@page=0 \c@page=1
2824 %\def\cl@page{}
2825 %\def\pagenumbering#1{%
2826 % \global\c@page \@ne \gdef\thepage{\csname @#1\endcsname
2827 % \c@page}}
2828 %\end{verbatim}
2829 % \end{quote}
2830 %
2831 % \begin{macrocode}
2832 \newcommand{\pagesLTS@providecounter}[1]{\@ifundefined{c@#1}{\newcounter{#1}}{}}
2833 % \end{macrocode}
2834 %
2835 % The command |\pagesLTS@ifcounter| is obsolete, but if a document was compiled
2836 % using an older version of the \xpackage{pageslts} package,
2837 % the command will still be in the \xfile{.aux} file.
2838 % (Following code will be removed in some future version.)
2839 %
2840 % \begin{macrocode}
2841 \NewCommandCopy{\pagesLTS@ifcounter}{\pagesLTS@providecounter}
2842 \AddToHook{begindocument}{%
2843 % \end{macrocode}
2844 %
2845 % This hook is executed after the \xfile{.aux} file has been read,
2846 % so there should be no following |\pagesLTS@ifcounter|.
2847 %
2848 % \begin{macrocode}
2849 \AddToHookWithArguments{cmd/pagesLTS@ifcounter/before}{%
2850 \PackageError{pageslts}{Old command \string\pagesLTS@ifcounter\space used}{%
2851 Replace by \string\pagesLTS@providecounter.}%
2852 }%
2853 }
2854
2855 % \end{macrocode}
2856 % \end{macro}
2857 %
2858 % \begin{macro}{\lastpages}
2859 % We provide a command to give the number of pages in a sector
2860 % of a split page numbering scheme (see page~\pageref{pagesLTS.pnscheme.nr},\newline
2861 % |pagesLTS.<page numbering scheme>.<number>.local.cnt|):
2862 %
2863 % \begin{macrocode}
2864 \newcommand{\lastpages}[2]{%
2865 \pagesLTS@providecounter{pagesLTS.#1.#2.local.cnt}%
2866 \number\value{pagesLTS.#1.#2.local.cnt}%
2867 }
2868
2869 % \end{macrocode}
2870 % \end{macro}
2871 %
2872 % \begin{macro}{\pagesLTS@writelabel}
2873 % At last defining the writing of a label:
2874 %
2875 % \begin{macrocode}
2876 \newcommand{\pagesLTS@writelabel}[1]{%
2877 \addtocounter{page}{+1}%
2878 % \end{macrocode}
2879 %
2880 % |\addtocounter{page}{+1}| because |\pagesLTS@putlabel| includes an\newline
2881 % |\addtocounter{page}{-1}|, which is not necessary here.\newline
2882 % Into the \xfile{.aux} file something like\newline
2883 % |\newlabel{pagesLTS.Roman}{{}{VIII}{}{page.VIII}{}}|\newline
2884 % is written, thus |\lastpageref{pagesLTS.Roman}| prints |VIII| and
2885 % links to |page.VIII|.
2886 %
2887 % \begin{macrocode}
2888 \pagesLTS@putlabel{pagesLTS.#1}{\thepage}{1}%
2889 % \end{macrocode}
2890 %
2891 % |\addtocounter{page}{-1}| is skipped, because another |\pagesLTS@putlabel| follows.
2892 %
2893 % \begin{macrocode}
2894 \ifx\pagesLTS@pnc\pagesLTS@zero%
2895 % \end{macrocode}
2896 %
2897 % i.\,e.~if the current page numbering scheme is \textquotedblleft 0\textquotedblright,
2898 % i.\,e.~before the first |\pagenumbering{...}| command, do nothing,
2899 %
2900 % \begin{macrocode}
2901 \else%
2902 % \end{macrocode}
2903 %
2904 % otherwise write into the \xfile{.aux} file something like\newline
2905 % |\newlabel{pagesLTS.arabic.local}{{}{6}{}{page.9}{}}|,\newline
2906 % thus |\lastpageref{pagesLTS.arabic.local}| prints |6| and links to |page.9|.\bigskip
2907 %
2908 % |\addtocounter{page}{+1}| is skipped, because we skipped the |\addtocounter{page}{-1}| above.
2909 %
2910 % \begin{macrocode}
2911 \pagesLTS@putlabel{pagesLTS.#1.local}{\theCurrentPageLocal}{1}%
2912 % \end{macrocode}
2913 %
2914 % |\addtocounter{page}{-1}| immediately after the |\pagesLTS@putlabel| is skipped,
2915 % because we do that outside of the |\ifx \else \fi|.
2916 %
2917 % \begin{macrocode}
2918 \fi%
2919 \addtocounter{page}{-1}%
2920 }
2921
2922 % \end{macrocode}
2923 % \end{macro}
2924 %
2925 % \begin{macro}{\erroralphalph}
2926 % |\erroralphalph| extends the \textquotedblleft numbers\textquotedblright\ of
2927 % counters to zero and negative values for representations usually not supporting this:
2928 % |\alphalph|, |\AlphAlph|, and |\fnsymbolmult| of the \xpackage{alphalph} package.\newline
2929 % |\alph|, |\Alph|, and |\fnsymbol| would not support
2930 % \textquotedblleft numbers\textquotedblright\ below one.\newline
2931 % |\arabic| already supports negative numbers and zero.\newline
2932 % |\roman| and |\Roman| support neither negative numbers nor zero, but are expanded
2933 % in this package (|\xroman| and |\XRoman|), see page~\pageref{xroman}.
2934 % \begin{macrocode}
2935
2936 %% The following code is from Heiko Oberdiek [2010/04/18], %%
2937 %% expanding his alphalph package as of 2010/04/18, v2.3. (Thanks!) %%
2938 \newcommand*{\erroralphalph}[2]{%
2939 \ifnum\value{#2}>0%
2940 #1{\value{#2}}%
2941 \else%
2942 \ifnum\value{#2}<0%
2943 -#1{\expandafter\@gobble\the\value{#2}}%
2944 \else%
2945 0%
2946 \fi%
2947 \fi%
2948 }
2949 %% End of code from Heiko Oberdiek %%
2950 %% Check and Error/Warning messages have been moved to hook "shipout/foreground" %%
2951 %% because messages inside e.g. the \pageref command can cause trouble. %%
2952
2953 % \end{macrocode}
2954 % \end{macro}
2955 %
2956 % \newpage
2957 % \begin{macro}{\expandPagenumbering}
2958 % Here the |\erroralphalph| command is called with the
2959 % appropriate arguments for each page numbering scheme.
2960 %
2961 % \begin{macrocode}
2962
2963 \newcommand{\expandPagenumbering}[1]{%
2964 \let\Origthepage\thepage%
2965 \def\pagesLTS@tmpC{arabic}%
2966 \ifx\pagesLTS@pnc\pagesLTS@tmpC%
2967 % \end{macrocode}
2968 %
2969 % |\arabic| already supports negative numbers and zero
2970 % (|-MAX...MAX|, where |MAX|\,$ = 2\,147\,483\,647$).
2971 %
2972 % \begin{macrocode}
2973 \else%
2974 \def\pagesLTS@tmpC{roman}%
2975 \ifx\pagesLTS@pnc\pagesLTS@tmpC%
2976 \ifpagesLTS@romanMult%
2977 % \end{macrocode}
2978 %
2979 % |\erroralphalph{\roman}{page}| cannot be used, because
2980 % |-\roman{\expandafter\@gobble\the\value{page}}| does not work.
2981 % If option |romanMult| is not false,
2982 % |\xroman| (see page~\pageref{xroman}) expands the usable
2983 % roman page numbers to values below 1 (i, I, respectively),
2984 % see subsubsection~\ref{sss:romanMult}.
2985 %
2986 % \begin{macrocode}
2987 \renewcommand*{\thepage}{\xroman{page}}%
2988 \fi%
2989 \else%
2990 \def\pagesLTS@tmpC{Roman}%
2991 \ifx\pagesLTS@pnc\pagesLTS@tmpC%
2992 % \end{macrocode}
2993 %
2994 % The same for |\Roman| page numbering, expanded by |\XRoman|
2995 % (see page~\pageref{xroman}). When the \xpackage{romanbar} package
2996 % has been loaded, the page format is changed accordingly.
2997 %
2998 % \begin{macrocode}
2999 \IfPackageLoadedTF{romanbarpagenumber}{%
3000 \ifpagesLTS@RomanMulti%
3001 \renewcommand*{\thepage}{\Roman@bar{\XRoman{page}}}%
3002 \else%
3003 \renewcommand*{\thepage}{\Roman@bar{\Roman{page}}}%
3004 \fi%
3005 }{\ifpagesLTS@RomanMulti%
3006 \renewcommand*{\thepage}{\XRoman{page}}%
3007 \fi%
3008 }%
3009 \else%
3010 \ifx\pagesLTS@pnc\pagesLTS@alph%
3011 % \end{macrocode}
3012 %
3013 % |\alph| and |\Alph| page numberings are expanded to negative
3014 % and zero values, and to values greater than
3015 % \textquotedblleft z\textquotedblright{} or
3016 % \textquotedblleft Z\textquotedblright{} with the
3017 % \xpackage{alphalph} package.~--
3018 % If |\pagesLTS@alphMult| was zero, nothing is done.
3019 %
3020 % \begin{macrocode}
3021 \ifx\pagesLTS@alphMult\pagesLTS@ab%
3022 \renewcommand*{\thepage}{\erroralphalph{\alphalph}{page}}%
3023 \else%
3024 \ifx\pagesLTS@alphMult\pagesLTS@bb%
3025 \renewcommand*{\thepage}{\erroralphalph{\alphMult}{page}}%
3026 \fi%
3027 \fi%
3028 \else%
3029 \ifx\pagesLTS@pnc\pagesLTS@Alph%
3030 \ifx\pagesLTS@AlphMulti\pagesLTS@ABi%
3031 \renewcommand*{\thepage}{\erroralphalph{\AlphAlph}{page}}%
3032 \else%
3033 \ifx\pagesLTS@AlphMulti\pagesLTS@BBi%
3034 \renewcommand*{\thepage}{\erroralphalph{\AlphMult}{page}}%
3035 \fi%
3036 \fi%
3037 \else%
3038 \ifx\pagesLTS@pnc\pagesLTS@fns%
3039 % \end{macrocode}
3040 %
3041 % Same for |\fnsymbol| page numbers.
3042 %
3043 % \begin{macrocode}
3044 \ifpagesLTS@fnsymbolmult%
3045 \renewcommand*{\thepage}{\erroralphalph{\fnsymbolmult}{page}}%
3046 \fi%
3047 \else%
3048 % \end{macrocode}
3049 %
3050 % For |silly| page numbers (from the \xpackage{sillypage} package),
3051 % |\thepage| is |\csname @silly\endcsname \c@page|, \mbox{i.\,e.}~|\@silly \c@page|
3052 % --~no change needed.
3053 %
3054 % \begin{macrocode}
3055 \ifx\pagesLTS@pnc\pagesLTS@silly%
3056 \else%
3057 % \end{macrocode}
3058 %
3059 % For |gobble| page numbers, |\thepage| is |\csname @gobble\endcsname \c@page|,
3060 % \mbox{i.\,e.}~|\@gobble \c@page| and |\@gobble| is \linebreak%
3061 % |\long\def \@gobble #1{}|, \mbox{i.\,e.}~|\thepage| is |{}|. This is OK,
3062 % but \xpackage{hyperref} does not create links when there is no linktext.
3063 % Thus we give |\null| as text for the page number, which prints as nothing
3064 % but makes \xpackage{hyperref} happy -- although not happy enough yet:
3065 % |\null| expands to |\hbox {}|, and \xpackage{hyperref} complains
3066 %\begin{verbatim}
3067 %Package hyperref Warning: Token not allowed in a PDF string (Unicode):
3068 %(hyperref) removing `\hbox' on input line <something>.
3069 %
3070 %Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
3071 %(hyperref) removing `\hbox' on input line <something>.
3072 %\end{verbatim}
3073 % To make \xpackage{hyperref} extra happy, we tell it to not use |\null| as
3074 % PDF string.
3075 %
3076 % \begin{macrocode}
3077 \ifx\pagesLTS@pnc\pagesLTS@gobble%
3078 \IfPackageLoadedT{hyperref}{%
3079 \renewcommand*{\thepage}{\texorpdfstring{\null}{{}}%
3080 \csname @gobble\endcsname \c@page}}%
3081 \else%
3082 % \end{macrocode}
3083 %
3084 %
3085 % If the used page numbering scheme has not been recognized by the
3086 % \xpackage{pageslts} package so far, we can do nothing, and problems
3087 % might result.
3088 %
3089 % \begin{macrocode}
3090 \PackageError{pageslts}{unknown page numbering scheme}{%
3091 The pageslts package encountered the unknown\MessageBreak%
3092 page numbering scheme\MessageBreak%
3093 \meaning#1. \MessageBreak%
3094 If this is no typing mistake, it might work\MessageBreak%
3095 - or it might not work.\MessageBreak%
3096 \@ehc}%
3097 \fi\fi\fi\fi\fi\fi\fi\fi%
3098 \let\pagesLTS@tmpC\undefined%
3099 }
3100
3101 % \end{macrocode}
3102 % \end{macro}
3103 %
3104 % \begin{macro}{\pagenumbering}
3105 % To keep the original meaning of |\pagenumbering|:
3106 %
3107 % \begin{macrocode}
3108 \NewCommandCopy{\OrigPagenumbering}{\pagenumbering}
3109
3110 % \end{macrocode}
3111 %
3112 % Now for the \textbf{new} version of the |\pagenumbering| command:
3113 %
3114 % \begin{macrocode}
3115 \renewcommand{\pagenumbering}[1]{%
3116 % \end{macrocode}
3117 %
3118 % If the current page numbering scheme, |\pagesLTS@pnc|,
3119 % and the requested page numbering scheme, |#1|, is the same one,
3120 % nothing is done, otherwise the real action begins.
3121 %
3122 % \begin{macrocode}
3123 \edef\pagesLTS@tmpA{#1}%
3124 \ifx\pagesLTS@pnc\pagesLTS@tmpA%
3125 \else%
3126 % \end{macrocode}
3127 %
3128 % If the requested page numbering scheme, |#1|, is~|\pagesLTS@fns|,
3129 % \mbox{i.\,e.}~\texttt{fnsymbol}, the counter\texttt{pagesLTS.fnsymbol.local}
3130 % is needed. If it does not exists yet, it is created here.
3131 % Same for the |silly| and |gobble| page numbering schemes.
3132 %
3133 % \begin{macrocode}
3134 \ifx\pagesLTS@tmpA\pagesLTS@fns%
3135 \pagesLTS@providecounter{pagesLTS.fnsymbol.local}%
3136 \fi%
3137 \ifx\pagesLTS@tmpA\pagesLTS@silly%
3138 \IfPackageLoadedF{sillypage}{\PackageError{pageslts}{%
3139 silly pagenumbering requested, sillypage package not loaded}{%
3140 When using \string\pagenumbering{silly},\MessageBreak%
3141 load the sillypage package.}}%
3142 \pagesLTS@providecounter{pagesLTS.silly.local}%
3143 \fi%
3144 \ifx\pagesLTS@tmpA\pagesLTS@gobble%
3145 \pagesLTS@providecounter{pagesLTS.gobble.local}%
3146 \fi%
3147 % \end{macrocode}
3148 %
3149 % The next code is executed, when we are at a page after the first one.
3150 % This distinction is done for two reasons:\newline
3151 % On the one hand, |\pagenumbering| could be called \textit{before}
3152 % |\begin{document}| (where the current page should not be
3153 % greater than one), and on the other hand we go one page back to
3154 % aim all references to that page. Obviously at the first page
3155 % there is no going backward.
3156 %
3157 % \begin{macrocode}
3158 \ifnum\value{CurrentPage}>1%
3159 \addtocounter{page}{-1}%
3160 \addtocounter{pagesLTS.current.local.\pagesLTS@pnc}{-1}%
3161 % \end{macrocode}
3162 %
3163 % For the case that the page numbering scheme is or will be split,
3164 % like e.\,g.~the Roman one in the |pageslts-example.tex|, a~counter like
3165 % |pagesLTS.Roman.1.local.count| (or |pagesLTS.Roman.2.local.count|,
3166 % |pagesLTS.Roman.3.local.count|,\ldots ) is introduced and set to the
3167 % number of the local page.
3168 %
3169 % \begin{macrocode}
3170 \newcounter{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}.local.count}%
3171 \setcounter{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}.local.count}{%
3172 \value{pagesLTS.current.local.\pagesLTS@pnc}}%
3173 % \end{macrocode}
3174 %
3175 % If the page numbering scheme is |fnsymbol|, and if it \textit{was} used before,
3176 % from said counter the number of pages of the preceding uses
3177 % of the same page numbering scheme, |pagesLTS.\[email protected]|,
3178 % is subtracted (same as for the other schemes, see below).
3179 % The same is done for the |silly| and |gobble| page numbers.
3180 %
3181 % \begin{macrocode}
3182 \ifx\pagesLTS@pnc\pagesLTS@fns%
3183 \ifnum\value{pagesLTS.pnc.\pagesLTS@pnc}>1%
3184 \setcounter{pagesLTS.tmpcounter}{\numexpr\value{pagesLTS.pnc.\pagesLTS@pnc}-1\relax}%
3185 \addtocounter{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}.local.count}{%
3186 -\value{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.tmpcounter}.local.count}}%
3187 \fi%
3188 \else%
3189 \ifx\pagesLTS@pnc\pagesLTS@silly%
3190 \ifnum\value{pagesLTS.pnc.\pagesLTS@pnc}>1%
3191 \setcounter{pagesLTS.tmpcounter}{\numexpr\value{pagesLTS.pnc.\pagesLTS@pnc}-1\relax}%
3192 \addtocounter{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}.local.count}{%
3193 -\value{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.tmpcounter}.local.count}}%
3194 \fi%
3195 \else%
3196 \ifx\pagesLTS@pnc\pagesLTS@gobble%
3197 \ifnum\value{pagesLTS.pnc.\pagesLTS@pnc}>1%
3198 \setcounter{pagesLTS.tmpcounter}{\numexpr\value{pagesLTS.pnc.\pagesLTS@pnc}-1\relax}%
3199 \addtocounter{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}.local.count}{%
3200 -\value{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.tmpcounter}.local.count}}%
3201 \fi%
3202 \else%
3203 % \end{macrocode}
3204 %
3205 % If the page numbering scheme is
3206 % \textit{neither} |fnsymbol| \textit{nor} |silly| \textit{nor} |gobble|
3207 % and if the page numbering scheme was \textit{not} used before,
3208 % an unnumbered label is also written:
3209 %
3210 % \begin{macrocode}
3211 \ifnum\value{pagesLTS.pnc.\pagesLTS@pnc}<2%
3212 \pagesLTS@writelabel{\pagesLTS@pnc}%
3213 \fi%
3214 \fi%
3215 \fi%
3216 % \end{macrocode}
3217 %
3218 % For all page numbering schemes: If the page numbering scheme \textit{was} used before,
3219 % from said counter the number of pages of the preceding uses
3220 % of the same page numbering scheme, |pagesLTS.\[email protected]|,
3221 % is subtracted -- except if option |pagenumbering=false| has been chosen,
3222 % because then the pagenumbers are reset anyway.
3223 %
3224 % \begin{macrocode}
3225 \ifnum\value{pagesLTS.pnc.\pagesLTS@pnc}>1%
3226 \ifpagesLTS@pagecontinue%
3227 \setcounter{pagesLTS.tmpcounter}{\numexpr\value{pagesLTS.pnc.\pagesLTS@pnc}-1\relax}%
3228 \pagesLTS@providecounter{pagesLTS.\[email protected]}%
3229 \addtocounter{pagesLTS.\[email protected]}{%
3230 \value{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.tmpcounter}.local.count}}%
3231 \addtocounter{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}.local.count}{%
3232 -\value{pagesLTS.\[email protected]}}%
3233 \fi%
3234 \fi%
3235 % \end{macrocode}
3236 %
3237 % A~numbered label is written:
3238 %
3239 % \begin{macrocode}
3240 \pagesLTS@writelabel{\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}}%
3241 % \end{macrocode}
3242 %
3243 % The values are written to the \xfile{.aux} file (if writing is allowed: |\if@filesw|),
3244 % because they must be available at the beginning of the document:
3245 %
3246 % \begin{macrocode}
3247 \if@filesw%
3248 \immediate\write\@auxout{\string
3249 \pagesLTS@providecounter{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}.local.cnt}}%
3250 \edef\pagesLTS@tmpB{\number\value{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}.local.count}}%
3251 \immediate\write\@auxout{\string
3252 \setcounter{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}.local.cnt}{\pagesLTS@tmpB}}%
3253 \fi%
3254 \fi%
3255 % \end{macrocode}
3256 %
3257 % For further code for the case of |fnsymbol| please see below
3258 % (|\lastpagereftext|, page~\pageref{lastpagereftextlabel}).\newline
3259 % The last page number is saved, in case the same page
3260 % numbering scheme is continued later.
3261 %
3262 % \begin{macrocode}
3263 \pagesLTS@providecounter{pagesLTS.double.\pagesLTS@pnc}%
3264 \setcounter{pagesLTS.double.\pagesLTS@pnc}{\value{page}}%
3265 % \end{macrocode}
3266 %
3267 % We went back one page, so we must go forward again:
3268 %
3269 % \begin{macrocode}
3270 \addtocounter{pagesLTS.current.local.\pagesLTS@pnc}{+1}%
3271 \addtocounter{page}{+1}%
3272 % \end{macrocode}
3273 %
3274 % The page numbering scheme |\pagesLTS@pnc| is now set to the new one,
3275 % given by the user as argument with the |\pagenumbering{...}| command:
3276 %
3277 % \begin{macrocode}
3278 \xdef\pagesLTS@pnc{#1}%
3279 % \end{macrocode}
3280 %
3281 % If option |pagecontinue=false| was chosen, the local page count is reset to~1.
3282 %
3283 % \begin{macrocode}
3284 \ifpagesLTS@pagecontinue%
3285 \else%
3286 \pagesLTS@providecounter{pagesLTS.current.local.\pagesLTS@pnc}%
3287 \setcounter{pagesLTS.current.local.\pagesLTS@pnc}{1}%
3288 \fi%
3289 % \end{macrocode}
3290 %
3291 % The new page numbering scheme is now started for real:
3292 %
3293 % \begin{macrocode}
3294 \OrigPagenumbering{#1}%
3295 % \end{macrocode}
3296 %
3297 % If a page numbering scheme not known by the original |\pagenumbering{...}| command is used,
3298 % an error will arise here - but maybe without error message.\bigskip
3299 %
3300 % If page numbering scheme |\alph|, |\Alph|, or |\fnsymbol| is used,
3301 % \xpackage{pageslts} extends the page numbers according to the given options,
3302 % using the \xpackage{alphalph} package. |\arabic| does not need any expansion.
3303 % |\roman| and |\Roman| at least receive a definition for zero.
3304 %
3305 % \begin{macrocode}
3306 \expandPagenumbering{#1}%
3307 % \end{macrocode}
3308 %
3309 % Counters like |pagesLTS.pnc.Roman| are introduced:
3310 %
3311 % \begin{macrocode}
3312 \pagesLTS@providecounter{pagesLTS.pnc.\pagesLTS@pnc}%
3313 % \end{macrocode}
3314 %
3315 % The saved number of times, this page numbering scheme was used, is increased by one:
3316 %
3317 % \begin{macrocode}
3318 \addtocounter{pagesLTS.pnc.\pagesLTS@pnc}{1}%
3319 % \end{macrocode}
3320 %
3321 % Now defining the counter |pagesLTS.double.\pagesLTS@pnc|,
3322 % if it did not exist already, adding~1, because this is the first page of it
3323 % (or another one, if the scheme is continued):
3324 %
3325 % \begin{macrocode}
3326 \pagesLTS@providecounter{pagesLTS.double.\pagesLTS@pnc}%
3327 \addtocounter{pagesLTS.double.\pagesLTS@pnc}{1}%
3328 % \end{macrocode}
3329 %
3330 % The page number is continued, if the option |pagecontinue=false| is \textbf{not} set,
3331 % otherwise it is reset to one. Note that neither the local nor the current counter are reset,
3332 % as they contain the real \textit{values} and not the \textit{names} of the pages.
3333 %
3334 % \begin{macrocode}
3335 \ifpagesLTS@pagecontinue%
3336 \setcounter{page}{\value{pagesLTS.double.\pagesLTS@pnc}}%
3337 \else%
3338 \setcounter{page}{1}%
3339 \fi%
3340 % \end{macrocode}
3341 %
3342 % If it does not exist already, the counter |pagesLTS.current.local.\pagesLTS@pnc|
3343 % \mbox{(e.\,g.} |pagesLTS.current.local.Roman|) is created.
3344 %
3345 % \begin{macrocode}
3346 \pagesLTS@providecounter{pagesLTS.current.local.\pagesLTS@pnc}%
3347 % \end{macrocode}
3348 %
3349 % If |pagesLTS.double.\pagesLTS@pnc| of the current page numbering
3350 % scheme is equal to one, this is the first page of this page numbering scheme.
3351 % Then |pagesLTS.current.local.\pagesLTS@pnc| (which was zero) is set to one.
3352 %
3353 % \begin{macrocode}
3354 \ifnum\value{pagesLTS.double.\pagesLTS@pnc}=1%
3355 \setcounter{pagesLTS.current.local.\pagesLTS@pnc}{1}%
3356 \fi%
3357 % \end{macrocode}
3358 %
3359 % Otherwise, i.\,e.~if |\value{CurrentPage}| is \mbox{not $>1$,}
3360 % i.\,e.~before the first page has shipped out:
3361 %
3362 % \begin{macrocode}
3363 \else%
3364 \ifx\pagesLTS@pnc\pagesLTS@zero\relax%
3365 \else%
3366 % \end{macrocode}
3367 %
3368 % |\pagenumbering{...}| has been called more than once before the end of the first page
3369 % (probably in the preamble). Let us reset the earlier |\pagenumbering|s, which
3370 % should not have any effect anyway:
3371 %
3372 % \begin{macrocode}
3373 \PackageNoteNoLine{pageslts}{%
3374 \string\pagenumbering\space used more than once before the end\MessageBreak%
3375 of the first page, maybe in the preamble.\MessageBreak%
3376 Resetting all unused page numbering schemes now}%
3377 \setcounter{pagesLTS.pnc.\pagesLTS@pnc}{0}%
3378 \setcounter{pagesLTS.double.\pagesLTS@pnc}{0}%
3379 \setcounter{pagesLTS.current.local.\pagesLTS@pnc}{0}%
3380 \fi%
3381 % \end{macrocode}
3382 %
3383 % The current page numbering scheme is defined by the argument of |\pagenumbering{...}|,
3384 % which the user gave:
3385 %
3386 % \begin{macrocode}
3387 \xdef\pagesLTS@pnc{#1}%
3388 % \end{macrocode}
3389 %
3390 % and the page numbering scheme set by the original page numbering command,
3391 % which resets the page number to one, but at the first page continuation does not make sense.
3392 %
3393 % \begin{macrocode}
3394 \OrigPagenumbering{#1}%
3395 % \end{macrocode}
3396 %
3397 % If a page numbering scheme is used, which is not known by \LaTeX,
3398 % an error might arise here -- but maybe without error message.\bigskip
3399 %
3400 % If page numbering scheme |\alph|, |\Alph|, or |\fnsymbol| is used,
3401 % \xpackage{pageslts} extends the page numbers according to the given options,
3402 % using the \xpackage{alphalph} package. |\arabic| does not need any expansion.
3403 % |\roman| and |\Roman| at least receive a definition for zero.
3404 %
3405 % \begin{macrocode}
3406 \expandPagenumbering{#1}%
3407 % \end{macrocode}
3408 %
3409 % We are at the first page, so the page counters are set to one:
3410 %
3411 % \begin{macrocode}
3412 \pagesLTS@providecounter{pagesLTS.pnc.\pagesLTS@pnc}%
3413 \setcounter{pagesLTS.pnc.\pagesLTS@pnc}{1}%
3414 \pagesLTS@providecounter{pagesLTS.double.\pagesLTS@pnc}%
3415 \setcounter{pagesLTS.double.\pagesLTS@pnc}{1}%
3416 \pagesLTS@providecounter{pagesLTS.current.local.\pagesLTS@pnc}%
3417 \setcounter{pagesLTS.current.local.\pagesLTS@pnc}{1}%
3418 \fi%
3419 % \end{macrocode}
3420 %
3421 % Whether |\pagenumbering{...}| is called in the preamble,
3422 % in the |begindocument| hooks, right after |\begin{document}|,
3423 % or somewhere in the document, we want to remember
3424 % \textit{whether} it was called at all:
3425 %
3426 % \begin{macrocode}
3427 \gdef\pagesLTS@called{1}%
3428 \fi%
3429 % \end{macrocode}
3430 %
3431 % We do not need the temporary definitions any more.
3432 %
3433 % \begin{macrocode}
3434 \let\pagesLTS@tmpA\undefined%
3435 \let\pagesLTS@tmpB\undefined%
3436 }
3437
3438 % \end{macrocode}
3439 % \end{macro}
3440 %
3441 % \begin{macro}{\lastpageref*}
3442 % If \xpackage{hyperref} is used, but (some) references to some last page shall
3443 % not be hyperlinked, a~command |\lastpageref*| (analogous to |\pageref*|)
3444 % is needed. Therefore we define (analogous to |\HyPsd@pageref| from
3445 % the \xpackage{hyperref} package
3446 %
3447 % \begin{macrocode}
3448 %% analogous to \HyPsd@pageref from the hyperref package:
3449 \def\lastpagereftxt#1{\pagesLTS@@pageref#1*\END}
3450
3451 % \end{macrocode}
3452 %
3453 % Macro |\pagesLTSpageref| checks, whether a star is present
3454 % (analogous to |\HyPsd@@pageref| again from the \xpackage{hyperref} package):
3455 %
3456 % \begin{macrocode}
3457 \def\pagesLTS@@pageref#1*#2\END{%
3458 \ifx\\#2\\% no star
3459 \pagesLTS@@@pageref{#1}%
3460 \else% star
3461 \expandafter\pagesLTS@@@pagerefstar%
3462 \fi%
3463 }
3464
3465 \def\pagesLTS@@@pageref#1{\lastpagereftext{#1}}
3466 \def\pagesLTS@@@pagerefstar#1{\lastpagereftextstar{#1}}
3467
3468 % \end{macrocode}
3469 % \end{macro}
3470 %
3471 % \phantomsection
3472 % \begin{macro}{\lastpagereftext}\label{lastpagereftextlabel}%
3473 % When |\lastpageref| is used somewhere inside the \texttt{txt} (text),
3474 % i.\,e.~not at the last page, it is defined as |\lastpagereftxt| (see above).
3475 % When the page numbering scheme is |fnsymbol|, and the \xpackage{hyperref}
3476 % package has been loaded, a hyperref instead of a label is used for the reference
3477 % to |pagesLTS.fnsymbol.local.\number\value{pagesLTS.fnsymbol.local}|.
3478 % (And if the \texttt{pagesLTS.fnsymbol.local} counter did not exist yet,
3479 % it is created here.)\bigskip
3480 %
3481 % \begin{macrocode}
3482 \newcommand{\lastpagereftext}[1]{%
3483 \def\pagesLTS@tmpA{#1}%
3484 \def\pagesLTS@tmpB{pagesLTS.fnsymbol.local}%
3485 \ifx\pagesLTS@tmpA\pagesLTS@tmpB%
3486 \pagesLTS@providecounter{pagesLTS.fnsymbol.local}%
3487 \IfPackageLoadedTF{hyperref}{%
3488 \href{\#pagesLTS.fnsymbol.local.\number\value{pagesLTS.fnsymbol.local}}%
3489 {\number\value{pagesLTS.fnsymbol.local}}%
3490 % \end{macrocode}
3491 %
3492 % When the page numbering scheme is |fnsymbol|, but the \xpackage{hyperref} package
3493 % has \textit{not} been loaded, just the arabic number of the
3494 % \texttt{pagesLTS.fnsymbol.local} counter is given
3495 % (because there will be no hyperlink anyway).
3496 %
3497 % \begin{macrocode}
3498 }{\number\value{pagesLTS.fnsymbol.local}}%
3499 \else%
3500 % \end{macrocode}
3501 %
3502 % Same for |silly| pagenumbering:
3503 %
3504 % \begin{macrocode}
3505 \def\pagesLTS@tmpB{pagesLTS.silly.local}%
3506 \ifx\pagesLTS@tmpA\pagesLTS@tmpB%
3507 \pagesLTS@providecounter{pagesLTS.silly.local}%
3508 \IfPackageLoadedTF{hyperref}{%
3509 \href{\#pagesLTS.silly.local.\number\value{pagesLTS.silly.local}}%
3510 {\number\value{pagesLTS.silly.local}}%
3511 }{\number\value{pagesLTS.silly.local}}%
3512 % \end{macrocode}
3513 %
3514 % and for |gobble| pagenumbering:
3515 %
3516 % \begin{macrocode}
3517 \else%
3518 \def\pagesLTS@tmpB{pagesLTS.gobble.local}%
3519 \ifx\pagesLTS@tmpA\pagesLTS@tmpB%
3520 \pagesLTS@providecounter{pagesLTS.gobble.local}%
3521 \IfPackageLoadedTF{hyperref}{%
3522 \href{\#pagesLTS.gobble.local.\number\value{pagesLTS.gobble.local}}%
3523 {\number\value{pagesLTS.gobble.local}}%
3524 }{\number\value{pagesLTS.gobble.local}}%
3525 % \end{macrocode}
3526 %
3527 % Otherwise just the common |\pageref| is applied:
3528 %
3529 % \begin{macrocode}
3530 \else%
3531 \pageref{#1}%
3532 \fi%
3533 \fi%
3534 \fi%
3535 % \end{macrocode}
3536 %
3537 % We do not need the temporary definitions any more.
3538 %
3539 % \begin{macrocode}
3540 \let\pagesLTS@tmpA\undefined%
3541 \let\pagesLTS@tmpB\undefined%
3542 }
3543
3544 % \end{macrocode}
3545 % \end{macro}
3546 %
3547 % \begin{macro}{\lastpagereftextstar}
3548 % And the same for the starred version, where no hyperlink is generated:
3549 %
3550 % \begin{macrocode}
3551 \newcommand{\lastpagereftextstar}[1]{%
3552 \def\pagesLTS@tmpA{#1}%
3553 \def\pagesLTS@tmpB{pagesLTS.fnsymbol.local}%
3554 \ifx\pagesLTS@tmpA\pagesLTS@tmpB%
3555 \pagesLTS@providecounter{pagesLTS.fnsymbol.local}%
3556 \number\value{pagesLTS.fnsymbol.local}%
3557 \else%
3558 \def\pagesLTS@tmpB{pagesLTS.silly.local}%
3559 \ifx\pagesLTS@tmpA\pagesLTS@tmpB%
3560 \pagesLTS@providecounter{pagesLTS.silly.local}%
3561 \number\value{pagesLTS.silly.local}%
3562 \else%
3563 \def\pagesLTS@tmpB{pagesLTS.gobble.local}%
3564 \ifx\pagesLTS@tmpA\pagesLTS@tmpB%
3565 \pagesLTS@providecounter{pagesLTS.gobble.local}%
3566 \number\value{pagesLTS.gobble.local}%
3567 % \end{macrocode}
3568 %
3569 % There is no |\pageref*| without \xpackage{hyperref}.
3570 %
3571 % \begin{macrocode}
3572 \else%
3573 \IfPackageLoadedTF{hyperref}{\pageref*{#1}}{\pageref{#1}}%
3574 \fi%
3575 \fi%
3576 \fi%
3577 \let\pagesLTS@tmpA\undefined%
3578 \let\pagesLTS@tmpB\undefined%
3579 }
3580
3581 % \end{macrocode}
3582 % \end{macro}
3583 %
3584 % \begin{macro}{\overrideLTSlabel}
3585 % |\overridelabel| from the \xpackage{undolabl} package just |\undonewlabel|s
3586 % a~label and places a new |\label{#1}|, but we need to place a
3587 % |\pagesLTS@putlabel{#1}{#2}|, therefore we need another command instead of
3588 % (but somewhat similar to) |\overridelabel|:
3589 %
3590 % \begin{macrocode}
3591 \newcommand\overrideLTSlabel[2]{%
3592 \@bsphack%
3593 \if@filesw%
3594 \edef\pagesLTS@tmpC{#1}%
3595 \edef\pagesLTS@tmpD{pagesLTS.\[email protected]}%
3596 \ifx\pagesLTS@tmpC\pagesLTS@tmpD%
3597 \ifnum\value{pagesLTS.pnc.\pagesLTS@pnc}>1%
3598 \immediate\write\@auxout{\string\undonewlabel{#1}}\@overriddenmessage s{#1}%
3599 \else%
3600 \edef\pagesLTS@tmpD{fnsymbol}%
3601 \ifx\pagesLTS@pnc\pagesLTS@tmpD%
3602 \immediate\write\@auxout{\string\undonewlabel{#1}}\@overriddenmessage s{#1}%
3603 \fi%
3604 \edef\pagesLTS@tmpD{gobble}%
3605 \ifx\pagesLTS@pnc\pagesLTS@tmpD%
3606 \immediate\write\@auxout{\string\undonewlabel{#1}}\@overriddenmessage s{#1}%
3607 \fi%
3608 \edef\pagesLTS@tmpD{silly}%
3609 \ifx\pagesLTS@pnc\pagesLTS@tmpD%
3610 \immediate\write\@auxout{\string\undonewlabel{#1}}\@overriddenmessage s{#1}%
3611 \fi%
3612 \fi%
3613 \fi%
3614 \pagesLTS@putlabel{#1}{#2}{0}%
3615 \fi%
3616 \@esphack%
3617 }
3618
3619 % \end{macrocode}
3620 % \end{macro}
3621 %
3622 % \begin{macro}{\pagesLTS@EveryShipout}
3623 % Because we cannot make references to pages with |fnsymbol| page
3624 % \textquotedblleft numbers\textquotedblright{} manually with \xpackage{hyperref},
3625 % we use \nolinebreak{|\phantomsection|\,s} and refer to one of those.
3626 % But because we do not know how many \nolinebreak{|\phantomsection|\,s} and
3627 % \nolinebreak{|\section*|\,s} are introduced by the user (or other packages;
3628 % cf.~\LaTeX~bug~2298: knowing level of |section*|,\ %
3629 % \url{https://www.latex-project.org/cgi-bin/ltxbugs2html?pr=latex/2298&introduction=yes&state=open}),
3630 % we cannot refer to the last one as we did with the pages.\bigskip
3631 %
3632 % Therefore each page with |fnsymbol| page \textquotedblleft number\textquotedblright{} %
3633 % receives a |\phantomsection| and a label, which includes a number increased by one
3634 % for each page. This is done for
3635 % |pagesLTS.fnsymbol.local.\number\value{pagesLTS.fnsymbol.cont}| as well as
3636 % |pagesLTS.fnsymbol|, |pagesLTS.\pagesLTS@pnc|, and
3637 % |pagesLTS.\[email protected]|.\newline
3638 % In case an older label already existed, it is overwritten by an |\overridelabel| command.
3639 %
3640 % \begin{macrocode}
3641 \newcommand{\pagesLTS@EveryShipout}{%
3642 \begingroup%
3643 \ifx\pagesLTS@pnc\pagesLTS@fns%
3644 \pagesLTS@providecounter{pagesLTS.fnsymbol.cont}%
3645 \addtocounter{pagesLTS.fnsymbol.cont}{1}%
3646 \IfPackageLoadedT{hyperref}{\phantomsection%
3647 \hypertarget{pagesLTS.fnsymbol.local.\number\value{pagesLTS.fnsymbol.cont}}{}%
3648 }%
3649 \ifnum\pagesLTS@esovFs=\pagesLTS@zero%
3650 \if@filesw\label{pagesLTS.fnsymbol}\fi%
3651 \pagesLTS@putlabel{pagesLTS.fnsymbol.local}{\theCurrentPageLocal}{0}%
3652 \else%
3653 \overridelabel{pagesLTS.fnsymbol}%
3654 \overrideLTSlabel{pagesLTS.fnsymbol.local}{\theCurrentPageLocal}%
3655 \fi%
3656 \else%
3657 % \end{macrocode}
3658 %
3659 % Same with |silly| page \textquotedblleft numbers\textquotedblright :
3660 %
3661 % \begin{macrocode}
3662 \ifx\pagesLTS@pnc\pagesLTS@silly%
3663 \pagesLTS@providecounter{pagesLTS.silly.cont}%
3664 \addtocounter{pagesLTS.silly.cont}{1}%
3665 \IfPackageLoadedT{hyperref}{\phantomsection%
3666 \hypertarget{pagesLTS.silly.local.\number\value{pagesLTS.silly.cont}}{}%
3667 }%
3668 \ifnum\pagesLTS@esovSy=\pagesLTS@zero%
3669 \if@filesw\label{pagesLTS.silly}\fi%
3670 \pagesLTS@putlabel{pagesLTS.silly.local}{\theCurrentPageLocal}{0}%
3671 \else%
3672 \overridelabel{pagesLTS.silly}%
3673 \overrideLTSlabel{pagesLTS.silly.local}{\theCurrentPageLocal}%
3674 \fi%
3675 \else%
3676 % \end{macrocode}
3677 %
3678 % and with |gobble| page \textquotedblleft numbers\textquotedblright :
3679 %
3680 % \begin{macrocode}
3681 \ifx\pagesLTS@pnc\pagesLTS@gobble%
3682 \pagesLTS@providecounter{pagesLTS.gobble.cont}%
3683 \addtocounter{pagesLTS.gobble.cont}{1}%
3684 \IfPackageLoadedT{hyperref}{\phantomsection%
3685 \hypertarget{pagesLTS.gobble.local.\number\value{pagesLTS.gobble.cont}}{}%
3686 }%
3687 \ifnum\pagesLTS@esovGbl=\pagesLTS@zero%
3688 \if@filesw\label{pagesLTS.gobble}\fi%
3689 \pagesLTS@putlabel{pagesLTS.gobble.local}{\theCurrentPageLocal}{0}%
3690 \else%
3691 \overridelabel{pagesLTS.gobble}%
3692 \overrideLTSlabel{pagesLTS.gobble.local}{\theCurrentPageLocal}%
3693 \fi%
3694 \else%
3695 \IfPackageLoadedT{hyperref}{\phantomsection}%
3696 \if@filesw%
3697 \overridelabel{pagesLTS.\pagesLTS@pnc}%
3698 \overrideLTSlabel{pagesLTS.\[email protected]}{\theCurrentPageLocal}%
3699 \fi\fi\fi\fi%
3700 \endgroup%
3701 }
3702
3703 % \end{macrocode}
3704 % \end{macro}
3705 % \newpage
3706 % \begin{macro}{\AddToHook{shipout/foreground}}
3707 % At the end of each shipout, the following commands are executed:
3708 %
3709 % \begin{macrocode}
3710 \AddToHook{shipout/foreground}{%
3711 \ifnum\value{page}>0%
3712 \else%
3713 \ifnum\value{page}=0%
3714 \PackageWarning{pageslts}{%
3715 Counter `page' is zero!\MessageBreak%
3716 If the page numbering scheme is not arabic\MessageBreak%
3717 and further not extended\MessageBreak%
3718 (see Page counter overflow in the pageslts\MessageBreak%
3719 documentation), without other measures\MessageBreak%
3720 this will lead to a counter overflow.\MessageBreak%
3721 Code}%
3722 \else%
3723 \ifnum\value{page}<0%
3724 \PackageWarning{pageslts}{%
3725 Counter `page' is negative: `\the\value{page}'!\MessageBreak%
3726 If the page numbering scheme is not arabic\MessageBreak%
3727 and further not extended\MessageBreak%
3728 (see Page counter overflow in the pageslts\MessageBreak%
3729 documentation), without other measures\MessageBreak%
3730 this will lead to a counter overflow.\MessageBreak%
3731 Code}%
3732 \else%
3733 \PackageError{pageslts}{Counter page has no recognized value}{%
3734 Counter `page' does not have a recognized value:\MessageBreak%
3735 `\the\value{page}'\MessageBreak%
3736 \@ehd\MessageBreak%
3737 }%
3738 \fi%
3739 \fi%
3740 \fi%
3741 % \end{macrocode}
3742 %
3743 % If the |CurrentPage| is equal to one, this is the first shipout.
3744 %
3745 % \begin{macrocode}
3746 \ifnum\value{CurrentPage}=1%
3747 % \end{macrocode}
3748 %
3749 % We check whether some page numbering scheme was defined by
3750 % |\pagenumbering{...}| (\textbf{as it schould be!}):
3751 %
3752 % \begin{macrocode}
3753 \ifx\pagesLTS@called\pagesLTS@zero%
3754 % \end{macrocode}
3755 %
3756 % If it was not defined (i.\,e. |\pagesLTS@called| is zero),
3757 % the user should be informed, that a |\pagenumbering{...}|
3758 % is missing behind |\begin{document}|.
3759 % Of course, it is possible that some package did some pages of output using
3760 % the |begindocument/end| hook. In that case,
3761 % one |\pagenumbering{...}| before |\begin{document}| and
3762 % one |\pagenumbering{...}| (with the same argument, of course!)
3763 % behind |\begin{document}| could help somewhat. When |\PackageError|
3764 % was used here, the error message was not written to the screen and
3765 % the \xfile{.log}-file, but into the document. Therefore we just make
3766 % a note to give the error message later (|\AddToHook{enddocument/afterlastpage}|).
3767 % At that time unfortunately most of the document has already been compiled
3768 % (or did not compile due to this error), but I do not know how to change that.
3769 %
3770 % \begin{macrocode}
3771 \gdef\pncmissing{1}%
3772 % \end{macrocode}
3773 %
3774 % We save the current value of the page,
3775 %
3776 % \begin{macrocode}
3777 \setcounter{pagesLTS.tmpcounter}{\value{page}}%
3778 % \end{macrocode}
3779 %
3780 % determine the current page numbering scheme,
3781 %
3782 % \begin{macrocode}
3783 %% Code from Andres L\"{o}h, Universiteit Utrecht (NL) %%
3784 \def\extract#1{\expandafter\extract@ #1\END}%
3785 \def\extract@#1\csname @#2\endcsname#3\END{#2}%
3786 \edef\pagesLTS@tmpQ{\extract\thepage}%
3787 %% End of code from Andres L\"{o}h %%
3788 % \end{macrocode}
3789 %
3790 % set the current page numbering scheme to~0
3791 % (because before the beginning of the document it should be~0),
3792 %
3793 % \begin{macrocode}
3794 \def\pagesLTS@pnc{0}%
3795 % \end{macrocode}
3796 %
3797 % and then issue a |\pagenumbering| command with the determined
3798 % page numbering scheme as argument:
3799 %
3800 % \begin{macrocode}
3801 \expandafter\pagenumbering\expandafter{\pagesLTS@tmpQ}%
3802 % \end{macrocode}
3803 %
3804 % This resets the page to one (if option |pagecontinue=false| was chosen),
3805 % but because we do not start a new page numbering scheme here
3806 % but manifest a page numbering scheme, which the user forgot to define,
3807 % the page number should not have been reset to one. (This is the first page,
3808 % but maybe the user wants it to have page number 2024?)
3809 % Therefore we revert this here and set the page number to its value,
3810 % which was saved before the |\pagenumbering| command.
3811 %
3812 % \begin{macrocode}
3813 \setcounter{page}{\value{pagesLTS.tmpcounter}}%
3814 \fi%
3815 % \end{macrocode}
3816 %
3817 % We are at the first page, so we put the label here.
3818 %
3819 % \begin{macrocode}
3820 \pagesLTS@writelabel{0}%
3821 \fi%
3822 % \end{macrocode}
3823 %
3824 % If the current page numbering scheme |\pagesLTS@pnc| is |\pagesLTS@fns|
3825 % (which is defined as \texttt{fnsymbol}), the label is set by \linebreak
3826 % |\pagesLTS@EveryShipout| (see just above),
3827 % and |\pagesLTS@esovFs| is set to the (real) number (not the name)
3828 % of this page numbering scheme, |\number\value{pagesLTS.fnsymbol.cont}|.\newline
3829 % When no more pages with |fnsymbol| page
3830 % \textquotedblleft number\textquotedblright{} are shipped out,
3831 % the value remains fixed and we have our reference to the last page
3832 % of the |fnsymbol| page numbering range.
3833 % (At least we will have that reference after some more work, see below).
3834 %
3835 % \begin{macrocode}
3836 \ifx\pagesLTS@pnc\pagesLTS@fns%
3837 \pagesLTS@EveryShipout%
3838 \xdef\pagesLTS@esovFs{\number\value{pagesLTS.fnsymbol.cont}}%
3839 \else%
3840 % \end{macrocode}
3841 %
3842 % Same for |silly| page \textquotedblleft number\textquotedblright :
3843 %
3844 % \begin{macrocode}
3845 \ifx\pagesLTS@pnc\pagesLTS@silly%
3846 \pagesLTS@EveryShipout%
3847 \xdef\pagesLTS@esovSy{\number\value{pagesLTS.silly.cont}}%
3848 \else%
3849 % \end{macrocode}
3850 %
3851 % and for |gobble| page \textquotedblleft number\textquotedblright :
3852 %
3853 % \begin{macrocode}
3854 \ifx\pagesLTS@pnc\pagesLTS@gobble%
3855 \pagesLTS@EveryShipout%
3856 \xdef\pagesLTS@esovGbl{\number\value{pagesLTS.gobble.cont}}%
3857 % \end{macrocode}
3858 %
3859 % When another page numbering scheme was reused (in the example file \xpackage{Roman}),
3860 % we also need to apply |\pagesLTS@EveryShipout|,
3861 % because otherwise we would get multiply defined labels.
3862 %
3863 % \begin{macrocode}
3864 \else%
3865 \ifnum\value{pagesLTS.pnc.\pagesLTS@pnc}>1%
3866 \pagesLTS@EveryShipout%
3867 \fi\fi\fi\fi%
3868 % \end{macrocode}
3869 %
3870 % The |CurrentPage| as well as the |pagesLTS.current.local.\pagesLTS@pnc|
3871 % are advanced by one (because one page was shipped out and the next is about to begin).
3872 %
3873 % \begin{macrocode}
3874 \addtocounter{CurrentPage}{1}%
3875 \addtocounter{pagesLTS.current.local.\pagesLTS@pnc}{1}%
3876 }
3877
3878 % \end{macrocode}
3879 % \end{macro}
3880 %
3881 % We use some code from the \xpackage{lastpage} package:
3882 %
3883 % \begin{macro}{\protected@iwrite}
3884 % We need an |\immediate\protected@write|. Just |\immediate\write| had led to errors,
3885 % for example when packages like \xpackage{babel-greek} re-defined |\roman|.
3886 %
3887 % \begin{macrocode}
3888 %% Code provided by Prof. Enrico Gregorio at https://tex.stackexchange.com/a/542425
3889 \long\def\protected@iwrite#1#2#3{%
3890 \begingroup%
3891 #2%
3892 \let\protect\@unexpandable@protect%
3893 \edef\reserved@a{\immediate\write#1{#3}}%
3894 \reserved@a%
3895 \endgroup%
3896 \if@nobreak\ifvmode\nobreak\fi\fi%
3897 }
3898
3899 % \end{macrocode}
3900 % \end{macro}
3901 %
3902 % \begin{macro}{\pagesLTS@makeHy}
3903 % Just once we need the page from |\@currentHpage| without any
3904 % \mbox{\textquotedblleft |page.|\textquotedblright}
3905 % (|\pagesLTS@makeHy| is identical to |\lastpage@makeHy| except of the used namings
3906 % --~well, being identical depends on the versions of the packages):
3907 % \begin{macrocode}
3908 \newcommand{\pagesLTS@makeHy}{%
3909 % \end{macrocode}
3910 % |\gdef\pagesLTS@Hy{}|, but that was already done before this command.
3911 % \begin{macrocode}
3912 \xdef\pagesLTS@Hptest{Doc-Start}%
3913 \ifx\pagesLTS@Hptest\@currentHpage\relax%
3914 \gdef\pagesLTS@Hy{\@currentHpage}%
3915 \else%
3916 \edef\pagesLTS@Hptest{\@currentHpage}%
3917 \ifx\pagesLTS@Hptest\empty\relax%
3918 % \end{macrocode}
3919 % then |\gdef\pagesLTS@Hy{}|, but that was already done before this command.
3920 % \begin{macrocode}
3921 \else%
3922 \edef\pagesLTS@Hptest{page.}%
3923 \ifx\@currentHpage\pagesLTS@Hptest\relax%
3924 \ifx\pagesLTS@pnc\pagesLTS@gobble%
3925 \PackageNoteNoLine{pageslts}{%
3926 With gobbled page numbers "\string\@currentHpage "\MessageBreak%
3927 is just "page." without number.\MessageBreak%
3928 "\string\pagesLTSlastpageHy " is now let empty}%
3929 \else%
3930 \PackageWarningNoLine{pageslts}{%
3931 \string\@currentHpage\space is just "page." without number.\MessageBreak%
3932 \string\pagesLTSlastpageHy\space is now let empty}%
3933 \fi%
3934 % \end{macrocode}
3935 % then in both cases |\gdef\pagesLTS@Hy{}|, but that was already done before this command.
3936 % \begin{macrocode}
3937 \else%
3938 % \end{macrocode}
3939 % |\@currentHpage| should be |page.<some number>|, |\pagesLTS@rmpage| removes the
3940 % \mbox{\textquotedblleft |page.|\textquotedblright .}\newline
3941 % Next compilation run, |\pagesLTSlastpageHy| gets defined via the \xfile{aux} file.
3942 % If we arrived at this place, but the definition is still empty,
3943 % then |\@currentHpage| has some unexpected content.
3944 % \begin{macrocode}
3945 \gdef\pagesLTS@Hy{\pagesLTS@rmpage{\@currentHpage}}%
3946 \ifx\pagesLTSlastpageHy\empty\relax%
3947 \PackageWarningNoLine{pageslts}{%
3948 \string\@currentHpage\space is\MessageBreak%
3949 \meaning\@currentHpage\MessageBreak%
3950 not beginning with "page.",\MessageBreak%
3951 \string\pagesLTSlastpageHy\space is now let empty}%
3952 \fi\fi\fi\fi%
3953 }%
3954
3955 % \end{macrocode}
3956 % \end{macro}
3957 %
3958 % \begin{macro}{\pagesLTS@rmpage}
3959 % |\pagesLTS@rmpage| removes the \mbox{\textquotedblleft |page.|\textquotedblright.}
3960 %
3961 % \begin{macrocode}
3962 %% Code provided by David Carlisle at https://tex.stackexchange.com/a/721877
3963 \def\pagesLTS@rmpage#1{%
3964 \expandafter\xpagesLTS@rmpage\expanded{#1}\xpagesLTS@rmpage page.%
3965 \xpagesLTS@rmpage\xxpagesLTS@rmpage{#1}}
3966 \def\xpagesLTS@rmpage #1page.#2\xpagesLTS@rmpage#3\xxpagesLTS@rmpage#4{%
3967 \if$\detokenize{#1}$#2%\else#4
3968 \fi}
3969
3970 % \end{macrocode}
3971 % |\else#4| means, that it did not start with |page.|, and whatever it is,
3972 % we cannot use this |#4| for |\pagesLTS@Hy|.
3973 % \end{macro}
3974 % \newpage
3975 % \phantomsection
3976 % \begin{macro}{\pagesLTS@putlabel}\label{pagesLTSputlabel}
3977 % Since the page has been put out, we are on the page after
3978 % that page. We therefore subtract one from the page counter.
3979 %
3980 % \begin{macrocode}
3981 \newcommand{\pagesLTS@putlabel}[3]{%
3982 \addtocounter{page}{-1}%
3983 % \end{macrocode}
3984 %
3985 % When the \xpackage{showkeys} package has been loaded in \texttt{draft} mode,
3986 % in the margin for each label a box is displayed with the name of the label.
3987 % \xpackage{showkeys} accomplishes this by redefining |\label|,
3988 % but \xpackage{pageslts} does not use |\label|, but writes directly to the
3989 % {\nobreak |\jobname|\xfile{.aux}-}\allowbreak file, and this is generally done
3990 % \emph{after} the according page has shipped out, therefore no box can be placed
3991 % on the \emph{preceding} page. At least \xpackage{pageslts} gives a warning, that
3992 % \xpackage{showkeys} cannot present the respective label.
3993 %
3994 % \begin{macrocode}
3995 \IfPackageLoadedT{showkeys}{%
3996 \IfPackageLoadedWithOptionsF{showkeys}{final}{%
3997 \ifnum\value{pagesLTS.pagenr}<1%
3998 \PackageWarningNoLine{pageslts}{%
3999 Package showkeys without option final loaded,\MessageBreak%
4000 but label #1 on page \thepage\space(about \theCurrentPage)\MessageBreak%
4001 cannot be shown, because pageslts does not use \string\label,\MessageBreak%
4002 but writes directly to the \jobname.aux file}%
4003 \else%
4004 \PackageWarningNoLine{pageslts}{%
4005 Package showkeys without option final loaded,\MessageBreak%
4006 but label #1 on page \thepage\space (about \theCurrentPage\space of %
4007 \number\value{pagesLTS.pagenr})\MessageBreak%
4008 cannot be shown, because pageslts does not use \string\label,\MessageBreak%
4009 but writes directly to the \jobname.aux file}%
4010 \fi%
4011 }%
4012 }%
4013 \IfPackageLoadedTF{hyperref}{%
4014 % \end{macrocode}
4015 %
4016 % Here the labels are set, if the \xpackage{hyperref} package
4017 % was loaded. Simply using |\label| would not work, because labels
4018 % wait for the output routines to work, and there may not be any
4019 % more invocations of the output routines. To force the write out
4020 % we need to do an |\immediate| write (|\protected@iwrite|).
4021 %
4022 % \begin{macrocode}
4023 \ifHy@pageanchor\else%
4024 % \end{macrocode}
4025 %
4026 % If the \xpackage{hyperref} package is used, but pageanchors are disabled,
4027 % the hyperlinking will not work.
4028 %
4029 % \begin{macrocode}
4030 \PackageWarningNoLine{pagesLTS}{%
4031 The \string\lastpageref{#1} link does not work\MessageBreak%
4032 using hyperref with disabled option `pageanchor'.\MessageBreak%
4033 Better enable `pageanchor' or use\MessageBreak%
4034 \string\lastpageref*{...} (not generating a link)%
4035 }%
4036 \fi%
4037 % \end{macrocode}
4038 % \newpage
4039 % If use of the \xfile{.aux}-file is allowed, the label for \texttt{LastPage}
4040 % is written into that file, the page reference depending on the options,
4041 % which where set for the \xpackage{hyperref} package.
4042 %
4043 % \begin{macrocode}
4044 \if@filesw%
4045 \begingroup%
4046 % \end{macrocode}
4047 %
4048 % |\@currentlabelname| \emph{should} have been sanitized, but sometimes it is not.
4049 % Therefore we get rid of any possible |\label|, |\index| and |\glossary| contained here.
4050 % This code is inside a |\begingroup|\ldots|\endgroup|, thus there is no need to save
4051 % and later restore the original meaning of those commands.
4052 %
4053 % \begin{macrocode}
4054 \let\label\@gobble@om%
4055 \let\index\@gobble@som%
4056 \let\glossary\@gobble@om%
4057 \protected@iwrite\@auxout{}{\string\newlabel{#1}{%
4058 {\@currentlabel}{#2}{\@currentlabelname}%
4059 {\ifx\pagesLTS@pnc\pagesLTS@fns%
4060 \@currentHref%
4061 \else\ifx\pagesLTS@pnc\pagesLTS@silly%
4062 \@currentHref%
4063 \else\ifx\pagesLTS@pnc\pagesLTS@gobble%
4064 \@currentHref%
4065 \else\ifHy@pageanchor\@currentHpage\fi%
4066 \fi\fi\fi%
4067 }%
4068 {\@kernel@reserved@label@data}}}%
4069 \endgroup%
4070 \fi%
4071 }{%
4072 % \end{macrocode}
4073 %
4074 % Also when \xpackage{hyperref} has not been loaded, the same procedure for |\@currentlabelname| is done:
4075 %
4076 % \begin{macrocode}
4077 \begingroup%
4078 \let\label\@gobble@om%
4079 \let\index\@gobble@som%
4080 \let\glossary\@gobble@om%
4081 % \end{macrocode}
4082 %
4083 % If the \xpackage{hyperref} package is not used, there will be no hyperlinks,
4084 % and the label is written in the way of the \xpackage{lastpage} package.
4085 % But we must remember to undo the label first, if it already exists.
4086 %
4087 % \begin{macrocode}
4088 \if@filesw%
4089 \ifnum\value{pagesLTS.pnc.\pagesLTS@pnc}<2%
4090 \protected@iwrite\@auxout{}{\string\newlabel{#1}{%
4091 {\@currentlabel}{#2}{\@currentlabelname}%
4092 {\@currentHref}{\@kernel@reserved@label@data}}%
4093 }%
4094 \else%
4095 \edef\pagesLTS@tmpC{#1}%
4096 \edef\pagesLTS@tmpD{pagesLTS.\[email protected]}%
4097 \ifx\pagesLTS@tmpC\pagesLTS@tmpD%
4098 \edef\pagesLTS@tmpC{#3}%
4099 \ifx\pagesLTS@tmpC\pagesLTS@one%
4100 % \end{macrocode}
4101 %
4102 % Only when the third argument of |\pagesLTS@putlabel| is $1$, we do need to undo the label.
4103 % Otherwise there is no label to undo, and the \xpackage{undolabl} package would give an error.
4104 %
4105 % \begin{macrocode}
4106 \immediate\write\@auxout{\string\undonewlabel{#1}}%
4107 \fi%
4108 \fi%
4109 \protected@iwrite\@auxout{}{\string\newlabel{#1}{%
4110 {\@currentlabel}{#2}{\@currentlabelname}%
4111 {\@currentHref}{\@kernel@reserved@label@data}}%
4112 }%
4113 \fi%
4114 \fi%
4115 \endgroup%
4116 }%
4117 % \end{macrocode}
4118 %
4119 % After the writeout we restore the page number again, since there might be other things still to be done.
4120 %
4121 % \begin{macrocode}
4122 \addtocounter{page}{+1}%
4123 }
4124
4125 % \end{macrocode}
4126 % \end{macro}
4127 %
4128 % \begin{macro}{\pagesLTS@putlabels}
4129 % |\pagesLTS@putlabels| writes labels and calls |\pagesLTS@putlabel{LastPages}{\theCurrentPage}{1}|.
4130 %
4131 % \begin{macrocode}
4132 \newcommand{\pagesLTS@putlabels}{%
4133 \IfFormatAtLeastF{2025-06-01}{\addtocounter{page}{-1}}%
4134 \addtocounter{CurrentPage}{-1}%
4135 \addtocounter{pagesLTS.current.local.\pagesLTS@pnc}{-1}%
4136 % \end{macrocode}
4137 %
4138 % If |\pagenumbering{...}| has not been used, |\pagesLTS@pnc| is still zero ($0$, |\pagesLTS@zero|),
4139 % and the according warning message is given.
4140 %
4141 % \begin{macrocode}
4142 \ifx\pagesLTS@pnc\pagesLTS@zero%
4143 \PackageWarningNoLine{pagesLTS}{No page numbering scheme found:\MessageBreak%
4144 \pagesLTS@messageNPN}%
4145 % \end{macrocode}
4146 %
4147 % otherwise the numbered label is written, and
4148 % if the page numbering scheme was not used before, also the unnumbered label is written.
4149 %
4150 % \begin{macrocode}
4151 \else%
4152 \pagesLTS@writelabel{\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}}%
4153 \ifnum\value{pagesLTS.pnc.\pagesLTS@pnc}<2%
4154 \ifx\pagesLTS@pnc\pagesLTS@fns%
4155 \else\ifx\pagesLTS@pnc\pagesLTS@silly%
4156 \else\ifx\pagesLTS@pnc\pagesLTS@gobble%
4157 \else\pagesLTS@writelabel{\pagesLTS@pnc}%
4158 \fi\fi\fi\fi\fi%
4159 % \end{macrocode}
4160 %
4161 % Before the label for the \texttt{LastPages} can be put, we must advance one page again
4162 % (if we changed it), because |\pagesLTS@putlabel| itself goes back one page
4163 % (and at its end forward again).
4164 %
4165 % \begin{macrocode}
4166 \IfFormatAtLeastF{2025-06-01}{\addtocounter{page}{+1}}%
4167 \pagesLTS@putlabel{LastPages}{\theCurrentPage}{1}%
4168 % \end{macrocode}
4169 %
4170 % Here should follow a\newline
4171 % |\addtocounter{page}{-1}|,\newline
4172 % but we have to remember to increase the page counters again,
4173 % which were decreased at the start of this |\pagesLTS@putlabels| command,
4174 % and that would include\newline
4175 % |\addtocounter{page}{+1}|,\newline
4176 % therefore these two lines cancel each other and therefore they just can be skipped.
4177 % But the other counters have to be increased again:
4178 %
4179 % \begin{macrocode}
4180 \addtocounter{CurrentPage}{+1}%
4181 \addtocounter{pagesLTS.current.local.\pagesLTS@pnc}{+1}%
4182 }
4183
4184 % \end{macrocode}
4185 % \end{macro}
4186 %
4187 % \begin{macro}{\AddToHook\{begindocument/end\}}
4188 % |\AddToHook{begindocument/end}{|\ldots |}|:
4189 % \begin{macrocode}
4190 \AddToHook{begindocument/end}{%
4191 % \end{macrocode}
4192 %
4193 % Checking, whether \xpackage{lastpage} and \xpackage{pageslts} have \emph{both} been loaded.
4194 %
4195 % \begin{macrocode}
4196 \IfPackageLoadedT{lastpage}{%
4197 \PackageNoteNoLine{pageslts}{Packages lastpage and pageslts used:\MessageBreak%
4198 Are you sure that you want to load both packages?}%
4199 }%
4200 % \end{macrocode}
4201 %
4202 % It is checked whether the \xpackage{hyperref} package, if loaded, is recent enough:
4203 %
4204 % \begin{macrocode}
4205 \IfPackageLoadedTF{hyperref}{%
4206 \ProvideTextCommand{\textasteriskcentered}{PD1}{*}%
4207 \IfPackageAtLeastF{hyperref}{2024-11-05}{%
4208 \PackageError{pageslts}{hyperref package version too old}{%
4209 Required version: 2024-11-05 v7.01l or newer,\MessageBreak%
4210 found version:\space\space\space\space\csname [email protected]\endcsname.}}%
4211 }{\PackageNoteNoLine{pageslts}{Package hyperref not loaded.\MessageBreak%
4212 pageslts would support hyperref.\MessageBreak%
4213 The page references will NOT be hyperlinked}%
4214 }%
4215 % \end{macrocode}
4216 %
4217 % Further it is checked whether the \xpackage{alphalph} package has been loaded.
4218 % If that is the case, the commands are defined accordingly.
4219 %
4220 % \begin{macrocode}
4221 \IfPackageLoadedT{alphalph}{%
4222 \newalphalph{\AlphMult}[mult]{\@Alph}{26}%
4223 \newalphalph{\alphMult}[mult]{\@alph}{26}%
4224 \newalphalph{\fnsymbolmult}[mult]{\@fnsymbol}{5}%
4225 }%
4226 % \end{macrocode}
4227 % \pagebreak
4228 %
4229 % It is checked whether writing to files is allowed.
4230 % The \xpackage{pageslts} package cannot be used without that!
4231 % Some packages (e.\,g.~\xpackage{tikz} and \xpackage{selectp}) sometimes prevent
4232 % the output to the \xfile{aux} file. In that case a warning or an error message
4233 % is issued. This is no problem as long as there is/was another compilation run
4234 % where the labels can/could be processed via the \xfile{aux} file.\bigskip
4235 %
4236 % \begin{macrocode}
4237 \if@filesw%
4238 \else%
4239 \IfPackageLoadedTF{tikz}{%
4240 \PackageWarningNoLine{pageslts}%
4241 {It was not allowed to write to an\MessageBreak%
4242 .aux file. This package does not work without access\MessageBreak%
4243 to an .aux file.\MessageBreak%
4244 It is OK if the .aux file was already updated\MessageBreak%
4245 by a previous compiler run\MessageBreak%
4246 and would not have changed anyway%
4247 }%
4248 }{\PackageError{pageslts}{No writing to auxiliary file allowed}%
4249 {It was not allowed to write to an .aux file.\MessageBreak%
4250 This package does not work without access to an .aux file.\MessageBreak%
4251 Press Ctrl+Z to exit.\MessageBreak%
4252 But it is OK if the .aux file was already updated\MessageBreak%
4253 by previous compiler runs\MessageBreak%
4254 and would not have changed anyway.\MessageBreak%
4255 (In that case just press Enter or Return\MessageBreak%
4256 to continue the compilation.)%
4257 }%
4258 }%
4259 \fi%
4260 }
4261
4262 % \end{macrocode}
4263 % \end{macro}
4264 %
4265 % We do check whether \xpackage{showkeys} has been loaded (\emph{before} \xpackage{pageslts}!)
4266 % in a mode to show the labels:
4267 %
4268 % \begin{macrocode}
4269 \def\pagesLTS@skld{0}
4270 \IfPackageLoadedT{showkeys}{\IfPackageLoadedWithOptionsF{showkeys}{final}{%
4271 \def\pagesLTS@skld{1}}%
4272 }%
4273
4274 % \end{macrocode}
4275 %
4276 % \begin{macro}{\AddToHook\{enddocument/afterlastpage\}}
4277 % |\AddToHook{enddocument/afterlastpage}| it is checked
4278 % whether the \xpackage{showkeys} package was loaded after the check performed before,
4279 % in which case an error message is issued.
4280 %
4281 % \begin{macrocode}
4282 \AddToHook{enddocument/afterlastpage}{%
4283 \IfPackageLoadedT{showkeys}{\IfPackageLoadedWithOptionsF{showkeys}{final}{%
4284 \ifx\pagesLTS@skld\pagesLTS@one\relax%
4285 \else\PackageError{pageslts}{Package showkeys loaded after pageslts}{%
4286 The showkeys package with option "final" has been loaded\MessageBreak%
4287 after the pageslts package.\MessageBreak%
4288 Please first load showkeys and then pageslts.}%
4289 \fi}%
4290 }%
4291 % \end{macrocode}
4292 %
4293 % We also give the error message about the missing (i.\,e.~not found)
4294 % page numbering scheme, which could not be given in hook |shipout/foreground|.
4295 %
4296 % \begin{macrocode}
4297 \ifx\pncmissing\pagesLTS@one\relax%
4298 \PackageError{pageslts}{pagenumbering scheme missing}{\pagesLTS@messageNPN}%
4299 \fi%
4300 % \end{macrocode}
4301 %
4302 % Then we put in an |info| to show, in what order things (which were called) are done.
4303 %
4304 % \begin{macrocode}
4305 \PackageInfo{pageslts}{enddocument/afterlastpage (AED): pageslts setting LastPage}%
4306 % \end{macrocode}
4307 %
4308 % After this we remember the page number (if |fnsymbol| or |silly| or |gobble|),
4309 % and after that we place the \texttt{LastPage} label.
4310 %
4311 % \begin{macrocode}
4312 \ifx\pagesLTS@pnc\pagesLTS@fns%
4313 \def\pagesLTS@tmpA{\number\value{pagesLTS.fnsymbol.local}}%
4314 \ifnum\pagesLTS@esoFs=\pagesLTS@tmpA%
4315 \gdef\pagesLTS@rerun{0}%
4316 \else%
4317 \gdef\pagesLTS@rerun{1}%
4318 \fi%
4319 \if@filesw%
4320 \immediate\write\@auxout{\string\gdef\string\pagesLTS@esoFs{\pagesLTS@tmpA}}%
4321 \fi%
4322 \else%
4323 \ifx\pagesLTS@pnc\pagesLTS@silly%
4324 \def\pagesLTS@tmpA{\number\value{pagesLTS.silly.local}}%
4325 \ifnum\pagesLTS@esoSy=\pagesLTS@tmpA%
4326 \gdef\pagesLTS@rerun{0}%
4327 \else%
4328 \gdef\pagesLTS@rerun{1}%
4329 \fi%
4330 \if@filesw%
4331 \immediate\write\@auxout{\string\gdef\string\pagesLTS@esoSy{\pagesLTS@tmpA}}%
4332 \fi%
4333 \else%
4334 \ifx\pagesLTS@pnc\pagesLTS@gobble%
4335 \def\pagesLTS@tmpA{\number\value{pagesLTS.gobble.local}}%
4336 \ifnum\pagesLTS@esoGbl=\pagesLTS@tmpA%
4337 \gdef\pagesLTS@rerun{0}%
4338 \else%
4339 \gdef\pagesLTS@rerun{1}%
4340 \fi%
4341 \if@filesw%
4342 \immediate\write\@auxout{\string\gdef\string\pagesLTS@esoGbl{\pagesLTS@tmpA}}%
4343 \fi\fi\fi\fi%
4344 \IfFormatAtLeastT{2025-06-01}{\addtocounter{page}{+1}}%
4345 \pagesLTS@putlabel{LastPage}{\thepage}{1}%
4346 \IfFormatAtLeastT{2025-06-01}{\addtocounter{page}{-1}}%
4347 % \end{macrocode}
4348 %
4349 % We do not need the temporary definition any more.
4350 %
4351 % \begin{macrocode}
4352 \let\pagesLTS@tmpA\undefined%
4353 % \end{macrocode}
4354 %
4355 % The number of pages with the |fnsymbol| page numbering scheme,
4356 % |\pagesLTS@esovFs|, and the number of pages with the |silly| page numbering scheme,
4357 % |\pagesLTS@esovSy|, and the number of pages with the |gobble| page numbering scheme,
4358 % |\pagesLTS@esovGbl|, are saved via the \xfile{.aux} file (if it is not zero, respectively):
4359 %
4360 % \begin{macrocode}
4361 \if@filesw%
4362 \ifx\pagesLTS@esovFs\pagesLTS@zero\relax%
4363 \else%
4364 \immediate\write\@auxout{\string\pagesLTS@providecounter{pagesLTS.fnsymbol.local}}%
4365 \immediate\write\@auxout{\string\setcounter{pagesLTS.fnsymbol.local}{\pagesLTS@esovFs}}%
4366 \fi%
4367 \ifx\pagesLTS@esovSy\pagesLTS@zero\relax%
4368 \else%
4369 \immediate\write\@auxout{\string\pagesLTS@providecounter{pagesLTS.silly.local}}%
4370 \immediate\write\@auxout{\string\setcounter{pagesLTS.silly.local}{\pagesLTS@esovSy}}%
4371 \fi%
4372 \ifx\pagesLTS@esovGbl\pagesLTS@zero\relax%
4373 \else%
4374 \immediate\write\@auxout{\string\pagesLTS@providecounter{pagesLTS.gobble.local}}%
4375 \immediate\write\@auxout{\string\setcounter{pagesLTS.gobble.local}{\pagesLTS@esovGbl}}%
4376 \fi%
4377 \fi%
4378 % \end{macrocode}
4379 %
4380 % At the call of a |\pagenumbering{...}| command, everything for a split page numbering scheme
4381 % is organized. For the last page numbering scheme, there is no |\pagenumbering{...}| command
4382 % at the end, so we need to handle this here:
4383 %
4384 % \begin{macrocode}
4385 \pagesLTS@providecounter{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}.local.count}%
4386 \setcounter{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}.local.count}{%
4387 \value{pagesLTS.current.local.\pagesLTS@pnc}}%
4388 % \end{macrocode}
4389 %
4390 % And we are one page after the last one (hook |enddocument/afterlastpage|!), so we go back one page.
4391 %
4392 % \begin{macrocode}
4393 \addtocounter{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}.local.count}{-1}%
4394 \ifnum\value{pagesLTS.pnc.\pagesLTS@pnc}>1%
4395 \setcounter{pagesLTS.tmpcounter}{\value{pagesLTS.pnc.\pagesLTS@pnc}}%
4396 \@tempcnta=\value{pagesLTS.tmpcounter}\relax%
4397 \loop%
4398 \ifnum\@tempcnta>1\relax%
4399 \addtocounter{pagesLTS.tmpcounter}{-1}%
4400 \addtocounter{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}.local.count}{%
4401 -\value{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.tmpcounter}.local.count}}%
4402 \@tempcnta=\value{pagesLTS.tmpcounter}\relax%
4403 \repeat%
4404 \fi%
4405 \if@filesw%
4406 \immediate\write\@auxout{\string
4407 \pagesLTS@providecounter{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}.local.cnt}}%
4408 \edef\pagesLTS@tmpA{\number\value{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}.local.count}}%
4409 \immediate\write\@auxout{\string
4410 \setcounter{pagesLTS.\pagesLTS@pnc.\number\value{pagesLTS.pnc.\pagesLTS@pnc}.local.cnt}{\pagesLTS@tmpA}}%
4411 \fi%
4412 % \end{macrocode}
4413 %
4414 % We need to save (via the \xfile{.aux} file) the page name |\thepage|
4415 % and the page number |\number\value{CurrentPage}| of the last page,
4416 % in case the last page has |fnsymbol| page numbering scheme.
4417 %
4418 % \begin{macrocode}
4419 \IfFormatAtLeastF{2025-06-01}{\addtocounter{page}{-1}}%
4420 \def\pagesLTS@tmpA{\thepage}%
4421 \if@filesw%
4422 \protected@iwrite\@auxout{}{\string\gdef\string\pagesLTSlastpage{\pagesLTS@tmpA}}%
4423 \gdef\pagesLTS@Hy{}%
4424 \IfPackageLoadedT{hyperref}{\ifHy@pageanchor\pagesLTS@makeHy\fi}%
4425 \protected@iwrite\@auxout{}{\string\gdef\string\pagesLTSlastpageHy{\pagesLTS@Hy}}%
4426 \fi%
4427 \IfFormatAtLeastF{2025-06-01}{\addtocounter{page}{-1}}%
4428 \addtocounter{CurrentPage}{-1}%
4429 \edef\pagesLTS@tmpB{\number\value{CurrentPage}}%
4430 \if@filesw%
4431 \immediate\write\@auxout{\string\setcounter{pagesLTS.pagenr}{\pagesLTS@tmpB}}%
4432 \fi%
4433 \addtocounter{CurrentPage}{+1}%
4434 % \end{macrocode}
4435 %
4436 % The \texttt{VeryLastPage} label is set here. Before the introduction of the hook mechanism in the kernel,
4437 % |\lastpageref{VeryLastPage}| could point to a later page then |\lastpageref{LastPage}|.
4438 % |LastPage| and |VeryLastPage| should now be identical, but for backward compatibility we keep both.
4439 %
4440 % \begin{macrocode}
4441 \PackageInfo{pageslts}{enddocument/afterlastpage (AED): pageslts setting VeryLastPage}%
4442 \IfFormatAtLeastT{2025-06-01}{\addtocounter{page}{+1}}%
4443 \pagesLTS@putlabel{VeryLastPage}{\thepage}{1}%
4444 \IfFormatAtLeastT{2025-06-01}{\addtocounter{page}{-1}}%
4445 % \end{macrocode}
4446 %
4447 % The \texttt{LastPages} label is set here, and |\lastpageref{LastPages}| gives
4448 % the total number of pages and points to the last page.
4449 %
4450 % \begin{macrocode}
4451 \PackageInfo{pageslts}{enddocument/afterlastpage (AED): pageslts setting LastPages}%
4452 \pagesLTS@putlabels%
4453 \ifodd\pagesLTS@tmpB%
4454 \PackageNoteNoLine{pageslts}{Total number of pages is odd}%
4455 \else%
4456 \PackageNoteNoLine{pageslts}{Total number of pages is even}%
4457 \fi%
4458 }
4459
4460 % \end{macrocode}
4461 % \end{macro}
4462 %
4463 % \begin{macro}{\frontmatter}
4464 % |\frontmatter| often contains |\pagenumbering|, but for some unknown reason
4465 % there are problems when another |\pagenumbering| with different page numbering scheme
4466 % has been used before on the same page. (This would not make any sense anyway,
4467 % because one page can only have one page numbering scheme.) This problem does not
4468 % occur when two |\pagenumbering| commands are used inside normal text.
4469 % Thus we need to check whether |\frontmatter| has been defined,
4470 % whether it changes the page numbering scheme, and whether the page numbering scheme
4471 % before |\frontmatter| was initiated at the same page.
4472 % With the hook mechanism it does not matter whether the command to be patched is defined.
4473 %
4474 % \begin{macrocode}
4475 \AddToHook{cmd/frontmatter/before}{%
4476 \xdef\pagesLTS@FMBpncn{\pagesLTS@pnc}%
4477 \xdef\pagesLTS@FMBpncp{\number\value{pagesLTS.current.local.\pagesLTS@pnc}}%
4478 }
4479
4480 % \end{macrocode}
4481 %
4482 % At the beginning of the |\frontmatter| (FMB), we remember the
4483 % current (c) page numbering (pn) scheme: its name (n) and page number (p).
4484 % |\pagesLTS@FMBpncp| would be |1| if the according |\pagenumbering| command
4485 % was used on the same page at the |\frontmatter|.
4486 %
4487 % At the end of the |\frontmatter| the named checks are performed
4488 % and in case of the named problem an error message is given.
4489 %
4490 % \begin{macrocode}
4491 \AddToHook{cmd/frontmatter/after}{%
4492 \xdef\pagesLTS@FMEpncn{\pagesLTS@pnc}%
4493 \ifx\pagesLTS@FMBpncn\pagesLTS@FMEpncn%
4494 \else%
4495 \ifx\pagesLTS@FMBpncn\pagesLTS@zero%
4496 \else%
4497 \ifx\pagesLTS@FMBpncp\pagesLTS@one%
4498 \PackageWarning{pageslts}{\string\pagenumbering\space before \string\frontmatter:\MessageBreak%
4499 Do not use \string\pagenumbering{\pagesLTS@FMBpncn} before \string\frontmatter\MessageBreak%
4500 on the same page!\MessageBreak%
4501 \string\frontmatter\space (re)defines the page numbering scheme to \pagesLTS@FMEpncn ,\MessageBreak%
4502 thus earlier use of \string\pagenumbering{\pagesLTS@FMBpncn} %
4503 on the same page is useless anyway\MessageBreak}%
4504 \fi%
4505 \fi%
4506 \fi%
4507 }
4508
4509 % \end{macrocode}
4510 % \end{macro}
4511 % \newpage
4512 %
4513 % \begin{macro}{\AddToHook\{enddocument/info\}}
4514 % The hook |enddocument/info| is even later:
4515 % \begin{quote}
4516 % \textquotedblleft This hook is meant to receive code that write final information messages
4517 % to the terminal. It follows immediately after the previous hook\textquotedblright
4518 % \end{quote}
4519 % (Frank Mittelbach (2024-11-25): \LaTeX's hook management, lthooks-code.pdf, p.~28)
4520 % |enddocument/afteraux|. Here it is used for a rerun hint.\newline
4521 % For example if the page numbering scheme of the last page of the
4522 % \textsf{pageslts-example.tex} file is changed to |fnsymbol| and two runs
4523 % of \pdfLaTeX{} are done, \pdfLaTeX{} will be happy and will not complain
4524 % about changed labels. But indeed, a \emph{third} run is necessary
4525 % and indicated by the warning message below.
4526 %
4527 % \begin{macrocode}
4528 \AddToHook{enddocument/info}{%
4529 \ifx\pagesLTS@rerun\pagesLTS@one%
4530 \PackageWarningNoLine{pageslts}{Label(s) may have changed.\MessageBreak%
4531 Rerun to get cross-references right}%
4532 \fi%
4533 }
4534
4535 % \end{macrocode}
4536 % \end{macro}
4537 % \begin{macrocode}
4538 %</package>
4539 % \end{macrocode}
4540 %
4541 % \newpage
4542 % \setlength{\parindent}{\the\ltsindent}
4543 %
4544 % \section{Installation}
4545 %
4546 % \subsection{Downloads\label{ss:Downloads}}
4547 %
4548 % Everything is available at \url{https://CTAN.org},
4549 % but may need additional packages themselves.\bigskip
4550 %
4551 % \DescribeMacro{pageslts.dtx}
4552 % For unpacking the |pageslts.dtx| file and constructing the documentation it is required:
4553 % \begin{description}
4554 % \item[-] \TeX Format \LaTeXe{} 2025-06-01: \url{https://CTAN.org}
4555 %
4556 % \item[-] document class \xclass{ltxdoc}, 2024/02/08, v2.1j, \url{https://ctan.org/pkg/ltxdoc}
4557 %
4558 % \item[-] package \xpackage{holtxdoc}, 2019/12/09, v0.30, \url{https://ctan.org/pkg/holtxdoc}
4559 %
4560 % \item[-] package \xpackage{hypdoc}, 2023-10-26, v1.19, \url{https://ctan.org/pkg/hypdoc}
4561 %
4562 % \item[-] package \xpackage{geometry}, 2020/01/02, v5.9, \url{https://ctan.org/pkg/geometry}
4563 %
4564 % \item[-] package \xpackage{ulem}, 2019-11-18, no version number given, \url{https://ctan.org/pkg/ulem}
4565 % \end{description}
4566 %
4567 % \DescribeMacro{pageslts.sty}
4568 % The |pageslts.sty| for \LaTeXe{} $\geq$ 2025-06-01 (i.\,e.~all documents using the
4569 % \xpackage{pageslts} package) requires:
4570 % \begin{description}
4571 % \item[-] \TeX{} Format \LaTeXe{} 2025-06-01, \url{https://CTAN.org}
4572 %
4573 % \item[-] package \xpackage{undolabl}, 2025-01-28, v1.0o, \url{https://ctan.org/pkg/undolabl}
4574 %
4575 % \item[-] if any of the options |alphMult|, |AlphMulti|, or |fnsymbolmult| is used:
4576 % package \xpackage{alphalph}, 2019/12/09, v2.6,\newline \url{https://ctan.org/pkg/alphalph}
4577 %
4578 % \item[-] if |\pagenumbering{silly}| shall be used, the \xpackage{sillypage} package
4579 % must be loaded, 2024-07-23, v1.7,\newline \url{https://www.ctan.org/pkg/sillypage}
4580 % \end{description}
4581 %
4582 % \DescribeMacro{pageslts-example.tex}
4583 % The |pageslts-example.tex| requires the same files as all documents using the
4584 % \xpackage{pageslts} package, and additionally:
4585 % \begin{description}
4586 % \item[-] class \textsf{article}, 2025/01/22, v1.4n, from \textsf{classes.dtx}: \url{https://ctan.org/pkg/classes}
4587 %
4588 % \item[-] package \xpackage{alphalph}, 2019/12/09, v2.6, \url{https://ctan.org/pkg/alphalph}
4589 %
4590 % \item[-] package \xpackage{lipsum}, 2021-09-20, v2.7, \url{https://ctan.org/pkg/lipsum}
4591 %
4592 % \item[-] package \xpackage{showkeys}, 2024/05/23, v3.21, \url{https://ctan.org/pkg/showkeys}
4593 %
4594 % \item[-] package \xpackage{hyperref}, 2025-07-12, v7.01o, \url{https://ctan.org/pkg/hyperref}
4595 %
4596 % \item[-] package \xpackage{pageslts}, 2025-08-14, v2.0g, \url{https://ctan.org/pkg/pageslts}\newline
4597 % (Well, it is the example file for this package, and because you are reading the
4598 % documentation for the \xpackage{pageslts} package, it can be assumed that you already
4599 % have some version of it~-- is it the current one?)
4600 % \end{description}
4601 %
4602 % \DescribeMacro{Münch}
4603 % A hyperlinked list of my (other) packages can be found at \url{https://ctan.org/author/muench-hm}.
4604 %
4605 % \subsection{Package, unpacking TDS}
4606 % \paragraph{Package.} This package is available on \url{https://CTAN.org}.
4607 % \begin{description}
4608 % \item[\url{https://mirror.ctan.org/macros/latex/contrib/pageslts/pageslts.dtx}]\hspace*{0.1cm} \newline
4609 % The source file.
4610 % \item[\url{https://mirror.ctan.org/macros/latex/contrib/pageslts/pageslts.pdf}]\hspace*{0.1cm} \newline
4611 % The documentation.
4612 % \item[\url{https://mirror.ctan.org/macros/latex/contrib/pageslts/pageslts-example.pdf}]\hspace*{0.1cm} \newline
4613 % The compiled example file, as it should look like.
4614 % \item[\url{https://mirror.ctan.org/macros/latex/contrib/pageslts/README}]\hspace*{0.1cm} \newline
4615 % The README file.
4616 % \end{description}
4617 % There is also a |pageslts.tds.zip| available:
4618 % \begin{description}
4619 % \item[\url{https://mirror.ctan.org/install/macros/latex/contrib/pageslts.tds.zip}]\hspace*{0.1cm} \newline
4620 % Everything in TDS compliant, compiled format.
4621 % \end{description}
4622 % which additionally contains\newline
4623 % \begin{tabular}{ll}
4624 % pageslts.ins & The \texttt{ins}tallation file.\\
4625 % pageslts.drv & The \mbox{\texttt{dr}i\texttt{v}er} to generate the documentation.\\
4626 % pageslts.sty & The \texttt{sty}le file.\\
4627 % pageslts-example.tex & The example file.%
4628 % \end{tabular}
4629 %
4630 % \bigskip
4631 %
4632 % \noindent For required other packages please see the preceding subsection.
4633 %
4634 % \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
4635 % \docstrip{} archive. The files are extracted by running the
4636 % \xext{.dtx} through \plainTeX :
4637 % \begin{quote}
4638 % \verb|tex pageslts.dtx|
4639 % \end{quote}
4640 %
4641 % About generating the documentation see paragraph~\ref{GenDoc} below.\bigskip
4642 %
4643 % \paragraph{TDS.} Now the different files must be moved into
4644 % the different directories in your installation TDS tree
4645 % (also known as \xfile{texmf} tree):
4646 % \begin{quote}
4647 % \def\t{^^A
4648 % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
4649 % pageslts.sty & tex/latex/pageslts.sty\\
4650 % pageslts.pdf & doc/latex/pageslts.pdf\\
4651 % pageslts-example.tex & doc/latex/pageslts-example.tex\\
4652 % pageslts-example.pdf & doc/latex/pageslts-example.pdf\\
4653 % pageslts.dtx & source/latex/pageslts.dtx\\
4654 % \end{tabular}^^A
4655 % }^^A
4656 % \sbox0{\t}^^A
4657 % \ifdim\wd0>\linewidth
4658 % \begingroup
4659 % \advance\linewidth by\leftmargin
4660 % \advance\linewidth by\rightmargin
4661 % \edef\x{\endgroup
4662 % \def\noexpand\lw{\the\linewidth}^^A
4663 % }\x
4664 % \def\lwbox{^^A
4665 % \leavevmode
4666 % \hbox to \linewidth{^^A
4667 % \kern-\leftmargin\relax
4668 % \hss
4669 % \usebox0
4670 % \hss
4671 % \kern-\rightmargin\relax
4672 % }^^A
4673 % }^^A
4674 % \ifdim\wd0>\lw
4675 % \sbox0{\small\t}^^A
4676 % \ifdim\wd0>\linewidth
4677 % \ifdim\wd0>\lw
4678 % \sbox0{\footnotesize\t}^^A
4679 % \ifdim\wd0>\linewidth
4680 % \ifdim\wd0>\lw
4681 % \sbox0{\scriptsize\t}^^A
4682 % \ifdim\wd0>\linewidth
4683 % \ifdim\wd0>\lw
4684 % \sbox0{\tiny\t}^^A
4685 % \ifdim\wd0>\linewidth
4686 % \lwbox
4687 % \else
4688 % \usebox0
4689 % \fi
4690 % \else
4691 % \lwbox
4692 % \fi
4693 % \else
4694 % \usebox0
4695 % \fi
4696 % \else
4697 % \lwbox
4698 % \fi
4699 % \else
4700 % \usebox0
4701 % \fi
4702 % \else
4703 % \lwbox
4704 % \fi
4705 % \else
4706 % \usebox0
4707 % \fi
4708 % \else
4709 % \lwbox
4710 % \fi
4711 % \else
4712 % \usebox0
4713 % \fi
4714 % \end{quote}
4715 % If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's
4716 % TDS installing feature, then some files can already be in the right
4717 % place, see the documentation of \docstrip.
4718 %
4719 % \subsection{Refresh file name databases}
4720 % If your \TeX~distribution (\TeX\,Live, \mikTeX, \dots) relies on
4721 % file name databases, you must refresh these. For example, \TeX\,Live\ users
4722 % run \verb|texhash| or \verb|mktexlsr|.
4723 %
4724 % \subsection{Some details for the interested}
4725 % \paragraph{Unpacking with \LaTeX.}
4726 % The \xfile{.dtx} chooses its action depending on the format:
4727 % \begin{description}
4728 % \item[\plainTeX:] Run \docstrip\ and extract the files.
4729 % \item[\LaTeX:] Generate the documentation.
4730 % \end{description}
4731 % If you insist on using \LaTeX\ for \docstrip\ (really,
4732 % \docstrip\ does not need \LaTeX), then inform the autodetect routine
4733 % about your intention:
4734 % \begin{quote}
4735 % \verb|latex \let\install=y\input{pageslts.dtx}|
4736 % \end{quote}
4737 % Do not forget to quote the argument according to the demands
4738 % of your shell.
4739 %
4740 % \paragraph{Generating the documentation.\label{GenDoc}}
4741 % You can use both the \xfile{.dtx} or the \xfile{.drv} to generate
4742 % the documentation. The process can be configured by a
4743 % configuration file \xfile{ltxdoc.cfg}. For instance, put the following
4744 % line into this file, if you want to have A4 as paper format:
4745 % \begin{quote}
4746 % \verb|\PassOptionsToClass{a4paper}{article}|
4747 % \end{quote}
4748 %
4749 % \noindent An example follows how to generate the
4750 % documentation with \pdfLaTeX :
4751 %
4752 % \begin{quote}
4753 %\begin{verbatim}
4754 %pdflatex pageslts.dtx
4755 %makeindex -s gind.ist pageslts.idx
4756 %pdflatex pageslts.dtx
4757 %makeindex -s gind.ist pageslts.idx
4758 %pdflatex pageslts.dtx
4759 %\end{verbatim}
4760 % \end{quote}
4761 %
4762 % \subsection{Compiling the example}
4763 % The example file, \textsf{pageslts-example.tex}, can be compiled via\newline
4764 % |latex pageslts-example.tex|\newline
4765 % or (recommended)\newline
4766 % |pdflatex pageslts-example.tex|\newline
4767 % and will need \textit{at least} (!) three compiler runs to get all references right.
4768 %
4769 % \pagebreak
4770 %
4771 % \section{Acknowledgements}
4772 % I (\textsc{H.-Martin Münch}) would like to thank
4773 % \textsc{Jeffrey P. Goldberg} (jeffrey+news at goldmark dot org) for
4774 % inventing the \xpackage{lastpage} package. This \xpackage{pageslts} package
4775 % first started as a revision of the \xpackage{lastpage} package, but a replacement
4776 % was deemed necessary to accomplish what this package does.
4777 % Further I would like to thank \textsc{Heiko Oberdiek} for providing the
4778 % |\erroralphalph| command as well as a~lot~(!) of useful packages
4779 % (from which I also got everything I know about creating a file in
4780 % \xfile{dtx} format, OK, say it: copying), \textsc{Ulrich Diez} for his code for the
4781 % \xpackage{undolabl} package, which allows overwriting of labels, and
4782 % \textsc{Andres Löh} for the code to determine the current page numbering scheme.
4783 % For bug reports I thank \textsc{Micha\l{} Herman}, \textsc{kwikwi}, \textsc{Joshua Ellis},
4784 % and \textsc{Dr.~Clea F. Rees}. For telling me how to fix a bug
4785 % (and for all his shared whisdom at \url{https://tex.stackexchange.com})
4786 % thanks go to \textsc{Prof.~Enrico Gregorio}.
4787 %
4788 % \phantomsection
4789 % \begin{History}\label{History}
4790 % \begin{Version}{1994/06/17, \xpackage{lastpage}}
4791 % \item \xpackage{lastpage} v0.99a: First shot by \textsc{Jeffrey P. Goldberg}.
4792 % \end{Version}
4793 % \begin{Version}{1994/06/25, \xpackage{lastpage}}
4794 % \item \xpackage{lastpage} v0.1b: Last version number created by \textsc{Jeffrey P. Goldberg}.
4795 % \end{Version}
4796 % \begin{Version}{1994/07/20, \xpackage{lastpage}}
4797 % \item \xpackage{lastpage} v0.1b (again): Documentation updated by
4798 % \textsc{Jeffrey P. Goldberg}.\newline
4799 % The main source code of the \xpackage{lastpage} package 1994/07/20 v0.1b was:\bigskip
4800 % \begin{verbatim}
4801 % \NeedsTeXFormat{LaTeX2e}[1994/06/01]
4802 % \ProvidesPackage{lastpage}[1994/07/20 v0.1b
4803 % LaTeX2e package for refs to last page number (JPG)]
4804 % \def\lastpage@putlabel{\addtocounter{page}{-1}%
4805 % \immediate\write\@auxout{\string
4806 % \newlabel{LastPage}{{}{\thepage}}}%
4807 % \addtocounter{page}{1}}
4808 % \AtEndDocument{%
4809 % \message{AED: lastpage setting LastPage}%
4810 % \clearpage\lastpage@putlabel}%
4811 % \endinput
4812 % \end{verbatim}
4813 % and then \xpackage{hyperref} and \xpackage{revtex} even redefine |\lastpage@putlabel|.
4814 % \end{Version}
4815 % \begin{Version}{2010/02/18, \xpackage{lastpage}}
4816 % \item \xpackage{lastpage} v1.1: Proposed |LastPages| label by H.-Martin Münch
4817 % on \Newsgroup{comp.text.tex}, see e.\,g.
4818 % \url{https://groups.google.com/group/comp.text.tex/msg/4407493da9c747f0?dmode=source};
4819 % now available in this \xpackage{pageslts} package.
4820 % \end{Version}
4821 % \begin{Version}{2010/05/15 v1.0 \xpackage{pagesLTS}}
4822 % \item \xpackage{pagesLTS} Complete rewriting of the package, so as to work with
4823 % \textbf{more than one page numbering scheme}; using |\AtVeryEnd|
4824 % for \texttt{VeryLastPage}; upgrade from \xpackage{fancyheadings} to
4825 % \xpackage{fancyhdr} package, then removed the need for a \xpackage{fancyhdr}
4826 % package at all.
4827 % \item Rewriting of the package, so as to work with the |fnsymbol|
4828 % page numbering scheme (even on the last page).
4829 % \item Introduction of \xpackage{kvoptions} into this package.
4830 % \item Check for incompatible \xpackage{endfloat} package.
4831 % \item \xpackage{lastpage209.sty} for \LaTeX209 .
4832 % \item Replacement of |\filedate|, |-version|, |-name|,\ldots{} because
4833 % of \LaTeX~bug 2705:\newline
4834 % Synopsis: Possible problem with |\fileversion| and |\filedate|\newline
4835 % \url{https://www.latex-project.org/cgi-bin/ltxbugs2html?category=LaTeX&responsible=anyone&state=anything&keyword=lastpage&pr=latex%2F2705&search=}
4836 % \item \xpackage{alphalph} support included.
4837 % \item Page numbering extension |\erroralph| by \textsc{Heiko Oberdiek} included.
4838 % \item (Page-)Numbering extension for |roman| and |Roman| numbers included.
4839 % \item Incompatible, old \xpackage{lastpage} package \textquotedblleft killed\textquotedblright .
4840 % \item Example |pagesLTS-example.tex| added.
4841 % \item Alternatives listing (section \ref{sec:Alternatives}).
4842 % \item Listing of \TeX{} sources (subsection \ref{ss:Downloads}).
4843 % \item Complete rewriting of the documentation.
4844 % \item Everything in DTX framework.
4845 % \item New package name: \xpackage{pagesLTS} for Last, Total,
4846 % and page numbering Schemes pages.
4847 % \end{Version}
4848 % \begin{Version}{2010/06/01 v1.1(a) \xpackage{pagesLTS}}
4849 % \item Abstract changed: Negative \texttt{roman} and \texttt{Roman} page
4850 % numbers are now possible.
4851 % \item Several typing mistakes have been corrected~-
4852 % both in the \xfile{sty}le file as well as in this documentation.
4853 % \end{Version}
4854 % \begin{Version}{2010/06/03 v1.1b \xpackage{pagesLTS}}
4855 % \item Corrected a bug in |\XXRoman|, where |\roman| instead of |\Roman| had been used.
4856 % \item New \xpackage{papermas} package mentioned.
4857 % \end{Version}
4858 % \begin{Version}{2010/06/24 v1.1c \xpackage{pagesLTS}}
4859 % \item \xpackage{holtxdoc} warning in \xfile{drv} updated.
4860 % \item Removed CRLF line endings from the \xfile{dtx} file.
4861 % \item Corrected the location of the package at CTAN.
4862 % (In this version \xfile{TDS} was still missing due to a packaging error.)
4863 % \item Corrected Message format in pagesLTS.\xfile{ins}.
4864 % \end{Version}
4865 % \begin{Version}{2010/07/15 v1.1d \xpackage{pagesLTS}}
4866 % \item Added the |\@ifclassloaded{revtex4}| code for |\lastpage@putlabel| (changed to
4867 % |\pagesLTS@putlabelhyper|) from the \xpackage{hyperref} package \textbf{as comment}.
4868 % \item In the documentation added the explanation of the occurrence of multiply definitions
4869 % of the |LastPage| label with \xpackage{lastpage}, \xpackage{pagesLTS}, \xpackage{hyperref}
4870 % package (in that order).
4871 % \item Updated to (then) new version of \xpackage{undolabl} package [2010/07/15] v1.0d,
4872 % which uses |\undonewlabel| with only one instead of two arguments.
4873 % \item Added a warning message, if \xpackage{hyperref} \textit{and} \xpackage{pdfpages} were \textit{both} used.
4874 % \end{Version}
4875 % \begin{Version}{2010/07/29 v1.1e \xpackage{pagesLTS}}
4876 % \item Removed \xpackage{lastpage209.sty}, because it is now contained
4877 % in the \xpackage{lastpage}\xfile{.dtx}\ file, v\,$\geq 1.2$a.
4878 % \item Removed the |\@ifclassloaded{revtex4}| code for |\lastpage@putlabel|.
4879 % \item Handling of \xpackage{lastpage} package adapted to updated version~1.2(a).
4880 % \item Corrected error in \xpackage{lastpage} code [1994/07/20 v0.1b].
4881 % \item Version handling for \xpackage{undolabl} package updated.
4882 % \item Included a |\CheckSum|.
4883 % \end{Version}
4884 % \begin{Version}{2010/08/08 v1.1f \xpackage{pagesLTS}}
4885 % \item Version 1.1e had a bug: AlphAlph was replaced by alphalph (because that package is named like this),
4886 % but this was done also in commands and definitions~- now reverted.
4887 % \end{Version}
4888 % \begin{Version}{2010/08/12 v1.1g \xpackage{pagesLTS}}
4889 % \item Now the rerun warning is given \textit{after} e.\,g.~the |\listfiles|,
4890 % increasing the chance of the user to read it.
4891 % \end{Version}
4892 % \begin{Version}{2010/08/23 v1.1h \xpackage{pagesLTS}}
4893 % \item Renamed |\XXRoman| to |\XRoman|.
4894 % \item Reduced the number of needed counters.
4895 % \item Removed wrong \% from the driver file.
4896 % \item Changed the |\unit| definition (got rid of an old |\rm|).
4897 % \item Without use of the \xpackage{hyperref} package, labels of type
4898 % \texttt{pagesLTS.}\meta{page numbering scheme}\texttt{.local}
4899 % became multiply defined. Now an |\undolabl| was inserted.
4900 % \end{Version}
4901 % \begin{Version}{2010/08/25 v1.1i \xpackage{pagesLTS}}
4902 % \item Bug fix: \textsf{tcilatex} defines the |\hyperref| command, therefore
4903 % for \xpackage{hyperref} package detection this had to be changed to
4904 % |\Hy@Warning|.
4905 % \end{Version}
4906 % \begin{Version}{2010/09/12 v1.1j \xpackage{pagesLTS}}
4907 % \item Bug fix: \LaTeX{} issued a \textquotedblleft \texttt{Label(s) may have changed.%
4908 % Rerun to get cross-references right.}\textquotedblright -warning,
4909 % even if labels had not changed but were overwritten.
4910 % \item Starred version of |\lastpageref| for suppressing hyperlinks introduced.
4911 % \item A lot of details.
4912 % \end{Version}
4913 % \begin{Version}{2010/09/22 v1.1k \xpackage{pagesLTS}}
4914 % \item When no \texttt{fnsymbol} pagenumbering scheme is used, the respective
4915 % counters are not defined, saving three counters.
4916 % \item Moved the package from \texttt{.../latex/muench/pagesLTS/...} to
4917 % \texttt{.../latex/pagesLTS/...}.
4918 % \end{Version}
4919 % \begin{Version}{2010/09/27 v1.1l \xpackage{pagesLTS}}
4920 % \item Bug fix: |\PackageError{pagesLTS}{pagenumbering missing}{\pagesLTS@messageNPN }|
4921 % had to be moved to the outside of |\EveryShipout|, because it wrote its
4922 % message into the document instead to the screen and the \xfile{.log}-file.
4923 % \item Updated to version 2010/04/24 v0.19 of the \xpackage{holtxdoc} package.
4924 % \end{Version}
4925 % \begin{Version}{2011/02/01 v1.1m \xpackage{pagesLTS}}
4926 % \item Added a new warning subsection about \xpackage{hyperref} and repeated page
4927 % numbers.
4928 % \item Bug fix: Missing \% after |-\romannumeral\number-\arabic{#1}| added.
4929 % \item The (then) new version v2.4i of the \xpackage{endfloat} package was then
4930 % even older than 15~years.
4931 % \item Put a warning in the documentation as well as in the \xfile{log}-file and
4932 % at the screen during compilation about the \xpackage{showkeys} package.
4933 % (The labels of the \xpackage{pagesLTS} package cannot be shown by the
4934 % \xpackage{showkeys} package.)
4935 % \item Bug fix: In some situations a rerun warning was given even if no rerun
4936 % was necessary.
4937 % \item The option \texttt{alphMult}\ \ is now set to \texttt{ab} by default.
4938 % \item The option \texttt{AlphMulti}\ is now set to \texttt{AB} by default.
4939 % \end{Version}
4940 % \begin{Version}{2011/03/16 v1.1n \xpackage{pagesLTS}}
4941 % \item Bug fix: Handling of option |pagecontinue=false| changed.
4942 % When |pagecontinue=false| was used, but also a
4943 % |alphMult|, |AlphMulti|, |fnsymbolmult|, |romanMult| or |RomanMulti| option
4944 % other than |0| or |false|, respectively, was used, the page numbering
4945 % \textit{was} continued/extended. Now a warning is issued in case of such
4946 % option clash and |pagecontinue=false| is heeded, disabling all continuation.
4947 % \item Bug fix: |\ProvidesPackage{pagesLTS}| contained an older date (2010/09/27 of v1.1l
4948 % instead of 2011/02/01 of v1.1m).
4949 % \item Bug fix: The \xpackage{ulem} package is needed to generate the documentation from the
4950 % \xfile{pagesLTS.dtx} file, but was not listed as necessary package.
4951 % \item Bug fix: One reference to an outdated version of \xpackage{undolabl} package,
4952 % replaced by the (then) recent version.
4953 % \item Some minor details.
4954 % \end{Version}
4955 % \begin{Version}{2011/03/17 v1.1o \xpackage{pagesLTS}}
4956 % \item Documentation and ReadMe bug fix: This \xpackage{pagesLTS} package is located at
4957 % \url{https://ctan.org/pkg/pageslts} instead of \ldots /pagesLTS/.
4958 % \item There is a new (possible) alternative package, \xpackage{totcount},
4959 % see section~\ref{sec:Alternatives}.
4960 % \item Bug fix: There was a reference to \xpackage{lastpage} 1994/07/20, v0.1b,
4961 % instead of the current version.
4962 % \end{Version}
4963 % \begin{Version}{2011/08/08 v1.2a}
4964 % \item \textbf{Renamed the package from \xpackage{pagesLTS} to \xpackage{pageslts}
4965 % (keeping family, prefix, internal commands,\ldots{} as |pagesLTS|).}
4966 % Added checking against double loading as \xpackage{pagesLTS} and \xpackage{pageslts}.
4967 % \item The \xpackage{holtxdoc} package was fixed (recent: 2011/02/04, v0.21), therefore
4968 % the warning in \xfile{drv} could be removed.
4969 % \item |\AtEndAfterFileList| from the (then) new version of the \xpackage{atveryend} package,
4970 % 2011/04/23, v1.7, by \textsc{Heiko Oberdiek}, is now used for the rerun hint
4971 % instead of appending to |\@dofilelist|.
4972 % \item Now defining $2$: |\def\pagesLTS@two{2}| and $3$: |\def\pagesLTS@three{3}|.
4973 % \item Replaced |\texttt{\textbackslash|\ldots|}| by
4974 % \textbar \textbackslash \ldots \textbar{} in the \xfile{dtx} and by
4975 % |\verb|\textbar \textbackslash \ldots \textbar{} in the example (where possible).
4976 % \item When the \xpackage{alphalph} package is needed, it is loaded via |\RequirePackage|
4977 % instead of crashing with an error message.
4978 % \item A lot of details (also in the documentation).
4979 % \end{Version}
4980 % \begin{Version}{2013/01/28 v1.2b}
4981 % \item Updated to \TeX{} live 2012 (for compiling the documentation and example)
4982 % and installed the available updates. Therefore I can no longer test
4983 % whether \xpackage{pageslts} works with earlier versions of \LaTeX{}.
4984 % \item Replaced |\let| by |\LetLtxMacro|.
4985 % \item The \xpackage{nameref} package redefines |\label| to have five arguments
4986 % instead of two, therefore |\newlabel{LastPage}{{}{\thepage}{}{}{}}| instead of
4987 % |\newlabel{LastPage}{{}{\thepage}}| must be used.
4988 % (Bug reported at \url{https://tex.stackexchange.com/q/95541/6865},
4989 % thanks to Micha\l{} Herman!) Fixed. [Later in the kernel \textit{all} labels
4990 % got defined to have five arguments.]
4991 % \item Updates to a lot of details, also in the documentation.
4992 % \end{Version}
4993 % \begin{Version}{2014/01/19 v1.2c}
4994 % \item Bug: missing loop, fix: inserted.
4995 % \item Bug: when option |pagecontinue=false| was set, the extension of the
4996 % page numbering schemes was disabled by mistake, fixed.
4997 % \item Now using |\ltx@ifpackageloaded| from the \xpackage{ltxcmds} package
4998 % for checking (even \emph{after} |\AtBeginDocument|)
4999 % whether a package has been loaded.
5000 % \item Bug: incompatibility with \xpackage{lineno} because of a mistake
5001 % in the redefined |\pagenumbering|, fixed. (Bug reported by \textsc{kwikwi}, thanks!)
5002 % \item Bug: When |\pagenumbering| preceded |\frontmatter| on the same page
5003 % but with different argument than the |\pagenumbering|, which was inside
5004 % |\frontmatter|, then some labelling got mixed up.
5005 % (Also this bug reported by \textsc{kwikwi}, thanks!) While this is not fixed automatically,
5006 % now an appropriate error message is given. (Two different page numbering schemes
5007 % on the same page make no sense anyway.)
5008 % \end{Version}
5009 % \begin{Version}{2015/08/02 v1.2d}
5010 % \item Updated to \TeX{} Live 2015 (for compiling the documentation and example)
5011 % and installed the available updates. Therefore I can no longer test
5012 % whether \xpackage{pageslts} works with earlier versions of \LaTeX .
5013 % \item A |ifundefinedorrelax| similar to the one from \xpackage{scrbase.sty}
5014 % of the KOMA script bundle as 2013/12/19 v3.12 is used now,
5015 % without the need for \eTeX .
5016 % \item New versions of Adobe Reader and of some packages have become available.
5017 % \item Changed the message (type) to be displayed if writing to files is disallowed
5018 % (as pointed out by \textsc{Joshua Ellis}, thanks!).
5019 % \item Updates to several details, also in the documentation.
5020 % \end{Version}
5021 % \begin{Version}{2015/08/17 v1.2e}
5022 % \item Bug fix, see \url{https://tex.stackexchange.com/q/261445/6865},
5023 % thank you to \textsc{Prof. Enrico Gregorio} for providing the fix
5024 % and to \textsc{Dr. Clea F. Rees} for bringing this to my attention.
5025 % \end{Version}
5026 % \begin{Version}{2015/12/21 v1.2f}
5027 % \item Replaced |\next| with |\@pageslts@currname|.
5028 % \item Bug fix, see \url{https://tex.stackexchange.com/q/140235/6865}.
5029 % If the bug had been actually reported (instead of waiting until I see
5030 % the question), I would have fixed it earlier, of course.
5031 % \item Changed minor details like fixing urls in the manual.
5032 % \end{Version}
5033 % \begin{Version}{2024-11-20 v2.0a}
5034 % \item Kernel-updates broke the package, the package was repaired and updated
5035 % to the new kernel-code; ports from \xpackage{lastpage}.
5036 % \item Removed |\unit|.
5037 % \item Removed |\XXRoman| (deprecated at least since 2015).
5038 % \item Removed code from/need for packages \xpackage{prelim2e}, \xpackage{ltxcmds},
5039 % \xpackage{atveryend}, \xpackage{etoolbox}, \xpackage{everyshi},
5040 % \xpackage{letltxmacro}, and \xpackage{rerunfilecheck}.
5041 % \item Removed checks for available \eTeX, \xpackage{endfloats} package from 1992,
5042 % \xpackage{pagesLTS} package from 2011, \xpackage{hyperref} from 2015 etc.
5043 % \item Renamed |\pagesLTS@ifcounter| to |\pagesLTS@providecounter|.
5044 % \item Renamed |\pagesLTS.lastpage| to |\pagesLTSlastpage|.
5045 % \end{Version}
5046 % \begin{Version}{2024-12-07 v2.0b}
5047 % \item Bug fix: |pagecontinue=false| did not reset everything always fully correct.
5048 % \item Instead of requiring the \xpackage{kvoptions} package, kernel commands are used.
5049 % \item Now compatible with the \xpackage{romanbarpagenumber} package,
5050 % even independent of loading order.
5051 % \item When more than one |\pagenumbering| command is given before the end of the first page
5052 % (maybe in the preamble), all but the last |\pagenumbering| are ignored
5053 % (as also \LaTeX{} would naturally do).
5054 % \item The saved |\OrigPagenumbering| is used in both places now
5055 % instead of the plain definition from the kernel,
5056 % so any change before the \xpackage{pageslts} package is taken into account.
5057 % \item Changed the \autoref{sec:Alternatives}: \nameref{sec:Alternatives},
5058 % mirroring the one from the current \xpackage{lastpage} package.
5059 % \item For cases when |\@currentHpage| is just |page.|, the warning text has been corrected.
5060 % \item Page numbering scheme |silly| (from \href{https://ctan.org/pkg/sillypage}{%
5061 % \xpackage{sillypage} package}) now works.
5062 % \item Page numbering scheme |gobble| now works. (Is that silly?!)
5063 % \item Added |\ProvideTextCommand{\textasteriskcentered}{PD1}{*}|.
5064 % \item Missing |\if@filesw \fi| added.
5065 % \item Recent \xpackage{undolabl} package ($\geq$ 2024-12-05 v1.0n) required!
5066 % \end{Version}
5067 % \begin{Version}{2024-12-23 v2.0c}
5068 % \item Bug fix: Error handling for missing |\pagenumbering| now needs
5069 % two \mbox{\texttt{\textbackslash}|expandafter|\,s.}
5070 % \end{Version}
5071 % \begin{Version}{2025-01-10 2.0d}
5072 % \item Bug fix: One |\Roman@bar{page}| must be |\Roman@bar{\Roman{page}}|.
5073 % \item Several typing mistakes have been corrected, used format and package versions have been updated.
5074 % \end{Version}
5075 % \begin{Version}{2025-06-05 v2.0e}
5076 % \item Since \LaTeX-format 2025-06-01 after shipping the last page all further |\write|s
5077 % are made |\immediate|, requiring some adjusted |\addtocounter{page}{-1}| and
5078 % |\addtocounter{page}{+1}| here.
5079 % \end{Version}
5080 % \begin{Version}{2025-08-09 v2.0f}
5081 % \item \xpackage{polyglossia} with |arabic| changes the meaning of |\arabic|,
5082 % therefore |\number\value| is needed to internally get compilable numbers.
5083 % \end{Version}
5084 % \begin{Version}{2025-08-14 v2.0g}
5085 % \item Compatibility fix for package \xpackage{titlesec} ported from \xpackage{lastpage}.
5086 % \end{Version}
5087 % \end{History}
5088 % \bigskip
5089 %
5090 % \noindent When you find a mistake or have a suggestion for an improvement of this package,
5091 % please send an e-mail to the maintainer, thanks!\newline
5092 % (Please see BUG REPORTS in the README.)
5093 % \PrintIndex
5094 % \Finale
5095 \endinput