diff options
author | Karl Berry <karl@freefriends.org> | 2008-02-05 01:37:03 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-02-05 01:37:03 +0000 |
commit | e1b4deff802f0013f051f9f07cc1a4ee6953d618 (patch) | |
tree | a5dd5504803239d09f4d17b0743e81640280fd7f /Master/texmf-dist/tex/latex/pgfplots | |
parent | c7bf9c35539d4441af084e9b99d68ed6efa4f404 (diff) |
pgfplots update (31jan08)
git-svn-id: svn://tug.org/texlive/trunk@6502 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/pgfplots')
-rw-r--r-- | Master/texmf-dist/tex/latex/pgfplots/pgfmathlog.sty | 24 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty | 228 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/pgfplots/pgfplotshelpers.sty | 205 |
3 files changed, 361 insertions, 96 deletions
diff --git a/Master/texmf-dist/tex/latex/pgfplots/pgfmathlog.sty b/Master/texmf-dist/tex/latex/pgfplots/pgfmathlog.sty index acb02e3b143..81e252bbe27 100644 --- a/Master/texmf-dist/tex/latex/pgfplots/pgfmathlog.sty +++ b/Master/texmf-dist/tex/latex/pgfplots/pgfmathlog.sty @@ -39,6 +39,8 @@ \ProvidesPackage{pgfmathlog}[2008/26/01 Version 0.9.] \RequirePackage{pgf}[2007/01/01] +\RequirePackage{pgfplotshelpers}[2008/31/01] + % Computes a normalised floating point representation for #1 of the % form % [+-]X.XXXXXXX*10^C @@ -377,28 +379,6 @@ \pgfmathlog@newton{#1}% } -\def\pgfmathlog@tonumber#1pt{#1} - -% Invokes command #1 with #2 without the 'pt' suffix. -\def\invokepgf@math@one#1#2{% - %\edef\pgfmath@resulttemp{\pgf@sys@tonumber{#2}}% - %\expandafter#1\expandafter{\pgfmath@resulttemp}% - \edef\pgfmath@resulttemp{{\pgf@sys@tonumber{#2}}}% - \expandafter#1\pgfmath@resulttemp% -} - -% Expands #2 using \edef and invokes #1 with the resulting string. -% -% Example: -% \pgfmath@y=7.9pt -% \pgfmathlog@invoke@expanded\pgfmathexp@{{\pgf@sys@tonumber{\pgfmath@y}}}% -% will invoke -% \pgfmathexp@{7.9} -\def\pgfmathlog@invoke@expanded#1#2{% - \edef\pgfmath@resulttemp{#2}% - \expandafter#1\pgfmath@resulttemp -} - % This implementation of log(X) is done with a newton method applied to x-exp(y) = 0. % The implementation \pgfmathexp is used for exp(y). % diff --git a/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty b/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty index daf042622ee..394cf16be6d 100644 --- a/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty +++ b/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty @@ -23,8 +23,8 @@ % along with this program. If not, see <http://www.gnu.org/licenses/>. % %-------------------------------------------- -\def\pgfplotsversion{0.9} -\ProvidesPackage{pgfplots}[2008/26/01 Version \pgfplotsversion] +\def\pgfplotsversion{0.92} +\ProvidesPackage{pgfplots}[2008/31/01 Version \pgfplotsversion] \RequirePackage{xkeyval}[2006/11/18] \RequirePackage{ifthen} \RequirePackage{liststructure} @@ -53,6 +53,7 @@ \def\axis@rightover{} \def\axisdefaultwidth{240pt} \def\axisdefaultheight{207pt} +\def\axisdefaulttickwidth{35}% the maximum space between adjacent ticks (in pt, but don't specify the unit 'pt') \listnew{\blackwhiteplotspeclist}{% mark options={fill=gray},mark=*\\% @@ -60,11 +61,11 @@ mark options={fill=gray},mark=otimes*\\% mark=star\\% mark options={fill=gray},mark=diamond*\\% - loosely dashed,mark options={solid,fill=gray},mark=*\\% - loosely dashed,mark options={solid,fill=gray},mark=square*\\% - loosely dashed,mark options={solid,fill=gray},mark=otimes*\\% - loosely dashed,mark options={solid},mark=star\\% - loosely dashed,mark options={solid,fill=gray},mark=diamond*\\% + densely dashed,mark options={solid,fill=gray},mark=*\\% + densely dashed,mark options={solid,fill=gray},mark=square*\\% + densely dashed,mark options={solid,fill=gray},mark=otimes*\\% + densely dashed,mark options={solid},mark=star\\% + densely dashed,mark options={solid,fill=gray},mark=diamond*\\% } \listnew{\coloredplotspeclist}{% blue,mark options={fill=blue!80!black},mark=*\\% @@ -72,11 +73,11 @@ brown!60!black,mark options={fill=brown!80!black},mark=otimes*\\% black,mark=star\\% blue,mark options={fill=blue!80!black},mark=diamond*\\% - red,loosely dashed,mark options={solid,fill=red!80!black},mark=*\\% - brown!60!black,loosely dashed,mark options={solid,fill=brown!80!black},mark=square*\\% - black,loosely dashed,mark options={solid,fill=gray},mark=otimes*\\% - blue,loosely dashed,mark=star,mark options=solid\\% - red,loosely dashed,mark options={solid,fill=red!80!black},mark=diamond*\\% + red,densely dashed,mark options={solid,fill=red!80!black},mark=*\\% + brown!60!black,densely dashed,mark options={solid,fill=brown!80!black},mark=square*\\% + black,densely dashed,mark options={solid,fill=gray},mark=otimes*\\% + blue,densely dashed,mark=star,mark options=solid\\% + red,densely dashed,mark options={solid,fill=red!80!black},mark=diamond*\\% } @@ -138,6 +139,7 @@ \tikzstyle{every axis label}=[] \tikzstyle{every axis x label}=[at={(0.5,0)},below,yshift=-15pt] \tikzstyle{every axis y label}=[at={(0,0.5)},xshift=-35pt,rotate=90] +\tikzstyle{every axis title}=[at={(0.5,1)},above,yshift=6pt] \tikzstyle{every tick}=[very thin,gray] \tikzstyle{every minor tick}=[] \tikzstyle{every tick label}=[] @@ -192,6 +194,7 @@ subtickwidth,tickwidth,% xfilter,yfilter,% width,height,% + title,% execute at begin plot,% execute at end plot,% x,y}% @@ -262,6 +265,7 @@ tickpos=both, xfilter=, yfilter=, + title=, width=, height=, subtickwidth=0.1cm, @@ -310,26 +314,33 @@ }} \newcommand{\axisdefaultticklabel}[0]{% - $\tick$% + $\prettyprintnumber{\tick}$% } \newcommand{\axisdefaultticklabellog}[0]{% - $10^{\logtologten\tick}$% + \logtologtentomacro{\tick}{\roundedtick}% + $10^{\prettyprintnumber{\roundedtick}}$% } -\newcommand{\showxlabel}{% +\newcommand{\axisshowxlabel}{% \node [style=every axis label,% style=every axis x label] {\axis@xlabel}; + } -\newcommand{\showylabel}{% +\newcommand{\axisshowylabel}{% \node [style=every axis label, style=every axis y label] {\axis@ylabel}; } +\newcommand{\axisshowtitle}{% + \node% + [style=every axis title] + {\axis@title}; +} % Y-Achsen und Achsenbeschriftung LOG: % 1: Ticks @@ -880,6 +891,12 @@ }% } +\def\logtologtentomacro#1#2{% + \pgfmathlog@invoke@expanded\pgfmathdivide@{{#1}{\logten}}% + \expandafter\skipsuffixzero\pgfmathresult|% + \let#2=\pgfmathresult +} + % Expands to #1/log(10). It will also skip a suffix '.0' \def\logtologten#1{% \pgfmathlog@invoke@expanded\pgfmathdivide@{{#1}{\logten}}% @@ -940,6 +957,103 @@ \fi } +% Computes tick positions using the current axis limits. +% +% Parameters: +% \axisdefaulttickwidth +% Determines the maximum space which is not filled by at least one +% tick label (approximate, there is some rounding internally) +% +% Heuristics: +% Set desirednumticks = trunc(ACTUAL WIDTH / axisdefaulttickwidth) +1 +% +% and generate STEPSIZE = (axis range)/ desirednumticks +% +% We actually restrict STEPSIZE to { 1, 1/2, 1/5, 1/10 } +% +% PRECONDITION: +% - limits are correct +% - axis width/height is set correctly +% +% POSTCONDITION: +% - Tick for axis #1 is assigned +% - \ifaxis@needs@check@uniformtick is set +\def\axis@assign@default@tick@foraxis#1{% + \begingroup + \let\desirednumticks=\c@pgf@countd + \let\Wr=\pgf@xc + \Wr=\csname axis@#1coordmaxTEX\endcsname + \advance\Wr by-\csname axis@#1coordminTEX\endcsname + % r = max place without ticks in pt -> choose desirednumticks >= W/r + \expandafter\expandafter\divide\Wr\axisdefaulttickwidth + \pgfmathsetcount{\desirednumticks}{\Wr}% + \advance\desirednumticks by1 + \ifcase\csname axis@#1mode\endcsname + % compute tick := MIN-h,MIN,....,MAX+h + % where h is a determined step size and MIN and MAX are + % (truncated) axis limits. + % + % The MIN-h and MAX+h is to support compatibility with the + % enlargelimits option - there should be ticks in the + % enlarged place. + \pgfmathsetcount{\c@pgf@counta}{\csname axis@#1min\endcsname}% + %\pgfmathsetcount{\c@pgf@countb}{\csname axis@#1max\endcsname}% + \expandafter\ifdim\csname axis@#1min\endcsname pt<0pt + % the truncation round TOWARDS 0 which is not what I want. + \advance\c@pgf@counta by-1 + \fi + \let\MINH=\pgf@xa + \let\H=\pgf@xb + \let\MAX=\axis@tmpa + \let\MIN=\axis@tmpb + % compute step size 'h': + \expandafter\MAX\csname axis@#1max\endcsname pt + \advance\MAX by0.001pt% avoid round errors + \expandafter\MIN\the\c@pgf@counta pt + \H=\MAX + \advance\H by-\MIN + \c@pgf@counta=\desirednumticks + \advance\c@pgf@counta by-1 + \divide\H by\c@pgf@counta + %\message{Wr\the\Wr, desirednumticks=\the\desirednumticks, H=\the\H}% + \ifdim\H<0.10001pt + \H=0.1pt + \else + \ifdim\H<0.20001pt + \H=0.2pt + \else + \ifdim\H<0.5001pt + \H=0.5pt + \else + \H=1pt + \fi + \fi + \fi + %\message{final H=\the\H}% + \MINH=\MIN + \advance\MINH by\H + \xdef\axis@TMP{\pgf@sys@tonumber{\MIN},\pgf@sys@tonumber{\MINH},...,\pgf@sys@tonumber{\MAX}}% + \aftergroup\axis@needs@check@uniformtickfalse + \or + \expandafter\ifx\csname axis@#1tickten\endcsname\empty + % I want ticks at 10^k. So determine k_min and k_max. + \pgfmathsetcount{\c@pgf@counta}{\csname axis@#1min\endcsname/\logten-1}% + \pgfmathsetmacro{\tmp@min}{\c@pgf@counta*\logten}% + \pgfmathsetcount{\c@pgf@counta}{\csname axis@#1max\endcsname/\logten}% + \pgfmathsetmacro{\tmp@max}{\c@pgf@counta*\logten}% + \pgfmathadd\tmp@min\logten% + \xdef\axis@TMP{\tmp@min,\pgfmathresult,...,\tmp@max}% + \aftergroup\axis@needs@check@uniformtickfalse + \else + \edef\axis@TMP{\csname axis@#1tickten\endcsname}% + \expandafter\axis@compute@tick@times@logten\axis@TMP\to\axis@TMP + \aftergroup\axis@needs@check@uniformticktrue + \fi + \fi + \endgroup + \expandafter\let\csname axis@#1tick\endcsname=\axis@TMP + %\message{pgfplots.sty: #1tick set to \csname axis@#1tick\endcsname [#1mode=\the\csname axis@#1mode\endcsname, #1min=\csname axis@#1min\endcsname, #1max=\csname axis@#1max\endcsname].}% +} \def\axis@determinedefaultvalues{% % NOTIZ: @@ -1002,6 +1116,7 @@ \axis@enlarge@xlim \axis@enlarge@ylim \else + % FIXME : this here should be user-configurable! \ifaxis@autocompute@xlim \axis@enlarge@xlim \fi @@ -1009,7 +1124,9 @@ \axis@enlarge@ylim \fi \fi -% + % + \axis@initsizes + % \newif\ifaxis@xisuniform \newif\ifaxis@yisuniform \axis@xisuniformtrue @@ -1017,32 +1134,7 @@ \newif\ifaxis@needs@check@uniformtick \axis@needs@check@uniformticktrue \ifx\axis@xtick\empty - \begingroup - \ifcase\axis@xmode - \pgfmathsetcount{\c@pgf@counta}{\axis@xmin-1}% - \edef\tmp@min{\the\c@pgf@counta}% - \pgfmathsetcount{\c@pgf@counta}{\axis@xmax}% - \edef\tmp@max{\the\c@pgf@counta}% - \xdef\axis@TMP{\tmp@min,...,\tmp@max}% - \aftergroup\axis@needs@check@uniformtickfalse - \or - \ifx\axis@xtickten\empty - % I want ticks at 10^k. So determine k_min and k_max. - \pgfmathsetcount{\c@pgf@counta}{\axis@xmin/\logten-1}% - \pgfmathsetmacro{\tmp@min}{\c@pgf@counta*\logten}% - \pgfmathsetcount{\c@pgf@counta}{\axis@xmax/\logten}% - \pgfmathsetmacro{\tmp@max}{\c@pgf@counta*\logten}% - \pgfmathadd\tmp@min\logten% - \xdef\axis@TMP{\tmp@min,\pgfmathresult,...,\tmp@max}% - \aftergroup\axis@needs@check@uniformtickfalse - \else - \expandafter\axis@compute@tick@times@logten\axis@xtickten\to\axis@TMP - \aftergroup\axis@needs@check@uniformticktrue - \fi - \fi - \endgroup - \let\axis@xtick=\axis@TMP - %\message{pgfplots.sty: xtick set to \axis@xtick [xmode=\the\axis@xmode].}% + \axis@assign@default@tick@foraxis{x}% \fi \ifaxis@needs@check@uniformtick \ifnum\axis@xmode=1 @@ -1060,32 +1152,7 @@ % \axis@needs@check@uniformticktrue \ifx\axis@ytick\empty - \begingroup - \ifcase\axis@ymode - \pgfmathsetcount{\c@pgf@counta}{\axis@ymin-1}% - \edef\tmp@min{\the\c@pgf@counta}% - \pgfmathsetcount{\c@pgf@counta}{\axis@ymax}% - \edef\tmp@max{\the\c@pgf@counta}% - \xdef\axis@TMP{\tmp@min,...,\tmp@max}% - \aftergroup\axis@needs@check@uniformtickfalse - \or - \ifx\axis@ytickten\empty - % I want ticks at 10^k. So determine k_min and k_max. - \pgfmathsetcount{\c@pgf@counta}{\axis@ymin/\logten-1}% - \pgfmathsetmacro{\tmp@min}{\c@pgf@counta*\logten}% - \pgfmathsetcount{\c@pgf@counta}{\axis@ymax/\logten}% - \pgfmathsetmacro{\tmp@max}{\c@pgf@counta*\logten}% - \pgfmathadd\tmp@min\logten% - \xdef\axis@TMP{\tmp@min,\pgfmathresult,...,\tmp@max}% - \aftergroup\axis@needs@check@uniformtickfalse - \else - \expandafter\axis@compute@tick@times@logten\axis@ytickten\to\axis@TMP - \aftergroup\axis@needs@check@uniformticktrue - \fi - \fi - \endgroup - \let\axis@ytick=\axis@TMP - %\message{pgfplots.sty: ytick set to \axis@ytick[ymode=\the\axis@ymode.}% + \axis@assign@default@tick@foraxis{y}% \fi \ifaxis@needs@check@uniformtick \ifnum\axis@ymode=1 @@ -1187,6 +1254,10 @@ %-------------------------------------------------- } +% PRECONDITION: correct axis limits +% POSTCONDITION: the current x- and y unit vectors are changed; +% \axis@[xy]coord{min,max}TEX are set +% \def\axis@initsizes{% % INIT. % @@ -1341,7 +1412,6 @@ \def\axis@BEGIN@init@and@draw@axis{% \axis@determinedefaultvalues - \axis@initsizes % X-Achsenbeschriftung: % LADE DIE \axis@xtick -variable REIN @@ -1428,12 +1498,12 @@ % any user-specified axis limits: \ifx\axis@ymin\empty \else - \pgfmathlog@\expandafter{\axis@ymin}% + \expandafter\pgfmathlog@\expandafter{\axis@ymin}% \let\axis@ymin=\pgfmathresult \fi \ifx\axis@ymax\empty \else - \pgfmathlog@\expandafter{\axis@ymax}% + \expandafter\pgfmathlog@\expandafter{\axis@ymax}% \let\axis@ymax=\pgfmathresult \fi % @@ -1552,8 +1622,18 @@ x={\axis@xcoordmaxTEX-\axis@xcoordminTEX}, y={\axis@ycoordmaxTEX-\axis@ycoordminTEX} ]% - \showxlabel - \showylabel + \ifx\axis@xlabel\empty + \else + \axisshowxlabel + \fi + \ifx\axis@ylabel\empty + \else + \axisshowylabel + \fi + \ifx\axis@title\empty + \else + \axisshowtitle + \fi \axis@createlegend \end{scope}% % diff --git a/Master/texmf-dist/tex/latex/pgfplots/pgfplotshelpers.sty b/Master/texmf-dist/tex/latex/pgfplots/pgfplotshelpers.sty new file mode 100644 index 00000000000..203f16379ee --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgfplots/pgfplotshelpers.sty @@ -0,0 +1,205 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Low-level helper methods for string parsing and number conversion. +% +% This file comes as part of the pgfplots-package. +% +% Copyright 2007/2008 by Christian Feuersänger. +% +% This program is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program. If not, see <http://www.gnu.org/licenses/>. +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\ProvidesPackage{pgfplotshelpers}[2008/31/01 Version 0.9] + +\def\prettyprintnumberprecision{2} + +\def\pgfmathlog@tonumber#1pt{#1} + +% Invokes command #1 with #2 without the 'pt' suffix. +\def\invokepgf@math@one#1#2{% + %\edef\pgfmath@resulttemp{\pgf@sys@tonumber{#2}}% + %\expandafter#1\expandafter{\pgfmath@resulttemp}% + \edef\pgfmath@resulttemp{{\pgf@sys@tonumber{#2}}}% + \expandafter#1\pgfmath@resulttemp% +} + +% Expands #2 using \edef and invokes #1 with the resulting string. +% +% Example: +% \pgfmath@y=7.9pt +% \pgfmathlog@invoke@expanded\pgfmathexp@{{\pgf@sys@tonumber{\pgfmath@y}}}% +% will invoke +% \pgfmathexp@{7.9} +\def\pgfmathlog@invoke@expanded#1#2{% + \edef\pgfmath@resulttemp{#2}% + \expandafter#1\pgfmath@resulttemp +} + +% Expands the NUMBER (without units) to a pretty printed string argument: rounded to +% several digits, discard any suffix zeros etc. +% +% It uses \prettyprintnumberprecision digits after the comma. +\def\prettyprintnumber#1{% + \begingroup +%\tracingmacros=2\tracingcommands=2 + \edef\argument{#1}% + \expandafter\prettyprintnumber@impl\argument.\END +%\tracingmacros=0\tracingcommands=0 + \endgroup +} + +\def\prettyprintnumber@impl#1.#2\END{% + % This implementation is really bad. + % I hope I find time to get something better... + \def\tmp{#2}% + \ifx\tmp\empty + % there was no '.' in the original arg + #1 + \else + % ok, there is a dot in the arg. + % 1. ROUND + % 2. DISCARD ZEROS + \toksdef\tokens=2 + \let\i=\c@pgf@counta + \let\lastdigit=\c@pgf@countb + \let\numberAsDIM=\pgfmath@x + \let\zeroFilledNum=\pgfmath@y + \i=0 + \tokens={}% + \def\D{#2}% + \def\DOT{.}% + \ifx\D\DOT + % the number '#1.' + \let\D=\empty + \else + \expandafter\prettyprintnumber@impl@getfirst + \prettyprintnumberprecision + \of#2% + \to\tokens% + \nextto\D + \count\i + \fi + %\message{Pretty print: first <= \prettyprintnumberprecision\ digits after period: \the\tokens, (strlen=\the\i), next rounding-relevant-digit: '\D'}% + \ifx\D\empty + \numberAsDIM=#1\expandafter.\the\tokens pt + % Nothing to do - we have our desired precision. + \else + \lastdigit\expandafter=\D\relax +% \message{D=\D!}% + \ifnum\lastdigit>4 + \numberAsDIM=#1\expandafter.\expandafter\the\tokens\D pt + % round up: + % compute numberAsDIM += 0.0000[10-digit] + \advance\lastdigit by-10 + \multiply\lastdigit by-1 + \tokens={0.}% + \loop + \ifnum\i>0 + \tokens=\expandafter{\the\tokens0}% + \advance\i by-1 + \repeat + \edef\D{\the\tokens\the\lastdigit pt}% + \expandafter\zeroFilledNum\D + \ifdim\numberAsDIM<0pt + \advance\numberAsDIM by-\zeroFilledNum + \else + \advance\numberAsDIM by\zeroFilledNum + \fi + \else + \numberAsDIM=#1\expandafter.\the\tokens pt + \fi + \fi + %\message{Pretty print: Result after rounding = \the\numberAsDIM / zeroFilledNum = \the\zeroFilledNum [only defined on up-rounding}% + \edef\D{\pgf@sys@tonumber{\numberAsDIM}}% + \expandafter\prettyprintnumber@onlyrelevant@digits\D\to\D + % FIXME : I could return '\D' as macro!? May thats a better + % way... + \D + \fi +} + +% This macro takes the first \prettyprintnumberprecision digits after +% the period and squeezes away any trailing zeros. +% +% If no digits after the period remain, the period will be discarded +% as well. +\def\prettyprintnumber@onlyrelevant@digits#1.#2\to#3{% + \begingroup + \toksdef\tokens=2 + \let\i=\c@pgf@counta + \let\maxDigits=\c@pgf@countc + \let\numsuffixZeros=\c@pgf@countb + \tokens={#1.}% + \i=0 + \expandafter\maxDigits\prettyprintnumberprecision + \numsuffixZeros=0 + \prettyprintnumber@onlyrelevant@digits@leftshift#2\to#3 + \ifnum\numsuffixZeros>0 + \ifnum\numsuffixZeros=\i + \tokens={#1}% + \else + \maxDigits=\i + \advance\maxDigits by-\numsuffixZeros + \tokens={#1.}% + \i=0 + \prettyprintnumber@onlyrelevant@digits@leftshift#2\to#3 + \fi + \fi + \xdef\pgfplotshelpersTMP{\the\tokens}% + \endgroup + \let#3=\pgfplotshelpersTMP +} + + +% shifts the input argument until either no more input is left or +% \maxDigits entries have been acquired. +% +% It also updates \i (will contain the number of acquired elements) +% and \numsuffixZeros (the number of zeros at the tail of #3 on +% output). +\def\prettyprintnumber@onlyrelevant@digits@leftshift#1#2\to#3{% + \ifnum\i<\maxDigits + \tokens=\expandafter{\the\tokens#1}% + \advance\i by1 + \ifnum#1=0 + \advance\numsuffixZeros by1 + \else + \numsuffixZeros=0 + \fi + \def\tmp{#2}% + \ifx\tmp\empty + \else + \prettyprintnumber@onlyrelevant@digits@leftshift#2\to#3 + \fi + \fi +} + +\def\prettyprintnumber@impl@getfirst#1\of#2#3.\to#4\nextto#5\count#6{% + \edef#5{#3}% + #4=\expandafter{\the#4#2}% + \advance#6 by1 + \ifx#5\empty + \else + \ifnum#6<#1 + \prettyprintnumber@impl@getfirst #1\of#3.\to#4\nextto#5\count{#6}% + \else + \prettyprintnumber@impl@firstof#3\to#5 + \fi + \fi +} + +\def\prettyprintnumber@impl@firstof#1#2\to#3{\def#3{#1}}% + |