summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/papermas
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/papermas
Initial commit
Diffstat (limited to 'macros/latex/contrib/papermas')
-rw-r--r--macros/latex/contrib/papermas/README148
-rw-r--r--macros/latex/contrib/papermas/papermas-example.pdfbin0 -> 83512 bytes
-rw-r--r--macros/latex/contrib/papermas/papermas.dtx1453
-rw-r--r--macros/latex/contrib/papermas/papermas.pdfbin0 -> 339530 bytes
4 files changed, 1601 insertions, 0 deletions
diff --git a/macros/latex/contrib/papermas/README b/macros/latex/contrib/papermas/README
new file mode 100644
index 0000000000..b82ecc3f07
--- /dev/null
+++ b/macros/latex/contrib/papermas/README
@@ -0,0 +1,148 @@
+README for papermas package, 2011/08/22, v1.0h
+
+
+TABLE OF CONTENTS
+=================
+
+1 Introduction
+2 Download
+3 Installation
+4 Additional Packages
+5 Package Compatibility
+6 Author/Maintainer
+7 Bug Reports
+8 Known Problems
+
+
+1 INTRODUCTION
+==============
+
+This package allows to compute the mass of a printed version of a
+document, useful e.g. when sending it by mail to determine the postage.
+
+Warning/Disclaimer: The mass of (printer's) ink has to be added and that
+of envelope, address sticker, stamps,... Thus this is only an estimation
+without guarantee - do not sue me, if you have got to pay excess postage!
+This material is subject to the LaTeX Project Public License
+(LPPL). See http://www.ctan.org/tex-archive/help/Catalogue/
+licenses.lppl.html for the details of that license.
+
+
+2 DOWNLOAD
+==========
+
+`papermas' is available on CTAN:
+ CTAN:macros/latex/contrib/papermas/
+
+Also a ZIP file is provided that contains the files, already
+sorted in a TDS tree:
+ CTAN:install/macros/latex/contrib/papermas.tds.zip
+
+`CTAN:' means one of the `Comprehensive TeX Archive Network'
+nodes or one of its mirrors. This is explained in
+ http://www.tex.ac.uk/cgi-bin/texfaq2html?label=archives
+
+The CTAN stuff will be mirrored automatically from the
+ftp server, so
+ ftp://ftp.tug.org/pub/tex/papermas/
+corresponds to
+ CTAN:macros/latex/contrib/papermas/
+
+
+3 INSTALLATION
+==============
+
+Installation with ZIP file in TDS format
+----------------------------------------
+The ZIP file `papermas.tds.zip' contains the files sorted
+in a TDS tree. Thus you can directly unpack the ZIP file
+inside a TDS tree.
+(See CTAN:tds.zip for an explanation of TDS.)
+Example:
+ cd /...somewhere.../texmf
+ unzip /...downloadpath.../papermas.tds.zip
+Do not forget to refresh the file name database of this
+TDS tree.
+Example:
+ texhash /...somewhere.../texmf
+
+Manual installation
+-------------------
+a) Download the papermas files from CTAN or the TUG server.
+ If necessary, unpack them.
+b) Generate the package and driver files:
+ tex papermas.ins
+c) Install the file `*.sty' in your TDS tree:
+ cp *.sty TDS:tex/latex/papermas/
+ Replace `TDS:' by the prefix of your TDS tree
+ (texmf directory).
+d) Copy the documentation files to
+ "TDS:doc/latex/papermas/":
+ README, papermas.pdf, papermas-example.tex,
+ papermas-example.pdf.
+e) Update the databases if necessary, e.g. for teTeX:
+ mktexlsr .../texmf
+
+
+4 ADDITIONAL PACKAGES
+=====================
+
+Depending on the driver and option settings, papermas loads
+other packages:
+* kvoptions.sty:
+ CTAN:macros/latex/contrib/oberdiek/kvoptions.dtx
+* intcalc.sty:
+ CTAN:macros/latex/contrib/oberdiek/intcalc.dtx
+* pageslts.sty:
+ CTAN:macros/latex/contrib/pageslts/pageslts.dtx
+which again load other packages
+(see the result of the \listfiles command in the log-file
+ of the example).
+
+
+5 PACKAGE COMPATIBILITY
+=======================
+
+papermas should be loaded AFTER package pageslts.
+
+
+6 AUTHOR/MAINTAINER
+=====================
+
+* H.-Martin Münch
+
+
+7 BUG REPORTS
+==============
+
+A bug report should contain:
+* Comprehensive problem description. This includes error or
+ warning messages.
+ * \errorcontextlines=\maxdimen can be added in the
+ TeX code to get more information in TeX error messages.
+* Minimal test file that shows the problem, but does not
+ contain any unnecessary packages and code.
+* Used drivers/programs.
+* Version information about used packages and programs.
+ * If you are using LaTeX, then add "\listfiles". Then
+ a list of version information is printed at the end
+ of the LaTeX run.
+* Please no other files than the minimal test file.
+ The other files .log, .dvi, .ps, .pdf are seldom
+ necessary, so send them only on request.
+* Please .zip or .tar.gz your file(s) before sending them!
+
+Bug address
+-----------
+Bug reports can be send to the maintainer:
+ H.-Martin Münch
+ <Martin [dot] Muench [at] Uni-Bonn [dot] de>
+
+
+8 KNOWN PROBLEMS
+=================
+
+TeX 2011/06/27 has changed \enddocument and
+thus broken the \AtVeryVeryEnd command/hooking
+of atveryend package as of 2011/04/23, v1.7.
+Until it is fixed, \AtEndAfterFileList is used.
diff --git a/macros/latex/contrib/papermas/papermas-example.pdf b/macros/latex/contrib/papermas/papermas-example.pdf
new file mode 100644
index 0000000000..43c91f26f0
--- /dev/null
+++ b/macros/latex/contrib/papermas/papermas-example.pdf
Binary files differ
diff --git a/macros/latex/contrib/papermas/papermas.dtx b/macros/latex/contrib/papermas/papermas.dtx
new file mode 100644
index 0000000000..78f15d43a2
--- /dev/null
+++ b/macros/latex/contrib/papermas/papermas.dtx
@@ -0,0 +1,1453 @@
+% \iffalse meta-comment
+%
+% File: papermas.dtx
+% Version: 2011/08/22 v1.0h
+%
+% Copyright (C) 2010, 2011 by
+% H.-Martin M"unch <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
+% http://www.latex-project.org/lppl/lppl-1-3c.txt
+% and the latest version of this license is in
+% http://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
+% and the derived files
+% papermas.sty, papermas.pdf, papermas.ins, papermas.drv,
+% papermas-example.tex.
+%
+% Distribution:
+% CTAN:macros/latex/contrib/papermas/papermas.dtx
+% CTAN:macros/latex/contrib/papermas/papermas.pdf
+% CTAN:install/macros/latex/contrib/papermas.tds.zip
+%
+% Unpacking:
+% (a) If papermas.ins is present:
+% tex papermas.ins
+% (b) Without papermas.ins:
+% tex papermas.dtx
+% (c) If you insist on using LaTeX
+% latex \let\install=y\input{papermas.dtx}
+% (quote the arguments according to the demands of your shell)
+%
+% Documentation:
+% (a) If papermas.drv is present:
+% (pdf)latex papermas.drv
+% makeindex -s gind.ist papermas.idx
+% (pdf)latex papermas.drv
+% makeindex -s gind.ist papermas.idx
+% (pdf)latex papermas.drv
+% (b) Without papermas.drv:
+% (pdf)latex papermas.dtx
+% makeindex -s gind.ist papermas.idx
+% (pdf)latex papermas.dtx
+% makeindex -s gind.ist papermas.idx
+% (pdf)latex papermas.dtx
+%
+% The class ltxdoc loads the configuration file ltxdoc.cfg
+% if available. Here you can specify further options, e.g.
+% use DIN A4 as paper format:
+% \PassOptionsToClass{a4paper}{article}
+%
+% Installation:
+% TDS:tex/latex/papermas/papermas.sty
+% TDS:doc/latex/papermas/papermas.pdf
+% TDS:doc/latex/papermas/papermas-example.tex
+% TDS:source/latex/papermas/papermas.dtx
+%
+%<*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 2011/08/22 v1.0h Computes paper mass of a printout (HMM)}
+\Msg{****************************************************************************}
+
+\keepsilent
+\askforoverwritefalse
+
+\let\MetaPrefix\relax
+\preamble
+
+This is a generated file.
+
+Project: papermas
+Version: 2011/08/22 v1.0h
+
+Copyright (C) 2010, 2011 by
+ H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de>
+
+The usual disclaimer applys:
+If it doesn't work right that's your problem.
+(Nevertheless, send an e-mail to the maintainer
+ when you find an error in this package.)
+
+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
+ http://www.latex-project.org/lppl/lppl-1-3c.txt
+and the latest version of this license is in
+ http://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
+and the derived files
+ papermas.sty, papermas.pdf, papermas.ins, papermas.drv,
+ papermas-example.tex.
+
+\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}[2009/09/24]
+\ProvidesFile{papermas.drv}%
+ [2011/08/22 v1.0h Computes paper mass of a printout (HMM)]%
+\documentclass{ltxdoc}[2007/11/11]% v2.0u
+\usepackage{holtxdoc}[2011/02/04]% v0.21
+%% papermas may work with earlier versions of LaTeX2e and those
+%% class and package, but this was not tested.
+%% Please consider updating your LaTeX, class, and package
+%% to the most recent version (if they are not already the most
+%% recent version).
+\hypersetup{%
+ pdfsubject={Computeing paper mass of a printout (HMM)},%
+ pdfkeywords={LaTeX, papermas, papermass, paper mass, paper, mass, weight, totpages, pageslts, Hans-Martin Muench},%
+ 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
+\hyphenation{created document docu-menta-tion every-thing ignored}
+\gdef\unit#1{\mathord{\thinspace\mathrm{#1}}}%
+\begin{document}
+ \DocInput{papermas.dtx}%
+\end{document}
+%</driver>
+% \end{macrocode}
+%
+% \fi
+%
+% \CheckSum{377}
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+% \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{\,,\\}
+% \DoNotIndex{\documentclass,\usepackage,\ProvidesPackage,\begin,\end}
+% \DoNotIndex{\NeedsTeXFormat,\DoNotIndex,\verb}
+% \DoNotIndex{\def,\edef,\gdef,\global}
+% \DoNotIndex{\ifx,\kvoptions,\listfiles,\mathord,\mathrm,\ProcessKeyvalOptions}
+% \DoNotIndex{\SetupKeyvalOptions}
+% \DoNotIndex{\bigskip,\space,\thinspace,\Large,\linebreak,\MessageBreak}
+% \DoNotIndex{\ldots,\indent,\noindent,\newline,\pagebreak,\pagenumbering}
+% \DoNotIndex{\textbf,\textit,\textsf,\texttt,\textquotedblleft,\textquotedblright}
+% \DoNotIndex{\plainTeX,\TeX,\LaTeX,\pdfLaTeX}
+% \DoNotIndex{\chapter,\section}
+% \DoNotIndex{\arabic,\newpage,\thepage,\value}
+%
+% \title{The \xpackage{papermas} package}
+% \date{2011/08/22 v1.0h}
+% \author{H.-Martin M\"{u}nch\\\xemail{Martin.Muench at Uni-Bonn.de}}
+%
+% \maketitle
+%
+% \begin{abstract}
+% 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. when sending it by mail to determine the postage.\\
+% (The number of pages of a document can be determined with the
+% \xpackage{pageslts} package.)
+% \end{abstract}
+%
+% \bigskip
+%
+% \noindent Disclaimer for web links: The author is not responsible for any contents
+% referred to in this work unless he has full knowledge of illegal contents.
+% If any damage occurs by the use of information presented there, only the
+% author of the respective pages might be liable, not the one who has referred
+% to these pages.
+%
+% \bigskip
+%
+% \noindent {\color{green} Save per page about $200\unit{ml}$ water,
+% $2\unit{g}$ CO$_{2}$ and $2\unit{g}$ wood:\\
+% Therefore please print only if this is really necessary.}
+%
+% \newpage
+%
+% \tableofcontents
+%
+% \pagebreak
+%
+% \section{Introduction}
+% \indent This package is kind of an add-on to the \xpackage{pageslts} package,
+% but because that already uses some resources and computing the
+% number of sheets of paper or the paper mass probably is not
+% needed so often, this was made into a separate package.\\
+% \indent It 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. when sending it by mail to determine the postage.\\
+% \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 some software has 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
+% (preferably after calling the \xpackage{pageslts} package).\\
+% Because the \xpackage{pageslts} package is used to get the total
+% number of pages, please place a |\pagenumbering{...}| with
+% appropriate argument (e.\,g.~arabic, roman, Roman, fnsymbol,
+% alph, or Alph) right behind |\begin{document}| (see
+% documentation of \xpackage{pageslts} package).\\
+% Now you can say
+% \begin{verbatim}
+% This document consists of $\arabic{pagesLTS.pagenr}$~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}), in the \xfile{log}
+% file (search for \textsf{***~Paper~mass~***}), and can be found
+% in the \xfile{aux} file~-- probably one does not want to have the
+% information in the printed document.\\
+% One could use the \xpackage{(x)color} package and
+% \begin{verbatim}
+% {\color{white} This document ... of about $\papermasstotal \unit{g}$.}
+% \end{verbatim}
+% which does not show in the printed document (white background of the page
+% assumed), but can be made visible on the screen be marking that text.
+%
+% \subsection{Options}
+% \DescribeMacro{options}
+% \indent The \xpackage{papermas} package takes the following options:
+%
+% \subsubsection{format\label{sss:format}}
+% \DescribeMacro{format}
+% \indent The option \texttt{format} wants to know the 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\label{sss:mass}}
+% \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\label{sss: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\label{sss: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}}
+%
+% For determining the number of pages (not sheets of paper)
+% instead of the \xpackage{pageslts} package the alternatives listed
+% in the description of that package could be used, but then
+% the according code in this package would need to be changed
+% (and also e.\,g. the |ifcounter| command used here).\\
+% With the \xpackage{totpages} package optionally the number of
+% sheets of paper needed to print the document can be computed, too.\\
+% (See \xpackage{pageslts} documentation.)\\
+%
+% \bigskip
+%
+% \noindent (You programmed or found another alternative,
+% which is available at \CTAN{}?\\
+% 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.)\\
+%
+% \smallskip
+%
+% \noindent About how to get those packages, please see subsection~\ref{ss:Downloads}.
+%
+% \newpage
+%
+% \section{Example}
+%
+% \begin{macrocode}
+%<*example>
+\documentclass[british,a4paper]{article}[2007/10/19]% v1.4h
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\usepackage{hyperref}[2011/04/17]% v6.82g
+\hypersetup{%
+ extension=pdf,%
+ plainpages=false,%
+ pdfpagelabels=true,%
+ hyperindex=false,%
+ pdflang={en},%
+ pdftitle={papermas package example},%
+ pdfauthor={Hans-Martin Muench},%
+ pdfsubject={Example for the papermas package},%
+ pdfkeywords={LaTeX, papermas, Hans-Martin Muench},%
+ pdfview=Fit,%
+ pdfstartview=Fit,%
+ pdfpagelayout=SinglePage,%
+ bookmarksopen=false%
+}
+\usepackage[pagecontinue=true,alphMult=ab,AlphMulti=AB,fnsymbolmult=true,%
+ romanMult=true,RomanMulti=true]{pageslts}[2011/08/08]% v1.2a
+%% These are the default options. %%
+\usepackage[format=4,masss=80,pagespersheet=2,decimalsep={.}]{papermas}
+%% These are the default options. %%
+\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.0h as of 2011/08/22 (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!\newline
+
+\bigskip
+
+This document consists of
+\lastpageref{LastPages}~(\arabic{pagesLTS.pagenr})~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}$.
+
+\bigskip
+
+\noindent Save per page about $200\unit{ml}$ water,
+$2\unit{g}$ CO$_{2}$ and $2\unit{g}$ wood:\newline
+Therefore please print only if this is really necessary.\newline
+I do NOT think, that it is necessary to print THIS file, really\newline
+(at least not after this page)!
+
+\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 Page \thepage
+\newpage Last page \thepage.
+
+\end{document}
+%</example>
+% \end{macrocode}
+%
+% \newpage
+%
+% \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}[2009/09/24]
+\ProvidesPackage{papermas}[2011/08/22 v1.0h
+ 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. when sending it by mail to determine the postage.
+%% 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}
+%
+% For the handling of the options we need the \xpackage{kvoptions}
+% package of \textsc{Heiko Oberdiek} (see subsection~\ref{ss:Downloads}):
+%
+% \begin{macrocode}
+\RequirePackage{kvoptions}[2010/12/23]% v3.10
+% \end{macrocode}
+%
+% For the total number of pages we need the \xpackage{pageslts}
+% package of myself (see subsection~\ref{ss:Downloads}):
+%
+% \begin{macrocode}
+\RequirePackage{pageslts}[2011/08/08]% v1.2a
+\RequirePackage{intcalc}[2007/09/27]% v1.1; for intcalcPow
+% \end{macrocode}
+%
+% A last information for the user:
+%
+% \begin{macrocode}
+%% papermas may work with earlier versions of LaTeX and those
+%% packages, but this was not tested. Please consider updating
+%% your LaTeX and packages to the most recent version
+%% (if they are not already the most recent version).
+
+% \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 foormat, 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}
+%
+% \begin{macro}{unit}
+% We define a |\unit| command:
+%
+% \begin{macrocode}
+\gdef\unit#1{\mathord{\thinspace\mathrm{#1}}}%
+
+% \end{macrocode}
+% \end{macro}
+%
+% \pagebreak
+%
+% Even if diverse commands are not defined yet, we do not want~a\\
+% \LaTeX \texttt{\ Error:~\ldots\ undefined}.
+%
+% \begin{macrocode}
+\@ifundefined{papermasstotal}{\gdef\papermasstotal{\textbf{??}}}{}
+\@ifundefined{papermasstotal}{\gdef\papermasstotal{\textbf{??}}}{}
+\@ifundefined{papermasformat}{\gdef\papermasformat{\textbf{??}}}{}
+\@ifundefined{papermasmasss}{\gdef\papermasmasss{\textbf{??}}}{}
+\@ifundefined{papermaspagespersheet}{\gdef\papermaspagespersheet{\textbf{??}}}{}
+\@ifundefined{papermassheets}{\gdef\papermassheets{\textbf{??}}}{}
+
+% \end{macrocode}
+%
+% \begin{macro}{\papermas@totmass}
+% This is the internal command, which computes the total paper mass
+% of the printed document.
+%
+% \begin{macrocode}
+\newcommand\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}% always 0
+ \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 devide 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|.\\
+%
+% We check whether option |pagespersheet| has a resonable value, i.\,e. $\geq 1$:
+%
+% \begin{macrocode}
+ \newcounter{papermasPPS}% is 0
+ \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|.\\
+%
+% We introduce a new counter |papermas@sheets| for the number of
+% sheets printed and initialize it with the number of pages
+% as computed by package \xpackage{pageslts},\newline
+% i.\,e. |pagesLTS.pagenr|.
+%
+% \begin{macrocode}
+ \newcounter{papermas@sheets}
+ \setcounter{papermas@sheets}{\arabic{pagesLTS.pagenr}}%
+% \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}=\value{pagesLTS.pagenr}
+ \relax
+ \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: o: p: q:
+ \setcounter{papermas@tmpn}{\arabic{papermasmasss}}% m:291 n:291 o: p: q:
+ \divide \value{papermas@tmpn} by 100% m:297 n:2 o: p: q:
+ \newcounter{papermas@tmpo}
+ \setcounter{papermas@tmpo}{\arabic{papermas@tmpn}}% m:291 n:2 o:2 p: q:
+ \multiply \value{papermas@tmpn} 10% m:297 n:20 o:2 p: q:
+ \divide \value{papermas@tmpm} by 10% m:29 n:20 o:2 p: q:
+ \newcounter{papermas@tmpp}
+ \setcounter{papermas@tmpp}{\arabic{papermas@tmpm}}
+ \addtocounter{papermas@tmpp}{-\arabic{papermas@tmpn}}%m:29 n:20 o:2 p:9 q:
+ % 29 - 20 = 9
+ \multiply \value{papermas@tmpm} 10% m:290 n:20 o:2 p:9 q:
+ \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}
+%
+% 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
+% \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 use the \xpackage{pageslts} package, which already was used
+% to determine the total number of pages, to 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}
+ \pagesLTS@ifcounter{papermassttl}
+% \end{macrocode}
+%
+% If the |papermassttl| counter value already has the value of
+% |papermasmasss|, everything is fine.
+%
+% \begin{macrocode}
+ \ifnum\value{papermassttl}=\value{papermasmasss}
+ \relax
+% \end{macrocode}
+%
+% Otherwise we need another run of \LaTeX.
+%
+% \begin{macrocode}
+ \else
+ \AtEndAfterFileList{%
+ \PackageWarningNoLine{papermas}{%
+ Number of pages may have changed.\MessageBreak%
+ Rerun to get it right%
+ }%
+ }%
+ \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,
+% the \xpackage{pageslts} package already gave an according
+% 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. Therefore we again use the
+% |\pagesLTS@ifcounter| command of the \xpackage{pageslts} package.
+%
+% \begin{macrocode}
+ \immediate\write\@auxout{\string
+ \pagesLTS@ifcounter{papermassttl}}%
+% \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 $\arabic{pagesLTS.pagenr}$~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\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|\\
+% (see |\AtEndAfterFileList| below)
+%
+% \item which will also appear in the \xfile{log}-file.
+%\end{enumerate}
+%
+% \pagebreak
+%
+% 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}}%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ }
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AtBeginDocument}
+% \indent |\AtBeginDocument| it is checked whether some commands,
+% which are/will be defined via the \xfile{aux}-file, are undefined yet.
+% If this is the case, |\AtEndAfterFileList| a rerun warning is given.
+%
+% \begin{macrocode}
+\AtBeginDocument{%
+ \gdef\papermas@undefined{\textbf{??}}
+ \gdef\papermas@rerun{0}
+ \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
+ \ifx\papermas@rerun\pagesLTS@one
+ \AtEndAfterFileList{
+ \PackageWarningNoLine{papermas}{%
+ Variable(s) still undefined!\MessageBreak%
+ Rerun to get the variable(s) right%
+ }
+ }
+ \fi
+ }
+
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AfterLastShipout}
+% What we did not do yet, is to really \textit{call} the command
+% |\papermas@totmass|.\linebreak
+% We do this |\AfterLastShipout|, because we need the total number of pages,
+% and asking for them at the end of the document might save another
+% compilation run.
+%
+% \begin{macrocode}
+\AfterLastShipout{%
+ \papermas@totmass%
+ }%
+
+% \end{macrocode}
+%
+% |\AfterLastShipout| is a command from the \xpackage{atveryend}
+% package of \textsc{Heiko Oberdiek}, which is already loaded by the
+% \xpackage{pageslts} package (about how to get the \xpackage{atveryend}
+% package, please see the documentation of the \xpackage{pageslts}
+% package -- you may need to get further packages for
+% \xpackage{pageslts} anyway, if they have not been installed
+% within your \LaTeX\ system).
+%
+% \end{macro}
+%
+% \pagebreak
+%
+% For pretty printing the message of \xpackage{papermas} three internal
+% commands are needed. We borrow the |pagesLTS.pnc.0| counter from the
+% \xpackage{pageslts} package instead of defining another new one.
+%
+% \begin{macrocode}
+\newcommand{\papermas@log}[1]{%
+ \ifnum#1>9%
+ \addtocounter{pagesLTS.pnc.0}{1}%
+ \papermas@log{\intcalcDiv{#1}{10}}%
+ \fi%
+ }
+
+\newcommand{\papermas@spaces}[2]{%
+ \edef\papermas@remember{\arabic{pagesLTS.pnc.0}}%
+ \setcounter{pagesLTS.pnc.0}{1}%
+ \papermas@log{#1}%
+ \addtocounter{pagesLTS.pnc.0}{-#2}%
+ \multiply \value{pagesLTS.pnc.0} -1%
+ \papermas@space{\arabic{pagesLTS.pnc.0}}%
+ \message{*^^J}%
+ \setcounter{pagesLTS.pnc.0}{\papermas@remember}%
+ }
+
+\newcommand{\papermas@space}[1]{%
+ \ifnum \value{pagesLTS.pnc.0}>0%
+ \message{}%
+ \fi%
+ \setcounter{pagesLTS.pnc.0}{#1}%
+ \addtocounter{pagesLTS.pnc.0}{-1}%
+ \ifnum \value{pagesLTS.pnc.0}>0%
+ \papermas@space{\arabic{pagesLTS.pnc.0}}%
+ \fi%
+ }
+
+% \end{macrocode}
+%
+% \begin{macro}{\AtEndAfterFileList}
+%
+% \begin{macrocode}
+\AtEndAfterFileList{%
+% \end{macrocode}
+%
+% \indent |\AtEndAfterFileList{...}| is even later than |\AfterLastShipout|:
+% \begin{quote}
+% \textquotedblleft This code is called right before the final |\cs{@@end}|.\textquotedblright
+% \end{quote}
+% (\xpackage{atveryend} package of \textsc{Heiko Oberdiek}, v1.6 as of 2011/04/15).\\
+%
+% If no necessarity for a rerun was \textit{detected} (Check for other rerun warnings!),
+% the final |\PackageInfo| is given.
+%
+% \begin{macrocode}
+ \ifx\papermas@rerun\pagesLTS@zero%
+ \message{^^J}%
+ \message{papermas: ******************** Paper mass ********************^^J}%
+ \message{papermas: * This document consists of \arabic{pagesLTS.pagenr} pages.}
+ \papermas@spaces{\arabic{pagesLTS.pagenr}}{16}%
+ \message{papermas: * When printing \papermaspagespersheet\space pages on one sheet of paper,}
+ \papermas@spaces{\papermaspagespersheet}{6}%
+ \message{papermas: * \papermassheets\space sheets will be needed.}
+ \papermas@spaces{\papermassheets}{26}%
+ \message{papermas: * For ISO A \papermasformat\space paper of \papermasmasss\space g/m^2 specific mass,}
+ \papermas@spaces{\papermasmasss}{7}%
+ \message{papermas: * the printout will have a mass of about \papermasstotal\space g.}
+ \papermas@spaces{\papermas@mbs}{5}%
+ \message{papermas: ****************************************************^^J}
+ \message{^^J}
+ \fi%
+ }
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\papermas@powerof}
+%
+% The command |\papermas@powerof| is \textbf{obsolete}. |\intcalcPow| is used instead.
+% For compatibility reasons we still provide the command (but with other code),
+% and issue an error message.
+%
+% \begin{macrocode}
+\newcommand\papermas@powerof[2]{%
+ \PackageError{papermas}{Obsolete command \string\papermas@powerof\space used}{%
+ The command \string\papermas@powerof\space has been removed from the papermas package.\MessageBreak%
+ Please use e.g. \string\intcalcPow\space from the intcalc package instead.\MessageBreak%
+ You can now just type Return to continue, but this error message will be\MessageBreak%
+ issued again when using \string\papermas@powerof,\space and the command might be\MessageBreak%
+ removed completely from future versions of the papermas package.\MessageBreak%
+ }%
+ \AtEndAfterFileList{%
+ \message{^^J%
+ papermas: Please remember to replace the \string\papermas@powerof\space command!^^J^^J%
+ }%
+ }%
+ \pagesLTS@ifcounter{papermas@result}%
+ \setcounter{papermas@result}{\intcalcPow{#1}{#2}}%
+ }
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+%
+% \newpage
+%
+% \section{Installation}
+%
+% \subsection{Downloads\label{ss:Downloads}}
+%
+% Everything is available at \CTAN{}, \url{http://www.ctan.org/tex-archive/},
+% 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: \url{http://www.CTAN.org/}
+%
+% \item[-] document class \xpackage{ltxdoc}, 2007/11/11, v2.0u,\\
+% \CTAN{macros/latex/base/ltxdoc.dtx}
+%
+% \item[-] package \xpackage{holtxdoc}, 2011/02/04, v0.21,\\
+% \CTAN{macros/latex/contrib/oberdiek/holtxdoc.dtx}
+%
+% \item[-] package \xpackage{hypdoc}, 2010/03/26, v1.9,\\
+% \CTAN{macros/latex/contrib/oberdiek/hypdoc.dtx}
+% \end{description}
+%
+% \DescribeMacro{papermas.sty}
+% The \texttt{papermas.sty} for \LaTeXe\ (i.\,e. all documents using
+% the \xpackage{papermas} package) requires:
+% \begin{description}
+% \item[-] \TeX Format \LaTeXe, \url{http://www.CTAN.org/}
+%
+% \item[-] package \xpackage{intcalc}, 2007/09/27, v1.1,\\
+% \CTAN{macros/latex/contrib/oberdiek/intcalc.dtx}
+%
+% \item[-] package \xpackage{kvoptions}, 2010/12/23, v3.10,\\
+% \CTAN{macros/latex/contrib/oberdiek/kvoptions.dtx}
+%
+% \item[-] package \xpackage{pageslts}, 2011/08/08, v1.2a,\\
+% \CTAN{macros/latex/contrib/pageslts/pageslts.dtx}\\
+% \end{description}
+%
+% \DescribeMacro{papermas-example.tex}
+% The \texttt{papermas-example.tex} requires the same files as all
+% documents using the \xpackage{papermas} package, and additionally:
+% \begin{description}
+% \item[-] class \xpackage{article}, 2007/10/19, v1.4h, from \xpackage{classes.dtx}:\\
+% \CTAN{macros/latex/base/classes.dtx}
+%
+% \item[-] package \xpackage{papermas}, 2011/08/22, v1.0h,\\
+% \CTAN{macros/latex/contrib/papermas/papermas.dtx}\\
+% (Well, it is the example file for this package, and 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{totpages}
+% As possible alternative in section \ref{sec:Alternatives} there is listed
+% \begin{description}
+% \item[-] package \xpackage{totpages}, 2005/09/19, v2.00,\\
+% \CTAN{macros/latex/contrib/totpages/totpages.dtx}
+% \end{description}
+%
+% \DescribeMacro{Oberdiek}
+% \DescribeMacro{holtxdoc}
+% \DescribeMacro{atveryend}
+% \DescribeMacro{intcalc}
+% \DescribeMacro{kvoptions}
+% All packages of \textsc{Heiko Oberdiek's} bundle `oberdiek'
+% (especially \xpackage{holtxdoc}, \xpackage{atveryend}, \xpackage{intcalc},
+% and \xpackage{kvoptions})
+% are also available in a TDS compliant ZIP archive:\\
+% \CTAN{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{hyperref}
+% \noindent \xpackage{hyperref} is not included in that bundle and needs to be downloaded
+% separately,\\
+% \url{http://mirror.ctan.org/install/macros/latex/contrib/hyperref.tds.zip}.\\
+%
+% \DescribeMacro{M\"{u}nch}
+% A hyperlinked list of my (other) packages can be found at
+% \url{http://www.Uni-Bonn.de/~uzs5pv/LaTeX.html}.\\
+%
+% \subsection{Package, unpacking TDS}
+%
+% \paragraph{Package.} This package is available on \CTAN{}:
+% \begin{description}
+% \item[\CTAN{macros/latex/contrib/papermas/papermas.dtx}]\hspace*{0.1cm} \\
+% The source file.
+% \item[\CTAN{macros/latex/contrib/papermas/papermas.pdf}]\hspace*{0.1cm} \\
+% The documentation.
+% \item[\CTAN{macros/latex/contrib/papermas/papermas-example.pdf}]\hspace*{0.1cm} \\
+% The compiled example file, as it should look like.
+% \item[\CTAN{macros/latex/contrib/papermas/README}]\hspace*{0.1cm} \\
+% The README file.
+% \item[\CTAN{install/macros/latex/contrib/papermas.tds.zip}]\hspace*{0.1cm} \\
+% 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, see the preceding subsection.
+%
+% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
+% \docstrip\ archive. The files are extracted by running the
+% \xfile{.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 (\teTeX, \mikTeX,\dots) relies on file name
+% databases, you must refresh these. For example, \teTeX\ 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 this
+% line into that 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.drv
+%makeindex -s gind.ist papermas.idx
+%pdflatex papermas.drv
+%makeindex -s gind.ist papermas.idx
+%pdflatex papermas.drv
+%\end{verbatim}
+% \end{quote}
+%
+% \subsection{Compiling the example}
+%
+% The example file, \textsf{papermas-example.tex}, can be compiled via\\
+% \indent |latex papermas-example.tex|\\
+% or (recommended)\\
+% \indent |pdflatex papermas-example.tex|\\
+% but will need probably three compiler runs to get everything right.
+%
+% \section{Acknowledgements}
+%
+% I would like to thank \textsc{Heiko Oberdiek}
+% (heiko dot oberdiek at googlemail dot com) 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),
+% and the \Newsgroup{comp.text.tex} and \Newsgroup{de.comp.text.tex}
+% newsgroups for their help in all things \TeX.
+%
+% \pagebreak
+%
+% \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 Updated references to other packages.
+% \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 Updated references to other packages: \xpackage{hyperref} and \xpackage{pagesLTS}.
+% \item Added a list of my other packages.
+% \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 There is a new version of the used \xpackage{hyperref} package: 2010/06/18,~v6.81g.
+% \item There is a new version of the used \xpackage{pagesLTS} package: 2010/07/29,~v1.1e.
+% \item Included a |\CheckSum|.
+% \end{Version}
+% \begin{Version}{2011/02/01 v1.0e}
+% \item Updated to version 2010/12/16 v6.81z of the \xpackage{hyperref} package.
+% \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 There is a new version of the used \xpackage{pagesLTS} package: 2011/02/01,~v1.1m.
+% \item Some small changes.
+% \end{Version}
+% \begin{Version}{2011/06/02 v1.0f}
+% \item There is a new version of the used \xpackage{kvoptions} package: 2010/12/23,~v3.10.
+% \item There is a new version of the used \xpackage{pagesLTS} package: 2011/03/17,~v1.1o.
+% \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 There is a new version of the used \xpackage{hyperref} package: 2011/04/17,~v6.82g.
+% \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).
+% \item Replaced |\text| by |\textrm|.
+% \item Instead of compiling \textquotedblleft $a$ to the power of $b$\textquotedblright\ itself,
+% \xpackage{papermas} now uses the \xpackage{intcalc} package of \textsc{Heiko Oberdiek}.
+% \item Removed five counters.
+% \item A lot of small changes (also in the README).
+% \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|.
+% \item Minor details.
+% \end{Version}
+% \begin{Version}{2011/08/22 v1.0h}
+% \item Hot fix: \TeX{} 2011/06/27 has changed |\enddocument| and
+% thus broken the |\AtVeryVeryEnd| command/hooking
+% of \xpackage{atveryend} package as of 2011/04/23, v1.7.
+% Until it is fixed, |\AtEndAfterFileList| is used.
+% \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 \ No newline at end of file
diff --git a/macros/latex/contrib/papermas/papermas.pdf b/macros/latex/contrib/papermas/papermas.pdf
new file mode 100644
index 0000000000..cc3129969f
--- /dev/null
+++ b/macros/latex/contrib/papermas/papermas.pdf
Binary files differ