summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/papermas
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2011-08-02 19:22:35 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2011-08-02 19:22:35 +0000
commitd95bf37641f0782c7c929b8977be9f84d45b0b3f (patch)
tree177b27d5322377bb5550a5a8a1d13ca8261cf839 /Master/texmf-dist/tex/latex/papermas
parent227539d12384a5dff2588e6c814b1fa324507997 (diff)
papermas 2011/06/02, v1.0f
git-svn-id: svn://tug.org/texlive/trunk@23343 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/papermas')
-rw-r--r--Master/texmf-dist/tex/latex/papermas/papermas.sty195
1 files changed, 108 insertions, 87 deletions
diff --git a/Master/texmf-dist/tex/latex/papermas/papermas.sty b/Master/texmf-dist/tex/latex/papermas/papermas.sty
index 834ff5f5a72..0edfd143874 100644
--- a/Master/texmf-dist/tex/latex/papermas/papermas.sty
+++ b/Master/texmf-dist/tex/latex/papermas/papermas.sty
@@ -8,10 +8,13 @@
%%
%% This is a generated file.
%%
-%% IMPORTANT NOTICE:
-%% The package takes options.
+%% Project: papermas
+%% Version: 2011/06/02 v1.0f
%%
-%% The usual disclaimers apply:
+%% 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.)
@@ -28,46 +31,44 @@
%%
%% This work has the LPPL maintenance status "maintained".
%%
-%% The Current Maintainer of this work is H.-Martin Muench
-%% (Martin dot Muench at Uni-Bonn dot de).
+%% 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.
%%
-\NeedsTeXFormat{LaTeX2e}[1994/06/01]
-\ProvidesPackage{papermas}[2011/02/01 v1.0e
- Computes paper mass of a printout (HMM)]%
+\NeedsTeXFormat{LaTeX2e}[2009/09/24]
+\ProvidesPackage{papermas}[2011/06/02 v1.0f
+ Computes paper mass of a printout (HMM)]
%% 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,...)!
+%% 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!
-%% Further this package allows to compute
-%% "base to the power of exponent" inside TeX.
-\RequirePackage{kvoptions}[2010/02/22]% v3.7
-\RequirePackage{pagesLTS}[2011/02/01]% v1.1m
-%% papermas may work with earlier versions of those packages,
-%% but this was not tested. Please consider updating your packages
-%% to the most recent version (if they are not already the most
-%% recent version).
+\RequirePackage{kvoptions}[2010/12/23]% v3.10
+\RequirePackage{pagesLTS}[2011/03/17]% v1.1o
+\RequirePackage{intcalc}[2007/09/27]% v1.1; for intcalcPow
+%% 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).
\SetupKeyvalOptions{family = papermas,prefix = papermas@}
\DeclareStringOption[4]{format}[4]% paper foormat, ISO A...,
- % default: (ISO A) 4
+%% default: (ISO A) 4
\DeclareStringOption[80]{masss}[80]% specific mass of the paper,
- % default: 80 (g/(m^2))
+%% default: 80 (g/(m^2))
\DeclareStringOption[2]{pagespersheet}[2]% number of pages per sheet,
- % for duplex printing this is 2.
+%% 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!
+%% e. g. "." or ",": decimalsep={,} - brackets are needed!!!
+%% decimalsep={,\,} does not work for screen, aux, log output!
\ProcessKeyvalOptions*
@@ -80,34 +81,6 @@
\@ifundefined{papermaspagespersheet}{\gdef\papermaspagespersheet{\textbf{??}}}{}
\@ifundefined{papermassheets}{\gdef\papermassheets{\textbf{??}}}{}
-\newcounter{papermas@rerun}
-\newcounter{papermas@base}
-\newcounter{papermas@exp}
-\newcounter{papermas@result}
-\newcounter{papermas@ini}
-\setcounter{papermas@ini}{1}
-
-\newcommand\papermas@powerof[2]{%
- \setcounter{papermas@base}{#1}
- \setcounter{papermas@exp}{#2}
- \ifnum \value{papermas@ini}=1
- \setcounter{papermas@result}{\value{papermas@base}}
- \setcounter{papermas@ini}{0}
- \ifnum \value{papermas@exp}=0%
- \setcounter{papermas@result}{1}
- \else
- \addtocounter{papermas@exp}{-1}
- \fi
- \fi
- \ifnum \value{papermas@exp}=0%
- \setcounter{papermas@ini}{1}
- \else
- \multiply \value{papermas@result} \value{papermas@base}
- \addtocounter{papermas@exp}{-1}
- \papermas@powerof{#1}{\value{papermas@exp}}
- \fi%
- }
-
\newcommand\papermas@totmass{%
\newcounter{papermasA}% paper mass for ISO A...
\setcounter{papermasA}{\papermas@format}% e. g. 4
@@ -124,7 +97,7 @@
\setcounter{papermasmasss}{\papermas@masss}% default: 80
\multiply \value{papermasmasss} 100 % default: 8000
\ifnum \value{papermasmasss}<1%
- \PackageError{pagesLTS}{Option masss has no valid value}%
+ \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%
@@ -154,8 +127,7 @@
\fi
\multiply \value{papermasmasss} \value{papermas@sheets}
% default: 8000 (no default for this)
- \papermas@powerof{2}{\value{papermasA}}
- \divide \value{papermasmasss} by \value{papermas@result}
+ \divide \value{papermasmasss} by \intcalcPow{2}{\value{papermasA}}
% default: 16000 / 2^(\value{papermasA})
% for the example 297 is used
\newcounter{papermas@tmpm}
@@ -183,6 +155,7 @@
\fi
\fi
\edef\papermastmpr{\arabic{papermas@tmpo}\papermas@decimalsep\arabic{papermas@tmpp}}%
+ \global\edef\papermas@mbs{\arabic{papermas@tmpo}}%
\edef\papermastmpformat{\papermas@format}%
\edef\papermastmpmasss{\papermas@masss}%
\edef\papermastmppagespersheet{\papermas@pagespersheet}%
@@ -191,9 +164,11 @@
\ifnum\value{papermassttl}=\value{papermasmasss}
\relax
\else
- \PackageWarningNoLine{papermas}{%
- Number of pages may have changed.\MessageBreak%
- Rerun to get it right.\MessageBreak%
+ \AtVeryVeryEnd{%
+ \PackageWarningNoLine{papermas}{%
+ Number of pages may have changed.\MessageBreak%
+ Rerun to get it right%
+ }%
}%
\fi
\setcounter{papermassttl}{\arabic{papermasmasss}}
@@ -220,46 +195,92 @@
}
\AtBeginDocument{%
- \def\papermas@undefined{\textbf{??}}
- \setcounter{papermas@rerun}{0}
- \ifx\papermasstotal\papermas@undefined \addtocounter{papermas@rerun}{000001} \fi
- \ifx\papermasstotal\papermas@undefined \addtocounter{papermas@rerun}{000010} \fi
- \ifx\papermasformat\papermas@undefined \addtocounter{papermas@rerun}{000100} \fi
- \ifx\papermasmasss\papermas@undefined \addtocounter{papermas@rerun}{001000} \fi
- \ifx\papermaspagespersheet\papermas@undefined \addtocounter{papermas@rerun}{010000} \fi
- \ifx\papermassheets\papermas@undefined \addtocounter{papermas@rerun}{100000} \fi
+ \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
+ \AtVeryVeryEnd{
+ \PackageWarningNoLine{papermas}{%
+ Variable(s) still undefined!\MessageBreak%
+ Rerun to get the variable(s) right%
+ }
+ }
+ \fi
}
\AfterLastShipout{%
\papermas@totmass%
}%
-\AtVeryEndDocument{%
- \ifnum\value{papermas@rerun}>0
- \PackageWarningNoLine{papermas}{!\MessageBreak%
- Variable(s) still undefined.\MessageBreak%
- (Error code \arabic{papermas@rerun}.)\MessageBreak%
- Rerun to get the variable(s) right.\MessageBreak%
- }%
- \else
- \message{papermas: ***************************************************}
- \message{papermas: * This document consists of \arabic{pagesLTS.pagenr} pages. *}
- \message{papermas: * When printing \papermaspagespersheet\space pages on one sheet of paper, *}
- \message{papermas: * \papermassheets\space sheets will be needed. *}
- \message{papermas: * For ISO A \papermasformat\space paper of \papermasmasss\space g/m^2 specific mass, *}
- \message{papermas: * the printout will have a mass of about \papermasstotal\space g. *}
- \message{papermas: ***************************************************}
- \PackageInfo{papermas}{***************************************************\MessageBreak%
- * This document consists of \arabic{pagesLTS.pagenr} pages. *\MessageBreak%
- * When printing \papermaspagespersheet\space pages on one sheet of paper, *\MessageBreak%
- * \papermassheets\space sheets will be needed. *\MessageBreak%
- * For ISO A \papermasformat\space paper of \papermasmasss\space g/m^2 specific mass, *\MessageBreak%
- * the printout will have a mass of about \papermasstotal\space g. *\MessageBreak%
- ***************************************************\MessageBreak%
- }%
+\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%
+ }
+
+\AtVeryVeryEnd{%
+ \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}}{15}%
+ \message{papermas: * When printing \papermaspagespersheet\space pages on one sheet of paper,}
+ \papermas@spaces{\papermaspagespersheet}{5}%
+ \message{papermas: * \papermassheets\space sheets will be needed.}
+ \papermas@spaces{\papermassheets}{25}%
+ \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}%
+ \message{papermas: ***************************************************^^J}
+ \message{^^J}
+ \fi%
+ }
+
+\newcommand\papermas@powerof[2]{%
+ \PackageError{papermas}{Obsolete command \string\papermas@powerof used}{%
+ The command \string\papermas@powerof has been removed from the papermas package.\MessageBreak%
+ Please use e.g. \string\intcalcPow 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, and the command might be\MessageBreak%
+ removed completely from future versions of the papermas package.\MessageBreak%
+ }%
+ \AtVeryVeryEnd{%
+ \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}}%
+ }
+
\endinput
%%
%% End of file `papermas.sty'.