diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots')
32 files changed, 6638 insertions, 2710 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex index 616c0730726..58664dc323d 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex @@ -139,13 +139,15 @@ }% \def\pgfplotslibrarysurfstreamend{% \pgfplotsapplistXlet\pgfplotslibrarysurf@binarystream=\pgfplotslibrarysurf@binarystream@accum + \pgfplotsapplistXnewempty\pgfplotslibrarysurf@binarystream@accum }% % #1: a pgf point. % #2: a color coordinate in the range [0,1000] \def\pgfplotslibrarysurfstreamcoord#1#2{% \pgfplotsbinarysetbytes\pgfplotslibrarysurf@bytespercoordinate% - \pgf@process{#1}% + %\pgf@process{#1}% this here causes `{retaining \pgf@x}' messages and pollutes the save stack! Avoid it. See \tracingrestores=2 + #1% % The idea is to map % the low-level point coordinates LINEARLY into [0,2^{8*<bytes>}]. % @@ -159,12 +161,14 @@ % The decode procedure tells the pdf viewer how to invert that % stuff. % - \pgf@sys@bp@correct\pgf@x% - \pgfplotsbinaryencodedimenmaplinearly\pgf@x + \pgf@xa=\pgf@x + \pgf@sys@bp@correct\pgf@xa% + \pgfplotsbinaryencodedimenmaplinearly\pgf@xa %\message{POINT \the\c@pgfplots@scanlineindex: ENCODING(x=\the\pgf@x)=\pgfplotsbinaryresult.}\advance\c@pgfplots@scanlineindex by1 \t@pgfplots@toka=\expandafter{\pgfplotsbinaryresult}% - \pgf@sys@bp@correct\pgf@y% - \pgfplotsbinaryencodedimenmaplinearly\pgf@y + \pgf@ya=\pgf@y + \pgf@sys@bp@correct\pgf@ya% + \pgfplotsbinaryencodedimenmaplinearly\pgf@ya %\message{ENCODING(y=\the\pgf@y)=\pgfplotsbinaryresult.}% \t@pgfplots@tokb=\expandafter{\pgfplotsbinaryresult}% {% diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.groupplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.groupplots.code.tex index bb5ea8de194..5086fef9d47 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.groupplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.groupplots.code.tex @@ -28,6 +28,8 @@ \def\pgfplots@group@xticklabels{} \def\pgfplots@group@yticklabels{} +\def\pgfplots@group@xlabels{} +\def\pgfplots@group@ylabels{} \def\pgfplots@group@totalplots{1} \def\pgfplots@group@columns{1} \def\pgfplots@group@rows{1} @@ -54,14 +56,38 @@ /pgfplots/group/shared labels=false, /pgfplots/group/xticklabels at/.is choice, /pgfplots/group/xticklabels at/all/.code=\def\pgfplots@group@xticklabels{all}, - /pgfplots/group/xticklabels at/edge top/.code=\def\pgfplots@group@xticklabels{edgeT}, - /pgfplots/group/xticklabels at/edge bottom/.code=\def\pgfplots@group@xticklabels{edgeB}, + /pgfplots/group/xticklabels at/edge top/.code=\def\pgfplots@group@xticklabels{upper}, + /pgfplots/group/xticklabels at/edge bottom/.code=\def\pgfplots@group@xticklabels{lower}, /pgfplots/group/xticklabels at=all, /pgfplots/group/yticklabels at/.is choice, /pgfplots/group/yticklabels at/all/.code=\def\pgfplots@group@yticklabels{all}, - /pgfplots/group/yticklabels at/edge left/.code=\def\pgfplots@group@yticklabels{edgeL}, - /pgfplots/group/yticklabels at/edge right/.code=\def\pgfplots@group@yticklabels{edgeR}, + /pgfplots/group/yticklabels at/edge left/.code=\def\pgfplots@group@yticklabels{left}, + /pgfplots/group/yticklabels at/edge right/.code=\def\pgfplots@group@yticklabels{right}, /pgfplots/group/yticklabels at=all, + /pgfplots/group/xlabels at/.is choice, + /pgfplots/group/xlabels at/all/.code=\def\pgfplots@group@xlabels{all}, + /pgfplots/group/xlabels at/edge top/.code=\def\pgfplots@group@xlabels{upper}, + /pgfplots/group/xlabels at/edge bottom/.code=\def\pgfplots@group@xlabels{lower}, + /pgfplots/group/xlabels at=all, + /pgfplots/group/ylabels at/.is choice, + /pgfplots/group/ylabels at/all/.code=\def\pgfplots@group@ylabels{all}, + /pgfplots/group/ylabels at/edge left/.code=\def\pgfplots@group@ylabels{left}, + /pgfplots/group/ylabels at/edge right/.code=\def\pgfplots@group@ylabels{right}, + /pgfplots/group/ylabels at=all, + /pgfplots/group/x descriptions at/.is choice, + /pgfplots/group/x descriptions at/all/.style= + {/pgfplots/group/xlabels at=all,/pgfplots/group/xticklabels at=all}, + /pgfplots/group/x descriptions at/edge bottom/.style= + {/pgfplots/group/xlabels at=edge bottom, /pgfplots/group/xticklabels at=edge bottom}, + /pgfplots/group/x descriptions at/edge top/.style= + {/pgfplots/group/xlabels at=edge top, /pgfplots/group/xticklabels at=edge top}, + /pgfplots/group/y descriptions at/.is choice, + /pgfplots/group/y descriptions at/all/.style= + {/pgfplots/group/ylabels at=all, /pgfplots/group/yticklabels at=all}, + /pgfplots/group/y descriptions at/edge left/.style= + {/pgfplots/group/ylabels at=edge left, /pgfplots/group/yticklabels at=edge left}, + /pgfplots/group/y descriptions at/edge right/.style= + {/pgfplots/group/ylabels at=edge right, /pgfplots/group/yticklabels at=edge right}, /pgfplots/group/group name/.store in=\pgfplots@group@name, /pgfplots/group/empty plot/.style={/pgfplots/hide axis=true}, } @@ -83,6 +109,7 @@ % If there has been other plots before then end the plot % \ifnum0<\pgfplots@group@current@plot\relax + % DEBUG: \message{DEBUG: Ending plot} \endpgfplots@environment@opt \fi % Prepare for next plot, increment plot, row and column @@ -148,10 +175,97 @@ \fi% } +% +% Determine the labels of both x and y. +% +\def\pgfplots@group@determine@labels{% + \def\pgfplots@loc@TMPa{all} + \def\pgfplots@loc@TMPb{lower} + \ifx\pgfplots@loc@TMPa\pgfplots@group@xlabels% + % xlabels at=all + % Do nothing as all should have xlabels + \fi + \gdef\pgfplots@glob@TMPa{} + \ifx\pgfplots@loc@TMPb\pgfplots@group@xlabels% + % xlabels at=lower + \ifnum1<\pgfplots@group@rows\relax + \foreach \pgfplots@column in {1,...,\pgfplots@group@columns} {% + \foreach \pgfplots@row in {1,...,\pgfplots@group@rows} {% + \ifnum\pgfplots@row=\pgfplots@group@rows\relax% + \else + \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{% + \pgfplots@glob@TMPa,/pgfplots/group/plot c\pgfplots@column r\pgfplots@row/.append style={/pgfplots/xlabel={}}}% + \fi + }% + }% + \fi% + \else + \def\pgfplots@loc@TMPb{upper}% + \ifx\pgfplots@loc@TMPb\pgfplots@group@xlabels% + % xlabels at=upper + \ifnum1<\pgfplots@group@rows\relax + \foreach \pgfplots@column in {1,...,\pgfplots@group@columns} {% + \foreach \pgfplots@row in {1,...,\pgfplots@group@rows} {% + \ifnum\pgfplots@row=1 % + \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{% + \pgfplots@glob@TMPa,/pgfplots/group/plot c\pgfplots@column r\pgfplots@row/.append style={/pgfplots/xticklabel pos=upper}}% + \else + \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{% + \pgfplots@glob@TMPa,/pgfplots/group/plot c\pgfplots@column r\pgfplots@row/.append style={/pgfplots/xlabel={}}}% + \fi + }% + }% + \fi% + \fi + \fi + % + % Defining styles for the y's + % + \ifx\pgfplots@loc@TMPa\pgfplots@group@ylabels% + % ylabels at=all + % Do nothing as all should have ylabels + \else + \def\pgfplots@loc@TMPb{left}% + \ifx\pgfplots@loc@TMPb\pgfplots@group@ylabels% + % ylabels at=left + \ifnum1<\pgfplots@group@columns\relax + \foreach \pgfplots@row in {1,...,\pgfplots@group@rows} {% + \foreach \pgfplots@column in {2,...,\pgfplots@group@columns} {% + \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{% + \pgfplots@glob@TMPa,/pgfplots/group/plot c\pgfplots@column r\pgfplots@row/.append style={/pgfplots/ylabel={}}}% + }% + }% + \fi% + \else + \def\pgfplots@loc@TMPb{right}% + \ifx\pgfplots@loc@TMPb\pgfplots@group@ylabels% + % ylabels at=right + \ifnum1<\pgfplots@group@columns\relax + \foreach \pgfplots@row in {1,...,\pgfplots@group@rows} {% + \foreach \pgfplots@column in {1,...,\pgfplots@group@columns} {% + \ifnum\pgfplots@column=\pgfplots@group@columns\relax + \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{% + \pgfplots@glob@TMPa,/pgfplots/group/plot c\pgfplots@column r\pgfplots@row/.append style={/pgfplots/yticklabel pos=upper}}% + \else + \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{% + \pgfplots@glob@TMPa,/pgfplots/group/plot c\pgfplots@column r\pgfplots@row/.append style={/pgfplots/ylabel={}}}% + \fi + }% + }% + \fi + \fi% + \fi + \fi + \expandafter\pgfkeys\expandafter{\pgfplots@glob@TMPa} +} + +% +% Determine the ticklabels of both x and y. +% \def\pgfplots@group@determine@ticklabels{% \def\pgfplots@loc@TMPa{all} - \def\pgfplots@loc@TMPb{edgeT} - \def\pgfplots@loc@TMPc{edgeB} + \def\pgfplots@loc@TMPb{upper} + \def\pgfplots@loc@TMPc{lower} \ifx\pgfplots@loc@TMPa\pgfplots@group@xticklabels% % Do nothing as all should have xticklabels \fi @@ -184,8 +298,8 @@ % % Defining styles for the ytick's % - \def\pgfplots@loc@TMPb{edgeL} - \def\pgfplots@loc@TMPc{edgeR} + \def\pgfplots@loc@TMPb{left} + \def\pgfplots@loc@TMPc{right} \ifx\pgfplots@loc@TMPa\pgfplots@group@yticklabels% % Do nothing as all should have yticklabels \fi @@ -307,6 +421,7 @@ % \pgfplots@group@individual@setup \pgfplots@group@determine@ticklabels + \pgfplots@group@determine@labels \pgfplots@group@current@plot=0% \pgfplots@group@current@row=1% \pgfplots@group@current@column=0% diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.units.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.units.code.tex index 5326db78aba..084d076b289 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.units.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.units.code.tex @@ -64,21 +64,21 @@ /pgfplots/x unit/.initial={},% /pgfplots/x unit prefix/.initial={},% /pgfplots/change x base/.is if=pgfplots@units@change@x@base,% - /pgfplots/change x base/.initial=false,% + /pgfplots/change x base=false,% % % Setup basic y settings % /pgfplots/y unit/.initial={},% /pgfplots/y unit prefix/.initial={},% /pgfplots/change y base/.is if=pgfplots@units@change@y@base,% - /pgfplots/change y base/.initial=false,% + /pgfplots/change y base=false,% % % Setup basic z settings % /pgfplots/z unit/.initial={},% /pgfplots/z unit prefix/.initial={},% /pgfplots/change z base/.is if=pgfplots@units@change@z@base,% - /pgfplots/change z base/.initial=false,% + /pgfplots/change z base=false,% % % default markings of units. I.e. the surroundings of the unit: % [unit markings=curly braces] yields {<unit>} @@ -221,4 +221,4 @@ \fi% \fi% } -\endinput
\ No newline at end of file +\endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex index 7464dc43876..d62273eca51 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex @@ -96,6 +96,15 @@ \fi } +% #1 the array's name (a macro name +% #2 a list created by \pgfplotslistnew +\def\pgfplotsarrayfrompgfplotslist#1#2{% + \pgfplotsarraynewempty#1% + \pgfplotslistforeachungrouped#2\as\pgfplotsarray@TMPa{% + \expandafter\pgfplotsarraypushback\expandafter{\pgfplotsarray@TMPa}\to#1% + }% +}% + \def\pgfplotsarraynew@backslash#1#2{% \pgfplotsarraynewempty{#1}% \long\def\pgfplotsarraynew@impl@rest{#2}% @@ -199,6 +208,9 @@ \def\pgfplotsarrayselect#1\of#2\to#3{% \c@pgfplotsarray@tmp=#1\relax \expandafter\let\expandafter#3\csname\string#2@\the\c@pgfplotsarray@tmp\endcsname% + \ifx#3\relax + \pgfplotsthrow{no such element}{#1}{No such element: \string\pgfplotsarrayselect\the\c@pgfplotsarray@tmp\string\of{\string#2}}\pgfeov% + \fi } % Expands to the value at index #1 of array #2. @@ -315,12 +327,7 @@ \let\pgfplotsarrayforeachindex=\relax% } -% #1: arg1 (possibly not fully expanded) -% #2: arg2 (possibly not fully expanded) -% #3: code to invoke in case arg1<arg2 -% #4: code to invoke in case arg1>=arg2 \pgfkeys{% - /pgfplots/array/iflessthan/.code args={#1#2#3#4}{\ifnum#1<#2\relax#3\else#4\fi},% /pgfplots/array/unscope pre/.code={% % That's more or less efficient (although some runtime factors % could be saved). @@ -349,7 +356,8 @@ % Sorts array '#1' using N log N time. % % The sort key is provided as argument in -% /pgfplots/array/iflessthan/.code args={#1#2#3#4}, see above. +% /pgfplots/iflessthan/.code args={#1#2#3#4}, see docs in +% pgfplotsutil.code.tex. % % Remarks: % - the sorting algorithm is a sub-optimal mergesort currently - @@ -400,13 +408,22 @@ % [\pgfplotsarrayforeach\testarray\as\elem{\elem\space}] % %-------------------------------------------------- -\def\pgfplotsarraysort#1{% +\def\pgfplotsarraysort{% + \pgfutil@ifnextchar[{\pgfplotsarraysort@opt}{\pgfplotsarraysort@opt[]}% +}% +\def\pgfplotsarraysort@opt[#1]#2{% % I admit, the implementation is more-or less copy-paste of an % experiment I had done at university. It does its job, but it is - % certainly not optimal. + % certainly not optimal (that means: it is slow). \begingroup - \pgfkeysgetvalue{/pgfplots/array/iflessthan/.@cmd}\pgfplotsarraysort@iflt - \pgfplotsarraysize{#1}\to\c@pgfplotsarray@tmp + \pgfqkeys{/pgfplots/array}{#1}% + \pgfkeysifdefined{/pgfplots/array/iflessthan/.@cmd}{% + \pgfplots@warning{Warning: /pgfplots/array/iflessthan/.@cmd is deprecated. Please use /pgfplots/iflessthan/.@cmd instead.}% + \pgfkeysgetvalue{/pgfplots/array/iflessthan/.@cmd}\pgfplotsarraysort@iflt + }{% + \pgfkeysgetvalue{/pgfplots/iflessthan/.@cmd}\pgfplotsarraysort@iflt + }% + \pgfplotsarraysize{#2}\to\c@pgfplotsarray@tmp \pgfplotsarrayresizeglobal{pgfparraytmp}{\the\c@pgfplotsarray@tmp}% \countdef\c@pgfplotsarraysort@m=0 \countdef\c@pgfplotsarraysort@k=1 @@ -414,15 +431,15 @@ \countdef\c@pgfplotsarraysort@l=3 \countdef\c@pgfplotsarraysort@j=4 \countdef\c@pgfplotsarraysort@q=5 - \def\pgfplotsarray@mergesort@{\pgfplotsarray@mergesort{#1}}% - \def\pgfplotsarray@mergesort@recurse@{\pgfplotsarray@mergesort@recurse{#1}}% + \def\pgfplotsarray@mergesort@{\pgfplotsarray@mergesort{#2}}% + \def\pgfplotsarray@mergesort@recurse@{\pgfplotsarray@mergesort@recurse{#2}}% \edef\pgfplotsarray@mergesort@@{{0}{\the\c@pgfplotsarray@tmp}}% \expandafter\pgfplotsarray@mergesort@\pgfplotsarray@mergesort@@ % % copy the complete, sorted result outside of the current scope. - \pgfkeysvalueof{/pgfplots/array/unscope pre/.@cmd}#1\pgfeov + \pgfkeysvalueof{/pgfplots/array/unscope pre/.@cmd}#2\pgfeov \endgroup - \pgfkeysvalueof{/pgfplots/array/unscope post/.@cmd}#1\pgfeov + \pgfkeysvalueof{/pgfplots/array/unscope post/.@cmd}#2\pgfeov }% % #1: array name, @@ -473,20 +490,27 @@ \c@pgfplotsarraysort@j=\c@pgfplotsarraysort@k \advance\c@pgfplotsarraysort@j by#2 \pgfplotsarrayselect{\c@pgfplotsarraysort@j}\of{#1}\to\pgfplotsarray@x@k + \begingroup \pgfplotsarraysort@iflt {\pgfplotsarray@x@mpl}% {\pgfplotsarray@x@k}% {% x[m+l] < x[k] - \pgfplotsarrayletentryglobal\c@pgfplotsarraysort@i\of{pgfparraytmp}=\pgfplotsarray@x@mpl - \advance\c@pgfplotsarraysort@i by1 - \advance\c@pgfplotsarraysort@l by1 + \aftergroup\pgfplots@loc@tmptrue }% {% x[k] <= x[m+l] - \pgfplotsarrayletentryglobal\c@pgfplotsarraysort@i\of{pgfparraytmp}=\pgfplotsarray@x@k - \advance\c@pgfplotsarraysort@i by1 - \advance\c@pgfplotsarraysort@k by1 + \aftergroup\pgfplots@loc@tmpfalse }% \pgfeov + \endgroup + \ifpgfplots@loc@tmp + \pgfplotsarrayletentryglobal\c@pgfplotsarraysort@i\of{pgfparraytmp}=\pgfplotsarray@x@mpl + \advance\c@pgfplotsarraysort@i by1 + \advance\c@pgfplotsarraysort@l by1 + \else + \pgfplotsarrayletentryglobal\c@pgfplotsarraysort@i\of{pgfparraytmp}=\pgfplotsarray@x@k + \advance\c@pgfplotsarraysort@i by1 + \advance\c@pgfplotsarraysort@k by1 + \fi \pgfutil@repeat % % append: diff --git a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex index 87ce40e586b..b60ff65c4f7 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex @@ -78,59 +78,85 @@ % Use braces '{}' to use '\\' or ',' as arguments. % \long\def\pgfplotslistnew#1#2{% - \pgfplots@check@backwards@compatible@list@format #2\\\pgfplots@EOI - \ifpgfplots@is@old@list@format - \pgfplotslistnew@backslash{#1}{#2}% + \pgfplotslist@check@backslash@list #2\\\pgfplotslist@EOI + \ifpgfplotslist@is@backslash@terminated + \pgfplotslistnew@backslash@{#1}{#2}% \else \pgfplots@foreach@to@list{#2}\to#1% \fi } +% Is this here *ever* used!? I guess not. \long\def\pgfplotslistnew@backslash#1#2{% \pgfplotslistnewempty{#1}% - \long\def\pgfplotslistnew@impl@rest{#2}% \pgfplotslist@check@backslash@list #2\\\pgfplotslist@EOI \ifpgfplotslist@is@backslash@terminated + \long\def\pgfplotslistnew@impl@rest{#2\pgfplotslist@EOI\\}% + \def\pgfplotslistnew@backslash@loop{\pgfplotslistnew@impl{#1}}% \else - \expandafter\def\expandafter\pgfplotslistnew@impl@rest\expandafter{\pgfplotslistnew@impl@rest,}% + \def\pgfplotslistnew@backslash@loop{\pgfplotslistnew@impl@comma{#1}}% + \long\def\pgfplotslistnew@impl@rest{#2\pgfplotslist@EOI,}% \fi - \pgfutil@loop - \ifx\pgfplotslistnew@impl@rest\pgfutil@empty - \pgfplots@loop@CONTINUEfalse + \expandafter\pgfplotslistnew@backslash@loop\pgfplotslistnew@impl@rest +}% +\long\def\pgfplotslistnew@backslash@#1#2{% + \pgfplotslistnewempty{#1}% + \def\pgfplotslistnew@backslash@loop{\pgfplotslistnew@impl{#1}}% + \pgfplotslistnew@backslash@loop#2\pgfplotslist@EOI\\% +}% + +% helper macro for \pgfplotslistnew +\long\def\pgfplotslistnew@impl#1#2\\{% + \def\pgfplotslist@loc@TMPa{#2}% + \ifx\pgfplotslist@loc@TMPa\pgfplotslist@EOI \else - \pgfplots@loop@CONTINUEtrue + \pgfplotslistpushback{#2}\to#1\relax% + \expandafter\pgfplotslistnew@backslash@loop \fi - \ifpgfplots@loop@CONTINUE - \ifpgfplotslist@is@backslash@terminated - \expandafter\pgfplotslistnew@impl\pgfplotslistnew@impl@rest\tolist#1\relax - \else - \expandafter\pgfplotslistnew@impl@comma\pgfplotslistnew@impl@rest\tolist#1\relax - \fi - \pgfutil@repeat -}% +} +\long\def\pgfplotslistnew@impl@comma#1#2,{% + \def\pgfplotslist@loc@TMPa{#2}% + \ifx\pgfplotslist@loc@TMPa\pgfplotslist@EOI + \else + \pgfplotslistpushback{#2}\to#1\relax% + \expandafter\pgfplotslistnew@backslash@loop + \fi +} \def\pgfplotslist@EOI{\pgfplotslist@EOI} +\def\pgfplotslist@backslashsep{\\} \long\def\pgfplotslist@check@backslash@list#1\\#2\pgfplotslist@EOI{% - \def\pgfplotslist@loc@TMPa{#2}% - \ifx\pgfplotslist@loc@TMPa\pgfutil@empty + \def\pgfplotslist@loc@TMPx{#2}% + \ifx\pgfplotslist@loc@TMPx\pgfutil@empty \pgfplotslist@is@backslash@terminatedfalse + \let\pgfplotslist@check@backslash@list@next=\relax \else - \pgfplotslist@is@backslash@terminatedtrue + \def\pgfplotslist@loc@TMPy{ }% + \ifx\pgfplotslist@loc@TMPx\pgfplotslist@loc@TMPy + \pgfplotslist@is@backslash@terminatedfalse + \let\pgfplotslist@check@backslash@list@next=\relax + \else + \ifx\pgfplotslist@loc@TMPx\pgfplotslist@backslashsep + % ok. The list is something like 'a\\b\\' so the + % complete input is + % 'a\\b\\ \\ \EOI' + % we have iterated long enough to find only the '\\' + % right before the \EOI. It is thus backslash + % terminated. + \pgfplotslist@is@backslash@terminatedtrue + \let\pgfplotslist@check@backslash@list@next=\relax + \else + % Iterate. We want to check the last list element. + \long\def\pgfplotslist@check@backslash@list@next{\pgfplotslist@check@backslash@list#2\pgfplotslist@EOI}% + \fi + \fi \fi + \pgfplotslist@check@backslash@list@next }% % Copies list #1 to list #2. \def\pgfplotslistcopy#1\to#2{\let#2=#1} -% helper macro for \pgfplotslistnew -\long\def\pgfplotslistnew@impl#1\\#2\tolist#3{% - \pgfplotslistpushback#1\to#3\relax% - \def\pgfplotslistnew@impl@rest{#2}% -} -\long\def\pgfplotslistnew@impl@comma#1,#2\tolist#3{% - \pgfplotslistpushback#1\to#3\relax% - \def\pgfplotslistnew@impl@rest{#2}% -} % #1: the item to prepend diff --git a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex index 157f8874691..b2c3d7bf946 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex @@ -1,6 +1,6 @@ %-------------------------------------------- % -% Package numtable +% Package pgfplotstable % % Provides support to read and work with abstact numeric tables of the % form @@ -11,7 +11,7 @@ % 1e124 0.00001 1.2345e-12 % ... % -% Copyright 2007/2008 by Christian Feuersänger. +% Copyright 2007-2010 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 @@ -32,45 +32,18 @@ % This file provides a high-level table manipulation and typesetting % package. % -% -% --------------------------------------------- -% Implementation notes for programmers: -% --------------------------------------------- -% -% The table data structure consists of -% 1. A name which must be a valid TeX macro like '\table' -% 2. A column list in the \pgfplotslist format. -% In fact, the column list is stored in the table's name: -% \pgfplotslistnewempty\table -% 3. A "file name" stored in -% \csname\string<\namemacro>@@table@name\endcsname -% 4. A "scan line length" number stored in -% \csname\string<\namemacro>@@table@scanline\endcsname -% It contains the value of \pgfplotsscanlinelength which has -% been identified right after \pgfplotstableread. -% 5. foreach column, there is a list of row-values (a row-vector) in -% the \pgfplotslist format named -% \csname\string<\namemacro>@<column name>\endcsname -% +% see pgfplotstableshared.code.tex for the low level routines. -\newif\ifpgfplotstable@search@header -\newif\ifpgfplotstable@firstline@is@header -\newcount\c@pgfplotstable@counta -\newwrite\pgfplotstable@outfile \newif\ifpgfplotstabletypesetdebug +\newif\ifpgfplotstable@sort \newif\ifpgfplotstabletypesetskipcoltypes \newif\ifpgfplotstabletypesetresult \newif\ifpgfplotstableuserow \newif\ifpgfplotstabletypeset@includeoutfiles \newif\ifpgfplotstabletypeset@force@remake -\newif\ifpgfplots@addplotimpl@readcompletely \newif\ifpgfplotstable@disable@rowcolstyles -% should always be false; use only in grouped internal macros -\newif\ifpgfplots@table@options@areset -\newif\ifpgfplots@tableread@to@listener -\newif\ifpgfplots@tableread@use@begingroup \input pgfplotstable.coltype.code.tex @@ -96,34 +69,6 @@ % /pgfplots/table/display columns/<col index>/.style={} % /pgfplots/table/create on use/<col name>/.style={create options} \pgfkeys{% - /pgfplots/table/header/.is choice, - /pgfplots/table/header/true/.code={\pgfplotstable@firstline@is@headerfalse\pgfplotstable@search@headertrue}, - /pgfplots/table/header/false/.code={\pgfplotstable@firstline@is@headerfalse\pgfplotstable@search@headerfalse}, - /pgfplots/table/header/has colnames/.code={\pgfplotstable@firstline@is@headertrue\pgfplotstable@search@headerfalse}, - /pgfplots/table/header=true, - /pgfplots/table/x index/.initial=0, - /pgfplots/table/x/.initial=, - /pgfplots/table/x expr/.initial=, - /pgfplots/table/y index/.initial=1, - /pgfplots/table/y/.initial=, - /pgfplots/table/y expr/.initial=, - /pgfplots/table/z index/.initial=2, - /pgfplots/table/z/.initial=, - /pgfplots/table/z expr/.initial=, - /pgfplots/table/meta index/.initial=, - /pgfplots/table/meta/.initial=, - /pgfplots/table/meta expr/.initial=, - /pgfplots/table/x error index/.initial=, - /pgfplots/table/y error index/.initial=, - /pgfplots/table/z error index/.initial=, - /pgfplots/table/x error/.initial=, - /pgfplots/table/y error/.initial=, - /pgfplots/table/z error/.initial=, - /pgfplots/table/x error expr/.initial=, - /pgfplots/table/y error expr/.initial=, - /pgfplots/table/z error expr/.initial=, - /pgfplots/table/read completely/.is if=pgfplots@addplotimpl@readcompletely, - /pgfplots/table/read completely/.default=true, /pgfplots/table/disable rowcol styles/.is if=pgfplotstable@disable@rowcolstyles, /pgfplots/table/disable rowcol styles/.default=true, /pgfplots/table/row predicate/.code={}, @@ -173,30 +118,38 @@ \pgfkeys{/pgfplots/table/row predicate/.append code={% \ifnum\pgfplotstablerow=0 \ifnum\pgfplotstablecol=0 + \pgfutil@ifundefined{pgfplotstable@unique@bitlist@backup}{% + }{% + \pgfplots@error{It seems there are *multiple* 'unique' keys running on one table. That doesn't work correctly, I guess. Consider using '\string\pgfplotstableset{row predicate/.code={}}' to reset it.}% + }% % PREPARE ONCE! Assemble the boolean results into % a list which is used for the complete table: - \expandafter\pgfplotstablegetcolumnfromstruct\expandafter{\expandafter\pgfplotstablecolname\expandafter}\expandafter\of\pgfplotstablename\to\pgfplotstable@unique@col + \def\pgfplotstable@loc@TMPd{\pgfplotstablegetcolumnfromstruct{#1}\of}% + \expandafter\pgfplotstable@loc@TMPd\pgfplotstablename\to\pgfplotstable@unique@col \pgfplotslistnewempty\pgfplotstable@unique@bitlist - \let\pgfplotstable@unique@LAST=\relax + \let\pgfplotstable@unique@LAST=\pgfutil@empty \pgfplotslistforeachungrouped\pgfplotstable@unique@col\as\pgfplotstable@unique@cur{% \def\pgfplotstable@unique@bit{1}% - \ifx\pgfplotstable@unique@LAST\relax + \ifx\pgfplotstable@unique@LAST\pgfutil@empty \else \ifx\pgfplotstable@unique@LAST\pgfplotstable@unique@cur \def\pgfplotstable@unique@bit{0}% \fi \fi + \ifpgfplotstabletypesetdebug + \pgfplots@message{unique={#1}: cur == last <=> ( \pgfplotstable@unique@cur\space == \pgfplotstable@unique@LAST ) = \pgfplotstable@unique@bit.}% + \fi \expandafter\pgfplotslistpushback\pgfplotstable@unique@bit\to\pgfplotstable@unique@bitlist \let\pgfplotstable@unique@LAST=\pgfplotstable@unique@cur }% \global\let\pgfplotstable@unique@bitlist@backup=\pgfplotstable@unique@bitlist \else - \ifx\pgfplotstable@unique@bitlist@backup\relax + \pgfutil@ifundefined{pgfplotstable@unique@bitlist@backup}{% % this sanity checking is NOT fool proof: it % fails if there are different occurances of % unique in the same file - \pgfplotstable@error{Sorry, the row predicate /pgfplots/table/unique={#1} has been used in the wrong context: it needs to be invoked for the very first processed column, not column no \pgfplotstablecol. Please provide it as argument to \string\pgfplotstabletypeset[unique={#1}] and not inside of column-specific styles.}% - \fi + \pgfplotstable@error{Sorry, the row predicate /pgfplots/table/unique={#1} has been used in the wrong context: it needs to be invoked for the very first processed column, not column no \pgfplotstablecol. Please provide it as argument to \string\pgfplotstabletypeset[unique={#1}] and not inside of column-specific styles}% + }{}% \fi % acquire the assembled list here: we'll do a lot of % popfronts with it. @@ -212,16 +165,18 @@ \pgfplotstableuserowfalse \fi \fi + % cleanup: + {% + \count0=\pgfplotstablecol\relax \advance\count0 by1 + \ifnum\count0=\pgfplotstablecols\relax + \count0=\pgfplotstablerow\relax \advance\count0 by1 + \ifnum\count0=\pgfplotstablerows\relax + \global\let\pgfplotstable@unique@bitlist@backup=\relax + \fi + \fi + }% }}% },% - /pgfplots/table/col sep/.is choice, - /pgfplots/table/col sep/space/.code = {\def\pgfplotstableread@COLSEP@CASE{0}}, - /pgfplots/table/col sep/comma/.code = {\def\pgfplotstableread@COLSEP@CASE{1}}, - /pgfplots/table/col sep/semicolon/.code = {\def\pgfplotstableread@COLSEP@CASE{2}}, - /pgfplots/table/col sep/colon/.code = {\def\pgfplotstableread@COLSEP@CASE{3}}, - /pgfplots/table/col sep/braces/.code = {\def\pgfplotstableread@COLSEP@CASE{4}}, - /pgfplots/table/col sep/tab/.code = {\def\pgfplotstableread@COLSEP@CASE{5}}, - /pgfplots/table/col sep=space, % columns={name1,name2} % or % columns={[index]2,name2,name3,[index]5} @@ -377,7 +332,6 @@ }, /pgfplots/table/dcolumn/.default={D{.}{.}{2}}{c}, /pgfplots/table/column type/.initial={c}, - /pgfplots/table/every table/.style={}, /pgfplots/table/every even row/.style={}, /pgfplots/table/every odd row/.style={}, /pgfplots/table/every last row/.style={}, @@ -402,6 +356,7 @@ /pgfplots/table/skip coltypes/.is if=pgfplotstabletypesetskipcoltypes, /pgfplots/table/skip coltypes/.default=true, /pgfplots/table/debug/.is if=pgfplotstabletypesetdebug, + /pgfplots/table/debug level/.initial=0,% % % will be redefined by |assign cell content| for every cell: /pgfplots/table/@cell content/.initial=, @@ -427,11 +382,32 @@ \fi \pgfkeyslet{/pgfplots/table/@cell content}\pgfmathresult }, + /pgfplots/table/numeric type/.code={% + \pgfkeysgetvalue{/pgfplots/table/assign cell content as number/.@cmd}\pgfplotstable@loc@TMPa% + \pgfkeyslet{/pgfplots/table/assign cell content/.@cmd}\pgfplotstable@loc@TMPa + }, /pgfplots/table/string type/.style={% /pgfplots/table/assign cell content/.style={% /pgfplots/table/@cell content={##1}% }% },% + /pgfplots/table/verb string type/.style={% + /pgfplots/table/assign cell content/.code={% + \def\pgfplotstable@loc@TMPa{##1}% + \pgfplots@command@to@string\pgfplotstable@loc@TMPa\pgfplotstable@loc@TMPa + \pgfkeyslet{/pgfplots/table/@cell content}{\pgfplotstable@loc@TMPa}% + }% + },% + /pgfplots/table/numeric as string type/.style={% + /pgfplots/table/assign cell content/.code={% + \def\pgfmathresult{##1}% + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfmathifisint{##1}{\let\pgfmathresult=\pgfretval}{\pgfmathfloattosci{\pgfretval}}% + \fi + \pgfkeyslet{/pgfplots/table/@cell content}\pgfmathresult + }% + },% /pgfplots/table/date type/.style={% /pgfplots/table/assign cell content/.code={% \begingroup @@ -659,6 +635,19 @@ \fi }% }, + /pgfplots/table/create col/linear regression/.code={% + \pgfplotstable@linear@regression{#1}% + \pgfkeysalso{/pgfplots/table/create col/@from list struct=\pgfplotsretval}% + }, + /pgfplots/table/create col/linear regression/.default=,% + /pgfplots/table/create col/linear regression/x/.initial=,% + /pgfplots/table/create col/linear regression/y/.initial=,% + /pgfplots/table/create col/linear regression/table/.initial=,% + /pgfplots/table/create col/linear regression/variance/.initial=,% + /pgfplots/table/create col/linear regression/variance list/.initial=,% + /pgfplots/table/create col/linear regression/variance src/.initial=,% + /pgfplots/table/create col/linear regression/xmode/.initial=,% auto + /pgfplots/table/create col/linear regression/ymode/.initial=,% auto /pgfplots/table/create col/quotient/.style={% /pgfplots/table/columns={#1}, /pgfplots/table/create col/assign first/.style={% @@ -814,12 +803,16 @@ \let\pgfmathdiff@x=\pgfmathresult \pgfmathsubtract@{\pgfmathnext@y}{\pgfmathcur@y}% \let\pgfmathdiff@y=\pgfmathresult - \ifdim\pgfmathdiff@x pt=0.0pt + % FPU is more robust: + \pgfmathfloatparsenumber\pgfmathdiff@x\let\pgfmathdiff@x=\pgfmathresult + \pgfmathfloatparsenumber\pgfmathdiff@y\let\pgfmathdiff@y=\pgfmathresult + \pgfplots@ifzero\pgfmathdiff@x{% \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% - \else - \pgfmathdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% + }{% + \pgfmathfloatdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% + \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% - \fi + }% \else % \pgfmathfloatcreate{3}{0.0}{0}% % \pgfmathfloattosci@\pgfmathresult @@ -921,18 +914,14 @@ }, /pgfplots/table/colnames from/.initial=,% for \pgfplotstabletranspose /pgfplots/table/input colnames to/.initial=colnames,% for \pgfplotstabletranspose -} -\pgfkeys{ - % #1: the argument which should have been assigned. - % #2: an error message. - /pgfplots/exception/non unique colname/.code 2 args={% - \ifx\pgfplotsexceptionmsg\relax - \pgfplots@error{#2}% - \else - \pgfplots@error{\pgfplotsexceptionmsg}% - \fi - \let#1=\pgfutil@empty - },% + /pgfplots/table/sort/.is if=pgfplotstable@sort, + /pgfplots/table/sort/.default=true, + /pgfplots/table/sort key/.initial=[index]0,% + % the argument of `sort cmp' will be evaluates as style in the key + % path /pgfplots/. See pgfplotsutil.code.tex for available + % styles. + /pgfplots/table/sort cmp/.initial=float <, + /pgfplots/table/sort key from/.initial=, } % 'function graph cut y'={<epsilon>}{<options>}{comma-separated-list of specs where to get yi} % @@ -946,8 +935,8 @@ % \pgfplotstableset{ % create on use/cut/.style={create col/function graph cut y={7e-4}{x=Basis,ymode=log,xmode=log}{{table=regtable,y=special-L2}}}, %} -\pgfkeysdefargs{/pgfplots/table/create col/function graph cut y}{#1#2#3}{\pgfplotstable@fgc@init{#1}{#2}{#3}{y}{x}} -\pgfkeysdefargs{/pgfplots/table/create col/function graph cut x}{#1#2#3}{\pgfplotstable@fgc@init{#1}{#2}{#3}{x}{y}} +\pgfkeysdefnargs{/pgfplots/table/create col/function graph cut y}{3}{\pgfplotstable@fgc@init{#1}{#2}{#3}{y}{x}} +\pgfkeysdefnargs{/pgfplots/table/create col/function graph cut x}{3}{\pgfplotstable@fgc@init{#1}{#2}{#3}{x}{y}} \pgfkeys{% /pgfplots/table/create col/function graph cut/xmode/.is choice, /pgfplots/table/create col/function graph cut/xmode/linear/.code={\def\pgfplotstable@fgc@xmode{0}},% @@ -995,116 +984,6 @@ }% }% -% \pgfplotstableread[OPTIONS] {FILE} to \name -% -% This method reads a table from FILE to macro \name. -% -% FILE is something like -% G Basis dof L2 A Lmax cgiter maxlevel eps -% 5 5 5 8.31160034e-02 0.00000000e+00 1.80007647e-01 2 2 -1 -% 17 17 17 2.54685628e-02 0.00000000e+00 3.75580565e-02 5 3 -1 -% ... -% -% A number format line is also understood: -% G Basis dof L2 A Lmax cgiter maxlevel eps -% $flags int int int sci:8 sci:8 sci:8 int int std:8 -% 5 5 5 8.31160034e-02 0.00000000e+00 1.80007647e-01 2 2 -1 -% -% or a three-column-gnuplot file with 2 comment headers like -% #Curve 0, 20 points -% #x y type -% 0.00000 0.00000 i -% 0.52632 0.50235 i -% -% The table data is stored columnwise in lists and can be accessed -% with the other methods of this package. -% -% \pgfplotstableread[<options>]{<file>}{<\macro>} -% \pgfplotstableread[<options>]{<file>} to listener{<\macro>} -% -% The 'to listener' variant does NOT assemble a table data structure. -% Instead, it processes the input table row-wise and invokes <\macro> -% after each complete row. During the evaluation of <\macro>, the -% following methods can be used to query values: -% \pgfplotstablereadgetcolindex{<index>}{<\macro>} -% \pgfplotstablereadgetcolname{<name>}{<\macro>} -% \pgfplotstablereadvalueofcolname{<name>} -% \pgfplotstablereadvalueofcolindex{<index>} -% \thisrow{<name>} (equivalent to \pgfplotstablereadvalueofcolname) -% \getthisrow{<name>}{<\macro>} (equivalent to \pgfplotstablereadgetcolname) -% \thisrowno{<index>} (equivalent to \pgfplotstablereadvalueofcolindex) -% \getthisrowno{<index>}{<\macro>} -% \pgfplotstableforeachcolumn\as{<\iteratemacro>}{<loop body>} -% (the '\as' is required directly after -% \pgfplotstableforeachcolumn in this context) -% Attention: 'to listener' is scoped by TeX groups, so any assignments -% need to be done globally (or with aftergroup magic). -% -% More remarks about scoping: -% \pgfplotstableread to listener works as follows: -% \begingroup -% // load table -% while file has more lines: -% load line, read every column; -% invoke listener; -% repeat -% \endgroup -% -% In short: all invocations of listener have the same level of -% scoping: they are inside of one TeX group. But single listener -% invocations as such are not scoped. Make sure you don't -% accidentally overwrite one of the internals in listener. And: make -% sure you don't change temporary registers without scoping them! -% -% Note: this command also updates \pgfplotsscanlinelength. -\def\pgfplotstableread{% - \pgfutil@ifnextchar*{% - \pgfplots@tableread@use@begingroupfalse - \pgfplotstableread@impl@star - }{% - \pgfplots@tableread@use@begingrouptrue - \pgfplotstableread@impl@star*% - }% -}% -\def\pgfplotstableread@impl@star*{% - \pgfutil@ifnextchar[{% - \pgfplotstableread@impl - }{% - \pgfplotstableread@impl[]% - }% -} - -% BACKWARDS COMPATIBILITY -\let\pgfnumtableread=\pgfplotstableread - -% Invokes #2 if '#1' is an already loaded table and #3 if not. -\long\def\pgfplotstable@isloadedtable#1#2#3{% - \pgfplotsutil@ifdefinedui@withsuffix{#1}{@@table@name}{#2}{#3}% -}% - -% Defines \pgfmathresult (and now also \pgfplotsretval) to be the number of rows in table #1. -% -% #1 may be either a loaded table structure (a macro name) or a table -% file name. In the latter case, the file will be loaded temporarily. -\def\pgfplotstablegetrowsof#1{% - \pgfplotstable@isloadedtable{#1}{% - % ah - it is an already loaded table! - \begingroup - \pgfplotslistfront#1\to\pgfplotstablegetrows@@ - \expandafter\pgfplotslistsize\csname\string#1@\pgfplotstablegetrows@@\endcsname\to\c@pgfplotstable@counta - \edef\pgfmathresult{\the\c@pgfplotstable@counta}% - \pgfmath@smuggleone\pgfmathresult - \endgroup - }{% - % ah - it is a file name. - \begingroup - \pgfplotstableread{#1}\pgfplotstablegetrows@ - \pgfplotstablegetrowsof{\pgfplotstablegetrows@}% - \pgfmath@smuggleone\pgfmathresult - \endgroup - }% - \let\pgfplotsretval=\pgfmathresult -}% % \pgfplotstablesave[<options>]{<\tablename>}{file name} \def\pgfplotstablesave{% @@ -1149,6 +1028,9 @@ \or % col sep=tab: \xdef\pgfplots@glob@TMPc{\the\t@pgfplots@toka\pgfplotstableread@tab}% + \or + % col sep=&: + \xdef\pgfplots@glob@TMPc{\the\t@pgfplots@toka&}% \fi \endgroup \pgfkeyslet{/pgfplots/table/@cell content}\pgfplots@glob@TMPc% @@ -1167,15 +1049,19 @@ /pgfplots/table/col sep/semicolon/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{2}},% /pgfplots/table/col sep/colon/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{3}},% /pgfplots/table/col sep/braces/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{4}},% - /pgfplots/table/col sep/tab/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{5}},% + /pgfplots/table/col sep/tab/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{5}},% + /pgfplots/table/col sep/&/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{6}},% + /pgfplots/table/col sep/ampersand/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{6}},% /pgfplots/table/col sep=space,% /pgfplots/table/in col sep/.is choice,% /pgfplots/table/in col sep/space/.code = {\def\pgfplotstableread@COLSEP@CASE{0}},% /pgfplots/table/in col sep/comma/.code = {\def\pgfplotstableread@COLSEP@CASE{1}},% /pgfplots/table/in col sep/semicolon/.code = {\def\pgfplotstableread@COLSEP@CASE{2}},% /pgfplots/table/in col sep/colon/.code = {\def\pgfplotstableread@COLSEP@CASE{3}},% - /pgfplots/table/in col sep/braces/.code = {\def\pgfplotstableread@COLSEP@CASE{4}},% - /pgfplots/table/in col sep/tab/.code = {\def\pgfplotstableread@COLSEP@CASE{5}},% + /pgfplots/table/in col sep/braces/.code = {\def\pgfplotstableread@COLSEP@CASE{4}},% + /pgfplots/table/in col sep/tab/.code = {\def\pgfplotstableread@COLSEP@CASE{5}},% + /pgfplots/table/in col sep/&/.code = {\def\pgfplotstableread@COLSEP@CASE{6}},% + /pgfplots/table/in col sep/ampersand/.code = {\def\pgfplotstableread@COLSEP@CASE{6}},% /pgfplots/table/in col sep=space,% % WARNING: you NEED a '%' before '#1': #1,% @@ -1271,7 +1157,7 @@ % % #1 a table macro. % #2 either a file name or a table macro. -\def\pgfplotstablevertcat#1#2{% +\long\def\pgfplotstablevertcat#1#2{% \pgfplotstable@isloadedtable{#2}{% \pgfplotstable@isloadedtable{#1}{% % for each column in '#1': @@ -1315,7 +1201,7 @@ }% } \def\pgfplotstabletranspose@star*{\pgfutil@ifnextchar[{\pgfplotstabletranspose@opt}{\pgfplotstabletranspose@opt[]}}% -\def\pgfplotstabletranspose@opt[#1]#2#3{% +\long\def\pgfplotstabletranspose@opt[#1]#2#3{% \pgfplotstable@isloadedtable{#3}{% \pgfplotstabletranspose@[#1]{#2}{#3}% }{% @@ -1324,315 +1210,6 @@ }% }% -% Iterates through every column of table '#1' and invokes the code -% '#3' for each column. The current column name will be available as -% '#2' and the current column index as |\pgfplotstablecol| (starting -% with 0). -% -% Example: -% \pgfplotstableforeachcolumn{\table}\as\colname{% -% The column name is `\colname'; its index \pgfplotstablecol.\par -% }% -% -% REMARK: this routine does NOT introduce TeX groups. -\long\def\pgfplotstableforeachcolumn#1\as#2#3{% - \def\pgfplotstablecol{0}% - \pgfplotslistforeachungrouped#1\as#2{% - #3\relax% - \pgfplotsutil@advancestringcounter\pgfplotstablecol - }% - \let\pgfplotstablecol=\relax -}% -% A variant of \pgfplotstableforeachcolumn which is used inside of -% \pgfplotstableread to listener. -% -% It is used as \pgfplotstableforeachcolumn\as\cur{<do something with \cur>} -\long\def\pgfplotstableforeachcolumn@listener\as#1#2{% - \def\pgfplotstablecol{0}% - \pgfplotslistforeachungrouped\pgfplotstable@colnames@glob\as#1{% - #2\relax% - \pgfplotsutil@advancestringcounter\pgfplotstablecol - }% - \let\pgfplotstablecol=\relax -}% - -% Reports every element t_{ij} for a fixed column j (in read-only -% mode). -% -% For every cell, the code '#4' will be executed where '#3' will -% contain the cell's value. During code '#4', the macro -% \pgfplotstablerow will contain the current row index. -% -% #1: either a column name or the string '[index]' followed by a -% number denoting a column index Access by column name is much faster.. -% #2: the table (macro or file name) -% #3: the macro in which the cell values shall be written -% #4: the code to execute. -% -% Example: -% \pgfplotstableforeachcolumnelement{colname}\of\table\as\cellelem{% -% I have now cell element `\cellelem' at row index -% `\pgfplotstablerow'. -% \par -% } -% -% REMARK: this routine does NOT introduce TeX groups. -\long\def\pgfplotstableforeachcolumnelement#1\of#2\as#3#4{% - \def\pgfplotstablerow{0}% - \pgfplotstablegetcolumn{#1}\of{#2}\to\pgfplotstableforeachcolumnelement@list - \pgfplotslistforeachungrouped\pgfplotstableforeachcolumnelement@list\as#3{% - % allow nesting by copying the old value of \pgfplotstablerow: - \expandafter\pgfplotstableforeachcolumnelement@\expandafter{\pgfplotstablerow}{#4}% - }% - \let\pgfplotstablerow=\relax -}% -% helper method to allow nesting. It copies \pgfplotstablerow. -% #1: the expanded value of \pgfplotstablerow. -\long\def\pgfplotstableforeachcolumnelement@#1#2{% - #2\relax - \def\pgfplotstablerow{#1}% restore to old value. - % advance. - \pgfplotsutil@advancestringcounter\pgfplotstablerow -}% - -% A routine which is similar to \pgfplotstableforeachcolumnelement, -% but this here checks for changes in \pgfplotsretval and writes them -% back into the respected cell. -% -% The runtime is quadratic in the number of rows. -\long\def\pgfplotstablemodifyeachcolumnelement#1\of#2\as#3#4{% - \def\pgfplotstablerow{0}% - % - % Step 0: get the REAL column name for '#1'. - % This needs modifications if '#1' is [index]<integer>. - % -> store the colname to \pgfplotstable@loc@TMPc: - \def\pgfplotstable@loc@TMPc{#1}% - \pgfplotstable@is@colname{\pgfplotstable@loc@TMPc}%% - \ifpgfplotstableread@foundcolnames - \else - \expandafter\pgfplotstablegetcolumnnamebyindex\pgfplotstable@loc@TMPc\of{#2}\to\pgfplotstable@loc@TMPc - \fi - % Step 0.1: prepare a command which re-assembles column '#1' - % (using the real column name). - % The re-assemblation command will be invoked at the end of each - % iteration. This complicated macro preparation allows nested - % calls to \pgfplotstablemodifyeachcolumnelement. - \t@pgfplots@toka={\expandafter\pgfplotslistpushback\expandafter{#3}\to}% - \edef\pgfplotstable@loc@TMPd{% - \the\t@pgfplots@toka{\expandafter\noexpand\csname\string#2@\pgfplotstable@loc@TMPc\endcsname}}% - % Step 1: copy the column data to \pgfplotstable@loc@TMPb - \expandafter\pgfplotstablegetcolumnbyname\pgfplotstable@loc@TMPc\of#2\to\pgfplotstable@loc@TMPb% - % - % clear the original column: - \expandafter\pgfplotslistnewempty\csname\string#2@\pgfplotstable@loc@TMPc\endcsname - % - % Call loop. The prepared re-assemble macro will be provided as macro argument - % to allow nested calls: - \expandafter\pgfplotstablemodifyeachcolumnelement@\expandafter{\pgfplotstable@loc@TMPd} - {\pgfplotstable@loc@TMPb}{#3}{#4}% - \let\pgfplotstablerow=\relax -}% -% #1: post-iteration code -% #2: the row list -% #3: the loop macro to assign -% #4: the loop body -\long\def\pgfplotstablemodifyeachcolumnelement@#1#2#3#4{% - \pgfplotslistforeachungrouped{#2}\as#3{% - % allow nesting by copying the old value of \pgfplotstablerow: - \expandafter\pgfplotstableforeachcolumnelement@\expandafter{\pgfplotstablerow}{#4}% - #1% - }% -} - -% Selects a single table element at row #1 and column #2 from table -% #3. -% -% #1: a row index. -% #2: a column name or the string '[index]' followed by a number -% denoting a column index. Access by column name is much faster. -% #3: the table (macro or file name). -% -% The cell value will be written into the macro \pgfplotsretval. -% -% REMARK: -% this routine is supposed to be very slow: it needs time O(N) where N -% is the number of rows. This may change in future versions. -% -% Example: -% \pgfplotstablegetelem{0}{[index]2}\of\table -% The elem is `\pgfplotsretval'. -\def\pgfplotstablegetelem#1#2\of#3{% - \begingroup - \pgfplotstablegetcolumn{#2}\of{#3}\to\pgfplotstable@loc@TMPa - \def\pgfplotsexceptionmsg{Sorry, row `#1' does not exist in table \pgfplotstablenameof{#3}}% - \pgfplotslistselect#1\of\pgfplotstable@loc@TMPa\to\pgfplotsretval - \pgfmath@smuggleone\pgfplotsretval - \endgroup -}% - -\def\pgfplotstablegetcolumnlist#1\to#2{\let#2=#1} - -% Returns a column vector in form of \pgfplotslist -% into #3. -% -% #1: the column name (not a macro) -% #2: the table structure -% #3: the output macro name. -% -% @throw `no such element' on error -\def\pgfplotstablegetcolumnbyname#1\of#2\to#3{% - \pgfutil@ifundefined{\string#2@#1}{% - % Oh, there is no column '#1' in table '#2'! - % - % Ok, then check for the 'create on use' and the 'alias' - % features... - % 1. create on use: - % - % WARNING : this code has been REPLICATED in - % *** \pgfplotstablereadgetptrtocolname *** - % *** \pgfplotstablegetcolumnbyname *** - % *** \pgfplotstableresolvecolname *** - % *** \pgfplotstablereadvalueofcolname *** - \def\pgfplotstable@loc@TMPa{/pgfplots/table/create on use/#1}% - \pgfkeysifdefined{\pgfplotstable@loc@TMPa/.@cmd}{% - % aah - a 'create on use' style exists. Apply it! - \expandafter\pgfplotstablecreatecol\expandafter[\pgfplotstable@loc@TMPa]{#1}{#2}% - % and return the newly generated col: - \expandafter\let\expandafter#3\csname\string#2@#1\endcsname - }{% - % ok, then it is either an alias or it is simply not - % existant. - \def\pgfplotstable@loc@TMPa{/pgfplots/table/alias/#1}% - \pgfkeysifdefined{\pgfplotstable@loc@TMPa}{% - \pgfkeysgetvalue{\pgfplotstable@loc@TMPa}{\pgfplotstable@loc@TMPb}% - \let\pgfplotstable@loc@TMPa=\pgfplotstable@loc@TMPb - \pgfutil@ifundefined{\string#2@\pgfplotstable@loc@TMPa}{% - \pgfplotsthrow{no such element}{#3}{Sorry, could not retrieve aliased column '\pgfplotstable@loc@TMPa' from table '\pgfplotstablenameof{#2}'. The original request was for '#1', which does not exist either.}\pgfeov% - }{% - \expandafter\let\expandafter#3\csname\string#2@\pgfplotstable@loc@TMPa\endcsname - }% - }{% - \pgfplotsthrow{no such element}{#3}{Sorry, could not retrieve column '#1' from table '\pgfplotstablenameof{#2}'. Please check spelling (or introduce name aliases).}\pgfeov% - }% - }% - }{% - \expandafter\let\expandafter#3\csname\string#2@#1\endcsname - }% -} - -% Retrieves the column *NAME* '#1' of table #2 and writes it into -% '#3'. -% -% If there is no such column, column aliases will be checked. Finally -% if there are no aliases, the command fails with an error. -% -% The 'create on use' statements can't be used in this context. -% @see \pgfplotstablegetcolumnbyname -% -% #1: a column name (not a macro) -% #2: the table structure -% #3: a macro name which will be filled with the (probably modified) -% column name into #2. -\def\pgfplotstableresolvecolname#1\of#2\to#3{% - \pgfutil@ifundefined{\string#2@#1}{% - % Oh, there is no column '#1' in table '#2'! - % - % Ok, then check for the 'alias' feature ... - % - % WARNING : this code has been REPLICATED in - % *** \pgfplotstablereadgetptrtocolname *** - % *** \pgfplotstablegetcolumnbyname *** - % *** \pgfplotstableresolvecolname *** - % *** \pgfplotstablereadvalueofcolname *** - \def\pgfplotstable@loc@TMPa{/pgfplots/table/alias/#1}% - \pgfkeysifdefined{\pgfplotstable@loc@TMPa}{% - \pgfkeysgetvalue{\pgfplotstable@loc@TMPa}{\pgfplotstable@loc@TMPb}% - \let\pgfplotstable@loc@TMPa=\pgfplotstable@loc@TMPb - \pgfutil@ifundefined{\string#2@\pgfplotstable@loc@TMPa}{% - \def\pgfplotstable@loc@TMPb{/pgfplots/table/create on use/#1}% - \pgfkeysifdefined{\pgfplotstable@loc@TMPb/.@cmd}{% - \pgfplotstable@error{Sorry, '\pgfplotstable@loc@TMPb' from table '\pgfplotstableread@filename' can't be evaluated in this context. Please prepare the table before using it here. You can do this using the 'read completely' key, see the manual for details.}% - }{% - \pgfplotsthrow{no such element}{#3}{Sorry, could not retrieve aliased column '\pgfplotstable@loc@TMPa' from table '\pgfplotstablenameof{#2}'. The original request was for '#1', which does not exist either.}\pgfeov% - }% - }{% - \let#3=\pgfplotstable@loc@TMPa - }% - }{% - \pgfplotsthrow{no such element}{#3}{Sorry, could not retrieve column '#1' from table '\pgfplotstablenameof{#2}'. Please check spelling (or introduce name aliases).}\pgfeov% - }% - }{% - \def#3{#1}% - }% -} - -% Invokes either \pgfplotstablegetcolumnbyindex or -% \pgfplotstablegetcolumnbyname. -% -% #1: either a column name, alias or create on use specification, or -% [index]<integer> denoting a column index. -% #2: either a loaded table or a table macro. -% #3: a macro name which will be filled with the column, in the format -% accepted of \pgfplotslist... -\def\pgfplotstablegetcolumn#1\of#2\to#3{% - \begingroup - \pgfplotstable@isloadedtable{#2}{% - \pgfplotstablegetcolumnfromstruct{#1}\of{#2}\to{#3}% - }{% - \pgfplotstableread{#2}\pgfplotstable@tmptbl - \pgfplotstablegetcolumnfromstruct{#1}\of\pgfplotstable@tmptbl\to{#3}% - }% - \pgfmath@smuggleone#3% - \endgroup -}% -\def\pgfplotstablegetcolumnfromstruct#1\of#2\to#3{% - \def\pgfplotstable@loc@TMPc{#1}% - \pgfplotstable@is@colname{\pgfplotstable@loc@TMPc}%% - \ifpgfplotstableread@foundcolnames - \else - \expandafter\pgfplotstablegetcolumnnamebyindex\pgfplotstable@loc@TMPc\of{#2}\to\pgfplotstable@loc@TMPc - \fi - \expandafter\pgfplotstablegetcolumnbyname\pgfplotstable@loc@TMPc\of#2\to{#3}% -}% - -\def\pgfplotstablegetcolumnnamebyindex#1\of#2\to#3{% - \pgfplotslistselect#1\of#2\to#3\relax -}% -\def\pgfplotstablegetcolumnbyindex#1\of#2\to#3{% - \pgfplotslistselect#1\of#2\to#3\relax - \expandafter\pgfplotstablegetcolumnbyname#3\of#2\to{#3}% -} - -\def\pgfplotstablecopy#1\to#2{% - \let#2=#1% - \pgfplotstablegetname#1\pgfplotstable@loc@TMPa - \expandafter\let\csname\string#2@@table@name\endcsname=\pgfplotstable@loc@TMPa - \expandafter\edef\csname\string#2@@table@scanline\endcsname{\pgfplotstablescanlinelengthof{#1}}% - \pgfplotslistforeachungrouped#1\as\pgfplotstable@loc@TMPa{% - \def\pgfplotstable@loc@TMPb{% - \expandafter\let\csname\string#2@\pgfplotstable@loc@TMPa\endcsname}% - \expandafter\pgfplotstable@loc@TMPb\csname\string#1@\pgfplotstable@loc@TMPa\endcsname - }% -} - -% Returns the file name of table '#1' into macro #2. -\def\pgfplotstablegetname#1#2{% - \expandafter\let\expandafter#2\csname\string#1@@table@name\endcsname -} - -% expands to the table file name of table '#1' -\def\pgfplotstablenameof#1{% - \csname\string#1@@table@name\endcsname -} - -% Returns the value of \pgfplotsscanlinelength for table '#1' into -% macro #2. -\def\pgfplotstablegetscanlinelength#1#2{% - \expandafter\let\expandafter#2\csname\string#1@@table@scanline\endcsname -}% - -% Expands to the scan line length of table '#1'. -\def\pgfplotstablescanlinelengthof#1{\csname\string#1@@table@scanline\endcsname}% % Creates a new column named #1 and appends it to table #2. % @@ -1695,21 +1272,32 @@ \pgfplotstabletypeset@opt[]% }% } -\def\pgfplotstabletypeset@opt[#1]#2{% +\long\def\pgfplotstabletypeset@opt[#1]{% + \begingroup + \ifpgfplots@table@options@areset + \else + \pgfplotstableset{#1}% + \fi + \pgfplotstablecollectoneargwithpreparecatcodes{% + \pgfplotstabletypeset@opt@collectarg[#1]% + }% +} +\long\def\pgfplotstabletypeset@opt@collectarg[#1]#2{% \pgfplotstable@isloadedtable{#2}% {\pgfplotstabletypeset@opt@[#1]{#2}}% {\pgfplotstabletypesetfile@opt@[#1]{#2}}% } + % Like \pgfplotstabletypeset, but the first argument is a file name. % This is the same now; it will be recognised automatically. \let\pgfplotstabletypesetfile=\pgfplotstabletypeset -\def\pgfplotstabletypesetfile@opt@[#1]#2{% - \begingroup +\long\def\pgfplotstabletypesetfile@opt@[#1]#2{% + %\begingroup <--- is already opened! \ifpgfplots@table@options@areset \else + \pgfplotstableset@every@table{#2}{#1}% \pgfplots@table@options@aresettrue - \pgfplotstableset{/pgfplots/table/every table={#2},#1}% \fi \ifpgfplotstabletypeset@force@remake \pgfplotstabletypeset@includeoutfilesfalse @@ -1756,822 +1344,25 @@ % IMPLEMENTATION % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\newif\ifpgfplotstableread@curline@contains@colnames -\newif\ifpgfplotstableread@foundcolnames -\newif\ifpgfplotstableread@skipline - -% Accept one of -% \pgfplotstableread[#1]{<file>}{<\macro>} -% \pgfplotstableread[#1]{<file>} to listener{<\macro>} -% or -% \pgfplotstableread[#1]{<file>} to {<\macro>} (DEPRECATED) -\def\pgfplotstableread@impl[#1]#2{% - \pgfutil@ifnextchar t{% - \pgfplotstableread@impl@@{#1}{#2}% - }{% - \pgfplotstableread@impl@{#1}{#2}% - }% -}% - -% I don't know why; but I started with -% >> \pgfplotstableread[]{file} to \macro -% That ' to ' is really ugly. This here is for backwards -% compatibility: -\def\pgfplotstableread@impl@@#1#2to {% - \pgfutil@ifnextchar l{% - \pgfplotstableread@impl@@listener{#1}{#2}% - }{% - \pgfplotstableread@impl@{#1}{#2}% - }% -}% -\def\pgfplotstableread@impl@@listener#1#2listener#3{% - \pgfplots@tableread@to@listenertrue - \pgfplotstableread@impl@{#1}{#2}{#3}% - \pgfplots@tableread@to@listenerfalse -}% - -\def\pgfplotstableread@impl@#1#2#3{% - \ifpgfplots@tableread@use@begingroup - \begingroup - \fi -%\pgfplots@message{ATTEMPTING TO READ #2}% - \openin\r@pgfplots@reada=#2.tex - \ifeof\r@pgfplots@reada - \openin\r@pgfplots@reada=#2\relax - \else - \pgfplots@warning{% - You requested to open table '#2', but there is also a '#2.tex'. - TeX will automatically append the suffix '.tex', so I will now open '#2.tex'. - Please make sure you don't accidentally load TeX files - this may produce unrecoverable errors.}% - \closein\r@pgfplots@reada - \openin\r@pgfplots@reada=#2\relax - \fi - \pgfplots@logfileopen{#2}% - % - \edef\pgfplotstableread@oldendlinechar{\the\endlinechar}% - \endlinechar=-1 % do not append a white space after each line - % - \pgfplotstableread@impl@prepare{#1}{#2}{#3}% - \ifeof\r@pgfplots@reada - \pgfplotsthrow{no such table file}{\pgfplots@loc@TMPa}{#2}{Could not read table file '#2'.}\pgfeov% - \global\let\pgfplotstable@colnames@glob=\pgfplots@loc@TMPa - \else - % - \pgfplotstableread@loop@over@lines - % - \closein\r@pgfplots@reada - % - \pgfplotstableread@finish - \fi - \endlinechar=\pgfplotstableread@oldendlinechar - \pgfplotsscanlinelengthcleanup - \pgfplotstable@copy@to@globalbuffers@simple{#2}% - \ifpgfplots@tableread@use@begingroup - \endgroup - \fi - \ifpgfplots@tableread@to@listener - % there are no data structures in this case. - \let\pgfplotsscanlinelength=\pgfplotstable@glob@buf@scanline - \else - % Now, we can access the global variables! - % copy them to #3. - \pgfplotstable@copy@globalbuffers@to#3% - \fi -} - -% #1: any options to set (respect \ifpgfplots@table@options@areset ) -% #2: the file name -% #3: the output macro (or listener) -\def\pgfplotstableread@impl@prepare#1#2#3{% - \ifpgfplots@table@options@areset - \else - \pgfplotstableset{/pgfplots/table/every table={#2},#1}% - \fi - \def\pgfplotstableread@filename{#2}% - % - % local counter definitions: - \ifpgfplots@tableread@use@begingroup - \let\pgfplotstableread@lineno=\c@pgf@counta - \let\pgfplotstableread@numcols=\c@pgf@countb - \let\pgfplotstableread@curcol=\c@pgf@countc - \let\pgfplotstableread@usablelineno=\c@pgf@countd - \def\thepgfplotstableread@lineno{\the\pgfplotstableread@lineno}% - \def\thepgfplotstableread@usablelineno{\the\pgfplotstableread@usablelineno}% - \def\thepgfplotstableread@curcol{\the\pgfplotstableread@curcol}% - \def\thepgfplotstableread@numcols{\the\pgfplotstableread@numcols}% - \def\pgfplotstableread@countreset##1{##1=0 }% - \def\pgfplotstableread@countset##1##2{##1=##2\relax}% - \def\pgfplotstableread@countadvance##1{\advance##1 by1 }% - \else - % don't re-use integers! We have no protecting scopes! - \def\thepgfplotstableread@lineno{\pgfplotstableread@lineno}% - \def\thepgfplotstableread@usablelineno{\pgfplotstableread@usablelineno}% - \def\thepgfplotstableread@curcol{\pgfplotstableread@curcol}% - \def\thepgfplotstableread@numcols{\pgfplotstableread@numcols}% - \def\pgfplotstableread@countreset##1{\def##1{0}}% - \def\pgfplotstableread@countset##1##2{\def##1{##2}}% - \def\pgfplotstableread@countadvance##1{\pgfplotsutil@advancestringcounter{##1}}% - \fi - \pgfplotstableread@countreset\pgfplotstableread@lineno - \pgfplotstableread@countreset\pgfplotstableread@usablelineno - \pgfplotstableread@countreset\pgfplotstableread@numcols - \pgfplotstableread@countreset\pgfplotstableread@curcol - % - \pgfplotstableread@impl@prepare@DO - \def\pgfplotstableread@isgnuplotformat{0}% - \global\pgfplotslistnewempty\pgfplotstable@colnames@glob - \pgfplotsscanlinelengthinitzero - \ifpgfplots@tableread@to@listener - \def\pgfplotstablerow{\thepgfplotstableread@usablelineno}% - \def\pgfplotstablelineno{\thepgfplotstableread@lineno}% - \let\pgfplotstable@listener=#3% - \let\pgfplotstableread@impl@nextrow@NEXT=\pgfplotstableread@impl@nextrow@NEXT@listener - \let\pgfplotstablereadgetcolindex=\pgfplotstablereadgetcolindex@ - \let\pgfplotstablereadgetcolname=\pgfplotstablereadgetcolname@ - \let\pgfplotstablereadgetptrtocolname=\pgfplotstablereadgetptrtocolname@ - \let\pgfplotstablereadgetptrtocolindex=\pgfplotstablereadgetptrtocolindex@ - \let\pgfplotstablereadevalptr=\pgfplotstablereadevalptr@ - \let\pgfplotstablereadvalueofptr=\pgfplotstablereadvalueofptr@ - \let\pgfplotstableforeachcolumn=\pgfplotstableforeachcolumn@listener - \let\pgfplotstablereadvalueofcolname=\pgfplotstablereadvalueofcolname@ - \let\pgfplotstablereadvalueofcolindex=\pgfplotstablereadvalueofcolindex@ - \let\getthisrow=\pgfplotstablereadgetcolname - \let\thisrow=\pgfplotstablereadvalueofcolname - \let\thisrowno=\pgfplotstablereadvalueofcolindex - \let\getthisrowno=\pgfplotstablereadgetcolindex - \fi -}% - -% Copies the table column list and the column vectors of #1 to global buffers. -% @see \pgfplotstable@copy@globalbuffers@to -% -% Use these two methods to avoid scoping problems. -% -% #1: the <\macro> name of the table which is to be copied to global buffers. -% #2: the table file name. -\def\pgfplotstable@copy@to@globalbuffers#1#2{% - \global\let\pgfplotstable@colnames@glob=#1\relax - \c@pgfplotstable@counta=0\relax% - \pgfplotslistforeachungrouped\pgfplotstable@colnames@glob\as\pgfplotstable@loc@TMPa{% - \def\pgfplotstable@loc@TMPb{% - \expandafter\global\expandafter\let\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname% - }% - \expandafter\pgfplotstable@loc@TMPb\csname\string#1@\pgfplotstable@loc@TMPa\endcsname - \advance\c@pgfplotstable@counta by1\relax - }% - \pgfplotstable@copy@to@globalbuffers@simple{#2}% -}% -% A variant of \pgfplotstable@copy@to@globalbuffers which copies only -% the member variables of a loaded table (the name and scanline length) to -% global buffers. -% -% #1: the table's file name. -% -% @PRECONDITION: any other variables and cell data of the table are already stored -% in global buffers. -\def\pgfplotstable@copy@to@globalbuffers@simple#1{% - \gdef\pgfplotstable@glob@buf@name{#1}% - \global\let\pgfplotstable@glob@buf@scanline=\pgfplotsscanlinelength -}% - -% copies the global column list and the global column vectors to #1 -% (NOT the table file name). -% @see \pgfplotstable@copy@to@globalbuffers -% -% @PRECONDITION the global buffers contain all members of a table. -% -% @POSTCONDITION The table '#1' is be initialised to these members. -% Furthermore, \pgfplotsscanlinelength is set. -\def\pgfplotstable@copy@globalbuffers@to#1{% - \let#1=\pgfplotstable@colnames@glob - \c@pgfplotstable@counta=0\relax% - \pgfplotslistforeachungrouped\pgfplotstable@colnames@glob\as\pgfplotstable@loc@TMPa{% - \def\pgfplotstable@loc@TMPb{% - \expandafter\let\csname\string#1@\pgfplotstable@loc@TMPa\endcsname}% - \expandafter\pgfplotstable@loc@TMPb\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname -%\message{Column '\pgfplotstable@loc@TMPa' has entries: \expandafter\meaning\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname}% - \expandafter\global\expandafter\let\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname=\pgfutil@empty - \advance\c@pgfplotstable@counta by1\relax - }% - \global\let\pgfplotstable@colnames@glob=\pgfutil@empty - \expandafter\let\csname\string#1@@table@scanline\endcsname=\pgfplotstable@glob@buf@scanline - \expandafter\let\csname\string#1@@table@name\endcsname=\pgfplotstable@glob@buf@name - \let\pgfplotsscanlinelength=\pgfplotstable@glob@buf@scanline -}% - -\def\pgfplotstableread@finish{% - \pgfplotsscanlinecomplete - \ifpgfplots@tableread@to@listener - \else - \ifpgfplotstableread@foundcolnames - \else - \pgfplotstableread@create@column@names@with@numbers - \fi - \pgfplotstableread@countreset\pgfplotstableread@curcol% - \pgfutil@loop - \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols\relax - \expandafter\pgfplotsapplistXflushbuffers\csname pgfp@numtable@glob@col@\thepgfplotstableread@curcol\endcsname - \pgfplotstableread@countadvance\pgfplotstableread@curcol - \pgfutil@repeat - \fi -} -\def\pgfplotstableread@loop@over@lines{% - \ifeof\r@pgfplots@reada -%\pgfplots@message{EOF}% - \else - \read\r@pgfplots@reada to\pgfplotstable@LINE - \ifeof\r@pgfplots@reada - \else - \pgfplotstableread@loop@processnextline - \fi - \expandafter\pgfplotstableread@loop@over@lines - \fi -} -% PRECONDITION: -% \pgfplotstable@LINE contains the current input line. -\def\pgfplotstableread@loop@processnextline{% - \expandafter\pgfplotstableread@checkspecial@line\pgfplotstable@LINE\pgfplotstable@EOI - \ifpgfplotstableread@skipline - \def\pgfplotstableread@gnuplotcheck{####x y type}% - \ifx\pgfplotstableread@gnuplotcheck\pgfplotstable@LINE - \def\pgfplotstableread@isgnuplotformat{1}% - \fi - \def\pgfplotstableread@gnuplotcheck{####x y z type}% - \ifx\pgfplotstableread@gnuplotcheck\pgfplotstable@LINE - \def\pgfplotstableread@isgnuplotformat{1}% - \fi - \else - %-------------------------------------------------- - % \ifnum\pgfplotstableread@lineno=0 - % \let\pgfplotstable@firstline=\pgfplotstable@LINE - % \fi - %-------------------------------------------------- -%\pgfplots@message{READING LINE \thepgfplotstableread@lineno: '\meaning\pgfplotstable@LINE'.}% - \pgfplotstableread@curline@contains@colnamesfalse - \ifnum\pgfplotstableread@numcols=0\relax - % STEP 0: initialise - % - count columns - % - find header data - \pgfplotstableread@countreset\pgfplotstableread@curcol - \ifpgfplotstable@firstline@is@header - \pgfplotstableread@curline@contains@colnamestrue - \fi - \pgfplotstableread@impl@DO\pgfplotstableread@impl@countcols@and@identifynames@NEXT\pgfplotstable@LINE - \pgfplotstableread@countset\pgfplotstableread@numcols{\pgfplotstableread@curcol}% - \pgfplotstableread@countreset\pgfplotstableread@curcol - % Create empty column lists: - \pgfplotstableread@create@column@lists - % - \ifnum\pgfplotstableread@usablelineno=0\relax - \if1\pgfplotstableread@isgnuplotformat% - % The file started with - % #... - % #x y type - % X Y i - % -> thats a gnuplot file! - \pgfplotstableread@curline@contains@colnamesfalse - \fi - \fi - % Now, read the first line. - % It contains either - % - column names, - % - numerical data, - % - nothing (comments). - \ifpgfplotstableread@curline@contains@colnames - \pgfplotstableread@foundcolnamestrue - \pgfplotstableread@countreset\pgfplotstableread@curcol - \pgfplotstableread@impl@DO\pgfplotstableread@impl@collectcolnames@NEXT\pgfplotstable@LINE - \else - \pgfplotsscanlinelengthincrease - \pgfplotstableread@foundcolnamesfalse - \pgfplotstableread@countreset\pgfplotstableread@curcol - % Leave column name lists empty... - \pgfplotstableread@impl@DO\pgfplotstableread@impl@nextrow@NEXT\pgfplotstable@LINE - \fi -%\pgfplots@message{After reading first row: found '\thepgfplotstableread@numcols' columns; column name list='\meaning\pgfplotstable@colnames@glob'}% - \else - \pgfplotsscanlinelengthincrease - \pgfplotstableread@countreset\pgfplotstableread@curcol - \pgfplotstableread@impl@DO\pgfplotstableread@impl@nextrow@NEXT\pgfplotstable@LINE - \fi - \ifnum\pgfplotstableread@curcol=\pgfplotstableread@numcols\relax - \else - \pgfplotstable@error{input table '\pgfplotstableread@filename' has an unbalanced number of columns in row '\thepgfplotstableread@lineno' (expected '\thepgfplotstableread@numcols' cols; got '\thepgfplotstableread@curcol'). Maybe the input table is corrupted? If you need unbalanced data, consider using 'nan' in empty cells (perhaps combined with 'unbounded coords=jump')}% - \fi - \ifpgfplots@tableread@to@listener - \ifpgfplotstableread@curline@contains@colnames - \else - % report row! - \pgfplotstable@listener - \fi - \fi - \pgfplotstableread@countadvance\pgfplotstableread@usablelineno - \fi - \pgfplotstableread@countadvance\pgfplotstableread@lineno -}% - -% WARNING: this routine is also used in pgfplots.code.tex ... -\def\pgfplotstableread@checkspecial@line{% - \pgfutil@ifnextchar##{% - \pgfplotstableread@skiplinetrue - \pgfplotstableread@impl@gobble - }{% - \pgfutil@ifnextchar${% - \pgfplotstableread@process@flags@line - }{% - \pgfutil@ifnextchar\pgfplotstable@EOI{% - \pgfplotstableread@skiplinetrue - \pgfplotsscanlinecomplete% the line is empty; same as \par! - \pgfplotstableread@impl@gobble - }{% - \pgfutil@ifnextchar\par{% - \pgfplotstableread@skiplinetrue - \pgfplotsscanlinecomplete - \pgfplotstableread@impl@gobble - }{% - \pgfplotstableread@skiplinefalse - \pgfplotstableread@impl@gobble - }% - }% - }% - }% -} - -\long\def\pgfplotstableread@process@flags@line$flags {% -%\pgfplots@message{Ignoring flags line ...}% - \pgfplotstableread@skiplinetrue - \pgfplotstableread@impl@gobble -} - -\def\pgfplotstableread@create@column@lists{% - \pgfutil@loop - \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols\relax - \def\pgfplots@loc@TMPa{\pgfplotsapplistXnewempty[to global]}% - \expandafter\pgfplots@loc@TMPa\csname pgfp@numtable@glob@col@\thepgfplotstableread@curcol\endcsname - \pgfplotstableread@countadvance\pgfplotstableread@curcol - \pgfutil@repeat -} - -\def\pgfplotstableread@create@column@names@with@numbers{% - \pgfplotstableread@countreset\pgfplotstableread@curcol - \pgfutil@loop - \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols\relax - \edef\pgfplotstable@loc@TMPb{\thepgfplotstableread@curcol}% - \expandafter\pgfplotslistpushbackglobal\pgfplotstable@loc@TMPb\to\pgfplotstable@colnames@glob - \pgfplotstableread@countadvance\pgfplotstableread@curcol - \pgfutil@repeat -} - -\long\def\pgfplotstableread@impl@gobble#1\pgfplotstable@EOI{}% - -\def\pgfplotstable@EOI{\pgfplotstable@EOI}% %%%%%%%%%%%%%%% -% A loop command which processes every single entry in a raw data row #2 -% and invokes the macro #1{<arg>} for each found column entry. -% -% Columns are separated by the /pgfplots/table/col sep character. -% -% #1: a command which takes precisely one argument. It will be called -% for each found column entry -% -% #2: a macro containing a raw data line with <col sep> separated -% entries. -\long\def\pgfplotstableread@impl@DO#1#2{% - \let\pgfplotstableread@impl@ITERATE@NEXT@=#1\relax - \expandafter\pgfplotstableread@impl@DO@\expandafter{#2}% -} -{% - \catcode`\ =10 - \catcode`\;=12 - \catcode`\:=12 - \gdef\pgfplotstableread@impl@prepare@DO{% - \ifcase\pgfplotstableread@COLSEP@CASE\relax - % col sep=space: - \catcode`\ =10 - \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1 \pgfplotstable@EOI}% - \or - % col sep=comma: - \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@COMMA - \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1,\pgfplotstable@EOI}% - \or - % col sep=semicolon: - \catcode`\;=12 - \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@SEMICOLON - \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1;\pgfplotstable@EOI}% - \or - % col sep=colon: - \catcode`\:=12 - \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@COLON - \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1:\pgfplotstable@EOI}% - \or - % col sep=brace: - % allow multi line cells: - \endlinechar=\pgfplotstableread@oldendlinechar\relax - \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@BRACE - \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1\pgfplotstable@EOI}% - \or - % col sep=tab: - \catcode`\^^I=12 - \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@TAB - \long\edef\pgfplotstableread@impl@DO@##1{\noexpand\pgfplotstableread@impl@ITERATE##1\pgfplotstableread@tab\noexpand\pgfplotstable@EOI}% - \fi - }% -}% -\long\def\pgfplotstableread@impl@ITERATE{% - \pgfutil@ifnextchar\pgfplotstable@EOI{% - \pgfplotstableread@impl@gobble - }{% - \pgfplotstableread@impl@ITERATE@NEXT - }% -}% -\long\def\pgfplotstableread@impl@ITERATE@NEXT#1 {% - \pgfplotstableread@impl@ITERATE@NEXT@{#1}% - \pgfplotstableread@impl@ITERATE -}% -\long\def\pgfplotstableread@impl@ITERATE@NEXT@COMMA#1,{% - \pgfplotstableread@impl@ITERATE@NEXT@{#1}% - \pgfplotstableread@impl@ITERATE -}% -\long\def\pgfplotstableread@impl@ITERATE@NEXT@SEMICOLON#1;{% - \pgfplotstableread@impl@ITERATE@NEXT@{#1}% - \pgfplotstableread@impl@ITERATE -}% -\long\def\pgfplotstableread@impl@ITERATE@NEXT@COLON#1:{% - \pgfplotstableread@impl@ITERATE@NEXT@{#1}% - \pgfplotstableread@impl@ITERATE -}% -\long\def\pgfplotstableread@impl@ITERATE@NEXT@BRACE#1{% - \pgfplotstableread@impl@ITERATE@NEXT@{#1}% - \pgfplotstableread@impl@ITERATE -}% -\begingroup -\catcode`\^^I=12 -\gdef\pgfplotstableread@tab{^^I}% -\long\gdef\pgfplotstableread@impl@ITERATE@NEXT@TAB#1^^I{% the following white spaces are SPACES, not tabs: - \pgfplotstableread@impl@ITERATE@NEXT@{#1}% - \pgfplotstableread@impl@ITERATE -}% -\endgroup -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -% these values are only usable for a read-listener, that means: -% when using -% -% \pgfplotstableread{<file>} to listener<\macro> -% -% -> <\macro> can than use the methods -% -% \pgfplotstablereadgetcolindex{<index>}{<\content>} -% performs \let\content=<content of column no <index> > -\def\pgfplotstablereadgetcolindex@#1#2{% - \pgfutil@ifundefined{pgfplotstblread@colcontent@no#1}{% - \pgfplotsthrow{no such element}{#2}{Sorry, the requested column number '#1' in table '\pgfplotstableread@filename' does not exist!? Please verify you used the correct index 0 <= i < N.}\pgfeov% - }{% - \expandafter\let\expandafter#2\csname pgfplotstblread@colcontent@no#1\endcsname - }% -}% - -\pgfkeysdef{/pgfplots/table/@undefined column text}{#1__column_not_found.}% -\def\pgfplotstable@undefinedtext#1{\pgfkeysvalueof{/pgfplots/table/@undefined column text/.@cmd}#1\pgfeov}% - -% As \pgfplotstablereadgetcolindex, but -% \pgfplotstablereadvalueofcolindex{<index>} -% directly expands to the value stored in the desired column. -% -% Example: -% \pgfplotstablereadvalueofcolindex{3} -> expands to '42' if '42' is -% written in column no 3. -% -% Column indexing starts at 0. -% -% @ATTENTION: since such a command may occur within an \edef or an -% \csname, it can't perform sanity checking. Proving an invalid index -% expands to \pgfkeysvalueof{/pgfplots/table/@undefined column text}. -\def\pgfplotstablereadvalueofcolindex@#1{% - \pgfutil@ifundefined{pgfplotstblread@colcontent@no#1}{% - \pgfplotstable@undefinedtext{colindex#1}% - }{% - \csname pgfplotstblread@colcontent@no#1\endcsname - }% -} - -% \pgfplotstablereadgetcolname{<name>}{<\content>} -% performs \let\content=<content of column named <name> > -\def\pgfplotstablereadgetcolname@#1#2{% - \pgfplotstablereadgetptrtocolname{#1}{\pgfplots@loc@TMPa}% - \pgfplotstablereadevalptr\pgfplots@loc@TMPa{#2}% -}% - -% This here is the implementation of \pgfplotstablereadvalueofcolname -% (and \thisrow{<colname>}) for use inside of the 'read to listener' -% framework. -% -% Like \pgfplotstablereadgetcolname, but this one expands directly to -% the value of the desired column. -% -% #1: a column name or a column alias. -% -% @ATTENTION: since such a command may occur within an \edef or an -% \csname, it can't perform sanity checking. Proving an invalid index -% expands to \pgfkeysvalueof{/pgfplots/table/@undefined column text}. -\def\pgfplotstablereadvalueofcolname@#1{% - \pgfplotstable@thisrow@impl{#1}{pgfplotstblread@colindex@for@name}{\pgfplotstable@thisrow@impl@read}% -}% -\def\pgfplotstable@thisrow@impl@read#1{\csname pgfplotstblread@colcontent@no#1\endcsname}% - -% This implements \thisrow in different contexts. -% -% Usage: -% \def\thisrow#1{\pgfplotstable@thisrow@impl{#1}{macroprefix@}{\pgfplotstable@thisrow@impl@}} -% -% Then, \thisrow{existingcol} -% will expand to -% -> \pgfplotstable@thisrow@impl@{\csname macroprefix@existingcol\endcsname} -% -> \csname macroprefix@existingcol\endcsname -% -% Furthermore, if '#1' is no existing col and there exists /pgfplots/table/alias/#1, -% \thisrow{aliased} -% will expand to -% -> \pgfplotstable@thisrow@impl@{\csname macroprefix@\pgfkeysvalueof{/pgfplots/table/alias/aliased}\endcsname} -% -> \csname macroprefix@\pgfkeysvalueof{/pgfplots/table/alias/aliased}\endcsname -% -% #1: the argument for \thisrow{#1} -% #2: a macro prefix such that \csname #2<colname>\endcsname contains -% the value of the current row for (physical) column <colname> -% #3: the name of a one-argument-macro which will get \csname #2<colname>\endcsname -% as argument. This is the last step of \thisrow. It allows indirect -% access by translating colnames to col indices in '\pgfplotstableread to listener' -\def\pgfplotstable@thisrow@impl#1#2#3{% - \pgfutil@ifundefined{#2#1}% - {% - % WARNING : this code has been REPLICATED in - % *** \pgfplotstablereadgetptrtocolname *** - % *** \pgfplotstablegetcolumnbyname *** - % *** \pgfplotstableresolvecolname *** - % *** \pgfplotstablereadvalueofcolname *** - \pgfkeysifdefined{/pgfplots/table/alias/#1}{% - \pgfutil@ifundefined{#2\pgfkeysvalueof{/pgfplots/table/alias/#1}}{% - \pgfplotstable@undefinedtext{\pgfkeysvalueof{/pgfplots/table/alias/#1}}% - }{% - #3{\csname #2\pgfkeysvalueof{/pgfplots/table/alias/#1}\endcsname}% - }% - }{% - \pgfplotstable@undefinedtext{#1}% - }% - }% - {% - #3{\csname #2#1\endcsname}% - }% -}% -\def\pgfplotstable@thisrow@impl@#1{#1}% - -% \pgfplotstablereadgetptrtocolname{<name>}{\ptr} -% Creates some sort of "pointer" to the column named <name>. This -% pointer can than be used every time a new line has been reported to -% the listener. It works like this: -% -% \let\ptr=\pgfutil@empty -% \def\macro{% -% \ifx\ptr\empty -% \pgfplotstablereadgetptrtocolname{<my col>}{\ptr}% -% \fi -% \pgfplotstablereadevalptr{\ptr}{\content}% -% -> do something with \content! -% } -% -% \pgfplotstableread{<file>} to listener<\macro> -% -% -> will evaluate \macro foreach row. -% -% The advantage of such a prepared pointer over \thisrow{#1} or -% \getthisrow{#1} is simply efficiency and sanity checking: the checks -% are done at the time of pointer creation, dereferencing the pointer -% is fast. -\def\pgfplotstablereadgetptrtocolname@#1#2{% - % Implementation note: it is necessary to replicate code becuase - % in this context, the table structure is NOT available. - \pgfutil@ifundefined{pgfplotstblread@colindex@for@name#1}{% - % Oh, there is no column '#1'! - % - % Check for the 'alias' feature! - % - % WARNING : this code has been REPLICATED in - % *** \pgfplotstablereadgetptrtocolname *** - % *** \pgfplotstablegetcolumnbyname *** - % *** \pgfplotstableresolvecolname *** - % *** \pgfplotstablereadvalueofcolname *** - % - \def\pgfplotstable@loc@TMPa{/pgfplots/table/alias/#1}% - \pgfkeysifdefined{\pgfplotstable@loc@TMPa}{% - \pgfkeysgetvalue{\pgfplotstable@loc@TMPa}{\pgfplotstable@loc@TMPb}% - \let\pgfplotstable@loc@TMPa=\pgfplotstable@loc@TMPb - \pgfutil@ifundefined{pgfplotstblread@colindex@for@name\pgfplotstable@loc@TMPa}{% - \pgfplotsthrow{no such element}{#2}{Sorry, could not retrieve aliased column '\pgfplotstable@loc@TMPa' from table '\pgfplotstableread@filename'. The original request was for '#1', which does not exist either.}\pgfeov% - \def#2{0}% - }{% - \edef#2{\csname pgfplotstblread@colindex@for@name\pgfplotstable@loc@TMPa\endcsname}% - }% - }{% - \def\pgfplotstable@loc@TMPa{/pgfplots/table/create on use/#1}% - \pgfkeysifdefined{\pgfplotstable@loc@TMPa/.@cmd}{% - \pgfplotstable@error{Sorry, '\pgfplotstable@loc@TMPa' from table '\pgfplotstableread@filename' can't be evaluated in this context. Please prepare the table before using it here. You can do this using the 'read completely' key, see the manual for details.}% - }{% - \pgfplotsthrow{no such element}{#2}{Sorry, could not retrieve column '#1' from table '\pgfplotstableread@filename'. Please check spelling (or introduce name aliases).}\pgfeov% - }% - \def#2{0}% - }% - }{% - \edef#2{\csname pgfplotstblread@colindex@for@name#1\endcsname}% - }% -}% - -% As \pgfplotstablereadgetptrtocolname, but this here access columns -% by index. -\def\pgfplotstablereadgetptrtocolindex@#1#2{\def#2{#1}}% - -% \pgfplotstablereadevalptr{<\ptr>}{<\content} -% writes the current value of <\ptr> to <\content>. The pointer <\ptr> -% must be initialised with \pgfplotstablereadgetptrtocolname -\let\pgfplotstablereadevalptr@=\pgfplotstablereadgetcolindex@ - -% \pgfplotstablereadvalueofptr{<\ptr>} -> expands to the pointers value. -% -% The pointer \ptr must be initialised with -% \pgfplotstablereadgetptrtocolname. -\let\pgfplotstablereadvalueofptr@=\pgfplotstablereadvalueofcolindex@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\long\def\pgfplotstableread@impl@nextrow@NEXT@listener#1{% - \expandafter\def\csname pgfplotstblread@colcontent@no\thepgfplotstableread@curcol\endcsname{#1}% - \pgfplotstableread@countadvance\pgfplotstableread@curcol -} - -\long\def\pgfplotstableread@impl@nextrow@NEXT#1{% -%\pgfplots@message{Inserting '#1' at (\thepgfplotstableread@lineno, \thepgfplotstableread@curcol).}% - \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols\relax - \pgfplotslist@assembleentry{#1}\into\t@pgfplots@tokc - \def\pgfplotstableread@TMP{\expandafter\pgfplotsapplistXpushback\expandafter{\the\t@pgfplots@tokc}\to}% - \expandafter\pgfplotstableread@TMP\csname pgfp@numtable@glob@col@\thepgfplotstableread@curcol\endcsname - \pgfplotstableread@countadvance\pgfplotstableread@curcol - \else - \begingroup - \t@pgfplots@tokc={#1}% - \pgfplotstable@error{Table '\pgfplotstableread@filename' has too much columns in line \thepgfplotstableread@lineno: Ignoring '\the\t@pgfplots@tokc'. Please verify that every cell entry is separated correctly (use braces {<cell entry>} if necessary). This error is not critical}% - \endgroup - \fi -} - - - -\long\def\pgfplotstableread@impl@collectcolnames@NEXT#1{% -%\pgfplots@message{Got column name no \thepgfplotstableread@curcol\ as '#1'}% - \pgfutil@ifundefined{pgfplotstableread@impl@COLNAME@#1}{% - \def\pgfplotstable@loc@TMPa{#1}% - }{% generate unique column names warning: - \pgfplots@warning{Table '\pgfplotstableread@filename' has non-unique column name '#1'. Only the first occurence can be accessed via column names.}% - \edef\pgfplotstable@loc@TMPa{#1--index\thepgfplotstableread@curcol}% - }% - \expandafter\def\csname pgfplotstableread@impl@COLNAME@#1\endcsname{foo}% remember this name. - \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplotstable@loc@TMPa}\to\pgfplotstable@colnames@glob - \ifpgfplots@tableread@to@listener - % create an associative container colindex -> colname - % for use in a listener. - \expandafter\edef\csname pgfplotstblread@colindex@for@name#1\endcsname{\thepgfplotstableread@curcol}% - \fi - \pgfplotstableread@countadvance\pgfplotstableread@curcol -} - - - - -\long\def\pgfplotstableread@impl@countcols@and@identifynames@NEXT#1{% - \pgfplotstableread@countadvance\pgfplotstableread@curcol - \ifpgfplotstable@search@header - \ifpgfplotstableread@curline@contains@colnames - \else - \pgfplotstableread@isnumber@ITERATE#1\pgfplotstable@EOI -%\ifpgfplotstableread@curline@contains@colnames\pgfplots@message{'#1' is a column name!}\else\pgfplots@message{'#1' is NO column name!}\fi - \fi - \fi -} -\def\pgfplotstableread@isnumber@plus{+} -\def\pgfplotstableread@isnumber@minus{-} -\def\pgfplotstableread@isnumber@zero{0} -\def\pgfplotstableread@isnumber@one{1} -\def\pgfplotstableread@isnumber@two{2} -\def\pgfplotstableread@isnumber@three{3} -\def\pgfplotstableread@isnumber@four{4} -\def\pgfplotstableread@isnumber@five{5} -\def\pgfplotstableread@isnumber@six{6} -\def\pgfplotstableread@isnumber@seven{7} -\def\pgfplotstableread@isnumber@eight{8} -\def\pgfplotstableread@isnumber@nine{9} -\def\pgfplotstableread@isnumber@e{e} -\def\pgfplotstableread@isnumber@E{E} -\def\pgfplotstableread@isnumber@period{.} - -\def\pgfplotstableread@isnumber@ITERATE#1{% - \def\pgfplotstableread@CURTOK{#1}% - \ifx\pgfplotstableread@CURTOK\pgfplotstable@EOI - \def\pgfplotstableread@NEXT{}% - \else - \def\pgfplotstableread@NEXT{\pgfplotstableread@isnumber@ITERATE}% - \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@plus - \else - \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@minus - \else - \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@zero - \else - \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@one - \else - \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@two - \else - \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@three - \else - \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@four - \else - \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@five - \else - \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@six - \else - \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@seven - \else - \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@eight - \else - \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@nine - \else - \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@e - \else - \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@E - \else - \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@period - \else -%\message{NO ITS NOT! Token: '\meaning\pgfplotstableread@CURTOK'}% - % it's no number, so it is a column name. - \pgfplotstableread@curline@contains@colnamestrue - \def\pgfplotstableread@NEXT{\pgfplotstableread@impl@gobble}% - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \fi - \pgfplotstableread@NEXT -} - -\def\pgfplotstable@error#1{\pgfplotsthrow{unsupported operation}{#1}\pgfeov}% - - -\def\pgfplotstableset{% - \pgfqkeys{/pgfplots/table}% -}% - -% Accepts a macro #1 which contains an argument denoting a column -% name. -% -% It checks whether #1 starts with '[index]', indicating that it is actually -% a column INDEX. If that is the case, -% \ifpgfplotstableread@foundcolnames is set to false and the index is -% returned into #1. -% -% Otherwise, \ifpgfplotstableread@foundcolnames is set to true. -\def\pgfplotstable@is@colname#1{% - \expandafter\pgfplotstabletypeset@is@colname@#1\pgfplotstable@EOI - \ifpgfplotstableread@foundcolnames - \else - \let#1=\pgfplotstable@loc@TMPa - \fi -}% -\def\pgfplotstabletypeset@is@colname@{% - \pgfutil@ifnextchar[{% - \pgfplotstabletypeset@is@colname@index - }{% - \pgfplotstableread@foundcolnamestrue - \pgfplotstabletypeset@is@colname@name - }% -} -\def\pgfplotstabletypeset@is@colname@index@@{index}% -\def\pgfplotstabletypeset@is@colname@index[#1]#2\pgfplotstable@EOI{% - \def\pgfplotstable@loc@TMPa{#1}% - \ifx\pgfplotstable@loc@TMPa\pgfplotstabletypeset@is@colname@index@@ - \pgfplotstableread@foundcolnamesfalse - \edef\pgfplotstable@loc@TMPa{#2}% - \else - \pgfplotstableread@foundcolnamestrue - \fi -}% -\def\pgfplotstabletypeset@is@colname@name#1\pgfplotstable@EOI{}% \long\def\pgfplotstabletypeset@getfinalentry#1#2{% \begingroup \def\pgfplotstablepartno{0}% \pgfkeyssetvalue{/pgfplots/table/@cell content}{#1}% \pgfkeyssetvalue{/pgfplots/table/@unprocessed cell content}{#1}% + \pgfplotstable@debug@notify@cellcontent% \pgfkeysvalueof{/pgfplots/table/preproc cell content/.@cmd}#1\pgfeov \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult% \pgfkeyslet{/pgfplots/table/@preprocessed cell content}\pgfmathresult% + \pgfplotstable@debug@notify@cellcontent@preprocessed% % \pgfkeysgetvalue{/pgfplots/table/assign cell content/.@cmd}\pgfplotstable@assigncell \expandafter\pgfplotstable@assigncell\pgfmathresult\pgfeov + \pgfplotstable@debug@notify@cellcontent@assigned% % \pgfkeysgetvalue{/pgfplots/table/postproc cell content/.@cmd}\pgfplotstable@postproccellcontent \ifx\pgfplotstable@postproccellcontent\pgfplotstable@postproccellcontent@EMPTY @@ -2591,12 +1382,84 @@ \expandafter\pgfplotstable@postproccellcontent\pgfplotstabletypeset@rawinput\pgfeov \fi \fi + \pgfplotstable@debug@notify@cellcontent@postprocessed% \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult% \pgfmath@smuggleone\pgfmathresult \endgroup \let#2=\pgfmathresult }% +\def\pgfplotstable@debug@notify@cellcontent{}% +\def\pgfplotstable@debug@notify@cellcontent@preprocessed{}% +\def\pgfplotstable@debug@notify@cellcontent@assigned{}% +\def\pgfplotstable@debug@notify@cellcontent@postprocessed{}% +\def\pgfplotstable@debug@notify@preprocess@incol#1{}% +\def\pgfplotstable@debug@notify@preprocess@col#1{}% +\def\pgfplotstable@debug@notify@preprocessed@col#1{}% +\def\pgfplotstable@debug@notify@balancingcell{}% + +\def\pgfplotstable@debug@notify@cellcontent@ACTIVE{% + \begingroup + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult% + \toks0=\expandafter{\pgfmathresult}% + \immediate\write16{Row \pgfplotstablerow/out \the\c@pgfplotstable@counta: Before cell content processing: `\the\toks0'}% + \endgroup +}% +\def\pgfplotstable@debug@notify@cellcontent@preprocessed@ACTIVE{% + \begingroup + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult% + \toks0=\expandafter{\pgfmathresult}% + \immediate\write16{Row \pgfplotstablerow/out \the\c@pgfplotstable@counta: After '@preproc cell content : `\the\toks0'}% + \endgroup +}% +\def\pgfplotstable@debug@notify@cellcontent@assigned@ACTIVE{% + \begingroup + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult% + \toks0=\expandafter{\pgfmathresult}% + \immediate\write16{Row \pgfplotstablerow/out \the\c@pgfplotstable@counta: After 'assign cell content : `\the\toks0'}% + \endgroup +}% +\def\pgfplotstable@debug@notify@cellcontent@postprocessed@ACTIVE{% + \begingroup + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult% + \toks0=\expandafter{\pgfmathresult}% + \immediate\write16{Row \pgfplotstablerow/out \the\c@pgfplotstable@counta: After 'postproc cell content : `\the\toks0'}% + \endgroup +} +\def\pgfplotstable@debug@notify@balancingcell@ACTIVE{% + \immediate\write16{Row --/out \the\c@pgfplotstable@counta: Inserting empty cell to balance rows}% +}% +\def\pgfplotstable@debug@notify@preprocess@incol@ACTIVE#1{% + \begingroup + \toks0=\expandafter{#1}% + \immediate\write16{>=== Loading input column `\the\toks0' <===}% + \endgroup +}% +\def\pgfplotstable@debug@notify@preprocess@col@ACTIVE#1{% + \begingroup + \toks0=\expandafter{#1}% + \immediate\write16{>=== Preprocessing output column `\the\toks0' <===}% + \endgroup +}% +\def\pgfplotstable@debug@notify@preprocessed@col@ACTIVE#1{% + \begingroup + \toks0=\expandafter{#1}% + \immediate\write16{>=== output column `\the\toks0' prepared, ok. <===}% + \endgroup +}% +\def\pgfplotstable@debug@activate{% + \ifnum\pgfkeysvalueof{/pgfplots/table/debug level}>0 + \let\pgfplotstable@debug@notify@preprocess@incol=\pgfplotstable@debug@notify@preprocess@incol@ACTIVE + \let\pgfplotstable@debug@notify@preprocess@col=\pgfplotstable@debug@notify@preprocess@col@ACTIVE + \let\pgfplotstable@debug@notify@preprocessed@col=\pgfplotstable@debug@notify@preprocessed@col@ACTIVE + \let\pgfplotstable@debug@notify@cellcontent=\pgfplotstable@debug@notify@cellcontent@ACTIVE + \let\pgfplotstable@debug@notify@cellcontent@preprocessed=\pgfplotstable@debug@notify@cellcontent@preprocessed@ACTIVE + \let\pgfplotstable@debug@notify@cellcontent@assigned=\pgfplotstable@debug@notify@cellcontent@assigned@ACTIVE + \let\pgfplotstable@debug@notify@cellcontent@postprocessed=\pgfplotstable@debug@notify@cellcontent@postprocessed@ACTIVE + \let\pgfplotstable@debug@notify@balancingcell=\pgfplotstable@debug@notify@balancingcell@ACTIVE + \fi +}% + % This routine invokes 'postproc cell content' for columns which % contain the column separator '&'. % @@ -2641,12 +1504,12 @@ \pgfutil@in@,{#1}% \fi \fi - }% \def\pgfplotstable@insertemptycells@forbalance{% \pgfutil@loop \ifnum\c@pgfplotstable@counta<\pgfplotstable@firstnumrows\relax + \pgfplotstable@debug@notify@balancingcell % let's hope @getfinalentry handles empty strings! \pgfplotstabletypeset@getfinalentry{}{\pgfplotstable@entry}% \expandafter\pgfplotslistpushback\pgfplotstable@entry\to\pgfplotstable@col@processed @@ -2658,8 +1521,8 @@ % TODO % - replace grouped list foreach by popfront-loop and use arrays % directly -> group only the pgfkeys eval -\def\pgfplotstabletypeset@opt@[#1]#2{% - \begingroup +\long\def\pgfplotstabletypeset@opt@[#1]#2{% + %\begingroup <--- is already opened! %-------------------------------------------------- % \pgfutil@ifundefined{#2}{% % \pgfplots@error{There is no such table '\string#2' loaded into memory. Maybe you meant to use '\string\pgfplotstabletypesetfile{\string#2}' instead of '\string\pgfplotstabletypeset{\string#2}'?}% @@ -2675,9 +1538,7 @@ \ifpgfplots@table@options@areset \else \pgfplotstablegetname{#2}\pgfplotstable@loc@TMPa - \t@pgfplots@toka=\expandafter{\pgfplotstable@loc@TMPa}% - \edef\pgfplotstable@loc@TMPa{/pgfplots/table/every table={\the\t@pgfplots@toka}}% - \expandafter\pgfplotstableset\expandafter{\pgfplotstable@loc@TMPa,#1}% + \expandafter\pgfplotstableset@every@table\expandafter{\pgfplotstable@loc@TMPa}{#1}% \fi \pgfkeysgetvalue{/pgfplots/table/outfile}\pgfplotstable@outfilename \pgfkeysgetvalue{/pgfplots/table/TeX comment}\pgfplots@TeX@comment @@ -2696,8 +1557,18 @@ \fi \fi \ifpgfplotstabletypeset@includeoutfiles - \input \pgfplotstable@outfilename\relax + \def\pgfplots@loc@TMPa{% + \input \pgfplotstable@outfilename\relax + \endgroup + }% \else + \def\pgfplots@loc@TMPa{% + \pgfplotstabletypeset@opt@prepare{#2}% + }% + \fi + \pgfplots@loc@TMPa +}% +\def\pgfplotstabletypeset@opt@prepare#1{% % % Prepare outfile and debug options: \let\pgfplotstable@notify@finished@line=\pgfutil@empty @@ -2723,6 +1594,7 @@ \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% \immediate\write16{\the\t@pgfplots@toka\pgfplots@TeX@comment}% }% + \pgfplotstable@debug@activate \fi \ifx\pgfplotstable@outfilename\pgfutil@empty \else @@ -2736,10 +1608,39 @@ % Start operation: \pgfkeysgetvalue{/pgfplots/table/columns}{\pgfplotstable@colnames}% \ifx\pgfplotstable@colnames\pgfutil@empty - \pgfplotstablegetcolumnlist#2\to\pgfplotstable@colnames + \pgfplotstablegetcolumnlist#1\to\pgfplotstable@colnames \else \expandafter\pgfplotslistnew\expandafter\pgfplotstable@colnames\expandafter{\pgfplotstable@colnames}% \fi + % + % + \ifpgfplotstable@sort + % make sure any columns exist (especially create on use). + % this can be done by calling getcolumnbyname once for every + % column: + \pgfplotslistforeachungrouped\pgfplotstable@colnames\as\pgfplotstable@colname{% + \pgfplotstable@is@colname\pgfplotstable@colname + \ifpgfplotstableread@foundcolnames + \else + \pgfplotstablegetcolumnnamebyindex\pgfplotstable@colname\of#1\to\pgfplotstable@colname + \fi + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplotstable@colname}\of#1\to\pgfplotstable@col + }% + \let\pgfplotstable@colname=\relax + \let\pgfplotstable@col=\relax + % + \def\pgfplots@loc@TMPa{% + \pgfplotstablesort\pgfplotstable@sortedtbl{#1}% + \pgfplotstabletypeset@opt@@{\pgfplotstable@sortedtbl}% + }% + \else + \def\pgfplots@loc@TMPa{% + \pgfplotstabletypeset@opt@@{#1}% + }% + \fi + \pgfplots@loc@TMPa +} +\def\pgfplotstabletypeset@opt@@#1{% \global\pgfplotslistnewempty\pgfplotstabletypeset@final@colnames \global\pgfplotslistnewempty\pgfplotstabletypeset@final@coltypes \global\pgfplotslistnewempty\pgfplotstabletypeset@final@cols @@ -2753,13 +1654,15 @@ \c@pgfplotstable@colindex=0\relax % FOREACH COLUMN: \pgfplotslistforeach\pgfplotstable@colnames\as\pgfplotstable@colname{% + \pgfplotstable@debug@notify@preprocess@incol\pgfplotstable@colname + % \c@pgfplotstable@rowindex=0\relax \pgfplotstable@is@colname\pgfplotstable@colname \ifpgfplotstableread@foundcolnames \else - \pgfplotstablegetcolumnnamebyindex\pgfplotstable@colname\of#2\to\pgfplotstable@colname + \pgfplotstablegetcolumnnamebyindex\pgfplotstable@colname\of#1\to\pgfplotstable@colname \fi - \pgfplotstablegetcolumnbyname\pgfplotstable@colname\of#2\to\pgfplotstable@col + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplotstable@colname}\of#1\to\pgfplotstable@col % % Init number of *input* rows here. This may not be the same % as the number of *output* rows (see the row predicate @@ -2815,6 +1718,9 @@ \let\pgfplotstable@colname@out=\pgfplotstable@colname \fi \expandafter\pgfplotstabletypeset@assign@final@colname\expandafter{\pgfplotstable@colname@out}\pgfplotstable@colname@out + % + \pgfplotstable@debug@notify@preprocess@col\pgfplotstable@colname@out + % \expandafter\pgfplotslistpushbackglobal\pgfplotstable@colname@out\to\pgfplotstabletypeset@final@colnames \pgfkeysgetvalue{/pgfplots/table/column type}{\pgfplotstable@coltype}% \expandafter\pgfplotslistpushbackglobal\pgfplotstable@coltype\to\pgfplotstabletypeset@final@coltypes @@ -2850,217 +1756,225 @@ % balance columns: \pgfplotstable@insertemptycells@forbalance \fi + % + \pgfplotstable@debug@notify@preprocessed@col\pgfplotstable@colname@out + % \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplotstable@col@processed}\to\pgfplotstabletypeset@final@cols \global\advance\c@pgfplotstable@colindex by1\relax }% % - % Ok, I have now everything which will come into the final table. - % - % But I have it column-oriented; I need to transpose the storage. - % - % The following code assembles a - % \begin{tabular}{} - % ... - % \end{tabular} - % statement piece after piece. - % -%\message{I have now \meaning\pgfplotstabletypeset@final@colnames, and \meaning\pgfplotstabletypeset@final@cols.}% - % Step 1: column names. - \c@pgfplotstable@colindex=0\relax - \c@pgfplotstable@rowindex=-1\relax - \let\pgfplotstable@result=\pgfutil@empty - % - \pgfkeysgetvalue{/pgfplots/table/font}{\pgfplotstable@font}% - \ifx\pgfplotstable@font\pgfutil@empty + \pgfplotslistcheckempty\pgfplotstabletypeset@final@colnames + \ifpgfplotslistempty + \let\pgfplotstable@result=\pgfutil@empty \else - \t@pgfplots@toka=\expandafter{\pgfplotstable@font}% - \edef\pgfplotstable@curline{\noexpand\begingroup\the\t@pgfplots@toka}% - \pgfplotstable@curline@FLUSH - \fi - % - \pgfkeysgetvalue{/pgfplots/table/begin table}{\pgfplotstable@entry}% - \t@pgfplots@toka=\expandafter{\pgfplotstable@entry}% - \edef\pgfplotstable@curline{\the\t@pgfplots@toka}% - % - \ifpgfplotstabletypesetskipcoltypes - \else - % STEP 1.1: collect column types: - \def\pgfplotstable@resulttypes{}% - \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@coltypes\as\pgfplotstable@coltype{% - \t@pgfplots@toka=\expandafter{\pgfplotstable@resulttypes}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@coltype}% - \edef\pgfplotstable@resulttypes{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% - }% - \ifx\pgfplotstable@resulttypes\pgfutil@empty + % Ok, I have now everything which will come into the final table. + % + % But I have it column-oriented; I need to transpose the storage. + % + % The following code assembles a + % \begin{tabular}{} + % ... + % \end{tabular} + % statement piece after piece. + % + %\message{I have now \meaning\pgfplotstabletypeset@final@colnames, and \meaning\pgfplotstabletypeset@final@cols.}% + % Step 1: column names. + \c@pgfplotstable@colindex=0\relax + \c@pgfplotstable@rowindex=-1\relax + \let\pgfplotstable@result=\pgfutil@empty + % + \pgfkeysgetvalue{/pgfplots/table/font}{\pgfplotstable@font}% + \ifx\pgfplotstable@font\pgfutil@empty \else - \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@resulttypes}% - \edef\pgfplotstable@curline{\the\t@pgfplots@toka{\the\t@pgfplots@tokb}}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@font}% + \edef\pgfplotstable@curline{\noexpand\begingroup\the\t@pgfplots@toka}% + \pgfplotstable@curline@FLUSH \fi - \fi - \ifx\pgfplotstable@curline\pgfutil@empty - \else - \pgfplotstable@curline@FLUSH - \fi - % - % Step 1.2: Collect FIRST ROW (column names) - \begingroup - \pgfplotstableset{every head row}% - \pgfkeysgetvalue{/pgfplots/table/before row}{\pgfplotstable@before}% - \pgfkeysgetvalue{/pgfplots/table/after row}{\pgfplotstable@after}% - \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% - \xdef\pgfplots@glob@TMPc{% - \noexpand\def\noexpand\pgfplotstable@before{\the\t@pgfplots@toka}% - \noexpand\def\noexpand\pgfplotstable@after{\the\t@pgfplots@tokb}% - }% - \endgroup - \pgfplots@glob@TMPc - % insert 'before row' here: - \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@curline}% - \edef\pgfplotstable@curline{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% - % - \def\pgfplotstablecolname{\pgfplotstable@colname@out}% - \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@colnames\as\pgfplotstable@colname@out{% % - \advance\c@pgfplotstable@colindex by1\relax - % typeset the cell: - \pgfkeysgetvalue{/pgfplots/table/typeset cell/.@cmd}\pgfplots@loc@TMPa - \expandafter\pgfplots@loc@TMPa\pgfplotstable@colname@out\pgfeov - \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult + \pgfkeysgetvalue{/pgfplots/table/begin table}{\pgfplotstable@entry}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@entry}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka}% % - % append this cell: - \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% - \t@pgfplots@tokb=\expandafter{\pgfmathresult}% - \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% - }% - % insert 'after row' here: - \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% - \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% - % - \pgfplotstable@curline@FLUSH - % -%\message{I have now \meaning\pgfplotstable@result.}% - % Step 2: column contents. - % I will first convert \pgfplotstabletypeset@final@cols into an array. - \c@pgfplotstable@colindex=0\relax - \pgfplotsarraynewempty\pgfplotstabletypeset@final@cols@array - \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@cols\as\pgfplotstable@col@processed{% - \expandafter\pgfplotsarraypushback\expandafter{\pgfplotstable@col@processed}\to\pgfplotstabletypeset@final@cols@array - }% - % init numrows: - \pgfplotsarrayselect\c@pgfplotstable@colindex\of\pgfplotstabletypeset@final@cols@array\to\pgfplotstable@col@processed - \pgfplotslistsize\pgfplotstable@col@processed\to\c@pgfplotstable@numrows - % - % Now, we loop over every column as long as there are still rows - % left. We assemble rows while we go. - % - \c@pgfplotstable@rowindex=0\relax - \ifnum\c@pgfplotstable@colindex<\c@pgfplotstable@numcols - \pgfplots@loop@CONTINUEtrue - \else - \pgfplots@loop@CONTINUEfalse - \fi - \def\pgfplotstablecolname{\pgfplotstable@error{Sorry, you can't evaluate \string\pgfplotstablecolname\space in this context.}}% - \pgfutil@loop - \ifpgfplots@loop@CONTINUE - \pgfplotsarrayselect\c@pgfplotstable@colindex\of\pgfplotstabletypeset@final@cols@array\to\pgfplotstable@col@processed - \pgfplotslistcheckempty\pgfplotstable@col@processed - \ifpgfplotslistempty - % assume that each column has the same number of entries - % (normalised tables): - \pgfplots@loop@CONTINUEfalse + \ifpgfplotstabletypesetskipcoltypes \else - \ifnum\c@pgfplotstable@colindex=0\relax - % Install styles for the next row. - \begingroup - \ifodd\c@pgfplotstable@rowindex - \t@pgfplots@toka={every odd row}% - \else - \t@pgfplots@toka={every even row}% - \fi - \ifnum\c@pgfplotstable@rowindex=0\relax - \t@pgfplots@toka=\expandafter{\the\t@pgfplots@toka,every first row}% - \fi - \ifpgfplotstable@disable@rowcolstyles - \else - \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,every row no \the\c@pgfplotstable@rowindex/.try}% - \t@pgfplots@toka=\expandafter{\pgfplotstable@loc@TMPa}% - \fi - % misuse as temporary variable: - \c@pgfplotstable@colindex=\c@pgfplotstable@rowindex - \advance\c@pgfplotstable@colindex by1\relax - \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numrows - \t@pgfplots@toka=\expandafter{\the\t@pgfplots@toka,every last row}% - \fi - \expandafter\pgfplotstableset\expandafter{\the\t@pgfplots@toka}% - \pgfkeysgetvalue{/pgfplots/table/before row}{\pgfplotstable@before}% - \pgfkeysgetvalue{/pgfplots/table/after row}{\pgfplotstable@after}% - \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% - \xdef\pgfplots@glob@TMPc{% - \noexpand\def\noexpand\pgfplotstable@before{\the\t@pgfplots@toka}% - \noexpand\def\noexpand\pgfplotstable@after{\the\t@pgfplots@tokb}% - }% - \endgroup - \pgfplots@glob@TMPc - % insert 'before row' here: - \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@curline}% - \edef\pgfplotstable@curline{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% + % STEP 1.1: collect column types: + \def\pgfplotstable@resulttypes{}% + \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@coltypes\as\pgfplotstable@coltype{% + \t@pgfplots@toka=\expandafter{\pgfplotstable@resulttypes}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@coltype}% + \edef\pgfplotstable@resulttypes{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + }% + \ifx\pgfplotstable@resulttypes\pgfutil@empty + \else + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@resulttypes}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka{\the\t@pgfplots@tokb}}% \fi + \fi + \ifx\pgfplotstable@curline\pgfutil@empty + \else + \pgfplotstable@curline@FLUSH + \fi + % + % Step 1.2: Collect FIRST ROW (column names) + \begingroup + \pgfplotstableset{every head row}% + \pgfkeysgetvalue{/pgfplots/table/before row}{\pgfplotstable@before}% + \pgfkeysgetvalue{/pgfplots/table/after row}{\pgfplotstable@after}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% + \xdef\pgfplots@glob@TMPc{% + \noexpand\def\noexpand\pgfplotstable@before{\the\t@pgfplots@toka}% + \noexpand\def\noexpand\pgfplotstable@after{\the\t@pgfplots@tokb}% + }% + \endgroup + \pgfplots@glob@TMPc + % insert 'before row' here: + \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@curline}% + \edef\pgfplotstable@curline{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% + % + \def\pgfplotstablecolname{\pgfplotstable@colname@out}% + \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@colnames\as\pgfplotstable@colname@out{% % - % - \pgfplotslistpopfront\pgfplotstable@col@processed\to\pgfplotstable@entry - \pgfplotsarrayletentry\c@pgfplotstable@colindex\of\pgfplotstabletypeset@final@cols@array=\pgfplotstable@col@processed \advance\c@pgfplotstable@colindex by1\relax % typeset the cell: \pgfkeysgetvalue{/pgfplots/table/typeset cell/.@cmd}\pgfplots@loc@TMPa - \expandafter\pgfplots@loc@TMPa\pgfplotstable@entry\pgfeov + \expandafter\pgfplots@loc@TMPa\pgfplotstable@colname@out\pgfeov \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult % % append this cell: \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% \t@pgfplots@tokb=\expandafter{\pgfmathresult}% \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% - % - \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numcols\relax - \c@pgfplotstable@colindex=0\relax - % insert 'after row' here: + }% + % insert 'after row' here: + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + % + \pgfplotstable@curline@FLUSH + % + %\message{I have now \meaning\pgfplotstable@result.}% + % Step 2: column contents. + % I will first convert \pgfplotstabletypeset@final@cols into an array. + \c@pgfplotstable@colindex=0\relax + \pgfplotsarraynewempty\pgfplotstabletypeset@final@cols@array + \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@cols\as\pgfplotstable@col@processed{% + \expandafter\pgfplotsarraypushback\expandafter{\pgfplotstable@col@processed}\to\pgfplotstabletypeset@final@cols@array + }% + % init numrows: + \pgfplotsarrayselect\c@pgfplotstable@colindex\of\pgfplotstabletypeset@final@cols@array\to\pgfplotstable@col@processed + \pgfplotslistsize\pgfplotstable@col@processed\to\c@pgfplotstable@numrows + % + % Now, we loop over every column as long as there are still rows + % left. We assemble rows while we go. + % + \c@pgfplotstable@rowindex=0\relax + \ifnum\c@pgfplotstable@colindex<\c@pgfplotstable@numcols + \pgfplots@loop@CONTINUEtrue + \else + \pgfplots@loop@CONTINUEfalse + \fi + \def\pgfplotstablecolname{\pgfplotstable@error{Sorry, you can't evaluate \string\pgfplotstablecolname\space in this context.}}% + \pgfutil@loop + \ifpgfplots@loop@CONTINUE + \pgfplotsarrayselect\c@pgfplotstable@colindex\of\pgfplotstabletypeset@final@cols@array\to\pgfplotstable@col@processed + \pgfplotslistcheckempty\pgfplotstable@col@processed + \ifpgfplotslistempty + % assume that each column has the same number of entries + % (normalised tables): + \pgfplots@loop@CONTINUEfalse + \else + \ifnum\c@pgfplotstable@colindex=0\relax + % Install styles for the next row. + \begingroup + \ifodd\c@pgfplotstable@rowindex + \t@pgfplots@toka={every odd row}% + \else + \t@pgfplots@toka={every even row}% + \fi + \ifnum\c@pgfplotstable@rowindex=0\relax + \t@pgfplots@toka=\expandafter{\the\t@pgfplots@toka,every first row}% + \fi + \ifpgfplotstable@disable@rowcolstyles + \else + \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,every row no \the\c@pgfplotstable@rowindex/.try}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@loc@TMPa}% + \fi + % misuse as temporary variable: + \c@pgfplotstable@colindex=\c@pgfplotstable@rowindex + \advance\c@pgfplotstable@colindex by1\relax + \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numrows + \t@pgfplots@toka=\expandafter{\the\t@pgfplots@toka,every last row}% + \fi + \expandafter\pgfplotstableset\expandafter{\the\t@pgfplots@toka}% + \pgfkeysgetvalue{/pgfplots/table/before row}{\pgfplotstable@before}% + \pgfkeysgetvalue{/pgfplots/table/after row}{\pgfplotstable@after}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% + \xdef\pgfplots@glob@TMPc{% + \noexpand\def\noexpand\pgfplotstable@before{\the\t@pgfplots@toka}% + \noexpand\def\noexpand\pgfplotstable@after{\the\t@pgfplots@tokb}% + }% + \endgroup + \pgfplots@glob@TMPc + % insert 'before row' here: + \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@curline}% + \edef\pgfplotstable@curline{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% + \fi + % + % + \pgfplotslistpopfront\pgfplotstable@col@processed\to\pgfplotstable@entry + \pgfplotsarrayletentry\c@pgfplotstable@colindex\of\pgfplotstabletypeset@final@cols@array=\pgfplotstable@col@processed + \advance\c@pgfplotstable@colindex by1\relax + % typeset the cell: + \pgfkeysgetvalue{/pgfplots/table/typeset cell/.@cmd}\pgfplots@loc@TMPa + \expandafter\pgfplots@loc@TMPa\pgfplotstable@entry\pgfeov + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult + % + % append this cell: \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% + \t@pgfplots@tokb=\expandafter{\pgfmathresult}% \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% - \advance\c@pgfplotstable@rowindex by1\relax - \pgfplotstable@curline@FLUSH + % + \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numcols\relax + \c@pgfplotstable@colindex=0\relax + % insert 'after row' here: + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \advance\c@pgfplotstable@rowindex by1\relax + \pgfplotstable@curline@FLUSH + \fi + %\message{I have now \meaning\pgfplotstable@result.}% \fi -%\message{I have now \meaning\pgfplotstable@result.}% + \pgfutil@repeat + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% + \pgfkeysgetvalue{/pgfplots/table/end table}{\pgfplotstable@entry}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@entry}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \ifx\pgfplotstable@curline\pgfutil@empty + \else + \pgfplotstable@curline@FLUSH + \fi + % + \ifx\pgfplotstable@font\pgfutil@empty + \else + \edef\pgfplotstable@curline{\noexpand\endgroup}% + \pgfplotstable@curline@FLUSH + \fi + \ifx\pgfplotstable@outfilename\pgfutil@empty + \else + \immediate\closeout\pgfplotstable@outfile + \fi + %\message{I have now \meaning\pgfplotstable@result.}% + \def\pgfplotstablecol{\pgfplotstable@error{Sorry, you can't access the \string\pgfplotstablecol\ in this context. It is ONLY valid during the preparation routines (please check the 'display columns/<index>' style in the manual).}}% + \def\pgfplotstablerow{\pgfplotstable@error{Sorry, you can't access the \string\pgfplotstablerow\ in this context. It is ONLY valid during the preparation routines (please check the 'every row no <index>' style).}}% + \ifpgfplotstabletypesetresult + \pgfplotstable@result \fi - \pgfutil@repeat - \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% - \pgfkeysgetvalue{/pgfplots/table/end table}{\pgfplotstable@entry}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@entry}% - \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% - \ifx\pgfplotstable@curline\pgfutil@empty - \else - \pgfplotstable@curline@FLUSH - \fi - % - \ifx\pgfplotstable@font\pgfutil@empty - \else - \edef\pgfplotstable@curline{\noexpand\endgroup}% - \pgfplotstable@curline@FLUSH - \fi - \ifx\pgfplotstable@outfilename\pgfutil@empty - \else - \immediate\closeout\pgfplotstable@outfile - \fi -%\message{I have now \meaning\pgfplotstable@result.}% - \def\pgfplotstablecol{\pgfplotstable@error{Sorry, you can't access the \string\pgfplotstablecol\ in this context. It is ONLY valid during the preparation routines (please check the 'display columns/<index>' style in the manual).}}% - \def\pgfplotstablerow{\pgfplotstable@error{Sorry, you can't access the \string\pgfplotstablerow\ in this context. It is ONLY valid during the preparation routines (please check the 'every row no <index>' style).}}% - \ifpgfplotstabletypesetresult - \pgfplotstable@result \fi \pgfkeysgetvalue{/pgfplots/table/write to macro}\pgfplots@loc@TMPa \ifx\pgfplots@loc@TMPa\pgfutil@empty @@ -3069,7 +1983,6 @@ \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% \xdef\pgfplots@glob@TMPa{\noexpand\def\expandafter\noexpand\pgfplots@loc@TMPa{\the\t@pgfplots@toka}}% \fi - \fi \endgroup \pgfplots@glob@TMPa% execute 'write to macro' if set. }% @@ -3080,6 +1993,7 @@ \def\pgfplotstablecreatecol@opt[#1]#2#3{% \begingroup + \def\pgfplotstablename{#3}% \pgfplotstableset{columns=,#1,% /pgf/fpu/handlers/empty number/.code 2 args={% \pgfmathfloatcreate{0}{0.0}{0}% @@ -3095,6 +2009,7 @@ \t@pgfplots@toka=\expandafter{#2}% this should handle macro names in '#2'. \edef\pgfplotstable@newcolname{\the\t@pgfplots@toka}% \global\pgfplotstablecreatecol@isreallynewtrue + \c@pgf@countd=0 \pgfplotslistforeachungrouped\pgfplotstable@colnames\as\pgfplotstable@colname{% \pgfplotstable@is@colname\pgfplotstable@colname \ifpgfplotstableread@foundcolnames @@ -3106,7 +2021,10 @@ \ifx\pgfplotstable@colname\pgfplotstable@newcolname \global\pgfplotstablecreatecol@isreallynewfalse \fi + \expandafter\edef\csname pgfplotstablecreate@index@to@name@\the\c@pgf@countd\endcsname{\pgfplotstable@colname}% + \advance\c@pgf@countd by1 }% + \edef\pgfplotstablecols{\the\c@pgf@countd}% \pgfplotstable@isfirstrowtrue \pgfplotstable@islastrowfalse \pgfplotslistnewempty\pgfplotstable@newcol @@ -3121,6 +2039,17 @@ \def\prevrow##1{\pgfplotstable@thisrow@impl{##1}{pgfplotstablecreate@prev@}{\pgfplotstable@thisrow@impl@}}% \def\thisrow##1{\pgfplotstable@thisrow@impl{##1}{pgfplotstablecreate@cur@}{\pgfplotstable@thisrow@impl@}}% \def\nextrow##1{\pgfplotstable@thisrow@impl{##1}{pgfplotstablecreate@next@}{\pgfplotstable@thisrow@impl@}}% + \def\pgfplotstable@rowno@impl##1##2{% + \pgfutil@ifundefined{pgfplotstablecreate@index@to@name@##1}{% + \csname ##2row\endcsname{colindex##1}% + }{% + \csname ##2row\endcsname{\csname pgfplotstablecreate@index@to@name@##1\endcsname}% + }% + }% + \def\prevrowno##1{\pgfplotstable@rowno@impl{##1}{prev}}% + \def\thisrowno##1{\pgfplotstable@rowno@impl{##1}{this}}% + \def\nextrowno##1{\pgfplotstable@rowno@impl{##1}{next}}% + % \def\getprevrow##1##2{\expandafter\let\expandafter##2\csname pgfplotstablecreate@prev@##1\endcsname}% \def\getthisrow##1##2{\expandafter\let\expandafter##2\csname pgfplotstablecreate@cur@##1\endcsname}% \def\getnextrow##1##2{\expandafter\let\expandafter##2\csname pgfplotstablecreate@next@##1\endcsname}% @@ -3463,12 +2392,12 @@ % \ifx\pgfplotstable@colnames\pgfutil@empty \pgfplotstableforeachcolumn{#3}\as\pgfplots@colname{% + \t@pgfplots@toka=\expandafter{\pgfplots@colname}% \ifnum\pgfplotstablecol=0 - \let\pgfplotstable@colnames=\pgfplots@colname + \edef\pgfplotstable@colnames{{\the\t@pgfplots@toka}}% \else - \t@pgfplots@toka=\expandafter{\pgfplots@colname}% \t@pgfplots@tokb=\expandafter{\pgfplotstable@colnames}% - \edef\pgfplotstable@colnames{\the\t@pgfplots@tokb,\the\t@pgfplots@toka}% + \edef\pgfplotstable@colnames{\the\t@pgfplots@tokb,{\the\t@pgfplots@toka}}% \fi }% \fi @@ -3476,15 +2405,19 @@ % sanity checking: \ifx\pgfplotstabletranspose@outcolnames\pgfutil@empty \else - \def\pgfplotstable@loc@TMPa{\expandafter\pgfutil@in@\expandafter{\pgfplotstabletranspose@outcolnames}}% - \expandafter\pgfplotstable@loc@TMPa\expandafter{\pgfplotstable@colnames}% - \ifpgfutil@in@ + \def\pgfplotstabletranspose@outcolnames@foundit{0}% + \expandafter\pgfplotsutilforeachcommasep\expandafter{\pgfplotstable@colnames}\as\pgfplots@colname{% + \ifx\pgfplots@colname\pgfplotstabletranspose@outcolnames + \def\pgfplotstabletranspose@outcolnames@foundit{1}% + \fi + }% + \if1\pgfplotstabletranspose@outcolnames@foundit \else % insert the 'colnames from' column into 'columns': \pgfplots@warning{table transposition: the 'colnames from=\pgfplotstabletranspose@outcolnames' is not part of 'columns'. Adding it.}% \t@pgfplots@toka=\expandafter{\pgfplotstabletranspose@outcolnames}% \t@pgfplots@tokb=\expandafter{\pgfplotstable@colnames}% - \edef\pgfplotstable@colnames{\the\t@pgfplots@tokb,\the\t@pgfplots@toka}% + \edef\pgfplotstable@colnames{\the\t@pgfplots@tokb,{\the\t@pgfplots@toka}}% \fi \fi % @@ -3578,4 +2511,323 @@ \pgfplotstable@copy@globalbuffers@to{#2}% }% +% #1: keys +\def\pgfplotstable@linear@regression#1{% + \begingroup + \pgfqkeys{/pgfplots/table/create col/linear regression}{/pgf/fpu,#1}% + \pgfkeysgetvalue{/pgfplots/table/create col/linear regression/x}{\pgfplotstable@xsrc}% + \pgfkeysgetvalue{/pgfplots/table/create col/linear regression/y}{\pgfplotstable@ysrc}% + \pgfkeysgetvalue{/pgfplots/table/create col/linear regression/table}{\pgfplotstable@table}% + \pgfkeysgetvalue{/pgfplots/table/create col/linear regression/xmode}{\pgfplotstable@xmode}% + \pgfkeysgetvalue{/pgfplots/table/create col/linear regression/ymode}{\pgfplotstable@ymode}% + \pgfkeysgetvalue{/pgfplots/table/create col/linear regression/variance}{\pgfplotstable@variance@colname}% + \pgfkeysgetvalue{/pgfplots/table/create col/linear regression/variance list}{\pgfplotstable@variance@list}% + \pgfkeysgetvalue{/pgfplots/table/create col/linear regression/variance src}{\pgfplotstable@variance@table}% + % + \ifx\pgfplotstable@table\pgfutil@empty + \pgfutil@ifundefined{pgfplotstablename}{}{% + \let\pgfplotstable@table=\pgfplotstablename + }% + \fi + \ifx\pgfplotstable@table\pgfutil@empty + \pgfplots@error{Sorry, I couldn't determine a value for create col/linear regression/table. Which table should I load?}% + \fi + \ifx\pgfplotstable@xsrc\pgfutil@empty + \pgfplotsifinaddplottablestruct{% + \pgfutil@ifundefined{pgfplots@plot@tbl@x}{}{% + \let\pgfplotstable@xsrc=\pgfplots@plot@tbl@x + \ifx\pgfplotstable@ysrc\pgfutil@empty + \pgfplotstablegetcolsof\pgfplots@table + \ifnum\pgfplotsretval=2 + \else + \pgfplotsthrow{invalid argument}{\pgfplotstable@ysrc}{Sorry, I don't which column should be used as `y' for the linear regression. Please provide 'linear regression={y=<colname>}'}\pgfeov% + \fi + \fi + }% + }{}% + \fi + \ifx\pgfplotstable@xsrc\pgfutil@empty + \def\pgfplotstable@xsrc{[index]0}% + \fi + \ifx\pgfplotstable@ysrc\pgfutil@empty + \def\pgfplotstable@ysrc{[index]1}% + \fi + % + \t@pgfplots@toka=\expandafter{\pgfplotstable@table}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@xsrc}% + \t@pgfplots@tokc=\expandafter{\pgfplotstable@ysrc}% + \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@tokb}\noexpand\of{\the\t@pgfplots@toka}}% + \edef\pgfplots@loc@TMPb{{\the\t@pgfplots@tokc}\noexpand\of{\the\t@pgfplots@toka}}% + \expandafter\pgfplotstablegetcolumn\pgfplots@loc@TMPa\to\pgfplotstable@X + \expandafter\pgfplotstablegetcolumn\pgfplots@loc@TMPb\to\pgfplotstable@Y + % + \edef\pgfplotstable@xmode{\pgfplotstable@xmode}% + \expandafter\pgfplotstable@linear@regression@prepare@mode\expandafter{\pgfplotstable@xmode}{x}%% + \edef\pgfplotstable@ymode{\pgfplotstable@ymode}% + \expandafter\pgfplotstable@linear@regression@prepare@mode\expandafter{\pgfplotstable@ymode}{y}%% + % + \ifx\pgfplotstable@variance@list\pgfutil@empty + % check 'variance' key (loaded from table) + \pgfplotslistnewempty\pgfplotstable@VARIANCE + \ifx\pgfplotstable@variance@colname\pgfutil@empty + \else + \ifx\pgfplotstable@variance@table\pgfutil@empty + \t@pgfplots@toka=\expandafter{\pgfplotstable@table}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@variance@table}% + \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@tokb}\noexpand\of{\the\t@pgfplots@toka}}% + \expandafter\pgfplotstablegetcolumn\pgfplots@loc@TMPa\to\pgfplotstable@VARIANCE + \else + \t@pgfplots@toka=\expandafter{\pgfplotstable@variance@colname}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@variance@table}% + \edef\pgfplotstable@loc@TMPa{% + \noexpand\pgfplotstablegetcolumn{\the\t@pgfplots@toka}\noexpand\of{\the\t@pgfplots@tokb}\noexpand\to\noexpand\pgfplotstable@VARIANCE}% + \pgfplotstable@loc@TMPa + \fi + \fi + \else + % load from list: + \expandafter\pgfplotslistnew\expandafter\pgfplotstable@VARIANCE\expandafter{\pgfplotstable@variance@list}% + \fi + % + \pgfplotslistnewempty\pgfplotstable@Xparsed + % + \pgfmathfloatcreate{0}{0.0}{0}% + \let\pgfplotstable@S=\pgfmathresult + \let\pgfplotstable@Sxx=\pgfmathresult + \let\pgfplotstable@Sx=\pgfmathresult + \let\pgfplotstable@Sy=\pgfmathresult + \let\pgfplotstable@Sxy=\pgfmathresult + \pgfutil@loop + \pgfplotslistcheckempty\pgfplotstable@X + \ifpgfplotslistempty + \pgfplots@loop@CONTINUEfalse + \else + \pgfplots@loop@CONTINUEtrue + \fi + \ifpgfplots@loop@CONTINUE + \pgfplotslistpopfront\pgfplotstable@X\to\pgfplotstable@x + \pgfplotslistpopfront\pgfplotstable@Y\to\pgfplotstable@y + % + \pgfplotstableparsex{\pgfplotstable@x}% + \let\pgfplotstable@x=\pgfmathresult + \expandafter\pgfplotslistpushback\pgfmathresult\to\pgfplotstable@Xparsed + \pgfplotstableparsey{\pgfplotstable@y}% + \let\pgfplotstable@y=\pgfmathresult + % + \pgfplotslistcheckempty\pgfplotstable@VARIANCE + \ifpgfplotslistempty + \pgfmathfloatcreate{1}{1.0}{0}% + \let\pgfplotstable@invsqr=\pgfmathresult + \else + \pgfplotslistpopfront\pgfplotstable@VARIANCE\to\pgfplotstable@variance + \pgfmathfloatparsenumber{\pgfplotstable@variance}% + \let\pgfplotstable@variance=\pgfmathresult + \pgfmathfloatmultiply@{\pgfplotstable@variance}{\pgfplotstable@variance}% + \let\pgfplotstable@sqr=\pgfmathresult + \pgfmathfloatreciprocal@{\pgfplotstable@sqr}% + \let\pgfplotstable@invsqr=\pgfmathresult + \fi + % + \pgfmathfloatadd@{\pgfplotstable@S}{\pgfplotstable@invsqr}% + \let\pgfplotstable@S=\pgfmathresult + % + \pgfmathfloatmultiply@{\pgfplotstable@x}{\pgfplotstable@invsqr}% + \let\pgfplots@table@accum=\pgfmathresult + \pgfmathfloatadd@{\pgfplotstable@Sx}{\pgfplots@table@accum}% + \let\pgfplotstable@Sx=\pgfmathresult + % + \pgfmathfloatmultiply@{\pgfplotstable@x}{\pgfplots@table@accum}% + \let\pgfplots@table@accum=\pgfmathresult + \pgfmathfloatadd@{\pgfplotstable@Sxx}{\pgfplots@table@accum}% + \let\pgfplotstable@Sxx=\pgfmathresult + % + \pgfmathfloatmultiply@{\pgfplotstable@y}{\pgfplotstable@invsqr}% + \let\pgfplots@table@accum=\pgfmathresult + \pgfmathfloatadd@{\pgfplotstable@Sy}{\pgfplots@table@accum}% + \let\pgfplotstable@Sy=\pgfmathresult + % + \pgfmathfloatmultiply@{\pgfplotstable@x}{\pgfplots@table@accum}% + \let\pgfplots@table@accum=\pgfmathresult + \pgfmathfloatadd@{\pgfplotstable@Sxy}{\pgfplots@table@accum}% + \let\pgfplotstable@Sxy=\pgfmathresult + \pgfutil@repeat + % + \pgfmathparse{\pgfplotstable@S * \pgfplotstable@Sxx - \pgfplotstable@Sx *\pgfplotstable@Sx}% + \let\pgfplotstable@delta=\pgfmathresult + % + \pgfmathparse{(\pgfplotstable@S * \pgfplotstable@Sxy - \pgfplotstable@Sx * \pgfplotstable@Sy) / \pgfplotstable@delta}% + \let\pgfplotstable@a=\pgfmathresult + % + \pgfmathparse{(\pgfplotstable@Sxx * \pgfplotstable@Sy - \pgfplotstable@Sx * \pgfplotstable@Sxy) / \pgfplotstable@delta}% + \let\pgfplotstable@b=\pgfmathresult + % + \pgfplotslistnewempty\pgfplotstable@RESULT + \pgfplotslistforeachungrouped\pgfplotstable@Xparsed\as\pgfplotstable@x{% + \pgfmathfloatmultiply@{\pgfplotstable@x}{\pgfplotstable@a}% + \let\pgfplotstable@tmp=\pgfmathresult + \pgfmathfloatadd@{\pgfplotstable@tmp}{\pgfplotstable@b}% + \ifx\pgfplotstableparseylogbase\pgfutil@empty + \else + \pgfplotstableparseyinv@{\pgfmathresult}% + \fi + \pgfmathfloattosci{\pgfmathresult}% + \expandafter\pgfplotslistpushback\pgfmathresult\to\pgfplotstable@RESULT + }% + \pgfmathfloattosci\pgfplotstable@a + \let\pgfplotstable@a=\pgfmathresult + % + \pgfmathfloattosci\pgfplotstable@b + \let\pgfplotstable@b=\pgfmathresult + % + \global\let\pgfplotstableregressiona\pgfplotstable@a% + \global\let\pgfplotstableregressionb\pgfplotstable@b% + \let\pgfplotsretval=\pgfplotstable@RESULT + \pgfmath@smuggleone\pgfplotsretval + \endgroup +}% +\def\pgfplotstable@linear@regression@prepare@mode#1#2{% + \expandafter\def\csname pgfplotstableparse#2\endcsname##1{\pgfmathfloatparsenumber{##1}}% + \expandafter\def\csname pgfplotstableparse#2logbase\endcsname{}% + \edef\pgfplots@loc@TMPa{#1}% + \def\pgfplots@loc@TMPb{auto}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \def\pgfplots@loc@TMPa{}% auto == empty string + \fi + % + \ifx\pgfplots@loc@TMPa\pgfutil@empty + % `auto' mode. + \pgfplotsifinaxis{% + \pgfplots@if{pgfplots@#2islinear}{% + \def\pgfplots@loc@TMPa{linear}% + }{% + \def\pgfplots@loc@TMPa{log}% + }% + }{% + \def\pgfplots@loc@TMPa{linear}% + }% + \fi + % + \def\pgfplots@loc@TMPb{linear}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \else + \def\pgfplots@loc@TMPb{log}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \pgfplotsmathdefinemacrolnbase{pgfplotstableparse#2}{\pgfkeysvalueof{/pgfplots/log basis #2}}% + \else + \pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{Sorry, the value '#1' is unexpected for 'linear regression/#2mode'}\pgfeov% + \fi + \fi +}% + + +% Sorts table #3 according to options defined in #1 and writes result +% to #2. +% +% \pgfplotstablesort[sort key=<colname>]\result{<input table>} +% \pgfplotstablesort[sort key=<colname>,sort key source=<\table>]\result{<input table>} +\def\pgfplotstablesort{\pgfutil@ifnextchar[{\pgfplotstablesort@opt}{\pgfplotstablesort@opt[]}} +\def\pgfplotstablesort@opt[#1]#2{% + \begingroup + \pgfplotstableset{#1}% + \pgfplotstablecollectoneargwithpreparecatcodes{% + \pgfplotstablesort@{#2}% + }% +} +\def\pgfplotstablesort@#1#2{% + \pgfkeysgetvalue{/pgfplots/table/sort key}\pgfplotstable@sort@key@colname + \pgfkeysgetvalue{/pgfplots/table/sort key from}\pgfplotstable@sort@key@table + \pgfkeysgetvalue{/pgfplots/table/sort cmp}\pgfplotstable@sort@cmp + % + % + \pgfplotstable@isloadedtable{#2}{% + \pgfplotstablegetrowsof{#2}% + \let\pgfplotstable@numrows=\pgfplotsretval + % + \pgfplotstabletranspose[input colnames to=,colnames from=]\pgfp@tmp{#2}% + \def\pgfplotstable@table{#2}% + \let\pgfplotstable@input@colnames=#2\relax + }{% + \pgfplotstableread{#2}\pgfp@tmp@in + \pgfplotstablegetrowsof\pgfp@tmp@in + \let\pgfplotstable@numrows=\pgfplotsretval + \def\pgfplotstable@table{\pgfp@tmp@in}% + \let\pgfplotstable@input@colnames=\pgfp@tmp@in + % + \pgfplotstabletranspose[input colnames to=,colnames from=]\pgfp@tmp\pgfp@tmp@in + }% + % + \ifx\pgfplotstable@sort@key@colname\pgfutil@empty + \else + \ifx\pgfplotstable@sort@key@table\pgfutil@empty + \t@pgfplots@toka=\expandafter{\pgfplotstable@table}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@sort@key@colname}% + \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@tokb}\noexpand\of{\the\t@pgfplots@toka}}% + \expandafter\pgfplotstablegetcolumn\pgfplots@loc@TMPa\to\pgfplotstable@sort@key + \else + \t@pgfplots@toka=\expandafter{\pgfplotstable@sort@key@colname}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@sort@key@table}% + \edef\pgfplotstable@loc@TMPa{% + \noexpand\pgfplotstablegetcolumn{\the\t@pgfplots@toka}\noexpand\of{\the\t@pgfplots@tokb}\noexpand\to\noexpand\pgfplotstable@sort@key}% + \pgfplotstable@loc@TMPa + \fi + \fi + \pgfplotsarraynewempty\pgfplotstable@sort@key@array + \pgfplotslistforeachungrouped{\pgfplotstable@sort@key}\as\pgfplotstable@loc@TMPa{% + \expandafter\pgfplotsarraypushback\expandafter{\pgfplotstable@loc@TMPa}\to\pgfplotstable@sort@key@array + }% + % + % + % use a side effect: columns are integers, they are stored as + % '\pgfp@tmp@<index>'. Thus, column names and array indices are + % essentially the same! That simplifies the operation and explains + % why we transposed the table. + % We simply interprete the transposed table as array. We don't + % even need to copy anything. + \pgfplotsarrayresize{\pgfp@tmp}{\pgfplotstable@numrows}% + % Oh, we also need the index to access the sort key. Well, then we + % did not win anything. + \pgfplotsarrayforeachungrouped\pgfp@tmp\as\pgfplotstable@loc@TMPa{% + \t@pgfplots@toka=\expandafter{\pgfplotstable@loc@TMPa}% + \edef\pgfplotstable@loc@TMPa{\pgfplotsarrayforeachindex:{\the\t@pgfplots@toka}}% + \pgfplotsarrayletentry{\pgfplotsarrayforeachindex}\of\pgfp@tmp=\pgfplotstable@loc@TMPa + }% + % extract current row index and row content: + \def\pgfplotstable@sort@extractindex##1:##2{% + \def\pgfmathresult{##1}% + \def\pgfplotstable@row{##2}% + }% + % + \expandafter\pgfplotsset\expandafter{\pgfplotstable@sort@cmp}% + \pgfkeysgetvalue{/pgfplots/iflessthan/.@cmd}\pgfplotstable@sort@cmp@routine + \def\pgfplotstable@sort@iflt##1##2##3##4{\pgfplotstable@sort@cmp@routine{##1}{##2}{##3}{##4}\pgfeov}% + % + \pgfkeysdefargs{/pgfplots/iflessthan}{##1##2##3##4}{% + \expandafter\pgfplotstable@sort@extractindex##1% + \pgfplotsarrayselect{\pgfmathresult}\of\pgfplotstable@sort@key@array\to\pgfplotstable@arga + \expandafter\pgfplotstable@sort@extractindex##2% + \pgfplotsarrayselect{\pgfmathresult}\of\pgfplotstable@sort@key@array\to\pgfplotstable@argb + \pgfplotstable@sort@iflt{\pgfplotstable@arga}{\pgfplotstable@argb}{##3}{##4}% + }% + \pgfkeysdef{/pgfplots/array/unscope pre}{% + % remove the row index: + \pgfplotsarrayforeachungrouped\pgfp@tmp\as\pgfplotstable@loc@TMPa{% + \expandafter\pgfplotstable@sort@extractindex\pgfplotstable@loc@TMPa% + \pgfplotsarrayletentry{\pgfplotsarrayforeachindex}\of\pgfp@tmp=\pgfplotstable@row + }% + % restore original form: + \pgfplotstabletranspose[input colnames to=,colnames from=]\pgfp@tmp@result\pgfp@tmp + % technical, transport result out of the current scope ... + \pgfplotstable@copy@to@globalbuffers\pgfp@tmp@result{\pgfplotstablenameof\pgfp@tmp}% + % ... and use this lowlevel thing to transport the original column names. + \global\let\pgfplotstable@colnames@glob=\pgfplotstable@input@colnames + }% + \pgfkeysdef{/pgfplots/array/unscope post}{}% + \pgfplotsarraysort{\pgfp@tmp}% + \endgroup + \pgfplotstable@copy@globalbuffers@to{#1}% +}% + +\pgfutil@ifundefined{pgfcalendardatetojulian}{% + \def\pgfcalendardatetojulian#1#2{\pgfplots@error{Sorry, you need to use \string\usepackage{pgfcalendar} before using date specific methods}}% +}{}% \endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstableshared.code.tex b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstableshared.code.tex new file mode 100644 index 00000000000..4a31f8fc84d --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstableshared.code.tex @@ -0,0 +1,1826 @@ +%-------------------------------------------- +% +% Package pgfplotstable +% +% Provides support to read and work with abstact numeric tables of the +% form +% +% COLUMN1 COLUMN2 COLUMN3 +% 1 2 3 +% 4 4 552 +% 1e124 0.00001 1.2345e-12 +% ... +% +% Copyright 2007-2010 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/>. +% +%-------------------------------------------- + +% This file provides a high-level table manipulation and typesetting +% package. +% +% +% --------------------------------------------- +% Implementation notes for programmers: +% --------------------------------------------- +% +% The table data structure consists of +% 1. A name which must be a valid TeX macro like '\table' +% 2. A column list in the \pgfplotslist format. +% In fact, the column list is stored in the table's name: +% \pgfplotslistnewempty\table +% 3. A "file name" stored in +% \csname\string<\namemacro>@@table@name\endcsname +% 4. A "scan line length" number stored in +% \csname\string<\namemacro>@@table@scanline\endcsname +% It contains the value of \pgfplotsscanlinelength which has +% been identified right after \pgfplotstableread. +% 5. foreach column, there is a list of row-values (a row-vector) in +% the \pgfplotslist format named +% \csname\string<\namemacro>@<column name>\endcsname +% + +\newif\ifpgfplotstable@search@header +\newif\ifpgfplotstable@firstline@is@header +\newcount\c@pgfplotstable@counta +\newtoks\t@pgfplotstable@a +\newwrite\pgfplotstable@outfile +\newif\ifpgfplots@addplotimpl@readcompletely +% should always be false; use only in grouped internal macros +\newif\ifpgfplots@table@options@areset +\newif\ifpgfplots@tableread@to@listener +\newif\ifpgfplots@tableread@use@begingroup +\newif\ifpgfplotstable@trimcells + +\pgfkeys{% + /pgfplots/table/every table/.style={}, + /pgfplots/table/.unknown/.code={% + \pgfplotstable@error@pkg{Sorry, I do not know the key `\pgfkeyscurrentkeyRAW' and I am going to ignore it. Perhaps you need \string\usepackage{pgfplotstable}? (The table typesetting parts are a separate package)}% + },% + /pgfplots/table/header/.is choice, + /pgfplots/table/header/true/.code={\pgfplotstable@firstline@is@headerfalse\pgfplotstable@search@headertrue}, + /pgfplots/table/header/false/.code={\pgfplotstable@firstline@is@headerfalse\pgfplotstable@search@headerfalse}, + /pgfplots/table/header/has colnames/.code={\pgfplotstable@firstline@is@headertrue\pgfplotstable@search@headerfalse}, + /pgfplots/table/header=true, + /pgfplots/table/x index/.initial=0, + /pgfplots/table/x/.initial=, + /pgfplots/table/x expr/.initial=, + /pgfplots/table/y index/.initial=1, + /pgfplots/table/y/.initial=, + /pgfplots/table/y expr/.initial=, + /pgfplots/table/z index/.initial=2, + /pgfplots/table/z/.initial=, + /pgfplots/table/z expr/.initial=, + /pgfplots/table/meta index/.initial=, + /pgfplots/table/meta/.initial=, + /pgfplots/table/meta expr/.initial=, + /pgfplots/table/x error index/.initial=, + /pgfplots/table/y error index/.initial=, + /pgfplots/table/z error index/.initial=, + /pgfplots/table/x error/.initial=, + /pgfplots/table/y error/.initial=, + /pgfplots/table/z error/.initial=, + /pgfplots/table/x error expr/.initial=, + /pgfplots/table/y error expr/.initial=, + /pgfplots/table/z error expr/.initial=, + /pgfplots/table/ignore chars/.initial=, + /pgfplots/table/white space chars/.initial=, + /pgfplots/table/trim cells/.is if=pgfplotstable@trimcells, + /pgfplots/table/trim cells/.default=true, + /pgfplots/table/read completely/.is choice, + /pgfplots/table/read completely/true/.code= \pgfplots@addplotimpl@readcompletelytrue\def\pgfplots@addplotimpl@readcompletely@auto{0}, + /pgfplots/table/read completely/false/.code=\pgfplots@addplotimpl@readcompletelyfalse\def\pgfplots@addplotimpl@readcompletely@auto{0}, + /pgfplots/table/read completely/auto/.code=\pgfplots@addplotimpl@readcompletelyfalse\def\pgfplots@addplotimpl@readcompletely@auto{1}, + /pgfplots/table/read completely/.default=true, + /pgfplots/table/read completely=auto, + /pgfplots/table/col sep/.is choice, + /pgfplots/table/col sep/space/.code = {\def\pgfplotstableread@COLSEP@CASE{0}}, + /pgfplots/table/col sep/comma/.code = {\def\pgfplotstableread@COLSEP@CASE{1}}, + /pgfplots/table/col sep/semicolon/.code = {\def\pgfplotstableread@COLSEP@CASE{2}}, + /pgfplots/table/col sep/colon/.code = {\def\pgfplotstableread@COLSEP@CASE{3}}, + /pgfplots/table/col sep/braces/.code = {\def\pgfplotstableread@COLSEP@CASE{4}}, + /pgfplots/table/col sep/tab/.code = {\def\pgfplotstableread@COLSEP@CASE{5}}, + /pgfplots/table/col sep/&/.code = {\def\pgfplotstableread@COLSEP@CASE{6}\pgfplotstable@trimcellstrue}, + /pgfplots/table/col sep/ampersand/.code = {\def\pgfplotstableread@COLSEP@CASE{6}\pgfplotstable@trimcellstrue}, + /pgfplots/table/col sep=space, + /pgfplots/table/format/.is choice, + /pgfplots/table/format/auto/.code = {\def\pgfplotstableread@FORMAT@CASE{0}}, + /pgfplots/table/format/inline/.code = {\def\pgfplotstableread@FORMAT@CASE{1}}, + /pgfplots/table/format/file/.code = {\def\pgfplotstableread@FORMAT@CASE{2}}, + /pgfplots/table/format=auto, + /pgfplots/table/row sep/.code={% + \pgfplotsutilifstringequal{#1}{\\}{% + \def\pgfplotstableread@ROWSEP@CASE{1}% + }{% + \pgfplotsutilifstringequal{#1}{crcr}{% + \def\pgfplotstableread@ROWSEP@CASE{1}% + }{% + \pgfplotsutilifstringequal{#1}{newline}{% + \def\pgfplotstableread@ROWSEP@CASE{0}% + }{% + {% + \t@pgfplots@tokc={#1}% + \pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{Sorry, the choice `row sep=\the\t@pgfplots@tokc' is not known. Maybe you misspelled it? Try `\string\\' or `newline'.}\pgfeov% + }% + }% + }% + }% + },% + /pgfplots/table/row sep=newline, +} + +\pgfkeys{ + % #1: the argument which should have been assigned. + % #2: an error message. + /pgfplots/exception/non unique colname/.code 2 args={% + \ifx\pgfplotsexceptionmsg\relax + \pgfplots@error{#2}% + \else + \pgfplots@error{\pgfplotsexceptionmsg}% + \fi + \let#1=\pgfutil@empty + },% +} + +% \pgfplotstableread[OPTIONS] {FILE} to \name +% +% This method reads a table from FILE to macro \name. +% +% FILE is something like +% G Basis dof L2 A Lmax cgiter maxlevel eps +% 5 5 5 8.31160034e-02 0.00000000e+00 1.80007647e-01 2 2 -1 +% 17 17 17 2.54685628e-02 0.00000000e+00 3.75580565e-02 5 3 -1 +% ... +% +% A number format line is also understood: +% G Basis dof L2 A Lmax cgiter maxlevel eps +% $flags int int int sci:8 sci:8 sci:8 int int std:8 +% 5 5 5 8.31160034e-02 0.00000000e+00 1.80007647e-01 2 2 -1 +% +% or a three-column-gnuplot file with 2 comment headers like +% #Curve 0, 20 points +% #x y type +% 0.00000 0.00000 i +% 0.52632 0.50235 i +% +% The table data is stored columnwise in lists and can be accessed +% with the other methods of this package. +% +% \pgfplotstableread[<options>]{<file>}{<\macro>} +% \pgfplotstableread[<options>]{<file>} to listener{<\macro>} +% \pgfplotstableread* ... +% +% The '*' does not protect its local variables with TeX groups, +% everything is added to the current scope (useful to the 'to +% listener' thing. +% +% The 'to listener' variant does NOT assemble a table data structure. +% Instead, it processes the input table row-wise and invokes <\macro> +% after each complete row. During the evaluation of <\macro>, the +% following methods can be used to query values: +% \pgfplotstablereadgetcolindex{<index>}{<\macro>} +% \pgfplotstablereadgetcolname{<name>}{<\macro>} +% \pgfplotstablereadvalueofcolname{<name>} +% \pgfplotstablereadvalueofcolindex{<index>} +% \thisrow{<name>} (equivalent to \pgfplotstablereadvalueofcolname) +% \getthisrow{<name>}{<\macro>} (equivalent to \pgfplotstablereadgetcolname) +% \thisrowno{<index>} (equivalent to \pgfplotstablereadvalueofcolindex) +% \getthisrowno{<index>}{<\macro>} +% \pgfplotstableforeachcolumn\as{<\iteratemacro>}{<loop body>} +% (the '\as' is required directly after +% \pgfplotstableforeachcolumn in this context) +% Attention: 'to listener' is scoped by TeX groups, so any assignments +% need to be done globally (or with aftergroup magic). +% +% More remarks about scoping: +% \pgfplotstableread to listener works as follows: +% \begingroup +% // load table +% while file has more lines: +% load line, read every column; +% invoke listener; +% repeat +% \endgroup +% +% In short: all invocations of listener have the same level of +% scoping: they are inside of one TeX group. But single listener +% invocations as such are not scoped. Make sure you don't +% accidentally overwrite one of the internals in listener. And: make +% sure you don't change temporary registers without scoping them! +% +% Note: this command also updates \pgfplotsscanlinelength. +\def\pgfplotstableread{% + \pgfutil@ifnextchar*{% + \pgfplots@tableread@use@begingroupfalse + \pgfplotstableread@impl@star + }{% + \pgfplots@tableread@use@begingrouptrue + \pgfplotstableread@impl@star*% + }% +}% +\def\pgfplotstableread@impl@star*{% + \pgfutil@ifnextchar[{% + \pgfplotstableread@impl + }{% + \pgfplotstableread@impl[]% + }% +} + +% BACKWARDS COMPATIBILITY +\let\pgfnumtableread=\pgfplotstableread + +% Invokes #2 if '#1' is an already loaded table and #3 if not. +\long\def\pgfplotstable@isloadedtable#1#2#3{% + \pgfplotsutil@ifdefinedui@withsuffix{#1}{@@table@name}{#2}{#3}% +}% + +% If the colum name `#1' is a `create on use' speicifcation, #2 is +% invoked, #3 otherwise. +\long\def\pgfplotstableifiscreateonuse#1#2#3{% + \pgfkeysifdefined{/pgfplots/table/create on use/#1/.@cmd}{#2}{% + \pgfutil@in@{create col/}{#1}% + \ifpgfutil@in@ + #2% + \else + #3% + \fi + }% +}% + +% Defines \pgfplotsretval to be a column name which does not already +% occur in the column names of table #1. +\def\pgfplotstablegenerateuniquecolnamefor#1{% + \begingroup + \c@pgf@countd=0 + \pgfplotstableforeachcolumn{#1}\as\pgfplots@loc@TMPa{% + \def\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}% + \edef\pgfplots@loc@TMPb{autocol\the\c@pgf@countd}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \advance\c@pgf@countd by1 + \fi + }% + \edef\pgfplotsretval{autocol\the\c@pgf@countd}% + \pgfmath@smuggleone\pgfplotsretval + \endgroup +} + +% Returns a column vector in form of \pgfplotslist +% into #3. +% +% #1: the column name (not a macro) +% #2: the table structure +% #3: the output macro name. +% +% @throw `no such element' on error +\def\pgfplotstablegetcolumnbyname#1\of#2\to#3{% + \let#3=\pgfutil@empty% just for sanity checking. + \pgfplotstable@getcol{#1}\of{#2}\to{#3}\getcolmethod{STD}% +} + +% Declares a new getcolmethod class #1. +% The argument '#1' can then be used as argument for +% \pgfplotstable@getcol...\getcolmethod{#1}. +% +% #2: a set of keys which redefine the behavior. +% See below for available choices. +\def\pgfplotstable@definegetcolmethod#1#2{% + \edef\pgfplotstable@definegetcolmethod@{#1}% + \pgfqkeys{/pgfplots/table/@getcol}{% + % Checks if column '#1' exists in table `#2' and invokes `#3' if that + % is the case and `#4' if not. + % + % Note that the check is only for physically existent colums, no alias + % or create on use is checked here. + % #1: colname + % #2: table struct + % #3: true code + % #4: false code + ifexists =\pgfutil@ifundefined{\string##2@##1}{##4}{##3}, + % + % Low level method to return (the actual content) of column #1 of + % table #2 to macro #3. + % #1: colname + % #2: table struct + % #3: result macro + getexisting =\expandafter\let\expandafter##3\csname\string##2@##1\endcsname, + % + % no arguments, the value is a boolean (0 or 1) + createonuse =1, + % + % error handling. + % #1: colname + % #2: table struct + % #3: result macro + lazyforbidden=\pgfplotstablegetcolumnbyname@impl@createonuseforbidden{##1}\of{##2}\to{##3}, + noalias =\pgfplotstablegetcolumnbyname@impl@nosuchalias{##1}\of{##2}\to{##3}, + nocol =\pgfplotstablegetcolumnbyname@impl@nocolumn{##1}\of{##2}\to{##3}, + #2% + }% +}% +\pgfqkeys{/pgfplots/table/@getcol}{% + ifexists/.code ={\expandafter\def\csname pgfplotstable@getcol@ifexists@\pgfplotstable@definegetcolmethod@\endcsname##1\of##2##3##4{#1}},% + getexisting/.code ={\expandafter\def\csname pgfplotstable@getcol@getexisting@\pgfplotstable@definegetcolmethod@\endcsname##1\of##2\to##3{#1}},% + createonuse/.code ={\expandafter\def\csname pgfplotstable@getcol@createonuse@\pgfplotstable@definegetcolmethod@\endcsname{#1}},% + lazyforbidden/.code ={\expandafter\def\csname pgfplotstable@getcol@lazyforbidden@\pgfplotstable@definegetcolmethod@\endcsname##1\of##2\to##3{#1}},% + noalias/.code ={\expandafter\def\csname pgfplotstable@getcol@noalias@\pgfplotstable@definegetcolmethod@\endcsname##1\of##2\to##3{#1}},% + nocol/.code ={\expandafter\def\csname pgfplotstable@getcol@nocol@\pgfplotstable@definegetcolmethod@\endcsname##1\of##2\to##3{#1}},% +}% + +\pgfplotstable@definegetcolmethod{STD}{}% +\pgfplotstable@definegetcolmethod{getptr}{% + ifexists =\pgfutil@ifundefined{pgfplotstblread@colindex@for@name#1}{#4}{#3},% + getexisting =\edef#3{\csname pgfplotstblread@colindex@for@name#1\endcsname},% +} +\pgfplotstable@definegetcolmethod{resolvename}{% + getexisting =\edef#3{#1},% +} + +% The low level implementation of \pgfplotstablegetcolumnbyname. +% +% #4: is a getcolmethod declared with \pgfplotstable@definegetcolmethod +% +% ATTENTION: this macro should be expandable! It is also used inside +% of \thisrow{}. +\def\pgfplotstable@getcol#1\of#2\to#3\getcolmethod#4{% + \csname pgfplotstable@getcol@ifexists@#4\endcsname{#1}\of{#2}{% + \csname pgfplotstable@getcol@getexisting@#4\endcsname{#1}\of{#2}\to#3% + }{% + % Oh, there is no column '#1' in table '#2'! + % + % Ok, then check for special features. + % + % 1. 'create col/...' + % 2. 'create on use' + % 3. 'alias' + % + % WARNING : this code has been REPLICATED in + % *** \pgfplotstablereadvalueofcolname *** + \if1\csname pgfplotstable@getcol@createonuse@#4\endcsname% + \pgfutil@in@{create col/}{#1}% + \ifpgfutil@in@ + \pgfplotstablegenerateuniquecolnamefor{#2}% + \def\pgfplotstable@loc@TMPa##1{% + \pgfkeysdef{/pgfplots/table/create on use/##1}{\pgfkeysalso{#1}}% + \pgfplotstablecreatecol[/pgfplots/table/create on use/##1]{##1}{#2}% + % and return the newly generated col: + \csname pgfplotstable@getcol@getexisting@#4\endcsname{##1}\of{#2}\to#3% + }% + \expandafter\pgfplotstable@loc@TMPa\expandafter{\pgfplotsretval}% + \else + \pgfplotstable@getcol@next{#1}\of{#2}\to{#3}\getcolmethod{#4}% + \fi + \else + \pgfplotstable@getcol@next{#1}\of{#2}\to{#3}\getcolmethod{#4}% + \fi + }% +}% +\def\pgfplotstable@getcol@next#1\of#2\to#3\getcolmethod#4{% + \pgfkeysifdefined{/pgfplots/table/create on use/#1/.@cmd}{% + % aah - a 'create on use' style exists. Apply it! + \if1\csname pgfplotstable@getcol@createonuse@#4\endcsname% + \pgfplotstablecreatecol[/pgfplots/table/create on use/#1]{#1}{#2}% + % and return the newly generated col: + \csname pgfplotstable@getcol@getexisting@#4\endcsname{#1}\of{#2}\to#3% + \else + \csname pgfplotstable@getcol@lazyforbidden@#4\endcsname{#1}\of{#2}\to#3% + \fi + }{% + % ok, then it is either an alias or it simply doesn't exist + \pgfkeysifdefined{/pgfplots/table/alias/#1}{% + \csname pgfplotstable@getcol@ifexists@#4\endcsname{\pgfkeysvalueof{/pgfplots/table/alias/#1}}\of{#2}{% + \csname pgfplotstable@getcol@getexisting@#4\endcsname{\pgfkeysvalueof{/pgfplots/table/alias/#1}}\of{#2}\to#3% + }{% + \csname pgfplotstable@getcol@noalias@#4\endcsname{#1}\of{#2}\to{#3}% + }% + }{% + \csname pgfplotstable@getcol@nocol@#4\endcsname{#1}\of{#2}\to{#3}% + }% + }% +} +\def\pgfplotstablegetcolumnbyname@impl@createonuseforbidden#1\of#2\to#3{% + \pgfplotstablegetcolumnbyname@impl@nocolumn@{#1}\of{#2}\to{#3}\pgfplotstablegetcolumnbyname@impl@createonuseforbiddentext@ +} + +\def\pgfplotstablegetcolumnbyname@impl@createonuseforbiddentext@#1{% + \space Note that I found a 'create on use/#1' style, but unfortunately, I can't evaluate it in this context. Please use the 'read completely' key such that it is processed earlier (see the manual for details)% +}% +\def\pgfplotstablegetcolumnbyname@impl@createonuseforbiddentext@disable#1{}% + +\def\pgfplotstablegetcolumnbyname@impl@nosuchalias#1\of#2\to#3{ + \pgfplotstablegetcolumnbyname@impl@nosuchalias@{#1}\of{#2}\to{#3}\pgfplotstablegetcolumnbyname@impl@createonuseforbiddentext@disable +}% + +\def\pgfplotstablegetcolumnbyname@impl@nosuchalias@#1\of#2\to#3#4{% + \pgfplotsthrow{no such element}{#3}{Sorry, could not retrieve aliased column '\pgfkeysvalueof{/pgfplots/table/alias/#1}' from table '\pgfplotstablenameof{#2}'. The original request was for '#1', which does not exist either.#4{#1}}\pgfeov% +}% + +\def\pgfplotstablegetcolumnbyname@impl@nocolumn#1\of#2\to#3{% + \pgfplotstablegetcolumnbyname@impl@nocolumn@{#1}\of{#2}\to{#3}\pgfplotstablegetcolumnbyname@impl@createonuseforbiddentext@disable +}% +\def\pgfplotstablegetcolumnbyname@impl@nocolumn@#1\of#2\to#3#4{% + \pgfplotsthrow{no such element}{#3}{Sorry, could not retrieve column '#1' from table '\pgfplotstablenameof{#2}'. Please check spelling (or introduce name aliases).#4{#1}}\pgfeov% +}% + + +% Retrieves the column *NAME* '#1' of table #2 and writes it into +% '#3'. +% +% If there is no such column, column aliases will be checked. Finally +% if there are no aliases, the command fails with an error. +% +% The 'create on use' statements can't be used in this context. +% @see \pgfplotstablegetcolumnbyname +% +% #1: a column name (not a macro) +% #2: the table structure +% #3: a macro name which will be filled with the (probably modified) +% column name into #2. +\def\pgfplotstableresolvecolname#1\of#2\to#3{% + \let#3=\pgfutil@empty% just for sanity checking. + \pgfplotstable@getcol{#1}\of{#2}\to{#3}\getcolmethod{resolvename}% +} + +% Invokes either \pgfplotstablegetcolumnbyindex or +% \pgfplotstablegetcolumnbyname. +% +% #1: either a column name, alias or create on use specification, or +% [index]<integer> denoting a column index. +% #2: either a loaded table or a table macro. +% #3: a macro name which will be filled with the column, in the format +% accepted of \pgfplotslist... +\long\def\pgfplotstablegetcolumn#1\of#2\to#3{% + \begingroup + \pgfplotstable@isloadedtable{#2}{% + \pgfplotstablegetcolumnfromstruct{#1}\of{#2}\to{#3}% + }{% + \pgfplotstableread{#2}\pgfplotstable@tmptbl + \pgfplotstablegetcolumnfromstruct{#1}\of\pgfplotstable@tmptbl\to{#3}% + }% + \pgfmath@smuggleone#3% + \endgroup +}% +\def\pgfplotstablegetcolumnfromstruct#1\of#2\to#3{% + \def\pgfplotstable@loc@TMPc{#1}% + \pgfplotstable@is@colname{\pgfplotstable@loc@TMPc}%% + \ifpgfplotstableread@foundcolnames + \else + \expandafter\pgfplotstablegetcolumnnamebyindex\pgfplotstable@loc@TMPc\of{#2}\to\pgfplotstable@loc@TMPc + \fi + \expandafter\pgfplotstablegetcolumnbyname\pgfplotstable@loc@TMPc\of#2\to{#3}% +}% + +\def\pgfplotstablegetcolumnnamebyindex#1\of#2\to#3{% + \pgfplotslistselect#1\of#2\to#3\relax +}% +\def\pgfplotstablegetcolumnbyindex#1\of#2\to#3{% + \pgfplotslistselect#1\of#2\to#3\relax + \expandafter\pgfplotstablegetcolumnbyname#3\of#2\to{#3}% +} + +\def\pgfplotstablecopy#1\to#2{% + \let#2=#1% + \pgfplotstablegetname#1\pgfplotstable@loc@TMPa + \expandafter\let\csname\string#2@@table@name\endcsname=\pgfplotstable@loc@TMPa + \expandafter\edef\csname\string#2@@table@scanline\endcsname{\pgfplotstablescanlinelengthof{#1}}% + \pgfplotslistforeachungrouped#1\as\pgfplotstable@loc@TMPa{% + \def\pgfplotstable@loc@TMPb{% + \expandafter\let\csname\string#2@\pgfplotstable@loc@TMPa\endcsname}% + \expandafter\pgfplotstable@loc@TMPb\csname\string#1@\pgfplotstable@loc@TMPa\endcsname + }% +} + +% Returns the file name of table '#1' into macro #2. +\def\pgfplotstablegetname#1#2{% + \expandafter\let\expandafter#2\csname\string#1@@table@name\endcsname +} + +% expands to the table file name of table '#1' +\def\pgfplotstablenameof#1{% + \csname\string#1@@table@name\endcsname +} + +% Returns the value of \pgfplotsscanlinelength for table '#1' into +% macro #2. +\def\pgfplotstablegetscanlinelength#1#2{% + \expandafter\let\expandafter#2\csname\string#1@@table@scanline\endcsname +}% + +% Expands to the scan line length of table '#1'. +\def\pgfplotstablescanlinelengthof#1{\csname\string#1@@table@scanline\endcsname}% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% IMPLEMENTATION +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newif\ifpgfplotstableread@curline@contains@colnames +\newif\ifpgfplotstableread@foundcolnames +\newif\ifpgfplotstableread@skipline + +% A method which is necessary to work with inline table data. +% +% It does nothing if format=file. +% +% It needs to be invoked BEFORE the inline table data has been +% seen the first time. "Seen" means collected as argument! +% +% The macro changes \catcodes in order to implement the 'row sep=newline', +% some special 'col sep' choices and the 'ignore chars' features. +% +% ATTENTION: this changes the processing of ALL following newline +% characters. +% @see \pgfplotstablecollectoneargwithpreparecatcodes +\def\pgfplotstablereadpreparecatcodes{% + \ifx\pgfplotstablereadrestorecatcodes\relax + \edef\pgfplotstablereadrestorecatcodes{% + \noexpand\pgfplotstableuninstallignorechars + \noexpand\catcode`\noexpand\^^M=\the\catcode`\^^M\noexpand\space + \noexpand\catcode`\noexpand\ =\the\catcode`\ \noexpand\space + \noexpand\catcode`\noexpand\;=\the\catcode`\;\noexpand\space + \noexpand\catcode`\noexpand\:=\the\catcode`\:\noexpand\space + \noexpand\catcode`\noexpand\^^I=\the\catcode`\^^I\noexpand\space + \noexpand\let\noexpand\pgfplotstablereadrestorecatcodes=\noexpand\relax + }% + \ifcase\pgfplotstableread@FORMAT@CASE\relax + % format=auto + \pgfplotstablereadpreparecatcodes@ + \or + % format=inline + \pgfplotstablereadpreparecatcodes@ + \fi + \fi +} +\let\pgfplotstablereadrestorecatcodes=\relax +\def\pgfplotstablereadpreparecatcodes@{% + \if0\pgfplotstableread@ROWSEP@CASE\relax + % row sep = newline + \catcode`\^^M=12 + \fi + \ifcase\pgfplotstableread@COLSEP@CASE\relax + % col sep=space: + \catcode`\ =10 + \or + % col sep=comma: + \or + % col sep=semicolon: + \catcode`\;=12 + \or + % col sep=colon: + \catcode`\:=12 + \or + % col sep=brace: + \or + % col sep=tab: + \catcode`\^^I=12 + \fi + \pgfplotstableinstallignorechars +}% + +% Logically, this routine does +% \pgfplotstablereadpreparecatcodes +% #1 +% and that's all. However, It makes sure that any white space +% characters (especially newlines) between '#1' and the following +% argument are gobbled! +% +% To show the problem, consider +% \pgfplotstabletypeset[<options>] +% \loadedtable +% +% and we want to set the catcodes *before* \loadedtable is seen. +% Well, there is a newline character after ']'! If we change the +% catcodes, this newline will be considered as character and will make +% up the first argument, the \loadedtable will be ignored. +% +% \pgfplotstablecollectoneargwithpreparecatcodes avoids this problem +% by gobbling all space (newline) characters *before* collecting the +% directly following argument token. Furthermore, it restores the +% catcodes directly after the argument has been collected. +% +% @see \pgfplotstablecollectoneargwithpreparecatcodesnorestore +\long\def\pgfplotstablecollectoneargwithpreparecatcodes#1{% + \begingroup + \t@pgfplotstable@a{{#1}}% this allows '#' characters in '#1' + \def\pgfplotstablecollectoneargwithpreparecatcodes@@{% + \pgfplotstablereadpreparecatcodes + \expandafter\pgfplotstablecollectoneargwithpreparecatcodes@end\the\t@pgfplotstable@a% + }% + % equivalent to + %\let\pgfplotstable@loc@TMPa=<next token>\pgfplotstablecollectoneargwithpreparecatcodes@@<next token> + \futurelet\pgfplotstable@loc@TMPa\pgfplotstablecollectoneargwithpreparecatcodes@@ + % this employs a side effect: \futurelet gobbles any spaces + % (including newlines). +}% +\def\pgfplotstablecollectoneargwithpreparecatcodes@end#1#2{% + \endgroup + #1{#2}% +}% + +% An overloaded method of +% \pgfplotstablecollectoneargwithpreparecatcodes which does not +% restore the catcodes after collecting one arg. +\long\def\pgfplotstablecollectoneargwithpreparecatcodesnorestore#1{% + \t@pgfplotstable@a{{#1}}% + \def\pgfplotstablecollectoneargwithpreparecatcodes@@{% + \expandafter\pgfplotstablereadpreparecatcodes\t@pgfplotstable@a + }% + % equivalent to + %\let\pgfplotstable@loc@TMPa=<next token>\pgfplotstablecollectoneargwithpreparecatcodes@@<next token> + \futurelet\pgfplotstable@loc@TMPa\pgfplotstablecollectoneargwithpreparecatcodes@@ +}% + +% Accept one of +% \pgfplotstableread[#1]{<file>}{<\macro>} +% \pgfplotstableread[#1]{<file>} to listener{<\macro>} +% or +% \pgfplotstableread[#1]{<file>} to {<\macro>} (DEPRECATED) +\long\def\pgfplotstableread@impl[#1]{% + \ifpgfplots@tableread@use@begingroup + \begingroup + \def\endgroup@@pgfplotstableread{\endgroup}% + \else + \let\endgroup@@pgfplotstableread=\relax% + \fi + % set options here, although we can't evaluate 'every table' yet + % (the file name is not yet known). + % But #1 may contain input format specifiers which are important + % for \catcodes, BEFORE we have read the second argument: + \pgfplotstableset{#1}% + % + \pgfplotstablecollectoneargwithpreparecatcodes{% + \pgfplotstableread@impl@collectfirstarg{#1}% + }% +}% +\long\def\pgfplotstableread@impl@collectfirstarg#1#2{% + \pgfutil@ifnextchar t{% + \pgfplotstableread@impl@@{#1}{#2}% + }{% + \pgfplotstableread@impl@{#1}{#2}% + }% +}% + + +% I don't know why; but I started with +% >> \pgfplotstableread[]{file} to \macro +% That ' to ' is really ugly. This here is for backwards +% compatibility: +\long\def\pgfplotstableread@impl@@#1#2to {% + \pgfutil@ifnextchar l{% + \pgfplotstableread@impl@@listener{#1}{#2}% + }{% + \pgfplotstableread@impl@{#1}{#2}% + }% +}% +\long\def\pgfplotstableread@impl@@listener#1#2listener#3{% + \pgfplots@tableread@to@listenertrue + \pgfplotstableread@impl@{#1}{#2}{#3}% + \pgfplots@tableread@to@listenerfalse +}% + +\newif\ifpgfplotstableread@inline +\long\def\pgfplotstableread@checkinlineformat@CRCR#1\\#2\pgfplotstable@EOI{% + \def\pgfplotstable@loc@TMPa{#2}% + \ifx\pgfplotstable@loc@TMPa\pgfutil@empty + \pgfplotstableread@inlinefalse + \else + \pgfplotstableread@inlinetrue + \let\pgfplotstableread@loop@next=\pgfplotstableread@loop@next@CRCR + \fi +}% +\long\def\pgfplotstableread@loop@next@CRCR#1\\{% + \long\def\pgfplotstable@LINE{#1}% + \pgfplotstableread@loop@processnextline + \pgfplotstableread@loop@over@lines +}% +\begingroup +\catcode`\^^M=12\relax% +\long\gdef\pgfplotstableread@checkinlineformat@NL@#1^^M#2\pgfplotstable@EOI{% + \def\pgfplotstable@loc@TMPa{#2}% + \ifx\pgfplotstable@loc@TMPa\pgfutil@empty% + \pgfplotstableread@inlinefalse% + \else% + \pgfplotstableread@inlinetrue% + \let\pgfplotstableread@loop@next=\pgfplotstableread@loop@next@NL% + \fi% +}% +\long\gdef\pgfplotstableread@checkinlineformat@NL#1{% + \pgfplotstableread@checkinlineformat@NL@ #1^^M\pgfplotstable@EOI% +}% +\long\gdef\pgfplotstableread@loop@next@NL#1^^M{% + \long\def\pgfplotstable@LINE{#1}% + \pgfplotstableread@loop@processnextline% + \pgfplotstableread@loop@over@lines% +}% +\endgroup + +% #1: options. +% #2: the table content (file name or inline data) +% #3: the result macro. +\long\def\pgfplotstableread@impl@#1#2#3{% + \ifcase\pgfplotstableread@FORMAT@CASE\relax + % format=auto + \ifcase\pgfplotstableread@ROWSEP@CASE\relax + % row sep=newline + \pgfplotstableread@checkinlineformat@NL{#2}% + \or + % row sep=crcr + \pgfplotstableread@checkinlineformat@CRCR #2\\\pgfplotstable@EOI + \fi + \or + % format=inline + \pgfplotstableread@inlinetrue + \ifcase\pgfplotstableread@ROWSEP@CASE\relax + % row sep=newline + \let\pgfplotstableread@loop@next=\pgfplotstableread@loop@next@NL + \or + % row sep=crcr + \let\pgfplotstableread@loop@next=\pgfplotstableread@loop@next@CRCR + \fi + \or + \pgfplotstableread@inlinefalse + \fi + % + \ifpgfplotstableread@inline + \def\pgfplotstableread@impl@fCLOSE{}% + \let\pgfplotstableread@loop@over@lines=\pgfplotstableread@loop@over@lines@frominline% + \long\def\pgfplotstableread@start@loop{% + \pgfplotstableread@loop@over@lines #2\pgfplotstable@EOI + }% + \def\pgfplotstableread@ready{1}% + \def\pgfplotstableread@filename{<inline_table>}% + \else + \def\pgfplotstableread@ready{1}% + \def\pgfplotstableread@filename{#2}% + \pgfplotstableread@openfile + \def\pgfplotstableread@impl@fCLOSE{% + \closein\r@pgfplots@reada + }% + \let\pgfplotstableread@loop@over@lines=\pgfplotstableread@loop@over@lines@fromfile% + \def\pgfplotstableread@start@loop{\pgfplotstableread@loop@over@lines}% + \pgfplotstableinstallignorechars + \fi + \edef\pgfplotstableread@oldendlinechar{\the\endlinechar}% + \endlinechar=-1 % do not append a white space after each line for file input +%\pgfplots@message{ATTEMPTING TO READ \pgfplotstableread@filename}% + % + \def\pgfplots@loc@TMPa{\pgfplotstableread@impl@prepare{#1}}% + \expandafter\pgfplots@loc@TMPa\expandafter{\pgfplotstableread@filename}{#3}% + % + \if1\pgfplotstableread@ready + \pgfplotstableread@start@loop + % + \pgfplotstableread@impl@fCLOSE% + % + \pgfplotstableread@finish + % + \fi + \endlinechar=\pgfplotstableread@oldendlinechar + \pgfplotsscanlinelengthcleanup + \expandafter\pgfplotstable@copy@to@globalbuffers@simple\expandafter{\pgfplotstableread@filename}% + \endgroup@@pgfplotstableread + \ifpgfplots@tableread@to@listener + % there are no data structures in this case. + \let\pgfplotsscanlinelength=\pgfplotstable@glob@buf@scanline + \else + % Now, we can access the global variables! + % copy them to #3. + \pgfplotstable@copy@globalbuffers@to#3% + \fi +} + +{\catcode`\"=12 \gdef\pgfplots@dquote{"}} + +% Opens \pgfplotstableread@filename. +\def\pgfplotstableread@openfile{% + \def\pgfplotstable@loc@TMPa{\pgfutil@in@{ }}% + \expandafter\pgfplotstable@loc@TMPa\expandafter{\pgfplotstableread@filename}% + \ifpgfutil@in@ + \t@pgfplots@toka=\expandafter{\pgfplotstableread@filename}% + \edef\pgfplotstableread@filename{\pgfplots@dquote\the\t@pgfplots@toka\pgfplots@dquote}% + \fi + \let\pgfplotstableread@old@crcr=\\% + \def\\{\string\\}% just to make sure we don't try to open inline table data... + \openin\r@pgfplots@reada=\pgfplotstableread@filename.tex + \ifeof\r@pgfplots@reada + \openin\r@pgfplots@reada=\pgfplotstableread@filename\relax + \else + \pgfplots@warning{% + You requested to open table '\pgfplotstableread@filename', but there is also a '\pgfplotstableread@filename.tex'. + TeX will automatically append the suffix '.tex', so I will now open '\pgfplotstableread@filename.tex'. + Please make sure you don't accidentally load TeX files - this may produce unrecoverable errors.}% + \closein\r@pgfplots@reada + \openin\r@pgfplots@reada=\pgfplotstableread@filename\relax + \fi + % + \ifeof\r@pgfplots@reada + \pgfplotsthrow{no such table file}{\pgfplots@loc@TMPa}{\pgfplotstableread@filename}{Could not read table file '\pgfplotstableread@filename'. In case you intended to provide inline data: maybe TeX screwed up your end-of-lines? Try `row sep=crcr' and terminate your lines with `\string\\' (refer to the pgfplotstable manual for details)}\pgfeov% + \global\let\pgfplotstable@colnames@glob=\pgfplots@loc@TMPa + \def\pgfplotstableread@ready{0}% + \fi + \pgfplots@logfileopen{\pgfplotstableread@filename}% + \let\\=\pgfplotstableread@old@crcr +} + +\def\pgfplotstableinstallignorechars{% + \ifx\pgfplotstableuninstallignorechars\pgfutil@empty + \pgfkeysgetvalue{/pgfplots/table/ignore chars}\pgfplotstable@loc@TMPa + \ifx\pgfplotstable@loc@TMPa\pgfutil@empty + \else + \pgfplotstableinstallignorechars@\pgfplotstable@loc@TMPa{9}% + \fi + \pgfkeysgetvalue{/pgfplots/table/white space chars}\pgfplotstable@loc@TMPa + \ifx\pgfplotstable@loc@TMPa\pgfutil@empty + \else + \pgfplotstableinstallignorechars@\pgfplotstable@loc@TMPa{10}% + \fi + \ifx\pgfplotstableuninstallignorechars\pgfutil@empty + \else + \expandafter\def\expandafter\pgfplotstableuninstallignorechars\expandafter{% + \pgfplotstableuninstallignorechars + \let\pgfplotstableuninstallignorechars=\pgfutil@empty + }% + \fi + \fi +}% +\let\pgfplotstableuninstallignorechars\pgfutil@empty% +% #1 macro containing the characters as comma-separated list +% #2 the catcode to assign +\def\pgfplotstableinstallignorechars@#1#2{% + \expandafter\pgfplotsutilforeachcommasep\expandafter{#1}\as\pgfplotstable@loc@TMPa{% + \t@pgfplots@toka=\expandafter{\pgfplotstableuninstallignorechars}% + \edef\pgfplotstableuninstallignorechars{% + \the\t@pgfplots@toka + \noexpand\catcode`\expandafter\noexpand\pgfplotstable@loc@TMPa=\expandafter\the\expandafter\catcode\expandafter`\pgfplotstable@loc@TMPa\noexpand\space + }% + \expandafter\catcode\expandafter`\pgfplotstable@loc@TMPa=#2\relax + }% +}% + +% #1: any options to set (respect \ifpgfplots@table@options@areset ) +% #2: the file name (if any) +% #3: the output macro (or listener) +\def\pgfplotstableread@impl@prepare#1#2#3{% + \ifpgfplots@table@options@areset + \else + \pgfplotstableset@every@table{#2}{#1}% + \fi + % + % local counter definitions: + \ifpgfplots@tableread@use@begingroup + \let\pgfplotstableread@lineno=\c@pgf@counta + \let\pgfplotstableread@numcols=\c@pgf@countb + \let\pgfplotstableread@curcol=\c@pgf@countc + \let\pgfplotstableread@usablelineno=\c@pgf@countd + \def\thepgfplotstableread@lineno{\the\pgfplotstableread@lineno}% + \def\thepgfplotstableread@usablelineno{\the\pgfplotstableread@usablelineno}% + \def\thepgfplotstableread@curcol{\the\pgfplotstableread@curcol}% + \def\thepgfplotstableread@numcols{\the\pgfplotstableread@numcols}% + \def\pgfplotstableread@countreset##1{##1=0 }% + \def\pgfplotstableread@countset##1##2{##1=##2\relax}% + \def\pgfplotstableread@countadvance##1{\advance##1 by1 }% + \else + % don't re-use integers! We have no protecting scopes! + \def\thepgfplotstableread@lineno{\pgfplotstableread@lineno}% + \def\thepgfplotstableread@usablelineno{\pgfplotstableread@usablelineno}% + \def\thepgfplotstableread@curcol{\pgfplotstableread@curcol}% + \def\thepgfplotstableread@numcols{\pgfplotstableread@numcols}% + \def\pgfplotstableread@countreset##1{\def##1{0}}% + \def\pgfplotstableread@countset##1##2{\def##1{##2}}% + \def\pgfplotstableread@countadvance##1{\pgfplotsutil@advancestringcounter{##1}}% + \fi + \pgfplotstableread@countreset\pgfplotstableread@lineno + \pgfplotstableread@countreset\pgfplotstableread@usablelineno + \pgfplotstableread@countreset\pgfplotstableread@numcols + \pgfplotstableread@countreset\pgfplotstableread@curcol + % + \pgfplotstableread@impl@prepare@DO + \def\pgfplotstableread@isgnuplotformat{0}% + \global\pgfplotslistnewempty\pgfplotstable@colnames@glob + \pgfplotsscanlinelengthinitzero + \ifpgfplots@tableread@to@listener + \def\pgfplotstablerow{\thepgfplotstableread@usablelineno}% + \def\pgfplotstablelineno{\thepgfplotstableread@lineno}% + \let\pgfplotstable@listener=#3% + \let\pgfplotstableread@impl@nextrow@NEXT=\pgfplotstableread@impl@nextrow@NEXT@listener + \let\pgfplotstablereadgetcolindex=\pgfplotstablereadgetcolindex@ + \let\pgfplotstablereadgetcolname=\pgfplotstablereadgetcolname@ + \let\pgfplotstablereadgetptrtocolname=\pgfplotstablereadgetptrtocolname@ + \let\pgfplotstablereadgetptrtocolindex=\pgfplotstablereadgetptrtocolindex@ + \let\pgfplotstablereadevalptr=\pgfplotstablereadevalptr@ + \let\pgfplotstablereadvalueofptr=\pgfplotstablereadvalueofptr@ + \let\pgfplotstableforeachcolumn=\pgfplotstableforeachcolumn@listener + \let\pgfplotstablereadvalueofcolname=\pgfplotstablereadvalueofcolname@ + \let\pgfplotstablereadvalueofcolindex=\pgfplotstablereadvalueofcolindex@ + \let\getthisrow=\pgfplotstablereadgetcolname + \let\thisrow=\pgfplotstablereadvalueofcolname + \let\thisrowno=\pgfplotstablereadvalueofcolindex + \let\getthisrowno=\pgfplotstablereadgetcolindex + \fi +}% + +% Copies the table column list and the column vectors of #1 to global buffers. +% @see \pgfplotstable@copy@globalbuffers@to +% +% Use these two methods to avoid scoping problems. +% +% #1: the <\macro> name of the table which is to be copied to global buffers. +% #2: the table file name. +\def\pgfplotstable@copy@to@globalbuffers#1#2{% + \global\let\pgfplotstable@colnames@glob=#1\relax + \c@pgfplotstable@counta=0\relax% + \pgfplotslistforeachungrouped\pgfplotstable@colnames@glob\as\pgfplotstable@loc@TMPa{% + \def\pgfplotstable@loc@TMPb{% + \expandafter\global\expandafter\let\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname% + }% + \expandafter\pgfplotstable@loc@TMPb\csname\string#1@\pgfplotstable@loc@TMPa\endcsname + \advance\c@pgfplotstable@counta by1\relax + }% + \pgfplotstable@copy@to@globalbuffers@simple{#2}% +}% +% A variant of \pgfplotstable@copy@to@globalbuffers which copies only +% the member variables of a loaded table (the name and scanline length) to +% global buffers. +% +% #1: the table's file name. +% +% @PRECONDITION: any other variables and cell data of the table are already stored +% in global buffers. +\def\pgfplotstable@copy@to@globalbuffers@simple#1{% + \gdef\pgfplotstable@glob@buf@name{#1}% + \global\let\pgfplotstable@glob@buf@scanline=\pgfplotsscanlinelength +}% + +% copies the global column list and the global column vectors to #1 +% (NOT the table file name). +% @see \pgfplotstable@copy@to@globalbuffers +% +% @PRECONDITION the global buffers contain all members of a table. +% +% @POSTCONDITION The table '#1' is be initialised to these members. +% Furthermore, \pgfplotsscanlinelength is set. +\def\pgfplotstable@copy@globalbuffers@to#1{% + \let#1=\pgfplotstable@colnames@glob + \c@pgfplotstable@counta=0\relax% + \pgfplotslistforeachungrouped\pgfplotstable@colnames@glob\as\pgfplotstable@loc@TMPa{% + \def\pgfplotstable@loc@TMPb{% + \expandafter\let\csname\string#1@\pgfplotstable@loc@TMPa\endcsname}% + \expandafter\pgfplotstable@loc@TMPb\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname +%\message{Column '\pgfplotstable@loc@TMPa' has entries: \expandafter\meaning\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname}% + \expandafter\global\expandafter\let\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname=\pgfutil@empty + \advance\c@pgfplotstable@counta by1\relax + }% + \global\let\pgfplotstable@colnames@glob=\pgfutil@empty + \expandafter\let\csname\string#1@@table@scanline\endcsname=\pgfplotstable@glob@buf@scanline + \expandafter\let\csname\string#1@@table@name\endcsname=\pgfplotstable@glob@buf@name + \let\pgfplotsscanlinelength=\pgfplotstable@glob@buf@scanline +}% + +\def\pgfplotstableread@finish{% + \pgfplotsscanlinecomplete + \ifpgfplots@tableread@to@listener + \else + \ifpgfplotstableread@foundcolnames + \else + \pgfplotstableread@create@column@names@with@numbers + \fi + \pgfplotstableread@countreset\pgfplotstableread@curcol% + \pgfutil@loop + \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols\relax + \expandafter\pgfplotsapplistXflushbuffers\csname pgfp@numtable@glob@col@\thepgfplotstableread@curcol\endcsname + \pgfplotstableread@countadvance\pgfplotstableread@curcol + \pgfutil@repeat + \fi +} + +\def\pgfplotstableread@loop@over@lines@fromfile{% + \ifeof\r@pgfplots@reada +%\pgfplots@message{EOF}% + \else + \read\r@pgfplots@reada to\pgfplotstable@LINE + \ifeof\r@pgfplots@reada + \else + \pgfplotstableread@loop@processnextline + \fi + \expandafter\pgfplotstableread@loop@over@lines + \fi +}% +\def\pgfplotstableread@loop@over@lines@frominline{% + \pgfutil@ifnextchar\pgfplotstable@EOI{% + \pgfutil@gobble + }{% + \pgfplotstableread@loop@next + }% +}% + +% PRECONDITION: +% \pgfplotstable@LINE contains the current input line. +\def\pgfplotstableread@loop@processnextline{% + \expandafter\pgfplotstableread@checkspecial@line\pgfplotstable@LINE\pgfplotstable@EOI + \ifpgfplotstableread@skipline + \def\pgfplotstableread@gnuplotcheck{####x y type}% + \ifx\pgfplotstableread@gnuplotcheck\pgfplotstable@LINE + \def\pgfplotstableread@isgnuplotformat{1}% + \fi + \def\pgfplotstableread@gnuplotcheck{####x y z type}% + \ifx\pgfplotstableread@gnuplotcheck\pgfplotstable@LINE + \def\pgfplotstableread@isgnuplotformat{1}% + \fi + \else + %-------------------------------------------------- + % \ifnum\pgfplotstableread@lineno=0 + % \let\pgfplotstable@firstline=\pgfplotstable@LINE + % \fi + %-------------------------------------------------- +%\pgfplots@message{READING LINE \thepgfplotstableread@lineno: '\meaning\pgfplotstable@LINE'.}% + \pgfplotstableread@curline@contains@colnamesfalse + \ifnum\pgfplotstableread@numcols=0\relax + % STEP 0: initialise + % - count columns + % - find header data + \pgfplotstableread@countreset\pgfplotstableread@curcol + \ifpgfplotstable@firstline@is@header + \pgfplotstableread@curline@contains@colnamestrue + \fi + \pgfplotstableread@impl@DO\pgfplotstableread@impl@countcols@and@identifynames@NEXT\pgfplotstable@LINE + \pgfplotstableread@countset\pgfplotstableread@numcols{\pgfplotstableread@curcol}% + \pgfplotstableread@countreset\pgfplotstableread@curcol + % Create empty column lists: + \pgfplotstableread@create@column@lists + % + \ifnum\pgfplotstableread@usablelineno=0\relax + \if1\pgfplotstableread@isgnuplotformat% + % The file started with + % #... + % #x y type + % X Y i + % -> thats a gnuplot file! + \pgfplotstableread@curline@contains@colnamesfalse + \fi + \fi + % Now, read the first line. + % It contains either + % - column names, + % - numerical data, + % - nothing (comments). + \ifpgfplotstableread@curline@contains@colnames + \pgfplotstableread@foundcolnamestrue + \pgfplotstableread@countreset\pgfplotstableread@curcol + \pgfplotstableread@impl@DO\pgfplotstableread@impl@collectcolnames@NEXT\pgfplotstable@LINE + \else + \pgfplotsscanlinelengthincrease + \pgfplotstableread@foundcolnamesfalse + \pgfplotstableread@countreset\pgfplotstableread@curcol + % Leave column name lists empty... + \pgfplotstableread@impl@DO\pgfplotstableread@impl@nextrow@NEXT\pgfplotstable@LINE + \fi +%\pgfplots@message{After reading first row: found '\thepgfplotstableread@numcols' columns; column name list='\meaning\pgfplotstable@colnames@glob'}% + \else + \pgfplotsscanlinelengthincrease + \pgfplotstableread@countreset\pgfplotstableread@curcol + \pgfplotstableread@impl@DO\pgfplotstableread@impl@nextrow@NEXT\pgfplotstable@LINE + \fi + \ifnum\pgfplotstableread@curcol=\pgfplotstableread@numcols\relax + \else + \pgfplotstable@error{input table '\pgfplotstableread@filename' has an unbalanced number of columns in row '\thepgfplotstableread@lineno' (expected '\thepgfplotstableread@numcols' cols; got '\thepgfplotstableread@curcol'). Maybe the input table is corrupted? If you need unbalanced data, consider using 'nan' in empty cells (perhaps combined with 'unbounded coords=jump')}% + \fi + \ifpgfplots@tableread@to@listener + \ifpgfplotstableread@curline@contains@colnames + \else + % report row! + \pgfplotstable@listener + \fi + \fi + \pgfplotstableread@countadvance\pgfplotstableread@usablelineno + \fi + \pgfplotstableread@countadvance\pgfplotstableread@lineno +}% + +% WARNING: this routine is also used in pgfplots.code.tex ... +\def\pgfplotstableread@checkspecial@line{% + \pgfutil@ifnextchar##{% + \pgfplotstableread@skiplinetrue + \pgfplotstableread@impl@gobble + }{% + \pgfutil@ifnextchar${% + \pgfplotstableread@process@flags@line + }{% + \pgfutil@ifnextchar\pgfplotstable@EOI{% + \pgfplotstableread@skiplinetrue + \pgfplotsscanlinecomplete% the line is empty; same as \par! + \pgfplotstableread@impl@gobble + }{% + \pgfutil@ifnextchar\par{% + \pgfplotstableread@skiplinetrue + \pgfplotsscanlinecomplete + \pgfplotstableread@impl@gobble + }{% + \pgfplotstableread@skiplinefalse + \pgfplotstableread@impl@gobble + }% + }% + }% + }% +} + +\long\def\pgfplotstableread@process@flags@line$flags {% +%\pgfplots@message{Ignoring flags line ...}% + \pgfplotstableread@skiplinetrue + \pgfplotstableread@impl@gobble +} + +\def\pgfplotstableread@create@column@lists{% + \pgfutil@loop + \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols\relax + \def\pgfplots@loc@TMPa{\pgfplotsapplistXnewempty[to global]}% + \expandafter\pgfplots@loc@TMPa\csname pgfp@numtable@glob@col@\thepgfplotstableread@curcol\endcsname + \pgfplotstableread@countadvance\pgfplotstableread@curcol + \pgfutil@repeat +} + +\def\pgfplotstableread@create@column@names@with@numbers{% + \pgfplotstableread@countreset\pgfplotstableread@curcol + \pgfutil@loop + \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols\relax + \edef\pgfplotstable@loc@TMPb{\thepgfplotstableread@curcol}% + \expandafter\pgfplotslistpushbackglobal\pgfplotstable@loc@TMPb\to\pgfplotstable@colnames@glob + \pgfplotstableread@countadvance\pgfplotstableread@curcol + \pgfutil@repeat +} + +\long\def\pgfplotstableread@impl@gobble#1\pgfplotstable@EOI{}% + +\def\pgfplotstable@EOI{\pgfplotstable@EOI}% + +% A loop command which processes every single entry in a raw data row #2 +% and invokes the macro #1{<arg>} for each found column entry. +% +% Columns are separated by the /pgfplots/table/col sep character. +% +% #1: a command which takes precisely one argument. It will be called +% for each found column entry +% +% #2: a macro containing a raw data line with <col sep> separated +% entries. +\long\def\pgfplotstableread@impl@DO#1#2{% + \ifpgfplotstable@trimcells + \def\pgfplotstableread@impl@ITERATE@NEXT@##1{% + \pgfkeys@spdef\pgfplotstableread@impl@ITERATE@NEXT@@@{##1}% + \expandafter#1\expandafter{\pgfplotstableread@impl@ITERATE@NEXT@@@}% + }% + \else + \let\pgfplotstableread@impl@ITERATE@NEXT@=#1\relax + \fi + \expandafter\pgfplotstableread@impl@DO@\expandafter{#2}% +} +{% + \catcode`\ =10 + \catcode`\;=12 + \catcode`\:=12 + \gdef\pgfplotstableread@impl@prepare@DO{% + \ifcase\pgfplotstableread@COLSEP@CASE\relax + % col sep=space: + \catcode`\ =10 + \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1 \pgfplotstable@EOI}% + \or + % col sep=comma: + \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@COMMA + \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1,\pgfplotstable@EOI}% + \or + % col sep=semicolon: + \catcode`\;=12 + \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@SEMICOLON + \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1;\pgfplotstable@EOI}% + \or + % col sep=colon: + \catcode`\:=12 + \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@COLON + \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1:\pgfplotstable@EOI}% + \or + % col sep=brace: + % allow multi line cells: + \endlinechar=\pgfplotstableread@oldendlinechar\relax + \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@BRACE + \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1\pgfplotstable@EOI}% + \or + % col sep=tab: + \catcode`\^^I=12 + \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@TAB + \long\edef\pgfplotstableread@impl@DO@##1{\noexpand\pgfplotstableread@impl@ITERATE##1\pgfplotstableread@tab\noexpand\pgfplotstable@EOI}% + \or + % col sep=&: + \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@AMPERSAND + \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1&\pgfplotstable@EOI}% + \fi + }% +}% +\long\def\pgfplotstableread@impl@ITERATE{% + \pgfutil@ifnextchar\pgfplotstable@EOI{% + \pgfplotstableread@impl@gobble + }{% + \pgfplotstableread@impl@ITERATE@NEXT + }% +}% +\long\def\pgfplotstableread@impl@ITERATE@NEXT#1 {% + \pgfplotstableread@impl@ITERATE@NEXT@{#1}% + \pgfplotstableread@impl@ITERATE +}% +\long\def\pgfplotstableread@impl@ITERATE@NEXT@COMMA#1,{% + \pgfplotstableread@impl@ITERATE@NEXT@{#1}% + \pgfplotstableread@impl@ITERATE +}% +\long\def\pgfplotstableread@impl@ITERATE@NEXT@SEMICOLON#1;{% + \pgfplotstableread@impl@ITERATE@NEXT@{#1}% + \pgfplotstableread@impl@ITERATE +}% +\long\def\pgfplotstableread@impl@ITERATE@NEXT@COLON#1:{% + \pgfplotstableread@impl@ITERATE@NEXT@{#1}% + \pgfplotstableread@impl@ITERATE +}% +\long\def\pgfplotstableread@impl@ITERATE@NEXT@BRACE#1{% + \pgfplotstableread@impl@ITERATE@NEXT@{#1}% + \pgfplotstableread@impl@ITERATE +}% +\long\def\pgfplotstableread@impl@ITERATE@NEXT@AMPERSAND#1&{% + \pgfplotstableread@impl@ITERATE@NEXT@{#1}% + \pgfplotstableread@impl@ITERATE +}% +\begingroup +\catcode`\^^I=12 +\gdef\pgfplotstableread@tab{^^I}% +\long\gdef\pgfplotstableread@impl@ITERATE@NEXT@TAB#1^^I{% the following white spaces are SPACES, not tabs: + \pgfplotstableread@impl@ITERATE@NEXT@{#1}% + \pgfplotstableread@impl@ITERATE +}% +\endgroup +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% these values are only usable for a read-listener, that means: +% when using +% +% \pgfplotstableread{<file>} to listener<\macro> +% +% -> <\macro> can than use the methods +% +% \pgfplotstablereadgetcolindex{<index>}{<\content>} +% performs \let\content=<content of column no <index> > +\def\pgfplotstablereadgetcolindex@#1#2{% + \pgfutil@ifundefined{pgfplotstblread@colcontent@no#1}{% + \pgfplotsthrow{no such element}{#2}{Sorry, the requested column number '#1' in table '\pgfplotstableread@filename' does not exist!? Please verify you used the correct index 0 <= i < N.}\pgfeov% + }{% + \expandafter\let\expandafter#2\csname pgfplotstblread@colcontent@no#1\endcsname + }% +}% + +\pgfkeysdef{/pgfplots/table/@undefined column text}{#1__column_not_found.}% +\def\pgfplotstable@undefinedtext#1{\pgfkeysvalueof{/pgfplots/table/@undefined column text/.@cmd}#1\pgfeov}% + +% As \pgfplotstablereadgetcolindex, but +% \pgfplotstablereadvalueofcolindex{<index>} +% directly expands to the value stored in the desired column. +% +% Example: +% \pgfplotstablereadvalueofcolindex{3} -> expands to '42' if '42' is +% written in column no 3. +% +% Column indexing starts at 0. +% +% @ATTENTION: since such a command may occur within an \edef or an +% \csname, it can't perform sanity checking. Proving an invalid index +% expands to \pgfkeysvalueof{/pgfplots/table/@undefined column text}. +\def\pgfplotstablereadvalueofcolindex@#1{% + \pgfutil@ifundefined{pgfplotstblread@colcontent@no#1}{% + \pgfplotstable@undefinedtext{colindex#1}% + }{% + \csname pgfplotstblread@colcontent@no#1\endcsname + }% +} + +% \pgfplotstablereadgetcolname{<name>}{<\content>} +% performs \let\content=<content of column named <name> > +\def\pgfplotstablereadgetcolname@#1#2{% + \pgfplotstablereadgetptrtocolname{#1}{\pgfplots@loc@TMPa}% + \pgfplotstablereadevalptr\pgfplots@loc@TMPa{#2}% +}% + +% This here is the implementation of \pgfplotstablereadvalueofcolname +% (and \thisrow{<colname>}) for use inside of the 'read to listener' +% framework. +% +% Like \pgfplotstablereadgetcolname, but this one expands directly to +% the value of the desired column. +% +% #1: a column name or a column alias. +% +% @ATTENTION: since such a command may occur within an \edef or an +% \csname, it can't perform sanity checking. Proving an invalid index +% expands to \pgfkeysvalueof{/pgfplots/table/@undefined column text}. +\def\pgfplotstablereadvalueofcolname@#1{% + \pgfplotstable@thisrow@impl{#1}{pgfplotstblread@colindex@for@name}{\pgfplotstable@thisrow@impl@read}% +}% +\def\pgfplotstable@thisrow@impl@read#1{\csname pgfplotstblread@colcontent@no#1\endcsname}% + +% This implements \thisrow in different contexts. +% +% Usage: +% \def\thisrow#1{\pgfplotstable@thisrow@impl{#1}{macroprefix@}{\pgfplotstable@thisrow@impl@}} +% +% Then, \thisrow{existingcol} +% will expand to +% -> \pgfplotstable@thisrow@impl@{\csname macroprefix@existingcol\endcsname} +% -> \csname macroprefix@existingcol\endcsname +% +% Furthermore, if '#1' is no existing col and there exists /pgfplots/table/alias/#1, +% \thisrow{aliased} +% will expand to +% -> \pgfplotstable@thisrow@impl@{\csname macroprefix@\pgfkeysvalueof{/pgfplots/table/alias/aliased}\endcsname} +% -> \csname macroprefix@\pgfkeysvalueof{/pgfplots/table/alias/aliased}\endcsname +% +% #1: the argument for \thisrow{#1} +% #2: a macro prefix such that \csname #2<colname>\endcsname contains +% the value of the current row for (physical) column <colname> +% #3: the name of a one-argument-macro which will get \csname #2<colname>\endcsname +% as argument. This is the last step of \thisrow. It allows indirect +% access by translating colnames to col indices in '\pgfplotstableread to listener' +\def\pgfplotstable@thisrow@impl#1#2#3{% + \pgfutil@ifundefined{#2#1}% + {% + % WARNING : this code has been REPLICATED in + % *** \pgfplotstablereadgetptrtocolname *** + % *** \pgfplotstablegetcolumnbyname *** + % *** \pgfplotstableresolvecolname *** + % *** \pgfplotstablereadvalueofcolname *** + \pgfkeysifdefined{/pgfplots/table/alias/#1}{% + \pgfutil@ifundefined{#2\pgfkeysvalueof{/pgfplots/table/alias/#1}}{% + \pgfplotstable@undefinedtext{\pgfkeysvalueof{/pgfplots/table/alias/#1}}% + }{% + #3{\csname #2\pgfkeysvalueof{/pgfplots/table/alias/#1}\endcsname}% + }% + }{% + \pgfplotstable@undefinedtext{#1}% + }% + }% + {% + #3{\csname #2#1\endcsname}% + }% +}% +\def\pgfplotstable@thisrow@impl@#1{#1}% + +% \pgfplotstablereadgetptrtocolname{<name>}{\ptr} +% Creates some sort of "pointer" to the column named <name>. This +% pointer can than be used every time a new line has been reported to +% the listener. It works like this: +% +% \let\ptr=\pgfutil@empty +% \def\macro{% +% \ifx\ptr\empty +% \pgfplotstablereadgetptrtocolname{<my col>}{\ptr}% +% \fi +% \pgfplotstablereadevalptr{\ptr}{\content}% +% -> do something with \content! +% } +% +% \pgfplotstableread{<file>} to listener<\macro> +% +% -> will evaluate \macro foreach row. +% +% The advantage of such a prepared pointer over \thisrow{#1} or +% \getthisrow{#1} is simply efficiency and sanity checking: the checks +% are done at the time of pointer creation, dereferencing the pointer +% is fast. +\def\pgfplotstablereadgetptrtocolname@#1#2{% + \def#2{0}% + \pgfplotstable@getcol{#1}\of{\pgfplotstableread@filename}\to{#2}\getcolmethod{getptr}% +}% + +% As \pgfplotstablereadgetptrtocolname, but this here access columns +% by index. +\def\pgfplotstablereadgetptrtocolindex@#1#2{\def#2{#1}}% + +% \pgfplotstablereadevalptr{<\ptr>}{<\content} +% writes the current value of <\ptr> to <\content>. The pointer <\ptr> +% must be initialised with \pgfplotstablereadgetptrtocolname +\let\pgfplotstablereadevalptr@=\pgfplotstablereadgetcolindex@ + +% \pgfplotstablereadvalueofptr{<\ptr>} -> expands to the pointers value. +% +% The pointer \ptr must be initialised with +% \pgfplotstablereadgetptrtocolname. +\let\pgfplotstablereadvalueofptr@=\pgfplotstablereadvalueofcolindex@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\long\def\pgfplotstableread@impl@nextrow@NEXT@listener#1{% + \expandafter\def\csname pgfplotstblread@colcontent@no\thepgfplotstableread@curcol\endcsname{#1}% + \pgfplotstableread@countadvance\pgfplotstableread@curcol +} + +\long\def\pgfplotstableread@impl@nextrow@NEXT#1{% +%\pgfplots@message{Inserting '#1' at (\thepgfplotstableread@lineno, \thepgfplotstableread@curcol).}% + \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols\relax + \pgfplotslist@assembleentry{#1}\into\t@pgfplots@tokc + \def\pgfplotstableread@TMP{\expandafter\pgfplotsapplistXpushback\expandafter{\the\t@pgfplots@tokc}\to}% + \expandafter\pgfplotstableread@TMP\csname pgfp@numtable@glob@col@\thepgfplotstableread@curcol\endcsname + \pgfplotstableread@countadvance\pgfplotstableread@curcol + \else + \begingroup + \t@pgfplots@tokc={#1}% + \pgfplotstable@error{Table '\pgfplotstableread@filename' has too much columns in line \thepgfplotstableread@lineno: Ignoring '\the\t@pgfplots@tokc'. Please verify that every cell entry is separated correctly (use braces {<cell entry>} if necessary). This error is not critical}% + \endgroup + \fi +} + + + +\long\def\pgfplotstableread@impl@collectcolnames@NEXT#1{% +%\pgfplots@message{Got column name no \thepgfplotstableread@curcol\ as '#1'}% + \pgfutil@ifundefined{pgfplotstableread@impl@COLNAME@#1}{% + \def\pgfplotstable@loc@TMPa{#1}% + }{% generate unique column names warning: + \pgfplots@warning{Table '\pgfplotstableread@filename' has non-unique column name '#1'. Only the first occurence can be accessed via column names.}% + \edef\pgfplotstable@loc@TMPa{#1--index\thepgfplotstableread@curcol}% + }% + \expandafter\def\csname pgfplotstableread@impl@COLNAME@#1\endcsname{foo}% remember this name. + \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplotstable@loc@TMPa}\to\pgfplotstable@colnames@glob + \ifpgfplots@tableread@to@listener + % create an associative container colindex -> colname + % for use in a listener. + \expandafter\edef\csname pgfplotstblread@colindex@for@name#1\endcsname{\thepgfplotstableread@curcol}% + \fi + \pgfplotstableread@countadvance\pgfplotstableread@curcol +} + + + + +\long\def\pgfplotstableread@impl@countcols@and@identifynames@NEXT#1{% + \pgfplotstableread@countadvance\pgfplotstableread@curcol + \ifpgfplotstable@search@header + \ifpgfplotstableread@curline@contains@colnames + \else + \pgfplotstableread@isnumber@ITERATE#1\pgfplotstable@EOI +%\ifpgfplotstableread@curline@contains@colnames\pgfplots@message{'#1' is a column name!}\else\pgfplots@message{'#1' is NO column name!}\fi + \fi + \fi +} +\def\pgfplotstableread@isnumber@plus{+} +\def\pgfplotstableread@isnumber@minus{-} +\def\pgfplotstableread@isnumber@zero{0} +\def\pgfplotstableread@isnumber@one{1} +\def\pgfplotstableread@isnumber@two{2} +\def\pgfplotstableread@isnumber@three{3} +\def\pgfplotstableread@isnumber@four{4} +\def\pgfplotstableread@isnumber@five{5} +\def\pgfplotstableread@isnumber@six{6} +\def\pgfplotstableread@isnumber@seven{7} +\def\pgfplotstableread@isnumber@eight{8} +\def\pgfplotstableread@isnumber@nine{9} +\def\pgfplotstableread@isnumber@e{e} +\def\pgfplotstableread@isnumber@E{E} +\def\pgfplotstableread@isnumber@period{.} + +\def\pgfplotstableread@isnumber@ITERATE#1{% + \def\pgfplotstableread@CURTOK{#1}% + \ifx\pgfplotstableread@CURTOK\pgfplotstable@EOI + \def\pgfplotstableread@NEXT{}% + \else + \def\pgfplotstableread@NEXT{\pgfplotstableread@isnumber@ITERATE}% + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@plus + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@minus + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@zero + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@one + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@two + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@three + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@four + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@five + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@six + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@seven + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@eight + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@nine + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@e + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@E + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@period + \else +%\message{NO ITS NOT! Token: '\meaning\pgfplotstableread@CURTOK'}% + % it's no number, so it is a column name. + \pgfplotstableread@curline@contains@colnamestrue + \def\pgfplotstableread@NEXT{\pgfplotstableread@impl@gobble}% + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi + \pgfplotstableread@NEXT +} + +\def\pgfplotstable@error#1{\pgfplotsthrow{unsupported operation}{#1}\pgfeov}% + + +\def\pgfplotstableset{% + \pgfqkeys{/pgfplots/table}% +}% + +% Accepts a macro #1 which contains an argument denoting a column +% name. +% +% It checks whether #1 starts with '[index]', indicating that it is actually +% a column INDEX. If that is the case, +% \ifpgfplotstableread@foundcolnames is set to false and the index is +% returned into #1. +% +% Otherwise, \ifpgfplotstableread@foundcolnames is set to true. +\def\pgfplotstable@is@colname#1{% + \expandafter\pgfplotstabletypeset@is@colname@#1\pgfplotstable@EOI + \ifpgfplotstableread@foundcolnames + \else + \let#1=\pgfplotstable@loc@TMPa + \fi +}% +\def\pgfplotstabletypeset@is@colname@{% + \pgfutil@ifnextchar[{% + \pgfplotstabletypeset@is@colname@index + }{% + \pgfplotstableread@foundcolnamestrue + \pgfplotstabletypeset@is@colname@name + }% +} +\def\pgfplotstabletypeset@is@colname@index@@{index}% +\def\pgfplotstabletypeset@is@colname@index[#1]#2\pgfplotstable@EOI{% + \def\pgfplotstable@loc@TMPa{#1}% + \ifx\pgfplotstable@loc@TMPa\pgfplotstabletypeset@is@colname@index@@ + \pgfplotstableread@foundcolnamesfalse + \edef\pgfplotstable@loc@TMPa{#2}% + \else + \pgfplotstableread@foundcolnamestrue + \fi +}% +\def\pgfplotstabletypeset@is@colname@name#1\pgfplotstable@EOI{}% + +% calls \pgfplotstableset{every table={#1}} where '#1' is the table +% file name. +% +% Note that 'every table' is usually set *AFTER* any other option. In +% other words: settings in 'every table' have higher precedence than +% those provided, for example, at +% \pgfplotstabletypeset[<options>]{...}. +% +% Why? Well, the <options> need to be set *before* the file name +% argument is read. After all, it might contain an inline table for +% which \catcodes need to be adjusted -- and <options> might explain +% how. +% +% REMARK: An early attempt to change the precendence for 'every table' +% was to set <options> again after 'every table'. But that is +% incompatible with, for example '/.add={}{}' key handlers. +% +% This macro does nothing if 'every table' is empty. +% +% #1: the table name (argument to 'every table') +% #2: The <options> which have already been set. +\long\def\pgfplotstableset@every@table#1#2{% + \pgfkeysgetvalue{/pgfplots/table/every table/.@cmd}\pgfplotstable@loc@TMPa + \ifx\pgfplotstable@loc@TMPa\pgfplots@empty@style@key + \else + \pgfplotstableset{/pgfplots/table/every table={#1}}%,#2}% + \fi +}% + +\def\pgfplotstabletypeset{% + \pgfutil@ifnextchar[{% + \pgfplotstabletypeset@opt + }{% + \pgfplotstabletypeset@opt[]% + }% +} +\long\def\pgfplotstabletypeset@opt[#1]#2{% + \pgfplotstable@error@pkg{Please load \string\usepackage{pgfplotstable} before using \string\pgfplotstabletypeset}% +} +\let\pgfplotstabletypesetfile=\pgfplotstabletypeset + +\def\pgfplotstablecreatecol{% + \pgfutil@ifnextchar[{% + \pgfplotstablecreatecol@opt + }{% + \pgfplotstablecreatecol@opt[]% + }% +}% +\def\pgfplotstablecreatecol@opt[#1]#2#3{% + \pgfplotstable@error@pkg{Please load \string\usepackage{pgfplotstable} before using \string\pgfplotstablecreatecol}% +}% + +% Iterates through every column of table '#1' and invokes the code +% '#3' for each column. The current column name will be available as +% '#2' and the current column index as |\pgfplotstablecol| (starting +% with 0). +% +% Example: +% \pgfplotstableforeachcolumn{\table}\as\colname{% +% The column name is `\colname'; its index \pgfplotstablecol.\par +% }% +% +% REMARK: this routine does NOT introduce TeX groups. +\long\def\pgfplotstableforeachcolumn#1\as#2#3{% + \def\pgfplotstablecol{0}% + \pgfplotslistforeachungrouped#1\as#2{% + #3\relax% + \pgfplotsutil@advancestringcounter\pgfplotstablecol + }% + \let\pgfplotstablecol=\relax +}% +% A variant of \pgfplotstableforeachcolumn which is used inside of +% \pgfplotstableread to listener. +% +% It is used as \pgfplotstableforeachcolumn\as\cur{<do something with \cur>} +\long\def\pgfplotstableforeachcolumn@listener\as#1#2{% + \def\pgfplotstablecol{0}% + \pgfplotslistforeachungrouped\pgfplotstable@colnames@glob\as#1{% + #2\relax% + \pgfplotsutil@advancestringcounter\pgfplotstablecol + }% + \let\pgfplotstablecol=\relax +}% + +% Reports every element t_{ij} for a fixed column j (in read-only +% mode). +% +% For every cell, the code '#4' will be executed where '#3' will +% contain the cell's value. During code '#4', the macro +% \pgfplotstablerow will contain the current row index. +% +% #1: either a column name or the string '[index]' followed by a +% number denoting a column index Access by column name is much faster.. +% #2: the table (macro or file name) +% #3: the macro in which the cell values shall be written +% #4: the code to execute. +% +% Example: +% \pgfplotstableforeachcolumnelement{colname}\of\table\as\cellelem{% +% I have now cell element `\cellelem' at row index +% `\pgfplotstablerow'. +% \par +% } +% +% REMARK: this routine does NOT introduce TeX groups. +\long\def\pgfplotstableforeachcolumnelement#1\of#2\as#3#4{% + \def\pgfplotstablerow{0}% + \pgfplotstablegetcolumn{#1}\of{#2}\to\pgfplotstableforeachcolumnelement@list + \pgfplotslistforeachungrouped\pgfplotstableforeachcolumnelement@list\as#3{% + % allow nesting by copying the old value of \pgfplotstablerow: + \expandafter\pgfplotstableforeachcolumnelement@\expandafter{\pgfplotstablerow}{#4}% + }% + \let\pgfplotstablerow=\relax +}% +% helper method to allow nesting. It copies \pgfplotstablerow. +% #1: the expanded value of \pgfplotstablerow. +\long\def\pgfplotstableforeachcolumnelement@#1#2{% + #2\relax + \def\pgfplotstablerow{#1}% restore to old value. + % advance. + \pgfplotsutil@advancestringcounter\pgfplotstablerow +}% + +% A routine which is similar to \pgfplotstableforeachcolumnelement, +% but this here checks for changes in \pgfplotsretval and writes them +% back into the respected cell. +% +% The runtime is quadratic in the number of rows. +\long\def\pgfplotstablemodifyeachcolumnelement#1\of#2\as#3#4{% + \def\pgfplotstablerow{0}% + % + % Step 0: get the REAL column name for '#1'. + % This needs modifications if '#1' is [index]<integer>. + % -> store the colname to \pgfplotstable@loc@TMPc: + \def\pgfplotstable@loc@TMPc{#1}% + \pgfplotstable@is@colname{\pgfplotstable@loc@TMPc}%% + \ifpgfplotstableread@foundcolnames + \else + \expandafter\pgfplotstablegetcolumnnamebyindex\pgfplotstable@loc@TMPc\of{#2}\to\pgfplotstable@loc@TMPc + \fi + % Step 0.1: prepare a command which re-assembles column '#1' + % (using the real column name). + % The re-assemblation command will be invoked at the end of each + % iteration. This complicated macro preparation allows nested + % calls to \pgfplotstablemodifyeachcolumnelement. + \t@pgfplots@toka={\expandafter\pgfplotslistpushback\expandafter{#3}\to}% + \edef\pgfplotstable@loc@TMPd{% + \the\t@pgfplots@toka{\expandafter\noexpand\csname\string#2@\pgfplotstable@loc@TMPc\endcsname}}% + % Step 1: copy the column data to \pgfplotstable@loc@TMPb + \expandafter\pgfplotstablegetcolumnbyname\pgfplotstable@loc@TMPc\of#2\to\pgfplotstable@loc@TMPb% + % + % clear the original column: + \expandafter\pgfplotslistnewempty\csname\string#2@\pgfplotstable@loc@TMPc\endcsname + % + % Call loop. The prepared re-assemble macro will be provided as macro argument + % to allow nested calls: + \expandafter\pgfplotstablemodifyeachcolumnelement@\expandafter{\pgfplotstable@loc@TMPd} + {\pgfplotstable@loc@TMPb}{#3}{#4}% + \let\pgfplotstablerow=\relax +}% +% #1: post-iteration code +% #2: the row list +% #3: the loop macro to assign +% #4: the loop body +\long\def\pgfplotstablemodifyeachcolumnelement@#1#2#3#4{% + \pgfplotslistforeachungrouped{#2}\as#3{% + % allow nesting by copying the old value of \pgfplotstablerow: + \expandafter\pgfplotstableforeachcolumnelement@\expandafter{\pgfplotstablerow}{#4}% + #1% + }% +} + +% Selects a single table element at row #1 and column #2 from table +% #3. +% +% #1: a row index. +% #2: a column name or the string '[index]' followed by a number +% denoting a column index. Access by column name is much faster. +% #3: the table (macro or file name). +% +% The cell value will be written into the macro \pgfplotsretval. +% +% REMARK: +% this routine is supposed to be very slow: it needs time O(N) where N +% is the number of rows. This may change in future versions. +% +% Example: +% \pgfplotstablegetelem{0}{[index]2}\of\table +% The elem is `\pgfplotsretval'. +\def\pgfplotstablegetelem#1#2\of#3{% + \begingroup + \pgfplotstablegetcolumn{#2}\of{#3}\to\pgfplotstable@loc@TMPa + \def\pgfplotsexceptionmsg{Sorry, row `#1' does not exist in table \pgfplotstablenameof{#3}}% + \pgfplotslistselect#1\of\pgfplotstable@loc@TMPa\to\pgfplotsretval + \pgfmath@smuggleone\pgfplotsretval + \endgroup +}% + +\def\pgfplotstablegetcolumnlist#1\to#2{\let#2=#1} + +% Defines \pgfmathresult (and now also \pgfplotsretval) to be the number of rows in table #1. +% +% #1 may be either a loaded table structure (a macro name) or a table +% file name. In the latter case, the file will be loaded temporarily. +\long\def\pgfplotstablegetrowsof#1{% + \pgfplotstable@isloadedtable{#1}{% + % ah - it is an already loaded table! + \begingroup + \pgfplotslistfront#1\to\pgfplotstablegetrows@@ + \expandafter\pgfplotslistsize\csname\string#1@\pgfplotstablegetrows@@\endcsname\to\c@pgfplotstable@counta + \edef\pgfmathresult{\the\c@pgfplotstable@counta}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + }{% + % ah - it is a file name. + \begingroup + \pgfplotstableread{#1}\pgfplotstablegetrows@ + \pgfplotstablegetrowsof{\pgfplotstablegetrows@}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + }% + \let\pgfplotsretval=\pgfmathresult +}% + +% Defines \pgfplotsretval to contain the number of columns in table +% #1. +% +% #1 may be either a loaded table structure (a macro name) or a table +% file name. In the latter case, the file will be loaded temporarily. +\long\def\pgfplotstablegetcolsof#1{% + \pgfplotstable@isloadedtable{#1}{% + % ah - it is an already loaded table! + \begingroup + \pgfplotslistsize#1\to\c@pgfplotstable@counta + \edef\pgfplotsretval{\the\c@pgfplotstable@counta}% + \pgfmath@smuggleone\pgfplotsretval + \endgroup + }{% + % ah - it is a file name. + \begingroup + \pgfplotstableread{#1}\pgfplots@table + \pgfplotstablegetcolsof{\pgfplots@table}% + \pgfmath@smuggleone\pgfplotsretval + \endgroup + }% + \let\pgfmathresult=\pgfplotsretval +} diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex index 6d1cb8a2ee1..180ca8ce195 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex @@ -1,4 +1,7 @@ +%\input pgfplotsoldpgfsupp_pgfmathparse.opt.code.tex +%\beginpgfmathparsecheckfornumber + \pgfutil@ifundefined{pgfmathlessthan@}{% \let\pgfmathlessthan@=\pgfmathless@ \let\pgfmathgreaterthan@=\pgfmathgreater@ @@ -13,8 +16,8 @@ % #1: for backwards compatibility % #2: for normal processing. \def\pgfplots@ifneedspgfcompabitibilitycode#1#2{% - %\pgfkeysifdefined{/handlers/.search also/.@cmd}{#2}{#1}% - \pgfutil@ifundefined{pgfkeysdefnargs}{#1}{#2}% + %\pgfkeysifdefined{/pgf/number format/sci precision/.@cmd}{#2}{#1}% + \pgfutil@ifundefined{tikzifinpicture}{#1}{#2}% }% \pgfplots@ifneedspgfcompabitibilitycode diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex index 178da4c3510..12d308255bd 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex @@ -12,6 +12,9 @@ \fi \let\pgfutil@inputcheck=\r@pgf@reada +\pgfutil@ifundefined{pgf@texdist@protect}{% + \def\pgf@texdist@protect{}% +}{} % from pgfutil-common.tex: @@ -241,6 +244,13 @@ \def\pgfutilensuremath#1{% \ifmmode#1\else$#1$\fi } +\def\tikzifinpicture#1#2{% + \pgfutil@ifundefined{filldraw}{#2}{#1}% +}% + +\def\tikz@fig@scan@name(#1){% + \pgfkeysvalueof{/tikz/name/.@cmd}#1\pgfeov% CF : this is now ALWAYS consistent with 'name=' option; allows overrides. + \tikz@@scan@fig}% \tikzoption{ybar}[]{\let\tikz@plot@handler=\pgfplothandlerybar} \tikzoption{xbar}[]{\let\tikz@plot@handler=\pgfplothandlerxbar} @@ -425,3 +435,10 @@ \fi } +% From pgfcorescopes.code.tex: +\def\pgfresetboundingbox{% + \global\pgf@picmaxx=-16000pt\relax% + \global\pgf@picminx=16000pt\relax% + \global\pgf@picmaxy=-16000pt\relax% + \global\pgf@picminy=16000pt\relax% +}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreexternal.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreexternal.code.tex index d9e6476398f..ee2c38fba38 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreexternal.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreexternal.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% @@ -27,15 +27,15 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreexternal.code.tex,v 1.1 2010/03/25 20:57:13 ludewich Exp $ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreexternal.code.tex,v 1.8 2010/07/10 20:51:57 ludewich Exp $ -\newif\ifpgfexternal@allow@aux +\newif\ifpgfexternal@aux@in@dpth \pgfkeys{ /pgf/images/include external/.code={\pgfimage{#1}}, - /pgf/images/aux in dpth/.is if=pgfexternal@allow@aux, + /pgf/images/aux in dpth/.is if=pgfexternal@aux@in@dpth, /pgf/images/aux in dpth/.default=true } @@ -103,14 +103,14 @@ \ifx\pgf@tempa\pgf@tempb% \else% \pgf@external@grabshipouttrue% - \pgfexternal@nofiles + \pgfexternal@nofiles% see also \pgf@external@init@aux@in@dpth \ifpgfexternalreadmainaux % and reset the jobname. This should allow to handle any % \label/\ref constructions which are stored in \jobname.aux (and % which won't be found otherwise) \gdef\jobname{#1}% \fi - \ifpgfexternal@allow@aux + \ifpgfexternal@aux@in@dpth \csname newwrite\endcsname\w@pgfexternal@auxout \fi \fi% @@ -136,20 +136,37 @@ \newif\ifpgf@external@grabshipout \newbox\pgfexternal@startupbox -\AtBeginDocument{% - \ifpgf@external@grabshipout% - \global\let\pgfexternal@originalshipout=\shipout% - \global\def\shipout{\setbox\pgfpic=}% - \maxdeadcycles=10000% - % Ok, gather everything we have seen up to now in a box. This box - % will contain any specials that have been used. - {% - \output{\global\setbox\pgfexternal@startupbox=\vbox{\csname @begindvi\endcsname\unvbox255}}% - \hbox{}\eject% - }% - \fi% +\pgfutil@ifundefined{AtBeginDocument}{}{% + \AtBeginDocument{% + \ifpgf@external@grabshipout% + \global\let\pgfexternal@originalshipout=\shipout% + \global\def\shipout{\setbox\pgfpic=}% + \maxdeadcycles=10000% + % Ok, gather everything we have seen up to now in a box. This box + % will contain any specials that have been used. + {% + \output{\global\setbox\pgfexternal@startupbox=\vbox{\csname @begindvi\endcsname\unvbox255}}% + \hbox{}\eject% + }% + \fi% + } +}% + +\pgfutil@ifundefined{AtEndDocument}{}{% + \AtEndDocument{% + \ifpgf@external@grabshipout + \pgfutil@ifundefined{pgfexternal@did@a@shipout}{% + \pgfexternal@error@no@shipout + }{}% + \fi + }% } +% This will be overwritten by the tikz external lib if it is loaded. +\def\pgfexternal@error@no@shipout{% + \PackageError{pgf}{Sorry, image externalization failed: the resulting image was EMPTY. I tried to externalize '\pgfactualjobname'. Perhaps there was a typo somewhere? Please check that your document contains '\string\beginpgfgraphicnamed{\pgfactualjobname} ... \string\endpgfgraphicnamed'}% +}% + % "Environment" for an external graphic. % @@ -210,21 +227,47 @@ % the first line (if any). \def\pgfincludeexternalgraphics#1{% \begingroup + \pgfexternalreaddpth{#1}% + \pgfkeysifdefined{/pgf/images/include external/#1/.@cmd}{% + \pgfkeysgetvalue{/pgf/images/include external/#1/.@cmd}\pgf@tempa + \pgfkeysgetlet{/pgf/images/include external/.@cmd}\pgf@tempa + }{}% \setbox1=\hbox{\pgfkeysvalueof{/pgf/images/include external/.@cmd}{#1}\pgfeov}% - % - \let\pgfincludeexternalgraphics@dp=\pgfutil@empty - \endlinechar=-1 % suppress white space at end - \catcode`\@=11 - \openin\r@pgf@reada=#1.dpth - \pgfincludeexternalgraphics@read@dpth - \ifx\pgfincludeexternalgraphics@dp\pgfutil@empty + \ifdim\pgfexternaltrimleft=0sp \else \kern\pgfexternaltrimleft\relax \fi + \ifdim\pgfexternaldepth=0pt \box1 \else - \dimen0=\pgfincludeexternalgraphics@dp\relax + \dimen0=\pgfexternaldepth\relax \hbox{\lower\dimen0 \box1 }% \fi + \ifdim\pgfexternaltrimright=0sp \else \kern\pgfexternaltrimright\relax \fi \endgroup } + +% Defines \pgfexternaldepth to be the depth of the external picture +% '#1' and \pgfexternaltrimleft / \pgfexternaltrimright to be the 'hbaseline' shift. +% +% +% Furthermore, it handles any auxiliary information stored in the +% .dpth file (it appends it to the main aux file). +% +\def\pgfexternalreaddpth#1{% + % no \begingroup. Handle that manually: + \edef\pgfexternalreaddpth@restore{% + \noexpand\endlinechar=\the\endlinechar\space + \noexpand\catcode`\noexpand\@=\the\catcode`\@\space + }% + % + \def\pgfexternaldepth{0sp}% + \def\pgfexternaltrimleft{0sp}% + \def\pgfexternaltrimright{0sp}% + \endlinechar=-1 % suppress white space at end + \catcode`\@=11 + \openin\r@pgf@reada=#1.dpth + \pgfincludeexternalgraphics@read@dpth + % + \pgfexternalreaddpth@restore +}% % % The .dpth consists of 0-N lines, where each is either a single % dimension (the box' depth) or something which belongs to the .aux @@ -241,32 +284,51 @@ \expandafter\pgfincludeexternalgraphics@read@dpth \fi }% + +\def\pgfexternal@restore#1{}% + \long\def\pgfincludeexternalgraphics@read@dpth@line#1#2\pgfincludeexternalgraphics@read@dpth@line@EOI{% \ifcat\noexpand#1\relax % Ah -- the first token is a control sequence. It belongs to % the .aux file. % - % #1#2\relax% do NOT set the information! many LaTeX commands don't support it (\label for example) - \pgfutil@ifundefined{if@filesw}{% - % sorry, .aux file support only for latex - }{% - % append to main .aux file (for forward references) - \if@filesw - {% - \toks0={#1#2}% - % believe it or not, but the - % \def\dpthimport{...}\dpthimport *makes* a - % difference! In ensures any occuring `##' characters - % are properly expanded to `#'. - \immediate\write\@auxout{\noexpand\def\noexpand\dpthimport{\the\toks0 }\noexpand\dpthimport }% - }% - \fi - }% - \else - \def\pgfincludeexternalgraphics@dp{#1#2}% + \ifx#1\pgfexternal@restore + #2% + \else + % do NOT execute #1#2! many LaTeX commands don't support it (\label for example) + \pgfutil@ifundefined{if@filesw}{% + % sorry, .aux file support only for latex + }{% + % append to main .aux file (for forward references) + \if@filesw + {% + \toks0={#1#2}% + % believe it or not, but the + % \def\dpthimport{...}\dpthimport *makes* a + % difference! In ensures any occuring `##' characters are properly expanded to `#'. + \immediate\write\@auxout{\noexpand\def\noexpand\dpthimport{\the\toks0 }\noexpand\dpthimport }% + }% + \fi + }% + \fi + \else% it is the depth (which is simply a number for backwards compatibility) + \def\pgfexternaldepth{#1#2}% \fi }% +% Stores '#1' into (expanded!) into the .dpth file of the currently +% exported image. +% +% Just before the image is included into the main document, '#1' will be +% invoked. +% +% This command has only an effect if an image is being exported. +\def\pgfexternalstorecommand#1{% +}% +\def\pgfexternalstorecommand@isexporting#1{% + \immediate\write\w@pgfexternal@auxout{\noexpand\pgfexternal@restore{#1}}% +}% + % Grab operation: If jobname matches the graphic name, typeset this @@ -275,14 +337,35 @@ % this method is also invoked from within the tikz external library. \def\pgf@external@grab#1{% \def\pgf@filename{#1}% - \ifpgfexternal@allow@aux + \ifpgfexternal@aux@in@dpth \begingroup \pgf@external@init@aux@in@dpth + \let\G@refundefinedtrue=\pgf@external@grab@refundefinedtrue \fi + \gdef\pgf@trimleft@final{0sp}% + \gdef\pgf@trimright@final{0sp}% \setbox\pgfpic=\hbox\bgroup\bgroup% \let\endpgfgraphicnamed=\pgf@externalend% } +{\catcode`\^=12 \gdef\pgfexternal@hat{^}} + +\expandafter\let\expandafter\pgf@external@grab@refundefinedtrue@orig\csname G@refundefinedtrue\endcsname + +\def\pgf@external@grab@refundefinedtrue{% + \pgf@external@grab@refundefinedtrue@orig + \begingroup + \def\n{\pgfexternal@hat\pgfexternal@hat J}% + \pgfexternalstorecommand{% + \noexpand\immediate\noexpand\write16{\pgf@external@grab@refundefinedtrue@warning}% + \noexpand\G@refundefinedtrue + }% + \endgroup +}% +\def\pgf@external@grab@refundefinedtrue@warning{% + LaTeX Warning: External picture `\pgfactualjobname' contains undefined references\noexpand\on@line.\n +}% + \let\pgf@external@@protected@write@orig=\protected@write \long\def\pgf@external@@protected@write@immediate#1#2#3{% \begingroup @@ -293,6 +376,8 @@ }% \def\pgf@external@init@aux@in@dpth{% + \let\pgfexternalstorecommand=\pgfexternalstorecommand@isexporting + % % tell LaTeX to write aux files... \csname @fileswtrue\endcsname % ... but redirect output to the .dpth file! @@ -304,11 +389,38 @@ \let\protected@write=\pgf@external@@protected@write@immediate }% +\def\pgf@externalend@storeshifts#1{% + \immediate\write#1{\the\dp\pgfpic}% + \ifx\pgf@trimleft@final\pgfutil@empty\else + \immediate\write#1{\noexpand\pgfexternal@restore{\noexpand\def\noexpand\pgfexternaltrimleft{\pgf@trimleft@final}}}% + \fi + \ifx\pgf@trimright@final\pgfutil@empty\else + \immediate\write#1{\noexpand\pgfexternal@restore{\noexpand\def\noexpand\pgfexternaltrimright{\pgf@trimright@final}}}% + \fi +} % REMARK: % this method is also invoked from within the tikz external library. \def\pgf@externalend{% \unskip\egroup\egroup% {% + \def\pgf@external@trim{0}% + \def\pgf@external@store@dpth{0}% + % + \ifdim\pgf@trimleft@final=0sp \gdef\pgf@trimleft@final{} \else\def\pgf@external@trim{1}\fi + \ifdim\pgf@trimright@final=0sp \gdef\pgf@trimright@final{} \else\def\pgf@external@trim{1}\fi + \if1\pgf@external@trim + % UNDO the trimming! export to pdf doesn't supported trimmed + % bounding boxes (has to do with the mediabox/trimbox etc). + % I'll keep the bounding box intact and store the trim information + % into the .dpth file. + \setbox\pgfpic=\hbox{% + \ifx\pgf@trimleft@final\pgfutil@empty\else\kern-\pgf@trimleft@final\fi + \box\pgfpic + \ifx\pgf@trimright@final\pgfutil@empty\else\kern-\pgf@trimright@final\fi + }% + \def\pgf@external@store@dpth{1}% + \fi + % \parindent0pt % leave the space % \leftmargin0pt% % \rightmargin0pt% @@ -316,12 +428,16 @@ \advance\dimen0\dp\pgfpic% \ifdim\dp\pgfpic=0pt\relax \else% store the picture's depth. Otherwise, it would be lost. - \ifpgfexternal@allow@aux - \immediate\write\@auxout{\the\dp\pgfpic}% + \def\pgf@external@store@dpth{1}% + \fi + % + \if1\pgf@external@store@dpth + \ifpgfexternal@aux@in@dpth + \pgf@externalend@storeshifts\@auxout \immediate\closeout\@auxout \else \immediate\openout\pgf@plotwrite=\pgf@filename.dpth - \immediate\write\pgf@plotwrite{\the\dp\pgfpic}% + \pgf@externalend@storeshifts\pgf@plotwrite \immediate\closeout\pgf@plotwrite \fi \fi @@ -339,13 +455,27 @@ \box\pgfpic% \kern 1truein }% \kern1truein }% + % + % compatibility with eso-pic package: \nointerlineskip is not + % allowed here, but the eso-pic package uses \nointerlineskip in + % its shipout routine. + \let\pgfexternal@nointerlineskip@orig=\nointerlineskip + \let\nointerlineskip=\pgfexternal@nointerlineskip + % \pgfexternal@originalshipout\box0 % + \gdef\pgfexternal@did@a@shipout{1}% }% - \ifpgfexternal@allow@aux + \ifpgfexternal@aux@in@dpth \endgroup \fi } +\def\pgfexternal@nointerlineskip{% + \ifvmode + \pgfexternal@nointerlineskip@orig + \else + \relax% \nointerlineskip in horizontal mode not allowed. Silently ignore the error message. + \fi +}% \endinput - diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreimage.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreimage.code.tex new file mode 100644 index 00000000000..5283de70b9d --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreimage.code.tex @@ -0,0 +1,580 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% This file is a copy of some part of PGF/Tikz. +%%% It has been copied here to provide : +%%% - compatibility with older PGF versions +%%% - availability of PGF contributions by Christian Feuersaenger +%%% which are necessary or helpful for pgfplots. +%%% +%%% For reasons of simplicity, I have copied the whole file, including own contributions AND +%%% PGF parts. The copyrights are as they appear in PGF. +%%% +%%% Note that pgfplots has compatible licenses. +%%% +%%% This copy has been modified in the following ways: +%%% - nested \input commands have been updated +%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Date of this copy: Mon Mar 22 16:42:03 CET 2010 %%% + + + +% Copyright 2006 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreimage.code.tex,v 1.14 2010/03/19 09:50:32 ludewich Exp $ + + + +% Declare an image +% +% #1 = optional argument: width, height, page specification +% #2 = name of the image for later use +% #4 = filename without extension, automatic extensions are .pdf, +% .jpg, and .png for PDF and .ps, .eps, .epsi for postscript. +% +% Description: +% +% This command declares an image file for later use. Even if the image +% is used several times in the document, in PDF it will only be stored +% once. +% +% Example: +% +% \pgfdeclareimage[width=2cm,page=2]{myimage}{imagefilename} + +\def\pgfdeclareimage{\pgfutil@ifnextchar[{\pgf@declareimage}{\pgf@declareimage[]}} +\def\pgf@declareimage[#1]#2#3{% + \pgfqkeys{/pgf/images}{height=,width=,page=,interpolate=false,mask=,#1}% + % Try to find the file + \gdef\pgf@filename{}% + % If page= parameter is not empty, try that file first: + \ifx\pgf@imagepage\pgfutil@empty% + \else% + \expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#3.page\pgf@imagepage}% + \fi% + \ifx\pgf@filename\pgfutil@empty% + \expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#3}% + \else% + \pgfkeys{/pgf/images/page=}% make page empty + \fi% + \ifx\pgf@filename\pgfutil@empty% + \PackageWarning{pgf}% + {File "#3" not found when defining image "#2".\MessageBreak + Tried all extensions in "\pgfsys@imagesuffixlist"}% + \pgf@declaredraftimage{#2}{#3}% + \else% + \ifpgf@draftmode% + \pgf@declaredraftimage{#2}{#3}% + \else% + \pgfsys@defineimage% + \fi% + \fi% + \expandafter\global\expandafter\let\csname pgf@image@#2!\endcsname=\pgf@image% +} + +\newif\ifpgfexternal@allow@aux + +\pgfkeys{ + /pgf/images/include external/.code={\pgfimage{#1}}, + /pgf/images/aux in dpth/.is if=pgfexternal@allow@aux, + /pgf/images/aux in dpth/.default=true, + /pgf/images/draft/.is if=pgf@draftmode, + /pgf/images/draft/.default=true} +\pgfkeys{/pgf/images/width/.estore in=\pgf@imagewidth} +\pgfkeys{/pgf/images/height/.estore in=\pgf@imageheight} +\pgfkeys{/pgf/images/page/.estore in=\pgf@imagepage} +\pgfkeys{/pgf/images/interpolate/.cd,.code=\edef\pgf@imageinterpolate{#1},.default=true} +\pgfkeys{/pgf/images/mask/.code=% + {% + \edef\pgf@imagemask{#1}% + \ifx\pgf@imagemask\pgfutil@empty% + \else% + \pgfutil@ifundefined{pgf@mask@#1}% + {\PackageError{pgf}{Undefined mask "#1".}{}% + \edef\pgf@imagemask{}}% + {\edef\pgf@imagemask{\csname pgf@mask@#1\endcsname}% + }% + \fi% + }} + + +\def\pgf@findfile#1:#2+#3{% + \pgfutil@IfFileExists{#3#1}% + {\xdef\pgf@filename{#3#1}}% + {\def\pgf@mightbeempty{#2}% + \ifx\pgf@mightbeempty\pgfutil@empty\else% + \pgf@findfile#2+{#3}% + \fi}} + +% #1: image name +% #2: file name +\def\pgf@declaredraftimage#1#2{% + \ifx\pgf@imagewidth\pgfutil@empty% + \PackageWarning{pgf}{Missing width for image "#1" ("#2") in draft mode.\MessageBreak Using 1cm instead}% + \edef\pgf@imagewidth{1cm}% + \fi% + \ifx\pgf@imageheight\pgfutil@empty% + \PackageWarning{pgf}{Missing height for image "#1" ("#2") in draft mode.\MessageBreak Using 1cm instead}% + \edef\pgf@imageheight{1cm}% + \fi% + \ifx\pgf@imagepage\pgfutil@empty\else\edef\pgf@imagepagetext{ page \pgf@imagepage}\fi% + \edef\pgf@image{% + \hbox to \pgf@imagewidth{% + \vrule\kern-0.4pt% + \vbox to \pgf@imageheight{% + \hrule\vfil% + \hbox to \pgf@imagewidth{\hskip-10cm\hfil\noexpand\tiny#2\pgf@imagepage\hfil\hskip-10cm}% + \vfil\hrule}% + \kern-0.4pt\vrule}% + }% +} + + + +% Declare a soft mask +% +% #1 = optional argument: matte specification. default matte is +% white. +% #2 = name of the mask for later use +% #3 = filename without extension, automatic extensions are .pdf, +% .jpg, and .png for PDF. Postscript is not supported. +% +% Description: +% +% This command declares a soft mask for later masking an image. The +% declared mask should be used together with an image of exactly the +% same height/width if matte is defined. Matte should be the +% preblended background color (see pdf spec for details). +% +% Example: +% +% \pgfdeclaremask[matte=white]{maskname}{maskfilename} +% \pgfdeclareimage[mask=maskname]{image}{imagefilename} + +\def\pgfdeclaremask{\pgfutil@ifnextchar[\pgf@declaremask{\pgf@declaremask[]}} +\def\pgf@declaremask[#1]#2#3{% + \pgfqkeys{/pgf/images/mask}{matte={1 1 1},#1}% defaults + \def\pgf@mask{}% + % Try to find the file + \gdef\pgf@filename{}% + \expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#3}% + \ifx\pgf@filename\pgfutil@empty% + \PackageWarning{pgf}% + {File "#3" not found when defining mask "#2".\MessageBreak + Tried all extensions in "\pgfsys@imagesuffixlist"}% + \else% + \pgfsys@definemask{#2}% + \fi% + \expandafter\global\expandafter\let\csname pgf@mask@#2\endcsname=\pgf@mask% +} + +\pgfkeys{/pgf/images/mask/matte/.cd,.estore in=\pgf@maskmatte,.value required} + + + +% Create an alias name for an image +% +% #1 = name of the alias +% #2 = name of the original +% +% Example: +% +% \pgfdeclareimage{image}{1cm}{1cm}{filename +% \pgfaliasimage{alias}{image} +% \pgfuseimage{alias} + +\def\pgfaliasimage#1#2{% + \expandafter\global\expandafter\let\expandafter\pgf@temp\expandafter=\csname pgf@image@#2!\endcsname% + \expandafter\global\expandafter\let\csname pgf@image@#1!\endcsname=\pgf@temp% + } + + +% Use an image +% +% #1 = name of a previously declared image +% +% Example: +% +% \pgfputat{\pgforigin}{\pgfbox[left,base]{\pgfuseimage{myimage}}} + +\def\pgfuseimage#1{% + \def\pgf@imagename{pgf@image@#1}% + \pgf@tryextensions{\pgf@imagename}{\pgfalternateextension}% + \expandafter\pgfutil@ifundefined\expandafter{\pgf@imagename}% + {\PackageError{pgf}{Undefined image "#1"}{}}% + {{\leavevmode\csname\pgf@imagename\endcsname}}} + +\def\pgf@tryextensions#1#2{% + \edef\pgf@args{[#2!]}\expandafter\pgf@@tryextensions\pgf@args{#1}} +\def\pgf@@tryextensions[#1!#2]#3{% + \expandafter\pgfutil@ifundefined\expandafter{#3#1!#2}% + {\def\pgf@temp{#2}% + \ifx\pgf@temp\pgfutil@empty% + \edef#3{#3!}% + \else% + \pgf@@tryextensions[#2]{#3}% + \fi}% + {\edef#3{#3#1!#2}}} + + +% Alternate image +% +% Description: +% +% When an image is used, pgf first attempts to use the image with the +% alternate extension added. If this fails, the original image is +% used. If the alternate extension contains ``!'', then the text up to +% the ! is successively removed and the remainder is tried as an +% alternate extension. +% +% Example: +% +% \def\pgfalternateextension{20!white} + +\def\pgfalternateextension{} + + + +% Directly insert an image +% +% #1 = optional argument: width, height, page specification +% #2 = file name +% +% Description: +% +% Directly inserts an image without declaration. You can, however, +% still access this image using the name pgflastimage. By using +% pgfaliasimage, you can also save this image for later. +% +% Example: +% +% \pgfimage[height=2cm]{filename} + +\def\pgfimage{\pgfutil@ifnextchar[\pgf@imagecom{\pgf@imagecom[]}} +\def\pgf@imagecom[#1]#2{% + \pgfdeclareimage[#1]{pgflastimage}{#2}% + \pgfuseimage{pgflastimage}} + + + + + + + + +% The external read/write mechanism is used as follows: +% +% In your document, you put a number or all of your pgfpicture (or +% tikzpicture) environments inside a pair of \beginpgfexternal and +% \endpgfexternal. The \beginpgfexternal gets one parameter called the +% graphics name. +% +% Once this is done, the next step is to declare the names of your +% graphics in the document at the beginning using the +% \pgfdeclaregraphicname command. +% +% Now, when you typeset your document, each time a \beginpgfexternal +% command is encountered, it will be checked whether the corresponding +% graphics file exists. If this is the case, it will be included and +% the code between \beginpgfexternal and \endpgfexternal is +% ignored. Otherwise, the code is executed normally. +% +% Things change when you run tex on your file with the \jobname set to +% the name of a decalred graphics name. In this case, only your +% graphic will be typeset, the rest of the document will be "thrown away". +% To be more precise, everything is gobbled up to the beginning +% of the first \beginpgfexternal with the given graphics name. Then, +% the content of the "environment" is put in a box (this "environment" +% need not contain a graphics, it may contain anything that can be put +% in a box). Then a single page is output whose size is exactly the +% size of the picture. +% +% So, once you have run tex repeatedly, each time with the jobname set +% to each of the graphics, you can then run tex on the whole document +% and this will cause all graphics to be included rather than begin +% typeset. +% +% Finally, once all the graphics have been created, you can also say +% \input pgfexternal.tex instead of including pgf/TikZ. + + +\newif\ifpgfexternalreadmainaux +\pgfexternalreadmainauxtrue + +% Tells pgf which jobname is the name of the real file +% +% #1 = name +% +% Description: +% +% This command is used to tell pgf that the file named #1 should be +% typeset normally. If \jobname is not equal to #1, only +% the graphic called \jobname will be typeset. +% +% Example: +% +% \pgfrealjobname{survey} +% +% Note that afterwards, \jobname will be set to the argument. In our +% example, \jobname will be 'survey'. This is to accomplish +% compatibility with aux-file generation. + +\def\pgfrealjobname#1{% + \global\let\pgfactualjobname=\jobname + \edef\pgf@tempa{\expandafter\string\csname #1\endcsname}% + \edef\pgf@tempb{\expandafter\string\csname\jobname\endcsname}% + \ifx\pgf@tempa\pgf@tempb% + \else% + \pgf@external@grabshipouttrue% + \pgfexternal@nofiles + \ifpgfexternalreadmainaux + % and reset the jobname. This should allow to handle any + % \label/\ref constructions which are stored in \jobname.aux (and + % which won't be found otherwise) + \gdef\jobname{#1}% + \fi + \ifpgfexternal@allow@aux + \csname newwrite\endcsname\w@pgfexternal@auxout + \fi + \fi% + \gdef\pgfrealjobname##1{}% avoid multiple calls. +} + +\def\pgfexternal@nofiles{% + % replace \relax. The \nofiles macros does + % \let\makeglossary=\relax + % but the glossary.sty calls \renewcommand\makeglossary (which + % will fail if \makeglossary=\relax). Stupid, but it works. + \let\pgfexternal@nofiles@=\relax + \def\relax{\relax}% + % + % suppress generation of LaTeX .aux, .toc etc files. + % generation of these files is not thread-safe. + % the \csname \endcsname yields \relax if \nofiles doesn't exist. + \csname nofiles\endcsname + % + \let\relax=\pgfexternal@nofiles@ +}% + +\newif\ifpgf@external@grabshipout +\newbox\pgfexternal@startupbox + +\AtBeginDocument{% + \ifpgf@external@grabshipout% + \global\let\pgfexternal@originalshipout=\shipout% + \global\def\shipout{\setbox\pgfpic=}% + \maxdeadcycles=10000% + % Ok, gather everything we have seen up to now in a box. This box + % will contain any specials that have been used. + {% + \output{\global\setbox\pgfexternal@startupbox=\vbox{\csname @begindvi\endcsname\unvbox255}}% + \hbox{}\eject% + }% + \fi% +} + + +% "Environment" for an external graphic. +% +% #1 = graphic name +% +% Example: +% +% \beginpgfgraphicnamed{main-graphic2} +% \begin{tikzpicture} +% ... +% \end{tikzpicture} +% \endpgfgraphicnamed + +\def\pgf@externalbegin#1{% + % First, check whether we wish to grab this graphic: + \let\pgf@next=\pgf@external@normal% + \ifpgf@external@grabshipout% + \edef\pgf@tempa{\expandafter\string\csname #1\endcsname}% + \edef\pgf@tempb{\expandafter\string\csname\pgfactualjobname\endcsname}% + \ifx\pgf@tempa\pgf@tempb% + \let\pgf@next=\pgf@external@grab% + \fi% + \fi% + \pgf@next{#1}% +} + + +\AtBeginDocument{ + \let\beginpgfgraphicnamed=\pgf@externalbegin% overwrite definition of pgfexternal.tex if necessary + \let\endpgfgraphicnamed=\unskip +} + + +% Normal operation: Include an external graphic instead of the +% picture, if such an external picture exists. +\def\pgf@external@normal#1{% + \let\pgf@filename=\pgfutil@empty% + \expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#1}% + \ifx\pgf@filename\pgfutil@empty% + % Ok, no such image... Just typeset the picture normally. + \let\pgf@next=\relax% + \else% + \let\pgf@next=\pgf@replacepicturebygraphic% + \fi% + \pgf@next% +} + +\long\def\pgf@replacepicturebygraphic#1\endpgfgraphicnamed{% + \expandafter\pgfincludeexternalgraphics\expandafter{\pgf@filename}\unskip +} + +% This is almost the same as \includegraphics{#1}, but it checks +% whether '#1.dpth' exists. In such case, it restores the boxes depth +% stored in #1.dpth. +% +% Furthermore, the .dpth file may contain .aux related information +% collected for the external graphics (references). They start after +% the first line (if any). +\def\pgfincludeexternalgraphics#1{% + \begingroup + \setbox1=\hbox{\pgfkeysvalueof{/pgf/images/include external/.@cmd}{#1}\pgfeov}% + % + \let\pgfincludeexternalgraphics@dp=\pgfutil@empty + \endlinechar=-1 % suppress white space at end + \catcode`\@=11 + \openin\r@pgf@reada=#1.dpth + \pgfincludeexternalgraphics@read@dpth + \ifx\pgfincludeexternalgraphics@dp\pgfutil@empty + \box1 + \else + \dimen0=\pgfincludeexternalgraphics@dp\relax + \hbox{\lower\dimen0 \box1 }% + \fi + \endgroup +} +% +% The .dpth consists of 0-N lines, where each is either a single +% dimension (the box' depth) or something which belongs to the .aux +% file (such lines will always start with a macro). +\def\pgfincludeexternalgraphics@read@dpth{% + \ifeof\r@pgf@reada + \closein\r@pgf@reada + \else + \read\r@pgf@reada to\pgfincludeexternalgraphics@auxline + \ifx\pgfincludeexternalgraphics@auxline\pgfutil@empty + \else + \expandafter\pgfincludeexternalgraphics@read@dpth@line\pgfincludeexternalgraphics@auxline\pgfincludeexternalgraphics@read@dpth@line@EOI + \fi + \expandafter\pgfincludeexternalgraphics@read@dpth + \fi +}% +\long\def\pgfincludeexternalgraphics@read@dpth@line#1#2\pgfincludeexternalgraphics@read@dpth@line@EOI{% + \ifcat\noexpand#1\relax + % Ah -- the first token is a control sequence. It belongs to + % the .aux file. + % + % #1#2\relax% do NOT set the information! many LaTeX commands don't support it (\label for example) + \pgfutil@ifundefined{if@filesw}{% + % sorry, .aux file support only for latex + }{% + % append to main .aux file (for forward references) + \if@filesw + {% + \toks0={#1#2}% + % believe it or not, but the + % \def\dpthimport{...}\dpthimport *makes* a + % difference! In ensures any occuring `##' characters + % are properly expanded to `#'. + \immediate\write\@auxout{\noexpand\def\noexpand\dpthimport{\the\toks0 }\noexpand\dpthimport }% + }% + \fi + }% + \else + \def\pgfincludeexternalgraphics@dp{#1#2}% + \fi +}% + + + +% Grab operation: If jobname matches the graphic name, typeset this +% picture normall. +% REMARK: +% this method is also invoked from within the tikz external library. +\def\pgf@external@grab#1{% + \def\pgf@filename{#1}% + \ifpgfexternal@allow@aux + \begingroup + \pgf@external@init@aux@in@dpth + \fi + \setbox\pgfpic=\hbox\bgroup\bgroup% + \let\endpgfgraphicnamed=\pgf@externalend% +} + +\let\pgf@external@@protected@write@orig=\protected@write +\long\def\pgf@external@@protected@write@immediate#1#2#3{% + \begingroup + \let\pgf@write@=\write + \def\write{\noexpand\immediate\pgf@write@}% + \pgf@external@@protected@write@orig{#1}{#2}{#3}% + \endgroup +}% + +\def\pgf@external@init@aux@in@dpth{% + % tell LaTeX to write aux files... + \csname @fileswtrue\endcsname + % ... but redirect output to the .dpth file! + \immediate\openout\w@pgfexternal@auxout=\pgf@filename.dpth + \let\@auxout=\w@pgfexternal@auxout + % ... and disable the correct page numbers. I can't get that + % (because the correct page number is only available in the + % shipout routine). Use immediate output: + \let\protected@write=\pgf@external@@protected@write@immediate +}% + +% REMARK: +% this method is also invoked from within the tikz external library. +\def\pgf@externalend{% + \unskip\egroup\egroup% + {% + \parindent0pt % leave the space +% \leftmargin0pt% +% \rightmargin0pt% + \dimen0\ht\pgfpic% + \advance\dimen0\dp\pgfpic% + \ifdim\dp\pgfpic=0pt\relax + \else% store the picture's depth. Otherwise, it would be lost. + \ifpgfexternal@allow@aux + \immediate\write\@auxout{\the\dp\pgfpic}% + \immediate\closeout\@auxout + \else + \immediate\openout\pgf@plotwrite=\pgf@filename.dpth + \immediate\write\pgf@plotwrite{\the\dp\pgfpic}% + \immediate\closeout\pgf@plotwrite + \fi + \fi + \pgfsys@papersize{\the\wd\pgfpic}{\the\dimen0}% + \setbox0=\vbox{% + \kern -1truein % + \hbox{% + \kern -1truein % + \hbox to0pt{% + \wd\pgfexternal@startupbox=0pt % + \ht\pgfexternal@startupbox=0pt % + \dp\pgfexternal@startupbox=0pt % + \box\pgfexternal@startupbox% + \pgfsys@atbegindocument\hss}% + \box\pgfpic% + \kern 1truein }% + \kern1truein }% + \pgfexternal@originalshipout\box0 % + }% + \ifpgfexternal@allow@aux + \endgroup + \fi +} + + +\endinput + diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeys.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeys.code.tex index 24203d3b330..98b203fbb68 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeys.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeys.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% @@ -829,6 +829,26 @@ .unknown/.style={/errors/unknown choice value=\pgfkeyscurrentkey\pgfkeyscurrentvalue}}} +% Repeatedly setting a key + +\pgfkeys{/handlers/.list/.code=% + {% + % Use foreach to unfold the list + \let\pgf@keys@temp=\pgfutil@empty% + \foreach \pgf@keys@key in{#1}% + {\expandafter\expandafter\expandafter\gdef% + \expandafter\expandafter\expandafter\pgf@keys@temp% + \expandafter\expandafter\expandafter{\expandafter\pgf@keys@temp\expandafter{\pgf@keys@key}}}% + \edef\pgf@keys@list@path{\pgfkeyscurrentpath}% + \expandafter\expandafter\expandafter\pgf@keys@do@list% + \expandafter\expandafter\expandafter{\expandafter\pgf@keys@list@path\expandafter}\pgf@keys@temp\pgf@stop% + }% +} +\def\pgf@keys@do@list#1{\pgfutil@ifnextchar\bgroup{\pgf@keys@do@list@item{#1}}\pgfutil@gobble} +\def\pgf@keys@do@list@item#1#2{\pgfkeysalso{#1={#2}}\pgf@keys@do@list{#1}} + + + % Inspection handlers \pgfkeys{/handlers/.show value/.code=\pgfkeysgetvalue{\pgfkeyscurrentpath}{\pgfkeysshower}\show\pgfkeysshower} % inspect the value diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex index c795bc45ffb..1063569eeec 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex index 0af3c3887c5..35dc897fec7 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% @@ -249,7 +249,7 @@ \pgfmathfloat@install\pgfmathrand@=\pgfmathfloatrand@ \pgfmathfloat@install\pgfmathrand=\pgfmathfloatrand@ \pgfmathfloat@install\pgfmathrnd@=\pgfmathfloatrnd@ - \pgfmathfloat@install\pgfmathrnd=\pgfmathfloatrnd + \pgfmathfloat@install\pgfmathrnd=\pgfmathfloatrnd@ \pgfmathfloat@install\pgfmathtrue@=\pgfmathfloattrue@ \pgfmathfloat@install\pgfmathfalse@=\pgfmathfloatfalse@ \pgfmathfloat@install\pgfmathnot@=\pgfmathfloatnot@ @@ -327,6 +327,7 @@ \pgfmathfloat@plots@install% \pgfmathfloat@parser@install@functions \let\pgfmathrand@=\pgfmath@basic@rand@ + \let\pgfmathrnd@=\pgfmath@basic@rnd@ \pgfmathfloat@install\pgfmathmax@=\pgfmathfloatmaxtwo% \pgfmathfloat@install\pgfmathmin@=\pgfmathfloatmintwo% \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{factorial}% @@ -645,6 +646,7 @@ \fi } \let\pgfmathfloatlessthan=\pgfmathfloatlessthan@ +\let\pgfmathfloatless@=\pgfmathfloatlessthan@ % compares \pgfmathfloat@a@[SME] < \pgfmathfloat@b@[SME] \def\pgfmathfloatlessthan@positive{% @@ -675,6 +677,7 @@ \def\pgfmathfloatgreaterthan@#1#2{\pgfmathfloatlessthan@{#2}{#1}} \let\pgfmathfloatgreaterthan=\pgfmathfloatgreaterthan@ +\let\pgfmathfloatgreater@=\pgfmathfloatgreaterthan@ \def\pgfmathfloatmax@#1{% \begingroup @@ -934,6 +937,7 @@ % or, equivalently % \pgfmathfloatifflags{\pgfmathresult}{+}{It's positive!}{It's not positive!}% % \pgfmathfloatifflags{\pgfmathresult}{-}{It's negative!}{It's not negative!}% +% it also supports #2=u which means 'unbounded' \def\pgfmathfloatifflags#1#2#3#4{% \if#2-% \pgfmathfloatifflags{#1}{2}{#3}{#4}% @@ -942,10 +946,18 @@ \pgfmathfloatifflags{#1}{1}{#3}{#4}% \else \pgfmathfloatgetflagstomacro#1\pgfmathfloat@loc@TMPa - \if\pgfmathfloat@loc@TMPa#2 - #3\relax + \if#2u% + \ifnum\pgfmathfloat@loc@TMPa>2 + #3\relax + \else + #4\relax + \fi \else - #4\relax + \if\pgfmathfloat@loc@TMPa#2 + #3\relax + \else + #4\relax + \fi \fi \fi \fi @@ -1315,6 +1327,8 @@ % % This operation is not limited to TeX's range of count registers (it % works symbolly) +% +% @see \pgfmathfloattoint \def\pgfmathfloatint@#1{% \begingroup \edef\pgfmathresult{#1}% @@ -1868,16 +1882,21 @@ \pgfutil@ifundefined{pgfmathdeclarefunction}{% % special treatment: \pgfmathrand@ was not properly defined for pgf 2.00: \let\pgfmath@basic@rand=\pgfmathrand + \let\pgfmath@basic@rand@=\pgfmathrand@ \def\pgfmathfloatrand@{% \pgfmath@basic@rand \pgfmathfloatparsenumber{\pgfmathresult}% }% + \let\pgfmathfloatrand=\pgfmathfloatrand@% + % % special treatment: \pgfmathrnd@ was not properly defined for pgf 2.00: \let\pgfmath@basic@rnd=\pgfmathrnd + \let\pgfmath@basic@rnd@=\pgfmathrnd@ \def\pgfmathfloatrnd@{% \pgfmath@basic@rnd \pgfmathfloatparsenumber{\pgfmathresult}% }% + \let\pgfmathfloatrnd=\pgfmathfloatrnd@% }{} % Implements the factorial of '#1'. diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex index f93028724a3..af2c68353a7 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% @@ -27,7 +27,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryplothandlers.code.tex,v 1.14 2009/11/18 20:27:45 ludewich Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryplothandlers.code.tex,v 1.15 2010/05/31 10:11:22 tantau Exp $ \newif\ifpgf@plot@started @@ -941,6 +941,102 @@ +% This handler turns creates a series of straight line segements +% between consecutive points, but leaving /pgf/gap around stream point +% space. +% +% Example: +% +% \pgfplothandlergaplineto +% \pgfplotxyfile{mytable} + +\pgfkeys{/pgf/gap around stream point/.initial=1.5pt} + +\def\pgfplothandlergaplineto{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@gap@lineto@handler@initial% + \global\let\pgf@plotstreamspecial=\pgfutil@gobble% + \global\let\pgf@plotstreamend=\relax% + }% +} + +\def\pgf@plot@gap@lineto@handler@initial#1{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \xdef\pgf@plot@gap@lineto@last{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% + \global\let\pgf@plotstreampoint=\pgf@plot@gap@lineto@handler% +} + +\def\pgf@plot@gap@lineto@handler#1{% + % Ok, compute normalized line vector + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \xdef\pgf@plot@gap@lineto@next{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% + \pgf@process{\pgfpointnormalised{\pgfpointdiff{\pgf@plot@gap@lineto@last}{\pgf@plot@gap@lineto@next}}}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgfpathmoveto{\pgfpointadd{\pgfpointscale{\pgfkeysvalueof{/pgf/gap + around stream point}}{\pgfqpoint{\pgf@xc}{\pgf@yc}}}{\pgf@plot@gap@lineto@last}}% + \pgfpathlineto{\pgfpointadd{\pgfpointscale{\pgfkeysvalueof{/pgf/gap + around stream point}}{\pgfqpoint{-\pgf@xc}{-\pgf@yc}}}{\pgf@plot@gap@lineto@next}}% + \global\let\pgf@plot@gap@lineto@last=\pgf@plot@gap@lineto@next% +} + + + + +% This handler works like \pgfplothandlergaplineto, only the last +% point is connected to the first point, creating a closed curve +% space. +% +% Example: +% +% \pgfplothandlergapcycle +% \pgfplotxyfile{mytable} + +\def\pgfplothandlergapcycle{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@gap@cycle@handler@initial% + \global\let\pgf@plotstreamspecial=\pgfutil@gobble% + \global\let\pgf@plotstreamend=\pgf@plot@gap@cycle@handler@finish% + \global\let\pgf@plot@gap@cycle@first=\relax% + }% +} + +\def\pgf@plot@gap@cycle@handler@initial#1{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \xdef\pgf@plot@gap@cycle@last{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% + \global\let\pgf@plot@gap@cycle@first=\pgf@plot@gap@cycle@last% + \global\let\pgf@plotstreampoint=\pgf@plot@gap@cycle@handler% +} + +\def\pgf@plot@gap@cycle@handler#1{% + % Ok, compute normalized line vector + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \xdef\pgf@plot@gap@cycle@next{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% + \pgf@process{\pgfpointnormalised{\pgfpointdiff{\pgf@plot@gap@cycle@last}{\pgf@plot@gap@cycle@next}}}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgfpathmoveto{\pgfpointadd{\pgfpointscale{\pgfkeysvalueof{/pgf/gap + around stream point}}{\pgfqpoint{\pgf@xc}{\pgf@yc}}}{\pgf@plot@gap@cycle@last}}% + \pgfpathlineto{\pgfpointadd{\pgfpointscale{\pgfkeysvalueof{/pgf/gap + around stream point}}{\pgfqpoint{-\pgf@xc}{-\pgf@yc}}}{\pgf@plot@gap@cycle@next}}% + \global\let\pgf@plot@gap@cycle@last=\pgf@plot@gap@cycle@next% +} + +\def\pgf@plot@gap@cycle@handler@finish{% + \ifx\pgf@plot@gap@cycle@first\relax% + \else + \pgf@plot@gap@cycle@handler{\pgf@plot@gap@cycle@first}% + \fi +} + \endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.code.tex index a03ef94d6a5..8677b488b82 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex index 0c20db997a3..09c012886d6 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex index 20e0bf1b4d2..e7154cc49ed 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex index 62a33269d8b..f403e35ff85 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% @@ -141,12 +141,7 @@ } % Extracts the flags of #1 into the macro #2. \def\pgfmathfloatgetflagstomacro#1#2{% - \begingroup - \edef\pgfmathfloat@loc@TMPa{#1}% - \expandafter\pgfmathfloat@decompose@F\pgfmathfloat@loc@TMPa\relax{\count0}% - \xdef\pgfmathfloat@glob@TMP{\the\count0 }% - \endgroup - \let#2=\pgfmathfloat@glob@TMP + \expandafter\pgfmathfloat@decompose@Fmacro#1\relax{#2}% }% % Extracts the mantisse of #1 into the dimen register #2. @@ -245,6 +240,14 @@ \fi #1#2% }% +\def\pgfmathfloat@decompose@Fmacro#1#2{% + \ifx#2Y% + \expandafter\pgfmathfloat@decompose@Fmacro@% + \else + \expandafter\pgfmathfloat@decompose@F@error% + \fi + #1#2% +}% \def\pgfmathfloat@decompose@M#1#2{% \ifx#2Y% \expandafter\pgfmathfloat@decompose@M@% @@ -270,6 +273,7 @@ #1#2% }% \def\pgfmathfloat@decompose@F@#1Y#2e#3]\relax#4{#4=#1\relax}% +\def\pgfmathfloat@decompose@Fmacro@#1Y#2e#3]\relax#4{\def#4{#1}}% \def\pgfmathfloat@decompose@M@#1Y#2e#3]\relax#4{#4=#2pt}% \def\pgfmathfloat@decompose@Mtok@#1Y#2e#3]\relax#4{#4={#2}}% \def\pgfmathfloat@decompose@E@#1Y#2e#3]\relax#4{#4=#3\relax}% @@ -378,6 +382,17 @@ } \let\pgfmathfloattofixed=\pgfmathfloattofixed@ +% Converts a float to an integer (in integer format). +% +% @see \pgfmathfloatint +\def\pgfmathfloattoint#1{% + \pgfmathfloattofixed{#1}% + \expandafter\pgfmathfloattoint@@\pgfmathresult\relax +}% +\def\pgfmathfloattoint@@#1.#2\relax{% + \def\pgfmathresult{#1}% +}% + % Converts a floating point number to scientific format 1.234e5. % % This operation is very fast. @@ -476,6 +491,9 @@ \pgfkeysgetvalue{/pgf/number format/@dec sep mark}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK \pgfkeysgetvalue{/pgf/number format/set thousands separator}\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP \c@pgf@counta=#4\relax + \ifnum#2=0 + \c@pgf@counta=0 + \fi \def\pgfmathresult{}% \ifpgfmathfloatroundhasperiod \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@period#1\pgfmathfloat@EOI @@ -837,6 +855,9 @@ \newif\ifpgfmathprintnumber@assumemathmode \newif\ifpgfmathprintnumber@showpositive \newif\ifpgfmathprintnumber@frac@warn +\newif\ifpgfmathprintnumber@frac@whole + +\long\def\pgfmathfloatfrac@verbatim#1#2{#1/#2}% \pgfkeys{% /pgf/number format/.is family, @@ -849,6 +870,10 @@ int trunc/.code= \pgfmath@set@number@printer{pgfmathprintnumber@INT@TRUNC}, frac/.code= \pgfmath@set@number@printer{pgfmathprintnumber@frac},% frac TeX/.initial=\frac, + frac whole format/.code={\def\pgfmathresult{#1}}, + frac denom/.initial=, + frac whole/.is if=pgfmathprintnumber@frac@whole, + frac whole=true, frac shift/.initial=4, frac warning/.is if=pgfmathprintnumber@frac@warn, frac warning=true, @@ -905,15 +930,19 @@ sci generic/empty mantisse sep/.initial=,% sci generic/exponent/.initial=,% sci generic/.value required, - verbatim/.style={% - sci generic={mantisse sep=,exponent={e##1}}, - 1000 sep=, - skip 0.=false, - print sign=false, - dec sep=., - assume math mode, - @dec sep mark=, - @sci exponent mark=, + verbatim/.code={% + \pgfqkeys{/pgf/number format}{% + sci generic={mantisse sep=,exponent={e##1}}, + 1000 sep=, + skip 0.=false, + print sign=false, + dec sep=., + assume math mode, + frac TeX=\pgfmathfloatfrac@verbatim, + frac whole format/.code={\def\pgfmathresult{##1 }}, + @dec sep mark=, + @sci exponent mark=, + }% }, % sci may skip mantisse/.is if=pgfmathfloatround@allow@empty@mantisse, % sci may skip mantisse/.default=true, @@ -1000,21 +1029,39 @@ \def\pgfmathfloat@loc@TMPa{+}% \fi \else - % FIXME : doesn't respect show pos! + \ifx\pgfmathfloat@loc@TMPa-% + \else + \ifx\pgfmathfloat@loc@TMPa+% + \else + \ifpgfmathprintnumber@showpositive + \edef\pgfmathfloat@loc@TMPa{+\pgfmathfloat@loc@TMPa}% + \fi + \def\pgfmathfloat@loc@TMPb{\pgfkeysvalueof{/pgf/number format/frac whole format/.@cmd}}% + \expandafter\pgfmathfloat@loc@TMPb\pgfmathfloat@loc@TMPa\pgfeov + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \fi + \fi \fi \toks1=\expandafter{\pgfmathfloat@loc@TMPa}% \edef\pgfmathresult{% - \the\toks1 \the\toks0 {#2}{#3}% + \the\toks1 \ifnum#2=0 \else\the\toks0 {#2}{#3}\fi% }% \pgfmath@smuggleone\pgfmathresult \endgroup }% % Defines \pgfmathresult to contain three sets of braces containing -% the sign (optionally containing any components >1), the counter and the denominator for #1. +% the sign (optionally containing any components >1), the numerator and the denominator for #1. % % \pgfmathfloatgetfrac{0.5} -> \pgfmathresult contains {}{1}{2} % \pgfmathfloatgetfrac{-0.5} -> \pgfmathresult contains {-}{1}{2} +% \pgfmathfloatgetfrac{1.5} -> \pgfmathresult contains {1}{1}{2} +% +% special cases: +% \pgfmathfloatgetfrac{0} -> \pgfmathresult contains {0}{0}{1} +% \pgfmathfloatgetfrac{1} -> \pgfmathresult contains {1}{0}{1} +% +% The numerator and denominator is always a number (not empty) \def\pgfmathfloatgetfrac#1{% \begingroup \edef\pgfmathfloat@arg{#1}% @@ -1022,7 +1069,7 @@ \def\pgfmathfloat@loc@TMPa{0}% \ifcase\pgfmathfloat@a@S % #1 = 0: - \def\pgfmathresult{{}{0}{1}}% + \def\pgfmathresult{{0}{0}{1}}% \or% #1 > 0 \pgfmathfloat@a@S=1 \def\pgfmathfloat@loc@TMPa{1}% @@ -1040,7 +1087,8 @@ \ifnum\pgfmathfloat@a@E<0 \def\pgfmathfloat@wholenumber{}% \else - \pgfmathfloattofixed{#1}% + \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \pgfmathfloattofixed\pgfmathresult% \def\pgfmathfloat@loc@TMPa##1.##2\relax{% \def\pgfmathfloat@wholenumber{##1}% \pgfmathfloatparsenumber{0.##2}% @@ -1048,7 +1096,6 @@ \expandafter\pgfmathfloat@loc@TMPa\pgfmathresult\relax \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E \fi - \pgfmathfloat@a@E=-\pgfmathfloat@a@E % \def\pgfmathfloat@loc@TMPa##1.##2\relax{% \def\pgfmathfloat@mantisse@first{##1}% @@ -1063,66 +1110,92 @@ \fi }% % - \ifdim\pgfmathfloat@mantisse@ltone pt=0pt - \def\pgfmathfloat@factor{1}% - \edef\pgfmathfloat@scaled@counter{\the\pgfmathfloat@a@Mtok}% - \else - % FIXME : this here is numerically instable. - % - % The errors of 1/r are magnified by 10^k which - % doesn't work. - \pgfutil@ifundefined{FPdiv}{% - \pgfmathfloatparsenumber{\pgfmathfloat@mantisse@ltone}% - \pgfmathfloatreciprocal@{\pgfmathresult}% - }{% - % \usepackage{fp}. - % yields higher absolute precision. - \FPmessagesfalse% - \FPdebugfalse% - \FPdiv\pgfmathresult{1}{\pgfmathfloat@mantisse@ltone}% - \pgfmathfloatparsenumber{\pgfmathresult}% - }% - \let\pgfmathfloat@inv=\pgfmathresult - \pgfmathfloatcreate{1}{1.0}{\pgfkeysvalueof{/pgf/number format/frac shift}}% - \let\pgfmathfloat@scalebaseten=\pgfmathresult - \pgfmathfloatmultiply@{\pgfmathfloat@inv}{\pgfmathfloat@scalebaseten}% - \let\pgfmathfloat@factor=\pgfmathresult - % - \expandafter\pgfmathfloatparsenumber\expandafter{\the\pgfmathfloat@a@Mtok}% - \let\pgfmathfloat@loc@TMPa=\pgfmathresult - \pgfmathfloatmultiply@{\pgfmathfloat@factor}{\pgfmathfloat@loc@TMPa}% - \pgfmathfloattofixed\pgfmathresult - \let\pgfmathfloat@scaled@counter=\pgfmathresult - % - \pgfmathfloattofixed\pgfmathfloat@factor - \expandafter\pgfmathfloat@loc@@to@int\pgfmathresult\relax{\pgfmathfloat@b@S}% - \edef\pgfmathfloat@factor{\the\pgfmathfloat@b@S}% - \fi - % - \let\pgfmathresultcounter=\pgfmathfloat@b@S + % alias registers names: + \let\pgfmathresultnumerator=\pgfmathfloat@b@S \let\pgfmathresultdenom=\pgfmathfloat@b@E % - \pgfmathresultdenom=\pgfmathfloat@factor\relax - \pgfmathfloat@multiply@ten@to@the@E\pgfmathresultdenom - % - \expandafter\pgfmathfloat@loc@@to@int\pgfmathfloat@scaled@counter\relax{\pgfmathresultcounter}% -%\message{scale = \pgfmathfloat@factor; Z = \the\pgfmathresultcounter\space ( von \pgfmathfloat@scaled@counter), N = \the\pgfmathresultdenom.}% + \pgfkeysgetvalue{/pgf/number format/frac denom}\pgfmath@target@denominator + \ifx\pgfmath@target@denominator\pgfutil@empty % - \pgfmathgreatestcommondivisor{\pgfmathresultcounter}{\pgfmathresultdenom}% - \divide\pgfmathresultcounter by\pgfmathresult\relax - \divide\pgfmathresultdenom by\pgfmathresult\relax - \ifpgfmathprintnumber@frac@warn - \ifnum\pgfmathresultdenom>1000 + \pgfmathfloat@a@E=-\pgfmathfloat@a@E + \ifdim\pgfmathfloat@mantisse@ltone pt=0pt + \def\pgfmathfloat@factor{1}% + \edef\pgfmathfloat@scaled@numerator{\the\pgfmathfloat@a@Mtok}% + \else + % FIXME : this here is numerically instable. + % + % The errors of 1/r are magnified by 10^k which + % doesn't work. \pgfutil@ifundefined{FPdiv}{% - \pgfmathfloattosci@\pgfmathfloat@arg - \immediate\write16{! Package pgf /pgf/number format/frac warning=true: /pgf/number format/frac of `\pgfmathresult' = \the\pgfmathresultcounter\space / \the\pgfmathresultdenom\space might be large due to instabilities. Try \string\usepackage{fp} to improve accuracy.}% - }{}% + \pgfmathfloatparsenumber{\pgfmathfloat@mantisse@ltone}% + \pgfmathfloatreciprocal@{\pgfmathresult}% + }{% + % \usepackage{fp}. + % yields higher absolute precision. + \FPmessagesfalse% + \FPdebugfalse% + \FPdiv\pgfmathresult{1}{\pgfmathfloat@mantisse@ltone}% + \pgfmathfloatparsenumber{\pgfmathresult}% + }% + \let\pgfmathfloat@inv=\pgfmathresult + \pgfmathfloatcreate{1}{1.0}{\pgfkeysvalueof{/pgf/number format/frac shift}}% + \let\pgfmathfloat@scalebaseten=\pgfmathresult + \pgfmathfloatmultiply@{\pgfmathfloat@inv}{\pgfmathfloat@scalebaseten}% + \let\pgfmathfloat@factor=\pgfmathresult + % + \expandafter\pgfmathfloatparsenumber\expandafter{\the\pgfmathfloat@a@Mtok}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatmultiply@{\pgfmathfloat@factor}{\pgfmathfloat@loc@TMPa}% + \pgfmathfloattofixed\pgfmathresult + \let\pgfmathfloat@scaled@numerator=\pgfmathresult + % + \pgfmathfloattofixed\pgfmathfloat@factor + \expandafter\pgfmathfloat@loc@@to@int\pgfmathresult\relax{\pgfmathfloat@b@S}% + \edef\pgfmathfloat@factor{\the\pgfmathfloat@b@S}% + \fi + % + % + \pgfmathresultdenom=\pgfmathfloat@factor\relax + \pgfmathfloat@multiply@ten@to@the@E\pgfmathresultdenom + % + \expandafter\pgfmathfloat@loc@@to@int\pgfmathfloat@scaled@numerator\relax{\pgfmathresultnumerator}% + %\message{scale = \pgfmathfloat@factor; Z = \the\pgfmathresultnumerator\space ( von \pgfmathfloat@scaled@numerator), N = \the\pgfmathresultdenom.}% + % + \pgfmathgreatestcommondivisor{\pgfmathresultnumerator}{\pgfmathresultdenom}% + \divide\pgfmathresultnumerator by\pgfmathresult\relax + \divide\pgfmathresultdenom by\pgfmathresult\relax + \ifpgfmathprintnumber@frac@warn + \ifnum\pgfmathresultdenom>1000 + \pgfutil@ifundefined{FPdiv}{% + \pgfmathfloattosci@\pgfmathfloat@arg + \immediate\write16{! Package pgf /pgf/number format/frac warning=true: /pgf/number format/frac of `\pgfmathresult' = \the\pgfmathresultnumerator\space / \the\pgfmathresultdenom\space might be large due to instabilities. Try \string\usepackage{fp} to improve accuracy.}% + }{}% + \fi + \fi + \else + % use target denominator: + \pgfmathresultdenom=\pgfmath@target@denominator\relax + \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \pgfmathfloattofixed\pgfmathresult + \pgf@xa=\pgfmathresult pt + \multiply\pgf@xa by\pgfmathresultdenom + \edef\pgfmathfloat@scaled@numerator{\pgf@sys@tonumber\pgf@xa}% + \expandafter\pgfmathfloat@loc@@to@int\pgfmathfloat@scaled@numerator\relax{\pgfmathresultnumerator}% + \fi + \ifpgfmathprintnumber@frac@whole + \else + \ifx\pgfmathfloat@wholenumber\pgfutil@empty + \else + \count0=\pgfmathfloat@wholenumber\relax + \multiply\count0 by\pgfmathresultdenom + \advance\pgfmathresultnumerator by\count0 + \def\pgfmathfloat@wholenumber{}% \fi \fi \ifnum\pgfmathfloat@a@S<0 - \edef\pgfmathresult{{-\pgfmathfloat@wholenumber}{\the\pgfmathresultcounter}{\the\pgfmathresultdenom}}% + \edef\pgfmathresult{{-\pgfmathfloat@wholenumber}{\the\pgfmathresultnumerator}{\the\pgfmathresultdenom}}% \else - \edef\pgfmathresult{{\pgfmathfloat@wholenumber}{\the\pgfmathresultcounter}{\the\pgfmathresultdenom}}% + \edef\pgfmathresult{{\pgfmathfloat@wholenumber}{\the\pgfmathresultnumerator}{\the\pgfmathresultdenom}}% \fi \fi \pgfmath@smuggleone\pgfmathresult @@ -1311,7 +1384,7 @@ \def\pgfmathprintnumber{% % \protect allows to supply \pgfmathprintnumber inside of latex % captions. The \csname yields \relax in case protect is undefined. - \csname protect\endcsname\pgfmathprintnumber@protected + \pgf@texdist@protect\pgfmathprintnumber@protected }% \def\pgfmathprintnumber@protected{% \pgfutil@ifnextchar[% @@ -1937,6 +2010,7 @@ \newif\ifpgfmathfloatparsenumberpendingperiod \def\pgfflt@EOI{p@EOI}% +\def\pgfflt@EOI@unexpanded{\pgfflt@EOI}% % Starts a finite-start-machine parser to read a number. % @@ -2193,16 +2267,16 @@ \def\pgfflt@readexponent#1\pgfflt@EOI{% \afterassignment\pgfflt@readexponent@ - \pgfmathfloat@b@E=#1\relax\pgfflt@EOI + \pgfmathfloat@b@E=#1 \pgfflt@EOI% the white space is important, otherwise \pgfflt@EOI will be expanded. } -\def\pgfflt@readexponent@{% +\def\pgfflt@readexponent@#1{% \advance\pgfmathfloat@a@E by\pgfmathfloat@b@E\relax - \afterassignment\pgfflt@readexponent@@ - \let\pgfmathfloat@loc@TMPb=}% -\def\pgfflt@readexponent@@#1\pgfflt@EOI{% - \ifx\pgfmathfloat@loc@TMPb\relax + % + % sanity checking: + \def\pgfmathfloat@loc@TMPb{#1}% + \ifx\pgfmathfloat@loc@TMPb\pgfflt@EOI@unexpanded \else - \def\pgfmathfloat@loc@TMPb{\pgfflt@error#1\pgfflt@EOI}% + \def\pgfmathfloat@loc@TMPb{\pgfflt@error#1}% \expandafter\pgfmathfloat@loc@TMPb \fi } diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathparse.opt.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathparse.opt.code.tex new file mode 100644 index 00000000000..e74d47c814e --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathparse.opt.code.tex @@ -0,0 +1,122 @@ +% A small optimization package which provides +% +% \beginpgfmathparsecheckfornumber +% ... +% \endpgfmathparsecheckfornumber +% +% in order to optimize \pgfmathparse. It works as follows: inside of +% the environment (which doesn't use scopes), \pgfmathparse is +% *replaced* by a different method which uses an extremely fast check +% to decide whether the input is a number number. Is so, it returns +% the number. Otherwise, it invokes the standard math parser. +% It is about 400% faster than \pgfmathparse if the argument *is* a +% number. +% +% The \endpgfmathparsecheckfornumber is optional (no groups are +% introduced) +% +% Copyright 2010 by Christian Feuersänger. +% +% Replaces \pgfmathparse by the fast number checker. +\def\beginpgfmathparsecheckfornumber{% + \let\pgfmathparse=\pgfmathparsehashedcheck +}% +\def\endpgfmathparsecheckfornumber{% + \let\pgfmathparse=\pgfmathparsehashedcheck@orig +}% + +\def\pgfmp@EOI{\pgfmp@EOI}% +\def\pgfmathparsehashedcheck@isnumber@gobble#1\pgfmp@EOI{} + +\newdimen\r@pgfmathparse@hashedcheck@ +\newcount\c@pgfmathparse@hashedcheck@ +\let\pgfmathparsehashedcheck@orig=\pgfmathparse + +\def\pgfmathparsehashedcheck#1{% + \edef\pgfmathparse@temp{#1}% + \expandafter\pgfmathparsehashedcheck@isnumber@loop\pgfmathparse@temp\pgfmp@EOI + \pgfmathparsehashedcheck@finalize{#1}% +}% +\def\pgfmathparsehashedcheck@finalize@isnonumber#1{% + \pgfmathparsehashedcheck@orig{#1}% + \let\pgfmathparsehashedcheck@finalize\pgfmathparsehashedcheck@finalize@isnumber +}% +\def\pgfmathparsehashedcheck@finalize@isnumber#1{% + \r@pgfmathparse@hashedcheck@=#1pt + \expandafter\pgfmathparsehashed@assign\the\r@pgfmathparse@hashedcheck@ + %-------------------------------------------------- + % % + % \let\KKK=\pgfmathresult + % \pgfmathparsehashedcheck@orig{#1}% + % \ifx\KKK\pgfmathresult + % \else + % \pgfplots@error{FAILED FOR #1: expected `\pgfmathresult'; got `\KKK' (temp = \pgf@temp)}% + % \fi + %-------------------------------------------------- +}% +{\catcode`\p=12\catcode`\t=12\gdef\PGF@TEMP{pt}} +\expandafter\def\expandafter\pgfmathparsehashed@assign\expandafter#\expandafter1\expandafter.\expandafter#\expandafter2\PGF@TEMP{% + \def\pgf@temp{#2}% + \ifx\pgf@temp0% + \def\pgfmathresult{#1}% + \else + \def\pgfmathresult{#1.#2}% + \fi +}% +\let\pgfmathparsehashedcheck@finalize\pgfmathparsehashedcheck@finalize@isnumber + +\expandafter\def\csname pgf@pp+\endcsname{1} +\expandafter\def\csname pgf@pp-\endcsname{1} +\expandafter\def\csname pgf@p0\endcsname{1} +\expandafter\def\csname pgf@p1\endcsname{1} +\expandafter\def\csname pgf@p2\endcsname{1} +\expandafter\def\csname pgf@p3\endcsname{1} +\expandafter\def\csname pgf@p4\endcsname{1} +\expandafter\def\csname pgf@p5\endcsname{1} +\expandafter\def\csname pgf@p6\endcsname{1} +\expandafter\def\csname pgf@p7\endcsname{1} +\expandafter\def\csname pgf@p8\endcsname{1} +\expandafter\def\csname pgf@p9\endcsname{1} +\expandafter\def\csname pgf@p.\endcsname{1} + +\pgfutil@ifundefined{ifcsname}{% + \def\pgfmathparsehashedcheck@isnumber@loop#1{% + \expandafter\ifx\csname pgf@pp\string#1\endcsname\relax + \expandafter\pgfmathparsehashedcheck@isnumber@loop + \else + \expandafter\pgfmathparsehashedcheck@isnumber@loop@\expandafter#1% + \fi + }% + \def\pgfmathparsehashedcheck@isnumber@loop@#1{% + \expandafter\ifx\csname pgf@p\string#1\endcsname\relax + \expandafter\pgfmathparsehashedcheck@isnumber@loop@ + \else + \expandafter\pgfmathparsehashedcheck@isnumber@endfalse\expandafter#1% + \fi + }% +}{% + \def\pgfmathparsehashedcheck@isnumber@loop#1{% + \ifcsname pgf@pp\string#1\endcsname + \expandafter\pgfmathparsehashedcheck@isnumber@loop + \else + \expandafter\pgfmathparsehashedcheck@isnumber@loop@\expandafter#1% + \fi + }% + \def\pgfmathparsehashedcheck@isnumber@loop@#1{% + \ifcsname pgf@p\string#1\endcsname + \expandafter\pgfmathparsehashedcheck@isnumber@loop@ + \else + \expandafter\pgfmathparsehashedcheck@isnumber@endfalse\expandafter#1% + \fi + }% +}% +\def\pgfmathparsehashedcheck@isnumber@endfalse#1{% + \ifx#1\pgfmp@EOI + \else + \let\pgfmathparsehashedcheck@finalize=\pgfmathparsehashedcheck@finalize@isnonumber + \expandafter\pgfmathparsehashedcheck@isnumber@gobble + \fi +}% + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty index 7814fb566f6..62c7709616a 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% @@ -50,6 +50,7 @@ \def\tikzsetnextfilename#1{\gdef\tikzexternal@nextfile{#1}} \def\tikzsetexternalprefix#1{\def\tikzexternal@filenameprefix{#1}} \def\tikzsetfigurename#1{\def\tikzexternal@figurename{#1}}% +\def\tikzappendtofigurename#1{\expandafter\def\expandafter\tikzexternal@figurename\expandafter{\tikzexternal@figurename #1}}% \tikzsetnextfilename{} \tikzsetexternalprefix{} \tikzsetfigurename{\tikzexternal@realjob-figure}% @@ -107,21 +108,57 @@ \fi \endgroup \global\let\tikzexternal@nextfile=\empty - \tikzexternalimage\tikzexternal@curfilename + \pgfincludeexternalgraphics\tikzexternal@curfilename }% -\def\tikzexternalimage#1{% - % now check for (optional) .dpth files for the 'baseline' option: +\def\tikzset#1{}\def\pgfkeys#1{}\def\pgfqkeys#1#2{} +\long\def\beginpgfgraphicnamed#1#2\endpgfgraphicnamed{\pgfincludeexternalgraphics{#1}} +\def\tikzifinpicture#1#2{#2} +\def\pgfincludeexternalgraphics#1{% \begingroup + \pgfexternalreaddpth{#1}% \setbox1=\hbox{\includegraphics{#1}}% - \openin1=#1.dpth - \ifeof1 \box1 + \ifdim\pgfretval=0pt + \box1 \else - \read1 to\pgfincludeexternalgraphics@dp \closein1 - \dimen0=\pgfincludeexternalgraphics@dp\relax - \hbox{\lower\dimen0\box1}% + \dimen0=\pgfretval\relax + \hbox{\lower\dimen0 \box1 }% \fi \endgroup } -\def\tikzset#1{}\def\pgfkeys#1{}\def\pgfqkeys#1#2{} -\long\def\beginpgfgraphicnamed#1#2\endpgfgraphicnamed{\tikzexternalimage{#1}} +\newread\r@pgf@reada +\def\pgfexternalreaddpth#1{% + \edef\pgfexternalreaddpth@restore{% + \noexpand\endlinechar=\the\endlinechar\space + \noexpand\catcode`\noexpand\@=\the\catcode`\@\space + }% + \def\pgfretval{0pt}% + \endlinechar=-1 % suppress white space at end + \catcode`\@=11 + \openin\r@pgf@reada=#1.dpth + \pgfincludeexternalgraphics@read@dpth + \pgfexternalreaddpth@restore +}% +\def\pgfincludeexternalgraphics@read@dpth{% + \ifeof\r@pgf@reada + \closein\r@pgf@reada + \else + \read\r@pgf@reada to\pgfincludeexternalgraphics@auxline + \ifx\pgfincludeexternalgraphics@auxline\empty + \else + \expandafter\pgfincludeexternalgraphics@read@dpth@line\pgfincludeexternalgraphics@auxline\pgfincludeexternalgraphics@read@dpth@line@EOI + \fi + \expandafter\pgfincludeexternalgraphics@read@dpth + \fi +}% +\long\def\pgfincludeexternalgraphics@read@dpth@line#1#2\pgfincludeexternalgraphics@read@dpth@line@EOI{% + \ifcat\noexpand#1\relax + \if@filesw + {\toks0={#1#2}% + \immediate\write\@auxout{\noexpand\def\noexpand\dpthimport{\the\toks0 }\noexpand\dpthimport }% + }% + \fi + \else% + \def\pgfretval{#1#2}% + \fi +}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternalshared.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternalshared.code.tex index 1e788bd5a27..95597ec23c3 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternalshared.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternalshared.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% @@ -148,7 +148,7 @@ mode/list only/.code = {\def\tikzexternal@opmode{3}\tikzexternal@genfigurelisttrue}, mode/convert with system call/.code={% \def\tikzexternal@opmode{4}% - \pgfkeysalso{/tikz/external/figure list=false,/pgf/images/aux in dpth=false}% + \pgfkeysalso{/tikz/external/figure list=false,/pgf/images/aux in dpth=true}% ATTENTION: this *can't* work if \label{} contains pictures! }, mode/list and make/.code = {% \def\tikzexternal@opmode{5}% @@ -159,6 +159,7 @@ % system call/.initial={pdflatex -interaction=batchmode -jobname '\image' '\texsource'; pdftops -eps \image.pdf}, force remake/.is if=tikzexternal@force@remake, force remake/.default=true, + failed ref warnings for/.initial={\ref,\cite,\pageref}, export next/.is if=tikzexternalexportnext, export/.is if=tikzexternal@export@enabled, remake next/.is if=tikzexternalremakenext, @@ -166,9 +167,38 @@ verbose IO/.is if=tikzexternal@verboseio, verbose IO/.default=true, verbose IO=true, - shell escape/.initial=-shell-escape, verbose optimize/.is if=tikzexternal@verbose@optimize, + verbose/.style={ + verbose IO=#1, + verbose optimize=#1, + }, + shell escape/.initial=-shell-escape, read main aux/.is if=pgfexternalreadmainaux, + image discarded text/.initial={% + [[ {\sc Image Discarded Due To} {\tt`/tikz/external/% + \ifcase\tikzexternal@opmode\relax + mode=only graphics% + \or + mode=no graphics% + \or + mode=graphics if exists% + \or + mode=list only% + \or + mode=convert with system call% + \or + mode=list and make% + \fi + '}~]]% + \pgfutil@ifundefined{tikzexternal@warning@at@end}{% + \pgfutil@ifundefined{AtEndDocument}{}{% + \AtEndDocument{% + \message{! Package tikz Warning: Some images are not up-to-date and need to be generated. }% + }% + }% + \gdef\tikzexternal@warning@at@end{1}% + }{}% + }, optimize/.is choice, optimize/true/.code={% \tikzexternal@optimizetrue @@ -241,6 +271,7 @@ } \def\tikzsetfigurename#1{\pgfkeyssetvalue{/tikz/external/figure name}{#1}}% +\def\tikzappendtofigurename#1{\pgfkeys{/tikz/external/figure name/.add={}{#1}}} % This method sets the file name prefix used for every import/export. % @@ -338,6 +369,9 @@ % inside of images. You will need to call the externalization command % manually. In this case, it should work. % +% The lock file allows to detect automatically whether an image is created by +% 'convert with system call' or if the user issued the required command manually. +% % @PRECONDITION : this command must be invoked AFTER % \tikzexternal@realjob has been defined but BEFORE \pgfrealjobname is % called. @@ -347,8 +381,12 @@ % with system call' if necessary. \def\tikzexternalauxlock@init{% \if4\tikzexternal@opmode + % mode=convert with system call \ifpgfexternalreadmainaux - % mode=convert with system call + % ohoh. This case needs care because the main.aux might + % not be ready at this time! + % check. + % \edef\pgf@tempa{\expandafter\string\csname\tikzexternal@realjob\endcsname}% \edef\pgf@tempb{\expandafter\string\csname\jobname\endcsname}% \ifx\pgf@tempa\pgf@tempb @@ -360,6 +398,8 @@ \tikzexternalauxlock@getlockvalue \if1\tikzexternallocked \pgfexternalreadmainauxfalse + % the main .aux file won't be read. Handle \ref commands: + \tikzexternalauxlock@handleref \else \pgfexternalreadmainauxtrue \fi @@ -397,6 +437,58 @@ \immediate\closeout\w@pgf@writea } + +% Installs a special \ref{} command such that externalized pictures +% can use \ref and the user gets a warning if something fails. +% +% The special \ref handling is installed for every reference command +% in the list '/tikz/external/failed ref warnings for' which contains +% '\ref,\pageref,\cite'. +% +% For use in the aux lock handling only. +\def\tikzexternalauxlock@handleref{% + \let\pgf@external@grab@refundefinedtrue=\pgf@external@grab@refundefinedtrue@orig + % + \pgfkeysgetvalue{/tikz/external/failed ref warnings for}\tikzexternal@temp + \expandafter\tikzexternalauxlock@handleref@loop\tikzexternal@temp,\@EOI,% +} +\def\tikzexternalauxlock@handleref@loop#1,{% + \def\tikzexternal@temp{#1}% + \ifx\tikzexternal@temp\pgfutil@empty + \expandafter\tikzexternalauxlock@handleref@loop + \else + \ifx#1\@EOI + \else + \expandafter\let\csname tikzexternalauxlock@handleref@orig@\string#1\endcsname=#1% + \def#1{\tikzexternalauxlock@handleref@repl{#1}}% + \expandafter\expandafter\expandafter\tikzexternalauxlock@handleref@loop + \fi + \fi +}% +\def\tikzexternalauxlock@handleref@repl#1{\pgfutil@ifnextchar[{\tikzexternalauxlock@handleref@repl@{#1}}{\tikzexternalauxlock@handleref@repl@{#1}[]}}% +\def\tikzexternalauxlock@handleref@repl@#1[#2]#3{% + \csname tikzexternalauxlock@handleref@orig@\string#1\endcsname{#3}% + \begingroup + \def\n{\pgfexternal@hat\pgfexternal@hat J}% + \tikzexternal@assemble@systemcall{\pgfactualjobname}{\pgf@tempa}% + \def\space{\noexpand\space}% + \pgfexternalstorecommand{% + \noexpand\begingroup + \noexpand\toks0={\pgf@tempa}% + \noexpand\immediate\noexpand\write16{\tikzexternalauxlock@handleref@warning{#3}{\noexpand\the\noexpand\toks0}}% + \noexpand\G@refundefinedtrue + \noexpand\endgroup + }% + \endgroup +}% +\def\tikzexternalauxlock@handleref@warning#1#2{% + \n + LaTeX Warning: Reference `#1' in external picture `\pgfactualjobname' could not be resolved\noexpand\on@line.\n + This is because the \tikzexternal@realjob.aux file is not accessable in this context, you will need to issue the externalize command\n + \space\space\space#2\n + manually.\n% +} + % Expands to the default image extension (it is set by % \tikzexternalize). % @@ -886,38 +978,6 @@ \fi }% -\def\tikzexternal@externalizefig@GRAB{% - \iftikzexternal@optimize - \ifpgf@external@grabshipout - \tikzexternal@optimize@RESTORE - \fi - \fi - \def\tikzpicture{% - \def\tikzpicture{% make sure that nested \tikzpicture are processed normally. - \begingroup - \def\endtikzpicture{% - \tikzexternal@origendpicture - \endgroup - }% - \tikzexternal@origpicture - }% - \pgf@external@grab{\tikzexternal@curfilename}% - \tikzexternal@origpicture - }% - \def\endtikzpicture{% - \tikzexternal@origendpicture - \pgf@externalend - \let\tikzpicture=\tikzexternal@tikzpicture@replacement - \let\endtikzpicture=\tikzexternal@origendpicture - \iftikzexternal@optimize - \ifpgf@external@grabshipout - \tikzexternal@optimize@REPLACE - \fi - \fi - }% - \tikzpicture -}% - % Used by the optimization code. % It will be called if GRAB mode is on. @@ -1097,21 +1157,7 @@ \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@listmodepicture@@ } \long\def\tikzexternal@listmodepicture@@#1{% - [[ {\sc Image Discarded Due To} {\tt`/tikz/external/% - \ifcase\tikzexternal@opmode\relax - mode=only graphics% - \or - mode=no graphics% - \or - mode=graphics if exists% - \or - mode=list only% - \or - mode=convert with system call% - \or - mode=list and make% - \fi - '}~]]% + \pgfkeysvalueof{/tikz/external/image discarded text}% \tikzexternal@closeenvironments } @@ -1323,7 +1369,30 @@ \xdef\pgf@tempa{\noexpand\pgf@findfile\pgfsys@imagesuffixlist:+{\tikzexternal@curfilename}}% \pgf@tempa \ifx\pgf@filename\pgfutil@empty% - \PackageError{tikz}{Sorry, the system call '#1' did NOT result in a usable output file '\tikzexternal@curfilename' (expected one of \pgfsys@imagesuffixlist). Please verify that you have enabled system calls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes it is also named 'write 18' or something like that. Or maybe the command simply failed? Error messages can be found in '\tikzexternal@curfilename.log'. If you continue now, I'll try to typeset the picture.}% + \PackageError{tikz}{Sorry, the system call '#1' did NOT result in a usable output file '\tikzexternal@curfilename' (expected one of \pgfsys@imagesuffixlist). Please verify that you have enabled system calls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes it is also named 'write 18' or something like that. Or maybe the command simply failed? Error messages can be found in '\tikzexternal@curfilename.log'. If you continue now, I'll try to typeset the picture}% \fi }% +% Overwrite error message of pgf. +% This happens if the generated image was empty, i.e. if there was no \shipout. +\def\pgfexternal@error@no@shipout{% + \begingroup + \tikzexternal@assemble@systemcall{\pgfactualjobname}{\pgf@tempa}% + \toks0=\expandafter{\pgf@tempa}% + \PackageError{tikz}{Sorry, image externalization failed: the resulting image was EMPTY. I tried to externalize '\pgfactualjobname', but it seems there is no such image in the document!? + \if\tikzexternal@opmode4 ^^J +\space\space You are currently using 'mode=convert with system call'. This problem can happen if the image (or one of the images preceeding it) was declared inside of a \string\label{} (i.e. in the .aux file): 'convert with system call' has no access to the main aux file.^^J +\space\space Possible solutions in this case:^^J +\space\space a) Try using 'mode=list and make',^^J +\space\space b) Issue the externalization command '\the\toks0' *manually* (also check the preceeding externalized images, perhaps the file name sequence is not correct).^^J +\space\space Repeat: the resulting image was EMPTY, your attention is required +\else + \if\tikzexternal@opmode5 ^^J +\space\space You are currently using 'mode=list and make'. Possible solutions:^^J +\space\space a) Try to delete `\tikzexternal@realjob.makefile'. Perhaps it is not up-to-date.^^J +\space\space b) Perhaps pictures are declared inside of \string\label{} and the .aux file is not up-to-date. Re-run latex, perhaps re-generate the graphics as well.^^J +\space\space Repeat: the resulting image was EMPTY, your attention is required + \fi +\fi}% + \endgroup +}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex index a850f7f3608..0983f904866 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex index bcc43c4051e..14e4d2e9c3d 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex @@ -50,6 +50,7 @@ \newif\ifpgfplots@axis@equal \newif\ifpgfplots@axis@equal@image \newif\ifpgfplots@reverse@legend +\newif\ifpgfplots@transpose@legend \newif\ifpgfplots@allow@reversal@of@rel@axis@cs \newif\ifpgfplots@scanline@verbose \newcount\pgfplots@numplots @@ -240,6 +241,17 @@ } } +\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@center\endcsname{1} +\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@south west\endcsname{1} +\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@south\endcsname{1} +\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@south east\endcsname{1} +\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@east\endcsname{1} +\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@north east\endcsname{1} +\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@north\endcsname{1} +\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@north west\endcsname{1} +\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@west\endcsname{1} +\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@baseline\endcsname{1} + % Sets the keys for /pgfplots/[xyz]ticklabel anchor. % #1: one of [xyz] % #2: the value @@ -409,6 +421,50 @@ \pgfplots@cycle@multi@list@finalize@ }% +\def\pgfplots@pgfkeys@set@point@meta@value#1{% + % + \pgfutil@in@{=}{#1}% + \ifpgfutil@in@ + \def\pgfplots@loc@TMPa##1=##2\pgfplots@EOI{% + % remove spaces from ##1 and ##2: + \pgfkeys@spdef\pgfplots@loc@TMPa{##1}% + \pgfkeys@spdef\pgfplots@loc@TMPb{##2}% + % + % check if the argument is known: + \pgfkeysifdefined{/pgfplots/point meta/\pgfplots@loc@TMPa/.@cmd}{% + \def\pgfplots@loc@TMPc{% + \pgfplots@invoke@pgfkeyscode{/pgfplots/point meta/\pgfplots@loc@TMPa/.@cmd}% + }% + \expandafter\pgfplots@loc@TMPc\expandafter{\pgfplots@loc@TMPb}% + }{% + \pgfplotsthrow{invalid argument} + {\pgfplots@loc@TMPa}% + {Sorry, `##1' is no valid choice for `point meta'. Maybe you misspelled it?}% + \pgfeov + }% + }% + % disassemble key'='value: + \pgfplots@loc@TMPa#1\pgfplots@EOI + \else + % the following code allows + % 'point meta=\thisrow{xcol}' even though + % \thisrow might be undefined in the context where keys are set. + % I convert the argument to a string. + \def\pgfplots@loc@TMPa{#1}% + \pgfplots@command@to@string\pgfplots@loc@TMPa\pgfplots@loc@TMPb + % + \pgfkeysifdefined{/pgfplots/point meta/\pgfplots@loc@TMPb/.@cmd}{% + % ok, use it! + \pgfplots@invoke@pgfkeyscode{/pgfplots/point meta/\pgfplots@loc@TMPb/.@cmd}{}% + }{% + % oh, then it will be a math expression. + \pgfplots@invoke@pgfkeyscode{/pgfplots/point meta/expr/.@cmd}{#1}% + }% + \fi + % + % +}% + \pgfkeys{% /pgfplots/search path for tikz/.search also={/tikz,/pgfplots}, /pgfplots/.is family, @@ -664,8 +720,14 @@ % Colorbar interface: /pgfplots/colorbar/.is if=pgfplots@colorbar, /pgfplots/colorbar/.default=true, + /pgfplots/colorbar to label/.style={/pgfplots/colorbar to name={#1}}, + /pgfplots/colorbar to name/.initial=, + /pgfplots/colorbar source/.code={\pgfplots@error{Sorry, you can only set `colorbar source' inside of \string\addplot\space (or a cycle list)}}, + /pgfplots/colorbar source/.default=true, + /pgfplots/colorbar pos*/.initial=,% one of 'rltb' (right, left, top, bottom). for internal use, to handle checks. /pgfplots/colorbar right/.style={% /pgfplots/colorbar=true, + /pgfplots/colorbar pos*=r, /pgfplots/colorbar shift/.style={xshift=0.3cm}, /pgfplots/every colorbar/.style={% title=, @@ -688,26 +750,28 @@ enlargelimits=false, scale only axis, height=\pgfkeysvalueof{/pgfplots/parent axis height},% - x=\pgfkeysvalueof{/pgfplots/colorbar/width}, + width=\pgfkeysvalueof{/pgfplots/colorbar/width}, xtick=\empty, xticklabel=, ytick=, yticklabel=, - yticklabel pos=right, + yticklabel pos=right,% ATTENTION: I check for this setting in 'colorbar sampled line', see below! colorbar vertical/lowlevel, }% },% /pgfplots/colorbar left/.style={% /pgfplots/colorbar right, + /pgfplots/colorbar pos*=l, /pgfplots/colorbar shift/.style={xshift=-0.3cm}, /pgfplots/every colorbar/.append style={% at={(parent axis.left of north west)}, anchor=north east, - yticklabel pos=left, + yticklabel pos=left,% ATTENTION: I check for this setting in 'colorbar sampled line', see below! }% },% /pgfplots/colorbar horizontal/.style={% /pgfplots/colorbar=true, + /pgfplots/colorbar pos*=b, /pgfplots/colorbar shift/.style={yshift=-0.3cm}, /pgfplots/every colorbar/.style={% title=, @@ -730,7 +794,7 @@ enlargelimits=false, scale only axis, width=\pgfkeysvalueof{/pgfplots/parent axis width},% - y=\pgfkeysvalueof{/pgfplots/colorbar/width}, + height=\pgfkeysvalueof{/pgfplots/colorbar/width}, xticklabel pos=left, xtick=, xticklabel=, @@ -743,6 +807,7 @@ % styles is incompatible with '.add code' -- and therefor also % with '.append style'. This here is a work-around which works. /pgfplots/colorbar vertical/lowlevel/.style={% + /pgfplots/colorbar addplot=\addplot graphics {};, plot graphics/lowlevel draw/.code 2 args={% \if\pgfkeysvalueof{/pgfplots/y dir/value}n% \pgfplotscolormaptoshadingspec{\pgfkeysvalueof{/pgfplots/colormap name}}{##2}\pgfplots@loc@TMPa @@ -755,6 +820,7 @@ },% }, /pgfplots/colorbar horizontal/lowlevel/.style={% + /pgfplots/colorbar addplot=\addplot graphics {};, plot graphics/lowlevel draw/.code 2 args={% \if\pgfkeysvalueof{/pgfplots/x dir/value}n% \pgfplotscolormaptoshadingspec{\pgfkeysvalueof{/pgfplots/colormap name}}{##1}\pgfplots@loc@TMPa @@ -770,11 +836,90 @@ /pgfplots/colorbar=false, /pgfplots/colorbar style/.style={/pgfplots/every colorbar/.append style={#1}}, /pgfplots/colorbar/width/.initial=0.5cm, + /pgfplots/colorbar addplot/.initial=\addplot graphics {};, /pgfplots/colorbar/draw/.code={% + % FIXME : the semicolon after ';' has a fixed catcode, namely + % the one assigned while pgfplots.code.tex has been read. + % + % The \pgfplots@checkandpreparefor@active@semicolon gets + % confused if the catcodes change... this here is a + % work-around for babel support. + \let\pgfplots@checkandpreparefor@active@semicolon=\relax \axis[every colorbar,colorbar shift,colorbar=false] - \addplot graphics {}; + \pgfkeysvalueof{/pgfplots/colorbar addplot}% \endaxis },% + /pgfplots/every colorbar sampled line/.style={help lines}, + /pgfplots/colorbar sampled line style/.style={/pgfplots/every colorbar sampled line/.append style={#1}}, + /pgfplots/colorbar sampled line/.style={% + colorbar, + /pgfplots/colorbar/draw/.code={% + \axis[ + cycle list={#1\\}, + domain=\pgfkeysvalueof{/pgfplots/point meta min}:\pgfkeysvalueof{/pgfplots/point meta max}, + every colorbar,colorbar shift,colorbar=false] + \pgfkeysvalueof{/pgfplots/colorbar addplot}% + \endaxis + },% + /pgfplots/colorbar horizontal/lowlevel/.code={% + \pgfkeysgetvalue{/pgfplots/colorbar pos*}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \def\pgfplots@loc@TMPa{b}% + \fi + \if b\pgfplots@loc@TMPa + \pgfkeysalso{axis x line*=bottom}% DEFAULT. + \else + \pgfkeysalso{axis x line*=top}% + \fi + \pgfkeysalso{% + y axis line style={/pgfplots/every colorbar sampled line}, + /pgfplots/colorbar addplot={\addplot {0.5};}, + point meta=x, + }% + },% + /pgfplots/colorbar vertical/lowlevel/.code={% + \pgfkeysgetvalue{/pgfplots/colorbar pos*}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \def\pgfplots@loc@TMPa{r}% + \fi + \if l\pgfplots@loc@TMPa + \pgfkeysalso{axis y line*=left}% + \else + \pgfkeysalso{axis y line*=right}% DEFAULT + \fi + \pgfkeysalso{% + x axis line style={/pgfplots/every colorbar sampled line}, + /pgfplots/colorbar addplot={\addplot (0.5,x);}, + point meta=y, + }% + },% + },% + /pgfplots/colorbar sampled line/.default={scatter,only marks}, + % + /pgfplots/colorbar sampled/.style={% + colorbar, + /pgfplots/colorbar/draw/.code={% + \axis[ + view={0}{90}, + cycle list={#1\\}, + domain=\pgfkeysvalueof{/pgfplots/point meta min}:\pgfkeysvalueof{/pgfplots/point meta max}, + samples y=2, + domain y=0:1, + zmin=0,zmax=1, + every colorbar,colorbar shift,colorbar=false] + \pgfkeysvalueof{/pgfplots/colorbar addplot}% + \endaxis + },% + /pgfplots/colorbar horizontal/lowlevel/.style={% + /pgfplots/colorbar addplot={\addplot3 {0};}, + point meta=x, + },% + /pgfplots/colorbar vertical/lowlevel/.style={% + /pgfplots/colorbar addplot={\addplot3 (y,x,0);}, + point meta=y, + },% + },% + /pgfplots/colorbar sampled/.default={surf,mark=none,shader=flat}, % tick options: /pgfplots/xticklabel/.store in= \pgfplots@xticklabel, /pgfplots/xticklabel/.belongs to family=/pgfplots/tick, @@ -1259,12 +1404,18 @@ % legend options: /pgfplots/legend entries/.initial={}, /pgfplots/legend entries/.belongs to family=/pgfplots/legend, + /pgfplots/legend to label/.style={/pgfplots/legend to name={#1}}, + /pgfplots/legend to name/.initial=,% /pgfplots/legend pos/.is choice, /pgfplots/legend pos/south west/.style={/pgfplots/legend style={at={(0.03,0.03)},anchor=south west}}, /pgfplots/legend pos/south east/.style={/pgfplots/legend style={at={(0.97,0.03)},anchor=south east}}, /pgfplots/legend pos/north west/.style={/pgfplots/legend style={at={(0.03,0.97)},anchor=north west}}, /pgfplots/legend pos/north east/.style={/pgfplots/legend style={at={(0.97,0.97)},anchor=north east}}, /pgfplots/legend pos/outer north east/.style={/pgfplots/legend style={at={(1.03,1)},anchor=north west}}, + /pgfplots/legend cell align/.is choice, + /pgfplots/legend cell align/left/.style= {/pgfplots/legend style={cells={anchor=west}}}, + /pgfplots/legend cell align/right/.style= {/pgfplots/legend style={cells={anchor=east}}}, + /pgfplots/legend cell align/center/.style= {/pgfplots/legend style={cells={anchor=center}}}, /pgfplots/legend columns/.store in=\pgfplots@legend@columns, /pgfplots/legend columns/.belongs to family=/pgfplots/legend, /pgfplots/legend columns=1, @@ -1278,6 +1429,8 @@ /pgfplots/legend plot pos/none/.belongs to family=/pgfplots/legend, /pgfplots/legend plot pos=left, /pgfplots/every legend image post/.code={},% + /pgfplots/legend image post style/.style={/pgfplots/every legend image post/.append style={#1}}, + /pgfplots/empty legend/.style={/pgfplots/legend image code/.code=}, /pgfplots/line legend/.style={% /pgfplots/legend image code/.code={% \draw[mark repeat=2,mark phase=2,##1] @@ -1292,6 +1445,10 @@ /pgfplots/legend image code/.belongs to family=/pgfplots/legend, /pgfplots/reverse legend/.is if=pgfplots@reverse@legend, /pgfplots/reverse legend/.default=true, + /pgfplots/transpose legend/.is if=pgfplots@transpose@legend, + /pgfplots/transpose legend/.default=true, + /pgfplots/legend transposed/.style={transpose legend=#1}, + /pgfplots/legend reversed/.style={reverse legend=#1}, % axis description options: /pgfplots/title/.initial=, /pgfplots/xlabel/.initial=, @@ -1313,6 +1470,22 @@ \pgfplots@assert@tikzinternal@exists{tikz@scan@one@point}% \tikz@scan@one@point\pgfplots@set@at#1}, /pgfplots/at/.belongs to family=/pgfplots, + /pgfplots/trim axis left/.code={% + \pgfutil@ifundefined{pgfsettrimleft}{% + \pgfplots@error{Sorry, the 'trim axis left' requires a more recent PGF version. At the time of this writing, only the experimental PGF version available from texexample.net supports it.}% + }{% + \pgfkeysalso{/tikz/trim left=(current axis.south west)}% + }% + },% + /tikz/trim axis left/.style={/pgfplots/trim axis left}, + /pgfplots/trim axis right/.code={% + \pgfutil@ifundefined{pgfsettrimleft}{% + \pgfplots@error{Sorry, the 'trim axis right' requires a more recent PGF version. At the time of this writing, only the experimental PGF version available from texexample.net supports it.}% + }{% + \pgfkeysalso{/tikz/trim right=(current axis.south east)}% + }% + },% + /tikz/trim axis right/.style={/pgfplots/trim axis right}, /pgfplots/clip limits/.is if=pgfplots@clip@limits, /pgfplots/clip limits/.default=true, /pgfplots/clip limits=true, @@ -1324,29 +1497,17 @@ /pgfplots/axis equal/.default=true, /pgfplots/axis equal image/.is if=pgfplots@axis@equal@image, /pgfplots/axis equal image/.default=true, - /pgfplots/xmin/.belongs to family=/pgfplots, /pgfplots/xmin/.initial=, - /pgfplots/xmax/.belongs to family=/pgfplots, /pgfplots/xmax/.initial=, - /pgfplots/ymin/.belongs to family=/pgfplots, /pgfplots/ymin/.initial=, - /pgfplots/ymax/.belongs to family=/pgfplots, /pgfplots/ymax/.initial=, - /pgfplots/zmin/.belongs to family=/pgfplots, /pgfplots/zmin/.initial=, - /pgfplots/zmax/.belongs to family=/pgfplots, /pgfplots/zmax/.initial=, - /pgfplots/xtickmin/.belongs to family=/pgfplots, /pgfplots/xtickmin/.initial=, - /pgfplots/xtickmax/.belongs to family=/pgfplots, /pgfplots/xtickmax/.initial=, - /pgfplots/ytickmin/.belongs to family=/pgfplots, /pgfplots/ytickmin/.initial=, - /pgfplots/ytickmax/.belongs to family=/pgfplots, /pgfplots/ytickmax/.initial=, - /pgfplots/ztickmin/.belongs to family=/pgfplots, /pgfplots/ztickmin/.initial=, - /pgfplots/ztickmax/.belongs to family=/pgfplots, /pgfplots/ztickmax/.initial=, /pgfplots/stack plots/.is choice, /pgfplots/stack plots/.belongs to family=/pgfplots, @@ -1379,19 +1540,28 @@ /pgfplots/z filter/.code={}, /pgfplots/z filter/.belongs to family=/pgfplots, /pgfplots/filter point/.code=, - /pgfplots/restrict x to domain/.style={/pgfplots/@restrict to domain={x}{}{#1}},% - /pgfplots/restrict y to domain/.style={/pgfplots/@restrict to domain={y}{}{#1}},% - /pgfplots/restrict z to domain/.style={/pgfplots/@restrict to domain={z}{}{#1}},% - /pgfplots/restrict expr to domain/.style 2 args={/pgfplots/@restrict to domain={x}{#1}{#2}},% + /pgfplots/restrict x to domain/.style={/pgfplots/@restrict to domain={x}{}{#1}{0}},% + /pgfplots/restrict y to domain/.style={/pgfplots/@restrict to domain={y}{}{#1}{0}},% + /pgfplots/restrict z to domain/.style={/pgfplots/@restrict to domain={z}{}{#1}{0}},% + /pgfplots/restrict expr to domain/.style 2 args={/pgfplots/@restrict to domain={x}{#1}{#2}{0}},% + /pgfplots/restrict x to domain*/.style={/pgfplots/@restrict to domain={x}{}{#1}{1}},% + /pgfplots/restrict y to domain*/.style={/pgfplots/@restrict to domain={y}{}{#1}{1}},% + /pgfplots/restrict z to domain*/.style={/pgfplots/@restrict to domain={z}{}{#1}{1}},% + /pgfplots/restrict expr to domain*/.style 2 args={/pgfplots/@restrict to domain={x}{#1}{#2}{1}},% % '#1': the filter to install % '#2': a mathematical expression (or empty) % '#3': the interval. must be numeric currently. - /pgfplots/@restrict to domain/.code args={#1#2#3}{% - \edef\pgfplots@loc@TMPa{#3}% + % '#4': bAssignLimits=0|1. if #4=1, any coordinate outside of the + % allowed domain will take the domain boundary as value. If #4=0, + % any coordinate outside of the allowed domain will get 'inf' or + % '-inf'. + /pgfplots/@restrict to domain/.code args={#1#2#3#4}{% + \if0#4% + \pgfkeysalso{/pgfplots/unbounded coords=jump}% + \fi % when invoked, ##1 and ##2 will be floats: \def\pgfplots@loc@TMPb##1:##2\relax{% \pgfkeysalso{% - /pgfplots/unbounded coords=jump,% /pgfplots/#1 filter/.append code={% \let\pgfplots@restrict@to@domain@orig=\pgfmathresult \def\pgfplots@restrict@to@domain@tmp{#2}% @@ -1405,11 +1575,11 @@ \let\pgfplots@restrict@to@domain@tmp=\pgfmathresult \pgfmathfloatlessthan@{\pgfplots@restrict@to@domain@tmp}{##1}% ##1 is the lower argument \ifpgfmathfloatcomparison - \def\pgfmathresult{inf}% + \edef\pgfmathresult{\if0#4inf\else ##1\fi}% \else \pgfmathfloatgreaterthan@{\pgfplots@restrict@to@domain@tmp}{##2}% \ifpgfmathfloatcomparison - \def\pgfmathresult{-inf}% + \edef\pgfmathresult{\if0#4-inf\else ##2\fi}% \else \let\pgfmathresult=\pgfplots@restrict@to@domain@orig \fi @@ -1425,10 +1595,11 @@ \edef\pgfplots@loc@TMPc{\pgfplots@rangea:\pgfmathresult}% \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPc\relax }% + \edef\pgfplots@loc@TMPa{#3}% \expandafter\pgfplots@loc@TMPc\pgfplots@loc@TMPa\relax },% % -> keeps only the nth point, all other ones will get ''. - /pgfplots/each nth point/.style 2 args={% + /pgfplots/each nth point/.style={% /pgfplots/x filter/.append code={% \ifnum\coordindex=0 \def\c@pgfplots@eachnthpoint@xfilter{0}% @@ -1453,6 +1624,9 @@ \fi} }, /pgfplots/translate gnuplot/.is if=pgfplots@translategnuplot, + /pgfplots/gnuplot writes logscale/.is choice, + /pgfplots/gnuplot writes logscale/true/.code={\gdef\pgfplots@gnuplot@logscale@writes@log{1}},% + /pgfplots/gnuplot writes logscale/false/.code={\gdef\pgfplots@gnuplot@logscale@writes@log{0}},% /pgfplots/parametric/var 2d/.initial={\u,\v}, /pgfplots/parametric/var 1d/.initial=\t, /pgfplots/xfilter/.initial=,% DEPRECATED @@ -1503,6 +1677,7 @@ /pgfplots/enlarge z limits=#1,% },% /pgfplots/enlargelimits/.default=true, + /pgfplots/update limits/.is if=pgfplots@bb@isactive, /pgfplots/x/.initial=,% is implicitly set by 'width' and/or '\axisdefaultwidth' /pgfplots/x/.belongs to family=/pgfplots, /pgfplots/y/.initial=,% is implicitly set by 'width' and/or '\axisdefaultwidth' @@ -1544,6 +1719,7 @@ }, /pgfplots/cycle list name/.belongs to family=/pgfplots, /pgfplots/cycle list name=color, + /pgfplots/cycle list shift/.initial=, % accepts arguments of the form % <first list spec>\nextlist <second list spec>\nextlist .... % where each list spec is EITHER a cycle list name OR a cycle list @@ -1936,43 +2112,30 @@ % crunch = 1 % open = 2 /pgfplots/axis x discontinuity/.is choice, - /pgfplots/axis x discontinuity/.belongs to family=/pgfplots, %/axis, /pgfplots/axis x discontinuity/none/.code ={\def\pgfplots@xaxisdiscontnum{0}}, - /pgfplots/axis x discontinuity/none/.belongs to family=/pgfplots, %/axis, /pgfplots/axis x discontinuity/crunch/.code ={\def\pgfplots@xaxisdiscontnum{1}}, - /pgfplots/axis x discontinuity/crunch/.belongs to family=/pgfplots, %/axis, /pgfplots/axis x discontinuity/parallel/.code ={\def\pgfplots@xaxisdiscontnum{2}}, - /pgfplots/axis x discontinuity/parallel/.belongs to family=/pgfplots, %/axis, /pgfplots/axis x discontinuity=none, % set \pgfplots@yaxisdiscontnum % none = 0 % crunch = 1 % open = 2 /pgfplots/axis y discontinuity/.is choice, - /pgfplots/axis y discontinuity/.belongs to family=/pgfplots, %/axis, /pgfplots/axis y discontinuity/none/.code ={\def\pgfplots@yaxisdiscontnum{0}}, - /pgfplots/axis y discontinuity/none/.belongs to family=/pgfplots, %/axis, /pgfplots/axis y discontinuity/crunch/.code ={\def\pgfplots@yaxisdiscontnum{1}}, - /pgfplots/axis y discontinuity/crunch/.belongs to family=/pgfplots, %/axis, /pgfplots/axis y discontinuity/parallel/.code ={\def\pgfplots@yaxisdiscontnum{2}}, - /pgfplots/axis y discontinuity/parallel/.belongs to family=/pgfplots, %/axis, /pgfplots/axis y discontinuity=none, % set \pgfplots@yaxisdiscontnum % none = 0 % crunch = 1 % open = 2 /pgfplots/axis z discontinuity/.is choice, - /pgfplots/axis z discontinuity/.belongs to family=/pgfplots, %/axis, /pgfplots/axis z discontinuity/none/.code ={\def\pgfplots@zaxisdiscontnum{0}}, - /pgfplots/axis z discontinuity/none/.belongs to family=/pgfplots, %/axis, /pgfplots/axis z discontinuity/crunch/.code ={\def\pgfplots@zaxisdiscontnum{1}}, - /pgfplots/axis z discontinuity/crunch/.belongs to family=/pgfplots, %/axis, /pgfplots/axis z discontinuity/parallel/.code ={\def\pgfplots@zaxisdiscontnum{2}}, - /pgfplots/axis z discontinuity/parallel/.belongs to family=/pgfplots, %/axis, /pgfplots/axis z discontinuity=none, /pgfplots/scale only axis/.is if=pgfplots@scale@only@axis, /pgfplots/scale only axis/.default=true, - /pgfplots/scale only axis/.belongs to family=/pgfplots, /pgfplots/scale only axis=false, % sets \pgfplots@xislinear to % normal=true @@ -2137,6 +2300,13 @@ \def\pgfplots@nodes@near@coords@align{above}% }% \fi + \else + \pgfutil@ifundefined{pgfplots@nodesnearcoordsalign@isanchor@\pgfplots@nodes@near@coords@align} + {}% + {% + \t@pgfplots@toka=\expandafter{\pgfplots@nodes@near@coords@align}% + \edef\pgfplots@nodes@near@coords@align{anchor=\the\t@pgfplots@toka}% + }% \fi \fi % ok, place the node. @@ -2146,7 +2316,7 @@ {% \if1\csname pgfpmeta@\pgfplotspointmetainputhandler @issymbolic\endcsname% % point meta=explicit symbolic - % do no try to invoke \pgfmathprintnumber on + % do not try to invoke \pgfmathprintnumber on % symbolic data... this check should keep the user % interface simpler. \def\pgfplots@loc@TMPa{\pgfmathprintnumber\pgfplotspointmeta}% @@ -2192,9 +2362,9 @@ /pgf/bar shift={% % total width = n*w + (n-1)*skip % -> subtract half for centering - -0.5*(\numplots*\pgfplotbarwidth + (\numplots-1)*#1) + + -0.5*(\numplotsofactualtype*\pgfplotbarwidth + (\numplotsofactualtype-1)*#1) + % the '0.5*w' is for centering - (.5+\plotnum)*\pgfplotbarwidth + \plotnum*#1},% + (.5+\plotnumofactualtype)*\pgfplotbarwidth + \plotnumofactualtype*#1},% /pgfplots/error bars/draw error bar/.code 2 args={% % FIXME: simplify this code! It is just a replication of the default error stuff together with an xshift! \pgfkeysgetvalue{/pgfplots/error bars/error mark}{\pgfplotserrorbarsmark}% @@ -2210,7 +2380,6 @@ /tikz/ybar, }, /pgfplots/ybar/.default=2pt, - /pgfplots/ybar/.belongs to family=/pgfplots, /pgfplots/xbar legend/.style={ /pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,bar width=3pt,yshift=-0.2em,bar shift=0pt] plot coordinates {(0cm,0.8em) (2*\pgfplotbarwidth,0.6em)};}, }, @@ -2222,9 +2391,9 @@ /pgf/bar shift={% % total width = n*w + (n-1)*skip % -> subtract half for centering - -0.5*(\numplots*\pgfplotbarwidth + (\numplots-1)*#1) + + -0.5*(\numplotsofactualtype*\pgfplotbarwidth + (\numplotsofactualtype-1)*#1) + % the '0.5*w' is for centering - (.5+\plotnum)*\pgfplotbarwidth + \plotnum*#1},% + (.5+\plotnumofactualtype)*\pgfplotbarwidth + \plotnumofactualtype*#1},% /pgfplots/error bars/draw error bar/.code 2 args={% % FIXME: simplify this code! It is just a replication of the default error stuff together with an xshift! \pgfkeysgetvalue{/pgfplots/error bars/error mark}{\pgfplotserrorbarsmark}% @@ -2240,7 +2409,6 @@ /tikz/xbar, }, /pgfplots/xbar/.default=2pt, - /pgfplots/xbar/.belongs to family=/pgfplots, /pgfplots/ybar interval legend/.style={ /pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,yshift=-0.2em,bar interval width=0.7,bar interval shift=0.5] plot coordinates {(0cm,0.8em) (5pt,0.6em) (10pt,0.6em)};}, }, @@ -2252,12 +2420,11 @@ xtick align=outside, xtick=data, ybar interval legend, - bar interval width={#1/\numplots}, - bar interval shift={(\plotnum+0.5)/\numplots}, + bar interval width={#1/\numplotsofactualtype}, + bar interval shift={(\plotnumofactualtype+0.5)/\numplotsofactualtype}, /tikz/ybar interval, }, /pgfplots/ybar interval/.default=1, - /pgfplots/ybar interval/.belongs to family=/pgfplots, /pgfplots/xbar interval legend/.style={% /pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,yshift=-0.2em,bar interval width=0.7,bar interval shift=0.5] plot coordinates {(0cm,0.8em) (5pt,0.6em) (10pt,0.6em)};}, }, @@ -2269,12 +2436,11 @@ ymajorgrids, ytick align=outside, xbar interval legend, - bar interval width={#1/\numplots}, - bar interval shift={(\plotnum+0.5)/\numplots}, + bar interval width={#1/\numplotsofactualtype}, + bar interval shift={(\plotnumofactualtype+0.5)/\numplotsofactualtype}, /tikz/xbar interval, }, /pgfplots/xbar interval/.default=1, - /pgfplots/xbar interval/.belongs to family=/pgfplots, /pgfplots/xbar stacked/.style={ /pgfplots/set point meta if empty=x,% bar cycle list, @@ -2283,7 +2449,6 @@ /tikz/xbar, }, /pgfplots/xbar stacked/.default=plus, - /pgfplots/xbar stacked/.belongs to family=/pgfplots, /pgfplots/ybar stacked/.style={ /pgfplots/set point meta if empty=f(x),% bar cycle list, @@ -2292,7 +2457,6 @@ /tikz/ybar, }, /pgfplots/ybar stacked/.default=plus, - /pgfplots/ybar stacked/.belongs to family=/pgfplots, /pgfplots/xbar interval stacked/.style={ /pgfplots/set point meta if empty=x,% bar cycle list, @@ -2301,7 +2465,6 @@ /tikz/xbar interval, }, /pgfplots/xbar interval stacked/.default=plus, - /pgfplots/xbar interval stacked/.belongs to family=/pgfplots, /pgfplots/ybar interval stacked/.style={ /pgfplots/set point meta if empty=f(x),% bar cycle list, @@ -2310,7 +2473,6 @@ /tikz/ybar interval, }, /pgfplots/ybar interval stacked/.default=plus, - /pgfplots/ybar interval stacked/.belongs to family=/pgfplots, /pgfplots/yticklabel interval boundaries/.style={% y tick label as interval, yticklabel={$\pgfmathprintnumber{\tick}$ -- $\pgfmathprintnumber{\nexttick}$} @@ -2327,6 +2489,7 @@ /pgfplots/plot graphics/.code={\let\tikz@plot@handler=\pgfplotsplothandlergraphics},% /pgfplots/plot graphics/src/.initial=, /pgfplots/plot graphics/includegraphics/.initial=, + /pgfplots/plot graphics/includegraphics cmd/.initial=\includegraphics, /pgfplots/plot graphics/xmin/.initial=, /pgfplots/plot graphics/xmax/.initial=, /pgfplots/plot graphics/ymin/.initial=, @@ -2435,6 +2598,19 @@ /pgfplots/clip marker paths/.default=true, /pgfplots/axis on top/.is if=pgfplots@axis@on@top, /pgfplots/axis on top/.default=true, + /pgfplots/invoke before crossref tikzpicture/.initial={% + \expandafter\ifx\csname tikzappendtofigurename\endcsname\relax + \else + \begingroup + \tikzappendtofigurename{_crossref}% + \fi + }, + /pgfplots/invoke after crossref tikzpicture/.initial={% + \expandafter\ifx\csname tikzappendtofigurename\endcsname\relax + \else + \endgroup + \fi + },% /pgfplots/every crossref picture/.style={% baseline,yshift=0.3em }, @@ -2505,30 +2681,20 @@ /pgfplots/symbolic z coords/.style={symbolic coords={z}{#1}},% % Defines the class name \pgfplotspointmetainputhandler: /pgfplots/point meta/.code={% - % this thing here converts control sequences to - % characters, they won't cause 'unknown control sequence' - % errors: - \def\pgfplots@loc@TMPa{#1}% - \pgfplots@command@to@string\pgfplots@loc@TMPa\pgfplots@loc@TMPb - \pgfkeysifdefined{/pgfplots/point meta/\pgfplots@loc@TMPb/.@cmd}{% - \pgfplots@invoke@pgfkeyscode{/pgfplots/point meta/#1/.@cmd}{}% - }{% - \pgfplotssetpointmetainput{expr}{#1}% - }% + \pgfplots@pgfkeys@set@point@meta@value{#1}% },% /pgfplots/point meta/none/.code ={\pgfplotssetpointmetainput{}{}},% /pgfplots/point meta/x/.code ={\pgfplotssetpointmetainput{x}{}},% /pgfplots/point meta/y/.code ={\pgfplotssetpointmetainput{y}{}},% /pgfplots/point meta/z/.code ={\pgfplotssetpointmetainput{z}{}},% + /pgfplots/point meta/expr/.code={\pgfplotssetpointmetainput{expr}{#1}},% /pgfplots/point meta/explicit/.code={\pgfplotssetpointmetainput{explicit}{}},% /pgfplots/point meta/explicit symbolic/.code={\pgfplotssetpointmetainput{explicit symbolic}{}},% - /pgfplots/point meta/f(x)/.code={ - \ifpgfplots@curplot@threedim - \pgfplotssetpointmetainput{z}{}% - \else - \pgfplotssetpointmetainput{y}{}% - \fi - }, + /pgfplots/point meta/f(x)/.code={\pgfplotssetpointmetainput{f(x)}{}},% + /pgfplots/point meta/TeX code/.code={\pgfplotssetpointmetainput{TeX code}{#1}},% + /pgfplots/point meta/TeX code/.value required, + /pgfplots/point meta/TeX code symbolic/.code={\pgfplotssetpointmetainput{TeX code symbolic}{#1}},% + /pgfplots/point meta/TeX code symbolic/.value required, /pgfplots/set point meta if empty/.code={% \ifx\pgfplotspointmetainputhandler\pgfutil@empty \pgfkeysalso{/pgfplots/point meta/#1}% @@ -2738,9 +2904,11 @@ /pgfplots/xtick placement tolerance/.initial=0.05pt, /pgfplots/ytick placement tolerance/.initial=0.05pt, /pgfplots/ztick placement tolerance/.initial=0.05pt, + % /pgfplots/compat/anchors/.is choice, /pgfplots/compat/anchors/pre 1.3/.code={\pgfplots@deprecated@anchorstrue},% FIXME: WAS \global /pgfplots/compat/anchors/1.3/.code= {\pgfplots@deprecated@anchorsfalse},% + /pgfplots/compat/anchors/1.4/.style= {/pgfplots/compat/anchors/1.3},% /pgfplots/compat/anchors/newest/.style= {/pgfplots/compat/anchors/1.3},% /pgfplots/compat/anchors/default/.style={/pgfplots/compat/anchors/1.3},% /pgfplots/compat/labels/.is choice, @@ -2750,8 +2918,9 @@ /pgfplots/compat/labels/1.3/.style={% /pgfplots/xlabel near ticks, /pgfplots/ylabel near ticks},% - /pgfplots/compat/labels/newest/.style={/pgfplots/compat/labels/1.3},% - /pgfplots/compat/labels/default/.style={/pgfplots/compat/labels/pre 1.3},% maintain backwards compatibility for labels :-( + /pgfplots/compat/labels/1.4/.style= {/pgfplots/compat/labels/1.3},% + /pgfplots/compat/labels/newest/.style= {/pgfplots/compat/labels/1.3},% + /pgfplots/compat/labels/default/.style= {/pgfplots/compat/labels/pre 1.3},% maintain backwards compatibility for labels :-( /pgfplots/compat/.style={% /pgfplots/compat/anchors=#1,% /pgfplots/compat/labels=#1,% @@ -2812,19 +2981,26 @@ \pgfprofilenewforcommand[pgfplotsapplistXX handling]{\pgfplotsapplistXXpushback}{1}% \pgfprofilenewforcommand[pgfplotsapplistXX handling]{\pgfplotsapplistXXflushbuffers}{0}% \pgfprofilenewforcommandpattern - [pgfplots(app|prepent)listX handling]{\pgfplotsapplistXpushback}{##1\to##2}{{##1}\to{##2}}% + [pgfplots(app|prepend)listX handling]{\pgfplotsapplistXpushback}{##1\to##2}{{##1}\to{##2}}% \pgfprofilenewforcommand - [pgfplots(app|prepent)listX handling]{\pgfplotsapplistXflushbuffers}{1}% + [pgfplots(app|prepend)listX handling]{\pgfplotsapplistXflushbuffers}{1}% \pgfprofilenewforcommandpattern - [pgfplots(app|prepent)listX handling]{\pgfplotsprependlistXpushfront}{##1\to##2}{{##1}\to{##2}}% + [pgfplots(app|prepend)listX handling]{\pgfplotsprependlistXpushfront}{##1\to##2}{{##1}\to{##2}}% \pgfprofilenewforcommand [pgfplots(app|prepend)listX handling]{\pgfplotsprependlistXflushbuffers}{1}% + \pgfprofilenewforcommand + [pgfsys buffer]{\pgfsyssoftpath@addtocurrentpath}{1}% + \pgfprofilenewforcommand + [pgfsys buffer]{\pgfsyssoftpath@flushcurrentpath}{0}% \pgfprofilenewforcommand[math parser (basic)]{\pgfmathparse}{1}% \pgfprofilenewforcommand[math parser (fpu)]{\pgfmathfloatparse@}{1}% \pgfprofilenewforcommand[math: division (basic)]{\pgfmathdivide@}{2}% \pgfprofilenewforcommand[math: division (basic)]{\pgfmath@basic@divide@}{2}% \pgfprofilenewforcommand[near ticklabel anchors]{\pgfplots@borderanchor@for@axis}{3}% \pgfprofilenewforcommand[ticklabel cs]{\pgfplotspointticklabelcs}{2}% + % \pgfprofilenewforcommand[binary conversion]{\pgfplotsbinaryencodeunsigned}{1}% + % \pgfprofilenewforcommand[binary conversion]{\pgfplotsbinaryencodesignedmaplinearly}{1}% + % \pgfprofilenewforcommand[binary conversion]{\pgfplotsbinaryencodedimenmaplinearly}{1}% },% } @@ -2841,11 +3017,15 @@ \pgfkeysdef{/pgfplots/empty command key}{}% \pgfkeysgetvalue{/pgfplots/empty command key/.@cmd}\pgfplots@loc@TMPa \global\let\pgfplots@empty@command@key=\pgfplots@loc@TMPa + +\pgfkeys{/empty/.style={}}% +\pgfkeysgetvalue{/empty/.@cmd}\pgfplots@loc@TMPa +\global\let\pgfplots@empty@style@key=\pgfplots@loc@TMPa } % Only define if it is undefined. It may be possible that related libraries % habe been loaded before pgfplots. -\pgfkeysifdefined{/pgfplots/@backgroundpath@hook}{\relax}{% +\pgfkeysifdefined{/pgfplots/@backgroundpath@hook/.@cmd}{\relax}{% \pgfkeysdef{/pgfplots/@backgroundpath@hook}{}% } @@ -3146,6 +3326,18 @@ \begingroup \let#1=\pgfutil@empty \pgfkeysgetvalue{/pgfplots/cycle multi list/@dim}\pgfplots@cycle@dim + % + \let\pgfplots@listindex=\pgfplots@numplots + \pgfkeysgetvalue{/pgfplots/cycle list shift}\pgfplots@listindex@shift + \ifx\pgfplots@listindex@shift\pgfutil@empty + \else + \c@pgf@counta=\pgfplots@listindex\relax + \advance\c@pgf@counta by\pgfplots@listindex@shift\relax + \ifnum\c@pgf@counta<0 + \c@pgf@counta=-\c@pgf@counta + \fi + \edef\pgfplots@listindex{\the\c@pgf@counta}% + \fi \ifnum\pgfplots@cycle@dim>0 % use the 'cycle multi list' feature. % @@ -3160,8 +3352,8 @@ % } % to get the different indices into the cycle lists. %-------------------------------------------------- - \c@pgf@counta=\pgfplots@cycle@dim - \c@pgf@countb=\pgfplots@numplots\relax + \c@pgf@counta=\pgfplots@cycle@dim\relax + \c@pgf@countb=\pgfplots@listindex\relax \advance\c@pgf@counta by-1 \pgfplotsloop{% \ifnum\c@pgf@counta<0 @@ -3187,7 +3379,7 @@ \else % normal cycle list: \pgfplotslistsize\autoplotspeclist\to\c@pgf@countd - \pgfplots@getautoplotspec@{\autoplotspeclist}{\c@pgf@countd}{\pgfplots@numplots}% + \pgfplots@getautoplotspec@{\autoplotspeclist}{\c@pgf@countd}{\pgfplots@listindex}% \let#1=\pgfplotsretval \fi \pgfmath@smuggleone#1% @@ -3217,6 +3409,9 @@ \long\def\pgfplots@replacement@for@tikz@path#1;{% \axispath\path#1;% } +\def\pgfplots@replacement@for@scope{\pgfutil@ifnextchar[{\pgfplots@replacement@for@scope@}{\pgfplots@replacement@for@scope@[]}}% +\def\pgfplots@replacement@for@scope@[#1]{\pgfplotsextra{\scope[#1]}}% +\def\pgfplots@replacement@for@endscope{\pgfplotsextra\endscope}% { % A block which handles active semicolons. @@ -3346,6 +3541,98 @@ \endgroup } +\def\pgfplots@transposelegend{% + \ifnum\pgfplots@legend@columns>1 + \begingroup + \pgfplots@transposelegend@ + \let\pgfplots@legend@columns=\c@pgfplots@row@end + \pgfmath@smuggleone\pgfplots@legend@columns + \endgroup + \fi +} +\def\pgfplots@transposelegend@{% + \let\c@pgfplots@row=\c@pgf@countb + \let\c@pgfplots@col=\c@pgf@countc + \let\c@pgfplots@no=\c@pgf@countd + \c@pgfplots@row=0 + \c@pgfplots@col=0 + \c@pgfplots@no=0 + \pgfplotslistforeachungrouped\pgfplots@legend\as\entry{% + \expandafter\let\csname m@pgfplots@\the\c@pgfplots@row,\the\c@pgfplots@col\endcsname=\entry + \advance\c@pgfplots@col by1 + \ifnum\pgfplots@legend@columns=\c@pgfplots@col\relax + \c@pgfplots@col=0 + \advance\c@pgfplots@row by1 + \fi + \advance\c@pgfplots@no by1 + }% + \ifnum\c@pgfplots@col=0 + \else + \advance\c@pgfplots@row by1 + \fi + \edef\c@pgfplots@row@end{\the\c@pgfplots@row}% + \edef\c@pgfplots@no@leg{\the\c@pgfplots@no}% + % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \c@pgfplots@row=0 + \c@pgfplots@col=0 + \c@pgfplots@no=0 + \pgfplotslistforeachungrouped\pgfplots@plotspeclist\as\entry{% + \expandafter\let\csname m@pgfplots@img@\the\c@pgfplots@row,\the\c@pgfplots@col\endcsname=\entry + \advance\c@pgfplots@col by1 + \ifnum\pgfplots@legend@columns=\c@pgfplots@col\relax + \c@pgfplots@col=0 + \advance\c@pgfplots@row by1 + \fi + \advance\c@pgfplots@no by1 + }% + \ifnum\c@pgfplots@col=0 + \else + \advance\c@pgfplots@row by1 + \fi + \ifnum\c@pgfplots@row<\c@pgfplots@row@end + \edef\c@pgfplots@row@end{\the\c@pgfplots@row}% + \fi + \ifnum\c@pgfplots@no<\c@pgfplots@no@leg + \edef\c@pgfplots@no@leg{\the\c@pgfplots@no}% + \fi + % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \c@pgfplots@col=0 + \global\pgfplotslistnewempty\pgfplots@legend% + \global\pgfplotslistnewempty\pgfplots@plotspeclist% + \pgfplotsloop{% + \ifnum\pgfplots@legend@columns=\c@pgfplots@col + \pgfplotsloopcontinuefalse + \else + \pgfplotsloopcontinuetrue + \fi + }{% + \c@pgfplots@row=0 + \pgfplotsloop{% + \ifnum\c@pgfplots@row@end=\c@pgfplots@row + \pgfplotsloopcontinuefalse + \else + \pgfplotsloopcontinuetrue + \fi + }{% + \pgfutil@ifundefined{m@pgfplots@\the\c@pgfplots@row,\the\c@pgfplots@col}{% + }{% + \pgfutil@ifundefined{m@pgfplots@img@\the\c@pgfplots@row,\the\c@pgfplots@col}{% + }{% + \expandafter\let\expandafter\pgfplots@legendtmp\csname m@pgfplots@\the\c@pgfplots@row,\the\c@pgfplots@col\endcsname + \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplots@legendtmp}\to\pgfplots@legend% + % + \expandafter\let\expandafter\pgfplots@legendtmp\csname m@pgfplots@img@\the\c@pgfplots@row,\the\c@pgfplots@col\endcsname + \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplots@legendtmp}\to\pgfplots@plotspeclist% + }% + }% + \advance\c@pgfplots@row by1 + }% + \advance\c@pgfplots@col by1 + }% +}% + \def\pgfplots@addlegendentryexpanded{% \pgfutil@ifnextchar[{% @@ -3368,6 +3655,7 @@ \pgfplots@rememberplotspec[#1]{/pgfplots/every axis plot,#2,/pgfplots/.cd,/pgfplots/every axis plot post}% }% +% This implements \addlegendentry \def\pgfplots@addlegendentry{% \pgfutil@ifnextchar[{% \pgfplots@addlegendentry@opts @@ -3409,7 +3697,9 @@ \fi } -\long\def\pgfplots@show@small@legendplots#1#2{ +% #1: DEPRECATED. Unused. +% #2: plot style +\long\def\pgfplots@show@small@legendplots#1#2{% \begingroup \pgfplots@define@currentplotstyle@as{#1,#2}% \scope[/tikz/current plot style,/pgfplots/every legend image post]% this scoping construction allows plot styles to change 'legend image code'. @@ -3439,6 +3729,7 @@ % or it creates a legend, stores the commands into the macro named % above and typesets it. \def\pgfplots@createlegend{% + \pgfkeysgetvalue{/pgfplots/legend to name}\pgfplots@createlegend@toname \ifx\pgfplots@already@computed@legend@node\pgfutil@empty \pgfplotslistcheckempty\pgfplots@legend \ifpgfplotslistempty @@ -3453,9 +3744,27 @@ \ifpgfplots@reverse@legend \pgfplots@reverselegend \fi + \ifpgfplots@transpose@legend + \pgfplots@transposelegend + \fi % % \begingroup + \ifx\pgfplots@createlegend@toname\pgfutil@empty + % ok, draw legend. + \def\pgfplots@createlegend@prepareimage@to##1{% + \t@pgfplots@tokc=\expandafter{\pgfplots@curplotlist}% + \edef##1{\noexpand\pgfplots@show@small@legendplots{}{\the\t@pgfplots@tokc}}% + }% + \else + % export legend instead of drawing it. + \def\pgfplots@createlegend@prepareimage@to##1{% + \t@pgfplots@tokc=\expandafter{\pgfplots@curplotlist}% + \edef\pgfplots@loc@TMPa{\noexpand\pgfplots@export@legend@image@to@macro{\the\t@pgfplots@tokc}{}}% + \pgfplots@loc@TMPa + \let##1=\pgfplotsretval + }% + \fi % assemble a % \matrix { % small plot & legend1\\ @@ -3498,30 +3807,49 @@ \else \advance\curcolumnNum by1 \begingroup + % \pgfplots@curlegend@opts are any options for + % this single legend text, provided as + % \addlegendentry[<options>]{<text>} + % or + % legend entries={...,[<options>]<text>, ....} \expandafter\pgfplots@split@opts\pgfplots@curlegend\pgfplots@result@to{\pgfplots@curlegend}{\pgfplots@curlegend@opts}% + \pgfplots@createlegend@prepareimage@to{\pgfplotsretval}% + % + \t@pgfplots@tokb=\expandafter{\pgfplots@curlegend@opts}% + \t@pgfplots@tokc=\expandafter{\pgfplots@curlegend}% + % + % prepare the \node[<options>] {<text>} into \t@pgfplots@tokc + \edef\pgfplots@loc@TMPa{\noexpand\node[\the\t@pgfplots@tokb]{\the\t@pgfplots@tokc};}% + \t@pgfplots@tokc=\expandafter{\pgfplots@loc@TMPa}% + % + % and the legend image into \t@pgfplots@tokb: + \t@pgfplots@tokb=\expandafter{\pgfplotsretval}% + % ok. Now, the + % - 'b' register contains the IMAGE and + % - 'c' register contains the TEXT \ifcase\legendplotpos % legend plot pos=left - \t@pgfplots@tokb=\expandafter{% - \expandafter\pgfplots@show@small@legendplots - \expandafter{\pgfplots@curlegend@opts}}% - \t@pgfplots@tokb=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\t@pgfplots@tokb\expandafter{\pgfplots@curplotlist}% - \pgfmatrixnextcell\node}% - \t@pgfplots@tokb=\expandafter\expandafter\expandafter{% - \expandafter\the\expandafter\t@pgfplots@tokb - \expandafter{\pgfplots@curlegend};}% + \edef\pgfplots@matrixentry{% + \the\t@pgfplots@tokb + \noexpand\pgfmatrixnextcell + \the\t@pgfplots@tokc% + }% \or % legend plot pos=right - \t@pgfplots@tokb=\expandafter{% - \expandafter\node - \expandafter{\pgfplots@curlegend};% - \pgfmatrixnextcell - \pgfplots@show@small@legendplots}% - \t@pgfplots@tokb=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\t@pgfplots@tokb\expandafter{\pgfplots@curlegend@opts}}% - \t@pgfplots@tokb=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\t@pgfplots@tokb\expandafter{\pgfplots@curplotlist}}% + \edef\pgfplots@matrixentry{% + \the\t@pgfplots@tokc% + \noexpand\pgfmatrixnextcell + \the\t@pgfplots@tokb + }% \or % legend plot pos=none - \t@pgfplots@tokb=\expandafter{\expandafter\node\expandafter{\pgfplots@curlegend};}% + \edef\pgfplots@matrixentry{% + \the\t@pgfplots@tokc% + }% \fi + % copy it back to 'b' register: + \t@pgfplots@tokb=\expandafter{\pgfplots@matrixentry}% + % \ifnum\curcolumnNum=\maxcolumnCount \t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb\\}% \else @@ -3554,6 +3882,7 @@ \t@pgfplots@tokb={\matrix[/pgfplots/every axis legend]}% \xdef\pgfplots@glob@TMPa{% \noexpand\def\noexpand\plotnum{0}% + \noexpand\def\noexpand\plotnumofactualtype{0}% \the\t@pgfplots@tokb {% \the\t@pgfplots@toka };% @@ -3562,10 +3891,107 @@ \let\pgfplots@already@computed@legend@node=\pgfplots@glob@TMPa \fi \fi -%\pgfplots@message{Vor legende: \meaning\pgfplots@already@computed@legend@node}% - \pgfplots@already@computed@legend@node +%\pgfplots@message{Vor legende: \meaning\pgfplots@already@computed@legend@node^^J}% + \ifx\pgfplots@createlegend@toname\pgfutil@empty + % DRAW: + \pgfplots@already@computed@legend@node + \else + % apply the 'legend to name' feature: + % + % store legend contents: + % + \t@pgfplots@toka=\expandafter{\pgfplots@already@computed@legend@node}% + \pgfkeysgetvalue{/pgfplots/every axis legend/.@cmd}\pgfplots@loc@TMPa + \t@pgfplots@tokb=\expandafter{\pgfplots@loc@TMPa\pgfeov}% + % + \pgfplots@assemble@ref@picture + {\pgfplots@legend@to@name} + {\tikz[/pgfplots/every legend to name picture/.try]{\pgfplots@legend@to@name}}% + \t@pgfplots@tokc=\expandafter{\pgfplotsretval}% + % + \expandafter\xdef\csname pgfplots@legend@to@name@\pgfplots@createlegend@toname\endcsname{% + \noexpand\begingroup + \noexpand\def\noexpand\pgfplots@legend@to@name{% + \noexpand\pgfkeysdef{/pgfplots/every axis legend}{\the\t@pgfplots@tokb}% + \noexpand\def\noexpand\numplots{\numplots}% + \the\t@pgfplots@toka + }% + \the\t@pgfplots@tokc + \noexpand\endgroup + }% + \t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname pgfplots@legend@to@name@\pgfplots@createlegend@toname\endcsname}% + \pgfplots@auxwrite{% + \noexpand\expandafter + \noexpand\gdef + \noexpand\csname pgfplots@legend@to@name@\pgfplots@createlegend@toname\noexpand\endcsname% + {\the\t@pgfplots@toka}% + }% + \begingroup + % + % make sure \ref{<legendname>} works: + \pgfplots@label{\pgfplots@createlegend@toname}{pgfplots@legend@to@name@}% + \endgroup + \fi } +% Defines a new \label{#1}. When \ref{#1} is used, the code +% \csname #2#1\endcsname +% will be invoked. +\def\pgfplots@label#1#2{% + \begingroup + \edef\@currentlabel{% + \string\expandafter + \string\protect + \string\csname\space #2#1\string\endcsname + }% + \pgfutil@ifundefined{hyper@makecurrent}{}{% + \hyper@makecurrent{pgfplotslink}% + \hyper@anchorstart{\@currentHref}{}\hyper@anchorend + \pgfplotsutil@advancestringcounter@global\c@pgfplots@label + }% + \expandafter\label\expandafter{#1}% + \endgroup +}% +\gdef\c@pgfplots@label{0}% +\def\theHpgfplotslink{\theHsection.\c@pgfplots@label}% + +% this is deprecated. Use \ref{#1} instead. +\def\pgfplotslegendfromname#1{% + \pgfplots@texdist@protect\pgfplotslegendfromname@{#1}% +}% +\def\pgfplotslegendfromname@#1{% + \pgfutil@ifundefined{pgfplots@legend@to@name@#1}{% + \pgfutil@ifundefined{ref}{% + \pgfplots@warning{There is no `legend to name=#1', sorry. I am skipping it}% + \string\pgfplotslegendfromname{#1}: ??% + }{% + \ref{\string\pgfplotslegendfromname{#1}}% + }% + }{% + \csname pgfplots@legend@to@name@#1\endcsname + }% +}% +% this is deprecated. Use \ref{#1} instead. +\def\pgfplotscolorbarfromname#1{% + \pgfplots@texdist@protect\pgfplotscolorbarfromname@{#1}% +}% +\def\pgfplotscolorbarfromname@#1{% + \pgfutil@ifundefined{pgfplots@colorbar@to@name@#1}{% + \pgfutil@ifundefined{ref}{% + \pgfplots@warning{There is no `colorbar to name=#1', sorry. I am skipping it}% + \string\pgfplotscolorbarfromname{#1}: ??% + }{% + \ref{\string\pgfplotscolorbarfromname{#1}}% + }% + }{% + \csname pgfplots@colorbar@to@name@#1\endcsname + }% +}% + +\def\pgfplots@ifintikzpicture#1#2{% + \pgfutil@ifundefined{filldraw}{#2}{#1}% +}% + % DEPRECATED. \def\skipsuffixzero#1.#2|{ {% @@ -3680,8 +4106,12 @@ \if1\bool@pgfplots@loc@enlargeany \pgfplots@enlarge@limit@for{#1}% \fi + \global\let\pgfplots@glob@TMPa=\bool@pgfplots@loc@enlargeany % assignments are made globally. \endgroup + \if1\pgfplots@glob@TMPa + \pgfplots@visphase@notify@changeofcanvaslimits{#1}% + \fi } % Helper method inside of \pgfplots@enlarge@limit@ifconfigured. @@ -4127,7 +4557,7 @@ % \let\pgfplots@ymax=\pgfmathresult % \fi %-------------------------------------------------- -%\message{x = [\pgfplots@xmin:\pgfplots@xmax] y = [\pgfplots@ymin:\pgfplots@ymax]}% +%\message{untransformed: x = [\pgfplots@xmin:\pgfplots@xmax] y = [\pgfplots@ymin:\pgfplots@ymax]. }% % % \pgfplots@set@default@size@options @@ -4144,6 +4574,7 @@ \pgfplots@check@and@apply@datatrafo@for z% \fi \pgfplots@datascaletrafo@initialisedtrue +%\message{transformed: x = [\pgfplots@xmin:\pgfplots@xmax] y = [\pgfplots@ymin:\pgfplots@ymax].}% % % From now on, we can always work with pgfmath. % We simply need to apply the data scaling trafo before doing so. @@ -4212,6 +4643,18 @@ \pgfplots@xminorgridsfalse \fi % + \if0\pgfplots@xaxislinesnum\else + % axis x line* != box + \let\pgfplots@xticklabel@pos=\pgfutil@empty + \fi + \if0\pgfplots@yaxislinesnum\else + % axis y line* != box + \let\pgfplots@yticklabel@pos=\pgfutil@empty + \fi + \if0\pgfplots@zaxislinesnum\else + % axis y line* != box + \let\pgfplots@zticklabel@pos=\pgfutil@empty + \fi % \ifx\pgfplots@xticklabel@pos\pgfutil@empty \def\pgfplots@xticklabel@pos{% @@ -4960,17 +5403,24 @@ %\message{\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname. [+- \pgfplots@glob@TMPb]}% % % Update auxiliary data members: - \csname pgfplots@#1min@reg\endcsname=\csname pgfplots@#1min\endcsname pt % - \csname pgfplots@#1max@reg\endcsname=\csname pgfplots@#1max\endcsname pt % - \pgfplots@if{pgfplots@apply@datatrafo@#1}{% - \csname pgfplots@inverse@datascaletrafo@#1\endcsname{\csname pgfplots@#1min\endcsname}% - \expandafter\let\csname pgfplots@#1min@unscaled@as@float\endcsname=\pgfmathresult - \csname pgfplots@inverse@datascaletrafo@#1\endcsname{\csname pgfplots@#1max\endcsname}% - \expandafter\let\csname pgfplots@#1max@unscaled@as@float\endcsname=\pgfmathresult - }{}% + \pgfplots@visphase@notify@changeofcanvaslimits{#1}% \fi } +% should be invoked whenever \pgfplots@#1min or \pgfplots@#1max have +% been changed during the visualization phase (for example, axis equal +% or enlargelimits) +\def\pgfplots@visphase@notify@changeofcanvaslimits#1{% + \csname pgfplots@#1min@reg\endcsname=\csname pgfplots@#1min\endcsname pt % + \csname pgfplots@#1max@reg\endcsname=\csname pgfplots@#1max\endcsname pt % + \pgfplots@if{pgfplots@apply@datatrafo@#1}{% + \csname pgfplots@inverse@datascaletrafo@#1\endcsname{\csname pgfplots@#1min\endcsname}% + \expandafter\let\csname pgfplots@#1min@unscaled@as@float\endcsname=\pgfmathresult + \csname pgfplots@inverse@datascaletrafo@#1\endcsname{\csname pgfplots@#1max\endcsname}% + \expandafter\let\csname pgfplots@#1max@unscaled@as@float\endcsname=\pgfmathresult + }{}% +}% + % Invokes #3 if % ( 10^{s1} * veclen1 < 10^{s2} * veclen2 ) % <=> @@ -5046,41 +5496,7 @@ % PROCESS THE 'width' and 'height' options %----------------------------------------- % - % FIXME: make these variables LOCAL: - % - \let\pgfplots@rectangle@width=\pgfutil@empty - \let\pgfplots@rectangle@height=\pgfutil@empty - % - \ifx\pgfplots@x\pgfutil@empty - \ifx\pgfplots@width\pgfutil@empty - \pgfplots@error{INTERNAL LOGIC ERROR! WIDTH NOT SET}% - \fi - \pgfplots@initsizes@getXscale\pgfplots@initsizes@axisdiag@x\into\pgfplots@tmpXscale - \ifpgfplots@scale@only@axis - \let\pgfplots@rectangle@width=\pgfplots@width - \fi - \else - \def\pgfplots@tmpXscale{1}% - \fi - % - \ifx\pgfplots@y\pgfutil@empty - \ifx\pgfplots@height\pgfutil@empty - \pgfplots@error{INTERNAL LOGIC ERROR! HEIGHT NOT SET}% - \fi - \pgfplots@initsizes@getYscale\pgfplots@initsizes@axisdiag@y\into\pgfplots@tmpYscale - \ifpgfplots@scale@only@axis - \let\pgfplots@rectangle@height=\pgfplots@height - \fi - \else - \def\pgfplots@tmpYscale{1}% - \fi - % - % - % assert( \pgfplots@tmpXscale != \pgfutil@empty && \pgfplots@tmpYscale != \pgfutil@empty ) % - \pgfplotsqpointxy{\pgfplots@tmpXscale}{\pgfplots@tmpYscale}% - \edef\pgfplots@tmpXscale{\the\pgf@x}% - \edef\pgfplots@tmpYscale{\the\pgf@y}% \pgfkeysgetvalue{/pgfplots/view/az}{\pgfplots@view@az}% \pgfkeysgetvalue{/pgfplots/view/el}{\pgfplots@view@el}% \ifpgfplots@threedim @@ -5095,11 +5511,45 @@ \def\pgfplots@view@dir@threedim@z{1}% \fi \ifx\pgfplots@view@az\pgfutil@empty - % FIXME : this does NOT work! it doesn't prepare the view@dir@threedim properly! + %\let\pgfplots@rectangle@width=\pgfutil@empty + %\let\pgfplots@rectangle@height=\pgfutil@empty + % + \ifx\pgfplots@x\pgfutil@empty + \ifx\pgfplots@width\pgfutil@empty + \pgfplots@error{INTERNAL LOGIC ERROR! WIDTH NOT SET}% + \fi + \pgfplots@initsizes@getXscale\pgfplots@initsizes@axisdiag@x\into\pgfplots@tmpXscale + %\ifpgfplots@scale@only@axis + % \let\pgfplots@rectangle@width=\pgfplots@width + %\fi + \else + \def\pgfplots@tmpXscale{1}% + \fi + % + \ifx\pgfplots@y\pgfutil@empty + \ifx\pgfplots@height\pgfutil@empty + \pgfplots@error{INTERNAL LOGIC ERROR! HEIGHT NOT SET}% + \fi + \pgfplots@initsizes@getYscale\pgfplots@initsizes@axisdiag@y\into\pgfplots@tmpYscale + %\ifpgfplots@scale@only@axis + % \let\pgfplots@rectangle@height=\pgfplots@height + %\fi + \else + \def\pgfplots@tmpYscale{1}% + \fi + % + \pgfplotsqpointxy{\pgfplots@tmpXscale}{\pgfplots@tmpYscale}% + \edef\pgfplots@tmpXscale{\the\pgf@x}% + \edef\pgfplots@tmpYscale{\the\pgf@y}% + % \pgfplots@initsizes@setunitvector{x}{0}{\pgfplots@tmpXscale}{\pgfplots@tmp@xisaxisparallel}% \pgfplots@initsizes@setunitvector{y}{1}{\pgfplots@tmpYscale}{\pgfplots@tmp@yisaxisparallel}% \pgfplots@initsizes@setunitvector{z}{2}{\pgfplots@tmpZscale}{\pgfplots@loc@TMPc}% \else + % 3D case is currently always initialised by `view': + \let\pgfplots@x=\pgfutil@empty + \let\pgfplots@y=\pgfutil@empty + \let\pgfplots@z=\pgfutil@empty \pgfplotssetaxesfromazel{\pgfplots@view@az}{\pgfplots@view@el}{\pgfplots@tmp@xisaxisparallel}% \if1\pgfplots@tmp@xisaxisparallel% \def\pgfplots@tmp@yisaxisparallel{1}% @@ -5160,7 +5610,7 @@ \def\pgfplotspointminmaxmin{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}}% \pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% \fi - \xdef\pgfplotspointminminmin{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \xdef\pgfplotspointminminmin{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% % ATTENTION: I re-use registers here! Make sure they won't be % overwritten! \pgfpointdiff and \pgfplotsqpointxy are ok in this respect. \let\pgfplots@xcoordminTEX=\pgf@xb @@ -5195,14 +5645,14 @@ \pgfpointdiff {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}} {\pgfplotspointmaxminmin}% - \xdef\pgfplotspointxaxis{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \xdef\pgfplotspointxaxis{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \pgfmathveclen{\pgf@x}{\pgf@y}% \xdef\pgfplotspointxaxislength{\pgfmathresult pt}% % \pgfpointdiff {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}} {\pgfplotspointminmaxmin}% - \xdef\pgfplotspointyaxis{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \xdef\pgfplotspointyaxis{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \pgfmathveclen{\pgf@x}{\pgf@y}% \xdef\pgfplotspointyaxislength{\pgfmathresult pt}% % @@ -5210,7 +5660,7 @@ \pgfpointdiff {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}} {\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmax}}% - \xdef\pgfplotspointzaxis{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \xdef\pgfplotspointzaxis{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \pgfmathveclen{\pgf@x}{\pgf@y}% \xdef\pgfplotspointzaxislength{\pgfmathresult pt}% % @@ -5225,10 +5675,10 @@ \pgfplotspointzaxis% \advance\pgf@xa by\pgf@x \advance\pgf@xb by\pgf@y - \pgf@x=\pgf@xa - \pgf@y=\pgf@xb + \global\pgf@x=\pgf@xa + \global\pgf@y=\pgf@xb }% - \xdef\pgfplotspointcenter{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \xdef\pgfplotspointcenter{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \else \global\let\pgfplotspointzaxis=\pgfpointorigin \gdef\pgfplotspointzaxislength{0pt}% @@ -5238,7 +5688,7 @@ \pgfplotspointxaxis% \pgfplotspointyaxis% }% - \xdef\pgfplotspointcenter{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \xdef\pgfplotspointcenter{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \fi \endgroup } @@ -5311,8 +5761,8 @@ \pgfdeclareshape{pgfplots@low@level@shape}{% % The '(0,0)' point is the LOWER LEFT OUTER CORNER. \savedanchor\upperrightcorner{ - \pgf@x=\wd\pgfnodepartimagebox - \pgf@y=\ht\pgfnodepartimagebox + \global\pgf@x=\wd\pgfnodepartimagebox + \global\pgf@y=\ht\pgfnodepartimagebox }% \savedanchor\lowerleftinnercorner{% \pgfqpoint{\pgfplots@savedanchor@inner@lowerleft@x\relax}{\pgfplots@savedanchor@inner@lowerleft@y\relax}% @@ -5324,8 +5774,8 @@ % \nodeparts{image}% \anchor{image}{% - \pgf@x=0pt % - \pgf@y=0pt % + \global\pgf@x=0pt % + \global\pgf@y=0pt % }% % % @@ -5339,7 +5789,7 @@ \anchor{north}{% \pgfpointadd {\lowerleftinnercorner} - {\innerdiagonal\divide\pgf@x by2 }% + {\innerdiagonal\global\divide\pgf@x by2 }% }% \anchor{north east}{% \pgfpointadd @@ -5349,28 +5799,28 @@ \anchor{east}{% \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\divide\pgf@y by2 }% + {\innerdiagonal\global\divide\pgf@y by2 }% }% \anchor{south east}{% \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\pgf@y=0sp }% + {\innerdiagonal\global\pgf@y=0sp }% }% \anchor{south}{% \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\divide\pgf@x by2 \pgf@y=0sp }% + {\innerdiagonal\global\divide\pgf@x by2 \global\pgf@y=0sp }% }% \anchor{south west}{\lowerleftinnercorner}% \anchor{west}{% \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\pgf@x=0sp \divide\pgf@y by2 }% + {\innerdiagonal\global\pgf@x=0sp \global\divide\pgf@y by2 }% } \anchor{north west}{% \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\pgf@x=0sp }% + {\innerdiagonal\global\pgf@x=0sp }% }% %% \anchor{origin}{% @@ -5379,69 +5829,69 @@ \anchor{above origin}{% \pgfpointintersectionoflines {\origin} - {\pgfpointadd{\origin}{\innerdiagonal\pgf@x=0sp }} - {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\pgf@x=0sp }} + {\pgfpointadd{\origin}{\innerdiagonal\global\pgf@x=0sp }} + {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\global\pgf@x=0sp }} {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal}}% }% \anchor{left of origin}{% \pgfpointintersectionoflines {\origin} - {\pgfpointadd{\origin}{\innerdiagonal\multiply\pgf@x by-1 \pgf@y=0sp }} + {\pgfpointadd{\origin}{\innerdiagonal\global\multiply\pgf@x by-1 \global\pgf@y=0sp }} {\lowerleftinnercorner} - {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\pgf@x=0sp }}% + {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\global\pgf@x=0sp }}% }% \anchor{right of origin}{% \pgfpointintersectionoflines {\origin} - {\pgfpointadd{\origin}{\innerdiagonal\pgf@y=0sp }} - {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\pgf@y=0sp }} + {\pgfpointadd{\origin}{\innerdiagonal\global\pgf@y=0sp }} + {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\global\pgf@y=0sp }} {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal}}% }% \anchor{below origin}{% \pgfpointintersectionoflines {\origin} - {\pgfpointadd{\origin}{\innerdiagonal\pgf@x=0sp \multiply\pgf@y by-1 }} + {\pgfpointadd{\origin}{\innerdiagonal\global\pgf@x=0sp \global\multiply\pgf@y by-1 }} {\lowerleftinnercorner} - {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\pgf@y=0sp }}% + {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\global\pgf@y=0sp }}% }% % %% % \anchor{outer north}{% \upperrightcorner - \pgf@x=.5\pgf@x + \global\pgf@x=.5\pgf@x }% \anchor{outer north east}{\upperrightcorner}% \anchor{outer east}{% \upperrightcorner - \pgf@y=.5\pgf@y + \global\pgf@y=.5\pgf@y }% \anchor{outer south east}{% \upperrightcorner - \pgf@y=0pt + \global\pgf@y=0pt }% \anchor{outer south}{% \upperrightcorner - \pgf@x=.5\pgf@x - \pgf@y=0pt + \global\pgf@x=.5\pgf@x + \global\pgf@y=0pt }% \anchor{outer south west}{% - \pgf@x=0pt - \pgf@y=0pt + \global\pgf@x=0pt + \global\pgf@y=0pt }% \anchor{outer west}{% \upperrightcorner - \pgf@x=0pt - \pgf@y=.5\pgf@y + \global\pgf@x=0pt + \global\pgf@y=.5\pgf@y }% \anchor{outer north west}{% \upperrightcorner - \pgf@x=0pt + \global\pgf@x=0pt }% \anchor{outer center}{% \upperrightcorner - \pgf@x=.5\pgf@x - \pgf@y=.5\pgf@y + \global\pgf@x=.5\pgf@x + \global\pgf@y=.5\pgf@y }% % % @@ -5453,7 +5903,7 @@ \pgfpointadd {\lowerleftinnercorner} {\innerdiagonal\divide\pgf@x by2 }% - \pgf@y=\pgfutil@tempdima + \global\pgf@y=\pgfutil@tempdima }% \anchor{above north east}{% \upperrightcorner @@ -5461,7 +5911,7 @@ \pgfpointadd \lowerleftinnercorner \innerdiagonal - \pgf@y=\pgfutil@tempdima + \global\pgf@y=\pgfutil@tempdima }% \anchor{right of north east}{% \upperrightcorner @@ -5469,63 +5919,63 @@ \pgfpointadd \lowerleftinnercorner \innerdiagonal - \pgf@x=\pgfutil@tempdima + \global\pgf@x=\pgfutil@tempdima }% \anchor{right of east}{% \upperrightcorner \pgfutil@tempdima=\pgf@x \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\divide\pgf@y by2 }% - \pgf@x=\pgfutil@tempdima + {\innerdiagonal\global\divide\pgf@y by2 }% + \global\pgf@x=\pgfutil@tempdima }% \anchor{right of south east}{% \upperrightcorner \pgfutil@tempdima=\pgf@x \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\pgf@y=0sp }% - \pgf@x=\pgfutil@tempdima + {\innerdiagonal\global\pgf@y=0sp }% + \global\pgf@x=\pgfutil@tempdima }% \anchor{below south east}{% \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\pgf@y=0sp }% - \pgf@y=0pt + {\innerdiagonal\global\pgf@y=0sp }% + \global\pgf@y=0pt }% \anchor{below south}{% \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\divide\pgf@x by2 \pgf@y=0sp }% + {\innerdiagonal\global\divide\pgf@x by2 \global\pgf@y=0sp }% \pgf@y=0pt }% \anchor{below south west}{% \lowerleftinnercorner - \pgf@y=0pt + \global\pgf@y=0pt }% \anchor{left of south west}{% \lowerleftinnercorner - \pgf@x=0pt + \global\pgf@x=0pt }% \anchor{left of west}{% \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\pgf@x=0sp \divide\pgf@y by2 }% - \pgf@x=0pt + {\innerdiagonal\global\pgf@x=0sp \global\divide\pgf@y by2 }% + \global\pgf@x=0pt }% \anchor{left of north west}{% \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\pgf@x=0sp }% - \pgf@x=0pt + {\innerdiagonal\global\pgf@x=0sp }% + \global\pgf@x=0pt }% \anchor{above north west}{% \upperrightcorner \pgfutil@tempdima=\pgf@y \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\pgf@x=0sp }% - \pgf@y=\pgfutil@tempdima + {\innerdiagonal\global\pgf@x=0sp }% + \global\pgf@y=\pgfutil@tempdima }% %% %% @@ -5559,8 +6009,8 @@ \pgfdeclareshape{pgfplots@low@level@shape@deprecated}{% % The '(0,0)' point is the LOWER LEFT OUTER CORNER. \savedanchor\upperrightcorner{ - \pgf@x=\wd\pgfnodepartimagebox - \pgf@y=\ht\pgfnodepartimagebox + \global\pgf@x=\wd\pgfnodepartimagebox + \global\pgf@y=\ht\pgfnodepartimagebox }% \savedanchor\lowerleftinnercorner{% \pgfqpoint{\pgfplots@savedanchor@inner@lowerleft@x\relax}{\pgfplots@savedanchor@inner@lowerleft@y\relax}% @@ -5573,8 +6023,8 @@ % \nodeparts{image}% \anchor{image}{% - \pgf@x=0pt % - \pgf@y=0pt % + \global\pgf@x=0pt % + \global\pgf@y=0pt % }% % % @@ -5656,39 +6106,39 @@ % \anchor{outer north}{% \upperrightcorner - \pgf@x=.5\pgf@x + \global\pgf@x=.5\pgf@x }% \anchor{outer north east}{\upperrightcorner}% \anchor{outer east}{% \upperrightcorner - \pgf@y=.5\pgf@y + \global\pgf@y=.5\pgf@y }% \anchor{outer south east}{% \upperrightcorner - \pgf@y=0pt + \global\pgf@y=0pt }% \anchor{outer south}{% \upperrightcorner - \pgf@x=.5\pgf@x - \pgf@y=0pt + \global\pgf@x=.5\pgf@x + \global\pgf@y=0pt }% \anchor{outer south west}{% - \pgf@x=0pt - \pgf@y=0pt + \global\pgf@x=0pt + \global\pgf@y=0pt }% \anchor{outer west}{% \upperrightcorner - \pgf@x=0pt - \pgf@y=.5\pgf@y + \global\pgf@x=0pt + \global\pgf@y=.5\pgf@y }% \anchor{outer north west}{% \upperrightcorner - \pgf@x=0pt + \global\pgf@x=0pt }% \anchor{outer center}{% \upperrightcorner - \pgf@x=.5\pgf@x - \pgf@y=.5\pgf@y + \global\pgf@x=.5\pgf@x + \global\pgf@y=.5\pgf@y }% % % @@ -5700,7 +6150,7 @@ \pgfpointadd {\lowerleftinnercorner}% {\pgfpointadd{\yaxisvec}{\pgfpointscale{0.5}{\xaxisvec}}}% - \pgf@y=\pgfutil@tempdima + \global\pgf@y=\pgfutil@tempdima }% \anchor{above north east}{% \upperrightcorner @@ -5708,7 +6158,7 @@ \pgfpointadd {\lowerleftinnercorner}% {\pgfpointadd{\yaxisvec}{\xaxisvec}}% - \pgf@y=\pgfutil@tempdima + \global\pgf@y=\pgfutil@tempdima }% \anchor{right of north east}{% \upperrightcorner @@ -5716,7 +6166,7 @@ \pgfpointadd {\lowerleftinnercorner}% {\pgfpointadd{\yaxisvec}{\xaxisvec}}% - \pgf@x=\pgfutil@tempdima + \global\pgf@x=\pgfutil@tempdima }% \anchor{right of east}{% \upperrightcorner @@ -5724,7 +6174,7 @@ \pgfpointadd {\lowerleftinnercorner}% {\pgfpointadd{\xaxisvec}{\pgfpointscale{0.5}{\yaxisvec}}}% - \pgf@x=\pgfutil@tempdima + \global\pgf@x=\pgfutil@tempdima }% \anchor{right of south east}{% \upperrightcorner @@ -5732,39 +6182,39 @@ \pgfpointadd {\lowerleftinnercorner}% {\xaxisvec}% - \pgf@x=\pgfutil@tempdima + \global\pgf@x=\pgfutil@tempdima }% \anchor{below south east}{% \pgfpointadd {\lowerleftinnercorner}% {\xaxisvec}% - \pgf@y=0pt + \global\pgf@y=0pt }% \anchor{below south}{% \pgfpointadd {\lowerleftinnercorner}% {\pgfpointscale{0.5}{\xaxisvec}}% - \pgf@y=0pt + \global\pgf@y=0pt }% \anchor{below south west}{% \lowerleftinnercorner - \pgf@y=0pt + \global\pgf@y=0pt }% \anchor{left of south west}{% \lowerleftinnercorner - \pgf@x=0pt + \global\pgf@x=0pt }% \anchor{left of west}{% \pgfpointadd {\lowerleftinnercorner}% {\pgfpointscale{0.5}{\yaxisvec}}% - \pgf@x=0pt + \global\pgf@x=0pt }% \anchor{left of north west}{% \pgfpointadd {\lowerleftinnercorner}% {\yaxisvec}% - \pgf@x=0pt + \global\pgf@x=0pt }% \anchor{above north west}{% \upperrightcorner @@ -5772,7 +6222,7 @@ \pgfpointadd {\lowerleftinnercorner}% {\yaxisvec}% - \pgf@y=\pgfutil@tempdima + \global\pgf@y=\pgfutil@tempdima }% %% %% @@ -6480,11 +6930,15 @@ % set baseline for sub-picture to default value. % the baseline option will be applied to the OUTER picture. \pgfsetbaseline{\pgf@picminy}% + \pgfutil@ifundefined{pgfsettrimleft}{}{% + \pgfsettrimleft{\pgf@picminx}% + \pgfsettrimright{\pgf@picmaxx}% + }% \begingroup \pgfgettransformentries\aa\ab\ba\bb\pgfplots@loc@TMPa\pgfplots@loc@TMPb \xdef\pgfplots@savedtransformshift{% - \pgf@x=\pgfplots@loc@TMPa\space - \pgf@y=\pgfplots@loc@TMPb\space + \global\pgf@x=\pgfplots@loc@TMPa\space + \global\pgf@y=\pgfplots@loc@TMPb\space }% \xdef\pgfplots@glob@TMPa{{\aa}{\ab}{\ba}{\bb}}% \endgroup @@ -6736,13 +7190,13 @@ \else \pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% - \edef\pgfplots@loc@TMPa{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \edef\pgfplots@loc@TMPa{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}% - \edef\pgfplots@loc@TMPb{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \edef\pgfplots@loc@TMPb{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}% - \edef\pgfplots@loc@TMPc{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \edef\pgfplots@loc@TMPc{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}% - \edef\pgfplots@loc@TMPd{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \edef\pgfplots@loc@TMPd{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \begingroup \toks0=\expandafter{\pgfplots@loc@TMPa}% \toks1=\expandafter{\pgfplots@loc@TMPb}% @@ -6798,8 +7252,8 @@ \expandafter\pgfplotspointbbdiagonal@\pgfplotspoint@bb@@@ }% \let\pgfplotspoint@bb@@@=\relax -\def\pgfplotspointbblowerleft@#1#2#3#4{\pgf@x=#1 \pgf@y=#2 }% -\def\pgfplotspointbbdiagonal@#1#2#3#4{\pgf@x=#3 \pgf@y=#4 }% +\def\pgfplotspointbblowerleft@#1#2#3#4{\global\pgf@x=#1 \global\pgf@y=#2 }% +\def\pgfplotspointbbdiagonal@#1#2#3#4{\global\pgf@x=#3 \global\pgf@y=#4 }% % #1: a complete \pgfusepath command what to do with the clip path. \def\pgfplots@clippath@install#1{% @@ -7318,55 +7772,59 @@ % \pgfplots@change@pgfpoints@to@descriptioncs % - \ifpgfplots@hide@x - \else - \ifpgfplots@units@use% - \pgfplots@show@label{x}{\pgfplots@label@units{x}}% - \else% - \pgfkeysgetvalue{/pgfplots/xlabel}{\pgfplots@label@}% - \ifx\pgfplots@label@\pgfutil@empty - \else - \pgfplots@show@label{x}{\pgfplots@label@}% - \fi - \fi - \fi - \ifpgfplots@hide@y - \else - \ifpgfplots@units@use% - \pgfplots@show@label{y}{\pgfplots@label@units{y}}% - \else% - \pgfkeysgetvalue{/pgfplots/ylabel}{\pgfplots@label@}% - \ifx\pgfplots@label@\pgfutil@empty - \else - \pgfplots@show@label{y}{\pgfplots@label@}% - \fi - \fi - \fi - \ifpgfplots@threedim - \ifpgfplots@hide@z - \else - \ifpgfplots@units@use% - \pgfplots@show@label{z}{\pgfplots@label@units{z}}% - \else% - \pgfkeysgetvalue{/pgfplots/zlabel}{\pgfplots@label@}% - \ifx\pgfplots@label@\pgfutil@empty - \else - \pgfplots@show@label{z}{\pgfplots@label@}% - \fi - \fi - \fi - \fi - % - \pgfkeysgetvalue{/pgfplots/title}\pgfplots@loc@TMPa - \ifx\pgfplots@loc@TMPa\pgfutil@empty + \pgfplots@create@axis@descriptions@ + \endgroup +} + +\def\pgfplots@create@axis@descriptions@{% + \ifpgfplots@hide@x + \else + \ifpgfplots@units@use% + \pgfplots@show@label{x}{\pgfplots@label@units{x}}% + \else% + \pgfkeysgetvalue{/pgfplots/xlabel}{\pgfplots@label@}% + \ifx\pgfplots@label@\pgfutil@empty + \else + \pgfplots@show@label{x}{\pgfplots@label@}% + \fi + \fi + \fi + \ifpgfplots@hide@y + \else + \ifpgfplots@units@use% + \pgfplots@show@label{y}{\pgfplots@label@units{y}}% + \else% + \pgfkeysgetvalue{/pgfplots/ylabel}{\pgfplots@label@}% + \ifx\pgfplots@label@\pgfutil@empty + \else + \pgfplots@show@label{y}{\pgfplots@label@}% + \fi + \fi + \fi + \ifpgfplots@threedim + \ifpgfplots@hide@z \else - \expandafter\pgfplots@show@title\expandafter{\pgfplots@loc@TMPa}% + \ifpgfplots@units@use% + \pgfplots@show@label{z}{\pgfplots@label@units{z}}% + \else% + \pgfkeysgetvalue{/pgfplots/zlabel}{\pgfplots@label@}% + \ifx\pgfplots@label@\pgfutil@empty + \else + \pgfplots@show@label{z}{\pgfplots@label@}% + \fi + \fi \fi - \pgfplots@createlegend - % - \pgfkeysvalueof{/pgfplots/extra description/.@cmd}\pgfeov% - % - \endgroup + \fi + % + \pgfkeysgetvalue{/pgfplots/title}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfplots@show@title\expandafter{\pgfplots@loc@TMPa}% + \fi + \pgfplots@createlegend + % + \pgfkeysvalueof{/pgfplots/extra description/.@cmd}\pgfeov% + % } \def\pgfplots@datascaletrafo@undoshift@x#1{% @@ -7578,6 +8036,38 @@ \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% } +% Invokes '#1' foreach key which should be saved by a color bar. +% +% The current key name is available as '##1', the macro under which +% the key is / should be saved as '##2'. +\def\pgfplots@colorbar@foreach@saved@key#1{% + \def\pgfplots@colorbar@foreach@saved@key@body##1##2{#1}% + \pgfplotsutilforeachcommasep{% + {/pgfplots/colorbar/draw/.@cmd}\pgfplots@savedstyle@colorbar@draw,% + {/pgfplots/every colorbar/.@cmd}\pgfplots@savedstyle@colorbar,% + {/pgfplots/colorbar shift/.@cmd}\pgfplots@savedstyle@colorbarshift,% + {/pgfplots/colorbar horizontal/lowlevel/.@cmd}\pgfplots@savedstyle@colorbar@horizontal,% + {/pgfplots/colorbar vertical/lowlevel/.@cmd}\pgfplots@savedstyle@colorbar@vertical,% + {/pgfplots/every tick/.@cmd}\pgfplots@savedstyle@tick,% + {/pgfplots/every minor tick/.@cmd}\pgfplots@savedstyle@minortick,% + {/pgfplots/every major tick/.@cmd}\pgfplots@savedstyle@majortick,% + {/pgfplots/every axis grid/.@cmd}\pgfplots@savedstyle@grid,% + {/pgfplots/every minor grid/.@cmd}\pgfplots@savedstyle@minorgrid,% + {/pgfplots/every major grid/.@cmd}\pgfplots@savedstyle@majorgrid,% + {/pgfplots/every tick label/.@cmd}\pgfplots@savedstyle@ticklabel,% + {/pgfplots/every tick label/.@cmd}\pgfplots@savedstyle@ticklabel% + }% + \as\pgfplots@colorbar@foreach@saved@key@@ + {% + \expandafter\pgfplots@colorbar@foreach@saved@key@body\pgfplots@colorbar@foreach@saved@key@@ + }% +}% +\def\pgfplots@colorbar@restore@saved@keys{% + \pgfplots@colorbar@foreach@saved@key{% + \pgfkeyslet{##1}##2% + }% +}% + % Defines '#1' to be a macro which, upon execution, draws the color % bar for the current axis. It also handles any required style % inheritance and option preparation issues. @@ -7592,99 +8082,178 @@ \pgfkeyslet{/pgfplots/parent axis width}{\pgfplots@loc@TMPa}% \pgfkeyslet{/pgfplots/parent axis height}{\pgfplots@loc@TMPb}% % + \pgfkeysgetvalue{/pgfplots/colorbar to name}\pgfplots@colorbar@toname + % \pgfnodealias{parent axis}{current axis}% + % + % FIXME : + % I would really prefer to find a different way to move these + % variables out of the current scope. But expansion leads to + % mistakes with '#' characters ... :-( + \pgfplots@colorbar@foreach@saved@key{% + \pgfkeysgetvalue{##1}\pgfplots@loc@TMPa + \global\let##2=\pgfplots@loc@TMPa + }% + % + \toks1={}% + \ifx\pgfplots@colorbar@toname\pgfutil@empty + \else + \toks1={% + \pgfkeysgetvalue{/pgfplots/at/.@cmd}\pgfplots@at@orig + \pgfkeyslet{/pgfplots/at/orig/.@cmd}\pgfplots@at@orig + % + \pgfkeysgetvalue{/pgfplots/colorbar to name/at/.@cmd}\pgfplots@colorbar@toname@at + \pgfkeyslet{/pgfplots/at/.@cmd}\pgfplots@colorbar@toname@at + }% + \pgfplots@colorbar@foreach@saved@key{% + \pgfplots@command@with@args@to@string##2\pgfplots@loc@TMPa + \pgfplots@auxwrite{% + \noexpand\expandafter + \noexpand\long + \noexpand\expandafter + \noexpand\gdef + \noexpand\csname pgfplots@colorbar@\pgfplots@colorbar@toname @\noexpand\string\noexpand##2\noexpand\endcsname% + \pgfplots@loc@TMPa + }% + \edef\pgfplots@loc@TMPa{% + \the\toks1 + \noexpand\expandafter + \noexpand\let + \noexpand\expandafter + \noexpand##2% + \noexpand\csname pgfplots@colorbar@\pgfplots@colorbar@toname @\noexpand\string\noexpand##2\noexpand\endcsname% + }% + \toks1=\expandafter{\pgfplots@loc@TMPa}% + }% + \fi + % % % we have to do a lot of work to move *some* of the current % settings out of the current TeX group: \pgfkeysgetvalue{/pgfplots/colormap name}\pgfplots@loc@TMPa \expandafter\pgfplotscolormapserializetomacro\expandafter{\pgfplots@loc@TMPa}{\pgfplots@serializedcolormap}% \toks0=\expandafter{\pgfplots@serializedcolormap}% % - % FIXME : - % I would really prefer to find a different way to move these - % variables out of the current scope. But expansion lead to - % mistakes with '#' characters ... :-( - % I use these no-name globals in the hope they might be used - % in another place as well. - {\globaldefs=1 - \pgfkeysgetvalue{/pgfplots/colorbar/draw/.@cmd}\pgfplots@savedstyle@colorbar@draw - \pgfkeysgetvalue{/pgfplots/every colorbar/.@cmd}\pgfplots@savedstyle@colorbar - \pgfkeysgetvalue{/pgfplots/colorbar shift/.@cmd}\pgfplots@savedstyle@colorbarshift - \pgfkeysgetvalue{/pgfplots/every tick/.@cmd}\pgfplots@savedstyle@tick - \pgfkeysgetvalue{/pgfplots/every minor tick/.@cmd}\pgfplots@savedstyle@minortick - \pgfkeysgetvalue{/pgfplots/every major tick/.@cmd}\pgfplots@savedstyle@majortick - \pgfkeysgetvalue{/pgfplots/every axis grid/.@cmd}\pgfplots@savedstyle@grid - \pgfkeysgetvalue{/pgfplots/every minor grid/.@cmd}\pgfplots@savedstyle@minorgrid - \pgfkeysgetvalue{/pgfplots/every major grid/.@cmd}\pgfplots@savedstyle@majorgrid - \pgfkeysgetvalue{/pgfplots/every tick label/.@cmd}\pgfplots@savedstyle@ticklabel - \pgfkeysgetvalue{/pgfplots/every tick label/.@cmd}\pgfplots@savedstyle@ticklabel - }% + \pgfkeysgetvalue{/pgfplots/colorbar addplot}\pgfplots@loc@TMPa + \toks2=\expandafter{\pgfplots@loc@TMPa}% + % + \ifx\pgfplots@colorbar@src@metamin\pgfutil@empty + \global\let\pgfplots@colorbar@src@metamin=\pgfplots@axiswide@metamin + \global\let\pgfplots@colorbar@src@metamax=\pgfplots@axiswide@metamax + \fi + % + \ifx\pgfplots@colorbar@src@metamax\pgfplots@invalidrange@metamax + \pgfplots@warning{Sorry, the colorbar is uninitialised - your axis has no color data. Consider using 'point meta=f(x)' or something like that. I am using a color range of [0,1] for the colorbar.}% + \pgfmathfloatparsenumber{0}% + \global\let\pgfplots@colorbar@src@metamin=\pgfmathresult + \pgfmathfloatparsenumber{1}% + \global\let\pgfplots@colorbar@src@metamax=\pgfmathresult + \fi + % + % normalize format: + \pgfmathfloattosci\pgfplots@colorbar@src@metamin + \global\let\pgfplots@colorbar@src@metamin=\pgfmathresult + \pgfmathfloattosci\pgfplots@colorbar@src@metamax + \global\let\pgfplots@colorbar@src@metamax=\pgfmathresult + % + \pgfplots@assemble@ref@picture + {\pgfplots@colorbar@draw} + {\tikz[/pgfplots/every colorbar to name picture/.try]{\pgfplots@colorbar@draw}}% + \toks3=\expandafter{\pgfplotsretval}% % \xdef#1{% \noexpand\begingroup - \the\toks0 % restore colormap definition - % restore relevant styles and variables: - \noexpand\pgfkeyslet{/pgfplots/colorbar/draw/.@cmd} {\noexpand\pgfplots@savedstyle@colorbar@draw}% - \noexpand\pgfkeyslet{/pgfplots/colorbar shift/.@cmd} {\noexpand\pgfplots@savedstyle@colorbarshift}% - \noexpand\pgfkeyslet{/pgfplots/every colorbar/.@cmd} {\noexpand\pgfplots@savedstyle@colorbar}% - \noexpand\pgfkeyslet{/pgfplots/every tick/.@cmd} {\noexpand\pgfplots@savedstyle@tick}% - \noexpand\pgfkeyslet{/pgfplots/every minor tick/.@cmd} {\noexpand\pgfplots@savedstyle@minortick}% - \noexpand\pgfkeyslet{/pgfplots/every major tick/.@cmd} {\noexpand\pgfplots@savedstyle@majortick}% - \noexpand\pgfkeyslet{/pgfplots/every axis grid/.@cmd} {\noexpand\pgfplots@savedstyle@grid}% - \noexpand\pgfkeyslet{/pgfplots/every minor grid/.@cmd} {\noexpand\pgfplots@savedstyle@minorgrid}% - \noexpand\pgfkeyslet{/pgfplots/every major grid/.@cmd} {\noexpand\pgfplots@savedstyle@majorgrid}% - \noexpand\pgfkeyslet{/pgfplots/every tick label/.@cmd} {\noexpand\pgfplots@savedstyle@ticklabel}% - \noexpand\pgfkeyssetvalue{/pgfplots/point meta min}{\pgfplots@axiswide@metamin}% - \noexpand\pgfkeyssetvalue{/pgfplots/point meta max}{\pgfplots@axiswide@metamax}% - \noexpand\pgfkeyssetvalue{/pgfplots/colormap name}{\pgfkeysvalueof{/pgfplots/colormap name}}% - \noexpand\pgfkeyssetvalue{/pgfplots/parent axis width}{\pgfkeysvalueof{/pgfplots/parent axis width}}% - \noexpand\pgfkeyssetvalue{/pgfplots/parent axis height}{\pgfkeysvalueof{/pgfplots/parent axis height}}% - \noexpand\pgfkeyssetvalue{/pgfplots/colorbar/width}{\pgfkeysvalueof{/pgfplots/colorbar/width}}% - \noexpand\pgfplots@colorbar@define@hook% - \noexpand\pgfkeysvalueof{/pgfplots/colorbar/draw/.@cmd}\noexpand\pgfeov + \noexpand\def\noexpand\pgfplots@colorbar@draw{% + \the\toks0 % restore colormap definition + \noexpand\def\noexpand\pgfplots@colorbar@toname{\pgfplots@colorbar@toname}% + \the\toks1 % definitions for 'colorbar to name' + % + % restore relevant styles and variables: + \noexpand\pgfplots@colorbar@restore@saved@keys + \noexpand\pgfkeyssetvalue{/pgfplots/point meta min}{\pgfplots@colorbar@src@metamin}% + \noexpand\pgfkeyssetvalue{/pgfplots/point meta max}{\pgfplots@colorbar@src@metamax}% + \noexpand\pgfkeyssetvalue{/pgfplots/colormap name}{\pgfkeysvalueof{/pgfplots/colormap name}}% + \noexpand\pgfkeyssetvalue{/pgfplots/parent axis width}{\pgfkeysvalueof{/pgfplots/parent axis width}}% + \noexpand\pgfkeyssetvalue{/pgfplots/parent axis height}{\pgfkeysvalueof{/pgfplots/parent axis height}}% + \noexpand\pgfkeyssetvalue{/pgfplots/colorbar/width}{\pgfkeysvalueof{/pgfplots/colorbar/width}}% + \noexpand\pgfkeyssetvalue{/pgfplots/colorbar addplot}{\the\toks2 }% + \noexpand\pgfkeyssetvalue{/pgfplots/colorbar pos*}{\pgfkeysvalueof{/pgfplots/colorbar pos*}}% + \noexpand\pgfplots@colorbar@define@hook% + \noexpand\pgfkeysvalueof{/pgfplots/colorbar/draw/.@cmd}\noexpand\pgfeov + \ifx\pgfplots@colorbar@toname\pgfutil@empty + \noexpand\pgfnodealias{current colorbar axis}{current axis}% + \noexpand\pgfnodealias{current axis}{parent axis}% + \fi + }% + \the\toks3 \noexpand\endgroup - \noexpand\pgfnodealias{current colorbar axis}{current axis}% - \noexpand\pgfnodealias{current axis}{parent axis}% }% + \ifx\pgfplots@colorbar@toname\pgfutil@empty + \else + % finalize the 'colorbar to name' feature + \toks0=\expandafter{#1}% + \pgfplots@auxwrite{% + \noexpand\expandafter + \noexpand\gdef\noexpand\csname pgfplots@colorbar@to@name@\pgfplots@colorbar@toname\endcsname{\the\toks0}}% + \xdef#1{}% NOP. + % + % make sure \ref{<colorbarname>} works: + \pgfplots@label{\pgfplots@colorbar@toname}{pgfplots@colorbar@to@name@}% + \fi +}% +\pgfkeysdef{/pgfplots/colorbar to name/at}{% + % automatically search-and-replace 'parent axis' which + % is not defined for a detached colorbar: + \pgfutil@in@{parent axis}{#1}% + \ifpgfutil@in@ + \pgfplots@invoke@pgfkeyscode{/pgfplots/at/orig/.@cmd}{(0pt,0pt)}% + \else + \pgfplots@invoke@pgfkeyscode{/pgfplots/at/orig/.@cmd}{#1}% + \fi }% \let\pgfplots@colorbar@position@hook\relax \def\pgfplots@colorbar@define@hook{% - \def\pgfplots@colorbar@position@hook{% - % I patch \pgfplots@at... - \let\pgfplots@at@orig=\pgfplots@at - % - % ... and I patch \pgfplotspointdescriptionxy (but only INSIDE - % of \pgfplots@at) ... - \let\pgfplotspointdescriptionxy@orig=\pgfplotspointdescriptionxy - \let\pgfplotsqpointdescriptionxy@orig=\pgfplotsqpointdescriptionxy - \def\pgfplots@colorbar@position@prepare@CS{% - % ... which needs to set up ONLY \pgfplotspoint@bb@@@, - % nothing more. - \pgfpointanchor{parent axis}{south west}% - \edef\pgfplotspoint@bb@@@{% - {\the\pgf@x}% - {\the\pgf@y}% - {\pgfkeysvalueof{/pgfplots/parent axis width}}% - {\pgfkeysvalueof{/pgfplots/parent axis height}}% - }% - }% - % - % Install replacements: - \def\pgfplots@at{% - \begingroup - \def\pgfplotspointdescriptionxy########1########2{% - \pgfplots@colorbar@position@prepare@CS - \pgfplotspointdescriptionxy@orig{########1}{########2}% + \ifx\pgfplots@colorbar@toname\pgfutil@empty + \def\pgfplots@colorbar@position@hook{% + % I patch \pgfplots@at... + \let\pgfplots@at@orig=\pgfplots@at + % + % ... and I patch \pgfplotspointdescriptionxy (but only INSIDE + % of \pgfplots@at) ... + \let\pgfplotspointdescriptionxy@orig=\pgfplotspointdescriptionxy + \let\pgfplotsqpointdescriptionxy@orig=\pgfplotsqpointdescriptionxy + \def\pgfplots@colorbar@position@prepare@CS{% + % ... which needs to set up ONLY \pgfplotspoint@bb@@@, + % nothing more. + \pgfpointanchor{parent axis}{south west}% + \edef\pgfplotspoint@bb@@@{% + {\the\pgf@x}% + {\the\pgf@y}% + {\pgfkeysvalueof{/pgfplots/parent axis width}}% + {\pgfkeysvalueof{/pgfplots/parent axis height}}% + }% }% - \def\pgfplotsqpointdescriptionxy########1########2{% - \pgfplots@colorbar@position@prepare@CS - \pgfplotsqpointdescriptionxy@orig{########1}{########2}% + % + % Install replacements: + \def\pgfplots@at{% + \begingroup + \def\pgfplotspointdescriptionxy########1########2{% + \pgfplots@colorbar@position@prepare@CS + \pgfplotspointdescriptionxy@orig{########1}{########2}% + }% + \def\pgfplotsqpointdescriptionxy########1########2{% + \pgfplots@colorbar@position@prepare@CS + \pgfplotsqpointdescriptionxy@orig{########1}{########2}% + }% + \pgfplots@deprecated@anchorsfalse + \pgfplots@change@pgfpoints@to@descriptioncs + \pgf@process{\pgfplots@at@orig}% + \endgroup }% - \pgfplots@deprecated@anchorsfalse - \pgfplots@change@pgfpoints@to@descriptioncs - \pgf@process{\pgfplots@at@orig}% - \endgroup }% - }% + \else + % nothing to do for colorbar to name: + \let\pgfplots@colorbar@position@hook=\relax + \fi }% % Parses all options in #1 which are known in the currently active families. @@ -7780,6 +8349,68 @@ \pgfkeyslet{/pgfplots/zmax/.@cmd}\pgfplots@cant@set@in@this@context }% +% This here is the main key filter for pgfplots. +% +% It sets keys if +% ( they have an active key family) +% OR +% ( they have /pgfplots/ key prefix ) +% OR +% ( they are a command key which contains \tikz@plot@handler ). +% +% In all other cases, the key filter will postpone the key. +% +% Note that \tikz@plot@handler should be defined before the survey +% phase starts. +\pgfkeysdef{/pgfplots/@@key filter}{% + \if\pgfkeyscasenumber0% + \pgfkeysfiltercontinuefalse + \else + \if\pgfkeyscasenumber3% + \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP + \else + \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP + \fi + \ifpgfkeyssuccess + % it has a family. Check it! + \pgfkeysisfamilyactive{\pgfkeyspred@TMP}% + \else% Ok, it does not belong to any family. + % Check if it has /pgfplots/ prefix: + \expandafter\pgfplots@key@filter@isdescendantof\pgfkeyscurrentkey/pgfplots/\pgf@@eov + \fi + \fi +} +\def\pgfplots@key@filter@isdescendantof#1/pgfplots/#2\pgf@@eov{% + \def\pgfkeyspred@TMP{#1}% + \ifx\pgfkeyspred@TMP\pgfkeys@empty + % Ah -- it *has* /pgfplots/ prefix. Use it! + \pgfkeysfiltercontinuetrue + \else + % Hm. Probably a /tikz/ key, but who knows. + \if1\pgfkeyscasenumber + % It is a command key. + % Check if the *body* of the command key contains + % \tikz@plot@handler. + \pgfkeysgetvalue{\pgfkeyscurrentkey/.@cmd}\pgfkeyspred@TMP% + \expandafter\pgfplots@key@filter@isplothandler\pgfkeyspred@TMP 123456789\pgfeov\tikz@plot@handler\pgfplots@EOI + \else + % Ok, it's no command key. Skip it directly. + \pgfkeysfiltercontinuefalse + \fi + \fi +}% +\def\pgfplots@key@filter@isplothandler#1\tikz@plot@handler#2\pgfplots@EOI{% + \def\pgfkeyspred@TMP{#2}% + \ifx\pgfkeyspred@TMP\pgfkeys@empty + % I didn't find '\tikz@plot@handler' in the key's body. Ok. + % key won't be processed. + \pgfkeysfiltercontinuefalse + \else + % Aaah -- it is something like /tikz/ybar! process it. + \pgfkeysfiltercontinuetrue + \fi +}% + \def\pgfplots@set@options#1{% \pgfplots@bb@isactivetrue \pgfplots@curplot@threedimfalse @@ -7815,7 +8446,8 @@ % % Step 2: parse any pgfplots options out of styles. \pgfkeysactivatefamily{/pgfplots/style commands}% - \pgfkeysinstallkeyfilter{/pgf/key filters/active families or descendants of}{/pgfplots} + %\pgfkeysinstallkeyfilter{/pgf/key filters/active families or descendants of}{/pgfplots} + \pgfkeysinstallkeyfilter{/pgfplots/@@key filter}{}% % \pgfkeysactivatefamilies {/pgfplots,/pgfplots/naming commands,/pgfplots/tick,/pgfplots/legend,/pgfplots/scale}%/pgfplots/descriptions,} @@ -7858,9 +8490,11 @@ % % And protocol all named sub-nodes! Their positions need to be % updated later. - \let\pgfplots@named@child@node@list=\pgfutil@empty - \pgfkeysgetvalue{/tikz/name/.@cmd}\pgfplots@old@name@impl - \pgfkeysgetvalue{/tikz/alias/.@cmd}\pgfplots@old@alias@impl + \global\let\pgfplots@named@child@node@list=\pgfutil@empty + \pgfutil@ifundefined{pgfplots@old@name@impl}{% + \pgfkeysgetvalue{/tikz/name/.@cmd}\pgfplots@old@name@impl + \pgfkeysgetvalue{/tikz/alias/.@cmd}\pgfplots@old@alias@impl + }{}% \pgfkeysdef{/tikz/name}{% \xdef\pgfplots@named@child@node@list{\pgfplots@named@child@node@list,{##1}}% \pgfplots@old@name@impl##1\pgfeov @@ -8062,6 +8696,101 @@ \let\pgfplots@already@computed@legend@node=\pgfutil@empty } +% Takes a plot style and exports it to a self-contained drawing +% command which can be used outside of the current context. +% +% This macro is used inside for \label{} / \ref{}; it tries to be +% reasonable smart about restoring relevant flags stored in a pgfplots +% axis. If it forgets something... well, it is not too smart. +% +% #1: the style to export. +% #2: either empty or the fully qualified name of a code key. If #2 is not empty, +% the current value of the code key is remembered. It will be restored +% just before the exported \tikz statement is invoked, and \tikz[#2] +% will be called. The code key should not rely on any arguments (it +% won't be given any) +% +% The exported routine autodetects whether the result is used inside of +% a picture. In that case, the '#2' style will be set inside of a +% scope instead of \tikz[#2]. +% +% Assembles a macro \pgfplotsretval which, upon execution, draws the +% plot style. +% +% As a side effect, it returns the resulting plot style (nothing else) into +% \pgfplotsretvalb +\def\pgfplots@export@legend@image@to@macro#1#2{% + \begingroup + % I'd like to get all options which are INDEPENDENT of + % pgfplots. Idea: expand all /pgfplots-keys and collect + % everything which belongs NOT to /pgfplots. This is the + % completely expanded rest. At least, I hope so and it appears + % to work. + % + % FIXME : this was a good approach before. Now, there ARE + % /pgfplots keys which should be maintained. How shall I do that? + % I can't handle every option separately... !? + \pgfkeysinstallkeyfilter + {/pgf/key filters/and} + {{/pgf/key filters/is descendant of=/pgfplots}% + {/pgf/key filters/defined}}% + \def\pgfplots@label@tikzopts{}% + \pgfkeysinstallkeyfilterhandler{/pgf/key filter handlers/append filtered to}{\pgfplots@label@tikzopts}% + \pgfqkeysfiltered{/tikz}{#1}% + % + \pgfkeysgetvalue{/pgfplots/legend image code/.@cmd}{\pgfplots@curlegendcode}% + \pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler + \toks0=\expandafter{\pgfplots@curlegendcode\pgfeov}% + \toks1=\expandafter{\pgfplots@label@tikzopts}% + \toks3=\expandafter{\pgfplots@basiclevel@plothandler}% + \def\pgfplots@stylekey{#2}% + \ifx\pgfplots@stylekey\pgfutil@empty + \else + \pgfkeysgetvalue{\pgfplots@stylekey/.@cmd}{\pgfplots@stylekey@}% + \toks4=\expandafter{\pgfplots@stylekey@\pgfeov}% + \fi + \edef\pgfplots@loc@TMPa{% + {% + \ifx\pgfplots@stylekey\pgfutil@empty + \else + \noexpand\scope[#2]% + \fi + % + \noexpand\pgfplots@draw@image + % + \ifx\pgfplots@stylekey\pgfutil@empty + \else + \noexpand\endscope% + \fi + }{% + \noexpand\tikz[#2]{% + \noexpand\pgfplots@draw@image + }% + }% + }% + \expandafter\pgfplots@assemble@ref@picture\pgfplots@loc@TMPa + \toks5=\expandafter{\pgfplotsretval}% + % + \edef\pgfplotsretval{% + \noexpand\begingroup + \noexpand\def\noexpand\pgfplots@draw@image{% + \noexpand\def\noexpand\tikz@plot@handler{\the\toks3}% + \noexpand\pgfkeysdef{/pgfplots/legend image code}{\the\toks0}% + \ifx\pgfplots@stylekey\pgfutil@empty + \else + \noexpand\pgfkeysdef{#2}{\the\toks4}% + \fi + \noexpand\pgfplots@show@small@legendplots{\the\toks1}{}% + }% + \the\toks5 + \noexpand\endgroup% + }% + \xdef\pgfplots@glob@TMPa{\the\toks1}% + \pgfmath@smuggleone\pgfplotsretval + \endgroup + \let\pgfplotsretvalb=\pgfplots@glob@TMPa +}% + % The implementation for \label{foo} after \addplot. It allows to % \ref{foo} (it inserts the 'legend image code'). % @@ -8078,44 +8807,21 @@ \def\pgfplots@plot@label@[#1]#2{% \ifpgfplots@has@label@information \begingroup - % I'd like to get all options which are INDEPENDENT of - % pgfplots. Idea: expand all /pgfplots-keys and collect - % everything which belongs NOT to /pgfplots. This is the - % completely expanded rest. At least, I hope so and it appears - % to work. - % - % FIXME : this was a good approach before. Now, there ARE - % /pgfplots keys which should be maintained. So: maintain all - % of them! Why should that pose any problems? - \pgfkeysinstallkeyfilter - {/pgf/key filters/and} - {{/pgf/key filters/is descendant of=/pgfplots}% - {/pgf/key filters/defined}}% - \def\pgfplots@label@tikzopts{}% - \pgfkeysinstallkeyfilterhandler{/pgf/key filter handlers/append filtered to}{\pgfplots@label@tikzopts}% - \def\pgfplots@loc@TMPa{\pgfqkeysfiltered{/tikz}}% \expandafter\let\expandafter\pgfplots@loc@TMPb\csname pgfplots@last@plot@style@#1\endcsname - \expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@loc@TMPb}% + \expandafter\pgfplots@export@legend@image@to@macro\expandafter{\pgfplots@loc@TMPb}{/pgfplots/every crossref picture}% % - \pgfkeysgetvalue{/pgfplots/every crossref picture/.@cmd}{\pgfplots@crossref@pic}% - \pgfkeysgetvalue{/pgfplots/legend image code/.@cmd}{\pgfplots@curlegendcode}% - \t@pgfplots@toka=\expandafter{\pgfplots@curlegendcode current plot style\pgfeov}% - \t@pgfplots@tokb=\expandafter{\pgfplots@label@tikzopts}% - \t@pgfplots@tokc=\expandafter{\pgfplots@crossref@pic\pgfeov}% + \t@pgfplots@toka=\expandafter{\pgfplotsretval}% + \t@pgfplots@tokb=\expandafter{\pgfplotsretvalb}% % 1. prepare /pgfplots/refstyle={#2}: - \if@filesw - \immediate\write\@auxout{% + \pgfplots@auxwrite{% \noexpand\expandafter\noexpand\gdef \noexpand\csname pgfplots@labelstyle@#2\noexpand\endcsname{\the\t@pgfplots@tokb}% }% % 2. prepare \ref{#2} and \pageref{#2}: % % There are several nasty things to consider: - % a) macro expansion. I did not really understand what happens - % here... I only understand that it is enough if the new label - % makes it into the .aux file of latex. That is sufficient for - % me! So, I converted the label command to a string using the - % \meaning functionality. + % a) macro expansion. Use \string to allow a safe \write + % operation. % % b) \protect . If the resulting \ref{} command occurs within % a "moving argument" like \caption or so, we need to use @@ -8123,29 +8829,16 @@ % % this here is the low-level implementation of \ref{#2}. Write it into % the .aux file: - \immediate\write\@auxout{% + \pgfplots@auxwrite{% \noexpand\expandafter\noexpand\gdef \noexpand\csname pgfplots@show@ref@#2\noexpand\endcsname{% - \noexpand\begingroup - \noexpand\pgfplots@define@currentplotstyle@as{\the\t@pgfplots@tokb}% - \noexpand\pgfkeysdef{/pgfplots/every crossref picture}{\the\t@pgfplots@tokc}% - \noexpand\tikz[/pgfplots/every crossref picture]{\the\t@pgfplots@toka}% - \noexpand\endgroup% + \the\t@pgfplots@toka }% }% - \fi - % This here is the high-level implementation \ref{#2}. - % The \protect handles the cases of "moving arguments": - \edef\pgfplots@loc@TMPa{% - \noexpand\expandafter - \noexpand\protect - \noexpand\csname pgfplots@show@ref@#2\noexpand\endcsname - }% - \pgfplots@command@to@string{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPa}% - \global\let\pgfplots@glob@TMPb=\pgfplots@loc@TMPa + % create the \label command: + \let\label=\pgfplots@original@LaTeX@label + \pgfplots@label{#2}{pgfplots@show@ref@}% \endgroup - \let\@currentlabel=\pgfplots@glob@TMPb - \pgfplots@original@LaTeX@label{#2}% \else \pgfplots@error{Can't create \string\label{#2}: it needs to be called after \string\addplot.}% \fi @@ -8173,6 +8866,9 @@ % \addplot[every mark/.append style={...}] % or something like that is interpreted as /tikz/ key: \pgfplots@invoke@pgfkeyscode{/handler config/full or existing/.@cmd}{}% restrict + % + \pgfkeysdef{/pgfplots/colorbar source}{}% make it NO-OP here. It has already been processed. + % % set both, pgfplots and tikz keys: % the draw is important since \addplot visualizes its stuff % with \path coordinates ... @@ -8216,6 +8912,15 @@ }% }% +% Invokes #1 if the statement occurs within \begin{axis}...\end{axis} +% and #2 if not. +\long\def\pgfplotsifinaxis#1#2{% + \pgfutil@ifundefined{pgfplots@is@in@axis}{#2}{#1}% +}% + +\pgfutil@ifundefined{label}{\relax}{% +}% + % % \begin{axis}[#1] : % @@ -8264,6 +8969,13 @@ % basis the latter to globally for the complete axis. % - will be assigned globally. % - meta data is ALWAYS collected in floating point. +% - \pgfplots@colorbar@src@metamin +% - \pgfplots@colorbar@src@metamax +% - these keys are usually empty, unless one provides the +% 'colorbar source' key for an \addplot command. In that case, +% they will be filled (globally) with the point meta min/max +% ranges of that particular plot. The colorbar will use the +% result for its ranges. % - \pgfplots@numplots % - A count register indexing the current plot counter. Assigned % globally. @@ -8327,10 +9039,21 @@ % - assigned globally. % - \ifpgfplots@coord@stream@isfirst % - assigned globally during \addplot. +% - \pgfplotssurveyphase@setactiveplothandlers +% A macro which is used to implement '\numplotsofactualtype' +% see \pgfplots@countplots@advance for details. % % \def\pgfplots@environment@opt[#1]{% \begingroup + \pgfutil@ifundefined{pgfplots@is@in@axis}{}{% + \pgfplots@error{% + Sorry, nested axis environments are not supported. + Please move the inner axis environment below \string\end{axis} and + use alignment options (for example named nodes, see manual) to place it at the desired + position}% + }% + \def\pgfplots@is@in@axis{1}% \pgfplots@checkandpreparefor@active@semicolon \pgfplots@install@abbrev@commands \pgfplots@stacked@initialise @@ -8407,6 +9130,8 @@ \global\let\pgfplots@data@zmax=\pgfplots@invalidrange@zmax \global\let\pgfplots@axiswide@metamin=\pgfplots@invalidrange@metamin \global\let\pgfplots@axiswide@metamax=\pgfplots@invalidrange@metamax + \global\let\pgfplots@colorbar@src@metamin=\pgfutil@empty + \global\let\pgfplots@colorbar@src@metamax=\pgfutil@empty % \pgfplots@autocompute@all@limitstrue \ifx\pgfplots@xmin\pgfutil@empty @@ -8484,11 +9209,19 @@ % \global\pgfplots@has@label@informationfalse % + \def\numplots{\the\pgfplots@numplots}% + \global\let\pgfplotssurveyphase@setactiveplothandlers=\pgfutil@empty + \let\numplotsofactualtype=\pgfplots@numplotsofactualtype + % % any \path command is invalid inside of an axis. % Use \axispath instead: - \def\numplots{\the\pgfplots@numplots}% \let\path=\pgfplots@replacement@for@tikz@path \let\closedcycle=\pgfplots@path@closed@cycle + \let\pgfplots@orig@scope=\scope + \let\pgfplots@orig@endscope=\endscope + \let\scope=\pgfplots@replacement@for@scope + \let\endscope=\pgfplots@replacement@for@endscope + % } % \end{axis} : @@ -8496,12 +9229,20 @@ % This command actually takes all collected (global) variables, % creates an axis and performs all postponed drawing operations. \def\endpgfplots@environment@opt{% + \pgfutil@ifundefined{label}{\relax}{% + % restore. + \let\label=\pgfplots@original@LaTeX@label + }% \xdef\numplots{\the\pgfplots@numplots}% \pgfkeysvalueof{/pgfplots/before end axis/.@cmd}\pgfeov% % % restore old \path command: \let\path=\pgfplots@orig@path \let\plot=\pgfplots@orig@plot + \let\scope=\pgfplots@orig@scope + \let\endscope=\pgfplots@orig@endscope + % + \pgfplotssurveyphase@setactiveplothandlers % %\end{axis}: % @@ -8533,6 +9274,7 @@ \ifx\pgfplots@stored@current@cmd\pgfutil@empty \pgfplots@stored@current@data% \else + % % this code here means we REALLY have a plotting % command! \scope[current plot style] % this does set BOTH pgfplots and tikz options. @@ -8588,9 +9330,9 @@ \xdef\pgfplots@savedanchor@inner@lowerleft@y{\the\pgf@xa}% % \pgfplotspointaxisorigin - \advance\pgf@x by-\pgf@picminx - \advance\pgf@y by-\pgf@picminy - \xdef\pgfplotspointaxisorigin{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \global\advance\pgf@x by-\pgf@picminx + \global\advance\pgf@y by-\pgf@picminy + \xdef\pgfplotspointaxisorigin{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \endgroup \endpgfinterruptpicture \egroup\egroup% end of pgfnodepartimagebox @@ -8609,11 +9351,31 @@ % \pgftransformshift{\pgfplots@at}% % + \edef\pgfplots@shapename{pgfplots@low@level@shape\ifpgfplots@deprecated@anchors @deprecated\fi}% + \pgfutil@ifundefined{pgf@anchor@\pgfplots@shapename @\pgfplots@anchorname}{% + % Oh. Well, suppose \pgfplots@anchorname is associated to an + % INNER node. + \def\pgfplots@loc@TMPa##1{% + \pgftransformshift{% + % So far, the inner node's position has not been + % corrected (that happens in + % \pgfplots@finally@correct@child@node@positions). + % Do that here with \pgfplots@saveddimen@picminx: + \pgfpointdiff + {\pgfqpoint{\pgfplots@saveddimen@picminx}{\pgfplots@saveddimen@picminy}} + {##1}% + \global\pgf@x=-\pgf@x \global\pgf@y=-\pgf@y + }% + }% + \expandafter\tikz@scan@one@point\expandafter\pgfplots@loc@TMPa\expandafter(\pgfplots@anchorname)% + \def\pgfplots@anchorname{image}% that means: no shift! + }{}% + % \ifpgfplots@deprecated@anchors \pgfplots@restore@deprecated@lowlevel@shape - \pgfmultipartnode{pgfplots@low@level@shape@deprecated}{\pgfplots@anchorname}{\tikz@fig@name}{\pgfusepath{discard}}% + \pgfmultipartnode{\pgfplots@shapename}{\pgfplots@anchorname}{\tikz@fig@name}{\pgfusepath{discard}}% \else - \pgfmultipartnode{pgfplots@low@level@shape}{\pgfplots@anchorname}{\tikz@fig@name}{\pgfusepath{discard}}% + \pgfmultipartnode{\pgfplots@shapename}{\pgfplots@anchorname}{\tikz@fig@name}{\pgfusepath{discard}}% \fi \pgfplots@fig@alias \pgfnodealias{current axis}{\tikz@fig@name}% @@ -8667,14 +9429,14 @@ \pgf@process{\pgfqpoint{\pgfplots@saveddimen@picminx}{\pgfplots@saveddimen@picminy}}% \advance\pgf@xa by-\pgf@x \advance\pgf@xb by-\pgf@y - \pgf@x=\pgf@xa - \pgf@y=\pgf@xb + \global\pgf@x=\pgf@xa + \global\pgf@y=\pgf@xb \edef\pgfplots@offset{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% % \pgfutil@for\pgfplots@child@node@name:=\pgfplots@named@child@node@list\do{% \ifx\pgfplots@child@node@name\pgfutil@empty \else -%\message{Attempting to correct '\pgfplots@child@node@name' position (it is inside of an axis).}% +%\message{Attempting to correct '\pgfplots@child@node@name' position by \meaning\pgfplots@offset\space (the node is inside of an axis).}% \expandafter\ifx\csname pgfplots@child@node@visited@\pgfplots@child@node@name\endcsname\relax% \pgfutil@ifundefined{pgf@sh@nt@\pgfplots@child@node@name}{% \pgfplots@warning{could not adjust coordinates of named node '\pgfplots@child@node@name' for reasons I do not understand! After finishing the image, it did no longer exist!? Sorry.}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex new file mode 100644 index 00000000000..6cf2d1c1e2b --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex @@ -0,0 +1,3 @@ +\def\pgfplotsrevision{% +version_1.4-1-g38878fa +} diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex index 13b71f8e942..fa6547c6bf3 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex @@ -97,14 +97,14 @@ {\pgfqpointxy@orig{##1}{##2}}% }% }% - \edef\pgfplotspointunitx{\pgf@x=\the\pgf@xx\space\pgf@y=\the\pgf@xy\space}% - \edef\pgfplotspointunity{\pgf@x=\the\pgf@yx\space\pgf@y=\the\pgf@yy\space}% + \edef\pgfplotspointunitx{\global\pgf@x=\the\pgf@xx\space\global\pgf@y=\the\pgf@xy\space}% + \edef\pgfplotspointunity{\global\pgf@x=\the\pgf@yx\space\global\pgf@y=\the\pgf@yy\space}% \let\pgfplotsunitxlength=\pgfplots@x@veclength \let\pgfplotsunitylength=\pgfplots@y@veclength \let\pgfplotsunitxinvlength=\pgfplots@x@inverseveclength \let\pgfplotsunityinvlength=\pgfplots@y@inverseveclength \ifpgfplots@threedim - \edef\pgfplotspointunitz{\pgf@x=\the\pgf@zx\space\pgf@y=\the\pgf@zy\space}% + \edef\pgfplotspointunitz{\global\pgf@x=\the\pgf@zx\space\global\pgf@y=\the\pgf@zy\space}% \let\pgfplotsunitzlength=\pgfplots@z@veclength \let\pgfplotsunitzinvlength=\pgfplots@z@inverseveclength \fi @@ -937,7 +937,7 @@ \edef\pgfplots@loc@TMPa{#1}% \expandafter\pgfplotspointouternormalvectorofaxis@\pgfplots@loc@TMPa\relax% % \endgroup in \pgfplotspointouternormalvectorofaxis@. - \expandafter\xdef\csname pgfplotspointouternormalvectorofaxis@cache@#1\endcsname{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}% + \expandafter\xdef\csname pgfplotspointouternormalvectorofaxis@cache@#1\endcsname{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \else \csname pgfplotspointouternormalvectorofaxis@cache@#1\endcsname \fi @@ -1124,8 +1124,8 @@ % % do not allow upside down labels: \ifdim\pgf@x<0pt% - \pgf@x=-\pgf@x% - \pgf@y=-\pgf@y% + \global\pgf@x=-\pgf@x% + \global\pgf@y=-\pgf@y% \fi% % \pgf@ya=-\pgf@y% @@ -1228,7 +1228,7 @@ % % we apply the inverse CM onto it here: \pgf@pos@transform\pgf@x\pgf@y - \edef\pgfplots@tmp@normaldir{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}% + \edef\pgfplots@tmp@normaldir{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% % % Now: % auto-determine the canonical (north, north east etc) anchor @@ -1306,17 +1306,19 @@ \pgfqpointscale {\csname pgfplotsunit#1invlength\endcsname} {\csname pgfplotspointunit#1\endcsname}% - \pgf@pos@transform\pgf@x\pgf@y + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgf@pos@transform\pgf@xa\pgf@ya % \edef\pgfplots@LEQ{% % solve linear system - {\pgf@sys@tonumber\pgf@xb}{\pgf@sys@tonumber\pgf@x}% - {\pgf@sys@tonumber\pgf@yb}{\pgf@sys@tonumber\pgf@y}% + {\pgf@sys@tonumber\pgf@xb}{\pgf@sys@tonumber\pgf@xa}% + {\pgf@sys@tonumber\pgf@yb}{\pgf@sys@tonumber\pgf@ya}% }% % % apply inverse matrix to right-hand-side (and compute RHS): \pgf@sh@reanchor{#3}{center}% - \edef\pgfplots@loc@center{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}% + \edef\pgfplots@loc@center{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \pgfpointdiff% {<start>}{<end>} -> computes <end> - <start> {\pgfplots@loc@center}% {\pgf@sh@reanchor{#3}{\pgfplots@anchor}}% @@ -1554,7 +1556,12 @@ \endgroup %\message{got scalex = \pgfplots@glob@TMPa\space and scaley = \pgfplots@glob@TMPb.}% \pgfmathsubtract@{\pgfplots@xmax}{\pgfplots@xmin}% - \expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}% + % compute 1/(xmax - xmin) in float. + % I observed that it is much more accurate (lead to scaling differences of up to 10pt!) + \pgfmathfloatparsenumber\pgfmathresult + \pgfmathfloatreciprocal@\pgfmathresult + \pgfmathfloattofixed\pgfmathresult + %\expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}% %\message{and 1/(xmax-xmin) = 1/(\pgfplots@xmax-\pgfplots@xmin) = \pgfmathresult.}% \pgf@xx=\pgfplots@glob@TMPa\pgf@xx \pgf@xy=\pgfplots@glob@TMPb\pgf@xy @@ -1562,7 +1569,10 @@ \pgf@xy=\pgfmathresult\pgf@xy % \pgfmathsubtract@{\pgfplots@ymax}{\pgfplots@ymin}% - \expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}% + \pgfmathfloatparsenumber\pgfmathresult + \pgfmathfloatreciprocal@\pgfmathresult + \pgfmathfloattofixed\pgfmathresult + %\expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}% %\message{and 1/(ymay-ymin) = 1/(\pgfplots@ymax-\pgfplots@ymin) = \pgfmathresult.}% \pgf@yx=\pgfplots@glob@TMPa\pgf@yx \pgf@yy=\pgfplots@glob@TMPb\pgf@yy @@ -1571,7 +1581,10 @@ % \ifpgfplots@threedim \pgfmathsubtract@{\pgfplots@zmax}{\pgfplots@zmin}% - \expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}% + \pgfmathfloatparsenumber\pgfmathresult + \pgfmathfloatreciprocal@\pgfmathresult + \pgfmathfloattofixed\pgfmathresult + %\expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}% %\message{and 1/(zmaz-zmin) = 1/(\pgfplots@zmax-\pgfplots@zmin) = \pgfmathresult.}% \pgf@zx=\pgfplots@glob@TMPa\pgf@zx \pgf@zy=\pgfplots@glob@TMPb\pgf@zy @@ -1646,10 +1659,7 @@ % - \csname pgfpmeta@#1@assign\endcsname{} % During the survey phase, this macro is expected to assign % \pgfplots@current@point@meta -% This method should prepare everything which is needed to invoke -% the postprocessors, i.e. it prepares the input for point meta -% transformations to [0,1000] or the scatter plot things. In other -% words: if it is a numeric input method, it should return a +% if it is a numeric input method, it should return a % floating point number. % It is allowed to return an empty string to say "there is no point % meta". @@ -1661,13 +1671,19 @@ % - \pgfplots@current@point@meta is ready for use: % - EITHER a parsed floating point number % - OR an empty string, -% - OR a symbolic string (if #3=symbolic) +% - OR a symbolic string (if the issymbolic boolean is true) % The default implementation is % \let\pgfplots@current@point@meta=\pgfutil@empty % % - \csname pgfpmeta@#1@issymbolic\endcsname -> expands to either '1' or '0' -% A numeric source will be processed numerically, i.e. the final map -% to [0,1000] will be initialised and meta limits will be updated. +% A numeric source will be processed numerically in float +% arithmetics. Thus, the output of the @assign routine should be +% a macro \pgfplots@current@point@meta in float format. +% +% The output of a numeric point meta source will result in meta +% limit updates and the final map to [0,1000] will be +% initialised automatically. +% % A symbolic input routine won't be processed. % Default is '0' % @@ -1697,6 +1713,7 @@ \expandafter\def\csname pgfpmeta@#1@initfor\endcsname##1{}% \expandafter\def\csname pgfpmeta@#1@issymbolic\endcsname{0}% \expandafter\def\csname pgfpmeta@#1@explicitinput\endcsname{0}% + \expandafter\def\csname pgfpmeta@#1@activate\endcsname{}% \edef\pgfplotsdeclarepointmetasource@{#1}% \pgfqkeys{/pgfplots/@declare point meta src}{#2}% }% @@ -1705,6 +1722,10 @@ {\expandafter\def\csname pgfpmeta@\pgfplotsdeclarepointmetasource@ @assign\endcsname{#1}},% initfor/.code= {\expandafter\def\csname pgfpmeta@\pgfplotsdeclarepointmetasource@ @initfor\endcsname##1{#1}},% + % Called during the survey phase before the first 'assign' call. + % It is usually empty. + activate/.code= + {\expandafter\def\csname pgfpmeta@\pgfplotsdeclarepointmetasource@ @activate\endcsname{#1}},% issymbolic/.code= {\expandafter\def\csname pgfpmeta@\pgfplotsdeclarepointmetasource@ @issymbolic\endcsname{#1}},% explicitinput/.code= @@ -1777,6 +1798,48 @@ }% \pgfkeyssetvalue{/pgfplots/point meta/expr}{}% +\pgfplotsdeclarepointmetasource{f(x)}{% + activate={% + \ifpgfplots@curplot@threedim + \def\pgfplotspointmetainputhandler{z}% + \else + \def\pgfplotspointmetainputhandler{y}% + \fi + \csname pgfpmeta@\pgfplotspointmetainputhandler @activate\endcsname + }, +}% + + +\pgfplotsdeclarepointmetasource{TeX code}{% + assign={% + \begingroup + \let\pgfplotspointmeta=\pgfutil@empty + \pgfplots@invoke@pgfkeyscode{/pgfplots/point meta/code/.@cmd}{}% + \pgfmathfloatparsenumber{\pgfplotspointmeta}% + \let\pgfplots@current@point@meta=\pgfmathresult + \pgfmath@smuggleone\pgfplots@current@point@meta + \endgroup + },% + initfor={% + \pgfkeysdef{/pgfplots/point meta/code}{#1}% + }, +}% +\pgfplotsdeclarepointmetasource{TeX code symbolic}{% + assign={% + \begingroup + \let\pgfplotspointmeta=\pgfutil@empty + \pgfplots@invoke@pgfkeyscode{/pgfplots/point meta/code/.@cmd}{}% + \let\pgfplots@current@point@meta=\pgfplotspointmeta + \pgfmath@smuggleone\pgfplots@current@point@meta + \endgroup + },% + initfor={% + \pgfkeysdef{/pgfplots/point meta/code}{#1}% + }, + issymbolic=1% +}% +\pgfkeysdef{/pgfplots/point meta/code}{}% + % Internal stream methods. % % Please overwrite @@ -2513,6 +2576,7 @@ \pgfmathfloatcreate{0}{0.0}{0}% \fi }% + \csname pgfpmeta@\pgfplotspointmetainputhandler @activate\endcsname % % %%%%%%%%%%%%%% % @@ -2587,6 +2651,14 @@ \global\let\pgfplots@axiswide@metamax=\pgfmathresult \fi \fi + \if1\pgfplots@colorbar@set@src% this 0|1 switch is set in \pgfplots@start@plot@with@behavioroptions + \ifx\pgfplots@metamin\pgfutil@empty + \pgfplotsthrow{no such element}{\pgfplots@loc@TMPa}{Sorry, `colorbar source' can't be processed: the current \string\addplot\space command doesn't have point meta. Ignoring it.}\pgfeov% + \else + \global\let\pgfplots@colorbar@src@metamin=\pgfplots@metamin + \global\let\pgfplots@colorbar@src@metamax=\pgfplots@metamax + \fi + \fi \ifpgfplots@autocompute@all@limits \global\let\pgfplots@data@xmin=\pgfplots@xmin \global\let\pgfplots@data@xmax=\pgfplots@xmax @@ -2647,6 +2719,15 @@ {% precommand(s): \expandafter\noexpand\csname pgfplots@curplot@threedim\ifpgfplots@curplot@threedim true\else false\fi\endcsname \noexpand\def\noexpand\plotnum{\the\pgfplots@numplots}% + % + % store \plotnumofactualtype + \noexpand\def\noexpand\plotnumofactualtype{\numplotsofactualtype}% + % ... and make sure that it + % remains the same type even if some plot handler uses + % other plot handlers internally: + \noexpand\def\noexpand\pgfplotsplothandlername@actual{\pgfplotsplothandlername@actual}% + \noexpand\let\noexpand\numplotsofactualtype\noexpand\pgfplots@numplotsofactualtype@duringplot + % \noexpand\def\noexpand\numcoords{\pgfplots@current@point@coordindex}% % \pgfplots@current@point@coordindex will always contain the current index. % Maybe overwritten if not provided using \c@pgfplots@coordindex. @@ -2804,7 +2885,7 @@ \message{PGFPlots: Scanline length is \pgfplotsscanlinelength.}% \else \ifnum\pgfplotsscanlinelength=-2 - \message{PGFPlots: Scanline length could not be determined as multiple, different scan line lengths have been found.}% + \message{PGFPlots: Scanline length could not be determined since multiple, different scan line lengths have been found.}% \else \message{PGFPlots: No end-of-scanline marker found in input stream.}% \fi @@ -4171,21 +4252,21 @@ \def\pgfplots@gnuplot@logdirs{}% \ifpgfplots@xislinear \else + \pgfplots@identify@gnuplot@logbehavior x% \expandafter\def\expandafter\pgfplots@gnuplot@logdirs\expandafter{\pgfplots@gnuplot@logdirs x}% \fi \ifpgfplots@yislinear \else + \pgfplots@identify@gnuplot@logbehavior y% \expandafter\def\expandafter\pgfplots@gnuplot@logdirs\expandafter{\pgfplots@gnuplot@logdirs y}% \fi \ifpgfplots@curplot@threedim \ifpgfplots@zislinear \else + \pgfplots@identify@gnuplot@logbehavior z% \expandafter\def\expandafter\pgfplots@gnuplot@logdirs\expandafter{\pgfplots@gnuplot@logdirs z}% \fi - \pgfplots@disablelogfilter@ztrue \fi - \pgfplots@disablelogfilter@xtrue - \pgfplots@disablelogfilter@ytrue \ifpgfplots@curplot@threedim \if1\b@pgfplots@should@sample@LINE \pgfplots@error{Sorry, I do not know how to sample 3D LINE plots with gnuplot... I only know 2D line and 3D mesh. You may want to help the author of pgfplots to improve this feature.}% @@ -4222,6 +4303,55 @@ \let\pgfplotxyfile=\pgfplots@backupof@pgfplotxyfile }% +\def\pgfplots@identify@gnuplot@logbehavior#1{% + \pgfutil@ifundefined{pgfplots@gnuplot@logscale@writes@log}{% + \pgfplots@identify@gnuplot@logbehavior@checkversion% + }{}% + \if1\pgfplots@gnuplot@logscale@writes@log + \csname pgfplots@disablelogfilter@#1true\endcsname + \fi +}% +\def\pgfplots@identify@gnuplot@logbehavior@checkversion{% + \immediate\write18{gnuplot -V >\pgfplots@plot@filename}% + \openin\r@pgfplots@reada=\pgfplots@plot@filename\relax + \ifeof\r@pgfplots@reada + \pgfplots@warning{Sorry, I could not determine 'gnuplot -V' to check whether gnuplot and logscale writes results in log() or not. Please set `/pgfplots/gnuplot writes logscale=true|false' manually.}% + \gdef\pgfplots@gnuplot@logscale@writes@log{1}% something doesn't work. set it somehow. + \else + \read\r@pgfplots@reada to\pgfplots@loc@TMPa + \gdef\pgfplots@gnuplot@logscale@writes@log{1}% + \immediate\write-1{Package pgfplots: checking gnuplot -V : `\pgfplots@loc@TMPa' (if this fails, set `/pgfplots/gnuplot writes logscale=true|false')}% + \expandafter\pgfplots@identify@gnuplot@logbehavior@checkversion@\pgfplots@loc@TMPa\relax + \closein\r@pgfplots@reada + \fi +}% +\def\pgfplots@identify@gnuplot@logbehavior@checkversion@#1 #2.#3 #4\relax{% + % starting with gnuplot 4.4, output files are no longer in + % logarithmic scale for log plots. + \ifnum#2<4 + % version 3.X + \gdef\pgfplots@gnuplot@logscale@writes@log{1}% + \else + \ifnum#2>4 + % version 5.X + \gdef\pgfplots@gnuplot@logscale@writes@log{0}% + \else + \ifnum#3<4 + % version 4.2 : + \gdef\pgfplots@gnuplot@logscale@writes@log{1}% + \else + % version 4.4 or later : + \gdef\pgfplots@gnuplot@logscale@writes@log{0}% + \fi + \fi + \fi + \if0\pgfplots@gnuplot@logscale@writes@log + \immediate\write-1{Package pgfplots: I found gnuplot version >= 4.4. This one doesn't write log() coordinates. I will apply log() manually.}% + \else + \immediate\write-1{Package pgfplots: I found gnuplot version < 4.4. This one writes log() coordinates. I'll handle it accordingly.}% + \fi +}% + \def\pgfplots@addplotimpl@gnuplotresult#1#2{% \begingroup \openin\r@pgfplots@reada=#2 @@ -4317,11 +4447,11 @@ \pgfplots@PREPARE@COORD@STREAM{#4}% \pgfplots@coord@stream@start \pgfplotsscanlinelengthinitzero - \pgfplots@logfileopen{#3}% \openin\r@pgfplots@reada=#3 \ifeof\r@pgfplots@reada \pgfplots@error{sorry, plot file{#3} could not be opened}% \else + \pgfplots@logfileopen{#3}% \let\pgfplots@current@point@x@error=\pgfutil@empty \let\pgfplots@current@point@y@error=\pgfutil@empty \let\pgfplots@current@point@z@error=\pgfutil@empty @@ -4337,6 +4467,7 @@ \let\pgfplots@addplotimpl@file@parsesingle=\pgfplots@addplotimpl@file@parsesingle@twodim@andmeta \fi \fi + \pgfplotstableinstallignorechars% \pgfplots@addplotimpl@file@readall \fi \pgfplotsscanlinelengthcleanup @@ -4397,9 +4528,10 @@ }% }% % \addplot[#1] plot[#2] graphics[#3] {#4} #5; -\def\pgfplots@addplotimpl@graphics@#1#2[#3]#4#5;{\pgfplots@addplotimpl@graphics@@{#1}{#2}{#3}{#4}{#5}}% -\def\pgfplots@addplotimpl@graphics@@#1#2#3#4#5{% +\long\def\pgfplots@addplotimpl@graphics@#1#2[#3]#4#5;{\pgfplots@addplotimpl@graphics@@{#1}{#2}{#3}{#4}{#5}}% +\long\def\pgfplots@addplotimpl@graphics@@#1#2#3#4#5{% \pgfplots@start@plot@with@behavioroptions{#1,/pgfplots/.cd,#2,% + /pgfplots/plot graphics/@prepare legend, /pgfplots/plot graphics,% /pgfplots/plot graphics/.cd,% #3,% @@ -4491,18 +4623,23 @@ \pgfutil@ifnextchar[{% \pgfplots@addplotimpl@table@getopts{#1}% }{% - \pgfplots@addplotimpl@table@getopts{#1}[x index=0,y index=1]% + \pgfplots@addplotimpl@table@getopts{#1}[]% }% }% \def\pgfplots@addplotimpl@table@getopts#1[#2]{% + % set options outside of the following group. + % They may contain behavior options. + \pgfplots@addplotimpl@table@installkeypath + \pgfplotstableset{#2}% + % \pgfutil@ifnextchar s{% \pgfplots@addplotimpl@table@fromshell{#1}{#2}% }{% \pgfutil@ifnextchar f{% - \pgfplots@addplotimpl@table@fromstructure{#1}{#2}% + \pgfplots@addplotimpl@table@fromstructure@gobble@space{#1}{#2}% }{% - \pgfplots@addplotimpl@table@fromfile{#1}{#2}% + \pgfplots@addplotimpl@table@fromfile@gobble@space{#1}{#2}% }% }% } @@ -4523,15 +4660,42 @@ % \addplot[#1] table[#2] from {#3} #4; % % #1: arguments to \addplot[...] -% #2: arguments to table[...] +% #2: arguments to table[...] (already processed!) % #3: the argument of plot table{...} % #4: trailing path arguments after plot table{...}#4; +\long\def\pgfplots@addplotimpl@table@fromstructure@gobble@space#1#2from{% + \pgfplotstablecollectoneargwithpreparecatcodes{% + \pgfplots@addplotimpl@table@fromstructure{#1}{#2}from% + }% +}% + +\def\pgfplots@addplot@table@fromstructure@preparecolname#1#2#3#4{% + \pgfkeysgetvalue{/pgfplots/table/#1}{\pgfplots@loc@TMPa}% + % + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \pgfkeysgetvalue{/pgfplots/table/#1 index}{\pgfplots@loc@TMPa}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \pgfplotstablegetcolumnnamebyindex\pgfplots@loc@TMPa\of#2\to\pgfplots@loc@TMPa + \fi + \fi + \let#3=\pgfplots@loc@TMPa + % + % modify \pgfplots@plot@tbl@{x,y,z,meta} if there are + % corresponding '#1 expr' statements: + \pgfplots@addplotimpl@table@fromstructure@prepareexpr@for{#1}{#3}{#4}% +} + +% Invokes `#1' if the command is invoked within +% \addplot table {<\macro>}; +% and `#2' if not. +\def\pgfplotsifinaddplottablestruct#1#2{% + \pgfutil@ifundefined{pgfplots@plot@tbl@meta}{#2}{#1}% +}% + \long\def\pgfplots@addplotimpl@table@fromstructure#1#2from#3#4;{\pgfplots@addplotimpl@table@startprocessing{#1}{#2}{#3}{#4}}% % \addplot[#1] table[#2] from {#3} #4 ; \long\def\pgfplots@addplotimpl@table@fromstructure@#1#2#3#4{% - % set options here. They may contain behavior options! - \pgfplots@addplotimpl@table@installkeypath - \pgfplotstableset{#2}% \begingroup \pgfplotstablegetscanlinelength{#3}{\pgfplotsscanlinelength}% % FIXME : this thing here has runtime O(N^2) ! @@ -4539,57 +4703,28 @@ % % well, for a lot of columns which are used in different contexts % and few rows, this here IS more efficient. - \pgfplotstablecopy#3\to\pgfplots@table - \pgfkeysgetvalue{/pgfplots/table/x}{\pgfplots@plot@tbl@x}% - \pgfkeysgetvalue{/pgfplots/table/x index}{\pgfplots@plot@tbl@xindex}% - \pgfkeysgetvalue{/pgfplots/table/y}{\pgfplots@plot@tbl@y}% - \pgfkeysgetvalue{/pgfplots/table/y index}{\pgfplots@plot@tbl@yindex}% - \pgfkeysgetvalue{/pgfplots/table/z}{\pgfplots@plot@tbl@z}% - \pgfkeysgetvalue{/pgfplots/table/z index}{\pgfplots@plot@tbl@zindex}% - \pgfkeysgetvalue{/pgfplots/table/meta}{\pgfplots@plot@tbl@meta}% - \pgfkeysgetvalue{/pgfplots/table/meta index}{\pgfplots@plot@tbl@metaindex}% % - \ifx\pgfplots@plot@tbl@x\pgfutil@empty - \pgfplotstablegetcolumnnamebyindex\pgfplots@plot@tbl@xindex\of\pgfplots@table\to\pgfplots@plot@tbl@x - \fi - \ifx\pgfplots@plot@tbl@y\pgfutil@empty - \pgfplotstablegetcolumnnamebyindex\pgfplots@plot@tbl@yindex\of\pgfplots@table\to\pgfplots@plot@tbl@y - \fi + \pgfplots@addplot@table@fromstructure@preparecolname{x}{#3}\pgfplots@plot@tbl@x\columnx + \pgfplots@addplot@table@fromstructure@preparecolname{y}{#3}\pgfplots@plot@tbl@y\columny \ifpgfplots@curplot@threedim - \ifx\pgfplots@plot@tbl@z\pgfutil@empty - \pgfplotstablegetcolumnnamebyindex\pgfplots@plot@tbl@zindex\of\pgfplots@table\to\pgfplots@plot@tbl@z - \fi - \fi - \ifx\pgfplots@plot@tbl@meta\pgfutil@empty - \ifx\pgfplots@plot@tbl@metaindex\pgfutil@empty - \else - \pgfplotstablegetcolumnnamebyindex\pgfplots@plot@tbl@metaindex\of\pgfplots@table\to\pgfplots@plot@tbl@meta - \fi + \pgfplots@addplot@table@fromstructure@preparecolname{z}{#3}\pgfplots@plot@tbl@z\columnz \fi + \pgfplots@addplot@table@fromstructure@preparecolname{meta}{#3}\pgfplots@plot@tbl@meta\columnmeta % % % high level user interface functions: \let\lineno=\coordindex% is the same here % - % modify \pgfplots@plot@tbl@{x,y,z,meta} if there are - % corresponding '#1 expr' statements: - \pgfplots@addplotimpl@table@fromstructure@prepareexpr@for x\columnx% - \pgfplots@addplotimpl@table@fromstructure@prepareexpr@for y\columny% - \pgfplots@addplotimpl@table@fromstructure@prepareexpr@for {meta}\columnmeta% + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@x}\of#3\to\addplot@tbl@x + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@y}\of#3\to\addplot@tbl@y \ifpgfplots@curplot@threedim - \pgfplots@addplotimpl@table@fromstructure@prepareexpr@for z\columnz% - \fi - % - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@x\of\pgfplots@table\to\addplot@tbl@x - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@y\of\pgfplots@table\to\addplot@tbl@y - \ifpgfplots@curplot@threedim - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@z\of\pgfplots@table\to\addplot@tbl@z + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@z}\of#3\to\addplot@tbl@z \fi % \let\addplot@tbl@meta=\pgfutil@empty \ifx\pgfplots@plot@tbl@meta\pgfutil@empty \else - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@meta\of\pgfplots@table\to\addplot@tbl@meta + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@meta}\of#3\to\addplot@tbl@meta \fi % % @@ -4597,57 +4732,26 @@ \let\addplot@tbl@error@y=\pgfutil@empty \let\addplot@tbl@error@z=\pgfutil@empty \ifpgfplots@errorbars@enabled - \pgfkeysgetvalue{/pgfplots/table/x error index}\pgfplots@plot@tbl@error@xindex - \pgfkeysgetvalue{/pgfplots/table/x error}\pgfplots@plot@tbl@error@x - \pgfkeysgetvalue{/pgfplots/table/y error index}\pgfplots@plot@tbl@error@yindex - \pgfkeysgetvalue{/pgfplots/table/y error}\pgfplots@plot@tbl@error@y - \pgfkeysgetvalue{/pgfplots/table/z error index}\pgfplots@plot@tbl@error@zindex - \pgfkeysgetvalue{/pgfplots/table/z error}\pgfplots@plot@tbl@error@z - \ifx\pgfplots@plot@tbl@error@x\pgfutil@empty - \ifx\pgfplots@plot@tbl@error@xindex\pgfutil@empty - \else - \pgfplotstablegetcolumnnamebyindex\pgfplots@plot@tbl@error@xindex\of\pgfplots@table\to\pgfplots@plot@tbl@error@x - \fi - \fi - % - \ifx\pgfplots@plot@tbl@error@y\pgfutil@empty - \ifx\pgfplots@plot@tbl@error@yindex\pgfutil@empty - \else - \pgfplotstablegetcolumnnamebyindex\pgfplots@plot@tbl@error@yindex\of\pgfplots@table\to\pgfplots@plot@tbl@error@y - \fi - \fi - % + \pgfplots@addplot@table@fromstructure@preparecolname{x error}{#3}\pgfplots@plot@tbl@error@x\columnerrorx + \pgfplots@addplot@table@fromstructure@preparecolname{y error}{#3}\pgfplots@plot@tbl@error@y\columnerrory \ifpgfplots@curplot@threedim - \ifx\pgfplots@plot@tbl@error@z\pgfutil@empty - \ifx\pgfplots@plot@tbl@error@zindex\pgfutil@empty - \else - \pgfplotstablegetcolumnnamebyindex\pgfplots@plot@tbl@error@zindex\of\pgfplots@table\to\pgfplots@plot@tbl@error@z - \fi - \fi + \pgfplots@addplot@table@fromstructure@preparecolname{z error}{#3}\pgfplots@plot@tbl@error@z\columnerrorz \else \let\pgfplots@plot@tbl@error@z=\pgfutil@empty \fi % - % modify \pgfplots@plot@tbl@{x error,y error,z error} if there are - % corresponding '#1 expr' statements: - \pgfplots@addplotimpl@table@fromstructure@prepareexpr@for {x error}\columnerrorx% - \pgfplots@addplotimpl@table@fromstructure@prepareexpr@for {y error}\columnerrory% - \ifpgfplots@curplot@threedim - \pgfplots@addplotimpl@table@fromstructure@prepareexpr@for {z error}\columnerrorz% - \fi - % % now: load the columns: \ifx\pgfplots@plot@tbl@error@x\pgfutil@empty \else - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@error@x\of\pgfplots@table\to\addplot@tbl@error@x + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@error@x}\of#3\to\addplot@tbl@error@x \fi \ifx\pgfplots@plot@tbl@error@y\pgfutil@empty \else - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@error@y\of\pgfplots@table\to\addplot@tbl@error@y + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@error@y}\of#3\to\addplot@tbl@error@y \fi \ifx\pgfplots@plot@tbl@error@z\pgfutil@empty \else - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@error@z\of\pgfplots@table\to\addplot@tbl@error@z + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@error@z}\of#3\to\addplot@tbl@error@z \fi % \else @@ -4719,13 +4823,19 @@ % temporary name). % The old value of \pgfplots@plot@tbl@#1 is available as column % alias. -% the high level user interface command '#2' will be set correctly. -\def\pgfplots@addplotimpl@table@fromstructure@prepareexpr@for#1#2{% +% the high level user interface command '#3' will be set correctly. +% +% #1: the key name of the current entity, for example 'x' for +% '/pgfplots/table/x' +% #2: the low level column name representing the data which is already +% defined somehow +% #3: a high level user interface command +\def\pgfplots@addplotimpl@table@fromstructure@prepareexpr@for#1#2#3{% % get old column name into a register: - \t@pgfplots@tokb=\expandafter\expandafter\expandafter{\csname pgfplots@plot@tbl@#1\endcsname}% + \t@pgfplots@tokb=\expandafter{#2}% % % high level user interface command: - \edef#2{\noexpand\thisrow{\the\t@pgfplots@tokb}}% + \edef#3{\noexpand\thisrow{\the\t@pgfplots@tokb}}% % \pgfkeysgetvalue{/pgfplots/table/#1 expr}{\pgfplots@loc@TMPa}% \ifx\pgfplots@loc@TMPa\pgfutil@empty @@ -4746,7 +4856,7 @@ % % tell `plot table' which column should be used for '#1': the % temporary column. - \expandafter\def\csname pgfplots@plot@tbl@#1\endcsname{#1expr@tempcol}% + \def#2{#1expr@tempcol}% \fi }% @@ -4759,31 +4869,30 @@ % number of rows is less than about 110000). % % #1: arguments to \addplot[...] -% #2: arguments to table[...] +% #2: arguments to table[...] (already processed!) % #3: the argument of plot table{...} % #4: trailing path arguments after plot table{...}#4; % +\long\def\pgfplots@addplotimpl@table@fromfile@gobble@space#1#2{% + \pgfplotstablecollectoneargwithpreparecatcodes{% + \pgfplots@addplotimpl@table@fromfile{#1}{#2}% + }% +}% \long\def\pgfplots@addplotimpl@table@fromfile#1#2#3#4;{\pgfplots@addplotimpl@table@startprocessing{#1}{#2}{#3}{#4}}% % \addplot[#1] table[#2] {#3} {#4}; \long\def\pgfplots@addplotimpl@table@fromfile@#1#2#3#4{% - % set options outside of the following group. - % They may contain behavior options. - \pgfplots@addplotimpl@table@installkeypath - \pgfplotstableset{#2}% - %-------------------------------------------------- - % \begingroup - % \pgfplotstableset{#2}% - % \pgfplotstableread{#3}\pgfplots@table - % \pgfplots@addplotimpl@table@fromstructure{#1}{}from{\pgfplots@table}{#4};% - % \endgroup - %-------------------------------------------------- - %\begingroup + \if1\pgfplots@addplotimpl@readcompletely@auto + \pgfplots@addplotimpl@table@check@createonuse@for{x}% + \pgfplots@addplotimpl@table@check@createonuse@for{y}% + \ifpgfplots@curplot@threedim + \pgfplots@addplotimpl@table@check@createonuse@for{z}% + \fi + \pgfplots@addplotimpl@table@check@createonuse@for{meta}% + \fi + % \ifpgfplots@addplotimpl@readcompletely \pgfplotstableread{#3}\pgfplots@table \pgfplots@addplotimpl@table@fromstructure@{#1}{}{\pgfplots@table}{#4}% - % \pgfmath@smuggleone\pgfplotsscanlinelength - % \endgroup - % \pgfplotsscanlinedisablechanges \else \pgfplotsapplistXXglobalnewempty % @@ -4832,30 +4941,15 @@ \pgfplotstableread*{#3} to listener\pgfplots@addplotimpl@table@fromfile@listener@COLLECTNORMALIZED \fi \pgfplots@coord@stream@end - % FIXME : i'd be glad if I could save this group: check why not - % perhaps because \pgfplotstableread uses several pgf - % variables? - %\pgfmath@smuggleone\pgfplotsscanlinelength - %\endgroup - %\pgfplotsscanlinedisablechanges - % - %\pgfplots@PREPARE@COORD@STREAM{#4}% - %\pgfplotsapplistXXgloballet\pgfplots@coordlist - %\pgfplotsapplistXXglobalclear - %\ifpgfplots@errorbars@enabled - % \pgfplots@plot@coords@mathparserfalse - % \ifpgfplots@curplot@threedim - % \expandafter\pgfplots@coord@stream@foreach@threedim\expandafter{\pgfplots@coordlist}%% - % \else - % \expandafter\pgfplots@coord@stream@foreach\expandafter{\pgfplots@coordlist}%% - % \fi - %\else - % this here is the usual case; it is faster than the error bar - % stuff. - % \expandafter\pgfplots@coord@stream@foreach@NORMALIZED\expandafter{\pgfplots@coordlist}% - %\fi \fi } +\def\pgfplots@addplotimpl@table@check@createonuse@for#1{% + \pgfkeysgetvalue{/pgfplots/table/#1}\pgfplots@addplotimpl@table@check@createonuse@for@ + \expandafter\pgfplotstableifiscreateonuse\expandafter{\pgfplots@addplotimpl@table@check@createonuse@for@}{% + \pgfplots@addplotimpl@readcompletelytrue + }{% + }% +}% \def\pgfplots@addplotimpl@table@fromfile@listener@COLLECTNORMALIZED{% \pgfplots@addplotimpl@table@fromfile@listener@ \pgfplots@coord@stream@coord @@ -5111,10 +5205,19 @@ \c@pgfplots@coordindex=0 \def\pgfplots@current@point@coordindex{\the\c@pgfplots@coordindex}% can be used inside of coordinate filters. \def\coordindex{\pgfplots@current@point@coordindex}% valid inside of \addplot - \ifpgfplots@usefpu - \pgfkeys{/pgf/fpu=true}% - \fi \def\pgfplots@addplot@running{1}% + \def\pgfplots@colorbar@set@src{0}% + \pgfkeysdef{/pgfplots/colorbar source}{% + \pgfplotsutilifstringequal{##1}{true}{% + \def\pgfplots@colorbar@set@src{1}% + }{% + \pgfplotsutilifstringequal{##1}{false}{% + \def\pgfplots@colorbar@set@src{0}% + }{% + \pgfplots@error{Sorry, I don't know the value `colorbar source={##1}' and I am going to ignore it. Maybe you misspelled it?}% + }% + }% + }% % % these styles may contain behavior options (error bars, % samples,... ) activate them! @@ -5135,19 +5238,19 @@ % need to change the .unknown handler. See the available % compatibility styles! % - \pgfkeysdef{/pgfplots/.unknown}{% + % ATTENTION: starting with more recent versions (since the + % unstable version), I will also set /tikz keys here! This should + % work. It is well tested for the unstable... I hope it will also + % work for the master branch. + %\pgfkeysdef{/pgfplots/.unknown}{% %\message{In \string\addplot[#1]: I am silently ignoring key `\pgfkeyscurrentkeyRAW' during the preparation phase.}% - }% + %}% % % it is possible that '#1' contains 'forget plot'. So, we need to % set the options before checking % \ifpgfplots@curplot@isirrelevant: \pgfplotsset{/pgfplots/every axis plot,#1}% % - % hooks: - \pgfkeysvalueof{/pgfplots/execute at begin plot@@}% - \pgfkeysvalueof{/pgfplots/execute at begin plot}% - % \ifpgfplots@curplot@isirrelevant \def\pgfplots@addplot@survey@@optionlist{/pgfplots/every axis plot,/pgfplots/every forget plot}% \pgfplotsset{/pgfplots/every forget plot,/pgfplots/every axis plot post}% @@ -5155,6 +5258,21 @@ \edef\pgfplots@addplot@survey@@optionlist{/pgfplots/every axis plot,/pgfplots/every axis plot no \the\pgfplots@numplots/.try}% \pgfplotsset{/pgfplots/every axis plot no \the\pgfplots@numplots/.try,/pgfplots/every axis plot post}% \fi + % + \ifpgfplots@usefpu + \pgfkeys{/pgf/fpu=true}% + \fi + \pgfplots@countplots@init + % + % hooks: + \pgfkeysvalueof{/pgfplots/execute at begin plot@@}% + \pgfkeysvalueof{/pgfplots/execute at begin plot}% + % + \if1\pgfplots@colorbar@set@src + \expandafter\def\expandafter\pgfplots@addplot@survey@@optionlist\expandafter{\pgfplots@addplot@survey@@optionlist,% + /pgfplots/point meta rel=per plot}% + \fi + % \expandafter\def\expandafter\pgfplots@addplot@survey@@optionlist\expandafter{\pgfplots@addplot@survey@@optionlist,% #1,/pgfplots/.cd,/pgfplots/every axis plot post}% \pgfplots@validate@plot@domain@arguments @@ -5210,13 +5328,76 @@ \def\pgfplots@end@plot{% \ifpgfplots@curplot@isirrelevant \else - \global\advance\pgfplots@numplots by1\relax% + \pgfplots@countplots@advance \fi \pgfkeysvalueof{/pgfplots/execute at end plot@@}% \pgfkeysvalueof{/pgfplots/execute at end plot}% \endgroup%<-- close the \begingroup of \pgfplots@addplotimpl@plot@withoptions } +% \numplotsofactualtype +% Expands to the number of plots which have been seen in the current +% axis and which have the same type as the actual plot handler. +% +% See also \plotnumofactualtype +\def\pgfplots@numplotsofactualtype{% + \pgfutil@ifundefined{pgfplotssurveyphase@setactiveplothandlers@\pgfplotsplothandlername}{% + 0% + }{% + \csname c@pgfplots@numplotsofactualtype@\pgfplotsplothandlername\endcsname + }% +}% +% use this only inside of \addplot or during the visualization phase +% of a plot. +\def\pgfplots@numplotsofactualtype@duringplot{% + \pgfutil@ifundefined{pgfplotssurveyphase@setactiveplothandlers@\pgfplotsplothandlername@actual}{% + 0% + }{% + \csname c@pgfplots@numplotsofactualtype@\pgfplotsplothandlername@actual\endcsname + }% +}% +% +% This macro may be overwritten inside of the \tikz@plot@handler +% macro. This here is just the default implementation. +% +% @INTERNAL HINT: I think the unstable version has another +% implementation. make sure it's not overwritten! +\def\pgfplotsplothandlername{\meaning\tikz@plot@handler}% +% +\def\pgfplots@countplots@init{% +% + % + \pgfplotssurveyphase@setactiveplothandlers + % + \let\numplotsofactualtype=\pgfplots@numplotsofactualtype@duringplot + % + % Store this name during the \addplot command. Thus, even if the + % plot handler changes, we will keep this one. + \edef\pgfplotsplothandlername@actual{\pgfplotsplothandlername}% + % + \pgfutil@ifundefined{pgfplotssurveyphase@setactiveplothandlers@\pgfplotsplothandlername@actual}{% + % oh. This is the first time \pgfplotsplothandlername was used + % in this axis. Set its counter to 0 and remember that it has + % been initialised. + \expandafter\xdef\csname c@pgfplots@numplotsofactualtype@\pgfplotsplothandlername@actual\endcsname{0}% + \t@pgfplots@toka=\expandafter{\pgfplotssurveyphase@setactiveplothandlers}% + \t@pgfplots@tokb=\expandafter{\pgfplotsplothandlername@actual}% + \xdef\pgfplotssurveyphase@setactiveplothandlers{% + \the\t@pgfplots@toka + \noexpand\expandafter\noexpand\def\noexpand\csname pgfplotssurveyphase@setactiveplothandlers@\the\t@pgfplots@tokb\noexpand\endcsname{1}% + }% + \expandafter\def\csname pgfplotssurveyphase@setactiveplothandlers@\the\t@pgfplots@tokb\endcsname{1}% + }{% + % ok. do nothing. + }% + % +}% +\def\pgfplots@countplots@advance{% + \global\advance\pgfplots@numplots by1\relax% + % + \expandafter\pgfplotsutil@advancestringcounter@global\csname c@pgfplots@numplotsofactualtype@\pgfplotsplothandlername@actual\endcsname +}% + % \addplot[#1] [#2] {#3} #4; \long\def\pgfplots@addplotimpl@coordinates#1#2plot coordinates#3#4;{\pgfplots@addplotimpl@coordinates@{#1}{#2}{#3}{#4}}% % \addplot[#1] [#2] coordinates {#3} #4; @@ -5258,7 +5439,7 @@ \long\def\pgfplots@addplotimpl@table@fromstructure@AS#1#2from#3#4;{\pgfplots@addplotimpl@table@startprocessing{#1}{#2}{#3}{#4}}% \long\def\pgfplots@addplotimpl@table@fromfile@AS#1#2#3#4;{\pgfplots@addplotimpl@table@startprocessing{#1}{#2}{#3}{#4}}% \long\def\pgfplots@addplotimpl@coordinates@AS#1#2plot coordinates#3#4;{\pgfplots@addplotimpl@coordinates@{#1}{#2}{#3}{#4}}% - \def\pgfplots@addplotimpl@graphics@AS#1#2[#3]#4#5;{\pgfplots@addplotimpl@graphics@@{#1}{#2}{#3}{#4}{#5}}% + \long\def\pgfplots@addplotimpl@graphics@AS#1#2[#3]#4#5;{\pgfplots@addplotimpl@graphics@@{#1}{#2}{#3}{#4}{#5}}% % % Checks whether ';' is an active character and, if that is the % case, modifies all public macros for it. @@ -5346,6 +5527,16 @@ % Init the plot handlers: \pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler \pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}% + % + \ifpgfplots@clip@limits + \else + % "clip marker paths=true" actually doesn't checks anything -- + % it leaves the checks to the clip path. But since there is no + % clip path, it is adequate to use it here: + \pgfplots@clip@marker@pathstrue + \fi + % + % \def\pgfplots@loc@TMPa{0}% <-- if (collectmark positions) \ifpgfplots@scatterplotenabled \def\pgfplots@loc@TMPa{1}% collect mark positions even if 'mark=none'! scatter might not even use markers. @@ -5424,6 +5615,7 @@ % Will be inserted in one of two possible places below (to collect % marker positions) \def\pgfplots@visualize@performserizalization{% + % ATTENTION: this here is replicated for stacked plots! \ifx\pgfplotspointmetainputhandler\pgfutil@empty % we don't have per-point meta data. Nothing special to % do: @@ -5457,29 +5649,33 @@ \ifpgfplots@curplot@threedim \E\pgf@yb=\E\pgfplots@current@point@z pt % \fi - \E\ifdim\E\pgf@xa<\E\pgfplots@xmin@reg - \E\else - \E\ifdim\E\pgf@xa>\E\pgfplots@xmax@reg + \ifpgfplots@clip + \E\ifdim\E\pgf@xa<\E\pgfplots@xmin@reg \E\else - \E\ifdim\E\pgf@ya<\E\pgfplots@ymin@reg + \E\ifdim\E\pgf@xa>\E\pgfplots@xmax@reg \E\else - \E\ifdim\E\pgf@ya>\E\pgfplots@ymax@reg + \E\ifdim\E\pgf@ya<\E\pgfplots@ymin@reg \E\else - \ifpgfplots@curplot@threedim - \E\ifdim\E\pgf@yb<\E\pgfplots@zmin@reg - \E\else - \E\ifdim\E\pgf@yb>\E\pgfplots@zmax@reg + \E\ifdim\E\pgf@ya>\E\pgfplots@ymax@reg + \E\else + \ifpgfplots@curplot@threedim + \E\ifdim\E\pgf@yb<\E\pgfplots@zmin@reg \E\else - \pgfplots@visualize@performserizalization + \E\ifdim\E\pgf@yb>\E\pgfplots@zmax@reg + \E\else + \pgfplots@visualize@performserizalization + \E\fi \E\fi - \E\fi - \else - \pgfplots@visualize@performserizalization - \fi + \else + \pgfplots@visualize@performserizalization + \fi + \E\fi \E\fi \E\fi \E\fi - \E\fi + \else + \pgfplots@visualize@performserizalization + \fi \fi \E\pgfplotstreampoint{}% it will simply take \pgf@x and \pgf@y! \advance\c@pgfplots@coordindex by1 @@ -5831,9 +6027,33 @@ % coordinates. \pgfplots@stacked@initzerolevelhandler \else - \pgfplotspointaxisorigin - \expandafter\pgfplotxzerolevelstreamconstant\expandafter{\the\pgf@x}% - \expandafter\pgfplotyzerolevelstreamconstant\expandafter{\the\pgf@y}% + \ifpgfplots@threedim + \def\pgfplotxzerolevelstreamstart{}% + \def\pgfplotxzerolevelstreamend{}% + \def\pgfplotxzerolevelstreamnext{% + \begingroup + \pgf@xa=\pgf@y + \pgfplotsqpointxyz{\pgfplots@logical@ZERO@x}{\pgfplots@current@point@y}{\ifpgfplots@curplot@threedim\pgfplots@current@point@z\else\pgfplots@logical@ZERO@z\fi}% + \global\pgf@x=\pgf@x + \global\pgf@y=\pgf@xa + \endgroup + }% + % + \def\pgfplotyzerolevelstreamstart{}% + \def\pgfplotyzerolevelstreamend{}% + \def\pgfplotyzerolevelstreamnext{% + \begingroup + \pgf@xa=\pgf@y + \pgfplotsqpointxyz{\pgfplots@current@point@x}{\pgfplots@current@point@y}{\pgfplots@logical@ZERO@z}% + \global\pgf@x=\pgf@y + \global\pgf@y=\pgf@xa + \endgroup + }% + \else + \pgfplotspointaxisorigin + \expandafter\pgfplotxzerolevelstreamconstant\expandafter{\the\pgf@x}% + \expandafter\pgfplotyzerolevelstreamconstant\expandafter{\the\pgf@y}% + \fi \fi } @@ -5902,7 +6122,7 @@ \fi \xdef\pgfplots@ZERO@x{\the\pgf@x}% \xdef\pgfplots@ZERO@y{\the\pgf@y}% - \xdef\pgfplotspointaxisorigin{\noexpand\pgf@x=\pgfplots@ZERO@x\space\noexpand\pgf@y=\pgfplots@ZERO@y\space}% + \xdef\pgfplotspointaxisorigin{\noexpand\global\pgf@x=\pgfplots@ZERO@x\space\noexpand\global\pgf@y=\pgfplots@ZERO@y\space}% }% @@ -5995,10 +6215,34 @@ \ifx\pgfplots@loc@TMPd\pgfutil@empty \pgfplots@error{Error using 'plot graphics': I don't have a graphics file name! Please set the '/pgfplots/plot graphics/src' key to the image file name. Skipping this plot.}% \else - \expandafter\includegraphics\expandafter[\pgfplots@loc@TMPc,width=#1,height=#2]{\pgfplots@loc@TMPd}% + \def\pgfplots@loc@TMPa{\pgfkeysvalueof{/pgfplots/plot graphics/includegraphics cmd}}% + \expandafter\pgfplots@loc@TMPa\expandafter[\pgfplots@loc@TMPc,width=#1,height=#2]{\pgfplots@loc@TMPd}% \fi }% +% legends for plot graphics should not use 'plot graphics' themselfes +% (for obvious reasons). +% This key handles that. Furthermore, it remembers the plot mark for +% the legend -- although no plot mark is allowed for plot graphics as +% such. +\pgfkeysdef{/pgfplots/plot graphics/@prepare legend}{% + \pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}% + % + \pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler + \t@pgfplots@tokc=\expandafter{\pgfplots@basiclevel@plothandler}% + % + \edef\pgfplots@loc@TMPa{% + \noexpand\pgfkeys{/pgfplots/every legend image post/.append code={% + \noexpand\def\noexpand\tikz@plot@handler{\the\t@pgfplots@tokc}% + \ifx\tikz@plot@mark\pgfutil@empty + \else + \noexpand\pgfkeysalso{/tikz/mark=\tikz@plot@mark}% + \fi + }% + }% + }% + \pgfplots@loc@TMPa +} % The low-level tikz plot handler for 3D mesh and surface plots. @@ -6287,13 +6531,9 @@ \fi % PREPARE THE STREAM PROCESSING: \def\pgfplots@plothandler@unbounded@visualize@jump{% - \pgfplotstreampoint{\pgf@x=-16000.0pt \pgf@y=-16000.0pt }% - }% - \def\pgfplotsplothandlermesh@check@unbounded####1####2\relax{% - \ifdim####1=-16000pt - \pgfplots@loc@tmpfalse - \fi + \pgfplotstreampoint{\global\pgf@x=-16000.0pt \global\pgf@y=-16000.0pt }% }% + \let\pgfplotsplothandlermesh@check@unbounded=\pgfplotsplothandlermesh@check@unbounded@setbool \if\pgfplotsplothandlermesh@ONEDIMMODE1% % Special case: 1D mesh processing \global\let\pgf@plotstreampoint=\pgfplotsplothandlermesh@ONEDIM@draw% @@ -6362,6 +6602,8 @@ \pgfplotsplothandlermesh@i@jm }% % Init memory: + % in fact, this does only remember the maximum capacity; + % it doesn't fill the memory. \c@pgfplots@scanlineindex=\pgfplotsplothandlermesh@scanlinelength\relax \advance\c@pgfplots@scanlineindex by1 \pgfplotsdequenewempty{lastscanline}\capacity{\the\c@pgfplots@scanlineindex}% @@ -6427,6 +6669,12 @@ }% }% +\def\pgfplotsplothandlermesh@check@unbounded@setbool#1#2\relax{% + \ifdim#1=-16000pt + \pgfplots@loc@tmpfalse + \fi +}% + \long\def\pgfplotsplothandlermesh@defaultlegend@img#1{% \scope[% #1, @@ -6498,7 +6746,7 @@ \if\pgfplotsplothandlermesh@zbuffer@choice4% % z buffer=sort: % process the z buffer: - \pgfkeyslet{/pgfplots/array/iflessthan/.@cmd}\pgfplotsplothandlermesh@zbuffer@sort@iflessthen + \pgfkeyslet{/pgfplots/iflessthan/.@cmd}\pgfplotsplothandlermesh@zbuffer@sort@iflessthen \pgfkeysdef{/pgfplots/array/unscope pre}{% \pgfplotsarrayforeachungrouped\pgfplots@zbuffer@local\as\curelem{% \expandafter\pgfplotsplothandlermesh@draw@zbufferelement\curelem% @@ -6583,17 +6831,18 @@ \def\pgfplotsplothandlermesh@shader@interp@transpose@finish{% % Now, "execute" each row vector: \def\pgfplotsplothandlermesh@shader@interp@next##1##2##3{% - \pgfplotslibrarysurfstreamcoord{\pgf@x=##1 \pgf@y=##2 }{##3}% + \pgfplotslibrarysurfstreamcoord{\global\pgf@x=##1 \global\pgf@y=##2 }{##3}% }% \c@pgfplots@scanlineindex=0 \pgfutil@loop \ifnum\c@pgfplots@scanlineindex<\pgfplotsplothandlermesh@rows\relax - \expandafter\pgfplotsapplistXlet\expandafter\pgfplots@loc@TMPa\expandafter=\csname pgfp@transprow@\the\c@pgfplots@scanlineindex\endcsname% + \expandafter\pgfplotsapplistXlet\expandafter\pgfplots@loc@TMPd\expandafter=\csname pgfp@transprow@\the\c@pgfplots@scanlineindex\endcsname% \expandafter\pgfplotsapplistXnewempty\csname pgfp@transprow@\the\c@pgfplots@scanlineindex\endcsname% clear % execute the row: - \pgfplots@loc@TMPa + \pgfplots@loc@TMPd \advance\c@pgfplots@scanlineindex by1 \pgfutil@repeat + \let\pgfplots@loc@TMPd=\relax }% \def\pgfplotsplothandlermesh@draw@zbufferelement#1#2{% @@ -6638,12 +6887,12 @@ % #2: projected y coord % #3: per point meta (if any) \def\pgfplotsplothandlermesh@unpack@corner#1#2#3{% - \pgf@x=#1\relax - \pgf@y=#2\relax + \global\pgf@x=#1\relax + \global\pgf@y=#2\relax }% \def\pgfplotsplothandlermesh@unpack@mean@accum#1#2#3{% - \pgf@x=#1\relax - \pgf@y=#2\relax + \global\pgf@x=#1\relax + \global\pgf@y=#2\relax \def\pgfplots@current@point@meta{#3}% \pgfplots@perpointmeta@trafo@APPLY \global\advance\pgfplots@tmpa by\pgfplotspointmetatransformed pt @@ -6739,7 +6988,7 @@ \else \pgfplotsarrayresize\pgfplots@zbuffer@local{\c@pgfplots@scanlineindex}% \fi - \pgfkeyslet{/pgfplots/array/iflessthan/.@cmd}\pgfplots@apply@zbuffer@SORT@iflessthan + \pgfkeyslet{/pgfplots/iflessthan/.@cmd}\pgfplots@apply@zbuffer@SORT@iflessthan \pgfkeysdef{/pgfplots/array/unscope pre}{% \pgfplotsapplistXnewempty{\pgfp@sortedlist}% \pgfplotsarrayforeachungrouped\pgfplots@zbuffer@local\as\curelem{% diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex index 026a1c83f78..ec1642f9409 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex @@ -26,6 +26,7 @@ \def\pgfplots@error#1{\PackageError{pgfplots}{#1}{}}% +\def\pgfplotstable@error@pkg#1{\PackageError{pgfplotstable}{#1}{}}% \def\pgfplots@warning#1{\pgfplots@message{! Package pgfplots Warning: #1}}% \def\pgfplots@message#1{% \immediate\write16{#1}% @@ -49,6 +50,33 @@ \def\pgfplotsthrow#1#2\pgfeov{% \pgfkeysvalueof{/pgfplots/exception/#1/.@cmd}#2\pgfeov }% +\let\pgfplotsthrow@orig=\pgfplotsthrow + +% A primitive try #1 catch #2 end block. +% +% It tries code #1. If any exception occurs within, it suppresses the +% exception and tries to continue. It then invokes #2 as soon as it +% can. +% +% You can use \pgfplotsrethrow in #2. +% +% ATTENTION: this is a simple attempt to simulate error control. Don't +% rely on it too heavily! In the moment, I am not even sure if it can +% be nested (perhaps you need to introduce extra scopes since +% \pgfplotstry doesn't). +\long\def\pgfplotstry#1\catch#2\endpgfplotstry{% + \global\let\pgfplotstry@exception\pgfutil@empty + \def\pgfplotsthrow##1##2\pgfeov{\gdef\pgfplotstry@exception{{##1}{##2}}}% + #1\relax% + \let\pgfplotsthrow=\pgfplotsthrow@orig + \ifx\pgfplotstry@exception\pgfutil@empty + \else + #2% + \fi + \global\let\pgfplotstry@exception\pgfutil@empty +}% +\def\pgfplotsrethrow{\expandafter\pgfplotsthrow\pgfplotstry@exception\pgfeov}% + \pgfkeys{ % #1: the argument which should have been assigned. % #2: an error message. @@ -131,4 +159,8 @@ \fi } \let\pgfplotsiffileexists=\pgfplots@iffileexists + +\pgfutil@ifundefined{pgfplots@texdist@protect}{% + \def\pgfplots@texdist@protect{}% +}{} \endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex index b0e18b0bf06..3c3e9dd7f6a 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex @@ -402,8 +402,16 @@ \pgfplots@coord@stream@INIT@finalize@storedcoords@prepare@scaletrafomacro % Will be inserted in one of two possible places below: \def\pgfplots@loc@TMPa{% - \E\edef\E\pgfmathresult{\E\noexpand\E\pgfplots@stream{\E\the\E\pgf@x}{\E\the\E\pgf@y}}% - \E\expandafter\E\pgfplotsapplistXpushback\E\expandafter{\E\pgfmathresult}\E\to\E\pgfplots@stacked@record@mark@cmds%% + \ifx\pgfplotspointmetainputhandler\pgfutil@empty + % we don't have per-point meta data. Nothing special to + % do: + \E\edef\E\pgfmathresult{\E\noexpand\E\pgfplots@stream@{\E\the\E\c@pgfplots@coordindex}{\E\the\E\pgf@x}{\E\the\E\pgf@y}}% + \E\expandafter\E\pgfplotsapplistXpushback\E\expandafter{\E\pgfmathresult}\E\to\E\pgfplots@stacked@record@mark@cmds% + \else + % Ok, then we need to process the meta data as well: + \E\edef\E\pgfmathresult{\E\noexpand\E\pgfplots@stream@withmeta@{\E\the\E\c@pgfplots@coordindex}{\E\the\E\pgf@x}{\E\the\E\pgf@y}{\E\pgfplots@current@point@meta}}% + \E\expandafter\E\pgfplotsapplistXpushback\E\expandafter{\E\pgfmathresult}\E\to\E\pgfplots@stacked@record@mark@cmds% + \fi }% % This finalize command maps the logical coordinate into PGF's % point space. Furthermore, it collects marker coordinates diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex index 416d888a511..46367c7c43e 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex @@ -773,11 +773,14 @@ \csname pgfplots@#1minorgridsfalse\endcsname \expandafter\let\expandafter\axis@TMP\csname pgfplots@extra@#1ticklabel\endcsname \expandafter\let\csname pgfplots@#1ticklabel\endcsname=\axis@TMP - \pgfplotsset{/pgfplots/every extra #1 tick}% +% \pgfplotsset{/pgfplots/every extra #1 tick}% + % use a scope here such that line width and draw color can be set. + \scope[/pgfplots/.cd,/pgfplots/every extra #1 tick] \pgfplots@prepare@tick@coordlists@for{#1}{#2}% \pgfplots@drawgridlines@onorientedsurf% \pgfplots@drawticklines@onorientedsurf% \pgfplots@drawticklabels@onorientedsurf% + \endscope \endgroup } diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex index 7229bc36d58..df3f66d0dd7 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex @@ -38,286 +38,323 @@ \begingroup % prepare ONE-BYTE conversion [0-255] -> binary character: \count0=0 -\catcode`\^^00=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^00}\advance\count0 by1 -\catcode`\^^01=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^01}\advance\count0 by1 -\catcode`\^^02=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^02}\advance\count0 by1 -\catcode`\^^03=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^03}\advance\count0 by1 -\catcode`\^^04=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^04}\advance\count0 by1 -\catcode`\^^05=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^05}\advance\count0 by1 -\catcode`\^^06=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^06}\advance\count0 by1 -\catcode`\^^07=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^07}\advance\count0 by1 -\catcode`\^^08=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^08}\advance\count0 by1 +\countdef\counter=0 +\catcode`\^^00=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^00}\advance\counter by1 +\catcode`\^^01=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^01}\advance\counter by1 +\catcode`\^^02=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^02}\advance\counter by1 +\catcode`\^^03=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^03}\advance\counter by1 +\catcode`\^^04=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^04}\advance\counter by1 +\catcode`\^^05=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^05}\advance\counter by1 +\catcode`\^^06=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^06}\advance\counter by1 +\catcode`\^^07=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^07}\advance\counter by1 +\catcode`\^^08=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^08}\advance\counter by1 \begingroup -\catcode`\^^09=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^09}\endgroup\advance\count0 by1 +\catcode`\^^09=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^09}\endgroup\advance\counter by1 \begingroup -\catcode`\^^0a=12\expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^0a}\endgroup\advance\count0 by1 +\catcode`\^^0a=11\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0a}\endgroup\advance\counter by1 \begingroup -\catcode`\^^0b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^0b}\endgroup\advance\count0 by1 -\catcode`\^^0c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^0c}\advance\count0 by1 +\catcode`\^^0b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0b}\endgroup\advance\counter by1 +\catcode`\^^0c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0c}\advance\counter by1 \begingroup -\catcode`\^^0d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^0d}\endgroup\advance\count0 by1 -\catcode`\^^0e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^0e}\advance\count0 by1 -\catcode`\^^0f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^0f}\advance\count0 by1 -\catcode`\^^10=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^10}\advance\count0 by1 -\catcode`\^^11=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^11}\advance\count0 by1 -\catcode`\^^12=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^12}\advance\count0 by1 -\catcode`\^^13=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^13}\advance\count0 by1 -\catcode`\^^14=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^14}\advance\count0 by1 -\catcode`\^^15=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^15}\advance\count0 by1 -\catcode`\^^16=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^16}\advance\count0 by1 -\catcode`\^^17=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^17}\advance\count0 by1 -\catcode`\^^18=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^18}\advance\count0 by1 -\catcode`\^^19=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^19}\advance\count0 by1 -\catcode`\^^1a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^1a}\advance\count0 by1 -\catcode`\^^1b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^1b}\advance\count0 by1 -\catcode`\^^1c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^1c}\advance\count0 by1 -\catcode`\^^1d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^1d}\advance\count0 by1 -\catcode`\^^1e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^1e}\advance\count0 by1 -\catcode`\^^1f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^1f}\advance\count0 by1 +\catcode`\^^0d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0d}\endgroup\advance\counter by1 +\catcode`\^^0e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0e}\advance\counter by1 +\catcode`\^^0f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0f}\advance\counter by1 +\catcode`\^^10=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^10}\advance\counter by1 +\catcode`\^^11=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^11}\advance\counter by1 +\catcode`\^^12=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^12}\advance\counter by1 +\catcode`\^^13=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^13}\advance\counter by1 +\catcode`\^^14=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^14}\advance\counter by1 +\catcode`\^^15=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^15}\advance\counter by1 +\catcode`\^^16=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^16}\advance\counter by1 +\catcode`\^^17=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^17}\advance\counter by1 +\catcode`\^^18=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^18}\advance\counter by1 +\catcode`\^^19=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^19}\advance\counter by1 +\catcode`\^^1a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1a}\advance\counter by1 +\catcode`\^^1b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1b}\advance\counter by1 +\catcode`\^^1c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1c}\advance\counter by1 +\catcode`\^^1d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1d}\advance\counter by1 +\catcode`\^^1e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1e}\advance\counter by1 +\catcode`\^^1f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1f}\advance\counter by1 \begingroup -\catcode`\^^20=12^^I\expandafter\xdef\csname^^Ipgfp@bin@\the\count0^^I\endcsname{^^20}\endgroup\advance\count0 by1 -\catcode`\^^21=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^21}\advance\count0 by1 -\catcode`\^^22=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^22}\advance\count0 by1 -\catcode`\^^23=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^23}\advance\count0 by1 -\catcode`\^^24=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^24}\advance\count0 by1 -\catcode`\^^25=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^25}\advance\count0 by1 -\catcode`\^^26=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^26}\advance\count0 by1 -\catcode`\^^27=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^27}\advance\count0 by1 -\catcode`\^^28=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^28}\advance\count0 by1 -\catcode`\^^29=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^29}\advance\count0 by1 -\catcode`\^^2a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^2a}\advance\count0 by1 -\catcode`\^^2b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^2b}\advance\count0 by1 -\catcode`\^^2c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^2c}\advance\count0 by1 -\catcode`\^^2d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^2d}\advance\count0 by1 -\catcode`\^^2e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^2e}\advance\count0 by1 -\catcode`\^^2f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^2f}\advance\count0 by1 -\catcode`\^^30=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^30}\advance\count0 by1 -\catcode`\^^31=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^31}\advance\count0 by1 -\catcode`\^^32=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^32}\advance\count0 by1 -\catcode`\^^33=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^33}\advance\count0 by1 -\catcode`\^^34=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^34}\advance\count0 by1 -\catcode`\^^35=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^35}\advance\count0 by1 -\catcode`\^^36=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^36}\advance\count0 by1 -\catcode`\^^37=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^37}\advance\count0 by1 -\catcode`\^^38=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^38}\advance\count0 by1 -\catcode`\^^39=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^39}\advance\count0 by1 -\catcode`\^^3a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^3a}\advance\count0 by1 -\catcode`\^^3b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^3b}\advance\count0 by1 -\catcode`\^^3c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^3c}\advance\count0 by1 -\catcode`\^^3d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^3d}\advance\count0 by1 -\catcode`\^^3e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^3e}\advance\count0 by1 -\catcode`\^^3f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^3f}\advance\count0 by1 -\catcode`\^^40=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^40}\advance\count0 by1 -\catcode`\^^41=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^41}\advance\count0 by1 -\catcode`\^^42=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^42}\advance\count0 by1 -\catcode`\^^43=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^43}\advance\count0 by1 -\catcode`\^^44=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^44}\advance\count0 by1 -\catcode`\^^45=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^45}\advance\count0 by1 -\catcode`\^^46=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^46}\advance\count0 by1 -\catcode`\^^47=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^47}\advance\count0 by1 -\catcode`\^^48=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^48}\advance\count0 by1 -\catcode`\^^49=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^49}\advance\count0 by1 -\catcode`\^^4a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^4a}\advance\count0 by1 -\catcode`\^^4b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^4b}\advance\count0 by1 -\catcode`\^^4c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^4c}\advance\count0 by1 -\catcode`\^^4d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^4d}\advance\count0 by1 -\catcode`\^^4e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^4e}\advance\count0 by1 -\catcode`\^^4f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^4f}\advance\count0 by1 -\catcode`\^^50=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^50}\advance\count0 by1 -\catcode`\^^51=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^51}\advance\count0 by1 -\catcode`\^^52=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^52}\advance\count0 by1 -\catcode`\^^53=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^53}\advance\count0 by1 -\catcode`\^^54=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^54}\advance\count0 by1 -\catcode`\^^55=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^55}\advance\count0 by1 -\catcode`\^^56=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^56}\advance\count0 by1 -\catcode`\^^57=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^57}\advance\count0 by1 -\catcode`\^^58=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^58}\advance\count0 by1 -\catcode`\^^59=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^59}\advance\count0 by1 -\catcode`\^^5a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^5a}\advance\count0 by1 -\catcode`\^^5b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^5b}\advance\count0 by1 +\catcode`\^^20=11^^I\expandafter\xdef\csname^^Ipgfp@bin@\the\counter^^I\endcsname{^^20}\endgroup\advance\counter by1 +\catcode`\^^21=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^21}\advance\counter by1 +\catcode`\^^22=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^22}\advance\counter by1 +\catcode`\^^23=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^23}\advance\counter by1 +\catcode`\^^24=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^24}\advance\counter by1 +\catcode`\^^25=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^25}\advance\counter by1 +\catcode`\^^26=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^26}\advance\counter by1 +\catcode`\^^27=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^27}\advance\counter by1 +\catcode`\^^28=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^28}\advance\counter by1 +\catcode`\^^29=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^29}\advance\counter by1 +\catcode`\^^2a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2a}\advance\counter by1 +\catcode`\^^2b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2b}\advance\counter by1 +\catcode`\^^2c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2c}\advance\counter by1 +\catcode`\^^2d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2d}\advance\counter by1 +\catcode`\^^2e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2e}\advance\counter by1 +\catcode`\^^2f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2f}\advance\counter by1 +\begingroup +\catcode`\^^30=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^30}\endgroup\advance\counter by1 +\begingroup +\catcode`\^^31=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^31}\endgroup\advance\counter by1 +\begingroup +\catcode`\^^32=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^32}\endgroup\advance\counter by1 +\begingroup +\catcode`\^^33=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^33}\endgroup\advance\counter by1 +\begingroup +\catcode`\^^34=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^34}\endgroup\advance\counter by1 +\begingroup +\catcode`\^^35=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^35}\endgroup\advance\counter by1 +\begingroup +\catcode`\^^36=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^36}\endgroup\advance\counter by1 +\begingroup +\catcode`\^^37=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^37}\endgroup\advance\counter by1 +\begingroup +\catcode`\^^38=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^38}\endgroup\advance\counter by1 +\begingroup +\catcode`\^^39=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^39}\endgroup\advance\counter by1 +\catcode`\^^3a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3a}\advance\counter by1 +\catcode`\^^3b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3b}\advance\counter by1 +\catcode`\^^3c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3c}\advance\counter by1 +\begingroup +\catcode`\^^3d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3d}\endgroup\advance\counter by1 +\catcode`\^^3e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3e}\advance\counter by1 +\catcode`\^^3f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3f}\advance\counter by1 +\catcode`\^^40=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^40}\advance\counter by1 +\catcode`\^^41=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^41}\advance\counter by1 +\catcode`\^^42=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^42}\advance\counter by1 +\catcode`\^^43=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^43}\advance\counter by1 +\catcode`\^^44=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^44}\advance\counter by1 +\catcode`\^^45=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^45}\advance\counter by1 +\catcode`\^^46=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^46}\advance\counter by1 +\catcode`\^^47=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^47}\advance\counter by1 +\catcode`\^^48=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^48}\advance\counter by1 +\catcode`\^^49=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^49}\advance\counter by1 +\catcode`\^^4a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4a}\advance\counter by1 +\catcode`\^^4b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4b}\advance\counter by1 +\catcode`\^^4c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4c}\advance\counter by1 +\catcode`\^^4d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4d}\advance\counter by1 +\catcode`\^^4e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4e}\advance\counter by1 +\catcode`\^^4f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4f}\advance\counter by1 +\catcode`\^^50=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^50}\advance\counter by1 +\catcode`\^^51=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^51}\advance\counter by1 +\catcode`\^^52=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^52}\advance\counter by1 +\catcode`\^^53=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^53}\advance\counter by1 +\catcode`\^^54=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^54}\advance\counter by1 +\catcode`\^^55=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^55}\advance\counter by1 +\catcode`\^^56=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^56}\advance\counter by1 +\catcode`\^^57=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^57}\advance\counter by1 +\catcode`\^^58=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^58}\advance\counter by1 +\catcode`\^^59=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^59}\advance\counter by1 +\catcode`\^^5a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5a}\advance\counter by1 +\catcode`\^^5b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5b}\advance\counter by1 \begingroup \catcode`\|=0 -\catcode`\\=12 |expandafter|xdef|csname pgfp@bin@|the|count0 |endcsname{^^5c}|endgroup\advance\count0 by1 -\catcode`\^^5d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^5d}\advance\count0 by1 +\catcode`\\=11 |expandafter|xdef|csname pgfp@bin@|the|counter|endcsname{^^5c}|endgroup \advance\counter by1 +\catcode`\^^5d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5d}\advance\counter by1 +\begingroup +\catcode`\^^5e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^}\endgroup\advance\counter by1 +\catcode`\^^5f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5f}\advance\counter by1 \begingroup -\catcode`\^^5e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^}\endgroup\advance\count0 by1 -\catcode`\^^5f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^5f}\advance\count0 by1 -\catcode`\^^60=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^60}\advance\count0 by1 -\catcode`\^^61=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^61}\advance\count0 by1 -\catcode`\^^62=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^62}\advance\count0 by1 -\catcode`\^^63=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^63}\advance\count0 by1 -\catcode`\^^64=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^64}\advance\count0 by1 -\catcode`\^^65=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^65}\advance\count0 by1 -\catcode`\^^66=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^66}\advance\count0 by1 -\catcode`\^^67=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^67}\advance\count0 by1 -\catcode`\^^68=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^68}\advance\count0 by1 -\catcode`\^^69=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^69}\advance\count0 by1 -\catcode`\^^6a=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^6a}\advance\count0 by1 -\catcode`\^^6b=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^6b}\advance\count0 by1 -\catcode`\^^6c=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^6c}\advance\count0 by1 -\catcode`\^^6d=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^6d}\advance\count0 by1 -\catcode`\^^6e=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^6e}\advance\count0 by1 -\catcode`\^^6f=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^6f}\advance\count0 by1 -\catcode`\^^70=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^70}\advance\count0 by1 -\catcode`\^^71=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^71}\advance\count0 by1 -\catcode`\^^72=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^72}\advance\count0 by1 -\catcode`\^^73=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^73}\advance\count0 by1 -\catcode`\^^74=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^74}\advance\count0 by1 -\catcode`\^^75=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^75}\advance\count0 by1 -\catcode`\^^76=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^76}\advance\count0 by1 -\catcode`\^^77=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^77}\advance\count0 by1 -\catcode`\^^78=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^78}\advance\count0 by1 -\catcode`\^^79=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^79}\advance\count0 by1 -\catcode`\^^7a=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^7a}\advance\count0 by1 +\catcode`\^^60=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^60}\endgroup\advance\counter by1 +\catcode`\^^61=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^61}\advance\counter by1 +\catcode`\^^62=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^62}\advance\counter by1 +\catcode`\^^63=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^63}\advance\counter by1 +\catcode`\^^64=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^64}\advance\counter by1 +\catcode`\^^65=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^65}\advance\counter by1 +\catcode`\^^66=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^66}\advance\counter by1 +\catcode`\^^67=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^67}\advance\counter by1 +\catcode`\^^68=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^68}\advance\counter by1 +\catcode`\^^69=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^69}\advance\counter by1 +\catcode`\^^6a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6a}\advance\counter by1 +\catcode`\^^6b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6b}\advance\counter by1 +\catcode`\^^6c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6c}\advance\counter by1 +\catcode`\^^6d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6d}\advance\counter by1 +\catcode`\^^6e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6e}\advance\counter by1 +\catcode`\^^6f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6f}\advance\counter by1 +\catcode`\^^70=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^70}\advance\counter by1 +\catcode`\^^71=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^71}\advance\counter by1 +\catcode`\^^72=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^72}\advance\counter by1 +\catcode`\^^73=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^73}\advance\counter by1 +\catcode`\^^74=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^74}\advance\counter by1 +\catcode`\^^75=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^75}\advance\counter by1 +\catcode`\^^76=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^76}\advance\counter by1 +\catcode`\^^77=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^77}\advance\counter by1 +\catcode`\^^78=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^78}\advance\counter by1 +\catcode`\^^79=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^79}\advance\counter by1 +\catcode`\^^7a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7a}\advance\counter by1 \begingroup \catcode`\q=1 -\catcode`\^^7b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname q^^7b}\endgroup\advance\count0 by1 -\catcode`\^^7c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^7c}\advance\count0 by1 +\catcode`\^^7b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname q^^7b}\endgroup\advance\counter by1 +\catcode`\^^7c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7c}\advance\counter by1 \begingroup \catcode`\q=2 -\catcode`\^^7d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^7dq\endgroup\advance\count0 by1 -\catcode`\^^7e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^7e}\advance\count0 by1 -\catcode`\^^7f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^7f}\advance\count0 by1 -\catcode`\^^80=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^80}\advance\count0 by1 -\catcode`\^^81=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^81}\advance\count0 by1 -\catcode`\^^82=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^82}\advance\count0 by1 -\catcode`\^^83=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^83}\advance\count0 by1 -\catcode`\^^84=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^84}\advance\count0 by1 -\catcode`\^^85=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^85}\advance\count0 by1 -\catcode`\^^86=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^86}\advance\count0 by1 -\catcode`\^^87=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^87}\advance\count0 by1 -\catcode`\^^88=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^88}\advance\count0 by1 -\catcode`\^^89=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^89}\advance\count0 by1 -\catcode`\^^8a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^8a}\advance\count0 by1 -\catcode`\^^8b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^8b}\advance\count0 by1 -\catcode`\^^8c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^8c}\advance\count0 by1 -\catcode`\^^8d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^8d}\advance\count0 by1 -\catcode`\^^8e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^8e}\advance\count0 by1 -\catcode`\^^8f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^8f}\advance\count0 by1 -\catcode`\^^90=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^90}\advance\count0 by1 -\catcode`\^^91=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^91}\advance\count0 by1 -\catcode`\^^92=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^92}\advance\count0 by1 -\catcode`\^^93=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^93}\advance\count0 by1 -\catcode`\^^94=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^94}\advance\count0 by1 -\catcode`\^^95=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^95}\advance\count0 by1 -\catcode`\^^96=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^96}\advance\count0 by1 -\catcode`\^^97=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^97}\advance\count0 by1 -\catcode`\^^98=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^98}\advance\count0 by1 -\catcode`\^^99=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^99}\advance\count0 by1 -\catcode`\^^9a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^9a}\advance\count0 by1 -\catcode`\^^9b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^9b}\advance\count0 by1 -\catcode`\^^9c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^9c}\advance\count0 by1 -\catcode`\^^9d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^9d}\advance\count0 by1 -\catcode`\^^9e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^9e}\advance\count0 by1 -\catcode`\^^9f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^9f}\advance\count0 by1 -\catcode`\^^a0=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a0}\advance\count0 by1 -\catcode`\^^a1=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a1}\advance\count0 by1 -\catcode`\^^a2=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a2}\advance\count0 by1 -\catcode`\^^a3=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a3}\advance\count0 by1 -\catcode`\^^a4=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a4}\advance\count0 by1 -\catcode`\^^a5=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a5}\advance\count0 by1 -\catcode`\^^a6=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a6}\advance\count0 by1 -\catcode`\^^a7=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a7}\advance\count0 by1 -\catcode`\^^a8=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a8}\advance\count0 by1 -\catcode`\^^a9=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a9}\advance\count0 by1 -\catcode`\^^aa=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^aa}\advance\count0 by1 -\catcode`\^^ab=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ab}\advance\count0 by1 -\catcode`\^^ac=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ac}\advance\count0 by1 -\catcode`\^^ad=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ad}\advance\count0 by1 -\catcode`\^^ae=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ae}\advance\count0 by1 -\catcode`\^^af=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^af}\advance\count0 by1 -\catcode`\^^b0=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b0}\advance\count0 by1 -\catcode`\^^b1=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b1}\advance\count0 by1 -\catcode`\^^b2=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b2}\advance\count0 by1 -\catcode`\^^b3=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b3}\advance\count0 by1 -\catcode`\^^b4=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b4}\advance\count0 by1 -\catcode`\^^b5=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b5}\advance\count0 by1 -\catcode`\^^b6=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b6}\advance\count0 by1 -\catcode`\^^b7=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b7}\advance\count0 by1 -\catcode`\^^b8=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b8}\advance\count0 by1 -\catcode`\^^b9=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b9}\advance\count0 by1 -\catcode`\^^ba=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ba}\advance\count0 by1 -\catcode`\^^bb=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^bb}\advance\count0 by1 -\catcode`\^^bc=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^bc}\advance\count0 by1 -\catcode`\^^bd=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^bd}\advance\count0 by1 -\catcode`\^^be=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^be}\advance\count0 by1 -\catcode`\^^bf=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^bf}\advance\count0 by1 -\catcode`\^^c0=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c0}\advance\count0 by1 -\catcode`\^^c1=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c1}\advance\count0 by1 -\catcode`\^^c2=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c2}\advance\count0 by1 -\catcode`\^^c3=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c3}\advance\count0 by1 -\catcode`\^^c4=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c4}\advance\count0 by1 -\catcode`\^^c5=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c5}\advance\count0 by1 -\catcode`\^^c6=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c6}\advance\count0 by1 -\catcode`\^^c7=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c7}\advance\count0 by1 -\catcode`\^^c8=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c8}\advance\count0 by1 -\catcode`\^^c9=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c9}\advance\count0 by1 -\catcode`\^^ca=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ca}\advance\count0 by1 -\catcode`\^^cb=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^cb}\advance\count0 by1 -\catcode`\^^cc=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^cc}\advance\count0 by1 -\catcode`\^^cd=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^cd}\advance\count0 by1 -\catcode`\^^ce=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ce}\advance\count0 by1 -\catcode`\^^cf=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^cf}\advance\count0 by1 -\catcode`\^^d0=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d0}\advance\count0 by1 -\catcode`\^^d1=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d1}\advance\count0 by1 -\catcode`\^^d2=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d2}\advance\count0 by1 -\catcode`\^^d3=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d3}\advance\count0 by1 -\catcode`\^^d4=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d4}\advance\count0 by1 -\catcode`\^^d5=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d5}\advance\count0 by1 -\catcode`\^^d6=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d6}\advance\count0 by1 -\catcode`\^^d7=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d7}\advance\count0 by1 -\catcode`\^^d8=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d8}\advance\count0 by1 -\catcode`\^^d9=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d9}\advance\count0 by1 -\catcode`\^^da=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^da}\advance\count0 by1 -\catcode`\^^db=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^db}\advance\count0 by1 -\catcode`\^^dc=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^dc}\advance\count0 by1 -\catcode`\^^dd=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^dd}\advance\count0 by1 -\catcode`\^^de=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^de}\advance\count0 by1 -\catcode`\^^df=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^df}\advance\count0 by1 -\catcode`\^^e0=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e0}\advance\count0 by1 -\catcode`\^^e1=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e1}\advance\count0 by1 -\catcode`\^^e2=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e2}\advance\count0 by1 -\catcode`\^^e3=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e3}\advance\count0 by1 -\catcode`\^^e4=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e4}\advance\count0 by1 -\catcode`\^^e5=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e5}\advance\count0 by1 -\catcode`\^^e6=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e6}\advance\count0 by1 -\catcode`\^^e7=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e7}\advance\count0 by1 -\catcode`\^^e8=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e8}\advance\count0 by1 -\catcode`\^^e9=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e9}\advance\count0 by1 -\catcode`\^^ea=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ea}\advance\count0 by1 -\catcode`\^^eb=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^eb}\advance\count0 by1 -\catcode`\^^ec=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ec}\advance\count0 by1 -\catcode`\^^ed=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ed}\advance\count0 by1 -\catcode`\^^ee=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ee}\advance\count0 by1 -\catcode`\^^ef=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ef}\advance\count0 by1 -\catcode`\^^f0=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f0}\advance\count0 by1 -\catcode`\^^f1=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f1}\advance\count0 by1 -\catcode`\^^f2=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f2}\advance\count0 by1 -\catcode`\^^f3=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f3}\advance\count0 by1 -\catcode`\^^f4=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f4}\advance\count0 by1 -\catcode`\^^f5=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f5}\advance\count0 by1 -\catcode`\^^f6=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f6}\advance\count0 by1 -\catcode`\^^f7=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f7}\advance\count0 by1 -\catcode`\^^f8=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f8}\advance\count0 by1 -\catcode`\^^f9=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f9}\advance\count0 by1 -\catcode`\^^fa=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^fa}\advance\count0 by1 -\catcode`\^^fb=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^fb}\advance\count0 by1 -\catcode`\^^fc=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^fc}\advance\count0 by1 -\catcode`\^^fd=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^fd}\advance\count0 by1 -\catcode`\^^fe=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^fe}\advance\count0 by1 -\catcode`\^^ff=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ff}\advance\count0 by1 -\ifnum\count0=256 +\catcode`\^^7d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7dq\endgroup\advance\counter by1 +\catcode`\^^7e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7e}\advance\counter by1 +\catcode`\^^7f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7f}\advance\counter by1 +\catcode`\^^80=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^80}\advance\counter by1 +\catcode`\^^81=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^81}\advance\counter by1 +\catcode`\^^82=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^82}\advance\counter by1 +\catcode`\^^83=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^83}\advance\counter by1 +\catcode`\^^84=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^84}\advance\counter by1 +\catcode`\^^85=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^85}\advance\counter by1 +\catcode`\^^86=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^86}\advance\counter by1 +\catcode`\^^87=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^87}\advance\counter by1 +\catcode`\^^88=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^88}\advance\counter by1 +\catcode`\^^89=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^89}\advance\counter by1 +\catcode`\^^8a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8a}\advance\counter by1 +\catcode`\^^8b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8b}\advance\counter by1 +\catcode`\^^8c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8c}\advance\counter by1 +\catcode`\^^8d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8d}\advance\counter by1 +\catcode`\^^8e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8e}\advance\counter by1 +\catcode`\^^8f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8f}\advance\counter by1 +\catcode`\^^90=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^90}\advance\counter by1 +\catcode`\^^91=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^91}\advance\counter by1 +\catcode`\^^92=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^92}\advance\counter by1 +\catcode`\^^93=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^93}\advance\counter by1 +\catcode`\^^94=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^94}\advance\counter by1 +\catcode`\^^95=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^95}\advance\counter by1 +\catcode`\^^96=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^96}\advance\counter by1 +\catcode`\^^97=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^97}\advance\counter by1 +\catcode`\^^98=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^98}\advance\counter by1 +\catcode`\^^99=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^99}\advance\counter by1 +\catcode`\^^9a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9a}\advance\counter by1 +\catcode`\^^9b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9b}\advance\counter by1 +\catcode`\^^9c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9c}\advance\counter by1 +\catcode`\^^9d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9d}\advance\counter by1 +\catcode`\^^9e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9e}\advance\counter by1 +\catcode`\^^9f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9f}\advance\counter by1 +\catcode`\^^a0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a0}\advance\counter by1 +\catcode`\^^a1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a1}\advance\counter by1 +\catcode`\^^a2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a2}\advance\counter by1 +\catcode`\^^a3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a3}\advance\counter by1 +\catcode`\^^a4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a4}\advance\counter by1 +\catcode`\^^a5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a5}\advance\counter by1 +\catcode`\^^a6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a6}\advance\counter by1 +\catcode`\^^a7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a7}\advance\counter by1 +\catcode`\^^a8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a8}\advance\counter by1 +\catcode`\^^a9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a9}\advance\counter by1 +\catcode`\^^aa=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^aa}\advance\counter by1 +\catcode`\^^ab=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ab}\advance\counter by1 +\catcode`\^^ac=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ac}\advance\counter by1 +\catcode`\^^ad=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ad}\advance\counter by1 +\catcode`\^^ae=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ae}\advance\counter by1 +\catcode`\^^af=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^af}\advance\counter by1 +\catcode`\^^b0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b0}\advance\counter by1 +\catcode`\^^b1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b1}\advance\counter by1 +\catcode`\^^b2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b2}\advance\counter by1 +\catcode`\^^b3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b3}\advance\counter by1 +\catcode`\^^b4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b4}\advance\counter by1 +\catcode`\^^b5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b5}\advance\counter by1 +\catcode`\^^b6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b6}\advance\counter by1 +\catcode`\^^b7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b7}\advance\counter by1 +\catcode`\^^b8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b8}\advance\counter by1 +\catcode`\^^b9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b9}\advance\counter by1 +\catcode`\^^ba=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ba}\advance\counter by1 +\catcode`\^^bb=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bb}\advance\counter by1 +\catcode`\^^bc=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bc}\advance\counter by1 +\catcode`\^^bd=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bd}\advance\counter by1 +\catcode`\^^be=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^be}\advance\counter by1 +\catcode`\^^bf=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bf}\advance\counter by1 +\catcode`\^^c0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c0}\advance\counter by1 +\catcode`\^^c1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c1}\advance\counter by1 +\catcode`\^^c2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c2}\advance\counter by1 +\catcode`\^^c3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c3}\advance\counter by1 +\catcode`\^^c4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c4}\advance\counter by1 +\catcode`\^^c5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c5}\advance\counter by1 +\catcode`\^^c6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c6}\advance\counter by1 +\catcode`\^^c7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c7}\advance\counter by1 +\catcode`\^^c8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c8}\advance\counter by1 +\catcode`\^^c9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c9}\advance\counter by1 +\catcode`\^^ca=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ca}\advance\counter by1 +\catcode`\^^cb=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cb}\advance\counter by1 +\catcode`\^^cc=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cc}\advance\counter by1 +\catcode`\^^cd=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cd}\advance\counter by1 +\catcode`\^^ce=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ce}\advance\counter by1 +\catcode`\^^cf=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cf}\advance\counter by1 +\catcode`\^^d0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d0}\advance\counter by1 +\catcode`\^^d1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d1}\advance\counter by1 +\catcode`\^^d2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d2}\advance\counter by1 +\catcode`\^^d3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d3}\advance\counter by1 +\catcode`\^^d4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d4}\advance\counter by1 +\catcode`\^^d5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d5}\advance\counter by1 +\catcode`\^^d6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d6}\advance\counter by1 +\catcode`\^^d7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d7}\advance\counter by1 +\catcode`\^^d8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d8}\advance\counter by1 +\catcode`\^^d9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d9}\advance\counter by1 +\catcode`\^^da=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^da}\advance\counter by1 +\catcode`\^^db=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^db}\advance\counter by1 +\catcode`\^^dc=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^dc}\advance\counter by1 +\catcode`\^^dd=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^dd}\advance\counter by1 +\catcode`\^^de=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^de}\advance\counter by1 +\catcode`\^^df=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^df}\advance\counter by1 +\catcode`\^^e0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e0}\advance\counter by1 +\catcode`\^^e1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e1}\advance\counter by1 +\catcode`\^^e2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e2}\advance\counter by1 +\catcode`\^^e3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e3}\advance\counter by1 +\catcode`\^^e4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e4}\advance\counter by1 +\catcode`\^^e5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e5}\advance\counter by1 +\catcode`\^^e6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e6}\advance\counter by1 +\catcode`\^^e7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e7}\advance\counter by1 +\catcode`\^^e8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e8}\advance\counter by1 +\catcode`\^^e9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e9}\advance\counter by1 +\catcode`\^^ea=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ea}\advance\counter by1 +\catcode`\^^eb=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^eb}\advance\counter by1 +\catcode`\^^ec=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ec}\advance\counter by1 +\catcode`\^^ed=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ed}\advance\counter by1 +\catcode`\^^ee=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ee}\advance\counter by1 +\catcode`\^^ef=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ef}\advance\counter by1 +\catcode`\^^f0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f0}\advance\counter by1 +\catcode`\^^f1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f1}\advance\counter by1 +\catcode`\^^f2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f2}\advance\counter by1 +\catcode`\^^f3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f3}\advance\counter by1 +\catcode`\^^f4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f4}\advance\counter by1 +\catcode`\^^f5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f5}\advance\counter by1 +\catcode`\^^f6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f6}\advance\counter by1 +\catcode`\^^f7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f7}\advance\counter by1 +\catcode`\^^f8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f8}\advance\counter by1 +\catcode`\^^f9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f9}\advance\counter by1 +\catcode`\^^fa=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fa}\advance\counter by1 +\catcode`\^^fb=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fb}\advance\counter by1 +\catcode`\^^fc=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fc}\advance\counter by1 +\catcode`\^^fd=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fd}\advance\counter by1 +\catcode`\^^fe=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fe}\advance\counter by1 +\catcode`\^^ff=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ff}\advance\counter by1 +\ifnum\counter=256 \else - \pgfplots@error{Internal logic Error: initialisation failed. I have only \the\count0\space bytes initialised.} + \pgfplots@error{Internal logic Error: initialisation failed. I have only \the\counter\space bytes initialised.} \fi \endgroup -% Returns a single character (with catcode 11 or 12), which has the -% binary code '#1'. +% Returns a single character, which has the +% binary ASCII code '#1', with catcode 11. +% +% #1 (expands to) a number between 0 and 255 (inclusive). % -% #1 is a number between 0 and 255 (inclusive). +% @see \pgfplotsgetchar Note that \pgfplotsgetchar is more powerful, +% but can't be used inside of \edef (it is not expandable) whereas +% \pgfplotscharno is. \def\pgfplotscharno#1{\csname pgfp@bin@#1\endcsname}% +% Defines \pgfplotsretval to be the ASCII character for #1, with +% catcode 11. +% +% #1: either a number between 0 and 255 (inclusive) or a description +% of the character. +% +% Examples: +% \pgfplotsgetchar{35} +% \pgfplotsgetchar{`\#} % code for '#' +% \pgfplotsgetchar{`\^^M} % Newline +% \pgfplotsgetchar{`\^^ff}% 255 +% +% @see \pgfplotscharno +\def\pgfplotsgetchar#1{% + \begingroup + \count0=#1\relax + \edef\pgfplotsretval{\csname pgfp@bin@\the\count0 \endcsname}% + \pgfmath@smuggleone\pgfplotsretval + \endgroup +}% \def\pgfplotsbinary@apphighorderbytes@BIGENDIAN#1{\xdef\pgfplotsbinaryresult{#1\pgfplotsbinaryresult}}% \def\pgfplotsbinary@apphighorderbytes@LITTLEENDIAN#1{\xdef\pgfplotsbinaryresult{\pgfplotsbinaryresult#1}}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex index 290fbfe9292..b1496a8fc1b 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex @@ -56,6 +56,7 @@ \let\pgfplots@createcolormap@LAST=\pgfplots@createcolormap@MIN % PARSE IT: \edef\pgfplots@loc@TMPa{#2}% + \let\pgfplots@createcolormap@context=\pgfutil@empty % this does also init @H: \expandafter\pgfplots@createcolormap@startloop\pgfplots@loc@TMPa\pgfplots@EOI \expandafter\pgfplotsarraycheckempty\expandafter{\pgfplots@createcolormap@name}% @@ -77,6 +78,7 @@ %\pgfplots@colormap@showdebuginfofor{#1}% } \def\pgfplots@createcolormap@seth[#1]{% + \def\pgfplots@createcolormap@context{[#1]}% \pgfmathparse{#1}% \let\pgfplots@createcolormap@H=\pgfmathresult \pgfplots@createcolormap@ @@ -102,13 +104,20 @@ \pgfutil@ifnextchar c{\pgfplots@createcolormap@grabcolor}% { \expandafter\pgfutil@ifnextchar\pgfplots@activesemicolon{\pgfplots@createcolormap@grabsemicolon@active}% - {\pgfplots@error{Illformed colormap specification}}% + {\pgfplots@createcolormap@error}% }% }% }% }% }% } +\def\pgfplots@createcolormap@error#1#2\pgfplots@EOI{% + {% + \t@pgfplots@toka={#1#2}% + \t@pgfplots@tokb={#1}% + \pgfplots@error{Illformed colormap specification: I could not read the substring `\the\t@pgfplots@toka' starting at `\the\t@pgfplots@tokb'}% + }% +}% \def\pgfplots@createcolormap@grabsemicolon;{\pgfplots@createcolormap@}% { @@ -147,6 +156,7 @@ }% } \def\pgfplots@createcolormap@grabrgb@(#1)=(#2,#3,#4){% + \def\pgfplots@createcolormap@context{rgb(#1)=(#2,#3,#4)}% \pgfplots@createcolormap@nextRGB{#1}{#2}{#3}{#4}% \pgfplots@createcolormap@} \def\pgfplots@createcolormap@grabrgb@two@five@five@rescale#1{% @@ -157,6 +167,7 @@ \pgfplots@createcolormap@next } \def\pgfplots@createcolormap@grabrgb@two@five@five@(#1)=(#2,#3,#4){% + \def\pgfplots@createcolormap@context{rgb255(#1)=(#2,#3,#4)}% \pgfplots@createcolormap@grabrgb@two@five@five@rescale{#2}% \let\pgfplots@loc@TMPa=\pgfmathresult \pgfplots@createcolormap@grabrgb@two@five@five@rescale{#3}% @@ -171,6 +182,7 @@ \pgfplots@createcolormap@next }% \def\pgfplots@createcolormap@grabgray@(#1)=(#2){% + \def\pgfplots@createcolormap@context{gray(#1)=(#2)}% \pgfplots@createcolormap@nextRGB{#1}{#2}{#2}{#2}% \pgfplots@createcolormap@} \def\pgfplots@createcolormap@grabcolor color{% @@ -178,6 +190,7 @@ \pgfplots@createcolormap@next }% \def\pgfplots@createcolormap@grabcolor@(#1)=(#2){% + \def\pgfplots@createcolormap@context{color(#1)=(#2)}% \pgfutil@colorlet{pgf@tempcol}{#2}% \pgfutil@extractcolorspec{pgf@tempcol}{\pgf@tempcolor}% \expandafter\pgfutil@convertcolorspec\pgf@tempcolor{rgb}{\pgf@rgbcolor}% @@ -186,7 +199,7 @@ \pgfplots@createcolormap@nextRGB{#4}{#1}{#2}{#3}% \pgfplots@createcolormap@} \def\pgfplots@createcolormap@rgbrangeexception#1#2#3{% - \pgfplots@error{Sorry, RGB[#1,#2,#3] is not supported. The allowed range is 0 <= r,g,b <= 1.}% + \pgfplots@error{Sorry, RGB[#1,#2,#3] is not supported. The allowed range is 0 <= r,g,b <= 1. The error occured near `\pgfplots@createcolormap@context'}% }% % Ok, we parsed the next single spec. % #1: the width @@ -222,7 +235,7 @@ \ifpgfplotsarrayempty \ifdim\pgfplots@createcolormap@MAX pt=0pt \else - \pgfplots@error{Sorry, the left end of a colormap (at 0pt) must be provided explicitly. You cannot start with \pgfplots@createcolormap@MAX pt.}% + \pgfplots@error{Sorry, the left end of a colormap (at 0pt) must be provided explicitly. You cannot start with \pgfplots@createcolormap@MAX pt. The error occured near `\pgfplots@createcolormap@context'}% \def\pgfplots@createcolormap@MAX{0}% \fi \else @@ -243,9 +256,8 @@ \c@pgf@counta=\pgfmathresult\relax \pgfmath@smuggleone\pgfmathresult \endgroup - \if\pgfmathresult\pgfutil@empty + \ifx\pgfmathresult\pgfutil@empty % I can't do that yet. - \pgfplots@error{Sorry, non-uniform colormaps are only partially implemented, yet: the provided points must be multiples of the mesh width h=\pgfplots@createcolormap@H pt. Perhaps it helps to provide the mesh widths as argument as in {<name>}{[1cm] <color arguments>}?}% \else \let\pgfplots@loc@TMPb=\pgfmathresult % interpolate missing values using the already fixed H. @@ -253,7 +265,7 @@ % only in forward direction - but it works at least. % For the backwards direction, you can provide the % meshwidth explicitly at - % \pgfplotscreatecolormap[h]{}{} + % \pgfplotscreatecolormap{}{[1pt]} \pgfplotsforeachungrouped \c@pgfplots@createcolormap in {1,2,...,\pgfplots@loc@TMPb} {% \ifdim\c@pgfplots@createcolormap pt=\pgfplots@loc@TMPb pt % omit the last. @@ -280,10 +292,27 @@ \edef\pgfplots@createcolormap@lastB{#4}% }% \def\pgfplots@createcolormap@nextRGB@consider@reinterpolation#1\relax{% - \ifdim#1pt<0.0005pt - \edef\pgfmathresult{\the\c@pgf@counta}% - \else + \pgf@xa=#1pt + \ifdim\pgf@xa>0.5pt % we have something like 99.995 or so. + % round up and compute 1 - #1: + \advance\c@pgf@counta by1 + \pgf@xa=1pt \advance\pgf@xa by-#1pt + \fi + % + % compute relative error: + \pgf@xb=\the\c@pgf@counta pt + \divide\pgf@xb by10000 +%\message{Checking H/h = \pgfplots@createcolormap@H@cur pt/\pgfplots@createcolormap@H pt = \the\c@pgf@counta+-\pgf@sys@tonumber\pgf@xa\space: \the\pgf@xa > \the\pgf@xb\space (relative to \the\c@pgf@counta)?}% + % + \ifdim\pgf@xa>\pgf@xb + \pgfplots@error{Sorry, non-uniform colormaps are only partially implemented, yet: the provided points must be multiples of the mesh width h=\pgfplots@createcolormap@H pt (but I found one with H/h = \pgfplots@createcolormap@H@cur pt/\pgfplots@createcolormap@H pt = \the\c@pgf@counta+-\pgf@sys@tonumber\pgf@xa\space which is no integer). Perhaps it helps to provide the mesh widths as argument as in {<name>}{[1cm] <color arguments>}? The error occured near `\pgfplots@createcolormap@context'}% \let\pgfmathresult=\pgfutil@empty + \else + \ifnum\c@pgf@counta=0 + \let\pgfmathresult=\pgfutil@empty + \else + \edef\pgfmathresult{\the\c@pgf@counta}% + \fi \fi }% @@ -312,20 +341,23 @@ % #2: a macro name \def\pgfplotscolormapserializetomacro#1#2{% \begingroup - \pgfplotslistnewempty\pgfplots@serialize@list + \pgfplotsapplistXnewempty\pgfplots@serialize@list@ \pgfplotsarrayforeachungrouped{pgfpl@cm@#1}\as\elem{% - \expandafter\pgfplotslistpushback\elem\to\pgfplots@serialize@list + \expandafter\pgfplotsapplistXpushback\expandafter{\elem},\to\pgfplots@serialize@list@ }% + \pgfplotsapplistXlet\pgfplots@serialize@list=\pgfplots@serialize@list@ \toks0={\expandafter\def\csname pgfpl@cm@#1@h\endcsname}% \toks1={\expandafter\def\csname pgfpl@cm@#1@invh\endcsname}% \toks2={% \pgfplotsarraynewempty{pgfpl@cm@#1}% - \pgfplotslistforeachungrouped\pgfplots@loc@TMPa\as\pgfplots@loc@TMPb{% - \expandafter\pgfplotsarraypushback\pgfplots@loc@TMPb\to{pgfpl@cm@#1}% + \expandafter\pgfplotsutilforeachcommasep\pgfplots@loc@TMPa\as\pgfplots@loc@TMPb{% + \ifx\pgfplots@loc@TMPb\pgfutil@empty + \else + \expandafter\pgfplotsarraypushback\pgfplots@loc@TMPb\to{pgfpl@cm@#1}% + \fi }% }% \toks3=\expandafter{\pgfplots@serialize@list}% - \t@pgfplots@toka=\expandafter{\pgfplots@serialize@list}% \xdef\pgfplots@glob@TMPa{% \the\toks0 {\csname pgfpl@cm@#1@h\endcsname}% \the\toks1 {\csname pgfpl@cm@#1@invh\endcsname}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex index 97260a1dae9..60df282f8bb 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex @@ -65,18 +65,16 @@ % Sets the boolean \ifpgfplots@is@old@list@format to true if and only % if the input is a list in the format '{first\\second\\}'. % -% This format is deprecated, but is still provided for backwards -% compatibility. % % Usage: % \pgfplots@check@backwards@compatible@list@format <argument>'\\'\pgfplots@EOI % you NEED to append '\\\pgfplots@EOI' at the end. -\def\pgfplots@check@backwards@compatible@list@format#1\\#2\pgfplots@EOI{% - \def\pgfplots@TMP{#2}% - \ifx\pgfplots@TMP\pgfutil@empty - \pgfplots@is@old@list@formatfalse - \else +\def\pgfplots@check@backwards@compatible@list@format#1\pgfplots@EOI{% + \pgfplotslist@check@backslash@list#1\pgfplotslist@EOI + \ifpgfplotslist@is@backslash@terminated \pgfplots@is@old@list@formattrue + \else + \pgfplots@is@old@list@formatfalse \fi }% @@ -149,7 +147,7 @@ }% -% Converts an arbitrary command to a string in which all characters +% Converts an arbitrary command (without arguments) to a string in which all characters % have category 12. % % #1: a macro name (which takes no arguments) @@ -164,6 +162,30 @@ \def#2{#1}% }% +% As \pgfplots@command@to@string, but it works for commands accepting +% arguments. More precisely, #2 will be a string (!) of the form +% <argument pattern>{ <body> } +% such that you can write +% \def\test #2 +% into a file to restore the original macro. This IGNORES \long +% (sorry) +\def\pgfplots@command@with@args@to@string#1#2{% + \expandafter\PGFPLOTS@CS@WITH@ARGS@TO@STRING\meaning#1\EOI{#2}% +}% +{ +\let\CATCODE=\catcode +\let\LONG=\long +\CATCODE`\m=12 +\CATCODE`\a=12 +\CATCODE`\c=12 +\CATCODE`\r=12 +\CATCODE`\o=12 +\CATCODE`\:=12 +\CATCODE`\-=12 +\CATCODE`\>=12 +\LONG\gdef\PGFPLOTS@CS@WITH@ARGS@TO@STRING #1macro:#2->#3\EOI#4{\def#4{#2{#3}}}% +}% + % Defines \pgfplotsretval to be '#1' but without leading and trailing % spaces. \def\pgfplotsutil@trim#1{% @@ -211,7 +233,9 @@ { \catcode`\%=12 \gdef\pgfplots@PERCENT@TEXT{%} -} +\catcode`\^^I=12 +\gdef\pgfplots@TAB{^^I} +\catcode`\#=12 \gdef\pgfplots@ROUTE{#}} % Usage: % \pgfplots@if{pgfplots@scaled@ticks}{true-code}{false-code} @@ -402,8 +426,18 @@ % related. % % @see \pgfplotsqpointxy@orthogonal -\let\pgfplotsqpointxy=\pgfqpointxy -\let\pgfplotsqpointxyz=\pgfqpointxyz +\def\pgfplotsqpointxy#1#2{% + \global\pgf@x=#1\pgf@xx% + \global\advance\pgf@x by #2\pgf@yx% + \global\pgf@y=#1\pgf@xy% + \global\advance\pgf@y by #2\pgf@yy} +\def\pgfplotsqpointxyz#1#2#3{% + \global\pgf@x=#1\pgf@xx% + \global\advance\pgf@x by #2\pgf@yx% + \global\advance\pgf@x by #3\pgf@zx% + \global\pgf@y=#1\pgf@xy% + \global\advance\pgf@y by #2\pgf@yy% + \global\advance\pgf@y by #3\pgf@zy} % A "quick" quick variant of \pgfqpointxy which assumes that % the X unit vector is ( e_xx,0 )^T and the Y unit vector is ( 0, @@ -412,8 +446,8 @@ % In words, the unit vectors are orthogonal. This is the usual case % for two-dimensional plots and shall be optimized. \def\pgfplotsqpointxy@orthogonal#1#2{% - \pgf@x=#1\pgf@xx% - \pgf@y=#2\pgf@yy} + \global\pgf@x=#1\pgf@xx% + \global\pgf@y=#2\pgf@yy} % Takes a domain as input and generates a foreach argument which @@ -785,6 +819,15 @@ \def\pgfplots@logfileopen#1{% \immediate\write-1{PGFPlots: reading {#1}}% + \pgfutil@ifundefined{tikzifexternalizingcurrent}{% + % version not up-to-date!? + }{% + % adjust the .dep file only if we are externalizing. + % Otherwise, it may be overwritten by \pgfplotstableread + % commands which are *before* the tikzpicture (and the picture + % will be replaced by its graphics) + \tikzifexternalizingcurrent{\tikzpicturedependsonfile{#1}}{}% + }% }% % Expands #2 using \edef and invokes #1 with the resulting string. @@ -857,6 +900,74 @@ \fi }% +% String comparison of '#1' and '#2'. +% Defines +% \pgfplotsretval=0 if #1 == #2 +% \pgfplotsretval=1 if #1 < #2 +% \pgfplotsretval=2 if #1 > #2 +\def\pgfplotsutilstrcmp#1#2{% + \begingroup + \def\pgfplots@strcmp@arga{#1}% + \pgfplots@command@to@string\pgfplots@strcmp@arga\pgfplots@strcmp@arga + \def\pgfplots@strcmp@argb{#2}% + \pgfplots@command@to@string\pgfplots@strcmp@argb\pgfplots@strcmp@argb + % + % + \def\pgfplotsretval{0}% + % + \pgfplotsloop{% + \if0\pgfplotsretval + % get next token of arga: + \expandafter\pgfplotsutilstrcmp@popfront\pgfplots@strcmp@arga\relax\relax + \let\pgfplots@strcmp@arga=\pgfplots@strcmp@rest + \let\pgfplots@strcmp@arga@=\pgfplots@strcmp@cur + % + % get next token of argb: + \expandafter\pgfplotsutilstrcmp@popfront\pgfplots@strcmp@argb\relax\relax + \let\pgfplots@strcmp@argb=\pgfplots@strcmp@rest + \let\pgfplots@strcmp@argb@=\pgfplots@strcmp@cur + % + % if one of them is empty: set retval and break loop. + \ifx\pgfplots@strcmp@arga@\pgfplotsutilstrcmp@relaxtext + \ifx\pgfplots@strcmp@argb@\pgfplotsutilstrcmp@relaxtext + \else + \def\pgfplotsretval{1}% + \fi + \pgfplotsloopcontinuefalse + \else + \ifx\pgfplots@strcmp@argb@\pgfplotsutilstrcmp@relaxtext + \def\pgfplotsretval{2}% + \pgfplotsloopcontinuefalse + \else + \pgfplotsloopcontinuetrue + \fi + \fi + \else + \pgfplotsloopcontinuefalse + \fi + }{% + % + \ifnum\expandafter`\pgfplots@strcmp@arga@<\expandafter`\pgfplots@strcmp@argb@ + \def\pgfplotsretval{1}% + \let\pgfplots@strcmp@arga=\pgfutil@empty + \else + \ifnum\expandafter`\pgfplots@strcmp@arga@>\expandafter`\pgfplots@strcmp@argb@ + \def\pgfplotsretval{2}% + \let\pgfplots@strcmp@arga=\pgfutil@empty + \fi + \fi + }% + % + \pgfmath@smuggleone\pgfplotsretval + \endgroup +}% +\def\pgfplotsutilstrcmp@relaxtext{\relax}% +\def\pgfplotsutilstrcmp@popfront#1#2\relax{% + \def\pgfplots@strcmp@cur{#1}% + \def\pgfplots@strcmp@rest{#2}% +}% + + \pgfutil@ifundefined{pgfmathdeclarefunction}{% % BACKWARDS COMPATIBILITY: We have PGF 2.00 : \def\pgfplotsmathdeclarepseudoconstant#1#2{% @@ -876,6 +987,72 @@ }% }% +\def\pgfplotsmathfloatln@#1{% + \pgfmathfloatln@{#1}% +} + +% Defines a macro which computes ln(x)/ln(#2) in float. +% +% #1: a macro name without backslash +% #2: the log base as fixed point number. Maybe the empty string in +% which case the natural log is used. +% +% It will define the macros: +% <macro>##1 -> calls \pgfmathfloatparsenumber and then the '@' variant: +% <macro>@##1 -> expects and returns result in float +% <macro>@tofixed##1 -> expects result in float, returns it in fixed (or an empty string) +% <macro>inv@##1 -> the inverse (exponential) function, expects float, returns float +% % +% <macro>logbase -> the basis as number +% <macro>logofbasefixed -> log(#2) +% <macro>invlogofbasefixed -> 1/log(#2) +% <macro>logofbasefloat -> log(#2) in float +% <macro>invlogofbasefloat -> 1/log(#2) in float +\def\pgfplotsmathdefinemacrolnbase#1#2{% + \expandafter\edef\csname #1logbase\endcsname{#2}% + \expandafter\ifx\csname #1logbase\endcsname\pgfutil@empty + \expandafter\edef\csname #1logbase\endcsname{2.718281828459}% + \expandafter\def\csname #1logofbasefixed\endcsname{1}% + \expandafter\def\csname #1invlogofbasefixed\endcsname{1}% + \else + \pgfmathlog@{\csname #1logbase\endcsname}% + \expandafter\let\csname #1logofbasefixed\endcsname\pgfmathresult% + \expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}% + \expandafter\let\csname #1invlogofbasefixed\endcsname\pgfmathresult% + \fi + % + \pgfmathfloatparsenumber{\csname #1logofbasefixed\endcsname}% + \expandafter\let\csname #1logofbasefloat\endcsname\pgfmathresult% + \pgfmathfloatparsenumber{\csname #1invlogofbasefixed\endcsname}% + \expandafter\let\csname #1invlogofbasefloat\endcsname\pgfmathresult% + % + \expandafter\def\csname #1@tofixed\endcsname##1{% + \pgfmathlog@float{##1}% + \ifx\pgfmathresult\pgfutil@empty + \else + \expandafter\pgfmath@basic@multiply@\expandafter + {\pgfmathresult}% + {\csname #1invlogofbasefixed\endcsname}% + \fi + }% + \expandafter\def\csname #1@\endcsname##1{% + \expandafter\csname #1@tofixed\endcsname{##1}% + \ifx\pgfmathresult\pgfutil@empty + \pgfmathfloatcreate{3}{0.0}{0}% + \else + \pgfmathfloatparsenumber{\pgfmathresult}% + \fi + }% + \expandafter\def\csname #1\endcsname##1{% + \pgfmathfloatparsenumber{##1}% + \csname #1@\endcsname{\pgfmathresult}% + }% + % + \expandafter\def\csname #1inv@\endcsname##1{% + \expandafter\pgfmathfloatmultiply@\expandafter{##1}{\csname #1logofbasefloat\endcsname}% + \pgfmathfloatexp@{\pgfmathresult}% + }% +}% % Usage: % \pgfplotsutilstrreplace{<token>}{<replacement>}{<string>} @@ -915,10 +1092,221 @@ % this command is in pgfplotscore.code.tex: % \pgfplotsiffileexists +% EXPERIMENTAL OPTIMIZATION: +\let\pgfmathparsex@orig=\pgfmathparse +\def\pgfmathparsex#1{% + \begingroup + \message{WORKING ON #1...}% + \tracingmacros=2 \tracingcommands=2 + \let\pgfmath@parse@@@operator\relax + \let\pgfmath@parse@@operator\relax + \let\pgfmath@parse@operator\relax + \let\pgfmath@stack@push@operand\pgfutil@gobble + \let\pgfmath@base=\pgfmath@empty + \let\pgfmath@number=\pgfmath@empty + \let\pgfmath@parse@number@failed=\relax + \edef\pgfmath@expression{#1}% + \expandafter\pgfmathparsex@first\pgfmath@expression\pgfmathparsex@EOI% + \if1\pgfmathparsex@recover@ + \xdef\pgfmathparsex@@{\noexpand\pgfmathparsex@orig{\pgfmath@expression}}% + \else + \xdef\pgfmathparsex@@{\noexpand\def\noexpand\pgfmathresult{\pgfmathresult}}% + \fi + \endgroup + \pgfmathparsex@@ +}% +\def\pgfmathparsex@first#1#2\pgfmathparsex@EOI{% + \def\pgfmath@token@next{#1}% + \pgfmath@parse@number{#2}% +}% +\def\pgfmathparsex@recover{\def\pgfmathparsex@recover@{1}}% +\def\pgfmathparsex@recover@{0}% + + +% compares YYYY-MM-DD < YYYY-MM-DD +% +% \pgfplotsutilifdatelessthan 2010-01-01\cmp 2011-01-01\relax{<true>}{<false>} +\long\def\pgfplotsutilifdatelessthan#1-#2-#3\cmp #4-#5-#6\relax#7#8{% + \long\def\pgfplotsutilifdatelessthan@true{#7}% + \long\def\pgfplotsutilifdatelessthan@false{#8}% + \ifnum#1<#4\relax + \pgfplotsutilifdatelessthan@true + \else + \ifnum#1>#4\relax + \pgfplotsutilifdatelessthan@false + \else + \ifnum#2<#5\relax + \pgfplotsutilifdatelessthan@true + \else + \ifnum#2>#5\relax + \pgfplotsutilifdatelessthan@false + \else + \ifnum#3<#6\relax + \pgfplotsutilifdatelessthan@true + \else + \pgfplotsutilifdatelessthan@false + \fi + \fi + \fi + \fi + \fi +}% +\long\def\pgfplotsutilifdategreaterthan#1-#2-#3\cmp #4-#5-#6\relax#7#8{% + \long\def\pgfplotsutilifdatelessthan@true{#7}% + \long\def\pgfplotsutilifdatelessthan@false{#8}% + \ifnum#1>#4\relax + \pgfplotsutilifdatelessthan@true + \else + \ifnum#1<#4\relax + \pgfplotsutilifdatelessthan@false + \else + \ifnum#2>#5\relax + \pgfplotsutilifdatelessthan@true + \else + \ifnum#2<#5\relax + \pgfplotsutilifdatelessthan@false + \else + \ifnum#3>#6\relax + \pgfplotsutilifdatelessthan@true + \else + \pgfplotsutilifdatelessthan@false + \fi + \fi + \fi + \fi + \fi +}% +\pgfkeys{% + % /pgfplots/iflessthan{#1}{#2}{#3}{#4}: + % #1: arg1 (a macro containing the first argument) + % #2: arg2 (a macro containing the second argument) + % #3: code to invoke in case arg1<arg2 + % #4: code to invoke in case arg1>=arg2 + % the iflessthan method will be invoked within local scopes. + /pgfplots/fixed </.style={% + /pgfplots/iflessthan/.code args={##1##2##3##4}{\ifdim##1pt<##2pt\relax##3\else##4\fi},% + }, + /pgfplots/fixed <, + /pgfplots/fixed >/.style={% + /pgfplots/iflessthan/.code args={##1##2##3##4}{\ifdim##1pt>##2pt\relax##3\else##4\fi},% + }, + /pgfplots/int </.style={% + /pgfplots/iflessthan/.code args={##1##2##3##4}{\ifnum##1<##2\relax##3\else##4\fi},% + }, + /pgfplots/int >/.style={% + /pgfplots/iflessthan/.code args={##1##2##3##4}{\ifnum##1>##2\relax##3\else##4\fi},% + }, + /pgfplots/float </.style={% + /pgfplots/iflessthan/.code args={##1##2##3##4}{% + \pgfmathfloatparsenumber{##1}% + \let\pgfplots@iflt@arga=\pgfmathresult + % + \pgfmathfloatparsenumber{##2}% + \let\pgfplots@iflt@argb=\pgfmathresult + % + \pgfmathfloatlessthan@{\pgfplots@iflt@arga}{\pgfplots@iflt@argb}% + \ifpgfmathfloatcomparison + ##3% + \else + ##4% + \fi + }% + },% + /pgfplots/float >/.style={% + /pgfplots/iflessthan/.code args={##1##2##3##4}{% + \pgfmathfloatparsenumber{##1}% + \let\pgfplots@iflt@arga=\pgfmathresult + % + \pgfmathfloatparsenumber{##2}% + \let\pgfplots@iflt@argb=\pgfmathresult + % + \pgfmathfloatgreaterthan@{\pgfplots@iflt@arga}{\pgfplots@iflt@argb}% + \ifpgfmathfloatcomparison + ##3% + \else + ##4% + \fi + }% + },% + % + % compares YYYY-MM-DD < YYYY-MM-DD + /pgfplots/date </.style={% + /pgfplots/iflessthan/.code args={##1##2##3##4}{% + \edef\pgfplotsarray@ltdate{##1\noexpand\cmp ##2}% + \expandafter\pgfplotsutilifdatelessthan\pgfplotsarray@ltdate\relax{##3}{##4}% + }% + },% + /pgfplots/date >/.style={% + /pgfplots/iflessthan/.code args={##1##2##3##4}{% + \edef\pgfplotsarray@ltdate{##1\noexpand\cmp ##2}% + \expandafter\pgfplotsutilifdategreaterthan\pgfplotsarray@ltdate\relax{##3}{##4}% + }% + },% + % + /pgfplots/string </.style={% + /pgfplots/iflessthan/.code args={##1##2##3##4}{% + \t@pgfplots@toka=\expandafter{##1}% + \t@pgfplots@tokb=\expandafter{##2}% + \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@toka}{\the\t@pgfplots@tokb}}% + \expandafter\pgfplotsutilstrcmp\pgfplots@loc@TMPa + \if1\pgfplotsretval ##3\else ##4\fi + }% + },% + /pgfplots/string >/.style={% + /pgfplots/iflessthan/.code args={##1##2##3##4}{% + \t@pgfplots@toka=\expandafter{##1}% + \t@pgfplots@tokb=\expandafter{##2}% + \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@toka}{\the\t@pgfplots@tokb}}% + \expandafter\pgfplotsutilstrcmp\pgfplots@loc@TMPa + \if2\pgfplotsretval ##3\else ##4\fi + }% + },% +} + +% defines \pgfplotsretval to be +% +% \tikzifinpicture{#1}{#2} +% +% and handles the '/pgfplots/invoke before crossref tikzpicture' key. +% +% #1 first argument to \tikzifinpicture +% #2 second argument to \tikzifinpicture +\def\pgfplots@assemble@ref@picture#1#2{% + \begingroup + \pgfkeysgetvalue{/pgfplots/invoke before crossref tikzpicture}\pgfplots@loc@TMPa + \pgfkeysgetvalue{/pgfplots/invoke after crossref tikzpicture}\pgfplots@loc@TMPb + \toks0={#1}% + \toks1=\expandafter{\pgfplots@loc@TMPa}% + \toks2={#2}% + \toks3=\expandafter{\pgfplots@loc@TMPb}% + \xdef\pgfplots@glob@TMPa{% + \noexpand\tikzifinpicture + {\the\toks0}% + {% + \the\toks1 + \the\toks2 + \the\toks3 + }% + }% + \endgroup + \let\pgfplotsretval=\pgfplots@glob@TMPa +}% + +\def\pgfplots@auxwrite@latex#1{% + \if@filesw + \immediate\write\@auxout{#1}% + \fi +}% +\pgfutil@ifundefined{if@filesw}{% + \def\pgfplots@auxwrite#1{}% +}{% + \let\pgfplots@auxwrite=\pgfplots@auxwrite@latex +}% + \input pgfplotsliststructure.code.tex \input pgfplotsliststructureext.code.tex \input pgfplotsarray.code.tex -\input pgfplotstable.code.tex +\input pgfplotstableshared.code.tex \input pgfplotsdeque.code.tex \input pgfplotsbinary.code.tex |