From 69ab11c38621bcb590b419847c10a89eaff7b281 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 18 Feb 2008 00:22:40 +0000 Subject: numprint 1.38 (17feb08) git-svn-id: svn://tug.org/texlive/trunk@6668 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/latex/numprint/numprint.dtx | 87 ++++++++++++++-------- .../texmf-dist/source/latex/numprint/numprint.ins | 2 +- 2 files changed, 55 insertions(+), 34 deletions(-) (limited to 'Master/texmf-dist/source') diff --git a/Master/texmf-dist/source/latex/numprint/numprint.dtx b/Master/texmf-dist/source/latex/numprint/numprint.dtx index cc9fa5b29ef..4d387ecf7d1 100644 --- a/Master/texmf-dist/source/latex/numprint/numprint.dtx +++ b/Master/texmf-dist/source/latex/numprint/numprint.dtx @@ -1,5 +1,5 @@ % \iffalse meta comment -% File: numprint.dtx Copyright (C) 2000--2005, 2007 Harald Harders +% File: numprint.dtx Copyright (C) 2000--2005, 2007, 2008 Harald Harders % \fi % % \iffalse @@ -72,13 +72,20 @@ \DoNotIndex{\string} \CodelineNumbered \RecordChanges -\CheckSum{2220} +\CheckSum{2257} \begin{document} \DocInput{numprint.dtx} \end{document} % % \fi % +% \changes{1.38}{2008/02/17}{Replaced \cs{stepcounter} and +% \cs{addtocounter} by \cs{advance} +% because otherwhise, \cs{numprint} does not work inside +% \cs{ensuremath}\{\cs{text}\{\$\ldots\$\}\}.}% +% \changes{1.38}{2008/02/17}{Moved counters \cs{nprt@curpos} and +% \cs{nprt@rndpos} outside the macro definitions to avoid an overflow +% of counters}% % \changes{1.37}{2007/01/08}{Add support for French}% % \changes{1.37}{2007/01/08}{Add an own separator for \textcelsius}% % \changes{1.37}{2007/01/08}{Use separator for percent also for permil}% @@ -133,7 +140,7 @@ % \tableofcontents % % \section*{Copyright} -% Copyright 2000--2005, 2007 Harald Harders. +% Copyright 2000--2005, 2007, 2008 Harald Harders. % % This program can be redistributed and/or modified under the terms % of the LaTeX Project Public License Distributed from CTAN @@ -1535,7 +1542,7 @@ % npdecimalsign& Change the decimal sign.\\ % npthousandsep& Change the thousand separator (before and after the % decimal sign).\\ -% npthousandspartsep& Change the thousand separator (only after the +% npthousandthpartsep& Change the thousand separator (only after the % decimal sign).\\ % npproductsign& Change the product sign.\\ % npunitseparator& Change the separator between a number and a @@ -1605,11 +1612,9 @@ % % \begin{itemize} % \item -% Tilman Finke, tfinke@it-and-law.de, had the idea of rounding -% numbers. +% Tilman Finke, had the idea of rounding numbers. % \item -% Stephan Helma, s.p.helma@gmx.net, has implemented padding -% numbers on the left side. +% Stephan Helma has implemented padding numbers on the left side. % This function has been slightly changed by me. % \item % Portuguese support by Vilar Camara Neto and Luis. @@ -1617,6 +1622,9 @@ % Dutch support by Ralph Hendriks. % \item % French support by Daniel Flipo. +% \item +% Ignacio Fern\'andez Galv\'an has reported a couple of bugs and +% suggestions (which parly still have to be implemented\ldots) % \end{itemize} % % \begin{thebibliography}{1} @@ -1644,7 +1652,7 @@ % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{numprint} - [2007/01/08 v1.37 Print numbers (HH)] + [2008/02/17 v1.38 Print numbers (HH)] % \end{macrocode} % % \subsection{Load packages} @@ -2331,7 +2339,7 @@ % \begin{macrocode} \csname ifnprt@#1@decimalfound\endcsname \expandafter\g@addto@macro\csname nprt@#1@after\endcsname{#2}% - \stepcounter{nprt@#1@digitsafter}% + \advance\csname c@nprt@#1@digitsafter\endcsname by 1\relax \else % \end{macrocode} % If the decimal sign has not been found before, this digit is in the @@ -2339,7 +2347,7 @@ % Then, add it at the end of the before-decimal-sign part. % \begin{macrocode} \expandafter\g@addto@macro\csname nprt@#1@before\endcsname{#2}% - \stepcounter{nprt@#1@digitsbefore}% + \advance\csname c@nprt@#1@digitsbefore\endcsname by 1\relax \fi }% % \end{macrocode} @@ -2571,7 +2579,7 @@ % Calculate how many separators are put into the number. % \begin{macrocode} \setcounter{nprt@blockcnt}{\csname nprt@#1@fixeddigits@#2\endcsname}% - \addtocounter{nprt@blockcnt}{-1}% + \advance\c@nprt@blockcnt by -1\relax \divide\c@nprt@blockcnt 3% % \end{macrocode} % If four-digit length numbers are not separated, delete the number of @@ -3072,12 +3080,13 @@ % \end{macrocode} % The column type \verb|n| aligns the base number but not the exponent. % \begin{macrocode} - \newcolumntype{n}[2]{>{\npdigits{#1}{#2}$}l<{$}} + \newcolumntype{n}[2]{>{\npdigits{#1}{#2}$}l<{$}} % \end{macrocode} % The column type \verb|N| aligns the base number as well as the exponent. % \begin{macrocode} - \newcolumntype{N}[3]{% - >{\npdigits{#1}{#2}\npexponentdigits{#3}$}l<{$}} + \newcolumntype{N}[3]{% + >{\npdigits{#1}{#2}\npexponentdigits{#3}$}l<{$}% + } % \end{macrocode} % End of column type section. % \begin{macrocode} @@ -3236,7 +3245,8 @@ % \begin{macrocode} \ifx\nprt@argone\@empty \xdef\nprt@newnum{\the\nprt@thisdigit}% - \stepcounter{nprt@\nprt@numname @digitsbefore}% +% \stepcounter{nprt@\nprt@numname @digitsbefore}% + \advance\csname c@nprt@\nprt@numname @digitsbefore\endcsname 1\relax \else % \end{macrocode} % Insert the current digit before the already stored digits in @@ -3248,6 +3258,12 @@ } % \end{macrocode} % \end{macro} +% Two new counters for the round position and the current postion in +% \cs{nprt@round@after}. +% \begin{macrocode} +\newcount\nprt@curpos +\newcount\nprt@rndpos +% \end{macrocode} % \begin{macro}{\nprt@round} % Round a number. % The first argument is the Number type (``mantissa'' resp.\ @@ -3284,12 +3300,6 @@ \expandafter\g@addto@macro\csname nprt@#1@after\endcsname{% \nprt@roundnull}% % \end{macrocode} -% Two new counters for the round position and the current postion in -% \cs{nprt@round@after}. -% \begin{macrocode} - \newcount\nprt@curpos - \newcount\nprt@rndpos -% \end{macrocode} % Set the number of digits after the decimal sign. % \begin{macrocode} \nprt@rndpos=#2 @@ -3337,7 +3347,8 @@ % \begin{macrocode} \ifnprt@roundup \expandafter\xdef\expandafter\nprt@newnum{1\nprt@newnum}% - \stepcounter{nprt@#1@digitsbefore}% +% \stepcounter{nprt@#1@digitsbefore}% + \advance\csname c@nprt@#1@digitsbefore\endcsname by 1\relax \fi % \end{macrocode} % Copy the new number before the decimal sign to the ``official'' @@ -3391,7 +3402,8 @@ \ifnum\csname thenprt@#1@digitsbefore\endcsname<#2 \expandafter\xdef\csname nprt@#1@before\endcsname{% #3\csname nprt@#1@before\endcsname}% - \stepcounter{nprt@#1@digitsbefore}% +% \stepcounter{nprt@#1@digitsbefore}% + \advance\csname c@nprt@#1@digitsbefore\endcsname by 1\relax \nprt@lpad{#1}{#2}{#3}% \fi \fi @@ -3488,7 +3500,8 @@ \ifnprt@addmissingzero \ifnum\csname thenprt@#1@digitsbefore\endcsname=0 \expandafter\edef\csname nprt@#1@before\endcsname{0}% - \stepcounter{nprt@#1@digitsbefore}% +% \stepcounter{nprt@#1@digitsbefore}% + \advance\csname c@nprt@#1@digitsbefore\endcsname by 1\relax \fi \fi % \end{macrocode} @@ -3529,7 +3542,7 @@ % ganze Bloecke \setcounter{nprt@blockcnt}{% \csname thenprt@#1@digitsbefore\endcsname}% - \addtocounter{nprt@blockcnt}{-1}% + \advance\c@nprt@blockcnt by -1\relax \divide\c@nprt@blockcnt 3% % \end{macrocode} % Then, calculate how many digits are in the first block (one, two, or @@ -3540,7 +3553,7 @@ \csname thenprt@#1@digitsbefore\endcsname}% \setcounter{nprt@cntprint}{\thenprt@blockcnt}% \multiply \c@nprt@cntprint 3% - \addtocounter{nprt@digitsfirstblock}{-\thenprt@cntprint}% + \advance\c@nprt@digitsfirstblock by -\thenprt@cntprint\relax % \end{macrocode} % Depending on that number, call \cs{nprt@printone}, % \cs{nprt@printtwo}, resp.\ \cs{nprt@printthree} which do what you @@ -3572,10 +3585,16 @@ % If the command has not reached the end of the string, print a % separator \cs{nprt@separator@before} and call this routine % recursively. +% Surprisingly, this routine does not work if |#1#2#3| is the first +% command in some cases. +% Thus, \cs{def}cs{nprt@tmp} has been moved in front of it. +% Make sure that this works in all cases. +% Same applies for \cs{nprt@printtwo}, \cs{nprt@printone}, and +% \cs{nprt@printthreeafter}. % \begin{macrocode} \def\nprt@printthree#1#2#3#4\@empty{% - #1#2#3% \def\nprt@tmp{#4}% + #1#2#3% \ifx\nprt@tmp\empty \else \nprt@separator@before% @@ -3588,8 +3607,8 @@ % The same but start with two instead of three digits. % \begin{macrocode} \def\nprt@printtwo#1#2#3\@empty{% - #1#2% \def\nprt@tmp{#3}% + #1#2% \ifx\nprt@tmp\empty \else \nprt@separator@before% @@ -3602,8 +3621,8 @@ % The same but start with one instead of three digits. % \begin{macrocode} \def\nprt@printone#1#2\@empty{% - #1% \def\nprt@tmp{#2}% + #1% \ifx\nprt@tmp\empty \else \nprt@separator@before% @@ -3628,7 +3647,8 @@ \ifnprt@addmissingzero \ifnum\csname thenprt@#1@digitsafter\endcsname=0 \expandafter\edef\csname nprt@#1@after\endcsname{0}% - \stepcounter{nprt@#1@digitsafter}% +% \stepcounter{nprt@#1@digitsafter}% + \advance\csname c@nprt@#1@digitsafter\endcsname by 1\relax \fi \fi % \end{macrocode} @@ -3641,7 +3661,8 @@ \else \ifnum\csname thenprt@#1@digitsafter\endcsname=0 \expandafter\edef\csname nprt@#1@after\endcsname{0}% - \stepcounter{nprt@#1@digitsafter}% +% \stepcounter{nprt@#1@digitsafter}% + \advance\csname c@nprt@#1@digitsafter\endcsname by 1\relax \fi \fi \fi @@ -3700,8 +3721,8 @@ % The same as \cs{nprt@printthree} but with another separator. % \begin{macrocode} \def\nprt@printthree@after#1#2#3#4\@empty{% - #1#2#3% \def\nprt@tmp{#4}% + #1#2#3% \ifx\nprt@tmp\empty \else \nprt@separator@after diff --git a/Master/texmf-dist/source/latex/numprint/numprint.ins b/Master/texmf-dist/source/latex/numprint/numprint.ins index 23922ff36e7..aa28afd8f1a 100644 --- a/Master/texmf-dist/source/latex/numprint/numprint.ins +++ b/Master/texmf-dist/source/latex/numprint/numprint.ins @@ -3,7 +3,7 @@ numprint package - Copyright 2000--2005, 2007 Harald Harders + Copyright 2000--2005, 2007, 2008 Harald Harders This program can be redistributed and/or modified under the terms of the LaTeX Project Public License Distributed from CTAN -- cgit v1.2.3