% \iffalse meta-comment % % File: pageslts.dtx % Version: 2024-12-23 v2.0c % Info: Variants of last page labels % % Copyright © 2010 - 2024 by % H.-Martin Münch % Portions of code copyrighted by other people as marked. % % This package first started as a revision of the lastpage % package of Jeffrey P. Goldberg (jeffrey+news at goldmark dot org), % but I thought a replacement was needed. % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either % version 1.3c of this license or (at your option) any later % version. This version of this license is in % https://www.latex-project.org/lppl/lppl-1-3c.txt % and the latest version of this license is in % https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of % LaTeX version 2005-12-01 or later. % % This work has the LPPL maintenance status "maintained". % % The Current Maintainer of this work is H.-Martin Münch. % % This work consists of the main source file pageslts.dtx, % the README, and the derived files % pageslts.sty, pageslts.pdf, % pageslts.ins, pageslts.drv, % pageslts-example.tex, pageslts-example.pdf. % % "pageslts" is available on CTAN: % https://ctan.org/pkg/pageslts % % Also a TDS.ZIP file is provided that contains all the files % already sorted in a TDS tree: % https://mirror.ctan.org/install/macros/latex/contrib/pageslts.tds.zip % %<*ignore> \begingroup \catcode123=1 % \catcode125=2 % \def\x{LaTeX2e}% \expandafter\endgroup \ifcase 0\ifx\install y1\fi\expandafter \ifx\csname processbatchFile\endcsname\relax\else1\fi \ifx\fmtname\x\else 1\fi\relax \else\csname fi\endcsname % %<*install> \input docstrip.tex \Msg{**********************************************************************************} \Msg{* Installation *} \Msg{* Package: pageslts 2024-12-23 v2.0c Refers to special pages' numbers/names (HMM)*} \Msg{**********************************************************************************} \keepsilent \askforoverwritefalse \let\MetaPrefix\relax \preamble This is a generated file. Project: pageslts Version: 2024-12-23 v2.0c Info: Variants of last page labels Copyright (C) 2010 - 2024 by H.-Martin Muench Portions of code copyrighted by other people as marked. IMPORTANT NOTICE: On the first page backslash pagenumbering should be called (with the appropriate argument out of e.g. * roman - Lowercase Roman numerals: i, ii, iii, iv,... * Roman - Uppercase Roman numerals: I, II, III, IV,... * arabic - Arabic numerals: 1, 2, 3, 4,... * alph - Lowercase letters: a, b, c, d,... * Alph - Uppercase letters: A, B, C, D,... * fnsymbol - Footnote symbols: *, † (ddagger), ‡ (dddagger), § (mathsection),... * silly - from sillypage package * gobble - gobbles the page numbers; maybe backslash thispagestyle{empty} is more useful? ). The command backslash pagenumbering is renewed, but no change should be visible to the output text, because only labels are added. backslash OrigPagenumbering can be used to get the original meaning of backslash pagenumbering, but in that case this package does not see the change in the page numbering scheme and will make mistakes. The package takes options. This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this license or (at your option) any later version. This version of this license is in https://www.latex-project.org/lppl/lppl-1-3c.txt and the latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX version 2005-12-01 or later. This work has the LPPL maintenance status "maintained". The Current Maintainer of this work is H.-Martin Muench. This package first started as a revision of the lastpage package of Jeffrey P. Goldberg (jeffrey+news at goldmark dot org), but I thought a replacement was needed. This work consists of the main source file pageslts.dtx, the README, and the derived files pageslts.sty, pageslts.pdf, pageslts.ins, pageslts.drv, pageslts-example.tex, pageslts-example.pdf. In memoriam Claudia Simone Barth + 1996-01-30 Tommy Muench + 2014-01-02 Hans-Klaus Muench + 2014-08-24 \endpreamble \let\MetaPrefix\DoubleperCent \generate{% \file{pageslts.ins}{\from{pageslts.dtx}{install}}% \file{pageslts.drv}{\from{pageslts.dtx}{driver}}% \usedir{tex/latex/pageslts}% \file{pageslts.sty}{\from{pageslts.dtx}{package}}% \usedir{doc/latex/pageslts}% \file{pageslts-example.tex}{\from{pageslts.dtx}{example}}% } \catcode32=13\relax% active space \let =\space% \Msg{************************************************************************} \Msg{*} \Msg{* To finish the installation you have to move the following} \Msg{* file into a directory searched by TeX:} \Msg{*} \Msg{* pageslts.sty} \Msg{*} \Msg{* To produce the documentation run the file `pageslts.drv'} \Msg{* through (pdf)LaTeX, e.g.} \Msg{* pdflatex pageslts.drv} \Msg{* makeindex -s gind.ist pageslts.idx} \Msg{* pdflatex pageslts.drv} \Msg{* makeindex -s gind.ist pageslts.idx} \Msg{* pdflatex pageslts.drv} \Msg{*} \Msg{* At least three runs are necessary e. g. to get the} \Msg{* references right!} \Msg{*} \Msg{* Happy TeXing!} \Msg{*} \Msg{************************************************************************} \endbatchfile % %<*ignore> \fi % % % \section{The documentation driver file} % The next bit of code contains the documentation driver file for % \TeX , i.\,e., the file that will produce the documentation you % are currently reading. It will be extracted from this file by the % \texttt{docstrip} programme. That is, run \LaTeX{} on \texttt{docstrip} % and specify the \texttt{driver} option when \texttt{docstrip} % asks for options. % % \begin{macrocode} %<*driver> \NeedsTeXFormat{LaTeX2e}[2024-11-01] \ProvidesFile{pageslts.drv}% [2024-12-23 v2.0c Refers to special pages' numbers/names (HMM)] \documentclass[landscape]{ltxdoc}[2024/02/08]% v2.1j Standard LaTeX documentation class \usepackage{geometry}[2020/01/02]% v5.9 Page Geometry \usepackage{holtxdoc}[2019/12/09]% v0.30 Private additional ltxdoc support (HO) \hypersetup{% pdfsubject={Refers to special pages' numbers/names (HMM)},% pdfkeywords={LaTeX, pageslts, pagesLTS, lastpage, page number, page name},% pdfencoding=auto,% pdflang={en},% breaklinks=true,% linktoc=all,% pdfstartview=FitH,% pdfpagelayout=OneColumn,% bookmarksnumbered=true,% bookmarksopen=true,% bookmarksopenlevel=2,% pdfmenubar=true,% pdftoolbar=true,% pdfwindowui=true,% pdfnewwindow=true% } \usepackage{ulem}[2019-11-18]% no version is given in the ulem.sty file \CodelineIndex \hyphenation{created every-thing ignored} \begin{document} \DocInput{pageslts.dtx}% \end{document} % % \end{macrocode} % \fi % % \GetFileInfo{pageslts.drv} % % \begingroup % \def\x{\#,\$,\^,\_,\~,\ ,\&,\{,\},\%}% % \makeatletter % \@onelevel@sanitize\x % \expandafter\endgroup % \expandafter\DoNotIndex\expandafter{\x} % \expandafter\DoNotIndex\expandafter{\string\ } % \begingroup % \makeatletter % \lccode`9=32\relax % \lowercase{%^^A % \edef\x{\noexpand\DoNotIndex{\@backslashchar9}}%^^A % }%^^A % \expandafter\endgroup\x % % \DoNotIndex{\ ,\",\,,\\,\-,\@Alph,\@alph,\@bsphack,\@ehc,\@ehd,\@esphack,\@ifundefined,\@ne,% % \@currentlabel,\@currentlabelname,\@evenfoot,\@fnsymbol,\@gobble,\@ifl@t@r,% % \@kernel@reserved@label@data,\@oddfoot,\@tempcnta,\addcontentsline,\addtocounter,\AfterLastShipout,% % \Alph,\alph,\alphalph,\AlphAlph,\AlphMult,\alphMult,\AlphMulti,\arabic,\AtEndDocument,\baselineskip,% % \begin,\bigskip,\csname,\dagger,\ddagger,\detokenize,\documentclass,\endinput,% % \empty,\END,\end,\endcsname,\ensuremath,\expanded,\extract,\extract@,\fmtversion,% % \fnsymbol,\fnsymbolmult,\frontmatter,\gdef,\href,\hskip,\hypersetup,\hypertarget,\HyPsd@pageref,% % \if,\if@filesw,\if@nobreak,\ifnum,\ifodd,\ifx,\ifvmode,% % \IfPackageAtLeastTF,\IfPackageAtLeastF,\@ifpackageloaded,\IfPackageLoadedT,\IfPackageLoadedF,% % \IfPackageLoadedTF,\IfPackageLoadedWithOptionsF,\immediate,\item,\jobname,\label,\LaTeX,\ldots,% % \linebreak,\lipsum,\listfiles,\loop,\makeatletter,\makeatother,\MessageBreak,\markboth,\mathparagraph,% % \mathsection,\mbox,\meaning,\newcommand,\newline,\newpage,\NeedsTeXFormat,\NewCommandCopy,\newcounter,% % \newlabel,\nobreak,\noindent,\nolinebreak,\number,\numexpr,\options,\PackageError,\PackageInfo,% % \PackageNoteNoLine,\PackageWarning,\PackageWarningNoLine,\pagebreak,\pageref,% % \pagesLTS@tmpA,\pagesLTS@tmpB,\pagesLTS@tmpC,\pagesLTS@tmpD,\pagesLTS@tmpQ,\par,\parindent,% % \phantomsection,\ProvidesPackage,\protect,\qquad,\ref,\renewcommand,\repeat,\RequirePackage,% % \section,\setcounter,\setlength,\smallskip,\space,\subsection,% % \tableofcontents,\textbackslash,\textbf,\textit,\textquotedblleft,\textquotedblright,\textsf,\texttt,% % \texorpdfstring,\textasteriskcentered,\the,\thepage,\thispagestyle,\undefined,\url,\usepackage,% % \value,\verb,\xpagesLTS@rmpage,\xxpagesLTS@rmpage,\SetKeys} % % \newlength\ltsindent % \setlength{\ltsindent}{\parindent} % \setlength{\parindent}{0pt} % \renewcommand{\indent}{\hspace*{\ltsindent}} % % \title{The \xpackage{pageslts} package} % \date{2024-12-23 v2.0c} % \author{H.-Martin Münch\\\xemail{Martin.Muench at Uni-Bonn.de}} % % \maketitle % % \begin{abstract} % \noindent This \LaTeX{} package puts the labels \texttt{LastPage} % (|\AddToHook{enddocument/afterlastpage}|, formerly |\AtEndDocument|) % and \texttt{VeryLastPage} (also |\AddToHook{enddocument/afterlastpage}|, % but formerly |\AfterLastShipout|) into the \xfile{.aux} file, % allowing the user to refer to the last page of a document. % This might be particularly useful in places like headers or footers. % When more than one page numbering scheme is used, % these references do not give the total \textit{number} of pages. % For this case the label \texttt{LastPages} is introduced. % Additionally, at the last page of each page numbering % scheme a label \texttt{pagesLTS.} is % placed, where \texttt{} is e.\,g. % arabic, roman, Roman, alph, or Alph. For fnsymbol % please use |\lastpageref{pagesLTS.fnsymbol}| % instead of |\pageref{pagesLTS.fnsymbol}|. % When the same numbering scheme is used twice, % the page numbers are either reset to one or continued % automatically, depending on the option given when the package % is called. The command |\theCurrentPage| % prints the current total/absolute page number -- in contrast to % |\thepage|, which gives only the page % \textit{name} in the current page numbering scheme. % |\theCurrentPageLocal| gives the current % number of pages in the current page numbering scheme. % |\thepage| and |\theCurrentPageLocal| are different e.\,g. % when |\addtocounter{page}{|\ldots|}| or % |\setcounter{page}{|\ldots|}| were used. % At the first page of the document a label \texttt{pagesLTS.0} is % created. This label can be referred to, too. % Further labels are provided for special cases.\par % % The \xpackage{alphalph} package is supported, % i.\,e.~page numbers alph or Alph $>26$ and fnsymbol $>9$ % can be used (with according options set). Even zero % and negative page numbers can be used with \texttt{arabic}, % \texttt{alph}, \texttt{Alph}, \texttt{roman}, \texttt{Roman}, % and \texttt{fnsymbol} page numbering (with \xpackage{alphalph} package % and according options).\par % % |\pageref*| and |\lastpageref*|, for using \xpackage{hyperref} % but suppressing links, are supported. -- The name of the \xpackage{pageslts} package % refers to \textbf{L}ast, \textbf{T}otal, and page numbering \textbf{S}chemes pages. % \xpackage{pagesLTS} was a former name of this package. % \end{abstract} % % Right after |\begin{document}| a |\pagenumbering{|\ldots|}| should be called~-- % with the appropriate argument out of e.\,g.\newline % arabic (Arabic numerals: 1, 2, 3, 4,\ldots),\newline % roman (Lowercase Roman numerals: i, ii, iii, iv,\ldots), % Roman (Uppercase Roman numerals: I, II, III, IV,\ldots),\newline % alph (Lowercase letters: a, b, c, d,\ldots), % Alph (Uppercase letters: A, B, C, D,\ldots),\newline % fnsymbol (Footnote symbols: $*$, $\dagger $, $\ddagger $, $\mathsection $,\ldots),\newline % gobble (Maybe \verb|\thispagestyle{empty}| is more useful?),\newline % silly (from the \href{https://ctan.org/pkg/sillypage}{\xpackage{sillypage} package}).\bigskip % % This package first started as a revision of the % \xpackage{lastpage} package of \textbf{Jeffrey P. Goldberg} (Thanks!), % but then it was deemed necessary to provide a separate, enhanced package. % After updates of the kernel and the package, % \xpackage{lastpage} now does what it is supposed to do.\bigskip % % Disclaimer for web links: The author is not responsible for any contents % referred to in this work unless he has full knowledge of illegal contents. % If any damage occurs by the use of information presented there, only the % author of the respective pages might be liable, not the one who has referred % to these pages.\pagebreak % % \tableofcontents % \newpage % % \section{Introduction} % This package puts the labels \texttt{LastPage} (|\AddToHook{enddocument/afterlastpage}|, % formerly |\AtEndDocument|; same as the \xpackage{LastPage} package) and \texttt{VeryLastPage} % (also |\AddToHook{enddocument/afterlastpage}|, but formerly |\AfterLastShipout|) into the \xfile{.aux} file, % allowing the user to refer to the last page of a document via |\lastpageref{LastPage}| and % |\lastpageref{VeryLastPage}|. This might be particularly useful in places like headers or footers. % When more than one page numbering scheme is used, these references do not give the total \textit{number} % of pages. For this case the label \texttt{LastPages} is introduced (similar to the label \texttt{TotPages} % of the \xpackage{TotPages} package, but the label \texttt{LastPages} is set later in the document). % Additionally, at the last page of each page numbering scheme a label % \texttt{pagesLTS.<}\textit{numbering scheme}\texttt{>} is placed, % where \texttt{<}\textit{numbering scheme}\texttt{>} is e.\,g. % arabic, roman, Roman, alph, or Alph. For fnsymbol please use % |\lastpageref{pagesLTS.fnsymbol}| instead of |\pageref{pagesLTS.fnsymbol}|. % When the same numbering scheme is used twice, the page numbers are either reset to one % or continued automatically, depending on the option given when the package is called. % The command |\theCurrentPage| prints the current total/absolute page number -- in contrast to |\thepage|, % which gives only the page \textit{name} in the current page numbering scheme. |\theCurrentPageLocal| % gives the current number of pages in the current page numbering scheme. |\thepage| and |\theCurrentPageLocal| % are different e.\,g.~when |\addtocounter{page}{|\ldots|}| or |\setcounter{page}{|\ldots|}| were used. % (See also \LaTeX\ bug~3421: 3rd~page is even (twoside, titlepage, abstract), % \url{https://www.latex-project.org/cgi-bin/ltxbugs2html?category=LaTeX&responsible=anyone&state=anything&keyword=pagenumber&pr=latex%2F3421&search=}.) % At the first page of the document a label \texttt{pagesLTS.0} is created. Also to this label it can be referred. % Further labels are provided for special cases.\bigskip % % The \xpackage{alphalph} package is supported, i.\,e.~page numbers \texttt{alph} or \texttt{Alph} $>26$ % and \texttt{fnsymbol} $>9$ can be used (with the according options set). Even zero or negative page % numbers can be used with \texttt{arabic}, \texttt{alph}, \texttt{Alph}, and \texttt{fnsymbol} % page numbering (with \xpackage{alphalph} package and according options), and zero \texttt{roman} % and \texttt{Roman} pages, too.\bigskip % % Right after |\begin{document}| a |\pagenumbering{|\ldots|}| should be called~-- % with the appropriate argument out of e.\,g.\newline % arabic (Arabic numerals: 1, 2, 3, 4,\ldots),\newline % roman (Lowercase Roman numerals: i, ii, iii, iv,\ldots), % Roman (Uppercase Roman numerals: I, II, III, IV,\ldots),\newline % alph (Lowercase letters: a, b, c, d,\ldots), % Alph (Uppercase letters: A, B, C, D,\ldots),\newline % fnsymbol (Footnote symbols: $*$, $\dagger $, $\ddagger $, $\mathsection $,\ldots),\newline % gobble (Maybe \verb|\thispagestyle{empty}| is more useful?),\newline % silly (from the \href{https://ctan.org/pkg/sillypage}{\xpackage{sillypage} package}).\bigskip % % This package first started as a revision of the % \xpackage{lastpage} package of \textsc{Jeffrey P. Goldberg} (Thanks!), % but then it became obvious that a replacement was needed to accomplish % what this package does.\bigskip % % \textbf{Trademarks} appear throughout this documentation without any trademark symbol; % they are the property of their respective trademark owner. There is no intention of infringement; % the usage is to the benefit of the trademark owner.\bigskip % % \phantomsection % \DescribeMacro{logical page numbers}\label{logical page numbers} % \textbf{Tip}: For the display of the \xfile{pdf}~file use \textbf{logical page numbers} % together with \xpackage{hyperref}! % \begin{description} % \item [-] In Adobe Reader Continuos Release 2024.004.20272 enable:\newline % Edit $>$ Preferences $>$ Categories: Page Display $>$ % Page Content and Information: Use logical page numbers % % \item[-] Use the \xpackage{hyperref} package with option |plainpages=false|\,. % \end{description} % The display will be e.\,g.\ \mbox{\textquotedblleft 7 (7 of 9)\textquotedblright ,} % or, in case of Roman instead of arabic numbers, % \mbox{\textquotedblleft VII (7 of 9)\textquotedblright ,} and when different % page numbers are used (see below) e.\,g.~arabic after 10~Roman pages: % \mbox{\textquotedblleft 17 (27 of 30)\textquotedblright .} % Please try this with the compiled \xpackage{pageslts-example} file! % % \section{Usage} % Just load the package by placing % \begin{quote} % |\usepackage[<|\textit{options}|>]{pageslts}| % \end{quote} % in the preamble of your \LaTeX\ source file and place a |\pagenumbering{...}| with appropriate argument % (e.\,g.~arabic, roman, Roman, fnsymbol, alph, or Alph) % right behind |\begin{document}| (see subsubsection~\ref{sss:nopnc})!\bigskip % % For example for various draft forms it is desirable to have a page reference to the last page, % so that e.\,g.\ page footers can contain something like %\textquotedblleft page \mbox{$N$ of $K$\textquotedblright ,} where $N$~is the current page and % $K$~is the last page. Once the package is loaded, anywhere in the text references can be made % to the labels \texttt{LastPage}, \texttt{VeryLastPage}, and \texttt{LastPages} % (most times with |\pageref{...}|, but more save with |\lastpageref{...}|). % In particular one can use the \xpackage{fancyhdr} (\url{https://ctan.org/pkg/fancyhdr}) or % \xpackage{nccfancyhdr} (\url{https://ctan.org/pkg/nccfancyhdr}) package, or % redefinitions of the page headings and footings to get a reference to the last page.\bigskip % % \DescribeMacro{\pageref*} % \DescribeMacro{\lastpageref*} % If the \xpackage{hyperref} package is used, the references are hyperlinked to their targets. % If these hyperlinks shall be suppressed, |\pageref*{...}| and |\lastpageref*{...}| can be used. % % \subsection{Options} % \DescribeMacro{options} % The \xpackage{pageslts} package takes the following options: % % \subsubsection{pagecontinue\label{sss:pagecontinue}} % \DescribeMacro{pagecontinue} % When option \texttt{pagecontinue=false} is \textbf{not} given (i.\,e.~\texttt{pagecontinue} % or \texttt{pagecontinue=true} or no \texttt{pagecontinue} option at all), at each % |\pagenumbering{...}| command the number of the page will be continued % with the page number following the last page of the same page numbering scheme. For example, % if there are V~Roman pages in the frontmatter, some arabic ones in the mainmatter, and then % Roman ones again in the backmatter, the last ones will start with VI instead of~I again.\bigskip % % If you want to start with I (or i, 1, a, A, *,\ldots ) again, set option % \texttt{pagecontinue=false}. If you want to generally continue the numbers, % but for some page numbering scheme do not want this, use \texttt{pagecontinue=true} % and say |\setcounter{page}{1}| after |\pagenumbering{...}| for that page numbering scheme. % % \subsubsection{alphMult, AlphMulti, fnsymbolmult\label{sss:alphalph}} % The page number printed in % \nolinebreak{\texttt{fnsymbol}\footnote{% % \ensuremath {*},% % \ensuremath {\dagger },% % \ensuremath {\ddagger },% % \ensuremath {\mathsection },% % \ensuremath {\mathparagraph },% % \ensuremath {\delimiter "026B30D },% % \ensuremath {**},% % \ensuremath {\dagger \dagger },% % \ensuremath {\ddagger \ddagger }}} % must be $>0$ and $<10$ and those printed in % \nolinebreak{\texttt{alph}\footnote{a, b, c, d, e, f, g, h,% % i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z}} and % \nolinebreak{\texttt{Alph}\footnote{A, B, C, D, E, F, G, H,% % I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z}} must % be $>0$ and $<27$. After page~Z\quad \LaTeX\ \textit{should} continue with % AA, AB, AC,\ldots\ Some people prefer AA, BB, CC,\ldots, but in hexadecimal it is % $AA_{16}=170_{10}$ and $171_{10}=AB_{16}$, whereas $BB_{16}=187_{10}$. In any way % it should continue at all (maybe even with a user option to choose between the two % continuations), but instead only gives an error:\pagebreak % \begin{verbatim} % LaTeX Error: Counter too large % See the LaTeX manual or LaTeX Companion for explanation. % You've lost some text. Try typing to proceed. % If that doesn't work, type X to quit. % \end{verbatim} % But thanks to the \xpackage{alphalph} package these limitation no longer hold. % With his |\erroralph| command now even negative or zero page % \textquotedblleft numbers\textquotedblright\ are possible.\newline % Nevertheless, some \TeX\ capacity will be exceeded well before the % $2\,147\,483\,647^{\textnormal{th}}$ page.\bigskip % % \DescribeMacro{alphMult} % The string option \texttt{alphMult} takes three values: |ab|, |bb|, |0|: % \begin{description} % \item[ab] After page z, the page \textquotedblleft numbers\textquotedblright\ continue with % aa, ab, ac, ad,\ldots, and before a with 0, -a, -b,\ldots, -z, -aa, \mbox{-ab,\ldots .} % \item[bb] After page z, the page \textquotedblleft numbers\textquotedblright\ continue with % aa, bb, cc, dd,\ldots, and before a with 0, -a, -b,\ldots, -z, -aa, \mbox{-bb,\ldots .} % \item[0] (zero) The \xpackage{pageslts} package does nothing, thus the user is free % to define the page \textquotedblleft numbers\textquotedblright\ after~z and before~a.\newline % (But if the user does not do anything at all, the\newline % \ |LaTeX Error: Counter too large|\newline % will appear again.) % \end{description} % % \DescribeMacro{AlphMulti} % The string option \texttt{AlphMulti} takes three values: |AB|, |BB|, |0|: % \begin{description} % \item[AB] After page Z, the page \textquotedblleft numbers\textquotedblright\ continue with % AA, AB, AC, AD,\ldots, and before A with 0, -A, -B,\ldots, -Z, -AA, \mbox{-AB,\ldots .} % \item[BB] After page Z, the page \textquotedblleft numbers\textquotedblright\ continue with % AA, BB, CC, DD,\ldots, and before A with 0, -A, -B,\ldots, -Z, -AA, \mbox{-BB,\ldots .} % \item[0] (zero) The \xpackage{pageslts} package does nothing, thus the user is free % to define the page \textquotedblleft numbers\textquotedblright\ after~Z and before~A.\newline % (But if the user does not do anything at all, the\newline % \ |LaTeX Error: Counter too large|\newline % will appear again.) % \end{description} % % \DescribeMacro{fnsymbolmult} % When option \texttt{fnsymbolmult=false} is \textbf{not} given % (but \texttt{fnsymbolmult} or \texttt{fnsymbolmult=true} or no \texttt{fnsymbolmult} option % at all), after \mbox{5 (\ensuremath {\mathparagraph })} the page % \textquotedblleft number\textquotedblright\ is continued with the doubled % \textquotedblleft number\textquotedblright{} of the first, second, third,\ldots\ page % (\ensuremath{**}, \ensuremath{\dagger\dagger}, \ensuremath{\ddagger\ddagger}, % \ensuremath{\mathsection\mathsection}, \ensuremath{\mathparagraph\mathparagraph}), % and after the tenth page the \textquotedblleft number\textquotedblright\ is tripled % (\ensuremath{***}, \ensuremath{\dagger\dagger\dagger},\ldots). % Compile the \textsf{pageslts-example.tex} and see the resulting \xfile{pdf} file.\bigskip % % Before \ensuremath{*} (page~1) the page \textquotedblleft numbers\textquotedblright\ are % continued with 0, \ensuremath{-*}, \ensuremath{-\dagger},\ldots, \ensuremath{-\mathparagraph}, % \ensuremath{-**}, \ensuremath{-\dagger\dagger},\ldots\newline % If this is not wanted, set option \texttt{fnsymbolmult=false}, and \xpackage{pageslts} % will do nothing and allow the user to change the page % \textquotedblleft number\textquotedblright . (But if the user does not do anything at all, % the\newline % \ |LaTeX Error: Counter too large|\newline % will appear again.) % % \subsubsection{romanMult, RomanMulti\label{sss:romanMult}} % \DescribeMacro{romanMult} % \DescribeMacro{RomanMulti} % The options \texttt{romanMult(=}\,\texttt{true)} and \texttt{RomanMulti(=}\,\texttt{true)} % expand the |\roman| and |\Roman| page numbering scheme to values below one ($<1$), % i.\,e.~0, -i, -ii, -iii, -iv,\ldots\ and 0, -I, -II, -III, -IV,\ldots, respectively.\newline % Again the \TeX\ capacity will be exceeded well before \mbox{$\pm$ |MAX|\,}% % $ = \pm 2\,147\,483\,647$. If the expansion below~$1$ is not wanted, set options % \texttt{romanMult=false} and/or \texttt{RomanMulti=false}, and \xpackage{pageslts} % will do nothing and allow the user to change the page % \textquotedblleft number\textquotedblright. (But if the user does not do anything at all, % \LaTeX\ will just ignore those values -- not even a warning will be issued!) % % \subsubsection{Arabic page numbers} % \DescribeMacro{Arabic page numbers} % In \LaTeX\ arabic (page) numbers are already possible between |-MAX...MAX|, where % |MAX|\,$ = 2\,147\,483\,647$ (cf.~the \xpackage{alphalph} package), without any expansion necessary. % % \subsection{Labels} % \DescribeMacro{pagesLTS.0} % At the first page a label \texttt{pagesLTS.0} is created. If |\pagenumbering{...}| is used right after % |\begin{document}|, this is much easier for the \xpackage{pageslts} package (and chances for % successful placing of all labels are much higher; \nolinebreak{cf.~subsubsection~\ref{sss:once}).}\bigskip % % \DescribeMacro{LastPage} % |\AddToHook{enddocument/afterlastpage}| (formerly: |\AtEndDocument}| this package defines a label, % \texttt{LastPage}, which the user can refer to with the |\lastpageref{LastPage}| command. % In former times |\pageref{LastPage}| did not work when used together with the \xpackage{hyperref} % package and the |fnsymbol| page numbering scheme. This should work now.\bigskip % % \DescribeMacro{VeryLastPage} % |\AddToHook{enddocument/afterlastpage}| (formerly: |\AfterLastShipout|) the label % \texttt{VeryLastPage} is defined, which the user can also refer to with the % |\lastpageref{VeryLastPage}| command. With the new kernel hooks \texttt{LastPage} % as well as \texttt{VeryLastPage} point to the last page indeed.\bigskip % % \DescribeMacro{LastPages} % \DescribeMacro{page number} % \DescribeMacro{number of pages} % When more than one page numbering scheme is used, neither \texttt{LastPage} nor % \texttt{VeryLastPage} give the total \textbf{number} of pages. For example, for a document % with VI+36 pages, both give \textquotedblleft 36\textquotedblright\ as reference to the last page. % While this is correct, the total number of pages is 42, and this is given by the reference to % \texttt{LastPage\underline{s}}: \nolinebreak{|\lastpageref{LastPage|\underline{|s|}|}|} (note the % \textquotedblleft s\textquotedblright\ at the end). When the page number was manipulated by % |\addtocounter{page}{...}| or |\setcounter{page}{...}|, \texttt{LastPages} ignores this. % (At a page numbering change the page is automatically reset to one (without option % |pagecontinue|). This is done by |\setcounter{page}{1}|, thus this is ignored, too.)\bigskip % % \DescribeMacro{totpages} % |\pageref{totpages}| of the \xpackage{totpages} package is similar to % |\lastpageref{LastPages}|, but while the target for % |\pageref{totpages}| is placed |\AtEndDocument|, the target for % |\lastpageref{LastPages}| is placed in the hook |enddocument/afterlastpage|, % therefore |\lastpageref{LastPages}| is safer to really get the total page number.\bigskip % % \DescribeMacro{\@abspage@last} % Nowadays the kernel provides |\@abspage@last|, which contains the number of pages.\bigskip % % \DescribeMacro{\theCurrentPage} % |\theCurrentPage| gives the current total/absolute page, in contrast to |\thepage|, % which gives only the page \textit{name} in the current page numbering scheme. For example, % when there are Roman VII~pages in the frontmatter and afterwards in the mainmatter you are % at arabic page~9, then |\theCurrentPage| is~16, whereas |\thepage| is~9. When the page % \textquotedblleft number\textquotedblright\ (name) is manipulated by % |\addtocounter{page}{...}| or |\setcounter{page}{...}|, |\theCurrentPage| ignores this. % Because \texttt{CurrentPage} is a normal counter, you can also say e.\,g.~|\Roman{CurrentPage}| % to get the value in Roman page numbering scheme (e.\,g.~VIII for~8).\bigskip % % \phantomsection % \DescribeMacro{\theCurrentPageLocal} % |\theCurrentPageLocal|\label{CurrentPageLocal} gives the current (arabic) % number of pages in the current page numbering scheme. |\thepage| and |\theCurrentPageLocal| % are different e.\,g.~when |\addtocounter{page}{...}| or |\setcounter{page}{...}| were used.\newline % |\theCurrentPageLocal| can be printed in other formats, % e.\,g.~|\roman{pagesLTS.current.local.roman}|, but probably it only makes sense % if page numbering scheme and format are the same, % e.\,g.~|\Roman{pagesLTS.current.local.Roman}| or\newline % |\Alph{pagesLTS.current.local.Alph}|. % \pagebreak % |\arabic{pagesLTS.current.local.|\ldots|}| probably make sense even when combined with % another page numbering scheme. And this is exactly what |\theCurrentPageLocal| does:\newline % |\def\theCurrentPageLocal{\arabic{pagesLTS.current.local.\pagesLTS@pnc}}|.\bigskip % % \DescribeMacro{pagesLTS. page numbering scheme . number } % If you want to refer to the last page of the first, second,\ldots\ use of a % page numbering scheme, you can refer to\linebreak % |pagesLTS..|, e.\,g.~|\lastpageref{pagesLTS.Roman.1}|, % where || is the occurrence of the page numbering scheme. For details please see % page~\pageref{pagesLTS.pnscheme.nr}.\bigskip % % \DescribeMacro{\lastpageref} % In former times for pages with the \texttt{fnsymbol} page numbering scheme, % |\lastpageref{...}| instead of |\pageref{...}| had to be used. % |\lastpageref| can be used for all pages. % % \subsection[\texttt{\textbackslash pagenumbering\{\ldots \}}]{% % \texttt{\textbackslash pagenumbering\{\ldots \}}} % \vspace{-1.8\baselineskip} % \DescribeMacro{\pagenumbering} % \subsubsection{If \texttt{\textbackslash pagenumbering\{\ldots \}} is \textbf{not} used\label{sss:nopnc}} % When the \xpackage{pageslts} package is used, but |\pagenumbering{...}| (with an argument like % arabic, roman, Roman, fnsymbol, alph, or Alph) is not used, there should be no problem, % except that you might need more~(!) compiler runs to get all references right, and some % references might even be missing (see below). The \xpackage{pageslts} package tries to determine % the page numbering scheme at the first shipout, but success is not guaranteed. Thus please use % |\pagenumbering{...}| at the beginning of your document!\newline % Without |\pagenumbering{}| (|| e.\,g.~=~arabic) at the beginning of the document, % the page numbers might be given in arabic \textit{by} (class) \textit{default}, but the % \xpackage{pageslts} package does not know about this without |\pagenumbering{arabic}|.~--\newline % The label \texttt{pagesLTS.0} is created at the first page even if no |\pagenumbering{...}| command % is given. Maybe have a look at the \xfile{.aux} file after compiling your document to detect % further labels (of other packages, too). % % \subsubsection{If \texttt{\textbackslash pagenumbering\{\ldots \}} is used once\label{sss:once}} % \DescribeMacro{pagesLTS.0} % At the first page a label \texttt{pagesLTS.0} is created. If |\pagenumbering{...}| is used % right after |\begin{document}|, this is much easier for the \xpackage{pageslts} package % (and chances for successful placing of all labels are much higher). % % \subsubsection{If \texttt{\textbackslash pagenumbering\{\ldots \}} is used more than once} % Everything from the preceding subsubsections applies and additionally the following:\bigskip % % When different page numbering schemes are used, e.\,g.~Roman numbers for the frontmatter % and arabic numbers for the mainmatter, please use |\pagenumbering{...}| for each of them! % Even if you do this, the reference to neither the label \texttt{LastPage} nor the label % \texttt{VeryLastPage} gives the \textbf{total} number of pages, but only the number of pages % of the last used page numbering scheme (which could be exactly what you want, % e.\,g.~if you want to refer to the last page itself and do not want to give the % total number of pages).\bigskip % % \DescribeMacro{LastPages} % For remediation the label \nolinebreak{\texttt{LastPage}\textbf{\underline{s}}} (with % \textquotedblleft s\textquotedblright{} at its end) is introduced. Please then refer % to this label by |\lastpageref{LastPages}| instead of \texttt{LastPage} or % \texttt{VeryLastPage}.\pagebreak % % \DescribeMacro{pagesLTS.arabic} % \DescribeMacro{pagesLTS.roman} % \DescribeMacro{pagesLTS.Roman} % \DescribeMacro{pagesLTS.alph} % \DescribeMacro{pagesLTS.Alph} % \DescribeMacro{pagesLTS.fnsymbol} % \DescribeMacro{pagesLTS.silly} % \DescribeMacro{pagesLTS.gobble} % Additionally, at the last page of each page numbering scheme a label % \texttt{pagesLTS.} is placed, where % \texttt{} is e.\,g.\ arabic, roman, Roman, alph, % Alph, fnsymbol, silly, gobble,\mbox{\ldots .}\newline % Additional page numbering schemes are unknown for \xpackage{pageslts}, % see \autoref{sec:unknown} \nameref{sec:unknown}. % \vspace{5\baselineskip} % % \subsubsection{If the same \texttt{\textbackslash pagenumbering\{\ldots \}}\ % % scheme is used more than once\label{sss:twice}} % Everything from the preceding subsubsections applies and additionally the following:\bigskip % % \DescribeMacro{pagecontinue} % If the same page numbering scheme is used twice (or even more often) in one document % (e.\,g.\ in the frontmatter Roman: I--V, in the mainmatter arabic: 1--20, and in the % backmatter again Roman: VI--X), the second time it is used, the page numbering is either % continued (option \texttt{pagecontinue} or \texttt{pagecontinue=true} or no option % \texttt{pagecontinue}; the default) or reset to one (option \texttt{pagecontinue=false}). % It is even possible to use a~page numbering scheme more than twice.\bigskip % % \phantomsection % \DescribeMacro{pagesLTS. page numbering scheme . number }\label{pagesLTS.pnscheme.nr} % If you want to refer to the last page of the first, second,\ldots\ use of a % page numbering scheme, page~V in the example above, you can refer to % |pagesLTS..|, e.\,g.~|\lastpageref{pagesLTS.Roman.1}|, % where || is the occurrence of the page numbering scheme.\bigskip % % If you want to refer to the first page of a page numbering scheme, % just place a label there, e.\,g. % \begin{verbatim} %\pagenumbering{Roman} %\section{Section title\label{RomanSection}} %\end{verbatim} % (You know where you use |\pagenumbering{...}| and this is the \xpackage{pageslts} package, % not the \xpackage{firstpage} package).\bigskip % % When you want to give the number of pages of each \textquotedblleft sector\textquotedblright\ of % the page numbering scheme, you can use\newline % \DescribeMacro{pagesLTS. page numbering scheme . number .local.cnt} % |\lastpages{}{}|,\newline % where || is e.\,g.~Roman, arabic,\ldots\ and || the % \textquotedblleft sector\textquotedblright{} number, e.\,g.~|\lastpages{Roman}{2}|.\newline % (Internally, the counter has the format |pagesLTS...local.cnt|.) % % If you used the page numbering scheme Roman for three times, you could say % \begin{verbatim} % Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}\newline % There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline % \lastpages{Roman}{1}~pages in the first Roman sector % (\pageref{Roman} -- \lastpageref{pagesLTS.Roman.1}),\newline % \lastpages{Roman}{2}~pages in the second Roman sector % (\pageref{Roman2} -- \lastpageref{pagesLTS.Roman.2}), and\newline % \lastpages{Roman}{3}~pages in the third Roman sector % (\pageref{Roman3} -- \lastpageref{pagesLTS.Roman.3}. % \end{verbatim}% % to get% % \begin{quote}% % Last Roman page (pagesLTS.Roman): VIII\newline % There are 8 pages with Roman numbers:\newline % 3 pages in the first Roman sector (I -- III),\newline % 4 pages in the second Roman sector (IV -- VII), and\newline % 3 pages in the third Roman sector (VIII -- X). % \end{quote} % (see e.\,g.~the compiled \textsf{pageslts-example} file).\bigskip % % If you want to continue one page numbering scheme, but later on (third use of it, % or for another page numbering scheme) want to reset the page number, % just say |\setcounter{page}{1}| there.\bigskip % % In your document the code % \begin{verbatim} % \makeatletter % \renewcommand{\@evenfoot}% % {\normalsize\slshape DRAFT \today\hfil \upshape page {\thepage} (\theCurrentPage) of\ % % \lastpageref{pagesLTS.Roman} + \lastpageref{pagesLTS.arabic}\ = \lastpageref{LastPages} pages% % } % \renewcommand{\@oddfoot}{\@evenfoot} % \makeatother %\end{verbatim} % creates footers like\bigskip % % \textquotedblleft\mbox{\textsl{DRAFT \today}\hspace{1cm}page V (5) of VII + 35 = 42 pages}\textquotedblright\bigskip % % or\bigskip % % \textquotedblleft\mbox{\textsl{DRAFT \today}\hspace{1cm}page 10 (17) of VII + 35 = 42 pages}\textquotedblright\bigskip % % in the compiled document (cf.~the \texttt{pageslts-example} file).\bigskip % % Code like % \begin{verbatim} % This book has \lastpageref{pagesLTS.Roman}+\lastpageref{pagesLTS.arabic} pages % % (\lastpageref{LastPages} pages in total). %\end{verbatim} % produces output like % \begin{quote} % This book has X+85 pages (95 pages in total). % \end{quote} % (when using the \xpackage{hyperref} package, the references are even hyperlinked).\bigskip % % If |\addtocounter{page}{...}| or |\setcounter{page}{...}| have been used, the local version of % \texttt{CurrentPage} can be used, |\theCurrentPageLocal|, see subsection~\ref{CurrentPageLocal}.\bigskip % % \subsection{\xpackage{papermas}(s) package\label{ss:papermas}} % There is a kind of an add-on to this package, the \xpackage{papermas} package, % which can be used to compute the number of sheets of paper needed to print a document % (you can print more than one page of a document on one sheet of paper) as well as the % approximate mass of the printout. \url{https://ctan.org/pkg/papermas} % % \section{A few warnings\label{sec:warn}} % \subsection{Hyperref and repeated page numbers} % When two (or more) different page numbering schemes are used, or the page number is reset, % or for any other reason there are two pages with the same number (maybe in different format, % e.\,g.~$1$ and \textsc{I}), and \xpackage{hyperref} has not been configured right, % this can cause problems. Use \xpackage{hyperref} with \texttt{plainpages=false} and % \texttt{pdfpagelabels=true}, and everything should be fine. More details can be found at % \url{https://texfaq.org/FAQ-pdfpagelabels}. % % \subsection{\xpackage{showkeys} package\label{ssec:showkeys}} % When the \xpackage{showkeys} package has been loaded in \texttt{draft} mode, % in the margin for each label a~box is displayed with the name of the label. % \xpackage{showkeys} accomplishes this by redefining |\label|, but % \xpackage{pageslts} does not always use |\label|, but sometimes writes directly into % the {\nobreak |\jobname|\xfile{.aux}-}\allowbreak file, and this is generally done % \emph{after} the according page has shipped out, therefore no box can be placed % on the \emph{preceding} page. At~least \xpackage{pageslts} gives a warning, that % \xpackage{showkeys} cannot present the respective label. % % \subsection{\xpackage{lastpage} package\label{ssec:lastpage}} % This package first started as a revision of the \xpackage{lastpage} package of % \textsc{Jeffrey P. Goldberg} (jeffrey+news at goldmark dot org), but then I deemed % a replacement necessary to accomplish what this package does. For backward compatibility, % a~label named |LastPage| is provided. Thus |\usepackage{lastpage}| can be replaced by\newline % |\usepackage[pagecontinue=false,alphMult=0,AlphMulti=0,fnsymbolmult=false,romanMult=false,RomanMulti=false%|% % \linebreak{}| ]{pageslts}|,\newline % if the behaviour of the \xpackage{lastpage} package should be simulated. % It is also possible to load both packages (if recent versions are used). % % \subsection{Using an unknown page numbering scheme\label{sec:unknown}} % While at the time of the latest revision of the \xpackage{pageslts} package % no other page numbering schemes (e.\,g.~Greek, Hebraic) were known to the maintainer, % this package in principle works with every scheme which is recognized by the original % |\pagenumbering| command. But the \xpackage{hyperref} package only then works with % special page names, if the references to those pages are given in a certain way, % thus the combination of a new page numbering scheme, the \xpackage{hyperref} and the % \xpackage{pageslts} package might not work.~-- % The \xpackage{pageslts} package by itself also works with schemes, which the original % |\pagenumbering{...}| does not recognize, but because the original % |\pagenumbering{...}| is called by the \xpackage{pageslts} package, this might cause % an error. Especially if the last page uses this new page numbering scheme, % you should check everything double (at least).\newline % And if the number format is unknown to \LaTeX , the pages will have no number, and % therefore cannot be referenced. You might be able to help yourself by using the % \xpackage{hyperref} package and manually placing |\phantomsectin|\,s and % \nolinebreak{|\label{|\ldots|}|\,s} or even |\hypertarget|\,s and % \nolinebreak{|\href|\,s.}\pagebreak % % \subsection{Page counter overflow\label{ss:overflow}} % \underline{\textbf{WITHOUT~(!)}} the use of the \xpackage{alphalph} package, the\\[0.6ex] % \textquotedblleft ranges of supported counter values are more or less restricted. % Only \cs{arabic} can be used with any counter value \TeX\ supports. % \begin{quote} % \catcode`\|=12 % % \begin{tabular}{@{}l|l|l|l@{}} % Presentation & Supported & Ignored & Error message\\ % command & domain & values & `Counter too large'\\ % \hline % \cs{arabic} % & \ttfamily -MAX..MAX & &\\ % \cs{roman}, \cs{Roman} % & \ttfamily 1..MAX & \ttfamily -MAX..0 &\\ % \cs{alph}, \cs{Alph} % & \ttfamily 1..26 & 0 & \ttfamily -MAX..-1, 27..MAX\\ % \cs{fnsymbol} % & \ttfamily 1..9 & 0 & \ttfamily -MAX..-1, 10..MAX\\ % \hline % \end{tabular}\\[1ex] % \texttt{MAX} = \texttt{2147483647} % \end{quote} % \textquotedblright\ (\xpackage{alphalph} package manual, 2019/12/09, v2.6, % first table, p.~2).\newline % Please see subsubsections~\ref{sss:alphalph} and \ref{sss:romanMult} for % instructions how to overcome these limitations -- except \mbox{$\pm$MAX:} % When this is exceeded via % |\setcounter{}{| something greater than MAX (or smaller then $-$MAX) |}|, % then the error % \begin{quote} % \begin{verbatim} % ! Number too big. % I can only go up to 2147483647='17777777777="7FFFFFFF, % so I'm using that number instead of yours. % \end{verbatim} % \end{quote} % \vspace{-\baselineskip} % will arise. But if the counter has a value of $2\,147\,483\,647 = {}$MAX, % and |\addtocounter{}{+1}| is tried, no error is issued, but % |\arabic{}| prints $-2147483648$, and further |\addtocounter{}{+1}|s % give $-2147483647$, $-2147483646$ and so on.\newline % For a counter value of $-2\,147\,483\,647 = -$MAX and |\addtocounter{}{-1}|s % after $-2147483647$ it is printed $-2147483648$, $2147483647$, $2147483646$ and so on % (without any message in the \xfile{log} file about any possible issue). % \newpage % % \section{Alternatives\label{sec:Alternatives}} % There are similar packages, which do (or do not) similar things. % As I neither know what exactly you want to accomplish when using this package % (e.\,g.~page number vs. page name, hyperlinks or not), nor what resources % your system has (e.\,g.~\TeX, \LaTeX2e, $\varepsilon$-\TeX{}, \LaTeX-format as recent % as 2024-06-01 or newer), here is a list of some possible alternatives: % \begin{description} % \item[-]\DescribeMacro{LaTeX-kernel} % The number of pages is nowadays available via |\@abspage@last|, % |\thetotalpages|, and |\PreviousTotalPages| from the kernel, % but when more than one page numbering scheme is used % (for example pages I~to X and then 1~to 10, thus number of pages % \hbox{\textquotedblleft 20\textquotedblright ,} but name of the last page % \hbox{\textquotedblleft 10\textquotedblright ),} % or when or the fnsymbol page numbering scheme is used, or another package % has output after this package, or the page numbers exceed a certain range, % there might be issues. (Is the total number of pages wanted? Or is the name % of the last page sought?)\newline % |\the\ReadonlyShipoutCounter| contains the number of currently shipped out pages, % i.\,e.~current page minus one. % % \item[-]\DescribeMacro{LastPage} % The \xpackage{lastpage} package also provides the \texttt{LastPage} label % (but not \texttt{VeryLastPage} or \texttt{LastPages}). If you only want this and/or % have a quite limited amount of \TeX\ resources, you might want to use that package instead. % It includes versions for older \LaTeX-kernels and even for \mbox{\LaTeX2.09{}.}\newline % \url{https://ctan.org/pkg/lastpage} % % \item[-]\DescribeMacro{totpages} % The \xpackage{totpages} package provides a \texttt{totpages} label similar to % \texttt{LastPages}, but |\AtEndDocument| instead of hook |enddocument/|\linebreak |afterlastpage|. % Therefore you should stay with \xpackage{pageslts}. % The \xpackage{totpages} package additionally computes the number of paper sheets % needed to (double) print the document (with one, two, three,\ldots{} pages on % one sheet of paper) (which can be achieved also with the \xpackage{papermas} package % (see \autoref{ss:papermas}).\newline % \url{https://ctan.org/pkg/totpages} % % \item[-]\DescribeMacro{totalcount} % The \xpackage{totalcount} package provides |\totalpages|. % If there are only arabic page numbers consecutively running from 1 to the last page, % this works. But for example % % \begin{quote} %\begin{verbatim} %\documentclass{article} %\usepackage[page]{totalcount} %\pagenumbering{Roman} %\begin{document} %\addtocounter{page}{49} %Page \thepage{} of \totalpages %\end{document} %\end{verbatim} % \end{quote} % % prints \textquotedblleft Page L of 50\textquotedblright, % where the number of pages is one (and no hyperlink is provided to the % last page even if \xpackage{hyperref} is used).\newline % \url{https://ctan.org/pkg/totalcount} % % \item[-]\DescribeMacro{totcount} % The \xpackage{totcount} package provides the last value of a counter, thus also the value % of the \texttt{page} counter. You do not get a hyperlink to the last page, only the numerical % value of the last page name is given \mbox{(i.\,e.~X+72} pages gives 72 instead of 82 % as total number of pages), and the number of pages can be changed for example % by |\addtocounter|.\newline % \url{https://ctan.org/pkg/totcount} % % \item[-]\DescribeMacro{nofm} % \textquotedblleft There is a package \xpackage{nofm.sty} available, but some versions % of it are defective, and most don't work with \xpackage{fancyhdr} because they take over % the complete page layout.\textquotedblright{} (\textsc{Piet van Oostrum}: % Page layout in \LaTeX , March~2, 2004, section~16; fancyhdr.pdf)\newline % \xpackage{nofm} as of 1991/02/25 (without version number), available at\newline % \url{https://mirror.ctan.org/obsolete/macros/latex209/contrib/misc/nofm.sty},\newline % does not work with e.\,g.~\xpackage{hyperref}, redefines |\enddocument| % as well as |\@oddhead|, |\@evenhead|, |\@oddfoot|, and |\@evenfoot|.\newline % If you know the (\url{https://CTAN.org}) location of a % \textbf{working}~(!) version, please send me an e-mail, thanks! % % \item[-]\DescribeMacro{count1to} % The \xpackage{count1to} package \textquotedblleft sets |\count1| to |\count8| % with the values of page to subparagraph. |\count9| is used to flag odd % pages. \ldots\ [T]he code for the TotalPages % label\textquotedblright\ (package manual, 2024-06-13) has been removed % from the current package version.\newline % \url{https://ctan.org/pkg/count1to} % % \item[-]\DescribeMacro{zref} % The \xpackage{zref} package \textquotedblleft implements an extensible referencing % system\textquotedblright\ (package manual, 2023-09-14).\newline % \url{https://ctan.org/pkg/zref} % % \item[-]\DescribeMacro{memoir} % The \xpackage{memoir} \emph{class} provides |\thelastpage| (page number printed % on last page) and |\thelastsheet| (number of pages). % \end{description} % % \bigskip % % \noindent (You programmed or found another alternative, % which is available at \url{https://CTAN.org}?\newline % OK, send an e-mail to me with the name, location at CTAN, % and a short notice, and I will probably include it in the list above.) % \newpage % % \section{Example} % \begin{macrocode} %<*example> \documentclass[british]{article}[2024/06/29]% v1.4n \usepackage{lipsum}[2021-09-20]% v2.7 \usepackage[draft]{showkeys}[2024/05/23]% v3.21 %% Use final instead of draft to hide the keys. %% \usepackage[pdfpagelabels=true,hyperindex=false]{hyperref}[2024-11-05]% v7.01l \makeatletter \@ifpackageloaded{hyperref}{% Hypertext links for LaTeX \hypersetup{extension=pdf,% plainpages=false,% pdflang={en},% pdftitle={pageslts package example},% pdfauthor={H.-Martin Muench},% pdfsubject={Example for the pageslts package},% pdfkeywords={LaTeX, pageslts},% pdfview=Fit,% pdfstartview=Fit,% pdfpagelayout=SinglePage,% bookmarksopen=true% }}{\usepackage{url}[2013/09/16]}% v3.4 \makeatother \usepackage[pagecontinue=true,alphMult=ab,AlphMulti=AB,fnsymbolmult=true,% romanMult=true,RomanMulti=true]{pageslts}[2024-12-23]% v2.0c %% These are the default options. %% \makeatletter \renewcommand{\@evenfoot}% {Page \thepage\ (\theCurrentPage; local: \theCurrentPageLocal) of % \lastpageref{pagesLTS.roman}(\lastpageref{pagesLTS.roman.local}) + % \ifpagesLTS@pagecontinue% \lastpageref{pagesLTS.Roman}(\lastpageref{pagesLTS.Roman.local}) % \else% \{\lastpageref{pagesLTS.Roman.1}% +\lastpageref{pagesLTS.Roman.2}% +\lastpageref{pagesLTS.Roman.3}% (\lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=% \the\numexpr% \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax)\} % \fi + % \lastpageref{pagesLTS.arabic}(\lastpageref{pagesLTS.arabic.local}) + % \lastpageref{pagesLTS.fnsymbol}(\lastpageref{pagesLTS.fnsymbol.local}) + % \lastpageref{pagesLTS.alph}(\lastpageref{pagesLTS.alph.local}) + % \lastpageref{pagesLTS.gobble}(\lastpageref{pagesLTS.gobble.local}) + % \lastpageref{pagesLTS.Alph}(\lastpageref{pagesLTS.Alph.local}) = % \lastpageref{LastPages} pages.% } \renewcommand{\@oddfoot}{\@evenfoot} \def\pagesLTSexampleArabic{3} \def\pagesLTSexamplealph{23} \makeatother \setlength{\parindent}{0pt} \listfiles \begin{document} \pagenumbering{roman} %% Note the first \pagenumbering immediately behind \begin{document}! %% %%\addtocounter{page}{-2} %% \section*{Example for pageslts} \addcontentsline{toc}{section}{Example for pageslts} \markboth{Example for pageslts}{Example for pageslts} This example demonstrates the most common uses of package\newline \textsf{pageslts}, v2.0c as of 2024-12-23 (HMM);\newline \url{https://ctan.org/pkg/pageslts}.\bigskip The used options were \texttt{pagecontinue=true}, \texttt{alphMult=ab}, \texttt{AlphMulti=AB}, \linebreak \texttt{fnsymbolmult=true}, \texttt{romanMult=true}, and \texttt{RomanMulti=true} (the default\linebreak ones).~-- For more details please see the documentation!\bigskip \label{keys} To hide the \pageref{keys}{\qquad } use option \texttt{final} instead of \texttt{draft} with the \textsf{showkeys} package (or remove the package call from the preamble of this document).\bigskip \textbf{Hyperlinks or not:} If the \textsf{hyperref} package is loaded, the references are also hyperlinked:\bigskip \smallskip Page \thepage\ (\theCurrentPage; local: \theCurrentPageLocal) of % \lastpageref{pagesLTS.roman}(\lastpageref{pagesLTS.roman.local}) + % \makeatletter% \ifpagesLTS@pagecontinue% \lastpageref{pagesLTS.Roman}(\lastpageref{pagesLTS.Roman.local}) % \else% \{\lastpageref{pagesLTS.Roman.1}% +\lastpageref{pagesLTS.Roman.2}% +\lastpageref{pagesLTS.Roman.3}% (\lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=% \the\numexpr% \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax)\} % \fi + % \makeatother% \lastpageref{pagesLTS.arabic}(\lastpageref{pagesLTS.arabic.local}) + % \lastpageref{pagesLTS.fnsymbol}(\lastpageref{pagesLTS.fnsymbol.local}) + % \lastpageref{pagesLTS.alph}(\lastpageref{pagesLTS.alph.local}) + % \lastpageref{pagesLTS.Alph}(\lastpageref{pagesLTS.Alph.local}) = % \lastpageref{LastPages} pages.\bigskip If the \textsf{hyperref} package is loaded, but the hyperlinks of the references shall be suppressed, \verb|\pageref*{...}| and \verb|\lastpageref*{...}| can be used:\\[0.5\baselineskip] Page \thepage\ (\theCurrentPage; local: \theCurrentPageLocal) of % \lastpageref*{pagesLTS.roman}(\lastpageref*{pagesLTS.roman.local}) + % \makeatletter% \ifpagesLTS@pagecontinue% \lastpageref*{pagesLTS.Roman}(\lastpageref*{pagesLTS.Roman.local}) % \else% \{\lastpageref*{pagesLTS.Roman.1}% +\lastpageref*{pagesLTS.Roman.2}% +\lastpageref*{pagesLTS.Roman.3}% (\lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=% \the\numexpr% \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax)\} % \fi + % \makeatother% \lastpageref*{pagesLTS.arabic}(\lastpageref*{pagesLTS.arabic.local}) + % \lastpageref*{pagesLTS.fnsymbol}(\lastpageref*{pagesLTS.fnsymbol.local}) + % \lastpageref*{pagesLTS.alph}(\lastpageref*{pagesLTS.alph.local}) + % \lastpageref*{pagesLTS.Alph}(\lastpageref*{pagesLTS.Alph.local}) = % \lastpageref*{LastPages} pages.\bigskip \textbf{Trademarks} appear throughout this example without any trademark symbol; they are the property of their respective trademark owner. There is no intention of infringement; the usage is to the benefit of the trademark owner.\bigskip \textbf{Tip}: Use \textit{logical page numbers} for the display of the pdf (in Adobe Reader Continuos Release 2024.004.20272:\newline Edit $>$ Preferences $>$ Categories: Page Display $>$ Page Content and Information: Use logical page numbers)!\bigskip You want negative page numbers? Not only arabic, but even roman, Roman, alph, Alph or fnsymbol ones? No problem, e.\,g.~just give a\newline \verb|\addtocounter{page}{|-\textit{some number}\verb|}| in the source code of this example file (or uncomment the prepared line)! \newpage \tableofcontents \newpage% \makeatletter% \def\pagesLTS@tmpC{roman}% \ifx\pagesLTS@pnc\pagesLTS@tmpC% \else\pagenumbering{roman}% %% in case the page numbering is changed before, %% otherwise pagesLTS.current.local.roman on this page would be undefined \fi% \makeatother% \section{roman} (\texttt{roman} page numbering was started before, because the page numbering scheme was needed to start at the first page, of course.)\bigskip First page (\verb|\lastpageref{pagesLTS.0}|): \lastpageref{pagesLTS.0}\bigskip The page (\verb|\thepage|): \thepage \bigskip Current page (\verb|\theCurrentPage|), i.\,e.~counted continuously from the first\linebreak page):~\theCurrentPage \bigskip You can get this also in other formats: \roman{CurrentPage}, \Roman{CurrentPage}, \arabic{CurrentPage}, \fnsymbol{CurrentPage}, \alph{CurrentPage}, \Alph{CurrentPage}. CurrentPageLocal (\verb|\theCurrentPageLocal|), i.\,e.~counted continuously from the first page of the current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal\newline You can get also this in other formats, too: \roman{pagesLTS.current.local.roman}, \Roman{pagesLTS.current.local.roman}, \arabic{pagesLTS.current.local.roman}, \fnsymbol{pagesLTS.current.local.roman}, \alph{pagesLTS.current.local.roman}, \Alph{pagesLTS.current.local.roman}, but probably it only makes sense if page numbering scheme and format are the same, e.\,g.\newline \verb|\Roman{pagesLTS.current.local.Roman}|\newline or \verb|\Alph{pagesLTS.current.local.Alph}|. \verb|\arabic{...}| could make sense even if combined with another page numbering scheme. And this is exactly what \verb|\theCurrentPageLocal| does:\newline \nolinebreak{\verb|\def\theCurrentPageLocal{\arabic{pagesLTS.current.local.\pagesLTS@pnc}}|.}\bigskip Last roman page (pagesLTS.roman): \lastpageref{pagesLTS.roman}{\hskip4em } (There are \lastpageref{pagesLTS.roman.local} pages with roman numbers.)\bigskip Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}{\hskip3em }% \makeatletter% \ifpagesLTS@pagecontinue% (There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline \else% (There are % \lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=% \the\numexpr% \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax~pages with Roman numbers:\newline \fi% \makeatother% \lastpages{Roman}{1}~pages in the first Roman sector (\pageref{Roman}{\hskip3em }-\lastpageref{pagesLTS.Roman.1}{\hskip3em }),\newline \lastpages{Roman}{2}~pages in the second Roman sector (\pageref{Roman2}{\hskip3em }-\lastpageref{pagesLTS.Roman.2}{\hskip3em }), and\newline \lastpages{Roman}{3}~pages in the third Roman sector (\pageref{Roman3}{\hskip3em }-\lastpageref{pagesLTS.Roman.3}{\hskip3em }).)\bigskip When the option \texttt{pagecontinue=false} is used with the \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will point to the same page as before, but this will have a lower number. And if that page number was also present in a preceding sector, the link will go to that page. (Several pages with the same number\ldots)\newline The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number of pages in the last sector. To get the total number of Roman pages, % \begin{verbatim} \the\numexpr \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax% \end{verbatim}% would be necessary.\bigskip Last arabic page (pagesLTS.arabic): \lastpageref{pagesLTS.arabic}{\hskip5em } (There are only \lastpageref{pagesLTS.arabic.local} pages with arabic numbers, because an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| was used.)\bigskip Last fnsymbol page (pagesLTS.fnsymbol): \lastpageref{pagesLTS.fnsymbol}\newline (better \verb|\lastpageref{pagesLTS.fnsymbol}| than just\newline \verb|\pageref{pagesLTS.fnsymbol}|!)\newline (There are \lastpageref{pagesLTS.fnsymbol.local} pages with fnsymbol numbers.)\bigskip Last alph page (pagesLTS.alph): \lastpageref{pagesLTS.alph}{\hskip4em } (There are only \lastpageref{pagesLTS.alph.local} pages with alph numbers, because an \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}| was used.)\bigskip Last Alph page (pagesLTS.Alph): \lastpageref{pagesLTS.Alph}{\hskip4em } (There are \lastpageref{pagesLTS.Alph.local} pages with Alph numbers.)\bigskip Last page's \textit{name} (LastPage): \lastpageref{LastPage}\bigskip Very last page's \textit{name} (VeryLastPage): \lastpageref{VeryLastPage}\newline (\texttt{LastPage} and \texttt{VeryLastPage} are now identical, because both are now done \verb|\AddToHook{enddocument/afterlastpage}| instead of formerly\newline \verb|\AtEndDocument| and \verb|\AfterLastShipout|, which were different.)\bigskip Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em } (=~total number of pages) \newpage \pagenumbering{Roman} \section{Roman\label{Roman}} \subsection{Common Roman page numbering} First page (\verb|\lastpageref{pagesLTS.0}|): \lastpageref{pagesLTS.0}\bigskip The page (\verb|\thepage|): \thepage\bigskip Current page (\verb|\theCurrentPage|), i.\,e.~counted continuously from the first page): \theCurrentPage\bigskip CurrentPageLocal (\verb|\theCurrentPageLocal|), i.\,e.~counted continuously from the first page of the current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip Last roman page (pagesLTS.roman): \lastpageref{pagesLTS.roman}{\hskip4em } (There are \lastpageref{pagesLTS.roman.local} pages with roman numbers.)\bigskip Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}{\hskip3em }% \makeatletter% \ifpagesLTS@pagecontinue% (There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline \else% (There are % \lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=% \the\numexpr% \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax~pages with Roman numbers:\newline \fi% \makeatother% \lastpages{Roman}{1}~pages in the first Roman sector (\pageref{Roman}{\hskip3em }-\lastpageref{pagesLTS.Roman.1}{\hskip3em }),\newline \lastpages{Roman}{2}~pages in the second Roman sector (\pageref{Roman2}{\hskip3em }-\lastpageref{pagesLTS.Roman.2}{\hskip3em }), and\newline \lastpages{Roman}{3}~pages in the third Roman sector (\pageref{Roman3}{\hskip3em }-\lastpageref{pagesLTS.Roman.3}{\hskip3em }).)\bigskip When the option \texttt{pagecontinue=false} is used with the \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will point to the same page as before, but this will have a lower number. And if that page number was also present in a preceding sector, the link will go to that page. (Several pages with the same number\ldots)\newline The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number of pages in the last sector. To get the total number of Roman pages, % \begin{verbatim} \the\numexpr \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax% \end{verbatim}% would be necessary. \pagebreak Last arabic page (pagesLTS.arabic): \lastpageref{pagesLTS.arabic}{\hskip5em } (There are only \lastpageref{pagesLTS.arabic.local} pages with arabic numbers, because an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| was used.)\bigskip Last fnsymbol page (pagesLTS.fnsymbol): \lastpageref{pagesLTS.fnsymbol}\newline (better \verb|\lastpageref{pagesLTS.fnsymbol}| than just\newline \verb|\pageref{pagesLTS.fnsymbol}|!)\bigskip (There are \lastpageref{pagesLTS.fnsymbol.local} pages with fnsymbol numbers.)\bigskip Last alph page (pagesLTS.alph): \lastpageref{pagesLTS.alph}{\hskip4em } (There are only \lastpageref{pagesLTS.alph.local} pages with alph numbers, because an \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}| was used.)\bigskip Last Alph page (pagesLTS.Alph): \lastpageref{pagesLTS.Alph}{\hskip4em } (There are \lastpageref{pagesLTS.Alph.local} pages with Alph numbers.)\bigskip Last page's \textit{name} (LastPage): \lastpageref{LastPage}\bigskip Very last page's \textit{name} (VeryLastPage): \lastpageref{VeryLastPage}\newline (\texttt{LastPage} and \texttt{VeryLastPage} are now identical, because both are now done \verb|\AddToHook{enddocument/afterlastpage}| instead of formerly\newline \verb|\AtEndDocument| and \verb|\AfterLastShipout|, which were different.)\bigskip Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em } (=~total number of pages) \newpage \subsection{Last page of first Roman sector} \verb|\lastpageref{pagesLTS.Roman}| does \textbf{not} refer to this page (but there: \lastpageref{pagesLTS.Roman}). When a reference to this page is wanted,\newline \verb|\lastpageref{pagesLTS.Roman.1}| can be used: \lastpageref{pagesLTS.Roman.1}.\bigskip There are \lastpages{Roman}{1}~pages (\verb|\lastpages{Roman}{1}|) in this first Roman sector.\newline The Roman page numbering scheme is continued later in section~\ref{Roman2})! \newpage \pagenumbering{arabic} \section{arabic} \subsection{Standard page numbering} First page (\verb|\lastpageref{pagesLTS.0}|): \lastpageref{pagesLTS.0}\bigskip The page (\verb|\thepage|): \thepage \bigskip Current page (\verb|\theCurrentPage|), i.\,e.~counted continuously from the first page): \theCurrentPage \bigskip CurrentPageLocal (\verb|\theCurrentPageLocal|), i.\,e.~counted continuously from the first page of the current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip Last roman page (pagesLTS.roman): \lastpageref{pagesLTS.roman}{\hskip4em } (There are \lastpageref{pagesLTS.roman.local} pages with roman numbers.)\bigskip Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}{\hskip3em }% \makeatletter% \ifpagesLTS@pagecontinue% (There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline \else% (There are % \lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=% \the\numexpr% \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax~pages with Roman numbers:\newline \fi% \makeatother% \lastpages{Roman}{1}~pages in the first Roman sector (\pageref{Roman}{\hskip3em }-\lastpageref{pagesLTS.Roman.1}{\hskip3em }),\newline \lastpages{Roman}{2}~pages in the second Roman sector (\pageref{Roman2}{\hskip3em }-\lastpageref{pagesLTS.Roman.2}{\hskip3em }), and\newline \lastpages{Roman}{3}~pages in the third Roman sector (\pageref{Roman3}{\hskip3em }-\lastpageref{pagesLTS.Roman.3}{\hskip3em }).)\bigskip When the option \texttt{pagecontinue=false} is used with the \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will point to the same page as before, but this will have a lower number. And if that page number was also present in a preceding sector, the link will go to that page. (Several pages with the same number\ldots)\newline The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number of pages in the last sector. To get the total number of Roman pages, % \begin{verbatim} \the\numexpr \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax% \end{verbatim}% would be necessary. \pagebreak Last arabic page (pagesLTS.arabic): \lastpageref{pagesLTS.arabic}{\hskip5em } (There are only \lastpageref{pagesLTS.arabic.local} pages with arabic numbers, because an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| was used.)\bigskip Last fnsymbol page (pagesLTS.fnsymbol): \lastpageref{pagesLTS.fnsymbol}\newline (better \verb|\lastpageref{pagesLTS.fnsymbol}| than just\newline \verb|\pageref{pagesLTS.fnsymbol}|!)\bigskip (There are \lastpageref{pagesLTS.fnsymbol.local} pages with fnsymbol numbers.)\bigskip Last alph page (pagesLTS.alph): \lastpageref{pagesLTS.alph}{\hskip4em } (There are only \lastpageref{pagesLTS.alph.local} pages with alph numbers, because an \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}| was used.)\bigskip Last Alph page (pagesLTS.Alph): \lastpageref{pagesLTS.Alph}{\hskip4em } (There are \lastpageref{pagesLTS.Alph.local} pages with Alph numbers.)\bigskip Last page's \textit{name} (LastPage): \lastpageref{LastPage}\bigskip Very last page's \textit{name} (VeryLastPage): \lastpageref{VeryLastPage}\newline (\texttt{LastPage} and \texttt{VeryLastPage} are now identical, because both are now done \verb|\AddToHook{enddocument/afterlastpage}| instead of formerly\newline \verb|\AtEndDocument| and \verb|\AfterLastShipout|, which were different.)\bigskip Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em } (=~total number of pages) \newpage \thispagestyle{empty} \subsection[Empty page style]{Also an empty page style is no problem % for the current or total page count} \bigskip First page (\verb|\lastpageref{pagesLTS.0}|): \lastpageref{pagesLTS.0}\bigskip The page (\verb|\thepage|): \thepage \bigskip Current page (\verb|\theCurrentPage|), i.\,e.~counted continuously from the first page): \theCurrentPage \bigskip CurrentPageLocal (\verb|\theCurrentPageLocal|), i.\,e.~counted continuously from the first page of the current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip Last roman page (pagesLTS.roman): \lastpageref{pagesLTS.roman}{\hskip4em } (There are \lastpageref{pagesLTS.roman.local} pages with roman numbers.)\bigskip Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}{\hskip3em }% \makeatletter% \ifpagesLTS@pagecontinue% (There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline \else% (There are % \lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=% \the\numexpr% \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax~pages with Roman numbers:\newline \fi% \makeatother% \lastpages{Roman}{1}~pages in the first Roman sector (\pageref{Roman}{\hskip3em }-\lastpageref{pagesLTS.Roman.1}{\hskip3em }),\newline \lastpages{Roman}{2}~pages in the second Roman sector (\pageref{Roman2}{\hskip3em }-\lastpageref{pagesLTS.Roman.2}{\hskip3em }), and\newline \lastpages{Roman}{3}~pages in the third Roman sector (\pageref{Roman3}{\hskip3em }-\lastpageref{pagesLTS.Roman.3}{\hskip3em }).)\newline When the option \texttt{pagecontinue=false} is used with the \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will point to the same page as before, but this will have a lower number. And if that page number was also present in a preceding sector, the link will go to that page. (Several pages with the same number\ldots)\newline The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number of pages in the last sector. To get the total number of Roman pages, % \begin{verbatim} \the\numexpr \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax% \end{verbatim}% would be necessary. \pagebreak Last arabic page (pagesLTS.arabic): \lastpageref{pagesLTS.arabic}{\hskip5em } (There are only \lastpageref{pagesLTS.arabic.local} pages with arabic numbers, because an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| was used.)\bigskip Last fnsymbol page (pagesLTS.fnsymbol): \lastpageref{pagesLTS.fnsymbol}\newline (better \verb|\lastpageref{pagesLTS.fnsymbol}| than just\newline \verb|\pageref{pagesLTS.fnsymbol}|!)\bigskip (There are \lastpageref{pagesLTS.fnsymbol.local} pages with fnsymbol numbers.)\bigskip Last alph page (pagesLTS.alph): \lastpageref{pagesLTS.alph}{\hskip4em } (There are only \lastpageref{pagesLTS.alph.local} pages with alph numbers, because an \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}| was used.)\bigskip Last Alph page (pagesLTS.Alph): \lastpageref{pagesLTS.Alph}{\hskip4em } (There are \lastpageref{pagesLTS.Alph.local} pages with Alph numbers.)\bigskip Last page's \textit{name} (LastPage): \lastpageref{LastPage}\bigskip Very last page's \textit{name} (VeryLastPage): \lastpageref{VeryLastPage}\newline (\texttt{LastPage} and \texttt{VeryLastPage} are now identical, because both are now done \verb|\AddToHook{enddocument/afterlastpage}| instead of formerly\newline \verb|\AtEndDocument| and \verb|\AfterLastShipout|, which were different.)\bigskip Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em } (=~total number of pages) \newpage \subsection[addtocounter, setcounter]{Neither % \texttt{\textbackslash addtocounter\{page\}} nor % \texttt{\textbackslash setcounter\{page\}} is a problem for the % current or total page numbers} (Here is an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| in the source code.) \addtocounter{page}{\pagesLTSexampleArabic}\bigskip The page (from \verb|\thepage| command): \thepage \bigskip Current page (from \verb|\theCurrentPage|\ % command), i.\,e.~counted continuously from the first page): \theCurrentPage \bigskip CurrentPageLocal (from \verb|\theCurrentPageLocal|\ % command), i.\,e.~counted continuously from the first page of the current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip Last page's number (LastPages): \lastpageref{LastPages}{\hskip3em } (= total number of pages) \newpage \pagenumbering{fnsymbol} \section{fnsymbol} Without option \texttt{fnsymbolmult=true} of the \textsf{pageslts} package (and the help of the \textsf{alphalph} package), after page~9 (\textquotedblleft \ensuremath {\ddagger \ddagger }\textquotedblright ) (and also for negative page numbers) there would just appear a \begin{quote} \begin{verbatim} LaTeX Error: Counter too large See the LaTeX manual or LaTeX Companion for explanation. You've lost some text. Try typing to proceed. If that doesn't work, type X to quit. \end{verbatim} \end{quote} Now the page numbers after 5 (\ensuremath {\mathparagraph }) are continued with the doubled \textquotedblleft number\textquotedblright{} of the first, second, third,\ldots\ page (\ensuremath {**}, \ensuremath {\dagger \dagger }, \ensuremath {\ddagger \ddagger }, \ensuremath {\mathsection \mathsection }, \ensuremath {\mathparagraph \mathparagraph }), and after the tenth page the \textquotedblleft number\textquotedblright{} is tripled (\ensuremath {***}, \ensuremath {\dagger \dagger \dagger },\ldots). Page zero is named 0 and negative pages are just named like the positive ones with addition of a minus \mbox{sign ($-$).} \bigskip For testing purposes, try: \begin{small} \begin{verbatim} \documentclass{article} \usepackage[plainpages=false,pageanchor=true,pdfpagelabels=true]{hyperref} \usepackage{pageslts} \pagenumbering{fnsymbol} \begin{document} First page.\newpage \verb|\lastpageref{pagesLTS.0} | \lastpageref{pagesLTS.0} \par \verb|\lastpageref{pagesLTS.0.local} | \lastpageref{pagesLTS.0.local} \par \verb|\lastpageref{LastPage} | \lastpageref{LastPage} \par \verb|\lastpageref{VeryLastPage} | \lastpageref{VeryLastPage} \par \verb|\lastpageref{pagesLTS.fnsymbol.1} | \lastpageref{pagesLTS.fnsymbol.1} \par \verb|\lastpageref{pagesLTS.fnsymbol.1.local} | \lastpageref{pagesLTS.fnsymbol.1.local} \par \verb|\lastpageref{pagesLTS.fnsymbol} | \lastpageref{pagesLTS.fnsymbol} \par \verb|\lastpageref{pagesLTS.fnsymbol.local} | \lastpageref{pagesLTS.fnsymbol.local} \par \verb|\lastpageref{LastPages} | \lastpageref{LastPages} \par \verb|\pagesLTSlastpage | \pagesLTSlastpage \newpage Last page. \end{document} \end{verbatim} \end{small} \newpage First page (\verb|\lastpageref{pagesLTS.0}|): \lastpageref{pagesLTS.0}\bigskip The page (\verb|\thepage|): \thepage \bigskip Current page (\verb|\theCurrentPage|), i.\,e.~counted continuously from the first page): \theCurrentPage \bigskip CurrentPageLocal (\verb|\theCurrentPageLocal|), i.\,e.~counted continuously from the first page of the current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip Last roman page (pagesLTS.roman): \lastpageref{pagesLTS.roman}{\hskip4em } (There are \lastpageref{pagesLTS.roman.local} pages with roman numbers.)\bigskip Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}{\hskip3em }% \makeatletter% \ifpagesLTS@pagecontinue% (There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline \else% (There are % \lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=% \the\numexpr% \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax~pages with Roman numbers:\newline \fi% \makeatother% \lastpages{Roman}{1}~pages in the first Roman sector (\pageref{Roman}{\hskip3em }-\lastpageref{pagesLTS.Roman.1}{\hskip3em }),\newline \lastpages{Roman}{2}~pages in the second Roman sector (\pageref{Roman2}{\hskip3em }-\lastpageref{pagesLTS.Roman.2}{\hskip3em }), and\newline \lastpages{Roman}{3}~pages in the third Roman sector (\pageref{Roman3}{\hskip3em }-\lastpageref{pagesLTS.Roman.3}{\hskip3em }).)\bigskip When the option \texttt{pagecontinue=false} is used with the \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will point to the same page as before, but this will have a lower number. And if that page number was also present in a preceding sector, the link will go to that page. (Several pages with the same number\ldots)\newline The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number of pages in the last sector. To get the total number of Roman pages, % \begin{verbatim} \the\numexpr \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax% \end{verbatim}% would be necessary.\bigskip Last arabic page (pagesLTS.arabic): \lastpageref{pagesLTS.arabic}{\hskip5em } (There are only \lastpageref{pagesLTS.arabic.local} pages with arabic numbers, because an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| was used.)\bigskip Last fnsymbol page (pagesLTS.fnsymbol): \lastpageref{pagesLTS.fnsymbol}\newline (better \verb|\lastpageref{pagesLTS.fnsymbol}| than just\newline \verb|\pageref{pagesLTS.fnsymbol}|!)\bigskip (There are \lastpageref{pagesLTS.fnsymbol.local} pages with fnsymbol numbers.)\bigskip Last alph page (pagesLTS.alph): \lastpageref{pagesLTS.alph}{\hskip4em } (There are only \lastpageref{pagesLTS.alph.local} pages with alph numbers, because an \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}| was used.)\bigskip Last Alph page (pagesLTS.Alph): \lastpageref{pagesLTS.Alph}{\hskip4em } (There are \lastpageref{pagesLTS.Alph.local} pages with Alph numbers.)\bigskip Last page's \textit{name} (LastPage): \lastpageref{LastPage}\bigskip Very last page's \textit{name} (VeryLastPage): \lastpageref{VeryLastPage}\newline (\texttt{LastPage} and \texttt{VeryLastPage} are now identical, because both are now done \verb|\AddToHook{enddocument/afterlastpage}| instead of formerly\newline \verb|\AtEndDocument| and \verb|\AfterLastShipout|, which were different.)\bigskip Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em } (=~total number of pages)\bigskip \lipsum[1-58] \newpage \pagenumbering{Roman} \section{Roman -- again!\label{Roman2}} The page number starts with \textquotedblleft I\textquotedblright{} again for option just \texttt{pagecontinue=false}, but for option \texttt{pagecontinue=true}, or with option just \texttt{pagecontinue}, or even just \nolinebreak{with\textbf{out}} option \texttt{pagecontinue=false} the page numbers are continued. This package remembered the $\arabic{pagesLTS.double.Roman}-1$, i.\,e.~\the\numexpr\value{pagesLTS.double.Roman}-1\relax, pages already done in Roman output, and therefore continues with page \textquotedblleft\Roman{pagesLTS.double.Roman}\textquotedblright{} in case of option \texttt{pagecontinue}.\newline If you want to start with \textquotedblleft I\textquotedblright{} all over again, you will have two pages with the same name, but nevertheless you can do this by using option \texttt{pagecontinue=false} or a \verb|\setcounter{page}{1}|\ here (not demonstrated in this example file).\bigskip There was the question: \textquotedblleft With option \verb|pagecontinue=false|, how do I get the number of pages in each number block (e.\,g.~in the first Roman section, second Roman section, third Roman section) with just one command?\textquotedblright \begin{verbatim} \makeatletter% \theCurrentPageLocal~of~\lastpageref*{% pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}.local}% \makeatother% \end{verbatim} provides this. Here: % \makeatletter% \theCurrentPageLocal~of~% \lastpageref*{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}.local}\newline% \makeatother% for \verb|pagecontinue=true| is \verb|4 of 8| (including % \makeatletter% $\the\numexpr\csname c@pagesLTS.double.Roman\endcsname -1\relax$ % from the first Roman section, $\the\csname c@pagesLTS.double.Roman\endcsname\relax =\the\numexpr\csname c@pagesLTS.double.Roman\endcsname -1\relax% first section +1% first page of this second section $, $\the\numexpr\csname c@pagesLTS.double.Roman\endcsname -1+% \csname c@pagesLTS.Roman.2.local.cnt\endcsname\relax% =\the\numexpr\csname c@pagesLTS.double.Roman\endcsname -1\relax+% \the\numexpr\csname c@pagesLTS.Roman.2.local.cnt\endcsname\relax$)\newline \makeatother% and for \verb|pagecontinue=false| is \verb|1 of 5| .\bigskip \verb|pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}.local| is: \begin{description} \item[-] \verb|pagesLTS| just identifies this counter to belong to the pageslts package. \item[-] \verb|\pagesLTS@pnc| is the Current Page Numbering scheme, i.\,e.~here it would be \verb|Roman|. \item[-] \verb|\arabic{pagesLTS.pnc.\pagesLTS@pnc}| is the value of counter\newline \verb|pagesLTS.pnc.\pagesLTS@pnc| printed in arabic numbers (1, 2, 3, ...) -- see below. \item[-] \verb|local|: Local there are 5 pages with Roman numbering in this example, globally there are $3+5+4=12$~pages with Roman numbering in this example, and the local numbers are wanted. \end{description} The counter \verb|pagesLTS.pnc.\pagesLTS@pnc| gives the number of the\newline \verb|\pagesLTS@pnc| page numbering scheme currently used, i.\,e.~we have consecutivly\newpage \begin{verbatim} pagesLTS.pnc.roman = 1 pagesLTS.pnc.Roman = 1 pagesLTS.pnc.arabic = 1 pagesLTS.pnc.fnsymbol = 1 pagesLTS.pnc.Roman = 2 pagesLTS.pnc.alph = 1 pagesLTS.pnc.Roman = 3 pagesLTS.pnc.Alph = 1 \end{verbatim} So, \verb|pagesLTS.pnc.Roman| changes from $1$ to $2$ automatically when doing the second \verb|\pagenumbering{Roman}|, and changes from $2$ to $3$ for the third\newline \verb|\pagenumbering{Roman}|.\bigskip First page (\verb|\lastpageref{pagesLTS.0}|): \lastpageref{pagesLTS.0}\bigskip The page (\verb|\thepage|): \thepage \bigskip Current page (\verb|\theCurrentPage|), i.\,e.~counted continuously from the first page): \theCurrentPage \bigskip CurrentPageLocal (\verb|\theCurrentPageLocal|), i.\,e.~counted continuously from the first page of the current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip Last roman page (pagesLTS.roman): \lastpageref{pagesLTS.roman}{\hskip4em } (There are \lastpageref{pagesLTS.roman.local} pages with roman numbers.)\bigskip Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}{\hskip3em }% \makeatletter% \ifpagesLTS@pagecontinue% (There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline \else% (There are % \lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=% \the\numexpr% \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax~pages with Roman numbers:\newline \fi% \makeatother% \lastpages{Roman}{1}~pages in the first Roman sector (\pageref{Roman}{\hskip3em }-\lastpageref{pagesLTS.Roman.1}{\hskip3em }),\newline \lastpages{Roman}{2}~pages in the second Roman sector (\pageref{Roman2}{\hskip3em }-\lastpageref{pagesLTS.Roman.2}{\hskip3em }), and\newline \lastpages{Roman}{3}~pages in the third Roman sector (\pageref{Roman3}{\hskip3em }-\lastpageref{pagesLTS.Roman.3}{\hskip3em }).)\bigskip When the option \texttt{pagecontinue=false} is used with the \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will point to the same page as before, but this will have a lower number. And if that page number was also present in a preceding sector, the link will go to that page. (Several pages with the same number\ldots)\newline The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number of pages in the last sector. To get the total number of Roman pages, % \begin{verbatim} \the\numexpr \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax% \end{verbatim}% would be necessary.\bigskip Last arabic page (pagesLTS.arabic): \lastpageref{pagesLTS.arabic}{\hskip5em } (There are only \lastpageref{pagesLTS.arabic.local} pages with arabic numbers, because an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| was used.)\bigskip Last fnsymbol page (pagesLTS.fnsymbol): \lastpageref{pagesLTS.fnsymbol}\newline (\verb|\lastpageref{pagesLTS.fnsymbol}| -- never \verb|\pageref{pagesLTS.fnsymbol}|!)\newline (There are \lastpageref{pagesLTS.fnsymbol.local} pages with fnsymbol numbers.)\bigskip Last alph page (pagesLTS.alph): \lastpageref{pagesLTS.alph}{\hskip4em } (There are only \lastpageref{pagesLTS.alph.local} pages with alph numbers, because an \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}| was used.)\bigskip Last Alph page (pagesLTS.Alph): \lastpageref{pagesLTS.Alph}{\hskip4em } (There are \lastpageref{pagesLTS.Alph.local} pages with Alph numbers.)\bigskip Last page's \textit{name} (LastPage): \lastpageref{LastPage}\bigskip Very last page's \textit{name} (VeryLastPage): \lastpageref{VeryLastPage}\newline (\texttt{LastPage} and \texttt{VeryLastPage} are now identical, because both are now done \verb|\AddToHook{enddocument/afterlastpage}| instead of formerly\newline \verb|\AtEndDocument| and \verb|\AfterLastShipout|, which were different.)\bigskip Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em } (=~total number of pages)\bigskip \lipsum[1-6] \newpage \verb|\lastpageref{pagesLTS.Roman}| does \textbf{not} refer to this page (but there: \lastpageref{pagesLTS.Roman}) for option \texttt{pagecontinue=true}. When a reference to this page is wanted,\newline \verb|\lastpageref{pagesLTS.Roman.2}| can be used: \lastpageref{pagesLTS.Roman.2}.\newline When the option \texttt{pagecontinue=false} is used with the \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will point to the same page as before, but this will have a lower number. And if that page number was also present in a preceding sector, the link will go to that page. (Several pages with the same number\ldots)\newline The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number of pages in the last sector. To get the total number of Roman pages, % \begin{verbatim} \the\numexpr \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax% \end{verbatim}% would be necessary.\bigskip There are \lastpages{Roman}{2}~pages (\verb|\lastpages{Roman}{2}|) in this second Roman sector.\newline The Roman page numbering scheme is continued later in section~\ref{Roman3})! \newpage \pagenumbering{alph} \section{alph\label{alph}} First page (\verb|\lastpageref{pagesLTS.0}|): \lastpageref{pagesLTS.0}\bigskip The page (\verb|\thepage|): \thepage \bigskip Current page (\verb|\theCurrentPage|), i.\,e.~counted continuously from the first page): \theCurrentPage \bigskip CurrentPageLocal (\verb|\theCurrentPageLocal|), i.\,e.~counted continuously from the first page of the current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip Last roman page (pagesLTS.roman): \lastpageref{pagesLTS.roman}{\hskip4em } (There are \lastpageref{pagesLTS.roman.local} pages with roman numbers.)\bigskip Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}{\hskip3em }% \makeatletter% \ifpagesLTS@pagecontinue% (There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline \else% (There are % \lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=% \the\numexpr% \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax~pages with Roman numbers:\newline \fi% \makeatother% \lastpages{Roman}{1}~pages in the first Roman sector (\pageref{Roman}{\hskip3em }-\lastpageref{pagesLTS.Roman.1}{\hskip3em }),\newline \lastpages{Roman}{2}~pages in the second Roman sector (\pageref{Roman2}{\hskip3em }-\lastpageref{pagesLTS.Roman.2}{\hskip3em }), and\newline \lastpages{Roman}{3}~pages in the third Roman sector (\pageref{Roman3}{\hskip3em }-\lastpageref{pagesLTS.Roman.3}{\hskip3em }).)\bigskip When the option \texttt{pagecontinue=false} is used with the \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will point to the same page as before, but this will have a lower number. And if that page number was also present in a preceding sector, the link will go to that page. (Several pages with the same number\ldots)\newline The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number of pages in the last sector. To get the total number of Roman pages, % \begin{verbatim} \the\numexpr \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax% \end{verbatim}% would be necessary.\bigskip Last arabic page (pagesLTS.arabic): \lastpageref{pagesLTS.arabic}{\hskip5em } (There are only \lastpageref{pagesLTS.arabic.local} pages with arabic numbers, because an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| was used.)\bigskip Last fnsymbol page (pagesLTS.fnsymbol): \lastpageref{pagesLTS.fnsymbol}\newline (better \verb|\lastpageref{pagesLTS.fnsymbol}| than just\newline \verb|\pageref{pagesLTS.fnsymbol}|!)\bigskip (There are \lastpageref{pagesLTS.fnsymbol.local} pages with fnsymbol numbers.)\bigskip Last alph page (pagesLTS.alph): \lastpageref{pagesLTS.alph}{\hskip4em } (There are only \lastpageref{pagesLTS.alph.local} pages with alph numbers, because an \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}| was used.)\bigskip Last Alph page (pagesLTS.Alph): \lastpageref{pagesLTS.Alph}{\hskip4em } (There are \lastpageref{pagesLTS.Alph.local} pages with Alph numbers.)\bigskip Last page's \textit{name} (LastPage): \lastpageref{LastPage}\bigskip Very last page's \textit{name} (VeryLastPage): \lastpageref{VeryLastPage}\newline (\texttt{LastPage} and \texttt{VeryLastPage} are now identical, because both are now done \verb|\AddToHook{enddocument/afterlastpage}| instead of formerly\newline \verb|\AtEndDocument| and \verb|\AfterLastShipout|, which were different.)\bigskip Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em } (=~total number of pages) \newpage Without option \texttt{alphMult=ab} of the \textsf{pageslts} (and the help of the \textsf{alphalph} package), after page \textquotedblleft z\textquotedblright{} there would just appear a \begin{quote} \begin{verbatim} LaTeX Error: Counter too large See the LaTeX manual or LaTeX Companion for explanation. You've lost some text. Try typing to proceed. If that doesn't work, type X to quit. \end{verbatim} \end{quote} Now the page numbers are continued aa, ab, ac,\ldots\ (aa, bb, cc,\ldots\ is also possible, see the \textsf{pageslts} documentation).\newline To demonstrate this, we add a\newline \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}|\newline in the source code here. \addtocounter{page}{\pagesLTSexamplealph} \bigskip \lipsum[1-18] \newpage \pagenumbering{Roman} \section{Roman - third time!\label{Roman3}} The page number starts with \textquotedblleft I\textquotedblright{} again for option just \texttt{pagecontinue=false}, but for option \texttt{pagecontinue=true}, or with option just \texttt{pagecontinue}, or even just \nolinebreak{with\textbf{out}} option \texttt{pagecontinue=false} the page numbers are continued. This package remembered the $\arabic{pagesLTS.double.Roman}-1$, i.\,e.~\the\numexpr\value{pagesLTS.double.Roman}-1\relax, pages already done in% \begin{description} \item[-] for \texttt{pagecontinue=false}: the preceding Roman sector, \item[-] for \texttt{pagecontinue=true}: all Roman sectors, \end{description}% and therefore continues with the appropriate page in case of option \texttt{pagecontinue}.\newline If you want to start with \textquotedblleft I\textquotedblright{} all over again, you will have two pages with the same name, but nevertheless you can do this by using option \texttt{pagecontinue=false} or a \verb|\setcounter{page}{1}|\ here (not demonstrated in this example file).\bigskip First page (\verb|\lastpageref{pagesLTS.0}|): \lastpageref{pagesLTS.0}\bigskip The page (\verb|\thepage|): \thepage \bigskip Current page (\verb|\theCurrentPage|), i.\,e.~counted continuously from the first page): \theCurrentPage \bigskip CurrentPageLocal (\verb|\theCurrentPageLocal|), i.\,e.~counted continuously from the first page of the current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip Last roman page (pagesLTS.roman): \lastpageref{pagesLTS.roman}{\hskip4em } (There are \lastpageref{pagesLTS.roman.local} pages with roman numbers.)\bigskip Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}{\hskip3em }% \makeatletter% \ifpagesLTS@pagecontinue% (There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline \else% (There are % \lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=% \the\numexpr% \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax~pages with Roman numbers:\newline \fi% \makeatother% \lastpages{Roman}{1}~pages in the first Roman sector (\pageref{Roman}{\hskip3em }-\lastpageref{pagesLTS.Roman.1}{\hskip3em }),\newline \lastpages{Roman}{2}~pages in the second Roman sector (\pageref{Roman2}{\hskip3em }-\lastpageref{pagesLTS.Roman.2}{\hskip3em }), and\newline \lastpages{Roman}{3}~pages in the third Roman sector (\pageref{Roman3}{\hskip3em }-\lastpageref{pagesLTS.Roman.3}{\hskip3em }).)\bigskip When the option \texttt{pagecontinue=false} is used with the \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will point to the same page as before, but this will have a lower number. And if that page number was also present in a preceding sector, the link will go to that page. (Several pages with the same number\ldots)\newline The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number of pages in the last sector. To get the total number of Roman pages, % \begin{verbatim} \the\numexpr \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax% \end{verbatim}% would be necessary.\bigskip Last arabic page (pagesLTS.arabic): \lastpageref{pagesLTS.arabic}{\hskip5em } (There are only \lastpageref{pagesLTS.arabic.local} pages with arabic numbers, because an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| was used.)\bigskip Last fnsymbol page (pagesLTS.fnsymbol): \lastpageref{pagesLTS.fnsymbol}\newline (better \verb|\lastpageref{pagesLTS.fnsymbol}| than just\newline \verb|\pageref{pagesLTS.fnsymbol}|!)\bigskip (There are \lastpageref{pagesLTS.fnsymbol.local} pages with fnsymbol numbers.)\bigskip Last alph page (pagesLTS.alph): \lastpageref{pagesLTS.alph}{\hskip4em } (There are only \lastpageref{pagesLTS.alph.local} pages with alph numbers, because an \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}| was used.)\bigskip Last Alph page (pagesLTS.Alph): \lastpageref{pagesLTS.Alph}{\hskip4em } (There are \lastpageref{pagesLTS.Alph.local} pages with Alph numbers.)\bigskip Last page's \textit{name} (LastPage): \lastpageref{LastPage}\bigskip Very last page's \textit{name} (VeryLastPage): \lastpageref{VeryLastPage}\newline (\texttt{LastPage} and \texttt{VeryLastPage} are now identical, because both are now done \verb|\AddToHook{enddocument/afterlastpage}| instead of formerly\newline \verb|\AtEndDocument| and \verb|\AfterLastShipout|, which were different.)\bigskip Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em } (=~total number of pages) \newpage \lipsum[1-3] \newpage \lastpageref{pagesLTS.Roman} (\verb|\lastpageref{pagesLTS.Roman}|) \textbf{does} refers to this page.\newline Also \verb|\lastpageref{pagesLTS.Roman.3}| give the right name of the page, but if \verb|pagecontinue=false| was chosen, it might point to another page with the same name! \lastpageref{pagesLTS.Roman.3}.\bigskip \bigskip There are \lastpages{Roman}{3}~pages (\verb|\lastpages{Roman}{3}|) in this third Roman sector. \newpage \pagenumbering{gobble} \section{gobble} Well. You can use \verb|gobble| as page numbering scheme. It gobbles the page numbers, i.\,e.~there is no page number. Maybe \verb|\thispagestyle{empty}| is more useful? Do not expect to be able to make working references to pages without page number, and do expect to get \begin{verbatim} pdfTeX warning (ext4): destination with the same identifier (name{page.}) has been already used, duplicate ignored \end{verbatim} The page (\verb|\thepage|): \thepage{} (There is a nothing between two spaces there.)\bigskip Current page (\verb|\theCurrentPage|), i.\,e.~counted continuously from the first page): \theCurrentPage \bigskip CurrentPageLocal (\verb|\theCurrentPageLocal|), i.\,e.~counted continuously from the first page of the current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip There are \lastpageref*{pagesLTS.gobble.local} pages with gobbled numbers (i.\,e.~without numbers). \bigskip For testing purposes, try: \begin{small} \begin{verbatim} \documentclass{article} \usepackage[plainpages=false,pageanchor=true,pdfpagelabels=true]{hyperref} \usepackage{pageslts} \pagenumbering{gobble} \begin{document} First page.\newpage \verb|\lastpageref{pagesLTS.0} | \lastpageref{pagesLTS.0} \par \verb|\lastpageref{pagesLTS.0.local} | \lastpageref{pagesLTS.0.local} \par \verb|\lastpageref{LastPage} | \lastpageref{LastPage} \par \verb|\lastpageref{VeryLastPage} | \lastpageref{VeryLastPage} \par \verb|\lastpageref{pagesLTS.gobble.1} | \lastpageref{pagesLTS.gobble.1} \par \verb|\lastpageref{pagesLTS.gobble.1.local} | \lastpageref{pagesLTS.gobble.1.local} \par \verb|\lastpageref{pagesLTS.gobble} | \lastpageref{pagesLTS.gobble} \par \verb|\lastpageref{pagesLTS.gobble.local} | \lastpageref{pagesLTS.gobble.local} \par \verb|\lastpageref{LastPages} | \lastpageref{LastPages} \par \verb|\pagesLTSlastpage | \pagesLTSlastpage \newpage Last page. \end{document} \end{verbatim} \end{small} \newpage \pagenumbering{Alph} \section{Alph} First page (\verb|\lastpageref{pagesLTS.0}|): \lastpageref{pagesLTS.0}\bigskip The page (\verb|\thepage|): \thepage \bigskip Current page (\verb|\theCurrentPage|), i.\,e.~counted continuously from the first page): \theCurrentPage \bigskip CurrentPageLocal (\verb|\theCurrentPageLocal|), i.\,e.~counted continuously from the first page of the current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip Last roman page (pagesLTS.roman): \lastpageref{pagesLTS.roman}{\hskip4em } (There are \lastpageref{pagesLTS.roman.local} pages with roman numbers.)\bigskip Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}{\hskip3em }% \makeatletter% \ifpagesLTS@pagecontinue% (There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline \else% (There are % \lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=% \the\numexpr% \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax~pages with Roman numbers:\newline \fi% \makeatother% \lastpages{Roman}{1}~pages in the first Roman sector (\pageref{Roman}{\hskip3em }-\lastpageref{pagesLTS.Roman.1}{\hskip3em }),\newline \lastpages{Roman}{2}~pages in the second Roman sector (\pageref{Roman2}{\hskip3em }-\lastpageref{pagesLTS.Roman.2}{\hskip3em }), and\newline \lastpages{Roman}{3}~pages in the third Roman sector (\pageref{Roman3}{\hskip3em }-\lastpageref{pagesLTS.Roman.3}{\hskip3em }).)\bigskip When the option \texttt{pagecontinue=false} is used with the \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will point to the same page as before, but this will have a lower number. And if that page number was also present in a preceding sector, the link will go to that page. (Several pages with the same number\ldots)\newline The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number of pages in the last sector. To get the total number of Roman pages, % \begin{verbatim} \the\numexpr \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax% \end{verbatim}% would be necessary.\bigskip Last arabic page (pagesLTS.arabic): \lastpageref{pagesLTS.arabic}{\hskip5em } (There are only \lastpageref{pagesLTS.arabic.local} pages with arabic numbers, because an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| was used.)\bigskip Last fnsymbol page (pagesLTS.fnsymbol): \lastpageref{pagesLTS.fnsymbol}\newline (better \verb|\lastpageref{pagesLTS.fnsymbol}| than just\newline \verb|\pageref{pagesLTS.fnsymbol}|!)\newline (There are \lastpageref{pagesLTS.fnsymbol.local} pages with fnsymbol numbers.)\bigskip Last alph page (pagesLTS.alph): \lastpageref{pagesLTS.alph}{\hskip4em } (There are only \lastpageref{pagesLTS.alph.local} pages with alph numbers, because an \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}| was used.)\bigskip Last Alph page (pagesLTS.Alph): \lastpageref{pagesLTS.Alph}{\hskip4em } (There are \lastpageref{pagesLTS.Alph.local} pages with Alph numbers.)\bigskip Last page's \textit{name} (LastPage): \lastpageref{LastPage}\bigskip Very last page's \textit{name} (VeryLastPage): \lastpageref{VeryLastPage}\newline (\texttt{LastPage} and \texttt{VeryLastPage} are now identical, because both are now done \verb|\AddToHook{enddocument/afterlastpage}| instead of formerly\newline \verb|\AtEndDocument| and \verb|\AfterLastShipout|, which were different.)\bigskip Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em } (=~total number of pages) \newpage Without option \texttt{alphMulti=AB} of the \textsf{pageslts} (and the help of the \textsf{alphalph} package), after page \textquotedblleft Z\textquotedblright{} there would just appear~a \begin{quote} \begin{verbatim} LaTeX Error: Counter too large See the LaTeX manual or LaTeX Companion for explanation. You've lost some text. Try typing to proceed. If that doesn't work, type X to quit. \end{verbatim} \end{quote} Now the page numbers are continued AA, AB, AC,\ldots\ (AA, BB, CC,\ldots\ is also possible, see the \textsf{pageslts} documentation).\newline This is not demonstrated here, but see section~\ref{alph}. \newpage \section{silly} The sillypage package, \url{https://ctan.org/pkg/sillypage}, provides the page\-numbering scheme \verb|silly|, which is not demonstrated here but works with the pageslts package, i.\,e.~the references all show the right (page) number and link to the right page.\bigskip This is \textbf{not} demonstrated here (discussing gobbled page numbers is silly enough), but for testing purposes, try: \begin{small} \begin{verbatim} \documentclass{article} \usepackage[plainpages=false,pageanchor=true,pdfpagelabels=true]{hyperref} \usepackage{pageslts} \usepackage{sillypage} \pagenumbering{silly} \begin{document} First page.\newpage \verb|\lastpageref{pagesLTS.0} | \lastpageref{pagesLTS.0} \par \verb|\lastpageref{pagesLTS.0.local} | \lastpageref{pagesLTS.0.local} \par \verb|\lastpageref{LastPage} | \lastpageref{LastPage} \par \verb|\lastpageref{VeryLastPage} | \lastpageref{VeryLastPage} \par \verb|\lastpageref{pagesLTS.silly.1} | \lastpageref{pagesLTS.silly.1} \par \verb|\lastpageref{pagesLTS.silly.1.local} | \lastpageref{pagesLTS.silly.1.local} \par \verb|\lastpageref{pagesLTS.silly} | \lastpageref{pagesLTS.silly} \par \verb|\lastpageref{pagesLTS.silly.local} | \lastpageref{pagesLTS.silly.local} \par \verb|\lastpageref{LastPages} | \lastpageref{LastPages} \par \verb|\pagesLTSlastpage | \pagesLTSlastpage \newpage Page \theCurrentPage\newpage Page \theCurrentPage\newpage Page \theCurrentPage\newpage Page \theCurrentPage\newpage Page \theCurrentPage\newpage Page \theCurrentPage\newpage Page \theCurrentPage\newpage Page \theCurrentPage\newpage Page \theCurrentPage\newpage Page \theCurrentPage\newpage Page \theCurrentPage\newpage Page \theCurrentPage\newpage Page \theCurrentPage : Last page. \end{document} \end{verbatim} \end{small} \newpage \section{The End} First page (\verb|\lastpageref{pagesLTS.0}|): \lastpageref{pagesLTS.0}\bigskip The page (\verb|\thepage|): \thepage \bigskip Current page (\verb|\theCurrentPage|), i.\,e.~counted continuously from the first page): \theCurrentPage \bigskip CurrentPageLocal (\verb|\theCurrentPageLocal|), i.\,e.~counted continuously from the first page of the current page numbering scheme (if option pagecontinue=false: sector)): \theCurrentPageLocal \bigskip Last roman page (pagesLTS.roman): \lastpageref{pagesLTS.roman}{\hskip4em } (There are \lastpageref{pagesLTS.roman.local} pages with roman numbers.)\bigskip Last Roman page (pagesLTS.Roman): \lastpageref{pagesLTS.Roman}{\hskip3em }% \makeatletter% \ifpagesLTS@pagecontinue% (There are \lastpageref{pagesLTS.Roman.local}~pages with Roman numbers:\newline \else% (There are % \lastpages{Roman}{1}+\lastpages{Roman}{2}+\lastpages{Roman}{3}=% \the\numexpr% \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax~pages with Roman numbers:\newline \fi% \makeatother% \lastpages{Roman}{1}~pages in the first Roman sector (\pageref{Roman}{\hskip3em }-\lastpageref{pagesLTS.Roman.1}{\hskip3em }),\newline \lastpages{Roman}{2}~pages in the second Roman sector (\pageref{Roman2}{\hskip3em }-\lastpageref{pagesLTS.Roman.2}{\hskip3em }), and\newline \lastpages{Roman}{3}~pages in the third Roman sector (\pageref{Roman3}{\hskip3em }-\lastpageref{pagesLTS.Roman.3}{\hskip3em }).)\bigskip When the option \texttt{pagecontinue=false} is used with the \textsf{pageslts} package, the \verb|\lastpageref{pagesLTS.Roman}| will point to the same page as before, but this will have a lower number. And if that page number was also present in a preceding sector, the link will go to that page. (Several pages with the same number\ldots)\newline The \verb|\lastpageref{pagesLTS.Roman.local}| will refer only to the number of pages in the last sector. To get the total number of Roman pages, % \begin{verbatim} \the\numexpr \csname c@pagesLTS.Roman.1.local.cnt\endcsname% +\csname c@pagesLTS.Roman.2.local.cnt\endcsname% +\csname c@pagesLTS.Roman.3.local.cnt\endcsname% \relax% \end{verbatim}% would be necessary.\bigskip Last arabic page (pagesLTS.arabic): \lastpageref{pagesLTS.arabic}{\hskip5em } (There are only \lastpageref{pagesLTS.arabic.local} pages with arabic numbers, because an \verb|\addtocounter{page}{|\pagesLTSexampleArabic\verb|}| was used.)\bigskip Last fnsymbol page (pagesLTS.fnsymbol): \lastpageref{pagesLTS.fnsymbol}\newline (better \verb|\lastpageref{pagesLTS.fnsymbol}| than just\newline \verb|\pageref{pagesLTS.fnsymbol}|!)\bigskip (There are \lastpageref{pagesLTS.fnsymbol.local} pages with fnsymbol numbers.)\bigskip Last alph page (pagesLTS.alph): \lastpageref{pagesLTS.alph}{\hskip4em } (There are only \lastpageref{pagesLTS.alph.local} pages with alph numbers, because an \verb|\addtocounter{page}{|\pagesLTSexamplealph\verb|}| was used.)\bigskip Last gobble page (pagesLTS.gobble: \lastpageref{pagesLTS.gobble}{\hskip4em } Yes, there is neither page number nor link, because everything got gobbled. (There is \lastpageref*{pagesLTS.gobble.local} page with gobbled number (i.\,e.~without number).)\bigskip Last Alph page (pagesLTS.Alph): \lastpageref{pagesLTS.Alph}{\hskip4em } (There are \lastpageref{pagesLTS.Alph.local} pages with Alph numbers.)\bigskip Silly page numbers are possible but were not demonstrated in this example. \newpage Last page's \textit{name} (LastPage): \lastpageref{LastPage}\bigskip Very last page's \textit{name} (VeryLastPage): \lastpageref{VeryLastPage}\newline (\texttt{LastPage} and \texttt{VeryLastPage} are now identical, because both are now done \verb|\AddToHook{enddocument/afterlastpage}| instead of formerly\newline \verb|\AtEndDocument| and \verb|\AfterLastShipout|, which were different.)\bigskip Last page's \textit{number} (LastPages): \lastpageref{LastPages}{\hskip3em } (=~total number of pages) \end{document} % % \end{macrocode} % \pagebreak % \StopEventually{} % % \section{The implementation} % (This and the source code of the example file are the reasons % for printing the documentation in landscape format instead of portrait.)\bigskip % % We start off by checking that we are loading into \LaTeXe{}, % format version at least 2024-06-01, and announcing the name and version of this package. % % \begin{macrocode} %<*package> % \end{macrocode} % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[2024-06-01] \ProvidesPackage{pageslts}[2024-12-23 v2.0c Refers to special pages' numbers/names (HMM)] % \end{macrocode} % % A short description of the \xpackage{pageslts} package: % % \begin{macrocode} %% Allows for things like\par %% |Page \thepage\ (\theCurrentPage; local: \theCurrentPageLocal) of % %% \lastpageref{pagesLTS.roman}(\lastpageref{pagesLTS.roman.local}) + % %% \lastpageref{pagesLTS.Roman}(\lastpageref{pagesLTS.Roman.local}) + % %% \lastpageref{pagesLTS.arabic}(\lastpageref{pagesLTS.arabic.local}) + % %% \lastpageref{pagesLTS.fnsymbol}(\lastpageref{pagesLTS.fnsymbol.local}) + % %% \lastpageref{pagesLTS.alph}(\lastpageref{pagesLTS.alph.local}) + % %% \lastpageref{pagesLTS.Alph}(\lastpageref{pagesLTS.Alph.local}) = % %% \lastpageref{LastPages} pages.|\par %% to get\par %% 'Page d (57; local: 4) of ii(2) + XX(20) + *(1) + 30(30) + e(5) + C(3) = 61 pages.'. % \end{macrocode} % % For the handling of the options we use the kernel commands: % % \begin{macrocode} \DeclareKeys[pagesLTS] {alphMult .store = \pagesLTS@alphMult , alphMult .usage = preamble , AlphMulti .store = \pagesLTS@AlphMulti , AlphMulti .usage = preamble , pagecontinue .if = pagesLTS@pagecontinue , pagecontinue .usage = load , romanMult .if = pagesLTS@romanMult , romanMult .usage = load , RomanMulti .if = pagesLTS@RomanMulti , RomanMulti .usage = load , fnsymbolmult .if = pagesLTS@fnsymbolmult , fnsymbolmult .usage = load } \SetKeys[pagesLTS]{alphMult=ab,AlphMulti=AB,pagecontinue=true,romanMult=true,RomanMulti=true,fnsymbolmult=true} \DeclareUnknownKeyHandler[pagesLTS]{% \PackageError{pageslts}{Unknown option "\CurrentOption"}{% LaTeX has been asked to set an option called\MessageBreak% '#1' \if\relax\detokenize{#2}\relax\else with value '#2'\fi\MessageBreak% but the package "pageslts" has not created an option with this name.\MessageBreak% Try typing to proceed.\MessageBreak% If that doesn't work, type X to quit.% }% } \ProcessKeyOptions[pagesLTS] % \end{macrocode} % % This package really does not work with an old \LaTeX{} format % without hooks, or without \eTeX, or with a \xpackage{pagesLTS.sty} file, % or with version~2.0 from~1992 of the \xpackage{endfloats} package, % or \xpackage{hyperref} from 2015 and so on. Assuming that nobody % would combine those old things with a modern \LaTeX{} format, % we request a recent format and do not check for the rest. % % \begin{macrocode} \@ifl@t@r\fmtversion{2024-06-01}{}{\PackageError{pageslts}{% LaTeX format 2024-06-01 or newer needed}{% Needed LaTeX format version: 2024-06-01 or newer.\MessageBreak% Found\space\space LaTeX format version: \fmtversion.\MessageBreak% Please update your TeX distribution!\MessageBreak% Loading of pageslts package is aborted.} \expandafter\endinput} % \end{macrocode} % % The \xpackage{undolabl} package (see subsection~\ref{ss:Downloads}) % is needed to overwrite labels, when the same page numbering scheme % is used twice (or even more often). % % \begin{macrocode} \RequirePackage{undolabl}[2024-12-05] \IfPackageLoadedTF{undolabl}{\IfPackageAtLeastF{undolabl}{2024-12-05}{% \PackageError{pageslts}{undolabl package version too old}{% Required version: 2024-12-05 v1.0n or newer,\MessageBreak% found version:\space\space\space\space\csname ver@undolabl.sty\endcsname.% }}}{\PackageError{pageslts}{undolabl package not loaded}{% The undolabl package is required by pageslts but was not loaded.}% } % \end{macrocode} % % For comparisons, zero, one, two and three are defined % (|\z@|, |\@ne| and so on do not work for this) % and for the page numbering scheme handling some definitions are made. % % \begin{macrocode} \def\pagesLTS@zero{0} \def\pagesLTS@one{1} \def\pagesLTS@two{2} \def\pagesLTS@three{3} \def\pagesLTS@ab{ab} \def\pagesLTS@bb{bb} \def\pagesLTS@ABi{AB} \def\pagesLTS@BBi{BB} % \end{macrocode} % % The traditional behaviour is a reset of the page number to one, % each time the page numbering scheme changes. The option % |pagecontinue| changes this to a continuation with the % number/name following the last page number/name of the same % page numbering scheme. The user is informed accordingly. % % \begin{macrocode} \ifpagesLTS@pagecontinue \PackageNoteNoLine{pageslts}{Option pagecontinue enabled (maybe by default):\MessageBreak% The pageslts package will continue the page numbering,\MessageBreak% when the same page numbering scheme is used twice.\MessageBreak% If you do not want this, call pageslts with option\MessageBreak% pagecontinue=false (or use \string\setcounter{page}=1)} \else \PackageNoteNoLine{pageslts}{Option pagecontinue is false:\MessageBreak% The pageslts package was used, but the option\MessageBreak% pagecontinue was set to false.\MessageBreak% If you want the page numbers to be continued,\MessageBreak% when the same page numbering scheme is used twice,\MessageBreak% please call pageslts with option pagecontinue=true,\MessageBreak% otherwise the page number is reset to one each time\MessageBreak% the page numbering scheme is changed} \fi % \end{macrocode} % % The page number printed in \texttt{alph} or in \texttt{Alph} % page numbering scheme had to be $>0$ and \mbox{$<27$.}\ % % Now the \xpackage{alphalph} package allows to extend the % numbering scheme (not only for pages). Because some users % prefer aa, ab, ac, ad,\ldots\ and some aa, bb, cc, dd,\ldots, % both schemes can be chosen via the options. % The \texttt{fnsymbol} page numbering scheme was restricted to values % $>0$ and \mbox{$<10$.}\ The \xpackage{alphalph} package allows % to extend this page numbering scheme, too. Option \texttt{fnsymbolmult} % can be chosen with the \xpackage{pageslts} package. % If no extension is wished (or another extension is wished % and implemented manually), \xpackage{pageslts} can be called with % options set to 0 (zero) and false: |alphMult=0|, |AlphMulti=0|, % |fnsymbolmult=false|. % % \begin{macrocode} \ifx\pagesLTS@alphMult\pagesLTS@ab% \else \ifx\pagesLTS@alphMult\pagesLTS@bb% \else \ifx\pagesLTS@alphMult\pagesLTS@zero% \PackageNoteNoLine{pageslts}{% Option alphMult=0 found:\MessageBreak% The pageslts package was used, but the option\MessageBreak% alphMult was set to 0 (zero).\MessageBreak% If you want the page numbers to be extended\MessageBreak% after z, you have to organize this yourself now.\MessageBreak% For automatic continuation, please use the\MessageBreak% alphalph package and call pageslts\MessageBreak% with option alphMult=ab (for aa, ab, ac, ad,...) or\MessageBreak% with option alphMult=bb (for aa, bb, cc, dd,...)} \else \PackageError{pageslts}{Unknown option value}{% The pageslts package was used with option\MessageBreak% alphMult=\meaning\pagesLTS@alphMult .\MessageBreak% Only values 'ab', 'bb', and '0' (zero) are valid.\MessageBreak% Now the default 'ab' is being set.} \SetKeys[pagesLTS]{alphMult=ab} \fi \fi \fi \ifx\pagesLTS@AlphMulti\pagesLTS@ABi% \else \ifx\pagesLTS@AlphMulti\pagesLTS@BBi% \else \ifx\pagesLTS@AlphMulti\pagesLTS@zero% \PackageNoteNoLine{pageslts}{% Option AlphMulti=0 found:\MessageBreak% The pageslts package was used, but the option\MessageBreak% AlphMulti was set to 0 (zero).\MessageBreak% If you want the page numbers to be extended\MessageBreak% after Z, you have to organize this yourself now.\MessageBreak% For automatic continuation, please use the\MessageBreak% alphalph package and call pageslts\MessageBreak% with option AlphMulti=AB (for AA, AB, AC, AD,...) or\MessageBreak% with option AlphMulti=BB (for AA, BB, CC, DD,...)} \else \PackageError{pageslts}{Unknown option value}{% The pageslts package was used with option\MessageBreak% AlphMulti=\meaning\pagesLTS@AlphMulti .\MessageBreak% Only values 'AB', 'BB', and '0' (zero) are valid.\MessageBreak% The default 'AB' is set.} \SetKeys[pagesLTS]{AlphMulti=AB} \fi \fi \fi % \end{macrocode} % % If |alph| or |Alph| or |fnsymbol| page numbers shall be continued, % the \xpackage{alphalph} package is required. % % \begin{macrocode} \ifx\pagesLTS@alphMult\pagesLTS@zero\else\RequirePackage{alphalph}[2019/12/09]\fi \ifx\pagesLTS@AlphMulti\pagesLTS@zero\else\RequirePackage{alphalph}[2019/12/09]\fi \ifpagesLTS@fnsymbolmult\RequirePackage{alphalph}[2019/12/09]\fi % \end{macrocode} % % For the roman page numbering scheme, it is just the % choice of an extension by \xpackage{pageslts} or not. % % \begin{macrocode} \ifpagesLTS@romanMult \PackageNoteNoLine{pageslts}{Option romanMult enabled (maybe by default):\MessageBreak% The pageslts package will extend the page numbering\MessageBreak% of the roman scheme below i with\MessageBreak% 0, -i, -ii, -iii, -iv,...\MessageBreak% If you do not want this, call pageslts with option\MessageBreak% romanMult=false} \else \PackageNoteNoLine{pageslts}{Option romanMult is set to false:\MessageBreak% The pageslts package was used, but the option\MessageBreak% romanMult was set to false.\MessageBreak% If you want the page numbering of the roman scheme\MessageBreak% to be extended below i,\MessageBreak% please call pageslts with option romanMult=true,\MessageBreak% otherwise zero and negative page numbers of the\MessageBreak% roman scheme will need to be defined otherwise} \fi % \end{macrocode} % % Same for the Roman page numbering scheme. % % \begin{macrocode} \ifpagesLTS@RomanMulti \PackageNoteNoLine{pageslts}{Option RomanMulti enabled (maybe by default):\MessageBreak% The pageslts package will extend the page numbering\MessageBreak% of the Roman scheme below I with\MessageBreak% 0, -I, -II, -III, -IV,...\MessageBreak% If you do not want this, call pageslts with option\MessageBreak% RomanMulti=false} \else \PackageNoteNoLine{pageslts}{Option RomanMulti is set to false:\MessageBreak% The pageslts package was used, but the option\MessageBreak% RomanMulti was set to false.\MessageBreak% If you want the page numbering of the Roman scheme\MessageBreak% to be extended below i,\MessageBreak% please call pageslts with option RomanMulti=true,\MessageBreak% otherwise zero and negative page numbers of the\MessageBreak% Roman scheme will need to be defined otherwise} \fi % \end{macrocode} % % For the footnotesymbol page numbering scheme, it is also % just the choice of a extension by \xpackage{pageslts} or not. % % \begin{macrocode} \ifpagesLTS@fnsymbolmult \PackageNoteNoLine{pageslts}{Option fnsymbolmult enabled (maybe by default):\MessageBreak% The pageslts package will extend the page numbering\MessageBreak% of the footnotesymbol scheme using the alphalph\MessageBreak% package.\MessageBreak% If you do not want this, call pageslts with option\MessageBreak% fnsymbolmult=false} \else \PackageNoteNoLine{pageslts}{% Option fnsymbolmult is set to false:\MessageBreak% The pageslts package was used, but the option\MessageBreak% fnsymbolmult was set to false.\MessageBreak% If you want the page numbering of the footnotesymbol\MessageBreak% scheme to be extended using the alphalph package,\MessageBreak% please call pageslts with option fnsymbolmult=true,\MessageBreak% otherwise page numbers of the footnotesymbol scheme\MessageBreak% greater than nine will need to be defined otherwise} \fi % \end{macrocode} % % Now defining some variables, place-holders, and abbreviations: % % \begin{macrocode} \def\pagesLTS@pnc{0} \def\pagesLTS@called{0} \def\pagesLTS@fns{fnsymbol} \def\pagesLTS@alph{alph} \def\pagesLTS@Alph{Alph} \def\pagesLTS@gobble{gobble} \def\pagesLTS@silly{silly} \def\pagesLTS@rerun{0} \def\pagesLTS@esoFs{0} \def\pagesLTS@esovFs{0} \def\pagesLTS@esoSy{0} \def\pagesLTS@esovSy{0} \def\pagesLTS@esoGbl{0} \def\pagesLTS@esovGbl{0} \def\lastpageref{\lastpagereftxt} \def\pagesLTS@undolable{none} \def\pncmissing{0} \def\pagesLTS@messageNPN{% The pageslts package was used, but\MessageBreak% \string\pagenumbering \MessageBreak% was not called at the beginning of the document\MessageBreak% (maybe earlier or later).\MessageBreak% Please use \string\pagenumbering \MessageBreak% (with an argument like arabic, roman, Roman,\MessageBreak% fnsymbol, alph, Alph, gobble,\MessageBreak% or silly (requiring sillypage package))\MessageBreak% at the beginning of your document!\MessageBreak% Otherwise your document will probably compile,\MessageBreak% but the pageslts package might not be able\MessageBreak% to get all labels for the references\MessageBreak% to the respective pages right.\MessageBreak% } % \end{macrocode} % % Defining some new counters (and doing related things): % % \begin{macrocode} \newcounter{CurrentPage} \setcounter{CurrentPage}{1} \def\theCurrentPageLocal{\arabic{pagesLTS.current.local.\pagesLTS@pnc}} % \end{macrocode} % % The counter |pagesLTS.pagenr| is for saving into the \xfile{.aux} file % the total page number of the last page. % % \begin{macrocode} \newcounter{pagesLTS.pagenr} \setcounter{pagesLTS.pagenr}{1} % \end{macrocode} % % While generally |\pagesLTS@providecounter{pagesLTS.current.local.\pagesLTS@pnc}| % is used, for the beginning of the document |pagesLTS.current.local.0| is predefined. % (A~|\pagesLTS@providecounter{pagesLTS.current.local.\pagesLTS@pnc}| % could be used for this, too, but we know that |pagesLTS.current.local.0| % was not defined, so we can just do the definition here.) % And the first local page gets the number one. % % \begin{macrocode} \newcounter{pagesLTS.current.local.0} \setcounter{pagesLTS.current.local.0}{1} % \end{macrocode} % % And the same again for |pagesLTS.pnc.0|. % % \begin{macrocode} \newcounter{pagesLTS.pnc.0} % \end{macrocode} % % Also a scratch counter is defined, |\pagesLTSlastpage| and |\pagesLTSlastpageHy| are predefined % \mbox{(e.\,g.}\ for computations in the first compilation run), % and the obsolete |\pagesLTS.lastpage| points to the new |\pagesLTSlastpage|. % % \begin{macrocode} \newcounter{pagesLTS.tmpcounter} \def\pagesLTSlastpage{1} \def\pagesLTSlastpageHy{1} \def\pagesLTS.lastpage{\pagesLTSlastpage} % \end{macrocode} % % \phantomsection % \begin{macro}{\xroman}\label{xroman} % When |\roman{...}| is used with a value $<1$, \LaTeX\ just ignores this % (see subsection~\ref{ss:overflow}). Here we provide a command % |\xroman{...}| \nolinebreak{(e\textbf{x}panded} roman), % which gives the usual |\roman| numbers (i, ii, iii, iv,\ldots) % for positive values, % $-\left\vert \ldots \right\vert $ (i.\,e. -i, -ii, -iii, -iv,\ldots) % for negative values, and 0 for all other values (which should be zero). % % \begin{macrocode} \newcommand{\xroman}[1]{% \ifnum\value{#1}>0% \roman{#1}% \else% \ifnum\value{#1}<0% % \end{macrocode} % % |\arabic{#1}| gives the arabic number of argument |#1|, % which is negative here (for example $-7$), % \textquotedblleft |-|\textquotedblright{} puts another minus % sign in front of it (for example $--7$), |\number| removes % all unnecessary preceding zeros, plus and minus signs % (for example $7$), |\romannumeral| turns it into a |roman| % number (for example vii), and % \textquotedblleft |-|\textquotedblright{} puts the minus % sign back in front of it (for example -vii). % % \begin{macrocode} -\romannumeral\number-\arabic{#1}% \else% 0% \fi% \fi% } % \end{macrocode} % \end{macro} % \newpage % \begin{macro}{\XRoman} % |\XRoman| does the same for uppercase |\Roman| numbers. % |-\uppercase{\romannumeral\number-\arabic{#1}}| cannot be used, % because the result in the example is |-\uppercase{vii}| and % not |-VII|.\footnote{This does not matter for the print out, % but for the display of the logical page numbers % as well as the \xfile{.aux} file.} Therefore we have a look % at \LaTeX's own |\@Roman\FOOcounter|,\newline % |\def\@Roman#1{\expandafter\@slowromancap\romannumeral #1@}|,\newline % and use |\@slowromancap|, which is a fully expandable macro, % to do the trick for this: % \begin{quote} % \textquotedblleft |\def\@slowromancap#1{\ifx @#1% then terminate|\newline% % \hphantom{\textquotedblleft}|\else|\newline% % \hphantom{\textquotedblleft}|\if i#1I\else\if v#1V\else\if x#1X\else\if l#1L\else\if|\newline% % \hphantom{\textquotedblleft}|c#1C\else\if d#1D\else \if m#1M\else#1\fi\fi\fi\fi\fi\fi\fi|\newline% % \hphantom{\textquotedblleft}|\expandafter\@slowromancap|\newline% % \hphantom{\textquotedblleft}|\fi|\newline% % \hphantom{\textquotedblleft}|}|\textquotedblright{} % % (2021/11/08 Version v1.1n \LaTeX{} Kernel File~21: ltcounts.dtx Counters and Lengths). % \end{quote} % % \begin{macrocode} \newcommand{\XRoman}[1]{% \ifnum\value{#1}>0% \Roman{#1}% \else% \ifnum\value{#1}<0% -\expandafter\@slowromancap\romannumeral\number-\arabic{#1}@% \else% 0% \fi% \fi% } % \end{macrocode} % \end{macro} % % \begin{macro}{\pagesLTS@providecounter} % We provide a way to create counters like % \begin{itemize} % \item[-] \DescribeMacro{pagesLTS.pnc. page numbering scheme } % |pagesLTS.pnc.|, e.\,g.~|pagesLTS.pnc.Roman|, % \item[-] \DescribeMacro{pagesLTS.double. page numbering scheme } % |pagesLTS.double.|, e.\,g.~|pagesLTS.double.Roman|, % \item[-] \DescribeMacro{PageCurrentLocal. page numbering scheme } % |PageCurrentLocal.|, e.\,g.~|PageCurrentLocal.Roman|, % \end{itemize} % for all page numbering schemes, even those not supported % by the current original |\pagenumbering| % (2020/12/05 Version v1.1a LaTeX Kernel File~33 ltpageno.dtx Page Numbering), which is % \begin{quote} %\begin{verbatim} %\countdef\c@page=0 \c@page=1 %\def\cl@page{} %\def\pagenumbering#1{% % \global\c@page \@ne \gdef\thepage{\csname @#1\endcsname % \c@page}} %\end{verbatim} % \end{quote} % % \begin{macrocode} \newcommand{\pagesLTS@providecounter}[1]{\@ifundefined{c@#1}{\newcounter{#1}}{}} % \end{macrocode} % % The command |\pagesLTS@ifcounter| is obsolete, but if a document was compiled % using an older version of the \xpackage{pageslts} package, % the command will still be in the \xfile{.aux} file. % (Following code will be removed in some future version.) % % \begin{macrocode} \NewCommandCopy{\pagesLTS@ifcounter}{\pagesLTS@providecounter} \AddToHook{begindocument}{% % \end{macrocode} % % This hook is executed after the \xfile{.aux} file has been read, % so there should be no following |\pagesLTS@ifcounter|. % % \begin{macrocode} \AddToHookWithArguments{cmd/pagesLTS@ifcounter/before}{% \PackageError{pageslts}{Old command \string\pagesLTS@ifcounter\space used}{% Replace by \string\pagesLTS@providecounter.}% }% } % \end{macrocode} % \end{macro} % % \begin{macro}{\lastpages} % We provide a command to give the number of pages in a sector % of a split page numbering scheme (see page~\pageref{pagesLTS.pnscheme.nr},\newline % |pagesLTS...local.cnt|): % % \begin{macrocode} \newcommand{\lastpages}[2]{% \pagesLTS@providecounter{pagesLTS.#1.#2.local.cnt}% \arabic{pagesLTS.#1.#2.local.cnt}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\pagesLTS@writelabel} % At last defining the writing of a label: % % \begin{macrocode} \newcommand{\pagesLTS@writelabel}[1]{% \addtocounter{page}{+1}% % \end{macrocode} % % |\addtocounter{page}{+1}| because |\pagesLTS@putlabel| includes an\newline % |\addtocounter{page}{-1}|, which is not necessary here.\newline % Into the \xfile{.aux} file something like\newline % |\newlabel{pagesLTS.Roman}{{}{VIII}{}{page.VIII}{}}|\newline % is written, thus |\lastpageref{pagesLTS.Roman}| prints |VIII| and % links to |page.VIII|. % % \begin{macrocode} \pagesLTS@putlabel{pagesLTS.#1}{\thepage}{1}% % \end{macrocode} % % |\addtocounter{page}{-1}| is skipped, because another |\pagesLTS@putlabel| follows. % % \begin{macrocode} \ifx\pagesLTS@pnc\pagesLTS@zero% % \end{macrocode} % % i.\,e.~if the current page numbering scheme is \textquotedblleft 0\textquotedblright, % i.\,e.~before the first |\pagenumbering{...}| command, do nothing, % % \begin{macrocode} \else% % \end{macrocode} % % otherwise write into the \xfile{.aux} file something like\newline % |\newlabel{pagesLTS.arabic.local}{{}{6}{}{page.9}{}}|,\newline % thus |\lastpageref{pagesLTS.arabic.local}| prints |6| and links to |page.9|.\bigskip % % |\addtocounter{page}{+1}| is skipped, because we skipped the |\addtocounter{page}{-1}| above. % % \begin{macrocode} \pagesLTS@putlabel{pagesLTS.#1.local}{\theCurrentPageLocal}{1}% % \end{macrocode} % % |\addtocounter{page}{-1}| immediately after the |\pagesLTS@putlabel| is skipped, % because we do that outside of the |\ifx \else \fi|. % % \begin{macrocode} \fi% \addtocounter{page}{-1}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\erroralphalph} % |\erroralphalph| extends the \textquotedblleft numbers\textquotedblright\ of % counters to zero and negative values for representations usually not supporting this: % |\alphalph|, |\AlphAlph|, and |\fnsymbolmult| of the \xpackage{alphalph} package.\newline % |\alph|, |\Alph|, and |\fnsymbol| would not support % \textquotedblleft numbers\textquotedblright\ below one.\newline % |\arabic| already supports negative numbers and zero.\newline % |\roman| and |\Roman| support neither negative numbers nor zero, but are expanded % in this package (|\xroman| and |\XRoman|), see page~\pageref{xroman}. % \begin{macrocode} %% The following code is from Heiko Oberdiek [2010/04/18], %% %% expanding his alphalph package as of 2010/04/18, v2.3. (Thanks!) %% \newcommand*{\erroralphalph}[2]{% \ifnum\value{#2}>0% #1{\value{#2}}% \else% \ifnum\value{#2}<0% -#1{\expandafter\@gobble\the\value{#2}}% \else% 0% \fi% \fi% } %% End of code from Heiko Oberdiek %% %% Check and Error/Warning messages have been moved to hook "shipout/foreground" %% %% because messages inside e.g. the \pageref command can cause trouble. %% % \end{macrocode} % \end{macro} % % \newpage % \begin{macro}{\expandPagenumbering} % Here the |\erroralphalph| command is called with the % appropriate arguments for each page numbering scheme. % % \begin{macrocode} \newcommand{\expandPagenumbering}[1]{% \let\Origthepage\thepage% \def\pagesLTS@tmpC{arabic}% \ifx\pagesLTS@pnc\pagesLTS@tmpC% % \end{macrocode} % % |\arabic| already supports negative numbers and zero % (|-MAX...MAX|, where |MAX|\,$ = 2\,147\,483\,647$). % % \begin{macrocode} \else% \def\pagesLTS@tmpC{roman}% \ifx\pagesLTS@pnc\pagesLTS@tmpC% \ifpagesLTS@romanMult% % \end{macrocode} % % |\erroralphalph{\roman}{page}| cannot be used, because % |-\roman{\expandafter\@gobble\the\value{page}}| does not work. % If option |romanMult| is not false, % |\xroman| (see page~\pageref{xroman}) expands the usable % roman page numbers to values below 1 (i, I, respectively), % see subsubsection~\ref{sss:romanMult}. % % \begin{macrocode} \renewcommand*{\thepage}{\xroman{page}}% \fi% \else% \def\pagesLTS@tmpC{Roman}% \ifx\pagesLTS@pnc\pagesLTS@tmpC% % \end{macrocode} % % The same for |\Roman| page numbering, expanded by |\XRoman| % (see page~\pageref{xroman}). When the \xpackage{romanbar} package % has been loaded, the page format is changed accordingly. % % \begin{macrocode} \IfPackageLoadedTF{romanbarpagenumber}{% \ifpagesLTS@RomanMulti% \renewcommand*{\thepage}{\Roman@bar{\XRoman{page}}}% \else% \renewcommand*{\thepage}{\Roman@bar{page}}% \fi% }{\ifpagesLTS@RomanMulti% \renewcommand*{\thepage}{\XRoman{page}}% \fi% }% \else% \ifx\pagesLTS@pnc\pagesLTS@alph% % \end{macrocode} % % |\alph| and |\Alph| page numberings are expanded to negative % and zero values, and to values greater than % \textquotedblleft z\textquotedblright{} or % \textquotedblleft Z\textquotedblright{} with the % \xpackage{alphalph} package.~-- % If |\pagesLTS@alphMult| was zero, nothing is done. % % \begin{macrocode} \ifx\pagesLTS@alphMult\pagesLTS@ab% \renewcommand*{\thepage}{\erroralphalph{\alphalph}{page}}% \else% \ifx\pagesLTS@alphMult\pagesLTS@bb% \renewcommand*{\thepage}{\erroralphalph{\alphMult}{page}}% \fi% \fi% \else% \ifx\pagesLTS@pnc\pagesLTS@Alph% \ifx\pagesLTS@AlphMulti\pagesLTS@ABi% \renewcommand*{\thepage}{\erroralphalph{\AlphAlph}{page}}% \else% \ifx\pagesLTS@AlphMulti\pagesLTS@BBi% \renewcommand*{\thepage}{\erroralphalph{\AlphMult}{page}}% \fi% \fi% \else% \ifx\pagesLTS@pnc\pagesLTS@fns% % \end{macrocode} % % Same for |\fnsymbol| page numbers. % % \begin{macrocode} \ifpagesLTS@fnsymbolmult% \renewcommand*{\thepage}{\erroralphalph{\fnsymbolmult}{page}}% \fi% \else% % \end{macrocode} % % For |silly| page numbers (from the \xpackage{sillypage} package), % |\thepage| is |\csname @silly\endcsname \c@page|, \mbox{i.\,e.}~|\@silly \c@page| % --~no change needed. % % \begin{macrocode} \ifx\pagesLTS@pnc\pagesLTS@silly% \else% % \end{macrocode} % % For |gobble| page numbers, |\thepage| is |\csname @gobble\endcsname \c@page|, % \mbox{i.\,e.}~|\@gobble \c@page| and |\@gobble| is \linebreak% % |\long\def \@gobble #1{}|, \mbox{i.\,e.}~|\thepage| is |{}|. This is OK, % but \xpackage{hyperref} does not create links when there is no linktext. % Thus we give |\null| as text for the page number, which prints as nothing % but makes \xpackage{hyperref} happy -- although not happy enough yet: % |\null| expands to |\hbox {}|, and \xpackage{hyperref} complains %\begin{verbatim} %Package hyperref Warning: Token not allowed in a PDF string (Unicode): %(hyperref) removing `\hbox' on input line . % %Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding): %(hyperref) removing `\hbox' on input line . %\end{verbatim} % To make \xpackage{hyperref} extra happy, we tell it to not use |\null| as % PDF string. % % \begin{macrocode} \ifx\pagesLTS@pnc\pagesLTS@gobble% \IfPackageLoadedT{hyperref}{% \renewcommand*{\thepage}{\texorpdfstring{\null}{{}}% \csname @gobble\endcsname \c@page}}% \else% % \end{macrocode} % % % If the used page numbering scheme has not been recognized by the % \xpackage{pageslts} package so far, we can do nothing, and problems % might result. % % \begin{macrocode} \PackageError{pageslts}{unknown page numbering scheme}{% The pageslts package encountered the unknown\MessageBreak% page numbering scheme\MessageBreak% \meaning#1. \MessageBreak% If this is no typing mistake, it might work\MessageBreak% - or it might not work.\MessageBreak% \@ehc}% \fi\fi\fi\fi\fi\fi\fi\fi% \let\pagesLTS@tmpC\undefined% } % \end{macrocode} % \end{macro} % % \begin{macro}{\pagenumbering} % To keep the original meaning of |\pagenumbering|: % % \begin{macrocode} \NewCommandCopy{\OrigPagenumbering}{\pagenumbering} % \end{macrocode} % % Now for the \textbf{new} version of the |\pagenumbering| command: % % \begin{macrocode} \renewcommand{\pagenumbering}[1]{% % \end{macrocode} % % If the current page numbering scheme, |\pagesLTS@pnc|, % and the requested page numbering scheme, |#1|, is the same one, % nothing is done, otherwise the real action begins. % % \begin{macrocode} \edef\pagesLTS@tmpA{#1}% \ifx\pagesLTS@pnc\pagesLTS@tmpA% \else% % \end{macrocode} % % If the requested page numbering scheme, |#1|, is~|\pagesLTS@fns|, % \mbox{i.\,e.}~\texttt{fnsymbol}, the counter\texttt{pagesLTS.fnsymbol.local} % is needed. If it does not exists yet, it is created here. % Same for the |silly| and |gobble| page numbering schemes. % % \begin{macrocode} \ifx\pagesLTS@tmpA\pagesLTS@fns% \pagesLTS@providecounter{pagesLTS.fnsymbol.local}% \fi% \ifx\pagesLTS@tmpA\pagesLTS@silly% \IfPackageLoadedF{sillypage}{\PackageError{pageslts}{% silly pagenumbering requested, sillypage package not loaded}{% When using \string\pagenumbering{silly},\MessageBreak% load the sillypage package.}}% \pagesLTS@providecounter{pagesLTS.silly.local}% \fi% \ifx\pagesLTS@tmpA\pagesLTS@gobble% \pagesLTS@providecounter{pagesLTS.gobble.local}% \fi% % \end{macrocode} % % The next code is executed, when we are at a page after the first one. % This distinction is done for two reasons:\newline % On the one hand, |\pagenumbering| could be called \textit{before} % |\begin{document}| (where the current page should not be % greater than one), and on the other hand we go one page back to % aim all references to that page. Obviously at the first page % there is no going backward. % % \begin{macrocode} \ifnum\value{CurrentPage}>1% \addtocounter{page}{-1}% \addtocounter{pagesLTS.current.local.\pagesLTS@pnc}{-1}% % \end{macrocode} % % For the case that the page numbering scheme is or will be split, % like e.\,g.~the Roman one in the |pageslts-example.tex|, a~counter like % |pagesLTS.Roman.1.local.count| (or |pagesLTS.Roman.2.local.count|, % |pagesLTS.Roman.3.local.count|,\ldots ) is introduced and set to the % number of the local page. % % \begin{macrocode} \newcounter{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}.local.count}% \setcounter{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}.local.count}{% \value{pagesLTS.current.local.\pagesLTS@pnc}}% % \end{macrocode} % % If the page numbering scheme is |fnsymbol|, and if it \textit{was} used before, % from said counter the number of pages of the preceding uses % of the same page numbering scheme, |pagesLTS.\pagesLTS@pnc.done|, % is subtracted (same as for the other schemes, see below). % The same is done for the |silly| and |gobble| page numbers. % % \begin{macrocode} \ifx\pagesLTS@pnc\pagesLTS@fns% \ifnum\value{pagesLTS.pnc.\pagesLTS@pnc}>1% \setcounter{pagesLTS.tmpcounter}{\numexpr\value{pagesLTS.pnc.\pagesLTS@pnc}-1\relax}% \addtocounter{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}.local.count}{% -\value{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.tmpcounter}.local.count}}% \fi% \else% \ifx\pagesLTS@pnc\pagesLTS@silly% \ifnum\value{pagesLTS.pnc.\pagesLTS@pnc}>1% \setcounter{pagesLTS.tmpcounter}{\numexpr\value{pagesLTS.pnc.\pagesLTS@pnc}-1\relax}% \addtocounter{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}.local.count}{% -\value{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.tmpcounter}.local.count}}% \fi% \else% \ifx\pagesLTS@pnc\pagesLTS@gobble% \ifnum\value{pagesLTS.pnc.\pagesLTS@pnc}>1% \setcounter{pagesLTS.tmpcounter}{\numexpr\value{pagesLTS.pnc.\pagesLTS@pnc}-1\relax}% \addtocounter{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}.local.count}{% -\value{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.tmpcounter}.local.count}}% \fi% \else% % \end{macrocode} % % If the page numbering scheme is % \textit{neither} |fnsymbol| \textit{nor} |silly| \textit{nor} |gobble| % and if the page numbering scheme was \textit{not} used before, % an unnumbered label is also written: % % \begin{macrocode} \ifnum\value{pagesLTS.pnc.\pagesLTS@pnc}<2% \pagesLTS@writelabel{\pagesLTS@pnc}% \fi% \fi% \fi% % \end{macrocode} % % For all page numbering schemes: If the page numbering scheme \textit{was} used before, % from said counter the number of pages of the preceding uses % of the same page numbering scheme, |pagesLTS.\pagesLTS@pnc.done|, % is subtracted -- except if option |pagenumbering=false| has been chosen, % because then the pagenumbers are reset anyway. % % \begin{macrocode} \ifnum\value{pagesLTS.pnc.\pagesLTS@pnc}>1% \ifpagesLTS@pagecontinue% \setcounter{pagesLTS.tmpcounter}{\numexpr\value{pagesLTS.pnc.\pagesLTS@pnc}-1\relax}% \pagesLTS@providecounter{pagesLTS.\pagesLTS@pnc.done}% \addtocounter{pagesLTS.\pagesLTS@pnc.done}{% \value{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.tmpcounter}.local.count}}% \addtocounter{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}.local.count}{% -\value{pagesLTS.\pagesLTS@pnc.done}}% \fi% \fi% % \end{macrocode} % % A~numbered label is written: % % \begin{macrocode} \pagesLTS@writelabel{\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}}% % \end{macrocode} % % The values are written to the \xfile{.aux} file (if writing is allowed: |\if@filesw|), % because they must be available at the beginning of the document: % % \begin{macrocode} \if@filesw% \immediate\write\@auxout{\string \pagesLTS@providecounter{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}.local.cnt}}% \edef\pagesLTS@tmpB{\arabic{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}.local.count}}% \immediate\write\@auxout{\string \setcounter{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}.local.cnt}{\pagesLTS@tmpB}}% \fi% \fi% % \end{macrocode} % % For further code for the case of |fnsymbol| please see below % (|\lastpagereftext|, page~\pageref{lastpagereftextlabel}).\newline % The last page number is saved, in case the same page % numbering scheme is continued later. % % \begin{macrocode} \pagesLTS@providecounter{pagesLTS.double.\pagesLTS@pnc}% \setcounter{pagesLTS.double.\pagesLTS@pnc}{\value{page}}% % \end{macrocode} % % We went back one page, so we must go forward again: % % \begin{macrocode} \addtocounter{pagesLTS.current.local.\pagesLTS@pnc}{+1}% \addtocounter{page}{+1}% % \end{macrocode} % % The page numbering scheme |\pagesLTS@pnc| is now set to the new one, % given by the user as argument with the |\pagenumbering{...}| command: % % \begin{macrocode} \xdef\pagesLTS@pnc{#1}% % \end{macrocode} % % If option |pagecontinue=false| was chosen, the local page count is reset to~1. % % \begin{macrocode} \ifpagesLTS@pagecontinue% \else% \pagesLTS@providecounter{pagesLTS.current.local.\pagesLTS@pnc}% \setcounter{pagesLTS.current.local.\pagesLTS@pnc}{1}% \fi% % \end{macrocode} % % The new page numbering scheme is now started for real: % % \begin{macrocode} \OrigPagenumbering{#1}% % \end{macrocode} % % If a page numbering scheme not known by the original |\pagenumbering{...}| command is used, % an error will arise here - but maybe without error message.\bigskip % % If page numbering scheme |\alph|, |\Alph|, or |\fnsymbol| is used, % \xpackage{pageslts} extends the page numbers according to the given options, % using the \xpackage{alphalph} package. |\arabic| does not need any expansion. % |\roman| and |\Roman| at least receive a definition for zero. % % \begin{macrocode} \expandPagenumbering{#1}% % \end{macrocode} % % Counters like |pagesLTS.pnc.Roman| are introduced: % % \begin{macrocode} \pagesLTS@providecounter{pagesLTS.pnc.\pagesLTS@pnc}% % \end{macrocode} % % The saved number of times, this page numbering scheme was used, is increased by one: % % \begin{macrocode} \addtocounter{pagesLTS.pnc.\pagesLTS@pnc}{1}% % \end{macrocode} % % Now defining the counter |pagesLTS.double.\pagesLTS@pnc|, % if it did not exist already, adding~1, because this is the first page of it % (or another one, if the scheme is continued): % % \begin{macrocode} \pagesLTS@providecounter{pagesLTS.double.\pagesLTS@pnc}% \addtocounter{pagesLTS.double.\pagesLTS@pnc}{1}% % \end{macrocode} % % The page number is continued, if the option |pagecontinue=false| is \textbf{not} set, % otherwise it is reset to one. Note that neither the local nor the current counter are reset, % as they contain the real \textit{values} and not the \textit{names} of the pages. % % \begin{macrocode} \ifpagesLTS@pagecontinue% \setcounter{page}{\value{pagesLTS.double.\pagesLTS@pnc}}% \else% \setcounter{page}{1}% \fi% % \end{macrocode} % % If it does not exist already, the counter |pagesLTS.current.local.\pagesLTS@pnc| % \mbox{(e.\,g.} |pagesLTS.current.local.Roman|) is created. % % \begin{macrocode} \pagesLTS@providecounter{pagesLTS.current.local.\pagesLTS@pnc}% % \end{macrocode} % % If |pagesLTS.double.\pagesLTS@pnc| of the current page numbering % scheme is equal to one, this is the first page of this page numbering scheme. % Then |pagesLTS.current.local.\pagesLTS@pnc| (which was zero) is set to one. % % \begin{macrocode} \ifnum\value{pagesLTS.double.\pagesLTS@pnc}=1% \setcounter{pagesLTS.current.local.\pagesLTS@pnc}{1}% \fi% % \end{macrocode} % % Otherwise, i.\,e.~if |\value{CurrentPage}| is \mbox{not $>1$,} % i.\,e.~before the first page has shiped out: % % \begin{macrocode} \else% \ifx\pagesLTS@pnc\pagesLTS@zero\relax% \else% % \end{macrocode} % % |\pagenumbering{...}| has been called more than once before the end of the first page % (probably in the preamble). Let us reset the earlier |\pagenumbering|s, which % should not have any effect anyway: % % \begin{macrocode} \PackageNoteNoLine{pageslts}{% \string\pagenumbering\space used more than once before the end\MessageBreak% of the first page, maybe in the preamble.\MessageBreak% Resetting all unused page numbering schemes now}% \setcounter{pagesLTS.pnc.\pagesLTS@pnc}{0}% \setcounter{pagesLTS.double.\pagesLTS@pnc}{0}% \setcounter{pagesLTS.current.local.\pagesLTS@pnc}{0}% \fi% % \end{macrocode} % % The current page numbering scheme is defined by the argument of |\pagenumbering{...}|, % which the user gave: % % \begin{macrocode} \xdef\pagesLTS@pnc{#1}% % \end{macrocode} % % and the page numbering scheme set by the original page numbering command, % which resets the page number to one, but at the first page continuation does not make sense. % % \begin{macrocode} \OrigPagenumbering{#1}% % \end{macrocode} % % If a page numbering scheme is used, which is not known by \LaTeX, % an error might arise here -- but maybe without error message.\bigskip % % If page numbering scheme |\alph|, |\Alph|, or |\fnsymbol| is used, % \xpackage{pageslts} extends the page numbers according to the given options, % using the \xpackage{alphalph} package. |\arabic| does not need any expansion. % |\roman| and |\Roman| at least receive a definition for zero. % % \begin{macrocode} \expandPagenumbering{#1}% % \end{macrocode} % % We are at the first page, so the page counters are set to one: % % \begin{macrocode} \pagesLTS@providecounter{pagesLTS.pnc.\pagesLTS@pnc}% \setcounter{pagesLTS.pnc.\pagesLTS@pnc}{1}% \pagesLTS@providecounter{pagesLTS.double.\pagesLTS@pnc}% \setcounter{pagesLTS.double.\pagesLTS@pnc}{1}% \pagesLTS@providecounter{pagesLTS.current.local.\pagesLTS@pnc}% \setcounter{pagesLTS.current.local.\pagesLTS@pnc}{1}% \fi% % \end{macrocode} % % Whether |\pagenumbering{...}| is called in the preamble, % in the |begindocument| hooks, right after |\begin{document}|, % or somewhere in the document, we want to remember % \textit{whether} it was called at all: % % \begin{macrocode} \gdef\pagesLTS@called{1}% \fi% % \end{macrocode} % % We do not need the temporary definitions any more. % % \begin{macrocode} \let\pagesLTS@tmpA\undefined% \let\pagesLTS@tmpB\undefined% } % \end{macrocode} % \end{macro} % % \begin{macro}{\lastpageref*} % If \xpackage{hyperref} is used, but (some) references to some last page shall % not be hyperlinked, a~command |\lastpageref*| (analogous to |\pageref*|) % is needed. Therefore we define (analogous to |\HyPsd@pageref| from % the \xpackage{hyperref} package % % \begin{macrocode} %% analogous to \HyPsd@pageref from the hyperref package: \def\lastpagereftxt#1{\pagesLTS@@pageref#1*\END} % \end{macrocode} % % Macro |\pagesLTSpageref| checks, whether a star is present % (analogous to |\HyPsd@@pageref| again from the \xpackage{hyperref} package): % % \begin{macrocode} \def\pagesLTS@@pageref#1*#2\END{% \ifx\\#2\\% no star \pagesLTS@@@pageref{#1}% \else% star \expandafter\pagesLTS@@@pagerefstar% \fi% } \def\pagesLTS@@@pageref#1{\lastpagereftext{#1}} \def\pagesLTS@@@pagerefstar#1{\lastpagereftextstar{#1}} % \end{macrocode} % \end{macro} % % \phantomsection % \begin{macro}{\lastpagereftext}\label{lastpagereftextlabel}% % When |\lastpageref| is used somewhere inside the \texttt{txt} (text), % i.\,e.~not at the last page, it is defined as |\lastpagereftxt| (see above). % When the page numbering scheme is |fnsymbol|, and the \xpackage{hyperref} % package has been loaded, a hyperref instead of a label is used for the reference % to |pagesLTS.fnsymbol.local.\arabic{pagesLTS.fnsymbol.local}|. % (And if the \texttt{pagesLTS.fnsymbol.local} counter did not exist yet, % it is created here.)\bigskip % % \begin{macrocode} \newcommand{\lastpagereftext}[1]{% \def\pagesLTS@tmpA{#1}% \def\pagesLTS@tmpB{pagesLTS.fnsymbol.local}% \ifx\pagesLTS@tmpA\pagesLTS@tmpB% \pagesLTS@providecounter{pagesLTS.fnsymbol.local}% \IfPackageLoadedTF{hyperref}{% \href{\#pagesLTS.fnsymbol.local.\arabic{pagesLTS.fnsymbol.local}}% {\arabic{pagesLTS.fnsymbol.local}}% % \end{macrocode} % % When the page numbering scheme is |fnsymbol|, but the \xpackage{hyperref} package % has \textit{not} been loaded, just the arabic number of the % \texttt{pagesLTS.fnsymbol.local} counter is given % (because there will be no hyperlink anyway). % % \begin{macrocode} }{\arabic{pagesLTS.fnsymbol.local}}% \else% % \end{macrocode} % % Same for |silly| pagenumbering: % % \begin{macrocode} \def\pagesLTS@tmpB{pagesLTS.silly.local}% \ifx\pagesLTS@tmpA\pagesLTS@tmpB% \pagesLTS@providecounter{pagesLTS.silly.local}% \IfPackageLoadedTF{hyperref}{% \href{\#pagesLTS.silly.local.\arabic{pagesLTS.silly.local}}% {\arabic{pagesLTS.silly.local}}% }{\arabic{pagesLTS.silly.local}}% % \end{macrocode} % % and for |gobble| pagenumbering: % % \begin{macrocode} \else% \def\pagesLTS@tmpB{pagesLTS.gobble.local}% \ifx\pagesLTS@tmpA\pagesLTS@tmpB% \pagesLTS@providecounter{pagesLTS.gobble.local}% \IfPackageLoadedTF{hyperref}{% \href{\#pagesLTS.gobble.local.\arabic{pagesLTS.gobble.local}}% {\arabic{pagesLTS.gobble.local}}% }{\arabic{pagesLTS.gobble.local}}% % \end{macrocode} % % Otherwise just the common |\pageref| is applied: % % \begin{macrocode} \else% \pageref{#1}% \fi% \fi% \fi% % \end{macrocode} % % We do not need the temporary definitions any more. % % \begin{macrocode} \let\pagesLTS@tmpA\undefined% \let\pagesLTS@tmpB\undefined% } % \end{macrocode} % \end{macro} % % \begin{macro}{\lastpagereftextstar} % And the same for the starred version, where no hyperlink is generated: % % \begin{macrocode} \newcommand{\lastpagereftextstar}[1]{% \def\pagesLTS@tmpA{#1}% \def\pagesLTS@tmpB{pagesLTS.fnsymbol.local}% \ifx\pagesLTS@tmpA\pagesLTS@tmpB% \pagesLTS@providecounter{pagesLTS.fnsymbol.local}% \arabic{pagesLTS.fnsymbol.local}% \else% \def\pagesLTS@tmpB{pagesLTS.silly.local}% \ifx\pagesLTS@tmpA\pagesLTS@tmpB% \pagesLTS@providecounter{pagesLTS.silly.local}% \arabic{pagesLTS.silly.local}% \else% \def\pagesLTS@tmpB{pagesLTS.gobble.local}% \ifx\pagesLTS@tmpA\pagesLTS@tmpB% \pagesLTS@providecounter{pagesLTS.gobble.local}% \arabic{pagesLTS.gobble.local}% % \end{macrocode} % % There is no |\pageref*| without \xpackage{hyperref}. % % \begin{macrocode} \else% \IfPackageLoadedTF{hyperref}{\pageref*{#1}}{\pageref{#1}}% \fi% \fi% \fi% \let\pagesLTS@tmpA\undefined% \let\pagesLTS@tmpB\undefined% } % \end{macrocode} % \end{macro} % % \begin{macro}{\overrideLTSlabel} % |\overridelabel| from the \xpackage{undolabl} package just |\undonewlabel|s % a~label and places a new |\label{#1}|, but we need to place a % |\pagesLTS@putlabel{#1}{#2}|, therefore we need another command instead of % (but somewhat similar to) |\overridelabel|: % % \begin{macrocode} \newcommand\overrideLTSlabel[2]{% \@bsphack% \if@filesw% \edef\pagesLTS@tmpC{#1}% \edef\pagesLTS@tmpD{pagesLTS.\pagesLTS@pnc.local}% \ifx\pagesLTS@tmpC\pagesLTS@tmpD% \ifnum\value{pagesLTS.pnc.\pagesLTS@pnc}>1% \immediate\write\@auxout{\string\undonewlabel{#1}}\@overriddenmessage s{#1}% \else% \edef\pagesLTS@tmpD{fnsymbol}% \ifx\pagesLTS@pnc\pagesLTS@tmpD% \immediate\write\@auxout{\string\undonewlabel{#1}}\@overriddenmessage s{#1}% \fi% \edef\pagesLTS@tmpD{gobble}% \ifx\pagesLTS@pnc\pagesLTS@tmpD% \immediate\write\@auxout{\string\undonewlabel{#1}}\@overriddenmessage s{#1}% \fi% \edef\pagesLTS@tmpD{silly}% \ifx\pagesLTS@pnc\pagesLTS@tmpD% \immediate\write\@auxout{\string\undonewlabel{#1}}\@overriddenmessage s{#1}% \fi% \fi% \fi% \pagesLTS@putlabel{#1}{#2}{0}% \fi% \@esphack% } % \end{macrocode} % \end{macro} % % \begin{macro}{\pagesLTS@EveryShipout} % Because we cannot make references to pages with |fnsymbol| page % \textquotedblleft numbers\textquotedblright{} manually with \xpackage{hyperref}, % we use \nolinebreak{|\phantomsection|\,s} and refer to one of those. % But because we do not know how many \nolinebreak{|\phantomsection|\,s} and % \nolinebreak{|\section*|\,s} are introduced by the user (or other packages; % cf.~\LaTeX~bug~2298: knowing level of |section*|,\ % % \url{https://www.latex-project.org/cgi-bin/ltxbugs2html?pr=latex/2298&introduction=yes&state=open}), % we cannot refer to the last one as we did with the pages.\bigskip % % Therefore each page with |fnsymbol| page \textquotedblleft number\textquotedblright{} % % receives a |\phantomsection| and a label, which includes a number increased by one % for each page. This is done for % |pagesLTS.fnsymbol.local.\arabic{pagesLTS.fnsymbol.cont}| as well as % |pagesLTS.fnsymbol|, |pagesLTS.\pagesLTS@pnc|, and % |pagesLTS.\pagesLTS@pnc.local|.\newline % In case an older label already existed, it is overwritten by an |\overridelabel| command. % % \begin{macrocode} \newcommand{\pagesLTS@EveryShipout}{% \begingroup% \ifx\pagesLTS@pnc\pagesLTS@fns% \pagesLTS@providecounter{pagesLTS.fnsymbol.cont}% \addtocounter{pagesLTS.fnsymbol.cont}{1}% \IfPackageLoadedT{hyperref}{\phantomsection% \hypertarget{pagesLTS.fnsymbol.local.\arabic{pagesLTS.fnsymbol.cont}}{}% }% \ifnum\pagesLTS@esovFs=\pagesLTS@zero% \if@filesw\label{pagesLTS.fnsymbol}\fi% \pagesLTS@putlabel{pagesLTS.fnsymbol.local}{\theCurrentPageLocal}{0}% \else% \overridelabel{pagesLTS.fnsymbol}% \overrideLTSlabel{pagesLTS.fnsymbol.local}{\theCurrentPageLocal}% \fi% \else% % \end{macrocode} % % Same with |silly| page \textquotedblleft numbers\textquotedblright : % % \begin{macrocode} \ifx\pagesLTS@pnc\pagesLTS@silly% \pagesLTS@providecounter{pagesLTS.silly.cont}% \addtocounter{pagesLTS.silly.cont}{1}% \IfPackageLoadedT{hyperref}{\phantomsection% \hypertarget{pagesLTS.silly.local.\arabic{pagesLTS.silly.cont}}{}% }% \ifnum\pagesLTS@esovSy=\pagesLTS@zero% \if@filesw\label{pagesLTS.silly}\fi% \pagesLTS@putlabel{pagesLTS.silly.local}{\theCurrentPageLocal}{0}% \else% \overridelabel{pagesLTS.silly}% \overrideLTSlabel{pagesLTS.silly.local}{\theCurrentPageLocal}% \fi% \else% % \end{macrocode} % % and with |gobble| page \textquotedblleft numbers\textquotedblright : % % \begin{macrocode} \ifx\pagesLTS@pnc\pagesLTS@gobble% \pagesLTS@providecounter{pagesLTS.gobble.cont}% \addtocounter{pagesLTS.gobble.cont}{1}% \IfPackageLoadedT{hyperref}{\phantomsection% \hypertarget{pagesLTS.gobble.local.\arabic{pagesLTS.gobble.cont}}{}% }% \ifnum\pagesLTS@esovGbl=\pagesLTS@zero% \if@filesw\label{pagesLTS.gobble}\fi% \pagesLTS@putlabel{pagesLTS.gobble.local}{\theCurrentPageLocal}{0}% \else% \overridelabel{pagesLTS.gobble}% \overrideLTSlabel{pagesLTS.gobble.local}{\theCurrentPageLocal}% \fi% \else% \IfPackageLoadedT{hyperref}{\phantomsection}% \if@filesw% \overridelabel{pagesLTS.\pagesLTS@pnc}% \overrideLTSlabel{pagesLTS.\pagesLTS@pnc.local}{\theCurrentPageLocal}% \fi\fi\fi\fi% \endgroup% } % \end{macrocode} % \end{macro} % \newpage % \begin{macro}{\AddToHook{shipout/foreground}} % At the end of each shipout, the following commands are executed: % % \begin{macrocode} \AddToHook{shipout/foreground}{% \ifnum\value{page}>0% \else% \ifnum\value{page}=0% \PackageWarning{pageslts}{% Counter `page' is zero!\MessageBreak% If the page numbering scheme is not arabic\MessageBreak% and further not extended\MessageBreak% (see Page counter overflow in the pageslts\MessageBreak% documentation), without other measures\MessageBreak% this will lead to a counter overflow.\MessageBreak% }% \else% \ifnum\value{page}<0% \PackageWarning{pageslts}{% Counter `page' is negative: `\the\value{page}'!\MessageBreak% If the page numbering scheme is not arabic\MessageBreak% and further not extended\MessageBreak% (see Page counter overflow in the pageslts\MessageBreak% documentation), without other measures\MessageBreak% this will lead to a counter overflow.\MessageBreak% }% \else% \PackageError{pageslts}{Counter page has no recognized value}{% Counter `page' does not have a recognized value:\MessageBreak% `\the\value{page}'\MessageBreak% \@ehd\MessageBreak% }% \fi% \fi% \fi% % \end{macrocode} % % If the |CurrentPage| is equal to one, this is the first shipout. % % \begin{macrocode} \ifnum\value{CurrentPage}=1% % \end{macrocode} % % We check whether some page numbering scheme was defined by % |\pagenumbering{...}| (\textbf{as it schould be!}): % % \begin{macrocode} \ifx\pagesLTS@called\pagesLTS@zero% % \end{macrocode} % % If it was not defined (i.\,e. |\pagesLTS@called| is zero), % the user should be informed, that a |\pagenumbering{...}| % is missing behind |\begin{document}|. % Of course, it is possible that some package did some pages of output using % the |begindocument/end| hook. In that case, % one |\pagenumbering{...}| before |\begin{document}| and % one |\pagenumbering{...}| (with the same argument, of course!) % behind |\begin{document}| could help somewhat. When |\PackageError| % was used here, the error message was not written to the screen and % the \xfile{.log}-file, but into the document. Therefore we just make % a note to give the error message later (|\AddToHook{enddocument/afterlastpage}|). % At that time unfortunately most of the document has already been compiled % (or did not compile due to this error), but I do not know how to change that. % % \begin{macrocode} \gdef\pncmissing{1}% % \end{macrocode} % % We save the current value of the page, % % \begin{macrocode} \setcounter{pagesLTS.tmpcounter}{\value{page}}% % \end{macrocode} % % determine the current page numbering scheme, % % \begin{macrocode} %% Code from Andres L\"{o}h, Universiteit Utrecht (NL) %% \def\extract#1{\expandafter\extract@ #1\END}% \def\extract@#1\csname @#2\endcsname#3\END{#2}% \edef\pagesLTS@tmpQ{\extract\thepage}% %% End of code from Andres L\"{o}h %% % \end{macrocode} % % set the current page numbering scheme to~0 % (because before the beginning of the document it should be~0), % % \begin{macrocode} \def\pagesLTS@pnc{0}% % \end{macrocode} % % and then issue a |\pagenumbering| command with the determined % page numbering scheme as argument: % % \begin{macrocode} \expandafter\pagenumbering\expandafter{\pagesLTS@tmpQ}% % \end{macrocode} % % This resets the page to one (if option |pagecontinue=false| was chosen), % but because we do not start a new page numbering scheme here % but manifest a page numbering scheme, which the user forgot to define, % the page number should not have been reset to one. (This is the first page, % but maybe the user wants it to have page number 2024?) % Therefore we revert this here and set the page number to its value, % which was saved before the |\pagenumbering| command. % % \begin{macrocode} \setcounter{page}{\value{pagesLTS.tmpcounter}}% \fi% % \end{macrocode} % % We are at the first page, so we put the label here. % % \begin{macrocode} \pagesLTS@writelabel{0}% \fi% % \end{macrocode} % % If the current page numbering scheme |\pagesLTS@pnc| is |\pagesLTS@fns| % (which is defined as \texttt{fnsymbol}), the label is set by \linebreak % |\pagesLTS@EveryShipout| (see just above), % and |\pagesLTS@esovFs| is set to the (real) number (not the name) % of this page numbering scheme, |\arabic{pagesLTS.fnsymbol.cont}|.\newline % When no more pages with |fnsymbol| page % \textquotedblleft number\textquotedblright{} are shipped out, % the value remains fixed and we have our reference to the last page % of the |fnsymbol| page numbering range. % (At least we will have that reference after some more work, see below). % % \begin{macrocode} \ifx\pagesLTS@pnc\pagesLTS@fns% \pagesLTS@EveryShipout% \xdef\pagesLTS@esovFs{\arabic{pagesLTS.fnsymbol.cont}}% \else% % \end{macrocode} % % Same for |silly| page \textquotedblleft number\textquotedblright : % % \begin{macrocode} \ifx\pagesLTS@pnc\pagesLTS@silly% \pagesLTS@EveryShipout% \xdef\pagesLTS@esovSy{\arabic{pagesLTS.silly.cont}}% \else% % \end{macrocode} % % and for |gobble| page \textquotedblleft number\textquotedblright : % % \begin{macrocode} \ifx\pagesLTS@pnc\pagesLTS@gobble% \pagesLTS@EveryShipout% \xdef\pagesLTS@esovGbl{\arabic{pagesLTS.gobble.cont}}% % \end{macrocode} % % When another page numbering scheme was reused (in the example file \xpackage{Roman}), % we also need to apply |\pagesLTS@EveryShipout|, % because otherwise we would get multiply defined labels. % % \begin{macrocode} \else% \ifnum\value{pagesLTS.pnc.\pagesLTS@pnc}>1% \pagesLTS@EveryShipout% \fi\fi\fi\fi% % \end{macrocode} % % The |CurrentPage| as well as the |pagesLTS.current.local.\pagesLTS@pnc| % are advanced by one (because one page was shipped out and the next is about to begin). % % \begin{macrocode} \addtocounter{CurrentPage}{1}% \addtocounter{pagesLTS.current.local.\pagesLTS@pnc}{1}% } % \end{macrocode} % \end{macro} % % We use some code from the \xpackage{lastpage} package: % % \begin{macro}{\protected@iwrite} % We need an |\immediate\protected@write|. Just |\immediate\write| had led to errors, % for example when packages like \xpackage{babel-greek} re-defined |\roman|. % % \begin{macrocode} %% Code provided by Prof. Enrico Gregorio at https://tex.stackexchange.com/a/542425 \long\def\protected@iwrite#1#2#3{% \begingroup% #2% \let\protect\@unexpandable@protect% \edef\reserved@a{\immediate\write#1{#3}}% \reserved@a% \endgroup% \if@nobreak\ifvmode\nobreak\fi\fi% } % \end{macrocode} % \end{macro} % % \begin{macro}{\pagesLTS@makeHy} % Just once we need the page from |\@currentHpage| without any % \mbox{\textquotedblleft |page.|\textquotedblright} % (|\pagesLTS@makeHy| is identical to |\lastpage@makeHy| except of the used namings % --~well, being identical depends on the versions of the packages): % \begin{macrocode} \newcommand{\pagesLTS@makeHy}{% % \end{macrocode} % |\gdef\pagesLTS@Hy{}|, but that was already done before this command. % \begin{macrocode} \xdef\pagesLTS@Hptest{Doc-Start}% \ifx\pagesLTS@Hptest\@currentHpage\relax% \gdef\pagesLTS@Hy{\@currentHpage}% \else% \edef\pagesLTS@Hptest{\@currentHpage}% \ifx\pagesLTS@Hptest\empty\relax% % \end{macrocode} % then |\gdef\pagesLTS@Hy{}|, but that was already done before this command. % \begin{macrocode} \else% \edef\pagesLTS@Hptest{page.}% \ifx\@currentHpage\pagesLTS@Hptest\relax% \ifx\pagesLTS@pnc\pagesLTS@gobble% \PackageNoteNoLine{pageslts}{% With gobbled page numbers "\string\@currentHpage "\MessageBreak% is just "page." without number.\MessageBreak% "\string\pagesLTSlastpageHy " is now let empty}% \else% \PackageWarningNoLine{pageslts}{% \string\@currentHpage\space is just "page." without number.\MessageBreak% \string\pagesLTSlastpageHy\space is now let empty}% \fi% % \end{macrocode} % then in both cases |\gdef\pagesLTS@Hy{}|, but that was already done before this command. % \begin{macrocode} \else% % \end{macrocode} % |\@currentHpage| should be |page.|, |\pagesLTS@rmpage| removes the % \mbox{\textquotedblleft |page.|\textquotedblright .}\newline % Next compilation run, |\pagesLTSlastpageHy| gets defined via the \xfile{aux} file. % If we arrived at this place, but the definition is still empty, % then |\@currentHpage| has some unexpected content. % \begin{macrocode} \gdef\pagesLTS@Hy{\pagesLTS@rmpage{\@currentHpage}}% \ifx\pagesLTSlastpageHy\empty\relax% \PackageWarningNoLine{pageslts}{% \string\@currentHpage\space is\MessageBreak% \meaning\@currentHpage\MessageBreak% not beginning with "page.",\MessageBreak% \string\pagesLTSlastpageHy\space is now let empty}% \fi\fi\fi\fi% }% % \end{macrocode} % \end{macro} % % \begin{macro}{\pagesLTS@rmpage} % |\pagesLTS@rmpage| removes the \mbox{\textquotedblleft |page.|\textquotedblright.} % % \begin{macrocode} %% Code provided by David Carlisle at https://tex.stackexchange.com/a/721877 \def\pagesLTS@rmpage#1{% \expandafter\xpagesLTS@rmpage\expanded{#1}\xpagesLTS@rmpage page.% \xpagesLTS@rmpage\xxpagesLTS@rmpage{#1}} \def\xpagesLTS@rmpage #1page.#2\xpagesLTS@rmpage#3\xxpagesLTS@rmpage#4{% \if$\detokenize{#1}$#2%\else#4 \fi} % \end{macrocode} % |\else#4| means, that it did not start with |page.|, and whatever it is, % we cannot use this |#4| for |\pagesLTS@Hy|. % \end{macro} % \newpage % \phantomsection % \begin{macro}{\pagesLTS@putlabel}\label{pagesLTSputlabel} % Since the page has been put out, we are on the page after % that page. We therefore subtract one from the page counter. % % \begin{macrocode} \newcommand{\pagesLTS@putlabel}[3]{% \addtocounter{page}{-1}% % \end{macrocode} % % When the \xpackage{showkeys} package has been loaded in \texttt{draft} mode, % in the margin for each label a box is displayed with the name of the label. % \xpackage{showkeys} accomplishes this by redefining |\label|, % but \xpackage{pageslts} does not use |\label|, but writes directly to the % {\nobreak |\jobname|\xfile{.aux}-}\allowbreak file, and this is generally done % \emph{after} the according page has shipped out, therefore no box can be placed % on the \emph{preceding} page. At least \xpackage{pageslts} gives a warning, that % \xpackage{showkeys} cannot present the respective label. % % \begin{macrocode} \IfPackageLoadedT{showkeys}{% \IfPackageLoadedWithOptionsF{showkeys}{final}{% \ifnum\value{pagesLTS.pagenr}<1% \PackageWarningNoLine{pageslts}{% Package showkeys without option final loaded,\MessageBreak% but label #1 on page \thepage\space(about \theCurrentPage)\MessageBreak% cannot be shown, because pageslts does not use \string\label,\MessageBreak% but writes directly to the \jobname.aux file}% \else% \PackageWarningNoLine{pageslts}{% Package showkeys without option final loaded,\MessageBreak% but label #1 on page \thepage\space(about \theCurrentPage\space of \arabic{pagesLTS.pagenr})\MessageBreak% cannot be shown, because pageslts does not use \string\label,\MessageBreak% but writes directly to the \jobname.aux file}% \fi% }% }% \IfPackageLoadedTF{hyperref}{% % \end{macrocode} % % Here the labels are set, if the \xpackage{hyperref} package % was loaded. Simply using |\label| would not work, because labels % wait for the output routines to work, and there may not be any % more invocations of the output routines. To force the write out % we need to do an |\immediate| write (|\protected@iwrite|). % % \begin{macrocode} \ifHy@pageanchor\else% % \end{macrocode} % % If the \xpackage{hyperref} package is used, but pageanchors are disabled, % the hyperlinking will not work. % % \begin{macrocode} \PackageWarningNoLine{pagesLTS}{% The \string\lastpageref{#1} link does not work\MessageBreak% using hyperref with disabled option `pageanchor'.\MessageBreak% Better enable `pageanchor' or use\MessageBreak% \string\lastpageref*{...} (not generating a link)% }% \fi% % \end{macrocode} % \newpage % If use of the \xfile{.aux}-file is allowed, the label for \texttt{LastPage} % is written into that file, the page reference depending on the options, % which where set for the \xpackage{hyperref} package. % % \begin{macrocode} \if@filesw% \begingroup% \protected@iwrite\@auxout{}{\string\newlabel{#1}{% {\@currentlabel}{#2}{\@currentlabelname}% {\ifx\pagesLTS@pnc\pagesLTS@fns% \@currentHref% \else\ifx\pagesLTS@pnc\pagesLTS@silly% \@currentHref% \else\ifx\pagesLTS@pnc\pagesLTS@gobble% \@currentHref% \else\ifHy@pageanchor\@currentHpage\fi% \fi\fi\fi% }% {\@kernel@reserved@label@data}}}% \endgroup% \fi% }{% % \end{macrocode} % % If the \xpackage{hyperref} package is not used, there will be no hyperlinks, % and the label is written in the way of the \xpackage{lastpage} package. % But we must remember to undo the label first, if it already exists. % % \begin{macrocode} \if@filesw% \ifnum\value{pagesLTS.pnc.\pagesLTS@pnc}<2% \protected@iwrite\@auxout{}{\string\newlabel{#1}{% {\@currentlabel}{#2}{\@currentlabelname}% {\@currentHref}{\@kernel@reserved@label@data}}% }% \else% \edef\pagesLTS@tmpC{#1}% \edef\pagesLTS@tmpD{pagesLTS.\pagesLTS@pnc.local}% \ifx\pagesLTS@tmpC\pagesLTS@tmpD% \edef\pagesLTS@tmpC{#3}% \ifx\pagesLTS@tmpC\pagesLTS@one% % \end{macrocode} % % Only when the third argument of |\pagesLTS@putlabel| is $1$, we do need to undo the label. % Otherwise there is no label to undo, and the \xpackage{undolabl} package would give an error. % % \begin{macrocode} \immediate\write\@auxout{\string\undonewlabel{#1}}% \fi% \fi% \protected@iwrite\@auxout{}{\string\newlabel{#1}{% {\@currentlabel}{#2}{\@currentlabelname}% {\@currentHref}{\@kernel@reserved@label@data}}% }% \fi% \fi% }% % \end{macrocode} % % After the writeout we restore the page number again, since there might be other things still to be done. % % \begin{macrocode} \addtocounter{page}{+1}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\pagesLTS@putlabels} % |\pagesLTS@putlabels| writes labels and calls |\pagesLTS@putlabel{LastPages}{\theCurrentPage}{1}|. % % \begin{macrocode} \newcommand{\pagesLTS@putlabels}{% \addtocounter{page}{-1}% \addtocounter{CurrentPage}{-1}% \addtocounter{pagesLTS.current.local.\pagesLTS@pnc}{-1}% % \end{macrocode} % % If |\pagenumbering{...}| has not been used, |\pagesLTS@pnc| is still zero ($0$, |\pagesLTS@zero|), % and the according warning message is given. % % \begin{macrocode} \ifx\pagesLTS@pnc\pagesLTS@zero% \PackageWarningNoLine{pagesLTS}{No page numbering scheme found:\MessageBreak% \pagesLTS@messageNPN}% % \end{macrocode} % % otherwise the numbered label is written, and % if the page numbering scheme was not used before, also the unnumbered label is written. % % \begin{macrocode} \else% \pagesLTS@writelabel{\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}}% \ifnum\value{pagesLTS.pnc.\pagesLTS@pnc}<2% \ifx\pagesLTS@pnc\pagesLTS@fns% \else\ifx\pagesLTS@pnc\pagesLTS@silly% \else\ifx\pagesLTS@pnc\pagesLTS@gobble% \else\pagesLTS@writelabel{\pagesLTS@pnc}% \fi\fi\fi\fi\fi% % \end{macrocode} % % Before the label for the \texttt{LastPages} can be put, we must advance one page again, % because |\pagesLTS@putlabel| itself goes back one page (and at its end forward again). % % \begin{macrocode} \addtocounter{page}{+1}% \pagesLTS@putlabel{LastPages}{\theCurrentPage}{1}% % \end{macrocode} % % Here should follow a\newline % |\addtocounter{page}{-1}|,\newline % but we have to remember to increase the page counters again, % which were decreased at the start of this |\pagesLTS@putlabels| command, % and that would include\newline % |\addtocounter{page}{+1}|,\newline % therefore these two lines cancel each other and therefore they just can be skipped. % But the other counters have to be increased again: % % \begin{macrocode} \addtocounter{CurrentPage}{+1}% \addtocounter{pagesLTS.current.local.\pagesLTS@pnc}{+1}% } % \end{macrocode} % \end{macro} % \newpage % \begin{macro}{\AddToHook\{begindocument/end\}} % |\AddToHook{begindocument/end}{|\ldots |}|: % \begin{macrocode} \AddToHook{begindocument/end}{% % \end{macrocode} % % Checking, whether \xpackage{lastpage} and \xpackage{pageslts} have \emph{both} been loaded. % % \begin{macrocode} \IfPackageLoadedT{lastpage}{% \PackageNoteNoLine{pageslts}{Packages lastpage and pageslts used:\MessageBreak% Are you sure that you want to load both packages?}% }% % \end{macrocode} % % It is checked whether the \xpackage{hyperref} package, if loaded, is recent enough: % % \begin{macrocode} \IfPackageLoadedTF{hyperref}{% \ProvideTextCommand{\textasteriskcentered}{PD1}{*}% \IfPackageAtLeastF{hyperref}{2024-10-30}{% \PackageError{pageslts}{hyperref package version too old}{% Required version: 2024-10-30 v7.01k or newer,\MessageBreak% found version:\space\space\space\space\csname ver@hyperref.sty\endcsname.}}% }{\PackageNoteNoLine{pageslts}{Package hyperref not loaded.\MessageBreak% pageslts would support hyperref.\MessageBreak% The page references will NOT be hyperlinked}% }% % \end{macrocode} % % Further it is checked whether the \xpackage{alphalph} package has been loaded. % If that is the case, the commands are defined accordingly. % % \begin{macrocode} \IfPackageLoadedT{alphalph}{% \newalphalph{\AlphMult}[mult]{\@Alph}{26}% \newalphalph{\alphMult}[mult]{\@alph}{26}% \newalphalph{\fnsymbolmult}[mult]{\@fnsymbol}{5}% }% % \end{macrocode} % % It is checked whether writing to files is allowed. % The \xpackage{pageslts} package cannot be used without that! % Some packages (e.\,g.~\xpackage{tikz} and \xpackage{selectp}) sometimes prevent % the output to the \xfile{aux} file. In that case a warning or an error message % is issued. This is no problem as long as there is/was another compilation run % where the labels can/could be processed via the \xfile{aux} file.\bigskip % % \begin{macrocode} \if@filesw% \else% \IfPackageLoadedTF{tikz}{% \PackageWarning{pageslts}% {It was not allowed to write to an\MessageBreak% .aux file. This package does not work without access\MessageBreak% to an .aux file.\MessageBreak% It is OK if the .aux file was already updated\MessageBreak% by a previouse compiler run\MessageBreak% and would not have changed anyway.\MessageBreak% }% }{\PackageError{pageslts}{No writing to auxiliary file allowed}% {It was not allowed to write to an .aux file.\MessageBreak% This package does not work without access to an .aux file.\MessageBreak% Press Ctrl+Z to exit.\MessageBreak% But it is OK if the .aux file was already updated\MessageBreak% by previouse compiler runs\MessageBreak% and would not have changed anyway.\MessageBreak% (In that case just press Enter or Return\MessageBreak% to continue the compilation.)\MessageBreak% }% }% \fi% } % \end{macrocode} % \end{macro} % % We do check whether \xpackage{showkeys} has been loaded (\emph{before} \xpackage{pageslts}!) % in a mode to show the labels: % % \begin{macrocode} \def\pagesLTS@skld{0} \IfPackageLoadedT{showkeys}{\IfPackageLoadedWithOptionsF{showkeys}{final}{% \def\pagesLTS@skld{1}}% }% % \end{macrocode} % % \begin{macro}{\AddToHook\{enddocument/afterlastpage\}} % |\AddToHook{enddocument/afterlastpage}| it is checked % whether the \xpackage{showkeys} package was loaded after the check performed before, % in which case an error message is issued. % % \begin{macrocode} \AddToHook{enddocument/afterlastpage}{% \IfPackageLoadedT{showkeys}{\IfPackageLoadedWithOptionsF{showkeys}{final}{% \ifx\pagesLTS@skld\pagesLTS@one\relax% \else\PackageError{pageslts}{Package showkeys loaded after pageslts}{% The showkeys package with option "final" has been loaded\MessageBreak% after the pageslts package.\MessageBreak% Please first load showkeys and then pageslts}% \fi}% }% % \end{macrocode} % % We also give the error message about the missing (i.\,e.~not found) % page numbering scheme, which could not be given in hook |shipout/foreground|. % % \begin{macrocode} \ifx\pncmissing\pagesLTS@one\relax% \PackageError{pageslts}{pagenumbering scheme missing}{\pagesLTS@messageNPN}% \fi% % \end{macrocode} % % Then we put in an |info| to show, in what order things (which were called) are done. % % \begin{macrocode} \PackageInfo{pageslts}{enddocument/afterlastpage (AED): pageslts setting LastPage}% % \end{macrocode} % % After this we remember the page number (if |fnsymbol| or |silly| or |gobble|), % and after that we place the \texttt{LastPage} label. % % \begin{macrocode} \ifx\pagesLTS@pnc\pagesLTS@fns% \def\pagesLTS@tmpA{\arabic{pagesLTS.fnsymbol.local}}% \ifnum\pagesLTS@esoFs=\pagesLTS@tmpA% \gdef\pagesLTS@rerun{0}% \else% \gdef\pagesLTS@rerun{1}% \fi% \if@filesw% \immediate\write\@auxout{\string\gdef\string\pagesLTS@esoFs{\pagesLTS@tmpA}}% \fi% \else% \ifx\pagesLTS@pnc\pagesLTS@silly% \def\pagesLTS@tmpA{\arabic{pagesLTS.silly.local}}% \ifnum\pagesLTS@esoSy=\pagesLTS@tmpA% \gdef\pagesLTS@rerun{0}% \else% \gdef\pagesLTS@rerun{1}% \fi% \if@filesw% \immediate\write\@auxout{\string\gdef\string\pagesLTS@esoSy{\pagesLTS@tmpA}}% \fi% \else% \ifx\pagesLTS@pnc\pagesLTS@gobble% \def\pagesLTS@tmpA{\arabic{pagesLTS.gobble.local}}% \ifnum\pagesLTS@esoGbl=\pagesLTS@tmpA% \gdef\pagesLTS@rerun{0}% \else% \gdef\pagesLTS@rerun{1}% \fi% \if@filesw% \immediate\write\@auxout{\string\gdef\string\pagesLTS@esoGbl{\pagesLTS@tmpA}}% \fi\fi\fi\fi% \pagesLTS@putlabel{LastPage}{\thepage}{1}% % \end{macrocode} % % We do not need the temporary definition any more. % % \begin{macrocode} \let\pagesLTS@tmpA\undefined% % \end{macrocode} % % The number of pages with the |fnsymbol| page numbering scheme, % |\pagesLTS@esovFs|, and the number of pages with the |silly| page numbering scheme, % |\pagesLTS@esovSy|, and the number of pages with the |gobble| page numbering scheme, % |\pagesLTS@esovGbl|, are saved via the \xfile{.aux} file (if it is not zero, respectively): % % \begin{macrocode} \if@filesw% \ifx\pagesLTS@esovFs\pagesLTS@zero\relax% \else% \immediate\write\@auxout{\string\pagesLTS@providecounter{pagesLTS.fnsymbol.local}}% \immediate\write\@auxout{\string\setcounter{pagesLTS.fnsymbol.local}{\pagesLTS@esovFs}}% \fi% \ifx\pagesLTS@esovSy\pagesLTS@zero\relax% \else% \immediate\write\@auxout{\string\pagesLTS@providecounter{pagesLTS.silly.local}}% \immediate\write\@auxout{\string\setcounter{pagesLTS.silly.local}{\pagesLTS@esovSy}}% \fi% \ifx\pagesLTS@esovGbl\pagesLTS@zero\relax% \else% \immediate\write\@auxout{\string\pagesLTS@providecounter{pagesLTS.gobble.local}}% \immediate\write\@auxout{\string\setcounter{pagesLTS.gobble.local}{\pagesLTS@esovGbl}}% \fi% \fi% % \end{macrocode} % % At the call of a |\pagenumbering{...}| command, everything for a split page numbering scheme % is organized. For the last page numbering scheme, there is no |\pagenumbering{...}| command % at the end, so we need to handle this here: % % \begin{macrocode} \pagesLTS@providecounter{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}.local.count}% \setcounter{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}.local.count}{% \value{pagesLTS.current.local.\pagesLTS@pnc}}% % \end{macrocode} % % And we are one page after the last one (hook |enddocument/afterlastpage|!), so we go back one page. % % \begin{macrocode} \addtocounter{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}.local.count}{-1}% \ifnum\value{pagesLTS.pnc.\pagesLTS@pnc}>1% \setcounter{pagesLTS.tmpcounter}{\value{pagesLTS.pnc.\pagesLTS@pnc}}% \@tempcnta=\value{pagesLTS.tmpcounter}\relax% \loop% \ifnum\@tempcnta>1\relax% \addtocounter{pagesLTS.tmpcounter}{-1}% \addtocounter{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}.local.count}{% -\value{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.tmpcounter}.local.count}}% \@tempcnta=\value{pagesLTS.tmpcounter}\relax% \repeat% \fi% \if@filesw% \immediate\write\@auxout{\string \pagesLTS@providecounter{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}.local.cnt}}% \edef\pagesLTS@tmpA{\arabic{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}.local.count}}% \immediate\write\@auxout{\string \setcounter{pagesLTS.\pagesLTS@pnc.\arabic{pagesLTS.pnc.\pagesLTS@pnc}.local.cnt}{\pagesLTS@tmpA}}% \fi% % \end{macrocode} % % We need to save (via the \xfile{.aux} file) the page name |\thepage| % and the page number |\arabic{CurrentPage}| of the last page, % in case the last page has |fnsymbol| page numbering scheme. % % \begin{macrocode} \addtocounter{page}{-1}% \def\pagesLTS@tmpA{\thepage}% \if@filesw% \protected@iwrite\@auxout{}{\string\gdef\string\pagesLTSlastpage{\pagesLTS@tmpA}}% \gdef\pagesLTS@Hy{}% \IfPackageLoadedT{hyperref}{\ifHy@pageanchor\pagesLTS@makeHy\fi}% \protected@iwrite\@auxout{}{\string\gdef\string\pagesLTSlastpageHy{\pagesLTS@Hy}}% \fi% \addtocounter{page}{+1}% \addtocounter{CurrentPage}{-1}% \edef\pagesLTS@tmpB{\arabic{CurrentPage}}% \if@filesw% \immediate\write\@auxout{\string\setcounter{pagesLTS.pagenr}{\pagesLTS@tmpB}}% \fi% \addtocounter{CurrentPage}{+1}% % \end{macrocode} % % The \texttt{VeryLastPage} label is set here. Before the introduction of the hook mechanism in the kernel, % |\lastpageref{VeryLastPage}| could point to a later page then |\lastpageref{LastPage}|. % |LastPage| and |VeryLastPage| should now be identical, but for backward compatibility we keep both. % % \begin{macrocode} \PackageInfo{pageslts}{enddocument/afterlastpage (AED): pageslts setting VeryLastPage}% \pagesLTS@putlabel{VeryLastPage}{\thepage}{1}% % \end{macrocode} % % The \texttt{LastPages} label is set here, and |\lastpageref{LastPages}| gives % the total number of pages and points to the last page. % % \begin{macrocode} \PackageInfo{pageslts}{enddocument/afterlastpage (AED): pageslts setting LastPages}% \pagesLTS@putlabels% \ifodd\pagesLTS@tmpB% \PackageNoteNoLine{pageslts}{Total number of pages is odd}% \else% \PackageNoteNoLine{pageslts}{Total number of pages is even}% \fi% } % \end{macrocode} % \end{macro} % % \begin{macro}{\frontmatter} % |\frontmatter| often contains |\pagenumbering|, but for some unknown reason % there are problems when another |\pagenumbering| with different page numbering scheme % has been used before on the same page. (This would not make any sense anyway, % because one page can only have one page numbering scheme.) This problem does not % occur when two |\pagenumbering| commands are used inside normal text. % Thus we need to check whether |\frontmatter| has been defined, % whether it changes the page numbering scheme, and whether the page numbering scheme % before |\frontmatter| was initiated at the same page. % With the hook mechanism it does not matter whether the command to be patched is defined. % % \begin{macrocode} \AddToHook{cmd/frontmatter/before}{% \xdef\pagesLTS@FMBpncn{\pagesLTS@pnc}% \xdef\pagesLTS@FMBpncp{\arabic{pagesLTS.current.local.\pagesLTS@pnc}}% } % \end{macrocode} % % At the beginning of the |\frontmatter| (FMB), we remember the % current (c) page numbering (pn) scheme: its name (n) and page number (p). % |\pagesLTS@FMBpncp| would be |1| if the according |\pagenumbering| command % was used on the same page at the |\frontmatter|. % % At the end of the |\frontmatter| the named checks are performed % and in case of the named problem an error message is given. % % \begin{macrocode} \AddToHook{cmd/frontmatter/after}{% \xdef\pagesLTS@FMEpncn{\pagesLTS@pnc}% \ifx\pagesLTS@FMBpncn\pagesLTS@FMEpncn% \else% \ifx\pagesLTS@FMBpncn\pagesLTS@zero% \else% \ifx\pagesLTS@FMBpncp\pagesLTS@one% \PackageWarning{pageslts}{\string\pagenumbering\space before \string\frontmatter:\MessageBreak% Do not use \string\pagenumbering{\pagesLTS@FMBpncn} before \string\frontmatter\MessageBreak% on the same page!\MessageBreak% \string\frontmatter\space (re)defines the page numbering scheme to \pagesLTS@FMEpncn ,\MessageBreak% thus earlier use of \string\pagenumbering{\pagesLTS@FMBpncn} % on the same page is useless anyway\MessageBreak}% \fi% \fi% \fi% } % \end{macrocode} % \end{macro} % % \begin{macro}{\AddToHook\{enddocument/info\}} % The hook |enddocument/info| is even later: % \begin{quote} % \textquotedblleft This hook is meant to receive code that write final information messages % to the terminal. It follows immediately after the previous hook\textquotedblright % \end{quote} % (Frank Mittelbach (2024-06-26): \LaTeX's hook management, lthooks-code.pdf, p.~27) % |enddocument/afteraux|. Here it is used for a rerun hint.\newline % For example if the page numbering scheme of the last page of the % \textsf{pageslts-example.tex} file is changed to |fnsymbol| and two runs % of \pdfLaTeX{} are done, \pdfLaTeX{} will be happy and will not complain % about changed labels. But indeed, a \emph{third} run is necessary % and indicated by the warning message below. % % \begin{macrocode} \AddToHook{enddocument/info}{% \ifx\pagesLTS@rerun\pagesLTS@one% \PackageWarningNoLine{pageslts}{Label(s) may have changed.\MessageBreak% Rerun to get cross-references right}% \fi% } % \end{macrocode} % \end{macro} % \begin{macrocode} % % \end{macrocode} % % \newpage % \setlength{\parindent}{\the\ltsindent} % % \section{Installation} % % \subsection{Downloads\label{ss:Downloads}} % % Everything is available at \url{https://CTAN.org}, % but may need additional packages themselves.\bigskip % % \DescribeMacro{pageslts.dtx} % For unpacking the |pageslts.dtx| file and constructing the documentation it is required: % \begin{description} % \item[-] \TeX Format \LaTeXe{} 2024-11-01: \url{https://CTAN.org} % % \item[-] document class \xclass{ltxdoc}, 2024/02/08, v2.1j, \url{https://ctan.org/pkg/ltxdoc} % % \item[-] package \xpackage{holtxdoc}, 2019/12/09, v0.30, \url{https://ctan.org/pkg/holtxdoc} % % \item[-] package \xpackage{hypdoc}, 2023-10-26, v1.19, \url{https://ctan.org/pkg/hypdoc} % % \item[-] package \xpackage{geometry}, 2020/01/02, v5.9, \url{https://ctan.org/pkg/geometry} % % \item[-] package \xpackage{ulem}, 2019-11-18, no version number given, \url{https://ctan.org/pkg/ulem} % \end{description} % % \DescribeMacro{pageslts.sty} % The |pageslts.sty| for \LaTeXe{} $\geq$ 2024-11-01 (i.\,e.~all documents using the % \xpackage{pageslts} package) requires: % \begin{description} % \item[-] \TeX{} Format \LaTeXe{} 2024-11-01, \url{https://CTAN.org} % % \item[-] package \xpackage{undolabl}, 2024-12-05, v1.0n, \url{https://ctan.org/pkg/undolabl} % % \item[-] package \xpackage{kvoptions}, 2022-06-15, v3.15, \url{https://ctan.org/pkg/kvoptions} % % \item[-] if any of the options |alphMult|, |AlphMulti|, or |fnsymbolmult| is used: % package \xpackage{alphalph}, 2019/12/09, v2.6,\newline \url{https://ctan.org/pkg/alphalph} % % \item[-] if |\pagenumbering{silly}| shall be used, the \xpackage{sillypage} package % must be loaded, 2024-07-23, v1.7,\newline \url{https://www.ctan.org/pkg/sillypage} % \end{description} % % \DescribeMacro{pageslts-example.tex} % The |pageslts-example.tex| requires the same files as all documents using the % \xpackage{pageslts} package, and additionally: % \begin{description} % \item[-] class \textsf{article}, 2024/06/29, v1.4n, from \textsf{classes.dtx}: \url{https://ctan.org/pkg/classes} % % \item[-] package \xpackage{alphalph}, 2019/12/09, v2.6, \url{https://ctan.org/pkg/alphalph} % % \item[-] package \xpackage{lipsum}, 2021-09-20, v2.7, \url{https://ctan.org/pkg/lipsum} % % \item[-] package \xpackage{showkeys}, 2024/05/23, v3.21, \url{https://ctan.org/pkg/showkeys} % % \item[-] package \xpackage{hyperref}, 2024-11-05, v7.01l, \url{https://ctan.org/pkg/hyperref} % % \item[-] package \xpackage{pageslts}, 2024-12-23, v2.0c, \url{https://ctan.org/pkg/pageslts}\newline % (Well, it is the example file for this package, and because you are reading the % documentation for the \xpackage{pageslts} package, it can be assumed that you already % have some version of it~-- is it the current one?) % \end{description} % % \DescribeMacro{Münch} % A hyperlinked list of my (other) packages can be found at \url{https://ctan.org/author/muench-hm}. % % \subsection{Package, unpacking TDS} % \paragraph{Package.} This package is available on \url{https://CTAN.org}. % \begin{description} % \item[\url{https://mirror.ctan.org/macros/latex/contrib/pageslts/pageslts.dtx}]\hspace*{0.1cm} \newline % The source file. % \item[\url{https://mirror.ctan.org/macros/latex/contrib/pageslts/pageslts.pdf}]\hspace*{0.1cm} \newline % The documentation. % \item[\url{https://mirror.ctan.org/macros/latex/contrib/pageslts/pageslts-example.pdf}]\hspace*{0.1cm} \newline % The compiled example file, as it should look like. % \item[\url{https://mirror.ctan.org/macros/latex/contrib/pageslts/README}]\hspace*{0.1cm} \newline % The README file. % \end{description} % There is also a |pageslts.tds.zip| available: % \begin{description} % \item[\url{https://mirror.ctan.org/install/macros/latex/contrib/pageslts.tds.zip}]\hspace*{0.1cm} \newline % Everything in TDS compliant, compiled format. % \end{description} % which additionally contains\newline % \begin{tabular}{ll} % pageslts.ins & The \texttt{ins}tallation file.\\ % pageslts.drv & The \mbox{\texttt{dr}i\texttt{v}er} to generate the documentation.\\ % pageslts.sty & The \texttt{sty}le file.\\ % pageslts-example.tex & The example file.% % \end{tabular} % % \bigskip % % \noindent For required other packages please see the preceding subsection. % % \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting % \docstrip{} archive. The files are extracted by running the % \xext{.dtx} through \plainTeX : % \begin{quote} % \verb|tex pageslts.dtx| % \end{quote} % % About generating the documentation see paragraph~\ref{GenDoc} below.\bigskip % % \paragraph{TDS.} Now the different files must be moved into % the different directories in your installation TDS tree % (also known as \xfile{texmf} tree): % \begin{quote} % \def\t{^^A % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} % pageslts.sty & tex/latex/pageslts.sty\\ % pageslts.pdf & doc/latex/pageslts.pdf\\ % pageslts-example.tex & doc/latex/pageslts-example.tex\\ % pageslts-example.pdf & doc/latex/pageslts-example.pdf\\ % pageslts.dtx & source/latex/pageslts.dtx\\ % \end{tabular}^^A % }^^A % \sbox0{\t}^^A % \ifdim\wd0>\linewidth % \begingroup % \advance\linewidth by\leftmargin % \advance\linewidth by\rightmargin % \edef\x{\endgroup % \def\noexpand\lw{\the\linewidth}^^A % }\x % \def\lwbox{^^A % \leavevmode % \hbox to \linewidth{^^A % \kern-\leftmargin\relax % \hss % \usebox0 % \hss % \kern-\rightmargin\relax % }^^A % }^^A % \ifdim\wd0>\lw % \sbox0{\small\t}^^A % \ifdim\wd0>\linewidth % \ifdim\wd0>\lw % \sbox0{\footnotesize\t}^^A % \ifdim\wd0>\linewidth % \ifdim\wd0>\lw % \sbox0{\scriptsize\t}^^A % \ifdim\wd0>\linewidth % \ifdim\wd0>\lw % \sbox0{\tiny\t}^^A % \ifdim\wd0>\linewidth % \lwbox % \else % \usebox0 % \fi % \else % \lwbox % \fi % \else % \usebox0 % \fi % \else % \lwbox % \fi % \else % \usebox0 % \fi % \else % \lwbox % \fi % \else % \usebox0 % \fi % \else % \lwbox % \fi % \else % \usebox0 % \fi % \end{quote} % If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's % TDS installing feature, then some files can already be in the right % place, see the documentation of \docstrip. % % \subsection{Refresh file name databases} % If your \TeX~distribution (\TeX\,Live, \mikTeX, \dots) relies on % file name databases, you must refresh these. For example, \TeX\,Live\ users % run \verb|texhash| or \verb|mktexlsr|. % % \subsection{Some details for the interested} % \paragraph{Unpacking with \LaTeX.} % The \xfile{.dtx} chooses its action depending on the format: % \begin{description} % \item[\plainTeX:] Run \docstrip\ and extract the files. % \item[\LaTeX:] Generate the documentation. % \end{description} % If you insist on using \LaTeX\ for \docstrip\ (really, % \docstrip\ does not need \LaTeX), then inform the autodetect routine % about your intention: % \begin{quote} % \verb|latex \let\install=y\input{pageslts.dtx}| % \end{quote} % Do not forget to quote the argument according to the demands % of your shell. % % \paragraph{Generating the documentation.\label{GenDoc}} % You can use both the \xfile{.dtx} or the \xfile{.drv} to generate % the documentation. The process can be configured by a % configuration file \xfile{ltxdoc.cfg}. For instance, put the following % line into this file, if you want to have A4 as paper format: % \begin{quote} % \verb|\PassOptionsToClass{a4paper}{article}| % \end{quote} % % \noindent An example follows how to generate the % documentation with \pdfLaTeX : % % \begin{quote} %\begin{verbatim} %pdflatex pageslts.dtx %makeindex -s gind.ist pageslts.idx %pdflatex pageslts.dtx %makeindex -s gind.ist pageslts.idx %pdflatex pageslts.dtx %\end{verbatim} % \end{quote} % % \subsection{Compiling the example} % The example file, \textsf{pageslts-example.tex}, can be compiled via\newline % |latex pageslts-example.tex|\newline % or (recommended)\newline % |pdflatex pageslts-example.tex|\newline % and will need \textit{at least} (!) three compiler runs to get all references right. % % \pagebreak % % \section{Acknowledgements} % I (\textsc{H.-Martin Münch}) would like to thank % \textsc{Jeffrey P. Goldberg} (jeffrey+news at goldmark dot org) for % inventing the \xpackage{lastpage} package. This \xpackage{pageslts} package % first started as a revision of the \xpackage{lastpage} package, but a replacement % was deemed necessary to accomplish what this package does. % Further I would like to thank \textsc{Heiko Oberdiek} for providing the % |\erroralphalph| command as well as a~lot~(!) of useful packages % (from which I also got everything I know about creating a file in % \xfile{dtx} format, OK, say it: copying), \textsc{Ulrich Diez} for his code for the % \xpackage{undolabl} package, which allows overwriting of labels, and % \textsc{Andres Löh} for the code to determine the current page numbering scheme. % For bug reports I thank \textsc{Micha\l{} Herman}, \textsc{kwikwi}, \textsc{Joshua Ellis}, % and \textsc{Dr.~Clea F. Rees}. For telling me how to fix a bug % (and for all his shared whisdom at \url{https://tex.stackexchange.com}) % thanks go to \textsc{Prof.~Enrico Gregorio}. % % \phantomsection % \begin{History}\label{History} % \begin{Version}{1994/06/17, \xpackage{lastpage}} % \item \xpackage{lastpage} v0.99a: First shot by \textsc{Jeffrey P. Goldberg}. % \end{Version} % \begin{Version}{1994/06/25, \xpackage{lastpage}} % \item \xpackage{lastpage} v0.1b: Last version number created by \textsc{Jeffrey P. Goldberg}. % \end{Version} % \begin{Version}{1994/07/20, \xpackage{lastpage}} % \item \xpackage{lastpage} v0.1b (again): Documentation updated by % \textsc{Jeffrey P. Goldberg}.\newline % The main source code of the \xpackage{lastpage} package 1994/07/20 v0.1b was:\bigskip % \begin{verbatim} % \NeedsTeXFormat{LaTeX2e}[1994/06/01] % \ProvidesPackage{lastpage}[1994/07/20 v0.1b % LaTeX2e package for refs to last page number (JPG)] % \def\lastpage@putlabel{\addtocounter{page}{-1}% % \immediate\write\@auxout{\string % \newlabel{LastPage}{{}{\thepage}}}% % \addtocounter{page}{1}} % \AtEndDocument{% % \message{AED: lastpage setting LastPage}% % \clearpage\lastpage@putlabel}% % \endinput % \end{verbatim} % and then \xpackage{hyperref} and \xpackage{revtex} even redefine |\lastpage@putlabel|. % \end{Version} % \begin{Version}{2010/02/18, \xpackage{lastpage}} % \item \xpackage{lastpage} v1.1: Proposed |LastPages| label by H.-Martin Münch % on \Newsgroup{comp.text.tex}, see e.\,g. % \url{https://groups.google.com/group/comp.text.tex/msg/4407493da9c747f0?dmode=source}; % now available in this \xpackage{pageslts} package. % \end{Version} % \begin{Version}{2010/05/15 v1.0 \xpackage{pagesLTS}} % \item \xpackage{pagesLTS} Complete rewriting of the package, so as to work with % \textbf{more than one page numbering scheme}; using |\AtVeryEnd| % for \texttt{VeryLastPage}; upgrade from \xpackage{fancyheadings} to % \xpackage{fancyhdr} package, then removed the need for a \xpackage{fancyhdr} % package at all. % \item Rewriting of the package, so as to work with the |fnsymbol| % page numbering scheme (even on the last page). % \item Introduction of \xpackage{kvoptions} into this package. % \item Check for incompatible \xpackage{endfloat} package. % \item \xpackage{lastpage209.sty} for \LaTeX209 . % \item Replacement of |\filedate|, |-version|, |-name|,\ldots{} because % of \LaTeX~bug 2705:\newline % Synopsis: Possible problem with |\fileversion| and |\filedate|\newline % \url{https://www.latex-project.org/cgi-bin/ltxbugs2html?category=LaTeX&responsible=anyone&state=anything&keyword=lastpage&pr=latex%2F2705&search=} % \item \xpackage{alphalph} support included. % \item Page numbering extension |\erroralph| by \textsc{Heiko Oberdiek} included. % \item (Page-) Numbering extension for |roman| and |Roman| numbers included. % \item Incompatible, old \xpackage{lastpage} package \textquotedblleft killed\textquotedblright . % \item Example |pagesLTS-example.tex| added. % \item Alternatives listing (section \ref{sec:Alternatives}). % \item Listing of \TeX{} sources (subsection \ref{ss:Downloads}). % \item Complete rewriting of the documentation. % \item Everything in DTX framework. % \item New package name: \xpackage{pagesLTS} for Last, Total, % and page numbering Schemes pages. % \end{Version} % \begin{Version}{2010/06/01 v1.1(a) \xpackage{pagesLTS}} % \item Abstract changed: Negative \texttt{roman} and \texttt{Roman} page % numbers are now possible. % \item Several typing mistakes have been corrected~- % both in the \xfile{sty}le file as well as in this documentation. % \end{Version} % \begin{Version}{2010/06/03 v1.1b \xpackage{pagesLTS}} % \item Corrected a bug in |\XXRoman|, where |\roman| instead of |\Roman| had been used. % \item New \xpackage{papermas} package mentioned. % \end{Version} % \begin{Version}{2010/06/24 v1.1c \xpackage{pagesLTS}} % \item \xpackage{holtxdoc} warning in \xfile{drv} updated. % \item Removed CRLF line endings from the \xfile{dtx} file. % \item Corrected the location of the package at CTAN. % (In this version \xfile{TDS} was still missing due to a packaging error.) % \item Corrected Message format in pagesLTS.\xfile{ins}. % \end{Version} % \begin{Version}{2010/07/15 v1.1d \xpackage{pagesLTS}} % \item Added the |\@ifclassloaded{revtex4}| code for |\lastpage@putlabel| (changed to % |\pagesLTS@putlabelhyper|) from the \xpackage{hyperref} package \textbf{as comment}. % \item In the documentation added the explanation of the occurence of multiply definitions % of the |LastPage| label with \xpackage{lastpage}, \xpackage{pagesLTS}, \xpackage{hyperref} % package (in that order). % \item Updated to (then) new version of \xpackage{undolabl} package [2010/07/15] v1.0d, % which uses |\undonewlabel| with only one instead of two arguments. % \item Added a warning message, if \xpackage{hyperref} \textit{and} \xpackage{pdfpages} were \textit{both} used. % \end{Version} % \begin{Version}{2010/07/29 v1.1e \xpackage{pagesLTS}} % \item Removed \xpackage{lastpage209.sty}, because it is now contained % in the \xpackage{lastpage}\xfile{.dtx}\ file, v\,$\geq 1.2$a. % \item Removed the |\@ifclassloaded{revtex4}| code for |\lastpage@putlabel|. % \item Handling of \xpackage{lastpage} package adapted to updated version~1.2(a). % \item Corrected error in \xpackage{lastpage} code [1994/07/20 v0.1b]. % \item Version handling for \xpackage{undolabl} package updated. % \item Included a |\CheckSum|. % \end{Version} % \begin{Version}{2010/08/08 v1.1f \xpackage{pagesLTS}} % \item Version 1.1e had a bug: AlphAlph was replaced by alphalph (because that package is named like this), % but this was done also in commands and definitions~- now reverted. % \end{Version} % \begin{Version}{2010/08/12 v1.1g \xpackage{pagesLTS}} % \item Now the rerun warning is given \textit{after} e.\,g.~the |\listfiles|, % increasing the chance of the user to read it. % \end{Version} % \begin{Version}{2010/08/23 v1.1h \xpackage{pagesLTS}} % \item Renamed |\XXRoman| to |\XRoman|. % \item Reduced the number of needed counters. % \item Removed wrong \% from the driver file. % \item Changed the |\unit| definition (got rid of an old |\rm|). % \item Without use of the \xpackage{hyperref} package, labels of type % \texttt{pagesLTS.}\meta{page numbering scheme}\texttt{.local} % became multiply defined. Now an |\undolabl| was inserted. % \end{Version} % \begin{Version}{2010/08/25 v1.1i \xpackage{pagesLTS}} % \item Bug fix: \textsf{tcilatex} defines the |\hyperref| command, therefore % for \xpackage{hyperref} package detection this had to be changed to % |\Hy@Warning|. % \end{Version} % \begin{Version}{2010/09/12 v1.1j \xpackage{pagesLTS}} % \item Bug fix: \LaTeX{} issued a \textquotedblleft \texttt{Label(s) may have changed.% % Rerun to get cross-references right.}\textquotedblright -warning, % even if labels had not changed but were overwritten. % \item Starred version of |\lastpageref| for suppressing hyperlinks introduced. % \item A lot of details. % \end{Version} % \begin{Version}{2010/09/22 v1.1k \xpackage{pagesLTS}} % \item When no \texttt{fnsymbol} pagenumbering scheme is used, the respective % counters are not defined, saving three counters. % \item Moved the package from \texttt{.../latex/muench/pagesLTS/...} to % \texttt{.../latex/pagesLTS/...}. % \end{Version} % \begin{Version}{2010/09/27 v1.1l \xpackage{pagesLTS}} % \item Bug fix: |\PackageError{pagesLTS}{pagenumbering missing}{\pagesLTS@messageNPN }| % had to be moved to the outside of |\EveryShipout|, because it wrote its % message into the document instead to the screen and the \xfile{.log}-file. % \item Updated to version 2010/04/24 v0.19 of the \xpackage{holtxdoc} package. % \end{Version} % \begin{Version}{2011/02/01 v1.1m \xpackage{pagesLTS}} % \item Added a new warning subsection about \xpackage{hyperref} and repeated page % numbers. % \item Bug fix: Missing \% after |-\romannumeral\number-\arabic{#1}| added. % \item The (then) new version v2.4i of the \xpackage{endfloat} package was then % even older than 15~years. % \item Put a warning in the documentation as well as in the \xfile{log}-file and % at the screen during compilation about the \xpackage{showkeys} package. % (The labels of the \xpackage{pagesLTS} package cannot be shown by the % \xpackage{showkeys} package.) % \item Bug fix: In some situations a rerun warning was given even if no rerun % was necessary. % \item The option \texttt{alphMult}\ \ is now set to \texttt{ab} by default. % \item The option \texttt{AlphMulti}\ is now set to \texttt{AB} by default. % \end{Version} % \begin{Version}{2011/03/16 v1.1n \xpackage{pagesLTS}} % \item Bug fix: Handling of option |pagecontinue=false| changed. % When |pagecontinue=false| was used, but also a % |alphMult|, |AlphMulti|, |fnsymbolmult|, |romanMult| or |RomanMulti| option % other than |0| or |false|, respectively, was used, the page numbering % \textit{was} continued/extended. Now a warning is issued in case of such % option clash and |pagecontinue=false| is heeded, disabling all continuation. % \item Bug fix: |\ProvidesPackage{pagesLTS}| contained an older date (2010/09/27 of v1.1l % instead of 2011/02/01 of v1.1m). % \item Bug fix: The \xpackage{ulem} package is needed to generate the documentation from the % \xfile{pagesLTS.dtx} file, but was not listed as necessary package. % \item Bug fix: One reference to an outdated version of \xpackage{undolabl} package, % replaced by the (then) recent version. % \item Some minor details. % \end{Version} % \begin{Version}{2011/03/17 v1.1o \xpackage{pagesLTS}} % \item Documentation and ReadMe bug fix: This \xpackage{pagesLTS} package is located at % \url{https://ctan.org/pkg/pageslts} instead of \ldots /pagesLTS/. % \item There is a new (possible) alternative package, \xpackage{totcount}, % see section~\ref{sec:Alternatives}. % \item Bug fix: There was a reference to \xpackage{lastpage} 1994/07/20, v0.1b, % instead of the current version. % \end{Version} % \begin{Version}{2011/08/08 v1.2a} % \item \textbf{Renamed the package from \xpackage{pagesLTS} to \xpackage{pageslts} % (keeping family, prefix, internal commands,\ldots{} as |pagesLTS|).} % Added checking against double loading as \xpackage{pagesLTS} and \xpackage{pageslts}. % \item The \xpackage{holtxdoc} package was fixed (recent: 2011/02/04, v0.21), therefore % the warning in \xfile{drv} could be removed. % \item |\AtEndAfterFileList| from the (then) new version of the \xpackage{atveryend} package, % 2011/04/23, v1.7, by \textsc{Heiko Oberdiek}, is now used for the rerun hint % instead of appending to |\@dofilelist|. % \item Now defining $2$: |\def\pagesLTS@two{2}| and $3$: |\def\pagesLTS@three{3}|. % \item Replaced |\texttt{\textbackslash|\ldots|}| by % \textbar \textbackslash \ldots \textbar{} in the \xfile{dtx} and by % |\verb|\textbar \textbackslash \ldots \textbar{} in the example (where possible). % \item When the \xpackage{alphalph} package is needed, it is loaded via |\RequirePackage| % instead of crashing with an error message. % \item A lot of details (also in the documentation). % \end{Version} % \begin{Version}{2013/01/28 v1.2b} % \item Updated to \TeX{} live 2012 (for compiling the documentation and example) % and installed the available updates. Therefore I can no longer test % whether \xpackage{pageslts} works with earlier versions of \LaTeX{}. % \item Replaced |\let| by |\LetLtxMacro|. % \item The \xpackage{nameref} package redefines |\label| to have five arguments % instead of two, therefore |\newlabel{LastPage}{{}{\thepage}{}{}{}}| instead of % |\newlabel{LastPage}{{}{\thepage}}| must be used. % (Bug reported at \url{https://tex.stackexchange.com/q/95541/6865}, % thanks to Micha\l{} Herman!) Fixed. [Later in the kernel \textit{all} labels % got defined to have five arguments.] % \item Updates to a lot of details, also in the documentation. % \end{Version} % \begin{Version}{2014/01/19 v1.2c} % \item Bug: missing loop, fix: inserted. % \item Bug: when option |pagecontinue=false| was set, the extension of the % page numbering schemes was disabled by mistake, fixed. % \item Now using |\ltx@ifpackageloaded| from the \xpackage{ltxcmds} package % for checking (even \emph{after} |\AtBeginDocument|) % whether a package has been loaded. % \item Bug: incompatibility with \xpackage{lineno} because of a mistake % in the redefined |\pagenumbering|, fixed. (Bug reported by \textsc{kwikwi}, thanks!) % \item Bug: When |\pagenumbering| preceded |\frontmatter| on the same page % but with different argument than the |\pagenumbering|, which was inside % |\frontmatter|, then some labelling got mixed up. % (Also this bug reported by \textsc{kwikwi}, thanks!) While this is not fixed automatically, % now an appropriate error message is given. (Two different page numbering schemes % on the same page make no sense anyway.) % \end{Version} % \begin{Version}{2015/08/02 v1.2d} % \item Updated to \TeX{} Live 2015 (for compiling the documentation and example) % and installed the available updates. Therefore I can no longer test % whether \xpackage{pageslts} works with earlier versions of \LaTeX . % \item A |ifundefinedorrelax| similar to the one from \xpackage{scrbase.sty} % of the KOMA script bundle as 2013/12/19 v3.12 is used now, % without the need for \eTeX . % \item New versions of Adobe Reader and of some packages have become available. % \item Changed the message (type) to be displayed if writing to files is disallowed % (as pointed out by \textsc{Joshua Ellis}, thanks!). % \item Updates to several details, also in the documentation. % \end{Version} % \begin{Version}{2015/08/17 v1.2e} % \item Bug fix, see \url{https://tex.stackexchange.com/q/261445/6865}, % thank you to \textsc{Prof. Enrico Gregorio} for providing the fix % and to \textsc{Dr. Clea F. Rees} for bringing this to my attention. % \end{Version} % \begin{Version}{2015/12/21 v1.2f} % \item Replaced |\next| with |\@pageslts@currname|. % \item Bug fix, see \url{https://tex.stackexchange.com/q/140235/6865}. % If the bug had been actually reported (instead of waiting until I see % the question), I would have fixed it earlier, of course. % \item Changed minor details like fixing urls in the manual. % \end{Version} % \begin{Version}{2024-11-20 v2.0a} % \item Kernel-updates broke the package, the package was repaired and updated % to the new kernel-code; ports from \xpackage{lastpage}. % \item Removed |\unit|. % \item Removed |\XXRoman| (deprecated at least since 2015). % \item Removed code from/need for packages \xpackage{prelim2e}, \xpackage{ltxcmds}, % \xpackage{atveryend}, \xpackage{etoolbox}, \xpackage{everyshi}, % \xpackage{letltxmacro}, and \xpackage{rerunfilecheck}. % \item Removed checks for available \eTeX, \xpackage{endfloats} package from 1992, % \xpackage{pagesLTS} package from 2011, \xpackage{hyperref} from 2015 etc. % \item Renamed |\pagesLTS@ifcounter| to |\pagesLTS@providecounter|. % \item Renamed |\pagesLTS.lastpage| to |\pagesLTSlastpage|. % \end{Version} % \begin{Version}{2024-12-07 v2.0b} % \item Bug fix: |pagecontinue=false| did not reset everything always fully correct. % \item Instead of requiring the \xpackage{kvoptions} package, kernel commands are used. % \item Now compatible with the \xpackage{romanbarpagenumber} package, % even independent of loading order. % \item When more than one |\pagenumbering| command is given before the end of the first page % (maybe in the preamble), all but the last |\pagenumbering| are ignored % (as also \LaTeX{} would naturally do). % \item The saved |\OrigPagenumbering| is used in both places now % instead of the plain definition from the kernel, % so any change before the \xpackage{pageslts} package is taken into account. % \item Changed the \autoref{sec:Alternatives}: \nameref{sec:Alternatives}, % mirroring the one from the current \xpackage{lastpage} package. % \item For cases when |\@currentHpage| is just |page.|, the warning text has been corrected. % \item Page numbering scheme |silly| (from \href{https://ctan.org/pkg/sillypage}{% % \xpackage{sillypage} package}) now works. % \item Page numbering scheme |gobble| now works. (Is that silly?!) % \item Added |\ProvideTextCommand{\textasteriskcentered}{PD1}{*}|. % \item Missing |\if@filesw \fi| added. % \item Recent \xpackage{undolabl} package ($\geq$ 2024-12-05 v1.0n) required! % \end{Version} % \begin{Version}{2024-12-23 v2.0c} % \item Bug fix: Error handling for missing |\pagenumbering| now needs % two \mbox{\texttt{\textbackslash}|expandafter|\,s.} % \end{Version} % \end{History} % \bigskip % % \noindent When you find a mistake or have a suggestion for an improvement of this package, % please send an e-mail to the maintainer, thanks!\newline % (Please see BUG REPORTS in the README.)\newpage % \PrintIndex % \Finale \endinput