%% %% This is file `pageslts-example.tex', %% generated with the docstrip utility. %% %% The original source files were: %% %% pageslts.dtx (with options: `example') %% %% This is a generated file. %% %% Project: pageslts %% Version: 2025-08-14 v2.0g %% Info: Variants of last page labels %% %% Copyright (C) 2010 - 2025 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: *, ^^e2^^80^^a0 (ddagger), ^^e2^^80^^a1 (dddagger), %% ^^c2^^a7 (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 %% \documentclass[british]{article}[2025/01/22]% 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}[2025-08-14]% v2.0g %% 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.0g as of 2025-08-14 (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 Acrobat Reader Continuous Release 2024.005.20320:\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|\number\value{...}| could make sense even if combined with another page numbering scheme. And this is exactly what \verb|\theCurrentPageLocal| does:\newline \nolinebreak{\verb|\def\theCurrentPageLocal{\number\value{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 $\number\value{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.\number\value{pagesLTS.pnc.\pagesLTS@pnc}.local}% \makeatother% \end{verbatim} provides this. Here: % \makeatletter% \theCurrentPageLocal~of~% \lastpageref*{pagesLTS.\pagesLTS@pnc.\number\value{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.\number\value{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|\number\value{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 $\number\value{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} \endinput %% %% End of file `pageslts-example.tex'.