% \iffalse meta-comment
%
% File: papermas.dtx
% Version: 2023-04-12 v1.1a
% Info: Computes paper mass of a printout
%
% Copyright © 2010 - 2023 by
%    H.-Martin Münch <Martin dot Muench at Uni-Bonn dot de>
%
% 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 papermas.dtx
% the README, and the derived files
%    papermas.sty, papermas.pdf,
%    papermas.ins, papermas.drv,
%    papermas-example.tex, papermas-example.pdf.
%
% "papermas" is available on CTAN:
% https://ctan.org/pkg/papermas
%
% 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/papermas.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
%</ignore>
%<*install>
\input docstrip.tex
\Msg{*****************************************************************************}
\Msg{* Installation                                                              *}
\Msg{* Package: papermas 2023-04-12 v1.1a Computes paper mass of a printout (HMM)*}
\Msg{*****************************************************************************}

\keepsilent
\askforoverwritefalse

\let\MetaPrefix\relax
\preamble

This is a generated file.

Project: papermas
Version: 2023-04-12 v1.1a
Info: Computes paper mass of a printout

Copyright (C) 2010 - 2023 by
    H.-Martin Muench <Martin dot Muench at Uni-Bonn dot de>

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 work consists of the main source file papermas.dtx
the README, and the derived files
   papermas.sty, papermas.pdf,
   papermas.ins, papermas.drv,
   papermas-example.tex, papermas-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{papermas.ins}{\from{papermas.dtx}{install}}%
  \file{papermas.drv}{\from{papermas.dtx}{driver}}%
  \usedir{tex/latex/papermas}%
  \file{papermas.sty}{\from{papermas.dtx}{package}}%
  \usedir{doc/latex/papermas}%
  \file{papermas-example.tex}{\from{papermas.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{*  papermas.sty}
\Msg{*}
\Msg{* To produce the documentation run the file `papermas.drv'}
\Msg{* through (pdf)LaTeX, e.g.}
\Msg{*  pdflatex papermas.drv}
\Msg{*  makeindex -s gind.ist papermas.idx}
\Msg{*  pdflatex papermas.drv}
\Msg{*  makeindex -s gind.ist papermas.idx}
\Msg{*  pdflatex papermas.drv}
\Msg{*}
\Msg{* At least two runs are necessary e.g. to get the}
\Msg{*  references right!}
\Msg{*}
\Msg{* Happy TeXing!}
\Msg{*}
\Msg{************************************************************************}

\endbatchfile
%</install>
%<*ignore>
\fi
%</ignore>
%
% \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}[2022-11-01]
\ProvidesFile{papermas.drv}%
  [2023-04-12 v1.1a Computes paper mass of a printout (HMM)]
\documentclass[landscape]{ltxdoc}[2022/06/22]% v2.1i 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={Computing paper mass of a printout (HMM)},%
 pdfkeywords={LaTeX, papermas, papermass, paper mass, paper, mass, weight},%
 pdfencoding=auto,%
 pdflang={en},%
 breaklinks=true,%
 linktoc=all,%
 pdfstartview=FitH,%
 pdfpagelayout=OneColumn,%
 bookmarksnumbered=true,%
 bookmarksopen=true,%
 bookmarksopenlevel=3,%
 pdfmenubar=true,%
 pdftoolbar=true,%
 pdfwindowui=true,%
 pdfnewwindow=true%
}
\CodelineIndex
\DeclareMathAlphabet{\mathup}{OT1}{\familydefault}{m}{n}
\DeclareRobustCommand{\unit}[1]{\ensuremath{\mathord{\thinspace\mathup{#1}}}}
\hyphenation{docu-ment}
\begin{document}
  \DocInput{papermas.dtx}%
\end{document}
%</driver>
%    \end{macrocode}
% \fi
%
% \GetFileInfo{papermas.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{\,,\@abspage@last,\@auxout,\@bsphack,\@esphack,\@ifundefined,\addtocounter,\AddToHook,\arabic,\begin,\end}
% \DoNotIndex{\bigskip,\DeclareMathAlphabet,\DeclareRobustCommand,\DeclareStringOption,\divide,\documentclass,\ensuremath}
% \DoNotIndex{\familydefault,\format,\gdef,\if@filesw,\ifnum,\ifx,\immediate,\intcalcDiv,\intcalcPow,\listfiles,\m@ne}
% \DoNotIndex{\markboth,\mathord,\mathup,\maxdimen,\message,\MessageBreak,\multiply,\NeedsTeXFormat,\newcounter,\newline}
% \DoNotIndex{\newpage,\number,\PackageError,\PackageWarningNoLine,\pagenumbering,\papermas@decimalsep,\papermas@format}
% \DoNotIndex{\papermas@log,\papermas@masss,\papermas@mbs,\papermas@pagespersheet,\papermas@powerof,\papermas@rerun}
% \DoNotIndex{\papermas@space,\papermas@spaces,\papermas@totmass,\papermas@undefined,\papermassEmpty,\papermassETest}
% \DoNotIndex{\papermassmd,\papermastmpformat,\papermastmpmasss,\papermastmppagespersheet,\papermastmpr,\papermastmps}
% \DoNotIndex{\papermastmpt,\pdfinfo,\ProcessKeyvalOptions,\ProvidesPackage,\RequirePackage,\section,\setcounter}
% \DoNotIndex{\SetupKeyvalOptions,\space,\textbf,\textsf,\texttt,\the,\thepage,\thinspace,\usepackage,\value,\write,\z@}
%
% \title{The \xpackage{papermas} package}
% \date{2023-04-12 v1.1a}
% \author{H.-Martin Münch\\\xemail{Martin.Muench at Uni-Bonn.de}}
%
% \maketitle
%
% \begin{abstract}
% \noindent This \LaTeX{} package allows to compute the number of sheets of paper needed
% to print a document as well as the mass of that printed version of the document,
% useful e.\,g. to determine the postage when sending it by snail mail.
% \end{abstract}
%
% \bigskip
%
% \noindent Disclaimer for web links: The author is not responsible for any contents
% referred to in this work unless having 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 those pages.
%
%
% \tableofcontents
%
% \section{Introduction}
% \indent This \LaTeX{} package allows to compute the number of sheets of paper
% needed to print a document (useful when the paper is running out)
% as well as the mass of that printed version of the document,
% useful e.\,g. to determine the postage when sending it by snail mail.\\
% \indent \textbf{Warning/Disclaimer}: The mass of (printer's) ink has to be added
% and that of envelope, address sticker, stamps,\ldots\space
% Thus this is only an estimation without guarantee --
% do not sue me, if you have got to pay excess postage!\\
% \indent The name \xpackage{papermas} is short for paper mass but written with only one \textsf{s},
% because historically some software had problems with names with more than eight letters.\\
% It is \textsf{mass} and gives a result in grammes $\left[ \unit{g}\right]$,
% because the weight $F=m\cdot g$ (really $\overrightarrow{F}=m\cdot \overrightarrow{g}$)
% $\left[ \unit{N}\right]$ would require the knowledge of the gravitational acceleration
% $g$ (depending on place and time, in central Europe approximately $9.81\unit{m}/\unit{s}^{2}$)
% and give a result in \textsc{Newton}, which probably is not very useful.
%
% \section{Usage}
% \indent Just load the package placing
% \begin{quote}
%   |\usepackage[<|\textit{options}|>]{papermas}|
% \end{quote}
% \noindent in the preamble of your \LaTeXe{} source file.\\
% Now you can say
% \begin{verbatim}
% This document consists of $\papermassPages$~pages.
% When printing $\papermaspagespersheet$~pages on one sheet of
% paper, $\papermassheets$~sheets will be needed. For
% ISO~A~\papermasformat{} paper of $\papermasmasss \unit{g}/\!\unit{m}^{2}$
% specific mass, the printout will have a mass of about
% $\papermasstotal \unit{g}$.
% \end{verbatim}
% to get e.\,g.
% \begin{quote}
% This document consists of $101$~pages.
% When printing $4$~pages on one sheet of
% paper, $26$~sheets will be needed. For
% ISO~A~4 paper of $80\unit{g}/\!\unit{m}^{2}$
% specific mass, the printout will have a mass of about
% $130\unit{g}$.
% \end{quote}
% This information is also presented at the screen while compiling your document
% (look for \xpackage{papermas}),\newline
% in the \xfile{log} file (search for \hbox{\textsf{***~Paper~mass~***}),}
% and can be found near the end of the \xfile{aux} file.
%
% \subsection{Options}
% \DescribeMacro{options}
% \indent The \xpackage{papermas} package takes the following options:
%
% \subsubsection{format}
% \DescribeMacro{format}
% \indent The option \texttt{format} wants to know the \hbox{ISO~A\ldots}
% format of the paper used for printing, i.\,e. |format=4| means ISO~A4
% paper format (which is also the default).
%
% \subsubsection{masss}
% \DescribeMacro{masss}
% \indent The option \texttt{masss} wants to know the specific
% (therefore the third~\texttt{s}) mass of the paper used for printing
% in $\unit{g}/\!\unit{m}^{2}$. The default is |masss=80|,
% i.\,e. $80\unit{g}/\!\unit{m}^{2}$.
%
% \subsubsection{pagespersheet}
% \DescribeMacro{pagespersheet}
% \indent The option \texttt{pagespersheet} wants to know, how many
% pages are to be printed on one sheet of paper.
% |pagespersheet=2| could mean duplex printing or printing two pages
% on one side of paper while keeping the back side blank. This
% does not influence the real printing process! So, if this number
% differs from the one chosen for printing, the result will be wrong,
% of course.
%
% \subsubsection{decimalsep}
% \DescribeMacro{decimalsep}
% \indent The option \texttt{decimalsep} wants to know,
% what should be used for the decimal separator. In English this is
% \textquotedblleft .\textquotedblright , while in German it is
% \textquotedblleft ,\textquotedblright . Enclose this in brackets,
% e.\,g.~|decimalsep={.}| or |decimalsep={,}|. The default is
% \textquotedblleft .\textquotedblright . This is used for the
% mass of the printed document, and this value is given at
% the screen during compilation as well as in the \xfile{log}
% and \xfile{aux} files. Therefore something like
% |decimalsep={,\,}| would cause trouble there.
%
% \section{Alternatives\label{sec:Alternatives}}
% With the \xpackage{totpages} package optionally the number of
% sheets of paper needed to print the document can be computed,
% but not the mass; \url{https://ctan.org/pkg/totpages}.
%
% \bigskip
%
% \noindent You programmed or found another alternative,
% which is available at \url{https://www.CTAN.org/}?
% 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.
%
% \section{Example}
%    \begin{macrocode}
%<*example>
\NeedsTeXFormat{LaTeX2e}[2022-11-01]
\documentclass[british,a4paper]{article}[2022/07/02]% v1.4n Standard LaTeX document class
\pdfinfo{
  /Author (H.-Martin Muench)
  /Title (papermas package example)
  /Subject (Example for the papermas package)
  /Keywords (LaTeX;papermas;papermass;paper mass;paper;mass;weight)
}
\usepackage[format=4,masss=80,pagespersheet=2,decimalsep={.}]{papermas}[2023-04-12]
%% v1.1a Computes paper mass of a printout (HMM)
%% These are the default options.
\DeclareMathAlphabet{\mathup}{OT1}{\familydefault}{m}{n}
\DeclareRobustCommand{\unit}[1]{\ensuremath{\mathord{\thinspace\mathup{#1}}}}
\listfiles
\begin{document}
\pagenumbering{arabic}
\section*{Example for papermas}
\markboth{Example for papermas}{Example for papermas}

This example demonstrates the use of package\newline
\textsf{papermas}, v1.1a as of 2023-04-12 (HMM).\newline
The used options were \texttt{format=4} (ISO~A4),
\texttt{masss=80} ($\unit{g}\unit{m}^{-2}$), and\newline
\texttt{pagespersheet=2} (pages per sheet of paper,
i.\,e. either duplex printing or\newline
printing two pages on one side of a sheet of paper with blank back side).\newline
(These are the default options.)\newline
For more details please see the documentation!
\bigskip

This document consists of $\papermassPages$~pages.
When printing $\papermaspagespersheet$~pages on one sheet of paper,
$\papermassheets$~sheets will be needed. For ISO~A~\papermasformat{}
paper of $\papermasmasss \unit{g}\unit{m}^{-2}$ specific mass,
the printout will have a mass of about $\papermasstotal \unit{g}$.

\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage
\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage
\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage
\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage
\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage
\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage
\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage
\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage
\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage
\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage\newpage Page \thepage
\newpage Last page \thepage.
\end{document}
%</example>
%    \end{macrocode}
% \StopEventually{}
%
% \section{The implementation}
% We start off by checking that we are loading into \LaTeXe{} and announcing the name and version of this package.
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[2022-11-01]
\ProvidesPackage{papermas}[2023-04-12 v1.1a Computes paper mass of a printout (HMM)]

%    \end{macrocode}
%
% A short description of the \xpackage{papermas} package:
%
%    \begin{macrocode}
%% Allows to compute the number of sheets of paper
%% needed to print a document as well as the
%% mass of that printed version of the document,
%% useful e.g. to determine the postage when sending it by snail mail.
%% Warning/Disclaimer: Mass of (printer's) ink has to be added
%% and that of envelope, address sticker, stamps,...!
%% So, this is only an estimation without guarantee -
%% do not sue me, if you have got to pay excess postage!

%    \end{macrocode}
%
% |\NeedsTeXFormat{LaTeX2e}[2022-11-01]| was demanded. Check for it:
%
%    \begin{macrocode}
\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}

\IfFormatAtLeastTF{2022/11/01}{\relax}{%
  \PackageError{papermas}{%
      Newer LaTeX format needed or older papermas package%
    }{Needed LaTeX format version: 2022-11-01 or newer.\MessageBreak%
      Found\space\space LaTeX format version: \fmtversion.\MessageBreak%
      Either update your TeX distribution\MessageBreak%
      or use an archived version of papermas\MessageBreak%
      (see section History in the documentation).\MessageBreak%
     }
  }

%    \end{macrocode}
%
% For the handling of the options we need the \xpackage{kvoptions} package
% and for |\intcalcPow| the \xpackage{intcalc} package:
%
%    \begin{macrocode}
\RequirePackage{kvoptions}[2022-06-15]% v3.15 Key value format for package options  (HO)
\RequirePackage{intcalc}[2019/12/15]%   v1.3  Expandable calculations with integers (HO)

%    \end{macrocode}
% See subsection~\ref{ss:Downloads} about how to get them.\\
%
% The options are introduced:
%
%    \begin{macrocode}
\SetupKeyvalOptions{family = papermas,prefix = papermas@}
\DeclareStringOption[4]{format}[4]%        paper format, ISO A..., default: (ISO A) 4
\DeclareStringOption[80]{masss}[80]%       specific mass of the paper, default: 80 (g/(m^2))
\DeclareStringOption[2]{pagespersheet}[2]% number of pages per sheet, for duplex printing this is 2.
\DeclareStringOption[.]{decimalsep}[.]%    decimal separator,
%%             e.g. "." or ",": decimalsep={,} - brackets are needed!!!
%%             decimalsep={,\,} does not work for screen, aux, log output!

\ProcessKeyvalOptions*

%    \end{macrocode}
%
% We pre-define some commands as (still) undefined:
%
%    \begin{macrocode}
\def\papermas@undefined{\textbf{??}}
%    \end{macrocode}
%
% |\papermas@undefined| will also be needed later!
%
%    \begin{macrocode}
\let\papermassPages\papermas@undefined
\let\papermasstotal\papermas@undefined
\let\papermasformat\papermas@undefined
\let\papermasmasss\papermas@undefined
\let\papermaspagespersheet\papermas@undefined
\let\papermassheets\papermas@undefined
\let\papermas@rerun\z@

%    \end{macrocode}
%
% \begin{macro}{\papermas@totmass}
% This is the internal command, which computes the total paper mass
% of the printed document.
%
%    \begin{macrocode}
\DeclareRobustCommand\papermas@totmass{%
  \newcounter{papermasA}% paper mass for ISO A...
  \setcounter{papermasA}{\papermas@format}% e.g. 4
%    \end{macrocode}
%
% We check whether |papermasA| has a resonable value:
%
%    \begin{macrocode}
  \ifnum \value{papermasA}<0%
    \PackageError{papermas}{Option format has no valid value}%
     {The format option of the papermas package\MessageBreak%
      only takes whole, non-negative numbers (0, 1, 2, 3,...),\MessageBreak%
      because this should be the paper format\MessageBreak%
      ISO A 0, 1, 2, 3,...\MessageBreak%
      Found instead: \papermas@format \MessageBreak%
     }%
  \else%
%    \end{macrocode}
%
% |papermasA| has a resonable value. We introduce a new counter
% |papermasmasss| and initialize it with the value given in option
% |masss|, i.\,e. |\papermas@masss|.
%
%    \begin{macrocode}
    \newcounter{papermasmasss}%
    \setcounter{papermasmasss}{\papermas@masss}% default   80
%    \end{macrocode}
%
% Counters are integers, but the amount of the mass of a single sheet
% of paper in most cases is not an integer, therefore we multiply with
% 100 to get two digits behind the decimal separator.\\
% (Later we need to divide by 100 again, of course.)
%
%    \begin{macrocode}
    \multiply \value{papermasmasss} 100 %        default 8000
%    \end{macrocode}
%
% We check whether |papermasmasss| has a resonable value, i.\,e. $> 0$:
%
%    \begin{macrocode}
    \ifnum \value{papermasmasss}<1%
      \PackageError{papermas}{Option masss has no valid value}%
       {The masss option of the papermas package\MessageBreak%
        only takes positive numbers,\MessageBreak%
        because this should be the mass per square meter\MessageBreak%
        of a single sheet of your paper.\MessageBreak%
        Found instead: \papermas@masss\MessageBreak%
       }%
    \else%
%    \end{macrocode}
%
% |masss| has a resonable value, and therefore also |\papermas@masss| and |papermasmasss|.\par
% We check whether option |pagespersheet| has a resonable value, i.\,e. $\geq 1$:
%
%    \begin{macrocode}
      \newcounter{papermasPPS}%
      \setcounter{papermasPPS}{\papermas@pagespersheet}% default 2
      \ifnum \value{papermasPPS}<1%
        \PackageError{papermas}{The number of pages per sheet must be positive.}{%
          You cannot print less than one TeX page per sheet of paper.\MessageBreak%
          The value found was \papermas@pagespersheet .\MessageBreak%
          }%
      \else%
%    \end{macrocode}
%
% |pagespersheet| has a resonable value, and therefore also |\papermas@pagespersheet| and |papermasTmpA|.\par
% We introduce a new counter |papermas@sheets| for the number of sheets printed.\par
% |\gdef\@abspage@last{...}| has not happened yet in first run.
%
%    \begin{macrocode}
        \newcounter{papermas@sheets}%
        \let\papermassPages\m@ne%
        \xdef\papermassmd{\number\maxdimen}%
        \ifnum \@abspage@last=\papermassmd\relax%
          \setcounter{papermas@sheets}{1}%
          \gdef\papermas@rerun{1}%
        \else%
          \setcounter{papermas@sheets}{\@abspage@last}%
          \xdef\papermassPages{\@abspage@last}%
        \fi%
%    \end{macrocode}
%
% When more than one page is printed on one sheet of paper,
% the number of sheets needed for printing is decreased:
%
%    \begin{macrocode}
        \divide \value{papermas@sheets} by \value{papermasPPS}%
%    \end{macrocode}
%
% |\divide| cuts off all digits behind the decimal separator,
% but if there are digits $>0$, this means that there is
% an additional, last sheet, which is only partially covered
% with print (e.\,g. only one side of it for duplex printing
% an odd number of pages). In that case, we have to add
% one sheet of paper to the number of sheets needed.
%
%    \begin{macrocode}
        \newcounter{papermas@tmpn}%
        \setcounter{papermas@tmpn}{\arabic{papermas@sheets}}%
        \multiply \value{papermas@tmpn} \value{papermasPPS}%
        \ifnum \value{papermas@tmpn}=\papermassPages%
        \else \addtocounter{papermas@sheets}{1}%
        \fi%
%    \end{macrocode}
%
% Now we can multiply the specific mass of 100 sheets
% with the number of sheets needed for printing:
%
%    \begin{macrocode}
        \multiply \value{papermasmasss} \value{papermas@sheets}%
        % default:     8000              (no default for this)
%    \end{macrocode}
%
% The result is in $\unit{g}\unit{m}^{-2}$.\\
% A sheet with format ISO A0 has a size of $1\unit{m}^{2}$,\\
% a sheet with format ISO A1 has a size of $1\unit{m}^{2}\cdot 2^{-1}$,\\
% a sheet with format ISO A2 has a size of $1\unit{m}^{2}\cdot 2^{-2}$, \ldots, and\\
% a sheet with format ISO A\textit{n} has a size of $1\unit{m}^{2}\cdot 2^{-n}$.\\
%
% Therefore we compute $2^{\textrm{\textbackslash value\{papermasA\}}}$
% and divide the specific paper mass by that value:
%
%    \begin{macrocode}
        \divide \value{papermasmasss} by \intcalcPow{2}{\value{papermasA}}%
        % default:    16000           /              2^(\value{papermasA})
%    \end{macrocode}
%
% We need to get the division by 100 and the digits after the decimal separator right:
%
%    \begin{macrocode}
        % for the example 297 is used
        \newcounter{papermas@tmpm}%
        \setcounter{papermas@tmpm}{\arabic{papermasmasss}}%   m:297 n:  0 o:0 p: 0 q:0
        \setcounter{papermas@tmpn}{\arabic{papermasmasss}}%   m:291 n:291 o:0 p: 0 q:0
        \divide \value{papermas@tmpn} by 100%                 m:297 n:  2 o:0 p: 0 q:0
        \newcounter{papermas@tmpo}%
        \setcounter{papermas@tmpo}{\arabic{papermas@tmpn}}%   m:291 n:  2 o:2 p: 0 q:0
        \multiply \value{papermas@tmpn} 10%                   m:297 n: 20 o:2 p: 0 q:0
        \divide \value{papermas@tmpm} by 10%                  m: 29 n: 20 o:2 p: 0 q:0
        \newcounter{papermas@tmpp}%
        \setcounter{papermas@tmpp}{\arabic{papermas@tmpm}}%
        \addtocounter{papermas@tmpp}{-\arabic{papermas@tmpn}}%m: 29 n: 20 o:2 p: 9 q:0
        %                  29        -  20 = 9
        \multiply \value{papermas@tmpm} 10%                   m:290 n: 20 o:2 p: 9 q:0
        \newcounter{papermas@tmpq}%
        \setcounter{papermas@tmpq}{\arabic{papermasmasss}}%
        \addtocounter{papermas@tmpq}{-\arabic{papermas@tmpm}}%m:290 n: 20 o:2 p: 9 q:7
        %                 297        - 290 = 7
%    \end{macrocode}
% \pagebreak
%
% Now rounding mathematically correct, i.\,e. $\geq 0.5$ becomes $1$
% (and remember a possible amount carried forward!) and $< 0.5$ becomes~$0$.
%
%    \begin{macrocode}
        \ifnum\value{papermas@tmpq}>4%
          \addtocounter{papermas@tmpp}{1}%                    m:290 n: 20 o:2 p:10 q:7
          \ifnum\value{papermas@tmpp}>9%                      m:290 n: 20 o:2 p:10 q:7
            \addtocounter{papermas@tmpo}{1}%                  m:290 n: 20 o:3 p:10 q:7
            \setcounter{papermas@tmpp}{0}%                    m:290 n: 20 o:3 p: 0 q:7
          \fi%
        \fi%
        \ifx\papermassPages\m@ne\relax\let\papermassPages\papermas@undefined\fi%
%    \end{macrocode}
%
% The result in the example above is $297/100=2.\,97\approx 3.\,0$.
% We write this into |\papermastmpr| (where |\papermas@decimalsep|)
% is the decimal separator) and the (other) options' values into
% temporary definitions, as well as the number of sheets:
%
%    \begin{macrocode}
        \edef\papermastmpr{\arabic{papermas@tmpo}\papermas@decimalsep\arabic{papermas@tmpp}}%
        \xdef\papermas@mbs{\arabic{papermas@tmpo}}%
        \edef\papermastmpformat{\papermas@format}%
        \edef\papermastmpmasss{\papermas@masss}%
        \edef\papermastmppagespersheet{\papermas@pagespersheet}%
        \edef\papermastmpt{\arabic{papermas@sheets}}%
%    \end{macrocode}
%
% We check for the counter |papermassttl|. If it exists, nothing is done,
% if it does not exist, it is declared as |\newcounter|
% (and by default set to zero).
%
%    \begin{macrocode}
        \@ifundefined{c@papermassttl}{\newcounter{papermassttl}}{\relax}%
%    \end{macrocode}
%
% If the |papermassttl| counter value already has the value of
% |papermasmasss|, everything is fine.
%
%    \begin{macrocode}
        \ifnum\value{papermassttl}=\value{papermasmasss}%
%    \end{macrocode}
%
% Otherwise we need another run of \LaTeX.
%
%    \begin{macrocode}
        \else\gdef\papermas@rerun{1}%
        \fi%
%    \end{macrocode}
%
% In any case, we set the counter |papermassttl| to the
% current value of |papermasmasss|.
%
%    \begin{macrocode}
        \setcounter{papermassttl}{\arabic{papermasmasss}}%
%    \end{macrocode}
%
% Because we want to write out into the \xfile{aux}-file,
% we need the expanded value (as string) of |papermasmasss|:
%
%    \begin{macrocode}
        \edef\papermastmps{\arabic{papermasmasss}}%
%    \end{macrocode}
%
% If we are allowed to write into the \xfile{aux}-file, we do it here. If we are not allowed to do it,
% we give an error message.
%
%    \begin{macrocode}
        \if@filesw%
%    \end{macrocode}
%
% When it is read from the \xfile{aux}-file and when its content is processed, the counter |papermassttl|
% might not have been defined yet, in which case we define it.
%
%    \begin{macrocode}
          \immediate\write\@auxout{\string\@ifundefined{c@papermassttl}{\string\newcounter{papermassttl}}{\string\relax}}%
%    \end{macrocode}
%
% We set the counter |papermassttl| to the value |\papermastmps|, i.\,e. |\arabic{papermasmasss}|.
% In the next compilation run it will be checked, whether |\value{papermassttl}=\value{papermasmasss}| (see above).\\
% If this is the case, everything is OK, no changes happened, and no rerun is necessary
% (at least not for \xpackage{papermas}).
%
%    \begin{macrocode}
          \immediate\write\@auxout{\string\setcounter{papermassttl}{\papermastmps}}%
%    \end{macrocode}
%
% What we do need, is to get the determined |\papermastmpr| to the user. Therefore
% \begin{enumerate}
% \item we define |\papermasstotal| in the \xfile{aux}-file, where the user can look it up
%
% \item we define |\papermasstotal|, so the user can e.\,g. write\\
% \begin{verbatim}
% This document consists of $\papermassPages$~pages.
% When printing $\papermaspagespersheet$~pages on one sheet of
% paper, $\papermassheets$~sheets will be needed. For
% ISO~A~\papermasformat{} paper of $\papermasmasss \unit{g}/\!\unit{m}^{2}$
% specific mass, the printout will have a mass of about
% $\papermasstotal \unit{g}$.
% \end{verbatim}
%
%    \begin{macrocode}
          \immediate\write\@auxout{\string\gdef\string\papermassPages{\papermassPages}}%
          \immediate\write\@auxout{\string\gdef\string\papermasstotal{\papermastmpr}}%
          \immediate\write\@auxout{\string\gdef\string\papermasformat{\papermastmpformat}}%
          \immediate\write\@auxout{\string\gdef\string\papermasmasss{\papermastmpmasss}}%
          \immediate\write\@auxout{\string\gdef\string\papermaspagespersheet{\papermastmppagespersheet}}%
%    \end{macrocode}
%
% \item we give at the screen the information about the |\papermasstotal|
%
% \item which will also appear in the \xfile{log}-file.
%\end{enumerate}
%
% We want to give also |\papermastmpt = \arabic{papermas@sheets}| to the user,
% i.\,e.~the number of sheets needed to print the document. Therefore we follow the same procedure:
%    \begin{macrocode}
          \immediate\write\@auxout{\string\gdef\string\papermassheets{\papermastmpt}}%
        \else\PackageError{papermas}{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%
           But it is OK if the .aux file was already updated by previouse compiler runs\MessageBreak%
           and would not have changed anyway. In that case just press Enter or Return\MessageBreak%
           to continue the compilation.}%
        \fi%
      \fi%
    \fi%
  \fi%
  }

%    \end{macrocode}
% \end{macro}
%
% For pretty printing the message of \xpackage{papermas} three internal commands are needed, needing another counter:
%
%    \begin{macrocode}
\newcounter{papermassSpace}

%    \end{macrocode}
% \begin{macro}{\papermas@log}
%    \begin{macrocode}
\DeclareRobustCommand{\papermas@log}[1]{%
  \ifnum#1>9%
    \addtocounter{papermassSpace}{1}%
    \papermas@log{\intcalcDiv{#1}{10}}%
  \fi%
  }

%    \end{macrocode}
% \end{macro}
% \begin{macro}{\papermas@spaces}
%    \begin{macrocode}
\DeclareRobustCommand{\papermas@spaces}[2]{%
  \setcounter{papermassSpace}{1}%
  \papermas@log{#1}%
  \addtocounter{papermassSpace}{-#2}%
  \multiply\value{papermassSpace} -1%
  \papermas@space{\arabic{papermassSpace}}%
  \message{*^^J}%
  }

%    \end{macrocode}
% \end{macro}
% \begin{macro}{\papermas@space}
%    \begin{macrocode}
\DeclareRobustCommand{\papermas@space}[1]{%
  \ifnum\value{papermassSpace}>0\relax\message{}\fi%
  \setcounter{papermassSpace}{#1}%
  \addtocounter{papermassSpace}{-1}%
  \ifnum\value{papermassSpace}>0\relax\papermas@space{\arabic{papermassSpace}}\fi%
  }

%    \end{macrocode}
% \end{macro}
%
% \indent At |begindocument| it is checked whether some commands, which are/will be defined via the
% \xfile{aux}-file, are undefined yet. If this is the case, at the end a rerun warning is given.
%
%    \begin{macrocode}
\AddToHook{begindocument}{%
 \@bsphack%
  \ifx\papermassPages\papermas@undefined       \gdef\papermas@rerun{1}\fi%
  \ifx\papermasstotal\papermas@undefined       \gdef\papermas@rerun{1}\fi%
  \ifx\papermasformat\papermas@undefined       \gdef\papermas@rerun{1}\fi%
  \ifx\papermasmasss\papermas@undefined        \gdef\papermas@rerun{1}\fi%
  \ifx\papermaspagespersheet\papermas@undefined\gdef\papermas@rerun{1}\fi%
  \ifx\papermassheets\papermas@undefined       \gdef\papermas@rerun{1}\fi%
 \@esphack%
%    \end{macrocode}
%
% What we did not do yet, is to really \textit{call} the command |\papermas@totmass|.\newline
% We do this after the last page, because we need the total number of pages.
%
%    \begin{macrocode}
 \AddToHook{enddocument}{%
  \AddToHook{enddocument/afterlastpage}{%
   \papermas@totmass%
%    \end{macrocode}
%
% After the final execution of the \xfile{aux}-file, everything should be defined.
% Otherwise a rerun is needed.
%
%    \begin{macrocode}
   \AddToHook{enddocument/afteraux}{%
    \ifx\papermassPages\m@ne\relax\gdef\papermas@rerun{1}%
    \else\ifx\papermassPages\@abspage@last\else\gdef\papermas@rerun{1}\fi%
    \fi%
    \AddToHook{enddocument/info}[kernel/filelist]{%
%    \end{macrocode}
%
% The final |\PackageInfo| is given, either giving values or a rerun warning.
%
%    \begin{macrocode}
     \message{^^J}%
     \message{papermas: ******************** Paper mass ********************^^J}%
     \ifx\papermas@rerun\z@\relax%
       \edef\papermassETest{\the\ReadonlyShipoutCounter\thetotalpages\PreviousTotalPages\@abspage@last}%
       \edef\papermassEmpty{0001}%
       \ifx\papermassEmpty\papermassETest\relax%
         \PackageWarningNoLine{papermas}{Your document seems to consists of zero pages.\MessageBreak%
           When printing no pages, no paper will be needed.\MessageBreak%
           No paper has no mass.\MessageBreak%
           Maybe just rerun or fix any mistakes}%
         \gdef\papermassPages{0}%
         \gdef\papermaspagespersheet{0}%
         \gdef\papermasstotal{0}%
       \else%
         \ifnum \papermassPages=1\relax\message{papermas: * This document consists of 1 page.}%
                                       \papermas@spaces{1}{16}% 16 because page vs. pages
         \else \message{papermas: * This document consists of \papermassPages\space pages.}%
               \papermas@spaces{\papermassPages}{15}%
         \fi%
         \ifnum \papermaspagespersheet=1\relax \message{papermas: * When printing one page on one sheet of paper,}%
                \papermas@spaces{100}{6}%
         \else \message{papermas: * When printing \papermaspagespersheet\space pages on one sheet of paper,}%
               \papermas@spaces{\papermaspagespersheet}{5}%
         \fi%
         \ifnum \papermassheets=1\relax \message{papermas: * one sheet will be needed.}%
                \papermas@spaces{100}{26}%
         \else \message{papermas: * \papermassheets\space sheets will be needed.}%
               \papermas@spaces{\papermassheets}{25}%
         \fi%
         \message{papermas: * For ISO A \papermasformat\space paper of \papermasmasss\space g/m^2 specific mass,}%
           \papermas@spaces{\papermasmasss}{6}%
         \message{papermas: * the printout will have a mass of about \papermasstotal\space g.}%
           \papermas@spaces{\papermas@mbs}{4}%
       \fi%
     \else \PackageWarningNoLine{papermas}{Variables have changed.\MessageBreak Rerun to get them right}%
     \fi%
     \message{papermas: ****************************************************^^J^^J}%
    }}}}}%
%    \end{macrocode}
%
% \begin{macro}{\papermas@powerof}
% The command |\papermas@powerof| is obsolete since \xpackage{papermas} 2011/06/02 v1.0f.
% As there was ample time to remove it from documents, the replacement has been removed
% from the package in version 2023-04-12 v1.1a. If you really need to use it, here is the code:
% \begin{verbatim}
% \makeatletter%
% \DeclareRobustCommand\papermas@powerof[2]{%
%   \@ifundefined{c@papermas@result}{\newcounter{papermas@result}}{\relax}%
%   \setcounter{papermas@result}{\intcalcPow{#1}{#2}}}%
% \makeatother%
% \end{verbatim}
% \end{macro}
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%
% \section{Installation}
% \subsection{Downloads\label{ss:Downloads}}
% Everything is available at \url{https://ctan.org},
% but may need additional packages themselves.\\
%
% \DescribeMacro{papermas.dtx}
% For unpacking the |papermas.dtx| file and constructing the documentation
% it is required:
% \begin{description}
% \item[-] \TeX-format \LaTeXe{} 2022-11-01 or newer: \url{https://www.CTAN.org/}
%
% \item[-] document class \xclass{ltxdoc}, 2022/06/22, v2.1i,
%   \url{https://ctan.org/pkg/ltxdoc}
%
% \item[-] package \xpackage{geometry}, 2020/01/02, v5.9,
%   \url{https://ctan.org/pkg/geometry}
%
% \item[-] package \xpackage{holtxdoc}, 2019/12/09, v0.30,
%   \url{https://ctan.org/pkg/holtxdoc}
% \end{description}
%
% \DescribeMacro{papermas.sty}
% The |papermas.sty| for \LaTeXe{} (i.\,e. each document using
% the \xpackage{papermas} package) requires:
% \begin{description}
% \item[-] \TeX{}-format \LaTeXe{} 2022-11-01 or newer, \url{https://www.CTAN.org/}
%
% \item[-] package \xpackage{kvoptions}, 2022-06-15, v3.15,
%   \url{https://ctan.org/pkg/kvoptions}
%
% \item[-] package \xpackage{intcalc}, 2019/12/15, v1.3,
%    \url{https://ctan.org/pkg/intcalc}
%
% \item[-] package \xpackage{papermas}, 2023-04-12, v1.1a,
%    \url{https://ctan.org/pkg/papermas} (Because you are reading the documentation for the \xpackage{papermas}
%    package, it can be assumed that you already have some version of it~-- is it the current one?)
% \end{description}
%
% \DescribeMacro{papermas-example.tex}
% The |papermas-example.tex| requires the same files as all
% documents using the \xpackage{papermas} package and additionally:
% \begin{description}
% \item[-] class \xpackage{article}, 2022/07/02, v1.4n, from \xpackage{classes}: \url{https://ctan.org/pkg/classes}
% \end{description}
%
% \DescribeMacro{totpages}
% As possible alternative in section \ref{sec:Alternatives} there is listed
% \begin{description}
% \item[-] package \xpackage{totpages}, 2005/09/19, v2.00, \url{https://ctan.org/pkg/totpages}
% \end{description}
%
% \DescribeMacro{Oberdiek}
% \DescribeMacro{holtxdoc}
% \DescribeMacro{kvoptions}
% All packages of the `oberdiek' bundle
% (especially \xpackage{holtxdoc} and \xpackage{kvoptions})
% are also available in a TDS compliant ZIP archive:\\
% \url{https://mirror.ctan.org/install/macros/latex/contrib/oberdiek.tds.zip}.\\
% It is probably best to download and use this, because the packages in there
% are quite probably both recent and compatible among themselves.\\
%
% \DescribeMacro{intcalc}
% The \xpackage{intcalc} is available at \url{https://www.ctan.org/pkg/intcalc}, also as \xfile{tds}:\\
% \url{https://mirrors.ctan.org/install/macros/latex/contrib/intcalc.tds.zip}.\\
%
% \DescribeMacro{hyperref}
% \noindent \xpackage{hyperref} is not included in that bundle and needs to be downloaded separately,\\
% \url{https://mirror.ctan.org/install/macros/latex/contrib/hyperref.tds.zip}.\\
%
% \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://www.CTAN.org}.
% \begin{description}
% \item[\url{https://mirror.ctan.org/macros/latex/contrib/papermas/papermas.dtx}]\ %
%       The source file.
% \item[\url{https://mirror.ctan.org/macros/latex/contrib/papermas/papermas.pdf}]\ %
%       The documentation.
% \item[\url{https://mirror.ctan.org/macros/latex/contrib/papermas/papermas-example.pdf}]\ %
%       The compiled example file, as it should look like.
% \item[\url{https://mirror.ctan.org/macros/latex/contrib/papermas/README}]\ %
%       The README file.
% \end{description}
%
% \noindent There is also a |papermas.tds.zip| available:
% \begin{description}
% \item[\url{https://mirror.ctan.org/install/macros/latex/contrib/papermas.tds.zip}]\ %
%       Everything in TDS compliant, compiled format.
% \end{description}
% which additionally contains\\
% \begin{tabular}{ll}
% papermas.ins & The installation file.\\
% papermas.drv & The driver to generate the documentation.\\
% papermas.sty &  The \xext{sty}le file.\\
% papermas-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 papermas.dtx|
% \end{quote}
%
% About generating the documentation see paragraph~\ref{GenDoc} below.\\
%
% \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@{}}
%   papermas.sty & tex/latex/papermas.sty\\
%   papermas.pdf & doc/latex/papermas.pdf\\
%   papermas-example.tex & doc/latex/papermas-example.tex\\
%   papermas-example.pdf & doc/latex/papermas-example.pdf\\
%   papermas.dtx & source/latex/papermas.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{papermas.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 papermas.dtx
%makeindex -s gind.ist papermas.idx
%pdflatex papermas.dtx
%makeindex -s gind.ist papermas.idx
%pdflatex papermas.dtx
%\end{verbatim}
% \end{quote}
%
% \subsection{Compiling the example}
% The example file, \textsf{papermas-example.tex}, can be compiled via |(pdf)latex papermas-example.tex|
% and will need at least two compiler runs to get everything right.
%
% \section{Acknowledgements}
%
% I would like to thank \textsc{Heiko Oberdiek} for providing a lot of
% useful packages (from which I also got everything I know about creating
% a file in \xext{dtx} format, OK, say it: copying).
%
% \phantomsection
% \begin{History}\label{History}
%   \begin{Version}{2010/06/01 v1.0(a)}
%     \item First version of this \xpackage{papermas} package.
%   \end{Version}
%   \begin{Version}{2010/06/03 v1.0b}
%     \item New |\papermassheets| and reruncheck introduced; several small changes.
%     \item Example adapted to other examples of mine.
%     \item TDS locations updated.
%     \item Several changes in the documentation and the Readme file.
%   \end{Version}
%   \begin{Version}{2010/06/24 v1.0c}
%     \item \xpackage{holtxdoc} warning in \xfile{drv} updated.
%     \item Corrected the location of the package at CTAN.
%             (TDS was still missing due to packaging error.)
%     \item Several changes to the documentation.
%     \item Introduced new \textbf{option}: |decimalsep|.
%   \end{Version}
%   \begin{Version}{2010/07/29 v1.0d}
%     \item Corrected given url of \texttt{papermas.tds.zip} and other urls.
%     \item Included a |\CheckSum| [was leter removed again].
%   \end{Version}
%   \begin{Version}{2011/02/01 v1.0e}
%     \item Removed wrong \%\ from the driver file.
%     \item Changed the |\unit| definition (got rid of an old |\rm|).
%     \item Replaced the list of my packages with a link to a web page list of those,
%             which has the advantage of showing the recent versions of all those packages.
%     \item Now using |\@ifundefined|.
%     \item Removed |/muench/| from the path at diverse locations.
%     \item Some small changes.
%   \end{Version}
%   \begin{Version}{2011/06/02 v1.0f}
%     \item The \xpackage{holtxdoc} package was fixed (recent version: 2011/02/04,~v0.21),
%             therefore the warning in \xfile{drv} could be removed.~-- Adapted the style of
%             this documentation to new \textsc{Oberdiek} \xfile{dtx} style.
%     \item The rerun warnings are given after the \texttt{filelist} (if that is called
%             with |\listfiles|) and the final \xpackage{papermas} information is presented
%             |\AtVeryVeryEnd| (now only ones instead of twice)
%             [later replaced by use of the new hook management].
%     \item Instead of compiling \textquotedblleft $a$ to the power of $b$\textquotedblright\ itself,
%             \xpackage{papermas} now uses the \xpackage{intcalc} package.
%     \item Removed five counters.
%   \end{Version}
%   \begin{Version}{2011/08/08 v1.0g}
%     \item The \xpackage{pagesLTS} package has been renamed to \xpackage{pageslts}: 2011/08/08,~v1.2a.
%     \item Replaced |\global\edef| by |\xdef|.
%   \end{Version}
%   \begin{Version}{2011/08/22 v1.0h}
%     \item Hot fix: \TeX{} 2011-06-27 changed |\enddocument| and thus broke the |\AtVeryVeryEnd|
%             command/hooking of \xpackage{atveryend} package as of 2011-04-23, v1.7.
%             Until fixed, |\AtEndAfterFileList| was used. [changed back in v1.0i]
%     \item This version was archived at
%             \url{https://web.archive.org/web/20190417084752/https://mirror.ctan.org/install/macros/latex/contrib/papermas.tds.zip}.
%   \end{Version}
%   \begin{Version}{-{}-{}-{}-/-{}-/-{}- v1.0i}
%     \item Made |\newcommand|s robust.
%     \item Moved from |\AtEndAfterFileList| to |\AtVeryVeryEnd| again.
%             [later replaced by use of new hook management]
%     \item By error this version was never released to the public.
%   \end{Version}
%   \begin{Version}{2023-04-12 v1.1a}
%     \item |\NeedsTeXFormat{LaTeX2e}[2022-11-01]|, older package version available from archive
%             (see version 2011/08/22 v1.0h above).
%     \item Using the new hook management and \LaTeX's |\@abspage@last|.
%     \item Package \xpackage{pageslts} is neither needed nor used by the
%             \xpackage{papermas} package any longer.
%     \item Removed |\papermas@powerof| (obsolete since version 2011-06-02~v1.0f).
%     \item Converted to UTF-8.
%     \item A lot of details; extensive documentation updates.
%   \end{Version}
% \end{History}
%
% \bigskip
%
% When you find a mistake or have a suggestion for an improvement of this package,
% please send an e-mail to the maintainer, thanks! (Please see BUG REPORTS in the README.)
%
% \bigskip
%
% \PrintIndex
%
% \Finale
\endinput