summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-01-03 01:14:11 +0000
committerKarl Berry <karl@freefriends.org>2010-01-03 01:14:11 +0000
commit98837e31bcd7413ffa40c85ebbce9aa3ff3fdbed (patch)
tree1ed7f18cb8a81bb3f209bf158a38f5b624c2d607 /Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib
parent080069f58e2325db5ab0ac5f5ea584f3021bc383 (diff)
pgfplots 1.3 (2jan10)
git-svn-id: svn://tug.org/texlive/trunk@16576 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib')
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex46
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex259
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeys.code.tex921
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex202
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex225
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex42
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.code.tex85
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex429
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex1115
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex345
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty127
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternalshared.code.tex1031
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex83
13 files changed, 4700 insertions, 210 deletions
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 26e55e00402..c63985e38c4 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
@@ -9,21 +9,39 @@
% The development of pgfplots and pgf is intermingled, so pgfplots
% always uses up-to-date pgf CVS versions - the relevant complements between
% PGF 2.00 and PGF CVS are loaded here:
-%\pgfutil@ifundefined{pgfmathfloatparsenumber@handleerror}{%
-\pgfkeysifdefined{/pgf/text mark}{\relax}{%
- \immediate\write16{Package pgfplots: loading complementary code for your PGF version...}
- \input pgfplotsoldpgfsupp_misc.code.tex
- \input pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex
- \input pgfplotsoldpgfsupp_pgfmathfloat.code.tex
- \input pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex
-}
- {\relax}
+%
+% #1: for backwards compatibility
+% #2: for normal processing.
+\def\pgfplots@ifneedspgfcompabitibilitycode#1#2{%
+ %\pgfkeysifdefined{/handlers/.search also/.@cmd}{#2}{#1}%
+ \pgfutil@ifundefined{pgfutilsolvetwotwoleq}{#1}{#2}%
+}%
+
+\pgfplots@ifneedspgfcompabitibilitycode
+ {%
+ \immediate\write16{Package pgfplots: loading complementary code for your PGF version...}
+ \input pgfplotsoldpgfsupp_misc.code.tex
+ \let\pgfkeysloaded=\undefined
+ % FIXME: this does also load pgfkeysfiltered.code.tex again:
+ \input pgfplotsoldpgfsupp_pgfkeys.code.tex
+ \input pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex
+ \input pgfplotsoldpgfsupp_pgfmathfloat.code.tex
+ \input pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex
+ \input pgfplotsoldpgfsupp_pgflibraryfpu.code.tex
+ }%
+ {%
+ \pgfplots@iffileexists{pgflibraryfpu.code.tex}{%
+ \usepgflibrary{fpu}%
+ }{%
+ \immediate\write16{Package pgfplots: loading FPU library which doesn't appear to exist in your PGF version...}
+ \input pgfplotsoldpgfsupp_pgflibraryfpu.code.tex
+ }%
+ }%
-\pgfplots@iffileexists{pgflibraryfpu.code.tex}{%
- \usepgflibrary{fpu}%
-}{%
- \immediate\write16{Package pgfplots: loading FPU library which doesn't appear to exist in your PGF version...}
+\pgfutil@ifundefined{pgfmathdeclarepseudoconstant}{
+ \immediate\write16{Package pgfplots: loading complementary arithmetics for your pgf version...}
\input pgfplotsoldpgfsupp_pgflibraryfpu.code.tex
-}%
+}
+{}%
\endinput
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 749c547563a..132240e77c7 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
@@ -1,47 +1,191 @@
% ======================================================
% compatibility with PGF 2.0
-\def\pgfkeysaddvalue#1#2#3{%
- {%
- \toks0{#2}%
- \pgfkeysifdefined{#1}
- {\pgfkeys@temptoks\expandafter\expandafter\expandafter{\csname pgfk@#1\endcsname}}%
- {\pgfkeys@temptoks{}}%
- \toks1{#3}%
- \xdef\pgfkeys@global@temp{\the\toks0 \the\pgfkeys@temptoks \the\toks1}% believe or don't: the spaces are important
- }%
- \pgfkeyslet{#1}\pgfkeys@global@temp%
+% ======================================================
+
+% from pgfutil-common.tex:
+
+% Usage:
+% \pgfutilstrreplace{<token>}{<replacement>}{<string>}
+%
+% -> will assign the modified string into \pgfretval.
+%
+% #1: the string to search (one or more tokens)
+% #2: zero, one or more tokens which will be inserted instead of '#1'.
+% #3: the string to search in
+\long\def\pgfutilstrreplace#1#2#3{%
+ \def\pgfretval{}%
+ \long\def\pgfutil@search@and@replace@@##1#1##2\pgf@EOI{%
+ \expandafter\def\expandafter\pgfretval\expandafter{\pgfretval ##1#2}%
+ \pgfutil@search@and@replace@loop{#1}{##2}%
+ }%
+ \pgfutil@search@and@replace@loop{#1}{#3}%
}
+\long\def\pgfutil@search@and@replace@loop#1#2{%
+ \pgfutil@in@{#1}{#2}%
+ \ifpgfutil@in@
+ \def\pgf@loc@TMPa{\pgfutil@search@and@replace@@ #2\pgf@EOI}%
+ \else
+ \expandafter\def\expandafter\pgfretval\expandafter{\pgfretval #2}%
+ \let\pgf@loc@TMPa=\relax
+ \fi
+ \pgf@loc@TMPa
+}%
+% Solves a linear equation system of size 2x2 using gauss elimination.
+%
+% It employs TeX register arithmetics to do so.
+% #1: should contain 4 sets of braces with matrix entries,
+% {<a11>}{<a12>}
+% {<a21>}{<a22>}
+% where each entry should be a number without unit.
+% #2: should contain 2 sets of braces with the right-hand-side,
+% {<r1>}{<r2>}
+% where each entry should be a number without unit.
+%
+% It will assign \pgfmathresult to contain two sets of braces with the
+% result.
+%
+% Example:
+% \pgfutilsolvetwotwoleq{
+% {0.24}{1}
+% {-0.97}{0}
+% }{
+% {-7}
+% {18}
+% }
+% -> yields \pgfmathresult={−18.55618}{−2.54642}
+%
+% The algorithm employs column pivotisation.
+\def\pgfutilsolvetwotwoleq#1#2{%
+ \begingroup
+ \dimendef\aa=0
+ \dimendef\ab=1
+ \dimendef\ba=2
+ \dimendef\bb=3
+ \dimendef\ra=4
+ \dimendef\rb=5
+ \dimendef\tmpa=6
+ \dimendef\tmpb=7
+ \edef\pgf@temp{#1}%
+ \expandafter\pgfutilsolvetwotwoleq@A\pgf@temp
+ \edef\pgf@temp{#2}%
+ \expandafter\pgfutilsolvetwotwoleq@r\pgf@temp
+ %
+ \pgfutilsolvetwotwoleq@ifislarger\aa\ba{%
+ % identity "permutation":
+ \def\Pa{a}%
+ \def\Pb{b}%
+ }{%
+ % permutation matrix: switch rows!
+ \def\Pa{b}%
+ \def\Pb{a}%
+ }%
+ % \pivot := 1/aa
+ \pgfmathreciprocal@
+ {\csname m\Pa a\endcsname}%
+ \let\pivot=\pgfmathresult
+ %
+ % \factor := 1/aa * ba
+ \csname \Pb a\endcsname=\pivot\csname \Pb a\endcsname
+ \edef\factor{\expandafter\pgf@sys@tonumber\csname \Pb a\endcsname}%
+ %
+ % bb -= ba/aa * ab
+ \tmpa=-\factor\csname \Pa b\endcsname
+ \advance\csname \Pb b\endcsname by\tmpa
+ %
+ % rb -= ba/aa * ra
+ \tmpa=-\factor\csname r\Pa\endcsname
+ \advance\csname r\Pb\endcsname by\tmpa
+ %
+ % xb := rb / bb (the modified rb and modified bb!)
+ \pgfmathdivide@
+ {\expandafter\pgf@sys@tonumber\csname r\Pb\endcsname}
+ {\expandafter\pgf@sys@tonumber\csname \Pb b\endcsname}%
+ \expandafter\let\csname pgfmathresult\Pb\endcsname=\pgfmathresult
+ %
+ % ra -= xb * ab
+ \tmpa=\csname pgfmathresult\Pb\endcsname\csname \Pa b\endcsname
+ \advance\csname r\Pa\endcsname by-\tmpa
+ %
+ % xa := 1/aa * ra (the modified ra!)
+ \tmpa=\pivot\csname r\Pa\endcsname
+ \expandafter\edef\csname pgfmathresult\Pa\endcsname{\pgf@sys@tonumber\tmpa}%
+ %
+ \edef\pgfmathresult{%
+ {\csname pgfmathresult\Pa\endcsname}%
+ {\csname pgfmathresult\Pb\endcsname}%
+ }%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\def\pgfutilsolvetwotwoleq@ifislarger#1#2#3#4{%
+ \tmpa=#1
+ \ifdim\tmpa<0pt
+ \multiply\tmpa by-1
+ \fi
+ \tmpb=#2
+ \ifdim\tmpb<0pt
+ \multiply\tmpb by-1
+ \fi
+ \ifdim\tmpa>\tmpb
+ #3%
+ \else
+ #4%
+ \fi
+}%
+\def\pgfutilsolvetwotwoleq@A#1#2#3#4{%
+ \def\maa{#1}\def\mab{#2}%
+ \def\mba{#3}\def\mbb{#3}%
+ \aa=#1pt \ab=#2pt
+ \ba=#3pt \bb=#4pt
+}
+\def\pgfutilsolvetwotwoleq@r#1#2{%
+ \ra=#1pt \rb=#2pt
+}%
-\def\pgfkeys@try{%
- \pgfkeysifdefined{\pgfkeyscurrentpath/.@cmd}%
- {%
- \pgfkeysgetvalue{\pgfkeyscurrentpath/.@cmd}{\pgfkeys@code}%
- \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text% Hmm... no value
- \pgfkeysifdefined{\pgfkeyscurrentpath/.@def}%
- {\pgfkeysgetvalue{\pgfkeyscurrentpath/.@def}{\pgfkeyscurrentvalue}}
- {}% no default, so leave it
- \fi%
- \let\pgfkeyscurrentkey=\pgfkeyscurrentpath% make sure that \pgfkeys@code doesn't know about 'try'. Important for .is choice
- % FIXME: maybe there are more things like that - also adjust currentname!?
- \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov%
- \pgfkeyssuccesstrue%
- }%
+
+%%%%%%%
+%%%%%%%
+
+% from pgfmoduleshapes.code.tex:
+% Invoke an anchor
+\def\pgf@sh@reanchor#1#2{%
+ \pgfutil@ifundefined{pgf@anchor@#1@#2}%
{%
- \pgfkeysifdefined{\pgfkeyscurrentpath}%
- {%
- \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text%
- \pgfkeysvalueof{\pgfkeyscurrentpath}%
- \else%
- \pgfkeyslet{\pgfkeyscurrentpath}\pgfkeyscurrentvalue%
- \fi%
- \pgfkeyssuccesstrue%
+ \pgfutil@ifundefined{pgf@anchor@generic@#2}{%
+ \pgfmathsetcounter{pgf@counta}{#2}%
+ \csname pgf@anchor@#1@border\endcsname{\pgfqpointpolar{\c@pgf@counta}{1pt}}%
+ }{%
+ \csname pgf@anchor@generic@#2\endcsname{#1}%
}%
- {\pgfkeyssuccessfalse}%
}%
+ {\csname pgf@anchor@#1@#2\endcsname}%
}
-% ======================================================
+% Defines a generic anchor, i.e. one which gets the associated shape
+% as first argument.
+%
+% #1: the anchor name.
+% #2: the code of the anchor. It may depend upon '##1', the shape's
+% name.
+%
+% The anchor will be defined locally in the current TeX scope.
+\def\pgfdeclaregenericanchor#1#2{%
+ \expandafter\def\csname pgf@anchor@generic@#1\endcsname##1{#2}%
+}%
+
+% from pgfcoretransformations.code.tex :
+\def\pgfgettransformentries#1#2#3#4#5#6{%
+ \edef#1{\pgf@pt@aa}%
+ \edef#2{\pgf@pt@ab}%
+ \edef#3{\pgf@pt@ba}%
+ \edef#4{\pgf@pt@bb}%
+ \edef#5{\the\pgf@pt@x}%
+ \edef#6{\the\pgf@pt@y}%
+}%
+\def\pgfsettransformentries#1#2#3#4#5#6{%
+ \pgfsettransform{{#1}{#2}{#3}{#4}{#5}{#6}}%
+}%
% pgfutil@loop (from plain.tex)
@@ -75,6 +219,13 @@
\expandafter\gdef\csname pgf@sh@pi@#1\endcsname{\pgfpictureid}%
\fi%
}
+% A "quick" variant of \pgfpointscale which doesn't invoke the math parser for '#1'.
+% #1 must be a number without units, no registers are accepted.
+\def\pgfqpointscale#1#2{%
+ \pgf@process{#2}%
+ \pgf@x=#1\pgf@x%
+ \pgf@y=#1\pgf@y%
+}
% ======================================================
\def\pgfutilensuremath#1{%
@@ -91,6 +242,11 @@
\tikzoption{jump mark right}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkright}
\tikzoption{jump mark left}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkleft}
+\def\tikz@plot@samples{25}
+\def\tikz@plot@domain{-5:5}
+\def\tikz@plot@var{\x}
+\def\tikz@plot@samplesat{-5,-4.5833333,...,5}
+
\tikzoption{mark}{
\def\tikz@plot@mark{#1}%
\def\tikz@temp{none}% this check is relatively new
@@ -98,8 +254,17 @@
\let\tikz@plot@mark=\pgfutil@empty
\fi
}
+
+% the 'pt' suffix is new:
+\pgfdeclareplotmark{ball}
+{%
+ \def\tikz@shading{ball}%
+ \shade (0pt,0pt) circle (\pgfplotmarksize);%
+}
+
% the 'every mark' style is new:
\tikzset{
+ no marks/.style={mark=none},%
every mark/.style={},
mark options/.style={%
every mark/.style={#1}%
@@ -183,14 +348,19 @@
\newif\ifpgfmarktext@usetikznode
\pgfkeys{
/pgf/text mark/.initial=p,
- /pgf/text mark/style/.initial=,
- /pgf/text mark/as node/.is if=pgfmarktext@usetikznode,
- /pgf/text mark/.default=true,
+ /pgf/text mark style/.initial=,
+ /pgf/text mark as node/.is if=pgfmarktext@usetikznode,
+ /pgf/text mark as node/.default=true,
+ %
+ % backw. compat: the extra search path confuses the '.unknown'
+ % handlers, so this here is deprecated:
+ /pgf/text mark/style/.style={/pgf/text mark style={#1}},%
+ /pgf/text mark/as node/.style={/pgf/text mark as node=#1},%
}%
\pgfdeclareplotmark{text}
{
- \pgfkeysgetvalue{/pgf/text mark/style}\pgfmarktext@style
+ \pgfkeysgetvalue{/pgf/text mark style}\pgfmarktext@style
\pgfkeysgetvalue{/pgf/text mark}\pgfmarktext@
\ifpgfmarktext@usetikznode
\expandafter\node\expandafter[\pgfmarktext@style]{\pgfmarktext@};
@@ -232,3 +402,16 @@
\pgfmatrixbegincode%
}%
}
+
+% From pgfmoduleplot.code.tex:
+{
+ \catcode`\%=12
+ \catcode`\"=12
+ \xdef\pgf@gnuplot@head@pgf@two@oo#1{set terminal table; set output "#1.table"; set format "%.5f"}
+ \ifx\pgf@gnuplot@head\pgf@gnuplot@head@pgf@two@oo
+ \xdef\pgf@gnuplot@head#1{set table "#1.table"; set format "%.5f"}
+ \else
+ \xdef\pgf@gnuplot@head{set table \noexpand\pgf@plottablefile@quoted; set format "%.5f"}
+ \fi
+}
+
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
new file mode 100644
index 00000000000..6ae79bec9bf
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeys.code.tex
@@ -0,0 +1,921 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% 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: Di 29. Dez 22:11:16 CET 2009 %%%
+
+
+
+% Copyright 2007 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.
+
+
+% The files pgfkeys.code.tex and pgfkeysfiltered.code.tex are
+% perfectly self-contained, except that the catcode of @
+% should be made a letter.
+
+
+% Guard against reading twice
+\ifx\pgfkeysloaded\undefined
+ \let\pgfkeysloaded=\relax
+\else
+ \expandafter\endinput
+\fi
+
+% The purpose of this file is to provide a general settings engine that
+% works with all TeX formats and has no save-stack impact
+
+
+% This is useful:
+
+\def\pgfkeys@ifcsname#1\endcsname#2\else#3\fi{\expandafter\ifx\csname#1\endcsname\relax#3\else#2\fi}%
+\ifx\eTeXrevision\undefined%
+\else%
+ \expandafter\let\expandafter\pgfkeys@ifcsname\csname ifcsname\endcsname%
+\fi
+
+\def\pgfkeys@empty{}
+
+% This also:
+
+\ifx\PackageError\undefined
+ \def\pgfkeys@error#1{\immediate\write-1{Package pgfkeys: Error! #1.}}%
+\else
+ \def\pgfkeys@error#1{\PackageError{pgfkeys}{#1}{}}%
+\fi
+
+% Set a key to a value
+%
+% #1 = key
+% #2 = tokens
+%
+% Description:
+%
+% This command sets the key to the given tokens. The tokens are stored as
+% is and can even contain things like #9.
+%
+% Keys are organized hierarchically using something similar to Unix
+% paths. Thus, a typically key might be called "/tikz/length" or
+% "/tikz/length dimension/.@cmd". Some keys starting with a dot are
+% special, so they should not be used as normal key names (they are
+% similar to Unix files starting with a dot -- you can use them, but
+% be careful).
+%
+% Keys are always local to the current TeX group.
+%
+% Example:
+%
+% \pgfkeyssetvalue{/tikz/length}{2cm-3cm}
+% \pgfkeyssetvalue{/algo/swap}{{#2}{#1}}
+
+\long\def\pgfkeyssetvalue#1#2{%
+ \pgfkeys@temptoks{#2}\expandafter\edef\csname pgfk@#1\endcsname{\the\pgfkeys@temptoks}%
+}
+
+
+
+% Add text to a key at the end
+%
+% #1 = key
+% #2 = a value to be added at the beginning
+% #3 = a value to be added at the end
+%
+% Description:
+%
+% This command adds #2 to the definition of the key. The key should
+% have been set previously using \pgfkeyssetvalue.
+%
+% Example:
+%
+% \pgfkeysaddvalue{/tikz/length}{}{-3cm}
+
+\long\def\pgfkeysaddvalue#1#2#3{%
+ {%
+ \toks0{#2}%
+ \pgfkeysifdefined{#1}
+ {\pgfkeys@temptoks\expandafter\expandafter\expandafter{\csname pgfk@#1\endcsname}}%
+ {\pgfkeys@temptoks{}}%
+ \toks1{#3}%
+ \xdef\pgfkeys@global@temp{\the\toks0 \the\pgfkeys@temptoks \the\toks1}% believe or don't: the spaces are important
+ }%
+ \pgfkeyslet{#1}\pgfkeys@global@temp%
+}
+
+
+
+% Makes a key equal a given code
+%
+% #1 = key
+% #2 = a code name
+%
+% Description:
+%
+% This command executes a \let command so that a key gets the same
+% value as the parameter #2.
+%
+% Keys are always local to the current TeX group.
+%
+% Example:
+%
+% \pgfkeyslet{/algo/swap}{\myswap}
+
+\def\pgfkeyslet#1#2{%
+ \expandafter\let\csname pgfk@#1\endcsname#2%
+}
+
+
+% Retrieve the code stored in a key into a code
+%
+% #1 = key
+% #2 = code
+%
+% Description:
+%
+% This command will set #2 to "point" to the value stored in the key.
+%
+% Example:
+%
+% \pgfkeysgetvalue{/tikz/swap}{\myswap}
+
+\def\pgfkeysgetvalue#1#2{\expandafter\let\expandafter#2\csname pgfk@#1\endcsname}
+
+
+
+% Retrieve the value stored in a key
+%
+% #1 = key
+%
+% Description:
+%
+% This command will expand to the value stored in the key. The key
+% should previously have been set using \pgfkeyasetkey or \pgfkeyslet.
+%
+% Example:
+%
+% The length is \pgfkeysvalue{/tikz/length}.
+
+\def\pgfkeysvalueof#1{\csname pgfk@#1\endcsname}
+
+
+
+% If for testing whether a key exists
+%
+% #1 = key
+% #2 = if-case
+% #3 = else-case
+%
+% Description:
+%
+% This if will be executed if the key exists. In eTeX mode this works
+% like a normal if, in normal TeX mode you need to provide an \else.
+%
+% Example:
+%
+% \pgfkeysifdefined{/tikz/length}{key exists}{does not exist}
+
+\long\def\pgfkeysifdefined#1#2#3{\pgfkeys@ifcsname pgfk@#1\endcsname#2\else#3\fi}
+
+% Tests whether a key is assignable. For standard keys which just
+% store their value, this is identical to \pgfkeysifdefined.
+%
+% But \pgfkeysifassignable is true for command keys as well (but not
+% for handled keys).
+\long\def\pgfkeysifassignable#1#2#3{%
+ \pgfkeysifdefined{#1}%
+ {#2}
+ {\pgfkeysifdefined{#1/.@cmd}%
+ {#2}%
+ {#3}}%
+}%
+
+
+
+% Execute settings
+%
+% #1 = list of settings
+%
+% Description:
+%
+% The list of settings should contain comma-separated settings. Each
+% setting has the following form:
+%
+% /path/key=value
+%
+% The parts "/path/" and "=value" are optional. When the path is not
+% specified, the value of the token register "\pgfkeypath" is used. If
+% "=value" is missing, the value of the setting "/path/key/.@def" is used
+% instead. If this key is set to "\pgfvaluerequired", the key
+% "/errors/value required/.@cmd" is executed. Theis error handler,
+% like all other error handlers, will get the current key as its first
+% parameter (unexpanded) and the current value as its second value
+% (also unexpanded).
+%
+% Any spaces at the beginning and at the end and around the
+% equals-sign are removed. The key with the complete path is set to
+% the code \pgfcurrentkey.
+%
+% The setting is then processed according to the following rules:
+%
+% 1) If the key /path/key/.@cmd" is present, its code is executed
+% with the value computed above, followed by \pgfeov (end of
+% value). So, to handle
+%
+% "/stuff/height= 1.5 ,"
+%
+% /stuff/height/.@cmd should be set to some code, that can
+% handle the parameter
+%
+% "1.5\pgfeov"
+%
+% For instance, saying
+%
+% \pgfkeys{/stuff/height/.@cmd}{#1\pgfeov}{\def\myheight{#1}}
+%
+% will do nicely.
+%
+% 2) Otherwise, if the key /path/key is present, this key is
+% set to the value computed above.
+%
+% 3) Otherwise, if the key /handlers/key/.@cmd is present, it is executed
+% with the same parameters as in 1). Additionally, the
+% token register \pgfcurrentkeypath will be set to "/path/" and the
+% macor \pgfcurrentkeywithoutpath to "key". So, in the above
+% example if neither "/stuff/height/.@cmd" nor
+% "/stuff/height" is present, but "/handlers/height" is,
+% then "/handlers/height" is executed with the parameters:
+%
+% "1.5\pgfeov"
+%
+% and \pgfcurrentkey is set to "/stuff/height" and \pgfcurrentkeypath
+% is set to "/stuff/" and \pgfcurrentkeywithoutpath to "height".
+%
+% 4) Otherwise, if the key "/path/.unknown/.@cmd" is present, its code is
+% executed with the same parameters as in 3).
+%
+% 5) Otherwise, the key "/handlers/.unknown/.@cmd" is executed with the same
+% parameters as in 1).
+%
+% After all settings have been processed, the value of the token
+% register \pgfdefaultkeypath is set to its original value. Thus, any local
+% change of this token register has no effect outside the call.
+%
+% Example:
+%
+% \pgfkeys{/tikz/.is family}
+% \pgfkeys{/tikz/line width/.cd,
+% .def=\pgfsetlinewidth{##1},
+% .set default=.4pt}
+% \pgfkeys{tikz,line width=1pt}
+
+\newtoks\pgfkeys@pathtoks
+\def\pgfkeyscurrentpath{\the\pgfkeys@pathtoks}
+\newtoks\pgfkeys@temptoks
+
+\def\pgfkeys@root{/}
+\let\pgfkeysdefaultpath\pgfkeys@root
+
+\def\pgfkeys{\expandafter\pgfkeys@@set\expandafter{\pgfkeysdefaultpath}}%
+\long\def\pgfkeys@@set#1#2{%
+ \let\pgfkeysdefaultpath\pgfkeys@root%
+ \pgfkeys@parse#2,\pgfkeys@mainstop%
+ \def\pgfkeysdefaultpath{#1}}
+
+\def\pgfkeys@parse{\futurelet\pgfkeys@possiblerelax\pgfkeys@parse@main}
+\def\pgfkeys@parse@main{%
+ \ifx\pgfkeys@possiblerelax\pgfkeys@mainstop%
+ \expandafter\pgfkeys@cleanup%
+ \else%
+ \expandafter\pgfkeys@normal%
+ \fi%
+}
+\long\def\pgfkeys@normal#1,{%
+ \pgfkeys@unpack#1=\pgfkeysnovalue=\pgfkeys@stop%
+ \pgfkeys@parse%
+}
+\def\pgfkeys@cleanup\pgfkeys@mainstop{}
+
+\def\pgfkeys@mainstop{\pgfkeys@mainstop} % equals only itself
+\def\pgfkeys@novalue{} % equals only itself
+\def\pgfkeysnovalue{\pgfkeys@novalue} % equals only itself
+\def\pgfkeysnovalue@text{\pgfkeysnovalue}
+\def\pgfkeysvaluerequired{\pgfkeysvaluerequired} % equals only itself
+
+\long\def\pgfkeys@unpack#1=#2=#3\pgfkeys@stop{%
+ \pgfkeys@spdef\pgfkeyscurrentkey{#1}%
+ \edef\pgfkeyscurrentkey{\pgfkeyscurrentkey}%
+ \ifx\pgfkeyscurrentkey\pgfkeys@empty%
+ % Skip
+ \else%
+ \pgfkeys@add@path@as@needed%
+ \pgfkeys@spdef\pgfkeyscurrentvalue{#2}%
+ \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text% Hmm... no value
+ \pgfkeysifdefined{\pgfkeyscurrentkey/.@def}%
+ {\pgfkeysgetvalue{\pgfkeyscurrentkey/.@def}{\pgfkeyscurrentvalue}}
+ {}% no default, so leave it
+ \fi%
+ \ifx\pgfkeyscurrentvalue\pgfkeysvaluerequired%
+ \pgfkeysvalueof{/errors/value required/.@cmd}\pgfkeyscurrentkey\pgfkeyscurrentvalue\pgfeov%
+ \else%
+ \pgfkeys@case@one%
+ \fi%
+ \fi}
+
+\def\pgfkeys@case@one{%
+ \pgfkeysifdefined{\pgfkeyscurrentkey/.@cmd}%
+ {\pgfkeysgetvalue{\pgfkeyscurrentkey/.@cmd}{\pgfkeys@code}%
+ \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov}
+ {\pgfkeys@case@two}%
+}
+
+\def\pgfkeys@case@two{%
+ \pgfkeysifdefined{\pgfkeyscurrentkey}%
+ {\pgfkeys@case@two@extern}%
+ {\pgfkeys@case@three}%
+}
+
+\def\pgfkeys@case@two@extern{%
+ \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text%
+ \pgfkeysvalueof{\pgfkeyscurrentkey}%
+ \else%
+ \pgfkeyslet{\pgfkeyscurrentkey}\pgfkeyscurrentvalue%
+ \fi%
+}
+
+
+% either handled key or unknown.
+%
+% This macro will be replaced by the /handler config/handle only existing
+% configuration, see below.
+\def\pgfkeys@case@three{%
+ \pgfkeys@split@path%
+ \pgfkeysifdefined{/handlers/\pgfkeyscurrentname/.@cmd}%
+ {\pgfkeysgetvalue{/handlers/\pgfkeyscurrentname/.@cmd}{\pgfkeys@code}%
+ \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov}
+ {\pgfkeys@unknown}%
+}
+\let\pgfkeys@case@three@handleall=\pgfkeys@case@three
+\def\pgfkeys@case@three@handle@restricted{%
+ \pgfkeys@split@path%
+ \pgfkeysifdefined{/handlers/\pgfkeyscurrentname/.@cmd}{%
+ \pgfkeys@ifexecutehandler{%
+ \pgfkeysgetvalue{/handlers/\pgfkeyscurrentname/.@cmd}{\pgfkeys@code}%
+ \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov
+ }{%
+ % this here is necessary: /my search path/key/.code
+ % won't be called, so \pgfkeyscurrentpath == '/my search path/key'
+ % -> it should be one directory higher! We want to invoke the
+ % .unknown handler in
+ % '/my search path'
+ %
+ % Idea:
+ % set
+ % - path := '/my search path'
+ % - name := 'key/.code'
+ % - key = '/my search path/key/.code'
+ \let\pgfkeys@temp=\pgfkeyscurrentkey
+ \let\pgfkeys@tempb=\pgfkeyscurrentname
+ \edef\pgfkeyscurrentkey{\pgfkeyscurrentpath}%
+ \pgfkeys@split@path%
+ \let\pgfkeyscurrentkey=\pgfkeys@temp
+ \edef\pgfkeyscurrentname{\pgfkeyscurrentname/\pgfkeys@tempb}%
+ \pgfkeys@unknown
+ }%
+ }{%
+ \pgfkeys@unknown
+ }%
+}
+
+% this macro is to implement the |handly only existing| key in key filtering:
+% #1: the code to invoke IF the key handler shall be executed
+% #2: the code to invoke if it shall not run.
+\def\pgfkeys@ifexecutehandler#1#2{#1}%
+\let\pgfkeys@ifexecutehandler@handleall=\pgfkeys@ifexecutehandler
+\def\pgfkeys@ifexecutehandler@handleonlyexisting#1#2{%
+ \pgfkeys@ifcsname pgfk@excpt@\pgfkeyscurrentname\endcsname%
+ #1% ok, this particular key handler is known and should be processed in any case (for example .try)
+ \else
+ % implement the 'only existing' feature here:
+ \pgfkeysifdefined{\pgfkeyscurrentpath}{#1}{%
+ \pgfkeysifdefined{\pgfkeyscurrentpath/.@cmd}{#1}{#2}%
+ }{}%
+ \fi%
+}%
+\def\pgfkeys@ifexecutehandler@handlefullorexisting#1#2{%
+ \ifpgfkeysaddeddefaultpath
+ \pgfkeys@ifcsname pgfk@excpt@\pgfkeyscurrentname\endcsname%
+%\message{ifexecutehandler(\pgfkeyscurrentkeyRAW, path \pgfkeysdefaultpath): '\pgfkeyscurrentname' is an exception; processing it (on \pgfkeyscurrentpath).}%
+ #1% ok, this particular key handler is known and be processed in any case (for example .try)
+ \else
+ % implement the 'only existing' feature here:
+ \pgfkeysifdefined{\pgfkeyscurrentpath}{%
+%\message{ifexecutehandler(\pgfkeyscurrentkeyRAW, path \pgfkeysdefaultpath): '\pgfkeyscurrentpath' does exist. Executing '\pgfkeyscurrentname'.}%
+ #1%
+ }{%
+ \pgfkeysifdefined{\pgfkeyscurrentpath/.@cmd}{%
+%\message{ifexecutehandler(\pgfkeyscurrentkeyRAW, path \pgfkeysdefaultpath): '\pgfkeyscurrentpath/.@cmd' does exist. Executing '\pgfkeyscurrentname'.}%
+ #1%
+ }{%
+%\message{ifexecutehandler(\pgfkeyscurrentkeyRAW, path \pgfkeysdefaultpath): '\pgfkeyscurrentpath' does NOT exist. Skipping '\pgfkeyscurrentname'.}%
+ #2%
+ }%
+ }%
+ \fi%
+ \else
+%\message{ifexecutehandler(\pgfkeyscurrentkeyRAW, path \pgfkeysdefaultpath): Fully qualified key provided. Executing '\pgfkeyscurrentname'.}%
+ #1% ok, always true if the USER explicitly provided the full key path.
+ \fi
+}%
+\def\pgfkeysaddhandlyonlyexistingexception#1{\expandafter\def\csname pgfk@excpt@#1\endcsname{1}}%
+
+
+\def\pgfkeys@unknown{%
+ \pgfkeysifdefined{\pgfkeyscurrentpath/.unknown/.@cmd}%
+ {%
+ \pgfkeysgetvalue{\pgfkeyscurrentpath/.unknown/.@cmd}{\pgfkeys@code}%
+ \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov}
+ {%
+ \pgfkeysgetvalue{/handlers/.unknown/.@cmd}{\pgfkeys@code}%
+ \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov%
+ }%
+}
+
+
+\long\def\pgfkey@argumentisspace#1{%
+ \long\def\pgfkeys@spdef##1##2{%
+ \futurelet\pgfkeys@possiblespace\pgfkeys@sp@a##2\pgfkeys@stop\pgfkeys@stop#1\pgfkeys@stop\relax##1}%
+ \def\pgfkeys@sp@a{%
+ \ifx\pgfkeys@possiblespace\pgfkeys@sptoken%
+ \expandafter\pgfkeys@sp@b%
+ \else%
+ \expandafter\pgfkeys@sp@b\expandafter#1%
+ \fi}%
+ \long\def\pgfkeys@sp@b#1##1 \pgfkeys@stop{\pgfkeys@sp@c##1}%
+}
+\pgfkey@argumentisspace{ }
+\long\def\pgfkeys@sp@c#1\pgfkeys@stop#2\relax#3{\pgfkeys@temptoks{#1}\edef#3{\the\pgfkeys@temptoks}}
+{\def\:{\global\let\pgfkeys@sptoken= } \: }
+
+
+
+\def\pgfkeys@add@path@as@needed{% Should add the path if the
+ % \pgfkeyscurrentkey does not start with /
+ \expandafter\futurelet\expandafter\pgfkeys@possibleslash\expandafter\pgfkeys@check@slash\pgfkeyscurrentkey\relax%
+}
+\newif\ifpgfkeysaddeddefaultpath
+\def\pgfkeys@check@slash{%
+ \ifx\pgfkeys@possibleslash/%
+ \expandafter\pgfkeys@nevermind%
+ \else%
+ \expandafter\pgfkeys@addpath%
+ \fi%
+}
+
+\def\pgfkeys@nevermind#1\relax{%
+ \pgfkeysaddeddefaultpathfalse
+ \let\pgfkeyscurrentkeyRAW\pgfkeyscurrentkey
+}
+\def\pgfkeys@addpath#1\relax{%
+ \pgfkeysaddeddefaultpathtrue
+ \def\pgfkeyscurrentkeyRAW{#1}%
+ \edef\pgfkeyscurrentkey{\pgfkeysdefaultpath#1}%
+}
+
+
+\def\pgfkeys@split@path{% Should assign the two codes
+ % \pgfkeyscurrentname and \pgfcurrentlkeypath
+ \pgfkeys@pathtoks{}%
+ \expandafter\pgfkeys@splitter\pgfkeyscurrentkey//%
+}
+\def\pgfkeys@splitter#1/#2/{%
+ \def\pgfkeys@temp{#2}%
+ \ifx\pgfkeys@temp\pgfkeys@empty%
+ % Ah. done
+ \def\pgfkeyscurrentname{#1}%
+ \expandafter\pgfkeys@gobbletoslash%
+ \else%
+ \expandafter\pgfkeys@pathtoks\expandafter{\the\pgfkeys@pathtoks#1/}%
+ \fi%
+ \pgfkeys@splitter#2/%
+}
+\def\pgfkeys@gobbletoslash\pgfkeys@splitter/{\expandafter\pgfkeys@remove@slash\the\pgfkeys@pathtoks\relax}%
+\def\pgfkeys@remove@slash#1/\relax{\pgfkeys@pathtoks{#1}}
+
+
+
+% Quickly set keys
+%
+% #1 = default path
+% #2 = key-value pairs
+%
+% Desscription:
+%
+% This command starts the execution with the default path set to
+% #1. This command should only be used when speed is important (like
+% in a heavily used macro like \tikzset). Normally, keys should be
+% used to set the path. Note that if #1 equals /, then \pgfkeys will
+% actually be quicker!
+%
+% Example:
+%
+% \pgfqkeys{/tikz}{myother length/.code=\def\myotherlength{#1}\pgfkeysalso{length=#1}}
+
+\def\pgfqkeys{\expandafter\pgfkeys@@qset\expandafter{\pgfkeysdefaultpath}}%
+\long\def\pgfkeys@@qset#1#2#3{\def\pgfkeysdefaultpath{#2/}\pgfkeys@parse#3,\pgfkeys@mainstop\def\pgfkeysdefaultpath{#1}}
+
+
+% Sets keys while setting keys
+%
+% #1 = key-value pairs
+%
+% Desscription:
+%
+% This code may only be called inside the code that is executed for a
+% key. The #1 should be a list of settings pairs. They will be executed
+% as if they had been given as the argument to the \pgfkeys command.
+%
+% Example:
+%
+% \pgfkeys{tikz,myother length/.code=\def\myotherlength{#1}\pgfkeysalso{length=#1}}
+
+\long\def\pgfkeysalso#1{\pgfkeys@parse#1,\pgfkeys@mainstop}
+
+
+
+% Quickly sets keys while setting keys
+%
+% #1 = default path
+% #2 = key-value pairs
+%
+% Desscription:
+%
+% This command executes #2 with the default path set to #1. This
+% command will cause chaos if used incorrectly. The only safe
+% place to use it instead of \pgfkeys is at the beginning of a TeX group.
+%
+% Example:
+%
+% \begingroup
+% \pgfqkeysalso{/tikz}{myother length/.code=\def\myotherlength{#1}\pgfkeysalso{length=#1}}
+
+\long\def\pgfqkeysalso#1#2{\def\pgfkeysdefaultpath{#1/}\pgfkeys@parse#2,\pgfkeys@mainstop}
+
+
+
+
+% Now setup the default handelers and keys:
+
+% Define a key macro with one argument (\def or \edef)
+%
+% #1 = key
+% #2 = code
+%
+% Description:
+%
+% This command will setup things so the key/.@cmd contains a macro
+% that takes one parameter and has #2 as its code.
+%
+% Example:
+%
+% \pgfkeysdef{/my key}{\show#1}
+
+\long\def\pgfkeysdef#1#2{%
+ \long\def\pgfkeys@temp##1\pgfeov{#2}%
+ \pgfkeyslet{#1/.@cmd}{\pgfkeys@temp}%
+}
+\long\def\pgfkeysedef#1#2{%
+ \long\edef\pgfkeys@temp##1\pgfeov{#2}%
+ \pgfkeyslet{#1/.@cmd}{\pgfkeys@temp}%
+}
+
+
+% Define a key macro with mutliple arguments (\def or \edef)
+%
+% #1 = key
+% #2 = argument pattern
+% #2 = code
+%
+% Description:
+%
+% This command will setup things so the key/.@cmd contains a macro
+% that takes #2 as its parameter pattern and has #3 as its code.
+%
+% Example:
+%
+% \pgfkeysdefargs{/swap}{#1#2}{#2#1}
+
+\long\def\pgfkeysdefargs#1#2#3{%
+ \def\pgfkeys@temp#2\pgfeov{#3}%
+ \pgfkeyslet{#1/.@cmd}{\pgfkeys@temp}%
+ \pgfkeyssetvalue{#1/.@args}{#2\pgfeov}%
+ \pgfkeyssetvalue{#1/.@body}{#3}%
+}
+\long\def\pgfkeysedefargs#1#2#3{%
+ \edef\pgfkeys@temp#2\pgfeov{#3}%
+ \pgfkeyslet{#1/.@cmd}{\pgfkeys@temp}%
+ \pgfkeyssetvalue{#1/.@args}{#2\pgfeov}%
+ \pgfkeyssetvalue{#1/.@body}{#3}%
+}
+
+
+
+% Defining a key command
+
+\pgfkeysdef{/handlers/.code}{\pgfkeysdef{\pgfkeyscurrentpath}{#1}}
+\pgfkeysdef{/handlers/.code 2 args}{\pgfkeysdefargs{\pgfkeyscurrentpath}{##1##2}{#1}}
+\pgfkeysdef{/handlers/.ecode}{\pgfkeysedef{\pgfkeyscurrentpath}{#1}}
+\pgfkeysdef{/handlers/.ecode 2 args}{\pgfkeysedefargs{\pgfkeyscurrentpath}{##1##2}{#1}}
+\pgfkeysdefargs{/handlers/.code args}{#1#2}{\pgfkeysdefargs{\pgfkeyscurrentpath}{#1}{#2}}
+\pgfkeysdefargs{/handlers/.ecode args}{#1#2}{\pgfkeysedefargs{\pgfkeyscurrentpath}{#1}{#2}}
+
+% Adding to a key command
+
+\pgfkeys{/handlers/.add code/.code 2 args=%
+ % Find out, whether with args or not.
+ \pgfkeysifdefined{\pgfkeyscurrentpath/.@args}%
+ {% Yes, so add to body and reuse args
+ \pgfkeysaddvalue{\pgfkeyscurrentpath/.@body}{#1}{#2}%
+ % Redefine code
+ \pgfkeysgetvalue{\pgfkeyscurrentpath/.@args}{\pgfkeys@tempargs}%
+ \pgfkeysgetvalue{\pgfkeyscurrentpath/.@body}{\pgfkeys@tempbody}%
+ \expandafter\expandafter\expandafter\def\expandafter\pgfkeys@temp\expandafter\pgfkeys@tempargs\expandafter{\pgfkeys@tempbody}%
+ \pgfkeyslet{\pgfkeyscurrentpath/.@cmd}{\pgfkeys@temp}%
+ }%
+ {%
+ % No, so single argument. Redefine accordingly.
+ {%
+ \toks0{#1}%
+ \pgfkeysifdefined{\pgfkeyscurrentpath/.@cmd}%
+ {\pgfkeys@temptoks\expandafter\expandafter\expandafter{\csname pgfk@\pgfkeyscurrentpath/.@cmd\endcsname##1\pgfeov}}%
+ {\pgfkeys@temptoks{}}%
+ \toks1{#2}%
+ \xdef\pgfkeys@global@temp{\the\toks0 \the\pgfkeys@temptoks \the\toks1 }%
+ }%
+ \expandafter\def\expandafter\pgfkeys@temp\expandafter##\expandafter1\expandafter\pgfeov\expandafter{\pgfkeys@global@temp}%
+ \pgfkeyslet{\pgfkeyscurrentpath/.@cmd}\pgfkeys@temp%
+ }%
+}
+\pgfkeys{/handlers/.prefix code/.code=\pgfkeys{\pgfkeyscurrentpath/.add code={#1}{}}}%
+\pgfkeys{/handlers/.append code/.code=\pgfkeys{\pgfkeyscurrentpath/.add code={}{#1}}}%
+
+
+% Defining a style
+
+\pgfkeys{/handlers/.style/.code=\pgfkeys{\pgfkeyscurrentpath/.code=\pgfkeysalso{#1}}}
+\pgfkeys{/handlers/.estyle/.code=\pgfkeys{\pgfkeyscurrentpath/.ecode=\noexpand\pgfkeysalso{#1}}}
+\pgfkeys{/handlers/.style args/.code 2 args=\pgfkeys{\pgfkeyscurrentpath/.code args={#1}{\pgfkeysalso{#2}}}}
+\pgfkeys{/handlers/.estyle args/.code 2 args=\pgfkeys{\pgfkeyscurrentpath/.ecode args={#1}{\noexpand\pgfkeysalso{#2}}}}
+\pgfkeys{/handlers/.style 2 args/.code=\pgfkeys{\pgfkeyscurrentpath/.code 2 args=\pgfkeysalso{#1}}}
+
+% Adding to a style
+
+\pgfkeys{/handlers/.add style/.code 2 args=\pgfkeys{\pgfkeyscurrentpath/.add code={\pgfkeysalso{#1}}{\pgfkeysalso{#2}}}}%
+\pgfkeys{/handlers/.prefix style/.code=\pgfkeys{\pgfkeyscurrentpath/.add code={\pgfkeysalso{#1}}{}}}%
+\pgfkeys{/handlers/.append style/.code=\pgfkeys{\pgfkeyscurrentpath/.add code={}{\pgfkeysalso{#1}}}}%
+
+
+% Defining a value
+
+\pgfkeys{/handlers/.initial/.code=\pgfkeyssetvalue{\pgfkeyscurrentpath}{#1}}
+\pgfkeys{/handlers/.add/.code 2 args=\pgfkeysaddvalue{\pgfkeyscurrentpath}{#1}{#2}}
+\pgfkeys{/handlers/.prefix/.code=\pgfkeysaddvalue{\pgfkeyscurrentpath}{#1}{}}
+\pgfkeys{/handlers/.append/.code=\pgfkeysaddvalue{\pgfkeyscurrentpath}{}{#1}}
+\pgfkeys{/handlers/.get/.code=\pgfkeysgetvalue{\pgfkeyscurrentpath}{#1}}
+\pgfkeys{/handlers/.link/.code=\pgfkeyssetvalue{\pgfkeyscurrentpath}{\pgfkeysvalueof{#1}}}
+
+
+% Defining a default
+
+\pgfkeys{/handlers/.default/.code=\pgfkeyssetvalue{\pgfkeyscurrentpath/.@def}{#1}}
+\pgfkeys{/handlers/.value required/.code=\pgfkeyssetvalue{\pgfkeyscurrentpath/.@def}{\pgfkeysvaluerequired}}
+\pgfkeys{/handlers/.value forbidden/.code=\pgfkeys{\pgfkeyscurrentpath/.add code=%
+{%
+ \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text%
+ \else%
+ \pgfkeysvalueof{/errors/value forbidden/.@cmd}\pgfkeyscurrentkey\pgfkeyscurrentvalue\pgfeov%
+ \fi%
+}{}}}
+
+
+% High-level cmds
+
+\pgfkeys{/handlers/.store in/.code=\pgfkeysalso{\pgfkeyscurrentpath/.code=\def#1{##1}}}
+\pgfkeys{/handlers/.estore in/.code=\pgfkeysalso{\pgfkeyscurrentpath/.code=\edef#1{##1}}}
+
+\pgfkeys{/handlers/.is if/.code=\pgfkeysalso{%
+ \pgfkeyscurrentpath/.code=\pgfkeys@handle@boolean{#1}{##1},
+ \pgfkeyscurrentpath/.default=true%
+ }%
+}
+\def\pgfkeys@handle@boolean#1#2{%
+ \pgfkeys@ifcsname#1#2\endcsname%
+ \csname#1#2\endcsname%
+ \else%
+ \pgfkeysvalueof{/errors/boolean expected/.@cmd}\pgfkeyscurrentkey{#2}\pgfeov%
+ \fi
+}
+
+\pgfkeys{/handlers/.is choice/.code=%
+ \pgfkeys{%
+ \pgfkeyscurrentpath/.cd,%
+ .code=\expandafter\pgfkeysalso\expandafter{\pgfkeyscurrentkey/##1},
+ .unknown/.style={/errors/unknown choice value=\pgfkeyscurrentkey\pgfkeyscurrentvalue}}}
+
+
+% Inspection handlers
+
+\pgfkeys{/handlers/.show value/.code=\pgfkeysgetvalue{\pgfkeyscurrentpath}{\pgfkeysshower}\show\pgfkeysshower} % inspect the value
+\pgfkeys{/handlers/.show code/.code=\pgfkeysgetvalue{\pgfkeyscurrentpath/.@cmd}{\pgfkeysshower}\show\pgfkeysshower} % inspect the body of the command
+
+
+% Path handling
+
+% Prepares the .unknown handler used by '.search also'.
+% It will be stored into \pgfkeys@global@temp.
+\def\pgfkeys@searchalso@prepare@unknown@handler#1{%
+ \global\def\pgfkeys@global@temp##1\pgfeov{}%
+ \pgfkeys@searchalso@parse#1,\pgfkeys@mainstop
+ {%
+ \toks0=\expandafter{\pgfkeys@global@temp##1\pgfeov}%
+ \toks1={\def\pgfutilnext{\pgfkeysvalueof{/handlers/.unknown/.@cmd}##1\pgfeov}\pgfutilnext}%
+ \xdef\pgfkeys@global@temp{%
+ \noexpand\ifpgfkeysaddeddefaultpath
+ \noexpand\pgfkeyssuccessfalse
+ \noexpand\let\noexpand\pgfkeys@searchalso@name=\noexpand\pgfkeyscurrentkeyRAW
+ \the\toks0 % one or more /.try things; one for each path. The last element won't have a /.try
+ %\noexpand\ifpgfkeyssuccess
+ %\noexpand\else
+ % \the\toks1 % invoke /handlers/.unknown handler
+ %\noexpand\fi
+ \noexpand\else
+ \the\toks1 % invoke /handlers/.unknown handler
+ \noexpand\fi
+ }%
+ \expandafter\gdef\expandafter\pgfkeys@global@temp\expandafter##\expandafter1\expandafter\pgfeov\expandafter{\pgfkeys@global@temp}%
+ }%
+}%
+
+\def\pgfkeys@searchalso@parse{\futurelet\pgfkeys@possiblerelax\pgfkeys@searchalso@parse@main}
+\def\pgfkeys@searchalso@parse@main{%
+ \ifx\pgfkeys@possiblerelax\pgfkeys@mainstop%
+ \expandafter\pgfkeys@cleanup%
+ \else%
+ \expandafter\pgfkeys@searchalso@appendentry%
+ \fi%
+}
+\def\pgfkeys@searchalso@appendentry#1,#2{%
+ \def\pgfkeys@searchalso@nexttok{#2}%
+ \pgfkeys@spdef\pgfkeys@temp{#1}%
+ {%
+ \toks0=\expandafter{\pgfkeys@global@temp##1\pgfeov}%
+ \toks1=\expandafter{\pgfkeys@temp}%
+ \toks2={##1}%
+ \xdef\pgfkeys@global@temp{%
+ \the\toks0 % the space is important!
+ \noexpand\ifpgfkeyssuccess\noexpand\else
+ \noexpand\pgfqkeys{\the\toks1 }{\noexpand\pgfkeys@searchalso@name
+ \ifx\pgfkeys@searchalso@nexttok\pgfkeys@mainstop\else/.try\fi={\the\toks2 }}%
+ \noexpand\fi}%
+ \expandafter\gdef\expandafter\pgfkeys@global@temp\expandafter##\expandafter1\expandafter\pgfeov\expandafter{\pgfkeys@global@temp}%
+ }%
+ \pgfkeys@searchalso@parse#2%
+}
+\pgfkeys{%
+ /handlers/.is family/.code=\pgfkeys{\pgfkeyscurrentpath/.ecode=\edef\noexpand\pgfkeysdefaultpath{\pgfkeyscurrentpath/}},%
+ /handlers/.cd/.code=\edef\pgfkeysdefaultpath{\pgfkeyscurrentpath/},%
+ /handlers/.search also/.code={%
+ \pgfkeys@searchalso@prepare@unknown@handler{#1}%
+%\message{I prepared the '\pgfkeyscurrentpath/.unknown' handler \meaning\pgfkeys@global@temp\space for '#1'.}%
+ \pgfkeyslet{\pgfkeyscurrentpath/.unknown/.@cmd}{\pgfkeys@global@temp}%
+ }
+}%
+
+
+% Value expansion
+
+\pgfkeys{/handlers/.expand once/.code=\expandafter\pgfkeys@exp@call\expandafter{#1}}
+\pgfkeys{/handlers/.expand twice/.code=\expandafter\expandafter\expandafter\pgfkeys@exp@call\expandafter\expandafter\expandafter{#1}}
+\pgfkeys{/handlers/.expanded/.code=\edef\pgfkeys@temp{#1}\expandafter\pgfkeys@exp@call\expandafter{\pgfkeys@temp}}
+
+\def\pgfkeys@exp@call#1{\pgfkeysalso{\pgfkeyscurrentpath={#1}}}
+
+% Try to set a key and do nothing if not define
+
+\newif\ifpgfkeyssuccess
+\pgfkeys{/handlers/.try/.code=\pgfkeys@try}
+\pgfkeys{/handlers/.retry/.code=\ifpgfkeyssuccess\else\pgfkeys@try\fi}
+\def\pgfkeys@try{%
+ \edef\pgfkeyscurrentkey{\pgfkeyscurrentpath}% make sure that \pgfkeys@code doesn't know about 'try'. Important for .is choice
+ \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text% Hmm... no value
+ \pgfkeysifdefined{\pgfkeyscurrentpath/.@def}%
+ {\pgfkeysgetvalue{\pgfkeyscurrentpath/.@def}{\pgfkeyscurrentvalue}}
+ {}% no default, so leave it
+ \fi%
+ \pgfkeysifdefined{\pgfkeyscurrentpath/.@cmd}%
+ {%
+ \pgfkeysgetvalue{\pgfkeyscurrentpath/.@cmd}{\pgfkeys@code}%
+ \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov%
+ \pgfkeyssuccesstrue%
+ }%
+ {%
+ \pgfkeysifdefined{\pgfkeyscurrentpath}%
+ {%
+ \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text%
+ \pgfkeysvalueof{\pgfkeyscurrentpath}%
+ \else%
+ \pgfkeyslet{\pgfkeyscurrentpath}\pgfkeyscurrentvalue%
+ \fi%
+ \pgfkeyssuccesstrue%
+ }%
+ {%
+ \pgfkeys@split@path%
+ \pgfkeysifdefined{/handlers/\pgfkeyscurrentname/.@cmd}{%
+ % in the standard configuration, this check here is redundand
+ % because pgfkeys@ifexecutehandler === true.
+ % It is only interesting for 'handle only existing'.
+ \pgfkeys@ifexecutehandler{%
+ \pgfkeysgetvalue{/handlers/\pgfkeyscurrentname/.@cmd}{\pgfkeys@code}%
+ \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov
+ \pgfkeyssuccesstrue%
+ }{%
+ \pgfkeyssuccessfalse
+ }%
+ }{%
+ \pgfkeyssuccessfalse
+ }%
+ }%
+ }%
+}
+
+% Utilities
+
+\pgfkeys{/utils/exec/.code=#1} % simply execute the given code directly.
+
+
+% Errors
+
+\pgfkeys{/errors/boolean expected/.code 2 args=\pgfkeys@error{%
+ Boolean parameter of key '#1' must be 'true' or 'false', not
+ '#2'. I am going to ignore it}}
+\pgfkeys{/errors/value required/.code 2 args=\pgfkeys@error{%
+ The key '#1' requires a value. I am going to ignore this key}{}}
+\pgfkeys{/errors/value forbidden/.code 2 args=\pgfkeys@error{%
+ You may not specify a value for the key '#1'. I am going to ignore
+ the value '#2' that you provided}}
+\pgfkeys{/errors/unknown choice value/.code 2 args=\pgfkeys@error{%
+ Choice '\pgfkeyscurrentname' unknown in key
+ '\pgfkeyscurrentpath'. I am going to ignore this key}}
+\pgfkeys{/errors/unknown key/.code 2 args=\pgfkeys@error{%
+ I do not know the key '#1' and I am going to ignore it. Perhaps
+ you misspelled it}}
+
+\pgfkeys{/handlers/.unknown/.code=%
+ {%
+ \let\pgfkeys@orig@key=\pgfkeyscurrentkey%
+ \pgfkeysalso{/errors/unknown key=\pgfkeys@orig@key{}}%
+ }
+}
+
+\pgfkeys{
+ /handler config/.is choice,
+ /handler config/all/.code={%
+ \let\pgfkeys@case@three=\pgfkeys@case@three@handleall
+ \let\pgfkeys@ifexecutehandler=\pgfkeys@ifexecutehandler@handleall
+ },
+ /handler config/only existing/.code={%
+ \let\pgfkeys@case@three=\pgfkeys@case@three@handle@restricted
+ \let\pgfkeys@ifexecutehandler=\pgfkeys@ifexecutehandler@handleonlyexisting
+ },
+ /handler config/full or existing/.code={%
+ \let\pgfkeys@case@three=\pgfkeys@case@three@handle@restricted
+ \let\pgfkeys@ifexecutehandler=\pgfkeys@ifexecutehandler@handlefullorexisting
+ },
+ /handler config/only existing/add exception/.code={\pgfkeysaddhandlyonlyexistingexception{#1}},
+}%
+\pgfkeysaddhandlyonlyexistingexception{.cd}%
+\pgfkeysaddhandlyonlyexistingexception{.try}%
+\pgfkeysaddhandlyonlyexistingexception{.retry}%
+\pgfkeysaddhandlyonlyexistingexception{.lastretry}%
+\pgfkeysaddhandlyonlyexistingexception{.unknown}%
+
+
+\input pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex
+
+\endinput
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 ed490784564..5d7a731334d 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
@@ -1,3 +1,23 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% 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: Di 29. Dez 22:11:16 CET 2009 %%%
+
+
+
% Copyright 2008 by Christian Feuersaenger
%
% This file may be distributed and/or modified
@@ -76,6 +96,8 @@
% The actual case number (0-3) will be provided as contents
% of the macro
% \pgfkeyscasenumber.
+% It is always a one-character token, so it may be compared
+% with both, \ifnum or \if.
% Please note that unknown options will be processed with
% the usual '.unknown' handlers unless the key filter takes
% control over unknown options as well.
@@ -150,17 +172,17 @@
%
% Example:
% \pgfkeys{/my group/.cd,/utils/exec=\pgfkeysalsofrom\filtered}
-\def\pgfkeysalsofrom#1{%
+\long\def\pgfkeysalsofrom#1{%
\expandafter\pgfkeysalso\expandafter{#1}%
}
% The same as \pgfkeysalsofrom, but it invokes \pgfkeysalsofiltered.
-\def\pgfkeysalsofilteredfrom#1{%
+\long\def\pgfkeysalsofilteredfrom#1{%
\expandafter\pgfkeysalsofiltered\expandafter{#1}%
}
% #1 = options
-\long\def\pgfkeysalsofiltered#1{%
+\long\long\def\pgfkeysalsofiltered#1{%
\pgfkeys@install@filter@and@invoke{\pgfkeysalso{#1}}%
}%
@@ -168,14 +190,14 @@
%
% #1: default path
% #2: key-value-pairs
-\def\pgfqkeysfiltered#1{%
+\long\def\pgfqkeysfiltered#1{%
\expandafter\pgfqkeysfiltered@@install\expandafter{\pgfkeysdefaultpath}{#1}%
}
% #1: old value of default path.
% #2: default path
% #3: key-value-list.
-\def\pgfqkeysfiltered@@install#1#2#3{%
+\long\def\pgfqkeysfiltered@@install#1#2#3{%
\pgfkeys@install@filter@and@invoke{%
\def\pgfkeysdefaultpath{#2/}\pgfkeys@parse#3,\pgfkeys@mainstop\def\pgfkeysdefaultpath{#1}%
}%
@@ -214,7 +236,7 @@
% Deactivates family #1.
%
% #1 maybe a macro.
-\def\pgfkeysdeactivatefamily#1{
+\def\pgfkeysdeactivatefamily#1{%
\pgfkeysiffamilydefined
{#1}%
{\csname pgfk@#1/familyactivefalse\endcsname}%
@@ -292,7 +314,15 @@
\def\pgfkeysgetfamily#1#2{%
\pgfkeysifdefined{#1/family}{\pgfkeysgetvalue{#1/family}{#2}\pgfkeyssuccesstrue}{\pgfkeyssuccessfalse}%
}
-
+
+% Equivalent to \pgfkeys{#1/.belongs to family=#2}
+\def\pgfkeyssetfamily#1#2{%
+ \pgfkeysiffamilydefined{#2}{%
+ \pgfkeyssetvalue{#1/family}{#2}%
+ }{%
+ \pgfkeysalso{/errors/family unknown=#2}%
+ }%
+}%
% Sets \ifpgfkeysfiltercontinue to true iff the current key belongs to
@@ -483,13 +513,7 @@
},%
/handlers/.activate family/.code=\pgfkeysactivatefamily{\pgfkeyscurrentpath},
/handlers/.deactivate family/.code=\pgfkeysdeactivatefamily{\pgfkeyscurrentpath},
- /handlers/.belongs to family/.code={%
- \pgfkeysiffamilydefined{#1}{%
- \pgfkeyssetvalue{\pgfkeyscurrentpath/family}{#1}%
- }{%
- \pgfkeysalso{/errors/family unknown=#1}%
- }%
- },%
+ /handlers/.belongs to family/.code={\pgfkeyssetfamily{\pgfkeyscurrentpath}{#1}},%
%
%
% An addition to the '.try' and '.retry' handlers:
@@ -543,12 +567,12 @@
% Returns true iff the currently processed key belongs to an active family.
% A family is active if it has been activated before.
/pgf/key filters/active families/.code={%
- \ifnum\pgfkeyscasenumber=0
+ \if\pgfkeyscasenumber0%
% unknown options shall be processed with the
% unknown-handlers.
\pgfkeysfiltercontinuetrue
\else
- \ifnum\pgfkeyscasenumber=3
+ \if\pgfkeyscasenumber3%
\pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP
\else
\pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP
@@ -577,10 +601,10 @@
% #2: the predicate which will be invoked in case 3 with
% the current case number as argument.
/pgf/key filters/active families or no family/.code 2 args={%
- \ifnum\pgfkeyscasenumber=0
+ \if\pgfkeyscasenumber0%
\pgfkeysevalkeyfilterwith{#2}%
\else
- \ifnum\pgfkeyscasenumber=3
+ \if\pgfkeyscasenumber3%
\pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP
\else
\pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP
@@ -593,11 +617,11 @@
\fi
},
/pgf/key filters/active families or no family DEBUG/.code 2 args={%
- \ifnum\pgfkeyscasenumber=0
+ \if\pgfkeyscasenumber0%
\immediate\write16{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) invoking unknown handler '#2']}%
\pgfkeysevalkeyfilterwith{#2}%
\else
- \ifnum\pgfkeyscasenumber=3
+ \if\pgfkeyscasenumber3%
\pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP
\else
\pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP
@@ -616,6 +640,59 @@
\fi
},
%
+ % A (faster) shortcut for
+ % /pgf/key filters/active families or no family=
+ % {/pgf/keys filters/false}
+ % {/pgf/keys filters/false}
+ /pgf/key filters/active families and known/.code={%
+ \if\pgfkeyscasenumber0%
+ \pgfkeysfiltercontinuefalse
+ \else
+ \if\pgfkeyscasenumber3%
+ \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP
+ \else
+ \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP
+ \fi
+ \ifpgfkeyssuccess
+ \pgfkeysisfamilyactive{\pgfkeyspred@TMP}%
+ \else% Ok, it does not belong to any family.
+ \pgfkeysfiltercontinuefalse
+ \fi
+ \fi
+ },
+ % A (faster) shortcut for
+ % /pgf/key filters/active families or no family=
+ % {/pgf/key filters/is descendant of=#1}% for keys without family
+ % {/pgf/keys filters/false}
+ /pgf/key filters/active families or descendants of/.code={%
+ \if\pgfkeyscasenumber0%
+ \pgfkeysfiltercontinuefalse
+ \else
+ \if\pgfkeyscasenumber3%
+ \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP
+ \else
+ \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP
+ \fi
+ \ifpgfkeyssuccess
+ \pgfkeysisfamilyactive{\pgfkeyspred@TMP}%
+ \else% Ok, it does not belong to any family.
+ % the 'is descendendant of' implementation has been
+ % COPY PASTED here:
+ %
+ % string prefix comparison:
+ \def\pgfkeysisdescendantof@impl##1#1##2\pgf@@eov{%
+ \def\pgfkeyspred@TMP{##1}%
+ \ifx\pgfkeyspred@TMP\pgfkeys@empty
+ \pgfkeysfiltercontinuetrue
+ \else
+ \pgfkeysfiltercontinuefalse
+ \fi
+ }%
+ \expandafter\pgfkeysisdescendantof@impl\pgfkeyscurrentkey#1\pgf@@eov
+ \fi
+ \fi
+ },
+ %
% Processes only options which are childs of #1.
% Example:
% is descendant of/.install key filter=/foo
@@ -626,14 +703,16 @@
% but not for
% /bar/foo/...
/pgf/key filters/is descendant of/.code={%
- \ifnum\pgfkeyscasenumber=0
+ \if\pgfkeyscasenumber0%
%\message{'\pgfkeyscurrentkey' (case \pgfkeyscasenumber) is UNKNOWN. Calling unknown handler.}%
% unknown options shall be processed with the
% unknown-handlers.
\pgfkeysfiltercontinuetrue
\else
% string prefix comparison:
- \long\def\pgfkeysisdescendantof@impl##1#1##2\pgf@@eov{%
+ % [ note : this has been COPY-PASTED to
+ % |active families or descendants of| ]
+ \def\pgfkeysisdescendantof@impl##1#1##2\pgf@@eov{%
\def\pgfkeyspred@TMP{##1}%
\ifx\pgfkeyspred@TMP\pgfkeys@empty
%\message{'\pgfkeyscurrentkey' (case \pgfkeyscasenumber) is descendant of '#1': TRUE.}%
@@ -651,7 +730,7 @@
%
% Returns true if the currently processed full key equals #2.
/pgf/key filters/equals/.code={%
- \ifnum\pgfkeyscasenumber=0
+ \if\pgfkeyscasenumber0%
% Unknown option:
\pgfkeysfiltercontinuetrue
\else
@@ -670,6 +749,7 @@
% Example:
% not/.install key filter={is descendend of=/tikz}
% will install a key filter which evaluates 'is descendant of' with argument '/tikz' and returns the logical negation of the result.
+ %
/pgf/key filters/not/.code={%
\pgfkeysevalkeyfilterwith{#1}%
\ifpgfkeysfiltercontinue
@@ -693,12 +773,14 @@
},%
/pgf/key filters/true/.code={\pgfkeysfiltercontinuetrue},%
/pgf/key filters/true/.install key filter,
- /pgf/key filters/false/.code={\pgfkeysfiltercontinuefalse},%
+ /pgf/key filters/false/.code={%
+ \pgfkeysfiltercontinuefalse
+ },%
%
% Returns false if the current key is unknown, which avoids calling
% the unknown handlers.
/pgf/key filters/defined/.code={%
- \ifnum\pgfkeyscasenumber=0
+ \if\pgfkeyscasenumber0%
\pgfkeysfiltercontinuefalse
\else
\pgfkeysfiltercontinuetrue
@@ -731,7 +813,7 @@
\pgfkeysgetvalue{\pgfkeyscurrentkey/.@cmd}{\pgfkeys@code}%
\expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov
\else
-%\message{FILTEReD OUT KEY \pgfkeyscurrentkey!}%
+%\message{FILTERED OUT KEY \pgfkeyscurrentkey!}%
\pgfkeys@filtered@handler%
\fi
}{%
@@ -750,16 +832,20 @@
\pgfkeys@split@path
% CASE THREE: a handler
\pgfkeysifdefined{/handlers/\pgfkeyscurrentname/.@cmd}{%
- \def\pgfkeyscasenumber{3}%
- \pgfkeys@key@predicate%
- \ifpgfkeysfiltercontinue
+ \pgfkeys@ifexecutehandler{%
+ \def\pgfkeyscasenumber{3}%
+ \pgfkeys@key@predicate%
+ \ifpgfkeysfiltercontinue
%\message{PROCESSING KEY \pgfkeyscurrentkey!}%
- \pgfkeysgetvalue{/handlers/\pgfkeyscurrentname/.@cmd}{\pgfkeys@code}%
- \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov
- \else
+ \pgfkeysgetvalue{/handlers/\pgfkeyscurrentname/.@cmd}{\pgfkeys@code}%
+ \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov
+ \else
%\message{FILTERED OUT KEY \pgfkeyscurrentkey!}%
- \pgfkeys@filtered@handler%
- \fi
+ \pgfkeys@filtered@handler%
+ \fi
+ }{%
+ \pgfkeys@unknown
+ }%
}{%
\pgfkeys@unknown
}%
@@ -788,6 +874,12 @@
\pgfkeys@orig@try
\else
\pgfkeysfiltercontinuetrue
+ \edef\pgfkeyscurrentkey{\pgfkeyscurrentpath}% make sure that \pgfkeys@code doesn't know about 'try'. Important for .is choice
+ \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text% Hmm... no value
+ \pgfkeysifdefined{\pgfkeyscurrentpath/.@def}%
+ {\pgfkeysgetvalue{\pgfkeyscurrentpath/.@def}{\pgfkeyscurrentvalue}}
+ {}% no default, so leave it
+ \fi%
\pgfkeysifdefined{\pgfkeyscurrentpath/.@cmd}%
{%
% CASE ONE: a command option
@@ -795,11 +887,6 @@
\pgfkeys@key@predicate%
\ifpgfkeysfiltercontinue
\pgfkeysgetvalue{\pgfkeyscurrentkey/.@cmd}{\pgfkeys@code}%
- \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text% Hmm... no value
- \pgfkeysifdefined{\pgfkeyscurrentpath/.@def}%
- {\pgfkeysgetvalue{\pgfkeyscurrentpath/.@def}{\pgfkeyscurrentvalue}}
- {}% no default, so leave it
- \fi%
\expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov%
\else
\pgfkeys@filtered@handler%
@@ -822,7 +909,33 @@
\fi
\pgfkeyssuccesstrue%
}%
- {\pgfkeyssuccessfalse}%
+ {%
+ \pgfkeys@split@path%
+ \pgfkeysifdefined{/handlers/\pgfkeyscurrentname/.@cmd}{%
+ % CASE THREE: a handled key
+ %
+ % in the standard configuration, this check here is redundand
+ % because pgfkeys@ifexecutehandler === true.
+ % It is only interesting for 'handle only existing'.
+ \pgfkeys@ifexecutehandler{%
+ \def\pgfkeyscasenumber{3}%
+ \pgfkeys@key@predicate%
+ \ifpgfkeysfiltercontinue
+%\message{PROCESSING KEY \pgfkeyscurrentkey!}%
+ \pgfkeysgetvalue{/handlers/\pgfkeyscurrentname/.@cmd}{\pgfkeys@code}%
+ \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov
+ \else
+%\message{FILTERED OUT KEY \pgfkeyscurrentkey!}%
+ \pgfkeys@filtered@handler%
+ \fi
+ \pgfkeyssuccesstrue%
+ }{%
+ \pgfkeyssuccessfalse
+ }%
+ }{%
+ \pgfkeyssuccessfalse
+ }%
+ }%
}%
\fi
}
@@ -883,10 +996,10 @@
% The argument '#1' MUST be a FULL KEY.
%
% The implementation employs a subset of the \pgfkeysalso code.
-\def\pgfkeysevalkeyfilterwith#1{%
+\long\def\pgfkeysevalkeyfilterwith#1{%
\pgfkeys@eval@key@filter@subroutine@unpack#1=\pgfkeysnovalue=\pgfkeys@stop
}%
-\def\pgfkeys@eval@key@filter@subroutine@unpack#1=#2=#3\pgfkeys@stop{%
+\long\def\pgfkeys@eval@key@filter@subroutine@unpack#1=#2=#3\pgfkeys@stop{%
\pgfkeys@spdef\pgfkeyspred@TMP{#1}%
\edef\pgfkeyspred@TMP{\pgfkeyspred@TMP}%
\pgfkeys@spdef\pgfkeyspred@TMPB{#2}% TMPB=value
@@ -908,11 +1021,6 @@
}
-\def\pgfkeys@nevermind#1\relax{\let\pgfkeyscurrentkeyRAW=\pgfkeyscurrentkey}
-\def\pgfkeys@addpath#1\relax{\def\pgfkeyscurrentkeyRAW{#1}% old @addpath:
- \edef\pgfkeyscurrentkey{\pgfkeysdefaultpath#1}%
-}
-
\def\pgfkeys@non@outer@newif@#1#2{%
\expandafter\edef\csname #2true\endcsname{\noexpand\let\noexpand#1=\noexpand\iftrue}%
\expandafter\edef\csname #2false\endcsname{\noexpand\let\noexpand#1=\noexpand\iffalse}%
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 1c985f27d47..3bb41804bdb 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
@@ -1,3 +1,23 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% 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: Di 29. Dez 22:11:16 CET 2009 %%%
+
+
+
% Copyright 2008/2009 by Christian Feuersaenger
%
% This file may be distributed and/or modified
@@ -217,7 +237,9 @@
\pgfmathfloat@install\pgfmathe@=\pgfmathfloate@%
\pgfmathfloat@install\pgfmathe=\pgfmathfloate@%
\pgfmathfloat@install\pgfmathlessthan@=\pgfmathfloatlessthan@%
+ \pgfmathfloat@install\pgfmathless@=\pgfmathfloatlessthan@%
\pgfmathfloat@install\pgfmathgreaterthan@=\pgfmathfloatgreaterthan@%
+ \pgfmathfloat@install\pgfmathgreater@=\pgfmathfloatgreaterthan@%
\pgfmathfloat@install\pgfmathpow@=\pgfmathfloatpow@
\pgfmathfloat@install\pgfmathrand@=\pgfmathfloatrand@
\pgfmathfloat@install\pgfmathrand=\pgfmathfloatrand@
@@ -233,20 +255,20 @@
\pgfmathfloat@install\pgfmathand@=\pgfmathfloatand@
\pgfmathfloat@install\pgfmathor@=\pgfmathfloator@
\pgfmathfloat@install\pgfmathfactorial@=\pgfmathfloatfactorial@
+ \pgfmathfloat@install\pgfmathveclen@=\pgfmathfloatveclen@
+ \pgfmathfloat@install\pgfmathcosh@=\pgfmathfloatcosh@
+ \pgfmathfloat@install\pgfmathsinh@=\pgfmathfloatsinh@
+ \pgfmathfloat@install\pgfmathtanh@=\pgfmathfloattanh@
\pgfmathfloat@install@unimplemented{ceil}%
\pgfmathfloat@install@unimplemented{frac}%
\pgfmathfloat@install@unimplemented{log2}%
\pgfmathfloat@install@unimplemented{log10}%
- \pgfmathfloat@install@unimplemented{veclen}%
\pgfmathfloat@install@unimplemented{equalto}%
\pgfmathfloat@install@unimplemented{random}%
\pgfmathfloat@install@unimplemented{setseed}%
\pgfmathfloat@install@unimplemented{Mod}%
\pgfmathfloat@install@unimplemented{real}%
\pgfmathfloat@install@unimplemented{notequal}%
- \pgfmathfloat@install@unimplemented{sinh}%
- \pgfmathfloat@install@unimplemented{cosh}%
- \pgfmathfloat@install@unimplemented{tanh}%
% \pgfmathfloat@install@unimplemented{atan2}%
% \pgfmathfloat@install@unimplemented{height}%
%
@@ -306,6 +328,9 @@
\pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{hex}%
\pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{bin}%
\pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{oct}%
+ \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{tanh}%
+ \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{sinh}%
+ \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{cosh}%
%
% The following methods actually enable the parser to work with
% the internal floating point number representation.
@@ -329,6 +354,31 @@
\pgfmathfloat@install\pgfmathparse=\pgfmathfloatparse@pgf@two@null@null%
}%
+\pgfutil@ifundefined{pgfmathdeclarefunction}{%
+ % BACKWARDS COMPATIBILITY: We have PGF 2.00 :
+ \def\pgfmathdeclarepseudoconstant#1#2{%
+ \begingroup
+ \toks0=\expandafter{\csname pgfmath#1@\endcsname}%
+ \toks1={\pgfmath@postfunction}%
+ \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }%
+ \xdef\pgfmathfloat@glob@TMPb{\the\toks0 }%
+ \endgroup
+ \expandafter\let\csname pgfmath@parsefunction@#1\endcsname=\pgfmathfloat@glob@TMP
+ \expandafter\let\csname pgfmath#1\endcsname=\pgfmathfloat@glob@TMPb
+ \expandafter\def\csname pgfmath#1@\endcsname{#2}%
+ }%
+ \let\pgfmathredeclarepseudoconstant=\pgfmathdeclarepseudoconstant
+}{%
+ \pgfutil@ifundefined{pgfmathdeclarepseudoconstant}{%
+ \def\pgfmathdeclarepseudoconstant#1#2{\pgfmathdeclarefunction*{#1}{0}{#2}}
+ }{}%
+}%
+
+\pgfmathdeclarepseudoconstant{inf}{\def\pgfmathresult{inf}}
+\pgfmathdeclarepseudoconstant{infty}{\def\pgfmathresult{inf}}
+\pgfmathdeclarepseudoconstant{nan}{\def\pgfmathresult{nan}}
+\pgfmathdeclarepseudoconstant{NaN}{\def\pgfmathresult{nan}}
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Hacks to the basic level pgf math engine:
@@ -482,6 +532,7 @@
\let\pgfmath@basic@subtract@=\pgfmathsubtract@
\let\pgfmath@basic@multiply@=\pgfmathmultiply@
\let\pgfmath@basic@divide@=\pgfmathdivide@
+\let\pgfmath@basic@reciprocal@=\pgfmathreciprocal@
\let\pgfmath@basic@abs@=\pgfmathabs@
\let\pgfmath@basic@round@=\pgfmathround@
\let\pgfmath@basic@rand@=\pgfmathrand@
@@ -523,34 +574,63 @@
}
% Compares #1 with #2 and sets \pgfmathresult either to 1.0 or 0.0.
%
-% It also sets the boolean \ifpgfmathfloatcomparison (globally.
+% It also sets the boolean \ifpgfmathfloatcomparison (globally).
\def\pgfmathfloatlessthan@#1#2{%
%\def\pgfmathfloatlessthan#1#2#3\and#4#5#6{%
\global\pgfmathfloatcomparisonfalse
\begingroup
- \expandafter\pgfmathfloat@decompose#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@M\pgfmathfloat@a@E
- \expandafter\pgfmathfloat@decompose#2\relax\pgfmathfloat@b@S\pgfmathfloat@b@M\pgfmathfloat@b@E
+ \edef\pgfmathfloat@loc@TMPa{#1}%
+ \edef\pgfmathfloat@loc@TMPb{#2}%
+ \expandafter\pgfmathfloat@decompose\pgfmathfloat@loc@TMPa\relax\pgfmathfloat@a@S\pgfmathfloat@a@M\pgfmathfloat@a@E
+ \expandafter\pgfmathfloat@decompose\pgfmathfloat@loc@TMPb\relax\pgfmathfloat@b@S\pgfmathfloat@b@M\pgfmathfloat@b@E
\ifcase\pgfmathfloat@a@S
% x = 0 -> (x<y <=> y >0)
- \ifnum1=\pgfmathfloat@b@S
+ \ifcase\pgfmathfloat@b@S
+ % y = 0
+ \or% y > 0
\global\pgfmathfloatcomparisontrue
+ \or% y < 0
+ \or% y = nan
+ \or% y = + infty
+ \global\pgfmathfloatcomparisontrue
+ \or% y = -infty
\fi
\or
% x > 0 -> (x<y <=> ( y > 0 && |x| < |y|) )
- \ifnum1=\pgfmathfloat@b@S
- % y>0:
+ \ifcase\pgfmathfloat@b@S
+ % y = 0
+ \or% y>0:
\pgfmathfloatlessthan@positive
+ \or% y < 0
+ \or% y = nan
+ \or% y = + infty
+ \global\pgfmathfloatcomparisontrue
+ \or% y = -infty
\fi
\or
% x < 0 -> (x<y <=> (y >= 0 || |x| > |y|) )
- \ifnum2=\pgfmathfloat@b@S
- % 'y<0':
+ \ifcase\pgfmathfloat@b@S
+ % y = 0
+ \global\pgfmathfloatcomparisontrue
+ \or%y > 0
+ \global\pgfmathfloatcomparisontrue
+ \or% 'y<0':
\pgfmathfloatgreaterthan@positive
+ \or% y = nan
+ \or% y = + infty
+ \global\pgfmathfloatcomparisontrue
+ \or% y = -infty
+ \fi
+ \or
+ % x = nan.
+ \or
+ % x = +infty
+ \or
+ % x = -infty
+ \ifnum\pgfmathfloat@b@S=3
\else
\global\pgfmathfloatcomparisontrue
\fi
- \else
- \pgfmath@error{Sorry, 'pgfmathfloatlessthan@{#1}{#2}' not yet supported.}{}%
\fi
\endgroup
\ifpgfmathfloatcomparison
@@ -736,24 +816,22 @@
% - \pgfmathfloat@a@Mtok : undefined (its contents will be destroyed.
%
\def\pgfmathfloattoextentedprecision@a#1{%
- \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \edef\pgfmathresult{#1}%
+ \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
\ifnum\pgfmathfloat@a@S<3
\advance\pgfmathfloat@a@E by-\pgfmathfloatextprec@shift\relax% compensate for shift
\expandafter\pgfmathfloattoextentedprecision@@\the\pgfmathfloat@a@Mtok 000\pgfmathfloat@EOI
- \else
- \edef\pgfmathresult{#1}%
\fi
}%
% Similar to \pgfmathfloattoextentedprecision@a, this one here fills the '@b' registers.
\def\pgfmathfloattoextentedprecision@b#1{%
- \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E
+ \edef\pgfmathresult{#1}%
+ \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E
\ifnum\pgfmathfloat@b@S<3
\advance\pgfmathfloat@b@E by-\pgfmathfloatextprec@shift\relax
\expandafter\pgfmathfloattoextentedprecision@@\the\pgfmathfloat@a@Mtok 00\pgfmathfloat@EOI
- \else
- \edef\pgfmathresult{#1}%
\fi
}%
@@ -810,8 +888,40 @@
% #2= TeX code to execute if #1 == 0
% #3= TeX code to execute if #1 != 0
\def\pgfmathfloatifzero#1#2#3{%
- \expandafter\pgfmathfloat@decompose@F#1\relax\pgfmathfloat@a@S
- \ifnum\pgfmathfloat@a@S=0 #2\else#3\fi
+ \pgfmathfloatgetflagstomacro{#1}\pgfmathfloat@loc@TMPa
+ \if\pgfmathfloat@loc@TMPa0 #2\else#3\fi
+}%
+
+\def\pgfmathfloatiffinite#1#2#3{%
+ \pgfmathfloatgetflagstomacro{#1}\pgfmathfloatiffinite@
+ \ifnum\pgfmathfloatiffinite@>2 #3\else #2\fi
+}%
+
+% Invokes code '#3' if the flags of the floating point number '#1'
+% match the flag provided in '#2'.
+%
+% \pgfmathfloatcreate{1}{1.0}{2}
+% \pgfmathfloatifflags{\pgfmathresult}{0}{It's zero!}{It's not zero!}%
+% \pgfmathfloatifflags{\pgfmathresult}{1}{It's positive!}{It's not positive!}%
+% \pgfmathfloatifflags{\pgfmathresult}{2}{It's negative!}{It's not negative!}%
+% or, equivalently
+% \pgfmathfloatifflags{\pgfmathresult}{+}{It's positive!}{It's not positive!}%
+% \pgfmathfloatifflags{\pgfmathresult}{-}{It's negative!}{It's not negative!}%
+\def\pgfmathfloatifflags#1#2#3#4{%
+ \if#2-%
+ \pgfmathfloatifflags{#1}{2}{#3}{#4}%
+ \else
+ \if#2+%
+ \pgfmathfloatifflags{#1}{1}{#3}{#4}%
+ \else
+ \pgfmathfloatgetflagstomacro#1\pgfmathfloat@loc@TMPa
+ \if\pgfmathfloat@loc@TMPa#2
+ #3\relax
+ \else
+ #4\relax
+ \fi
+ \fi
+ \fi
}%
% #1=mantisse which needs to be shifted (with smaller exponent)
@@ -857,7 +967,8 @@
% Subtracts two floating point numbers.
\def\pgfmathfloatsubtract@#1#2{%
\begingroup
- \expandafter\pgfmathfloat@decompose@tok#2\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E
+ \edef\pgfmathresult{#2}%
+ \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E
\ifcase\pgfmathfloat@b@S
\edef\pgfmathresult{#1}%
\or
@@ -914,12 +1025,10 @@
\def\pgfmathfloatmultiply@#1#2{%
\begingroup
\pgfmathfloatsetextprecision{1}%
- \edef\pgfmathfloat@arga{#1}%
- \pgfmathfloattoextentedprecision@a{\pgfmathfloat@arga}%
+ \pgfmathfloattoextentedprecision@a{#1}%
\let\pgfmathfloat@arga=\pgfmathresult
%
- \edef\pgfmathfloat@argb{#2}%
- \pgfmathfloattoextentedprecision@b{\pgfmathfloat@argb}%
+ \pgfmathfloattoextentedprecision@b{#2}%
\let\pgfmathfloat@argb=\pgfmathresult
%
\pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases.
@@ -1764,4 +1873,66 @@
\pgfmath@smuggleone\pgfmathresult
\endgroup
}%
+
+% Implements the vector length of a 2D vector.
+%
+% ATTENTION: this does NOT use the improved code of the basic layer!
+% It simply computed sqrt( #1^2 + #2^2 )!
+\def\pgfmathfloatveclen@#1#2{%
+ \begingroup
+ \edef\pgfmathfloat@@a{#1}%
+ \pgfmathfloatmultiply@{\pgfmathfloat@@a}{\pgfmathfloat@@a}%
+ \let\pgfmathfloat@@a=\pgfmathresult
+ %
+ \edef\pgfmathfloat@@b{#2}%
+ \pgfmathfloatmultiply@{\pgfmathfloat@@b}{\pgfmathfloat@@b}%
+ \let\pgfmathfloat@@b=\pgfmathresult
+ %
+ \pgfmathfloatadd@{\pgfmathfloat@@a}{\pgfmathfloat@@b}%
+ \pgfmathfloatsqrt@{\pgfmathresult}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+\def\pgfmathfloatcosh@#1{%
+ \begingroup
+ \pgfmathfloatexp@{#1}%
+ \let\pgfmathfloat@@a=\pgfmathresult
+ %
+ \pgfmathfloatneg@{#1}%
+ \pgfmathfloatexp@{\pgfmathresult}%
+ %
+ \pgfmathfloatadd@{\pgfmathresult}{\pgfmathfloat@@a}%
+ \expandafter\pgfmathfloatmultiplyfixed@\expandafter{\pgfmathresult}{0.5}%
+ %
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\def\pgfmathfloatsinh@#1{%
+ \begingroup
+ \pgfmathfloatexp@{#1}%
+ \let\pgfmathfloat@@a=\pgfmathresult
+ %
+ \pgfmathfloatneg@{#1}%
+ \pgfmathfloatexp@{\pgfmathresult}%
+ %
+ \pgfmathfloatsubtract@{\pgfmathfloat@@a}{\pgfmathresult}%
+ \expandafter\pgfmathfloatmultiplyfixed@\expandafter{\pgfmathresult}{0.5}%
+ %
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\def\pgfmathfloattanh@#1{%
+ \begingroup
+ \pgfmathfloatsinh@{#1}%
+ \let\pgfmathfloat@@a=\pgfmathresult
+ %
+ \pgfmathfloatcosh@{#1}%
+ \let\pgfmathfloat@@b=\pgfmathresult
+ %
+ \pgfmathfloatdivide@{\pgfmathfloat@@a}{\pgfmathfloat@@b}%
+ %
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
\endinput
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 a3a1410968b..d2089a6fd67 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
@@ -1,3 +1,23 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% 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: Di 29. Dez 22:11:16 CET 2009 %%%
+
+
+
% Copyright 2006 by Till Tantau
%
% This file may be distributed and/or modified
@@ -7,7 +27,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgfplots/pgfplots/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex,v 1.7 2009/02/13 21:00:47 ludewich Exp $
+\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryplothandlers.code.tex,v 1.14 2009/11/18 20:27:45 ludewich Exp $
\newif\ifpgf@plot@started
@@ -603,15 +623,16 @@
}%
}
\def\pgf@plot@const@line@handler#1{%
- \pgf@plot@first@action{#1}%
+ \pgf@process{#1}%
\xdef\pgf@plot@const@line@handler@last{\the\pgf@y}%
+ \pgf@plot@first@action{}%
\global\let\pgf@plotstreampoint=\pgf@plot@const@line@handler@@%
}
\def\pgf@plot@const@line@handler@@#1{%
\pgf@process{#1}%
\pgf@xa=\pgf@x
\pgf@ya=\pgf@y
- \expandafter\pgf@yb\pgf@plot@const@line@handler@last
+ \pgf@yb\pgf@plot@const@line@handler@last\relax
\pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}%
\pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}%
\xdef\pgf@plot@const@line@handler@last{\the\pgf@ya}%
@@ -637,15 +658,16 @@
}%
}
\def\pgf@plot@const@line@mark@right@handler#1{%
- \pgf@plot@first@action{#1}%
+ \pgf@process{#1}%
\xdef\pgf@plot@const@line@handler@last{\the\pgf@x}%
+ \pgf@plot@first@action{}%
\global\let\pgf@plotstreampoint=\pgf@plot@const@line@mark@right@handler@@%
}
\def\pgf@plot@const@line@mark@right@handler@@#1{%
\pgf@process{#1}%
\pgf@xa=\pgf@x
\pgf@ya=\pgf@y
- \expandafter\pgf@yb\pgf@plot@const@line@handler@last
+ \pgf@yb\pgf@plot@const@line@handler@last\relax
\pgfpathlineto{\pgfqpoint{\pgf@yb}{\pgf@ya}}%
\pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}%
\xdef\pgf@plot@const@line@handler@last{\the\pgf@xa}%
@@ -673,15 +695,16 @@
}%
}
\def\pgf@plot@jumpmarkright@handler#1{%
- \pgf@plot@first@action{#1}%
+ \pgf@process{#1}%
\xdef\pgf@plot@const@line@handler@last{\the\pgf@x}%
+ \pgf@plot@first@action{}%
\global\let\pgf@plotstreampoint=\pgf@plot@jumpmarkright@handler@@%
}
\def\pgf@plot@jumpmarkright@handler@@#1{%
\pgf@process{#1}%
\pgf@xa=\pgf@x
\pgf@ya=\pgf@y
- \expandafter\pgf@yb\pgf@plot@const@line@handler@last
+ \pgf@yb\pgf@plot@const@line@handler@last\relax
\pgfpathmoveto{\pgfqpoint{\pgf@yb}{\pgf@ya}}%
\pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}%
\xdef\pgf@plot@const@line@handler@last{\the\pgf@xa}%
@@ -709,15 +732,16 @@
}%
}
\def\pgf@plot@jumpmarkleft@handler#1{%
- \pgf@plot@first@action{#1}%
+ \pgf@process{#1}%
\xdef\pgf@plot@const@line@handler@last{\the\pgf@y}%
+ \pgf@plot@first@action{}%
\global\let\pgf@plotstreampoint=\pgf@plot@jumpmarkleft@handler@@%
}
\def\pgf@plot@jumpmarkleft@handler@@#1{%
\pgf@process{#1}%
\pgf@xa=\pgf@x
\pgf@ya=\pgf@y
- \expandafter\pgf@yb\pgf@plot@const@line@handler@last
+ \pgf@yb\pgf@plot@const@line@handler@last\relax
\pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}%
\pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}%
\xdef\pgf@plot@const@line@handler@last{\the\pgf@ya}%
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
new file mode 100644
index 00000000000..93a7a0c59e2
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.code.tex
@@ -0,0 +1,85 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% 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: Di 29. Dez 22:11:16 CET 2009 %%%
+
+
+
+% Copyright 2009 by Till Tantau and Christian Feuersänger
+%
+% 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.
+
+\input pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex
+\input pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex
+
+% TODO for auto xrefs:
+% 1. check the already identified labels, preferrably using
+% /pdflinks/show labels=true
+% and the image externalization debug mode (see pgfmanual-en-main.tex)
+% (to strip almost all images away)
+%
+% 2. Insert '\declareandlabel' in the document whenever something has been
+% defined in the text, so it should get a pdf anchor (see
+% pgfmanual.pdflinks.code.tex )
+%
+% 2.1 perhaps insert \pgfmanualpdflabel{<label>}{} where needed.
+%
+% 3. Verify that the |...| commands occuring in situations where catcodes can't
+% be changed (footnotes or macro arguments) work as expected.
+%
+% 4. Consider telling the pretty printer that several control sequences
+% have arguments which are options (see below for the predefined list).
+% This may apply to \pgfpageslogicalpageoptions or so.
+%
+% 5. @Christian: consider extensions of the parser such that it identifies path commands (at least partially)
+%
+%
+
+\def\pgfmanual@warning#1{\immediate\write16{! Package pgfmanual Warning: #1}}%
+
+
+\pgfkeys{
+ % set this to 'false' to disable auto reference generation.
+ % However, a little bit runtime overhead will still remain
+ % (and the \pgfmanualpdflabel commands will still be used)
+ /pdflinks/codeexample links=true,
+ %
+ /codeexample/prettyprint/cs arguments/tikzset/.initial=1,
+ /codeexample/prettyprint/cs/tikzset/.code 2 args={\pgfmanualpdfref{#1}{#1}\{\pgfmanualprettyprintpgfkeys{#2}\pgfmanualclosebrace},
+ /codeexample/prettyprint/cs arguments/usetikzlibrary/.initial=1,
+ /codeexample/prettyprint/cs/usetikzlibrary/.code 2 args={\pgfmanualpdfref{#1}{#1}\{\pgfmanualpdfref{#2}{#2}\pgfmanualclosebrace},
+ /codeexample/prettyprint/cs arguments/usepgflibrary/.initial=1,
+ /codeexample/prettyprint/cs/usepgflibrary/.code 2 args={\pgfmanualpdfref{#1}{#1}\{\pgfmanualpdfref{#2}{#2}\pgfmanualclosebrace},
+ %
+ %
+ %
+ % whenever an unqualified key is found, the following key prefix
+ % list is tried to find a match.
+ /pdflinks/search key prefixes in={/tikz/,/pgf/},
+ %
+ % the link prefix written to the pdf file:
+ /pdflinks/internal link prefix=pgf,
+ %
+ /pdflinks/warnings=false,
+ % for debugging:
+ /pdflinks/show labels=false,
+}%
+
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
new file mode 100644
index 00000000000..edfc48d5a4e
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex
@@ -0,0 +1,429 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% 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: Di 29. Dez 22:11:16 CET 2009 %%%
+
+
+
+%--------------------------------------------
+%
+% Package pgfplots
+%
+% Provides a user-friendly interface to create function plots (normal
+% plots, semi-logplots and double-logplots).
+%
+% It is based on Till Tantau's PGF package.
+%
+% Copyright 2007/2008/2009 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 an interface to the
+% pgfmanual.prettyprint.code.tex thing -- it allows to
+% *generate pdf crossrefs inside of codeexamples automatically*
+% without any user input.
+%
+% Thus, you write
+% \begin{codeexample}[]
+% \begin{tikzpicture}[options]
+% \end{tikzpicture}
+% \end{codeexample}
+% and pdf cross references to the definitions of 'tikzpicture'
+% and any options will be generated automatically.
+%
+% Furthermore, pdf cross references will be generated for everything
+% within vertical bars, |....|.
+%
+%
+%
+%
+%
+% The only necessary thing is that \pgfmanualpdflabel has been called
+% for every (fully qualified) key, control sequence, environment or
+% whatever.
+
+\newif\ifpgfmanualpdfwarnings
+\pgfmanualpdfwarningstrue
+
+\newif\ifpgfmanualshowlabels
+
+\pgfkeys{%
+ /codeexample/prettyprint/cs arguments/pgfkeys/.initial=1,
+ /codeexample/prettyprint/cs/pgfkeys/.code 2 args={\pgfmanualpdfref{#1}{#1}\{\pgfmanualprettyprintpgfkeys{#2}\pgfmanualclosebrace},
+ %
+ /codeexample/prettyprint/autolinks/.style={%
+ /codeexample/prettyprint/key name/.code={\pgfmanualpdfref{##1}{##1}},
+ /codeexample/prettyprint/key name with handler/.code 2 args={\pgfmanualpdfref{##1}{##1}/\pgfmanualpdfref{/handlers/##2}{##2}},
+ /codeexample/prettyprint/key value display only/.code={\pgfmanualprettyprintcode{##1}},
+ /codeexample/prettyprint/cs/.code={\pgfmanualpdfref{##1}{##1}},
+ /codeexample/prettyprint/cs with args/.code 2 args={\pgfmanualpdfref{##1}{##1}\{\pgfmanualprettyprintcode{##2}\pgfmanualclosebrace},
+ /codeexample/prettyprint/cs arguments/pgfkeys/.initial=1,
+ /codeexample/prettyprint/cs/pgfkeys/.code 2 args={\pgfmanualpdfref{##1}{##1}\{\pgfmanualprettyprintpgfkeys{##2}\pgfmanualclosebrace},
+ /codeexample/prettyprint/cs arguments/begin/.initial=1,
+ /codeexample/prettyprint/cs/begin/.code 2 args={##1\{\pgfmanualpdfref{##2}{##2}\pgfmanualclosebrace},
+ /codeexample/prettyprint/cs arguments/end/.initial=1,
+ /codeexample/prettyprint/cs/end/.code 2 args={##1\{\pgfmanualpdfref{##2}{##2}\pgfmanualclosebrace},
+ /codeexample/prettyprint/word/.code={\begingroup\pgfkeyssetvalue{/pdflinks/search key prefixes in}{}\pgfmanualpdfref{##1}{##1}\endgroup},
+ /codeexample/prettyprint/point/.code={##1},%
+ /codeexample/prettyprint/point with cs/.code 2 args={(\pgfmanualpdfref{##1}{##1}:##2},%
+ },%
+ /codeexample/prettyprint/autolinks,
+}%
+
+\pgfkeys{
+ %
+ % Enables or disables the parsing of codeexamples.
+ /pdflinks/codeexample links/.is if=pgfmanualprettyenabled,
+ /pdflinks/codeexample links/.default=true,
+ %
+ % whenever an unqualified key is found, the following key prefix
+ % list is tried to find a match.
+ /pdflinks/search key prefixes in/.initial={/tikz/,/pgf/},
+ %
+ % Enables or disables warnings for failed auto links:
+ /pdflinks/warnings/.is if=pgfmanualpdfwarnings,
+ /pdflinks/warnings/.default=true,
+ %
+ % Shows the autogenerated labels. This is useful to check if the
+ % 'search key prefixes in' worked as it ought to.
+ /pdflinks/show labels/.is if=pgfmanualshowlabels,
+ /pdflinks/show labels/.default=true,
+ /pdflinks/show labels=false,
+ % will be invoked with '#1' set to the generated label.
+ /pdflinks/show labels code/.code={
+ \hbox to 0pt{%
+ \vbox to 0pt{\hsize=0pt
+ \vskip-\baselineskip
+ \hbox to \hsize{%
+ \hss
+ {\footnotesize\ttfamily\textcolor{red}{#1}}%
+ \hss
+ }%
+ \vss
+ }%
+ \vbox to 0pt{\hsize=0pt
+ \vss
+ \hbox to \hsize{%
+ \hss
+ {\footnotesize\ttfamily\textcolor{red}{$\vert$}}%
+ \hss
+ }%
+ }%
+ \vsize=0pt
+ }%
+ },
+ %
+ % the link prefix written to the pdf file:
+ /pdflinks/internal link prefix/.initial=pgf,
+}
+
+\gdef\pgfmanualpdf@installreplacements{%
+ \def\marg##1{{##1}}%
+ \def\oarg##1{[##1]}%
+ \def\meta##1{<##1>}%
+ \def\x{x}%
+ \def\textbackslash{<CS>}%
+ \def\\{\textbackslash}%
+ \def\space{:}%
+ \edef\ {\space}%
+ \edef\#{}%
+ \def\printanat{@}%
+ \def\protect{}%
+ \def\textasciicircum{o}%
+ \expandafter\edef\pgfmanual@verb@activebar{\pgfmanual@verb@bar}%
+}%
+
+% Defines a new pdf cross ref label for use with \pgfmanualpdfref.
+%
+% Usage:
+% \pgfmanualpdflabel{<label>}{<text>}
+% #1: the label.
+% The text #2 will be shown in the resulting pdf (if it is not empty).
+%
+% There is also support for catcode changes if <label> contains
+% something which shouldn't be written as-is into .aux files:
+% \pgfmanualpdflabel[\catcode`\|=12 ]{|-}{}
+% -> this will write
+% \begingroup \catcode `\|=12
+% <code to deal with the label |- >
+% \endgroup
+% into the .aux file.
+%
+\def\pgfmanualpdflabel{\pgfutil@ifnextchar[{\pgfmanualpdflabel@opt}{\pgfmanualpdflabel@opt[]}}%
+\def\pgfmanualpdflabel@opt[#1]#2#3{%
+ \begingroup
+ %
+ \def\pgfmanualpdf@catcode{#1}%
+ \pgfmanualpdf@catcode
+ %
+ \pgfmanualpdflabel@generate{#2}{#3}%
+ %
+ % this is pgfplots-specific: pgfplots supports generic styles which
+ % contain '\x' where '\x' iterates through 'x,y,z'.
+ \pgfutil@in@\x{#2}%
+ \ifpgfutil@in@
+ \def\x{y}%
+ \pgfmanualpdflabel@generate{#2}{#3}%
+ \def\x{z}%
+ \pgfmanualpdflabel@generate{#2}{#3}%
+ \fi
+ \endgroup
+}%
+\def\pgfmanualpdflabel@generate#1#2{%
+ \pgfmanual@handlespeciallabeltokens@in{#1}%
+ %
+ \def\pgfmanualpdflabel@generateone{0}%
+ \pgfutil@ifundefined{pgfd@lbl@\pgfmanualpdflabel@@}{%
+ % ok, no such label is known.
+ \def\pgfmanualpdflabel@generateone{1}%
+ }{%
+ \if\csname pgfd@lbl@\pgfmanualpdflabel@@\endcsname a% "a"ux
+ % ah, it is "just" known from a previous run, but there is
+ % no code in the pdf! Write it!
+ \def\pgfmanualpdflabel@generateone{1}%
+ \else
+ % ok, we already wrote one before. Skip.
+ \fi
+ }%
+ \if\pgfmanualpdflabel@generateone1%
+ \ifpgfmanualshowlabels
+ \pgfkeysvalueof{/pdflinks/show labels code/.@cmd}{\pgfmanualpdflabel@@}\pgfeov
+ \fi
+ %
+ \ifx\pgfmanualpdf@catcode\pgfutil@empty
+ \else
+ \toks0=\expandafter{\pgfmanualpdf@catcode}%
+ \immediate\write\@auxout{%
+ \noexpand\begingroup
+ \the\toks0
+ }%
+ \fi
+ \immediate\write\@auxout{%
+ \noexpand\expandafter\noexpand\gdef
+ \noexpand\csname pgfd@lbl@\pgfmanualpdflabel@@\noexpand\endcsname{a}% a = known in "a"ux file
+ }%
+ \ifx\pgfmanualpdf@catcode\pgfutil@empty
+ \else
+ \immediate\write\@auxout{\noexpand\endgroup}%
+ \fi
+ \expandafter\gdef\csname pgfd@lbl@\pgfmanualpdflabel@@\endcsname{w}% 1. remember the label AND remember that we "w"rote it into the pdf.
+ \edef\pgfmanualpdflabel@@{\pgfkeysvalueof{/pdflinks/internal link prefix}.\pgfmanualpdflabel@@}%
+ \expandafter\hypertarget\expandafter{\pgfmanualpdflabel@@}{#2}%
+ \else
+ #2%
+ \fi
+}%
+
+% A pdf reference to label `#1' with (TeX) text `#2'.
+% @see also \verbpdfref.
+\def\pgfmanualpdfref#1#2{%
+ \begingroup
+ \pgfmanual@handlespeciallabeltokens@in{#1}%
+ %
+ \ifcsname pgfd@lbl@\pgfmanualpdflabel@@\endcsname
+ \else
+ \global\let\pgfmanual@glob=\pgfmanualpdflabel@@
+ \def\pgfmanual@tempa{\foreach \prefix in }%
+ \pgfkeysgetvalue{/pdflinks/search key prefixes in}\pgfmanual@tempb
+ \expandafter\pgfmanual@tempa\expandafter{\pgfmanual@tempb}{%
+ \ifcsname pgfd@lbl@\prefix\pgfmanualpdflabel@@\endcsname
+ \xdef\pgfmanual@glob{\prefix\pgfmanualpdflabel@@}%
+ \breakforeach
+ \fi
+ }%
+ \let\pgfmanualpdflabel@@=\pgfmanual@glob
+ \ifcsname pgfd@lbl@\pgfmanualpdflabel@@\endcsname
+ \else
+ \ifpgfmanualpdfwarnings
+ \begingroup
+ \toks0={#1}%
+ \pgfmanual@warning{pgfmanualpdfref{\the\toks0 }: target label does not exist.}%
+ \endgroup
+ \fi
+ #2%
+ \let\pgfmanualpdflabel@@=\pgfutil@empty
+ \fi
+ \fi
+ \ifx\pgfmanualpdflabel@@\pgfutil@empty
+ \else
+ \expandafter\pgfmanualpdfref@\expandafter{\pgfmanualpdflabel@@}{#2}%
+ \fi
+ \endgroup
+}%
+\def\pgfmanualpdfref@#1#2{%
+ \pgfkeysgetvalue{/pdflinks/internal link prefix}\pgfmanual@temp
+ \expandafter\hyperlink\expandafter{\pgfmanual@temp.#1}{#2}%
+ \ifpgfmanualshowlabels
+ \pgfkeysvalueof{/pdflinks/show labels code/.@cmd}{#1}\pgfeov
+ \fi
+}%
+
+% Handles special tokens in a pdf label which should be treated with
+% care.
+%
+% For example, backslashes might produce problems.
+% This occurs quite frequently with automatically generated hyperrefs
+% inside of codeexamples where \pgfmanualpdfref will be invoked -
+% there, we get the catcode 12 backslashes.
+% Check for them!
+%
+% #1: a token list which shall be used either as cross ref or as
+% label.
+%
+% On output, the macro \pgfmanualpdflabel@@ will be '\edef'ed to the
+% new, possibly modified value.
+\def\pgfmanual@handlespeciallabeltokens@in#1{%
+ \begingroup
+ \pgfmanualpdf@installreplacements
+ \expandafter\pgfutil@in@\pgfmanual@pretty@backslash{#1}%
+ \ifpgfutil@in@
+ % assume the backslash is the first char and substitute it:
+ \pgfmanualpdfref@substitute@backslash#1\relax
+ \else
+ \edef\pgfmanualpdflabel@@{#1}%
+ \fi
+ \def\pgfmanual@tmp{\pgfutilstrreplace{ }{\space}}%
+ \expandafter\pgfmanual@tmp\expandafter{\pgfmanualpdflabel@@}%
+ \edef\pgfmanualpdflabel@@{\pgfretval}%
+ \pgfmath@smuggleone\pgfmanualpdflabel@@
+ \endgroup
+}%
+\expandafter\def\expandafter\pgfmanualpdfref@substitute@backslash\expandafter#\expandafter1\pgfmanual@pretty@backslash#2\relax{%
+ \edef\pgfmanualpdflabel@@{#1\textbackslash #2}%
+}%
+
+% Typesets '#1' in red,\texttt like every declaration. It will also
+% generate a pdf cross ref anchor for #1.
+%
+% WARNING: this changes catcodes! In case this is not acceptable in
+% your context, you will need to generate a \pgfmanualpdflabel
+% manually.
+%
+% \declareandlabel{\controlsequence} can be used as |\controlsequence|
+\def\declareandlabel{%
+ \begingroup
+ \pgfmanual@verb@preparecatcodes@
+ \def\pgfmanualprettyprinterhandlecollectedargs##1{%
+ \pgfmanualpdflabel##1{\texttt{\declare##1}}% mark: '##1' contains already braces.
+ \endgroup
+ }%
+ \pgfmanualprettyprintercollectargcount1{\relax}%
+}
+
+%
+% \verbpdfref{\controlsequence more stuff}
+% is the same as writing |\controlsequence more stuff|, but the
+% *complete* argument is supposed to be one label.
+%
+% The difference to \pgfmanualpdfref{...}{} is that the argument is
+% supposed to be verbatim text.
+\def\verbpdfref{%
+ \begingroup
+ \pgfmanual@verb@preparecatcodes@
+ \def\pgfmanualprettyprinterhandlecollectedargs##1{%
+ \pgfmanualpdfref##1{\texttt{##1}}% mark: '##1' contains already braces.
+ \endgroup
+ }%
+ \pgfmanualprettyprintercollectargcount1{\relax}%
+}
+
+% Prepare active vertical bars, |....| for auto-pretty cross
+% referencing.
+%
+% Example:
+% |\pgfkeys| -> will generate a hyperref!
+{
+ \catcode`\|=12
+ \gdef\pgfmanual@verb@bar{|}%
+% \gdef\pgfmanual@verb@collect#1|{%
+% % this command will also handle control sequences.
+% \texttt{\pgfmanualprettyprintpgfkeys{#1}}%
+% \endgroup
+% }%
+ \catcode`\|=13
+ \gdef\pgfmanual@verb@activebar{|}%
+}
+\def\pgfmanual@verb{%
+ \begingroup
+ \pgfmanual@verb@preparecatcodes@
+ \toksdef\t@pgfmanual@verb=0
+ \t@pgfmanual@verb={}%
+ \pgfmanual@verb@collect
+}
+% this version of \pgfmanual@verb@collect is less efficient than the
+% one uncommented above. BUT: it can auto-detect the case when
+% |...| has been provided somewhere where I can't change catcodes!
+% The other one would simply fail to compile.
+\def\pgfmanual@verb@collect#1{%
+ \def\pgfmanual@temp{#1}%
+ \ifx\pgfmanual@temp\pgfmanual@verb@bar
+ % ok, finish:
+ \edef\pgfmanual@verb@collect@next{%
+ % this command will also handle control sequences.
+ \noexpand\endgroup
+ \noexpand\texttt{\noexpand\pgfmanualprettyprintpgfkeys{\the\t@pgfmanual@verb}}%
+ }%
+ \else
+ \ifx\pgfmanual@temp\pgfmanual@verb@activebar
+ % ohoh... that should not happen! It means someone invoked
+ % |...| within an argument; I couln't change catcodes.
+ % Ok, resort to a simple fallback solution.
+ % FIXME : I have just realized that THIS DOESN'T PRESERVE SPACES
+ \edef\pgfmanual@verb@collect@next{%
+ \noexpand\endgroup
+ \noexpand\texttt{\the\t@pgfmanual@verb}%
+ }%
+ \else
+ \t@pgfmanual@verb=\expandafter{\the\t@pgfmanual@verb #1}%
+ \let\pgfmanual@verb@collect@next=\pgfmanual@verb@collect
+ \fi
+ \fi
+ \pgfmanual@verb@collect@next
+}%
+
+\AtBeginDocument{%
+ \ifpgfmanualprettyenabled
+ \catcode`\|=13
+ \expandafter\let\pgfmanual@verb@activebar=\pgfmanual@verb
+ \fi
+}%
+
+\def\pgfmanual@verb@preparecatcodes@{%
+ \let\do\@makeother%
+ \dospecials%
+ \catcode`\%=12 % THATS IMPORTANT! Do *not* handle comments!
+ % these catcodes are expected by the pretty printer...
+ %\catcode`\^^M=13
+ \catcode`\ =13
+ \catcode`\^^I=13
+ \expandafter\def\pgfmanual@pretty@activespace{\space}%
+ \expandafter\def\pgfmanual@pretty@activetab{\space\space\space\space}%
+}%
+\endinput
+% vi: ts=4 sw=4
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
new file mode 100644
index 00000000000..04fed087887
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex
@@ -0,0 +1,1115 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% 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: Di 29. Dez 22:11:16 CET 2009 %%%
+
+
+
+%--------------------------------------------
+%
+% Package pgfplots
+%
+% Provides a user-friendly interface to create function plots (normal
+% plots, semi-logplots and double-logplots).
+%
+% It is based on Till Tantau's PGF package.
+%
+% Copyright 2007/2008/2009 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 is some kind of "plug-in" for pgfmanual-en-macros.tex which
+% provides pretty printing of the code lines in 'codeexample'.
+%
+% It requires to be invoked with \pgfmanualprettyprintcode{#1} at the
+% right place.
+%
+% ATTENTION:
+% this is NOT a sophisticated syntax highlighter like lstlistings!
+% It has rather strict assumptions about how to use it (the input must
+% have been read verbatim, for example).
+
+% Special code for syntax highlighting:
+%
+%
+% USER INTERFACE
+\pgfkeys{%
+ % this is the public hook into
+ % \begin{codeexample}...\end{codeexample} which triggers pretty
+ % printing:
+ /codeexample/typeset listing/.code= {\pgfmanualprettyprintcode{#1}},
+ %
+ % this key will be invoked whenever a key in key-value context has been identified.
+ %
+ % It won't be invoked for handled keys like |my style/.style=....|, see below.
+ %
+ % #1 will be the keys name.
+ /codeexample/prettyprint/key name/.code={#1},
+ %
+ % A variant which will be used instead of |key name| if the key
+ % has a key handler. For example, when the pretty printer finds
+ % |my style/.style|, it will call
+ % |key name with handler={my style}{.style}.
+ /codeexample/prettyprint/key name with handler/.code 2 args={#1/#2},
+ %
+ % Will be invoked whenever the value of a key has been found.
+ % It will be invoked AFTER 'key name' and not at all if there was
+ % no value.
+ %
+ % #1: the key's name
+ % #2: the key's value.
+ %
+ % The default implementation checks if there is a special handler
+ % for the key name '#1', in
+ % /codeexample/prettyprint/key value/#1.
+ % For example:
+ % /codeexample/prettyprint/key value/my key/.code 2 args={name=#1, value =#2}
+ % If such a key exists, it will be invoked with {#1}{#2} as
+ % arguments. Otherwise, the generic method
+ % /codeexample/prettyprint/key value with style detection={#1}{#2}
+ % will be invoked.
+ /codeexample/prettyprint/key value/.code 2 args={%
+ \pgfkeysifdefined{/codeexample/prettyprint/key value/#1}{%
+ \pgfkeysalso{/codeexample/prettyprint/key value/#1={#1}{#2}}%
+ }{%
+ \pgfkeysalso{/codeexample/prettyprint/key value with style detection={#1}{#2}}%
+ }%
+ },
+ % A helper macro for the default 'key value' implementation.
+ /codeexample/prettyprint/key value with style detection/.code 2 args={%
+ \pgfutil@in@{style}{#1}%
+ \ifpgfutil@in@
+ \pgfmanualprettyprintpgfkeys{#2}%
+ \else
+ \pgfkeysalso{/codeexample/prettyprint/key value display only={#2}}%
+ \fi
+ },%
+ %
+ % Will be invoked by the default 'key value' implementation to
+ % typeset the value as such.
+ /codeexample/prettyprint/key value display only/.code={#1},
+ %
+ % Used to typeset a single word. A word is something which has not
+ % been identified in any other context; a maximal sequence of
+ % non-white-space tokens.
+ /codeexample/prettyprint/word/.code={#1},
+ %
+ % A two-argument code key which invokes '#1' if spaces shall
+ % delimit words and '#2' if not.
+ % This may be useless. Handle with care!
+ /codeexample/prettyprint/if space is word delim/.code 2 args={%
+ #1%
+ },%
+ %
+ % A three-argument code key which should invoke '#2' if the single
+ % token '#1' is a word delimiter and '#3' if that is not the case.
+ % Note that '#1' doesn't have the usual catcodes (see the
+ % \pgfmanual@pretty@** macros)!
+ % Furthermore, white spaces are treated separately.
+ /codeexample/prettyprint/if is word delim/.code args={#1#2#3}{%
+ \edef\pgfmanual@check{,;().;\pgfmanual@pretty@lbrace\pgfmanual@pretty@rbrace}%
+ \def\pgfmanual@check@{\pgfutil@in@{#1}}%
+ \expandafter\pgfmanual@check@\expandafter{\pgfmanual@check}%
+ \ifpgfutil@in@ #2\else #3\fi
+ },%
+ %
+ % Used to typeset a single control sequence.
+ % #1 is the control sequence's name as a sequence of catcode 12
+ % tokens.
+ /codeexample/prettyprint/cs/.code={#1},
+ %
+ % Used to typeset a single control sequence together with one or
+ % more arguments.
+ %
+ % #1 is the control sequence's name (including the backslash as
+ % literal string) and
+ % #2,#3,...,#9 are the arguments. The number of arguments depends
+ % on the 'cs arguments/<CS NAME>' key; it contains the integer
+ % number.
+ %
+ % For example, if
+ % |cs arguments/pgfkeys/.initial=1|,
+ % the pretty printer invokes
+ % |cs with args={\pgfkeys}{<argument>}.
+ %
+ % If
+ % |cs arguments/mycommand/.initial=2|,
+ % the pretty printer invokes
+ % |cs with args={\pgfkeys}{<argument1>}{<argument2>}.
+ % In this case, 'cs with args' needs to be defined in a way which
+ % allows to deal with 3 arguments.
+ %
+ % Please note that the value do not contain braces! The braces
+ % need to be inserted manually.
+ %
+ % Special cases:
+ % 1. If end-of-input is encountered BEFORE the expected number of
+ % arguments has been found, the following happens:
+ % - if not even one (partial) argument has been found, the
+ % /codeexample/prettyprint/cs/.@cmd key will be used instead.
+ % - the \ifpgfmanualprettyprinterarghasunmatchedbraces boolean
+ % indicates if the trailing brace is missing.
+ /codeexample/prettyprint/cs with args/.code 2 args={#1\{#2\pgfmanualclosebrace},
+ %
+ % For every identified control sequence, the key
+ % /codeexample/prettyprint/cs arguments/<CSNAME>
+ % will be checked. If it exists, it contains an integer with the
+ % number of arguments it takes.
+ % The <CSNAME> must not contain the '\'.
+ /codeexample/prettyprint/cs arguments/pgfkeys/.initial=1,
+ %
+ % For every identified control sequence, the key
+ % /codeexample/prettyprint/cs/<CSNAME>/.@cmd
+ % will be checked. If it exists, it will be used instead of
+ % 'cs with args' (with the same special case restrictions for
+ % early end-of-input).
+ %
+ % The <CSNAME> must not contain the '\'.
+ %
+ % This allows special treatment for special
+ % commands like \pgfkeys:
+ /codeexample/prettyprint/cs/pgfkeys/.code 2 args={#1\{\pgfmanualprettyprintpgfkeys{#2}\pgfmanualclosebrace},
+ %
+ % recognise environments:
+ /codeexample/prettyprint/cs arguments/begin/.initial=1,
+ /codeexample/prettyprint/cs/begin/.code 2 args={#1\{#2\pgfmanualclosebrace},
+ /codeexample/prettyprint/cs arguments/end/.initial=1,
+ /codeexample/prettyprint/cs/end/.code 2 args={#1\{#2\pgfmanualclosebrace},
+ %
+ % a point coordinate (#1)
+ % Note that '#1' will contain the braces (if there was one),
+ /codeexample/prettyprint/point/.code={#1},%
+ %
+ % a point coordinate with explicit coordinate system: (#1:#2)
+ % Note that '#2' will contain the terminating brace (if there was one)
+ % #1: the coordinate system name (*without* the leading brace).
+ % The leading brace must be re-inserted by this style.
+ /codeexample/prettyprint/point with cs/.code 2 args={(#1:#2},%
+ % the same with specialised code:
+ %/codeexample/prettyprint/point with cs/<CS NAME>/.code 2 args={(#1:#2},%
+ %
+ %
+ % A predefined style which colors every identified token. It's
+ % purpose is only debugging.
+ /codeexample/prettyprint/colored/.style={%
+ /codeexample/prettyprint/key name/.code={\textcolor{red!75!black}{##1}},
+ /codeexample/prettyprint/key name with handler/.code 2 args={\textcolor{red!75!black}{##1}/\textcolor{red!90!black}{##2}},
+ /codeexample/prettyprint/key value display only/.code={\textcolor{yellow}{##1}},
+ /codeexample/prettyprint/cs/.code={\textcolor{green}{##1}},
+ /codeexample/prettyprint/cs with args/.code 2 args={\textcolor{green}{##1}\{\textcolor{orange}{##2}\pgfmanualclosebrace},
+ /codeexample/prettyprint/cs arguments/pgfkeys/.initial=1,
+ /codeexample/prettyprint/cs/pgfkeys/.code 2 args={\textcolor{green}{##1}\{\pgfmanualprettyprintpgfkeys{##2}\pgfmanualclosebrace},
+ /codeexample/prettyprint/cs arguments/begin/.initial=1,
+ /codeexample/prettyprint/cs/begin/.code 2 args={\textcolor{green}{##1}\{\textcolor{orange}{##2}\pgfmanualclosebrace},
+ /codeexample/prettyprint/cs arguments/end/.initial=1,
+ /codeexample/prettyprint/cs/end/.code 2 args={\textcolor{green}{##1}\{\textcolor{orange}{##2}\pgfmanualclosebrace},
+ /codeexample/prettyprint/word/.code={\textcolor{brown}{##1}},
+ /codeexample/prettyprint/point/.code={\textcolor{red}{##1}},%
+ /codeexample/prettyprint/point with cs/.code 2 args={(\textcolor{green}{##1}:\textcolor{red}{##2}},%
+ },%
+ % A further debuggin helper.
+ /codeexample/prettyprint/colored and verbose/.style={%
+ /codeexample/prettyprint/colored,
+ /codeexample/prettyprint/key name/.code={\message{[key name=##1]}\textcolor{red!75!black}{##1}},
+ /codeexample/prettyprint/key name with handler/.code 2 args={\message{[key name with handler=##1/##2]}\textcolor{red!75!black}{##1}/\textcolor{red!90!black}{##2}},
+ /codeexample/prettyprint/key value display only/.code={\def\temp{##1}\message{[key value=\meaning\temp]}\textcolor{yellow}{##1}},
+ /codeexample/prettyprint/cs/.code={\message{[cs=##1]}\textcolor{green}{##1}},
+ /codeexample/prettyprint/cs with args/.code 2 args={\def\temp{##2}\message{[cs with args={##1}{\meaning\temp}]}\textcolor{green}{##1}\{\textcolor{orange}{##2}\pgfmanualclosebrace},
+ /codeexample/prettyprint/word/.code={\message{[word=##1]}\textcolor{brown}{##1}},
+ /codeexample/prettyprint/point/.code={\message{[point=##1]}\textcolor{red}{##1}},%
+ /codeexample/prettyprint/point with cs/.code 2 args={\message{[point with cs={##1}{##2}]}(\textcolor{green}{##1}:\textcolor{red}{##2}},%
+ },%
+ %/codeexample/prettyprint/colored,
+ %/codeexample/prettyprint/colored and verbose,
+}%
+
+\newif\ifpgfmanualprettyenabled
+\pgfmanualprettyenabledtrue
+
+% User interface command to handle unmatched braces:
+%
+% It expands to '\}' unless the preceding argument had unmatched braces.
+\def\pgfmanualclosebrace{%
+ \ifpgfmanualprettyprinterarghasunmatchedbraces
+ \else
+ \}%
+ \fi
+}%
+
+
+% Typesets '#1', possibly using some sort of pretty printer.
+%
+% The argument '#1' is expected to be a long token list in which
+% 1. all characters have catcode 11 or 12 (normal letters),
+% 2. white spaces, tabs and newlines have catcode 13 (are active).
+%
+% @see \pgfmanualprettyprintpgfkeys
+\long\def\pgfmanualprettyprintcode#1{%
+%\def\temp{#1}\message{STARTING PRETTY PRINTING for \meaning\temp}%
+ \ifpgfmanualprettyenabled
+ \begingroup
+ \pgfmanualprettyprintstyles
+ \pgfmanual@pretty@mainloop#1\pgfmanual@EOI
+ \endgroup
+ \else
+ #1%
+ \fi
+}%
+% DISABLE:
+%\long\def\pgfmanualprettyprintcode#1{#1}%
+
+\def\pgfmanualprettyprintstyles{%
+%\tracingmacros=2 \tracingcommands=2 \message{PRETTYPRINT INIT}%
+ \def\{{\pgfmanual@pretty@lbrace}%
+ \def\}{\pgfmanual@pretty@rbrace}%
+ \pgfmanual@pretty@installcommenthandler
+ \let\pgfmanualprettyprintstyles=\relax
+}%
+
+
+\newif\ifpgfmanualprettycommentactive
+
+% we can't use the \@typeset@till@return method for comments because
+% the pretty printer needs full control over the token list.
+%
+% We try a replacement here.
+%
+% FIXME
+% THIS INTRODUCES A NEW GROUP! Does that hurt the pretty printer??
+%
+\def\pgfmanual@pretty@installcommenthandler{%
+ \expandafter\def\pgfmanual@pretty@activepercent{%
+ \begingroup
+ \pgfmanualprettycommentactivetrue
+ \expandafter\let\pgfmanual@pretty@activenl=\pgfmanual@pretty@recoveraftercomment
+ \expandafter\def\pgfmanual@pretty@activepercent{\%}%
+ %\tt
+ \% %
+ }%
+}%
+\def\pgfmanual@pretty@recoveraftercomment{%
+ \endgroup
+ \pgfmanual@pretty@activenl
+}%
+
+\def\pgfmanual@EOI{\pgfmanual@EOI}%
+
+{
+ \catcode`\[=0
+ \catcode`\\=12
+ [gdef[pgfmanual@pretty@backslash{\}%
+}
+\begingroup
+ \catcode`\:=12
+ \catcode`\(=12
+ \catcode`\)=12
+ \gdef\pgfmanual@pretty@colon{:}%
+ \gdef\pgfmanual@pretty@lroundbrace{(}%
+ \gdef\pgfmanual@pretty@rroundbrace{)}%
+ \catcode`\[=1
+ \catcode`\]=2
+ \catcode`\{=12
+ \catcode`\}=12
+ \gdef\pgfmanual@pretty@lbrace[{]%
+ \gdef\pgfmanual@pretty@rbrace[}]%
+ \catcode`\{=1
+ \catcode`\}=2
+ \catcode`\[=12
+ \catcode`\]=12
+ \catcode`\,=12
+ \catcode`\ =10\relax\gdef\pgfmanual@pretty@space{ }%
+ \gdef\pgfmanual@pretty@lbracket{[}%
+ \gdef\pgfmanual@pretty@rbracket{]}%
+ \gdef\pgfmanual@pretty@comma{,}%
+ \catcode`\==12
+ \gdef\pgfmanual@pretty@eq{=}%
+\endgroup
+\begingroup
+ \catcode`\%=12
+ \gdef\pgfmanual@pretty@percent{%}
+ \catcode`\%=13
+ \gdef\pgfmanual@pretty@activepercent{%}
+ \catcode`\^^M=13
+ \gdef\pgfmanual@pretty@activenl{^^M}\endgroup
+\begingroup
+\catcode`\^^I=13\relax\gdef\pgfmanual@pretty@activetab{^^I}%
+\catcode`\ =13\relax\gdef\pgfmanual@pretty@activespace{ }\endgroup
+
+% loops through all tokens.
+% #1 is a single token.
+\def\pgfmanual@pretty@mainloop{%
+ \def\pgfmanual@pretty@mainloop@currentword{}%
+ \pgfmanual@pretty@mainloop@
+}%
+\long\def\pgfmanual@pretty@mainloop@#1{%
+ \def\pgfmanual@loc@TMPa{#1}%
+ \let\pgfmanual@pretty@mainloop@NEXT=\pgfmanual@pretty@mainloop@
+ \ifx\pgfmanual@loc@TMPa\pgfmanual@EOI
+ % stop iteration.
+ \pgfmanual@pretty@mainloop@finishword
+ \let\pgfmanual@pretty@mainloop@NEXT=\relax
+ \else
+ \ifpgfmanualprettycommentactive
+ #1%
+ \else
+ \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@lbracket%
+ % we found the start of OPTIONS '[ ... ]'.
+ \pgfmanual@pretty@mainloop@finishword
+ % Attempt syntax highlighting for pgfkeys:
+ \let\pgfmanual@pretty@mainloop@NEXT=\pgfmanual@pretty@pgfkeys
+ \else
+ \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@backslash
+ % we found the start of a control sequence '\command'
+ \pgfmanual@pretty@mainloop@finishword
+ %
+ % collect the control sequence name into
+ % \pgfmanual@loc@TMPa, but without the backslash:
+ \let\pgfmanual@loc@TMPa=\pgfutil@empty
+ \let\pgfmanual@pretty@mainloop@NEXT=\pgfmanual@pretty@collectcs@loop
+ \else
+ \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@lroundbrace%
+ \pgfmanual@pretty@mainloop@finishword
+ \let\pgfmanual@pretty@mainloop@NEXT=\pgfmanual@pretty@collectpoint
+ \else
+ \def\pgfmanual@isspace{0}%
+ \ifnum13=\catcode`#1
+ % we found a white space (space, TAB or NL) or comment
+ \def\pgfmanual@isspace{1}%
+ \else
+ \ifnum10=\catcode`#1
+ \def\pgfmanual@isspace{1}%
+ \fi
+ \fi
+ \if\pgfmanual@isspace1%
+ \pgfkeysvalueof{/codeexample/prettyprint/if space is word delim/.@cmd}{%
+ \pgfmanual@pretty@mainloop@finishword
+ #1% ok, show it.
+ }{%
+ % collect the word.
+ \expandafter\def\expandafter\pgfmanual@pretty@mainloop@currentword\expandafter{\pgfmanual@pretty@mainloop@currentword #1}%
+ }%
+ \else
+ \pgfkeysvalueof{/codeexample/prettyprint/if is word delim/.@cmd}{#1}{%
+ \pgfmanual@pretty@mainloop@finishword
+ #1% ok, show the delimiter.
+ }{%
+ % collect the word.
+ \expandafter\def\expandafter\pgfmanual@pretty@mainloop@currentword\expandafter{\pgfmanual@pretty@mainloop@currentword #1}%
+ }\pgfeov%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \pgfmanual@pretty@mainloop@NEXT
+}%
+
+\def\pgfmanual@pretty@mainloop@finishword{%
+ \ifx\pgfmanual@pretty@mainloop@currentword\pgfutil@empty
+ \else
+ \def\pgfmanual@loc@TMPa{\pgfkeysvalueof{/codeexample/prettyprint/word/.@cmd}}%
+ \expandafter\pgfmanual@loc@TMPa\pgfmanual@pretty@mainloop@currentword\pgfeov
+ \let\pgfmanual@pretty@mainloop@currentword=\pgfutil@empty
+ \fi
+}%
+
+\def\pgfmanual@pretty@collectpoint{%
+ \let\pgfmanualprettyprinterhandlecollectedargs=\pgfmanual@pretty@collectargs@finish@collectpoint
+ \expandafter\pgfmanualprettyprintercollectupto\pgfmanual@pretty@rroundbrace
+ {\afterpgfmanual@pretty@collectpoint}%
+}
+
+{
+\catcode`\:=12
+\gdef\pgfmanual@pretty@collectargs@finish@collectpoint#1{%
+ \expandafter\pgfutil@in@\pgfmanual@pretty@colon{#1}%
+ \ifpgfutil@in@
+ \def\pgfmanual@pretty@collectpoint@getcoordsystem##1:##2\relax{%
+ \begingroup
+ \pgfmanual@pretty@restorespaces
+ % remove active spaces from ##1:
+ \xdef\pgfmanual@pretty@glob@TMPa{##1}%
+ \endgroup
+ \pgfkeysifdefined{/codeexample/prettyprint/point with cs/\pgfmanual@pretty@glob@TMPa/.@cmd}{%
+ \def\pgfmanual@loc@TMPb{\pgfkeysvalueof{/codeexample/prettyprint/point with cs/\pgfmanual@pretty@glob@TMPa/.@cmd}}%
+ }{%
+ \def\pgfmanual@loc@TMPb{\pgfkeysvalueof{/codeexample/prettyprint/point with cs/.@cmd}}%
+ }%
+ \expandafter\def\expandafter\pgfmanual@loc@TMPa\expandafter{\expandafter{\pgfmanual@pretty@glob@TMPa}{##2}}%
+ \expandafter\pgfmanual@loc@TMPb\pgfmanual@loc@TMPa\pgfeov
+ }%
+ \ifpgfmanualprettyprinterfoundterminator
+ \pgfmanual@pretty@collectpoint@getcoordsystem#1)\relax
+ \else
+ \pgfmanual@pretty@collectpoint@getcoordsystem#1\relax
+ \fi
+ \else
+ \def\pgfmanual@loc@TMPb{\pgfkeysvalueof{/codeexample/prettyprint/point/.@cmd}}%
+ \ifpgfmanualprettyprinterfoundterminator
+ \pgfmanual@loc@TMPb(#1)\pgfeov
+ \else
+ \pgfmanual@loc@TMPb(#1\pgfeov
+ \fi
+ \fi
+}%
+}
+\def\afterpgfmanual@pretty@collectpoint{\pgfmanual@pretty@mainloop}%
+
+% loops through all tokens, assembling the cs name as it goes.
+% #1 is a single token.
+\def\pgfmanual@pretty@collectcs@loop#1{%
+ \let\pgfmanual@pretty@collectcs@loop@NEXT=\pgfmanual@pretty@collectcs@loop
+ \def\pgfmanual@loc@TMPb{#1}%
+ \ifx\pgfmanual@loc@TMPb\pgfmanual@EOI
+ \def\pgfmanual@pretty@collectcs@loop@NEXT{\pgfmanual@pretty@collectcs@loop@END #1}%
+ \else
+ % a csname may only use letters. And: only letters have a
+ % positive lcccode!
+ \ifnum\lccode`#1=0
+ \ifx\pgfmanual@loc@TMPb @%
+ % ok, we may also accept an `@':
+ \edef\pgfmanual@loc@TMPa{\pgfmanual@loc@TMPa #1}%
+ \else
+ % This here is the first non-letter.
+ \def\pgfmanual@pretty@collectcs@loop@NEXT{\pgfmanual@pretty@collectcs@loop@END #1}%
+ \fi
+ \else
+ % continue iterating and assemble the csname...
+ \edef\pgfmanual@loc@TMPa{\pgfmanual@loc@TMPa #1}%
+ \fi
+ \fi
+ \pgfmanual@pretty@collectcs@loop@NEXT
+}%
+\def\afterpgfmanual@pretty@cs{\pgfmanual@pretty@mainloop}%
+
+\def\pgfmanual@pretty@collectcs@loop@END{%
+ \pgfkeysifdefined{/codeexample/prettyprint/cs arguments/\pgfmanual@loc@TMPa}{%
+ % oh. The collected control sequence expects arguments. That
+ % means a lot of work since there are no nestable braces in
+ % the token list! All of them have catcode 12... we need to do
+ % that manually.
+ \let\pgfmanualprettyprinterhandlecollectedargs=\pgfmanual@pretty@collectargs@finish@cs
+ \def\pgfmanual@pretty@collectcs@loop@END@next{%
+ \pgfmanualprettyprintercollectargcount
+ {\pgfkeysvalueof{/codeexample/prettyprint/cs arguments/\pgfmanual@loc@TMPa}}%
+ {\afterpgfmanual@pretty@cs}%
+ }%
+ }{%
+ % re-insert the backslash:
+ \edef\pgfmanual@loc@TMPa{\pgfmanual@pretty@backslash \pgfmanual@loc@TMPa}%
+ % ok, report the macro and continue with the main loop.
+ \def\pgfmanual@loc@TMPb{\pgfkeysvalueof{/codeexample/prettyprint/cs/.@cmd}}%
+ \expandafter\pgfmanual@loc@TMPb\pgfmanual@loc@TMPa\pgfeov
+ \let\pgfmanual@pretty@collectcs@loop@END@next=\afterpgfmanual@pretty@cs
+ }%
+ \pgfmanual@pretty@collectcs@loop@END@next
+}%
+
+\newif\ifpgfmanualprettyprinterarghasunmatchedbraces
+
+% Collects arguments inside of a token list, dealing with nested
+% catcode-12-braces.
+%
+% #1: is the NUMBER of arguments to collect.
+% #2: is TeX code which shall be invoked after
+% \pgfmanualprettyprinterhandlecollectedargs has been invoked (see
+% below).
+%
+% PRECONDITION:
+% there is a large token list following
+% \pgfmanualprettyprintercollectargcount with balanced braces. The braces
+% have \catcode 12.
+% POSTCONDITION:
+% 1. the arguments will be collected as
+% '<result> := {<first arg>}{<second arg>}',
+% 2.1 the macro \pgfmanualprettyprinternumcollectedargs will contain
+% the *actual* number of *completely* collected arguments,
+% 2.2 the if \ifpgfmanualprettyprinterarghasunmatchedbraces will be
+% set to \c true if the last found argument had an unmatched brace,
+% 3. then, \pgfmanualprettyprinterhandlecollectedargs{<result>} will be
+% invoked. Just define \pgfmanualprettyprinterhandlecollectedargs
+% properly.
+% Afterwards, #2 will be invoked to recover from the argument
+% collection.
+%
+%
+% Example:
+% \pgfmanualprettyprintercollectargcount{2}{\donnextstep}
+% {_12 first argument }_12 {_12 second argument }_12 next tokens%
+%
+% will result in the expansion
+% \pgfmanualprettyprinterhandlecollectedargs{{_1 first argument }_2 {_1 second argument }_2 }
+% \donnextstep
+% next tokens
+%
+%
+%
+% ATTENTION:
+% \pgfmanualprettyprinterhandlecollectedargs will be invoked with a SINGLE
+% argument. The argument as such will contain extra braces, one pair
+% of braces for each of the #1 arguments. These braces will have
+% catcode 1 and 2, i.e. they can *really* be used in TeX. Thus, the
+% finish routine will be invoked with
+% \pgfmanualprettyprinterhandlecollectedargs{{<arg>}}
+% for one argument and with
+% \pgfmanualprettyprinterhandlecollectedargs{{<first arg>}{<second arg>}}
+% for two and more arguments. Note the extra set of braces for one
+% arg.
+% It might happen that not all arguments have been found if
+% end-of-input occured before. The
+% \pgfmanualprettyprinterhandlecollectedargs routine has to check
+% this using the macro \pgfmanualprettyprinternumcollectedargs which
+% contains the actual number of collected args.
+%
+% @remark This macro checks for the end-of-input indicator, \pgfmanual@EOI. In case it encounters
+% \pgfmanual@EOI, it
+% 1. stops collecting, leaving the \pgfmanual@EOI as next token to be read,
+% 2. sets \ifpgfmanualprettyprinterarghasunmatchedbraces to \iftrue if necessary,
+% 3. assigns \pgfmanualprettyprinternumcollectedargs
+% 4. invokes the finish routine.
+% The \pgfmanual@EOI needs to be collected by following routines in
+% this case. You can also use \pgfutil@ifnextchar\pgfmanual@EOI{}{} in
+% following routines to check for \pgfmanual@EOI.
+\def\pgfmanualprettyprintercollectargcount#1#2{%
+ \pgfmanualprettyprinterarghasunmatchedbracesfalse
+ \begingroup
+ \edef\pgfmanual@loc@csargcount{#1}%
+ \toksdef\t@afterpgfmanualprettyprinterhandlecollected=10
+ \t@afterpgfmanualprettyprinterhandlecollected={#2}%
+ \let\c@pgfmanual@pretty@openbracecount=\c@pgf@counta
+ \let\c@pgfmanual@pretty@curargcount=\c@pgf@countb
+ % I will track open braces and the number of completely
+ % collected arguments here:
+ \c@pgfmanual@pretty@openbracecount=0
+ \c@pgfmanual@pretty@curargcount=0
+ %
+ % and I will accumulate the argument token lists as such here:
+ \toksdef\t@pgfmanual@currentarg=0
+ \toksdef\t@pgfmanual@allargs=1
+ \t@pgfmanual@currentarg={}%
+ \t@pgfmanual@allargs={}%
+ %
+ \pgfmanual@pretty@collectargs@loop
+}%
+
+% loops through all tokens, collecting the required number of
+% arguments. This involves to track nested braces manually.
+% #1 is a single token.
+\def\pgfmanual@pretty@collectargs@loop#1{%
+ \let\pgfmanual@pretty@collectargs@loop@NEXT=\pgfmanual@pretty@collectargs@loop
+ \def\pgfmanual@loc@TMPc{#1}%
+ \ifx\pgfmanual@loc@TMPc\pgfmanual@EOI
+ \ifnum\c@pgfmanual@pretty@openbracecount>0
+ \ifpgfmanualpdfwarnings
+ \pgfplots@warning{The pretty printer did not found the closing curly brace!? This will potentially lead to display errors}%
+ \fi
+ \fi
+ \edef\pgfmanual@pretty@collectargs@loop@NEXT{%
+ \noexpand\endgroup
+ \ifnum\c@pgfmanual@pretty@openbracecount>0
+ \noexpand\pgfmanualprettyprinterarghasunmatchedbracestrue
+ \fi
+ \noexpand\def\noexpand\pgfmanualprettyprinternumcollectedargs{\the\c@pgfmanual@pretty@curargcount}%
+ \noexpand\pgfmanualprettyprinterhandlecollectedargs{\the\t@pgfmanual@allargs\the\t@pgfmanual@currentarg}%
+ \the\t@afterpgfmanualprettyprinterhandlecollected
+ \noexpand\pgfmanual@EOI% <- put this token back into token list!
+ }%
+ \else
+ \ifpgfmanualprettycommentactive
+ \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}%
+ \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@activenl
+ \pgfmanualprettycommentactivefalse
+ \fi
+ \else
+ \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@activepercent
+ \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}%
+ \pgfmanualprettycommentactivetrue
+ \else
+ \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@lbrace
+ \advance\c@pgfmanual@pretty@openbracecount by1
+ \ifnum\c@pgfmanual@pretty@openbracecount>1
+ \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}%
+ \fi
+ \else
+ \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@rbrace
+ \advance\c@pgfmanual@pretty@openbracecount by-1
+ \ifnum\c@pgfmanual@pretty@openbracecount=0
+ % we have one complete argument ready!
+ % append it -- with REAL braces if needed:
+ \edef\pgfmanual@loc@TMPc{\the\t@pgfmanual@allargs{\the\t@pgfmanual@currentarg}}%
+ \t@pgfmanual@allargs=\expandafter{\pgfmanual@loc@TMPc}%
+ \t@pgfmanual@currentarg={}%
+ %
+ % check it we need more arguments:
+ \advance\c@pgfmanual@pretty@curargcount by1
+ \ifnum\c@pgfmanual@pretty@curargcount=\pgfmanual@loc@csargcount\relax
+ \edef\pgfmanual@pretty@collectargs@loop@NEXT{%
+ \noexpand\endgroup
+ \noexpand\def\noexpand\pgfmanualprettyprinternumcollectedargs{\the\c@pgfmanual@pretty@curargcount}%
+ \noexpand\pgfmanualprettyprinterhandlecollectedargs{\the\t@pgfmanual@allargs}%
+ \the\t@afterpgfmanualprettyprinterhandlecollected
+ }%
+ \fi
+ \else
+ \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}%
+ \fi
+ \else
+ \ifnum13=\catcode`#1
+ % we found a white space (space, TAB or NL) or comment
+ \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}%
+ \else
+ \ifnum10=\catcode`#1
+ % we found a white space (space, TAB
+ % or NL) with unexpected catcode
+ \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}%
+ \else
+ \ifnum\c@pgfmanual@pretty@openbracecount=0
+ \ifpgfmanualpdfwarnings
+ \begingroup
+ \toks4{#1}%
+ \pgfplots@warning{The pretty printer did not find the expected \pgfmanual@loc@csargcount\space arguments (only token \the\toks4 )}%
+ \endgroup
+ \fi
+ \edef\pgfmanual@pretty@collectargs@loop@NEXT{%
+ \noexpand\endgroup
+ \noexpand\def\noexpand\pgfmanualprettyprinternumcollectedargs{\the\c@pgfmanual@pretty@curargcount}%
+ \noexpand\pgfmanualprettyprinterhandlecollectedargs{\the\t@pgfmanual@allargs\the\t@pgfmanual@currentarg}%
+ \the\t@afterpgfmanualprettyprinterhandlecollected
+ \noexpand#1% <- put this token back into token list!
+ }%
+ \else
+ \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \pgfmanual@pretty@collectargs@loop@NEXT
+}%
+
+\newif\ifpgfmanualprettyprinterfoundterminator
+
+% Collects tokens inside of a token list up to a single delimiting token, dealing with nested
+% catcode-12-braces.
+%
+% #1: is the end token, the delimiter. It won't be collected.
+% #2: is code to invoke after
+% \pgfmanualprettyprinterhandlecollectedargs has been invoked.
+%
+% PRECONDITION:
+% there is a large token list following
+% \pgfmanualprettyprintercollectargcount with balanced braces. The braces
+% have \catcode 12.
+% POSTCONDITION:
+% - the arguments will be collected as
+% '<result> := <token list>'
+% and then, \pgfmanualprettyprinterhandlecollectedargs{<result>} will be
+% invoked. Just define \pgfmanualprettyprinterhandlecollectedargs
+% properly.
+% Then, #2 will be invoked.
+% - The boolean \ifpgfmanualprettyprinterfoundterminator will be set to true if and only if '#1' has been found.
+%
+% @see \pgfmanualprettyprintercollectargcount for more details.
+%
+\def\pgfmanualprettyprintercollectupto#1#2{%
+ \pgfmanualprettyprinterarghasunmatchedbracesfalse
+ \pgfmanualprettyprinterfoundterminatortrue
+ \begingroup
+ \def\pgfmanual@loc@delimittoken{#1}%
+ \toksdef\t@afterpgfmanualprettyprinterhandlecollected=10
+ \t@afterpgfmanualprettyprinterhandlecollected={#2}%
+ %
+ \let\c@pgfmanual@pretty@openbracecount=\c@pgf@counta
+ % I will track open braces here:
+ \c@pgfmanual@pretty@openbracecount=0
+ %
+ % and I will accumulate the argument token lists as such here:
+ \toksdef\t@pgfmanual@currentarg=0
+ \t@pgfmanual@currentarg={}%
+ %
+ \pgfmanual@pretty@collectupto@loop
+}%
+
+% loops through all tokens, collecting the required number of
+% arguments. This involves to track nested braces manually.
+% #1 is a single token.
+\def\pgfmanual@pretty@collectupto@loop#1{%
+ \let\pgfmanual@pretty@collectupto@loop@NEXT=\pgfmanual@pretty@collectupto@loop
+ \def\pgfmanual@loc@TMPc{#1}%
+ \ifx\pgfmanual@loc@TMPc\pgfmanual@EOI
+ \edef\pgfmanual@pretty@collectupto@loop@NEXT{%
+ \noexpand\endgroup
+ \ifnum\c@pgfmanual@pretty@openbracecount>0
+ \noexpand\pgfmanualprettyprinterarghasunmatchedbracestrue
+ \fi
+ \noexpand\pgfmanualprettyprinterfoundterminatorfalse
+ \noexpand\pgfmanualprettyprinterhandlecollectedargs{\the\t@pgfmanual@currentarg}%
+ \the\t@afterpgfmanualprettyprinterhandlecollected
+ \noexpand\pgfmanual@EOI% <- put this token back into token list!
+ }%
+ \else
+ \ifpgfmanualprettycommentactive
+ \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}%
+ \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@activenl
+ \pgfmanualprettycommentactivefalse
+ \fi
+ \else
+ \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@activepercent
+ \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}%
+ \pgfmanualprettycommentactivetrue
+ \else
+ \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@lbrace
+ \advance\c@pgfmanual@pretty@openbracecount by1
+ \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}%
+ \else
+ \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@rbrace
+ \advance\c@pgfmanual@pretty@openbracecount by-1
+ \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}%
+ \else
+ \ifx\pgfmanual@loc@TMPc\pgfmanual@loc@delimittoken
+ \ifnum\c@pgfmanual@pretty@openbracecount=0
+ % do NOT include the delimit token.
+ \edef\pgfmanual@pretty@collectupto@loop@NEXT{%
+ \noexpand\endgroup
+ \noexpand\pgfmanualprettyprinterhandlecollectedargs{\the\t@pgfmanual@currentarg}%
+ \the\t@afterpgfmanualprettyprinterhandlecollected
+ }%
+ \else
+ \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}%
+ \fi
+ \else
+ \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \pgfmanual@pretty@collectupto@loop@NEXT
+}%
+
+\def\pgfmanual@pretty@collectargs@finish@cs#1{%
+ \def\pgfmanual@pretty@collectargs@finish@cs@hasargs{1}%
+ \ifnum\pgfmanualprettyprinternumcollectedargs=0
+ \ifpgfmanualprettyprinterarghasunmatchedbraces
+ \else
+ \def\pgfmanual@pretty@collectargs@finish@cs@hasargs{0}%
+ \fi
+ \fi
+ \if\pgfmanual@pretty@collectargs@finish@cs@hasargs1%
+ % report the macro and its arguments:
+ \pgfkeysifdefined{/codeexample/prettyprint/cs/\pgfmanual@loc@TMPa/.@cmd}{%
+ % oh, we have a separate routine for this macro! Ok, use it:
+ \edef\pgfmanual@loc@TMPb{\noexpand\pgfkeysvalueof{/codeexample/prettyprint/cs/\pgfmanual@loc@TMPa/.@cmd}}%
+ }{%
+ % use the generic routine:
+ \edef\pgfmanual@loc@TMPb{\noexpand\pgfkeysvalueof{/codeexample/prettyprint/cs with args/.@cmd}}%
+ }%
+ % re-insert the backslash:
+ \edef\pgfmanual@loc@TMPa{{\pgfmanual@pretty@backslash\pgfmanual@loc@TMPa}}%
+ \expandafter\pgfmanual@loc@TMPb\pgfmanual@loc@TMPa #1\pgfeov
+ \else
+ % Oh. We probably got |\pgfkeys| instead of |\pgfkeys{arg}|
+ % re-insert the backslash:
+ \edef\pgfmanual@loc@TMPa{{\pgfmanual@pretty@backslash\pgfmanual@loc@TMPa}}%
+ \edef\pgfmanual@loc@TMPb{\noexpand\pgfkeysvalueof{/codeexample/prettyprint/cs/.@cmd}}%
+ \expandafter\pgfmanual@loc@TMPb\pgfmanual@loc@TMPa\pgfeov
+ #1\relax% simply typeset any encountered tokens after the control sequence.
+ \fi
+}%
+
+% A user macro which pretty prints a set of keys.
+%
+% If '#1' is NOT an argument for \pgfkeys,
+% \pgfmanualprettyprintpgfkeys will try to recognise at least control
+% sequences (in the same way as usual). Thus, you can even use this
+% method if there *could* be pgfkeys arguments in an automated pretty
+% printing environment.
+%
+% However, '#1' should only have catcode 12 characters with the
+% exception of catcode 13 for newlines, spaces and comments.
+\long\def\pgfmanualprettyprintpgfkeys#1{%
+ \ifpgfmanualprettyenabled
+ \begingroup
+ \pgfmanualprettyprintstyles
+ \pgfmanual@pretty@pgfkeys@loop#1\pgfmanual@EOI
+ \endgroup
+ \else
+ #1%
+ \fi
+}
+
+\def\pgfmanual@pretty@pgfkeys{%
+ \let\pgfmanualprettyprinterhandlecollectedargs=\pgfmanual@pretty@pgfkeys@start
+ \pgfmanualprettyprintercollectupto]{\pgfmanual@pretty@mainloop}%%
+}%
+\long\def\pgfmanual@pretty@pgfkeys@start#1{%
+ [%
+ \pgfmanual@pretty@pgfkeys@loop#1\pgfmanual@EOI
+ ]%
+}%
+% iterates through single tokens, detecting key names and values while
+% it goes.
+\long\def\pgfmanual@pretty@pgfkeys@loop#1{%
+ \def\pgfmanual@loc@TMPa{#1}%
+ \ifx\pgfmanual@loc@TMPa\pgfmanual@EOI
+ \def\pgfmanual@pretty@pgfkeys@loop@NEXT{\relax}%
+ \else
+ \def\pgfmanual@pretty@pgfkeys@loop@NEXT{\pgfmanual@pretty@pgfkeys@loop}%
+ \ifpgfmanualprettycommentactive
+ #1%
+ \else
+ \ifnum13=\catcode`#1
+ % we found a white space (space, TAB or NL) or comment
+ #1%
+ \else
+ \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@comma%
+ %\let\pgfmanual@pretty@pgfkeys@loop@NEXT=\pgfmanual@pretty@pgfkeys@checkforEOI
+ ,%
+ \else
+ \ifnum10=\catcode`#1
+ % another white space... I thought they'd have
+ % catcode 13. doesn't matter.
+ #1%
+ \else
+ \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@lbrace
+ % braces may not occur in the first place -
+ % but there are circumstances where it is
+ % convenient to deal with them here (when
+ % processing arguments of styles)
+ % Do it.
+ #1%
+ \else
+ \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@rbrace
+ #1%
+ \else
+ % found the beginning of a key!
+ % We will collect the key name into
+ % \toks0.
+ \toks0={}%
+ %
+ % Handle it:
+ % FIXME what if we found an opening brace!?
+ \def\pgfmanual@pretty@pgfkeys@loop@NEXT{\pgfmanual@pretty@pgfkeys@collectkey #1}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \pgfmanual@pretty@pgfkeys@loop@NEXT
+}%
+\def\pgfmanual@pretty@pgfkeys@collectkey#1{%
+ \def\pgfmanual@loc@TMPb{#1}%
+ \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@pgfkeys@collectkey}%
+ \ifx\pgfmanual@loc@TMPb\pgfmanual@EOI
+ % finish key name.
+ \edef\pgfmanual@loc@TMPb{\the\toks0 }%
+ \ifx\pgfmanual@loc@TMPb\pgfutil@empty
+ \else
+ \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }%
+ \fi
+ \def\pgfmanual@pretty@pgfkeys@collectkey@next{\relax}%
+ \else
+ \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@eq
+ % finish key name.
+ \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }%
+ #1%
+ % now, we do the same with the value - we collect it into
+ % \toks0.
+ \toks0={}%
+ \def\pgfmanual@pretty@pgfkeys@collectvalue@hasconsumedspaces{0}%
+ \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@pgfkeys@collectvalue}%
+ \else
+ \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@comma
+ % finish key name.
+ \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }%
+ #1%
+ \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@pgfkeys@loop}%
+ \else
+ \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@activenl
+ % finish key name before newline. This is not
+ % necessarily as in TeX, but its simpler here
+ % because we don't need special cases for comments
+ % and we don't need to gobble following white
+ % spaces.
+ \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }%
+ #1%
+ \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@pgfkeys@loop}%
+ \else
+ \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@backslash
+ % This is confusing. I simply try to invoke
+ % the control sequence code and recover as
+ % good as possible. Let's see if that's
+ % useful.
+ \edef\pgfmanual@loc@TMPb{\the\toks0 }%
+ \ifx\pgfmanual@loc@TMPb\pgfutil@empty
+ \else
+ \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }%
+ \fi
+ %
+ % we found the start of a control sequence '\command':
+ %
+ % collect the control sequence name into
+ % \pgfmanual@loc@TMPa, but without the backslash:
+ \begingroup
+ \let\pgfmanual@loc@TMPa=\pgfutil@empty
+ \def\afterpgfmanual@pretty@cs{%
+ \endgroup
+ \pgfmanual@pretty@pgfkeys@loop
+ }%
+ \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@collectcs@loop}%
+ \else
+ \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@lbrace
+ % Braces in key names are allowed (if they
+ % are not the first character of a key
+ % name)
+ \def\pgfmanualprettyprinterhandlecollectedargs##1{%
+ \toks1={##1}%
+ \edef\pgfmanual@loc@TMPc{%
+ \the\toks0 \pgfmanual@pretty@lbrace \the\toks1
+ \ifpgfmanualprettyprinterarghasunmatchedbraces
+ \else
+ \pgfmanual@pretty@rbrace
+ \fi
+ }%
+ \toks0=\expandafter{\pgfmanual@loc@TMPc}%
+ }%
+ \def\pgfmanual@pretty@pgfkeys@collectkey@next{%
+ \pgfmanualprettyprintercollectargcount{1}{\pgfmanual@pretty@pgfkeys@collectkey}%
+ #1%
+ }%
+ \else
+ \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@rbrace
+ \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }%
+ #1%
+ \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@pgfkeys@loop}%
+ \else
+ \toks0=\expandafter{\the\toks0 #1}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \pgfmanual@pretty@pgfkeys@collectkey@next
+}%
+\def\pgfmanual@pretty@pgfkeys@collectvalue#1{%
+ \def\pgfmanual@loc@TMPb{#1}%
+ \let\pgfmanual@pretty@pgfkeys@collectvalue@next=\pgfmanual@pretty@pgfkeys@collectvalue
+ \ifx\pgfmanual@loc@TMPb\pgfmanual@EOI
+ % the key value is empty.
+ %\expandafter\pgfmanual@pretty@pgfkeys@processvalue\expandafter{\the\toks0 }%
+ \let\pgfmanual@pretty@pgfkeys@collectvalue@next=\relax
+ \else
+ \def\pgfmanual@pretty@isconsumed{0}%
+ \if\pgfmanual@pretty@pgfkeys@collectvalue@hasconsumedspaces0%
+ \ifnum13=\catcode`#1
+ % we found a white space (space, TAB or NL)
+ #1%
+ \def\pgfmanual@pretty@isconsumed{1}%
+ \else
+ \ifnum10=\catcode`#1
+ % another white space... I thought they'd have
+ % catcode 13. doesn't matter.
+ \def\pgfmanual@pretty@isconsumed{1}%
+ #1%
+ \fi
+ \fi
+ \fi
+ \if\pgfmanual@pretty@isconsumed0%
+ \def\pgfmanualprettyprinterhandlecollectedargs##1{\pgfmanual@pretty@pgfkeys@processvalue{##1}}% the braces will be handled separately.
+ \def\pgfmanual@pretty@pgfkeys@collectvalue@next{%
+ \pgfmanualprettyprintercollectupto,{\afterpgfmanual@pretty@collectargs@finish@value}#1%
+ }%
+ \fi
+ \fi
+ \pgfmanual@pretty@pgfkeys@collectvalue@next
+}%
+\def\afterpgfmanual@pretty@collectargs@finish@value{%
+ \pgfutil@ifnextchar\pgfmanual@EOI{%
+ \pgfmanual@pretty@pgfkeys@loop
+ }{%
+ \pgfmanual@pretty@pgfkeys@loop,% re-insert the gobbled comma here!
+ }%
+}%
+
+{\catcode`\^^M=13 \catcode`\ =13\relax\catcode`\%=13\relax\gdef\pgfmanual@pretty@restorespaces{\def%{\pgfmanual@pretty@percent}\def^^M{\pgfmanual@pretty@space}\def {\pgfmanual@pretty@space}}}
+
+% #1: the key's name
+\def\pgfmanual@pretty@pgfkeys@processkey#1{%
+ \begingroup
+ \pgfmanual@pretty@restorespaces
+ % remember this key name! It is used when we are dealing with
+ % its value later... (if it has a value)
+ \xdef\pgfmanual@pretty@pgfkeys@collectkey@keyname{#1}%
+ \endgroup
+ %
+ % check if it is a handled key. FIXME: this could be done in a
+ % rigorous way! This here assumes that all key handlers start with
+ % '.' and the '.' occurs never right after a '/' otherwise:
+ \def\pgfmanual@loc@TMPa{\pgfutil@in@{/.}}%
+ \expandafter\pgfmanual@loc@TMPa\expandafter{\pgfmanual@pretty@pgfkeys@collectkey@keyname}%
+ \ifpgfutil@in@
+ % split into key name and handler name...
+ \def\pgfmanual@pretty@splitit##1/.##2\relax{%
+ \def\pgfmanual@loc@TMPb{{##1}{.##2}}%
+ }%
+ \expandafter\pgfmanual@pretty@splitit\pgfmanual@pretty@pgfkeys@collectkey@keyname\relax
+ %
+ % report key name AND handler:
+ \def\pgfmanual@loc@TMPa{\pgfkeysvalueof{/codeexample/prettyprint/key name with handler/.@cmd}}%
+ \expandafter\pgfmanual@loc@TMPa\pgfmanual@loc@TMPb\pgfeov
+ \else
+ % report key name ...
+ \def\pgfmanual@loc@TMPa{\pgfkeysvalueof{/codeexample/prettyprint/key name/.@cmd}}%
+ \expandafter\pgfmanual@loc@TMPa\pgfmanual@pretty@pgfkeys@collectkey@keyname\pgfeov
+ \fi
+}
+\def\pgfmanual@pretty@pgfkeys@processvalue#1{%
+ % report or process the value, depending on the keyname.
+ % After all, it *may* be a style which needs to be pretty printed
+ % as well.
+ \pgfkeysifdefined{/codeexample/prettyprint/key value/\pgfmanual@pretty@pgfkeys@collectkey@keyname/.@cmd}{%
+ % oh, we have a separate routine for this macro! Ok, use it:
+ \edef\pgfmanual@loc@TMPb{\noexpand\pgfkeysvalueof{/codeexample/prettyprint/key value/\pgfmanual@pretty@pgfkeys@collectkey@keyname/.@cmd}}%
+ }{%
+ % use the generic routine:
+ \edef\pgfmanual@loc@TMPb{\noexpand\pgfkeysvalueof{/codeexample/prettyprint/key value/.@cmd}}%
+ }%
+ \edef\pgfmanual@loc@TMPa{{\pgfmanual@pretty@pgfkeys@collectkey@keyname}}%
+ \expandafter\pgfmanual@loc@TMPb\pgfmanual@loc@TMPa{#1}\pgfeov
+}
+
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 3d0cad1b196..67d2be8c72b 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
@@ -1,3 +1,23 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% 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: Di 29. Dez 22:11:16 CET 2009 %%%
+
+
+
% Copyright 2008 by Christian Feuersaenger
%
% This file may be distributed and/or modified
@@ -100,17 +120,48 @@
}
% The same as \pgfmathfloatparsenumber, but does not perform sanity checking.
-\def\pgfmathfloatqparsenumber#1{%
+% FIXME: there is no longer any difference here.
+\let\pgfmathfloatqparsenumber=\pgfmathfloatparsenumber
+
+% Takes a floating point number #1 as input and writes flags to count
+% register #2, mantisse to dimen register #3 and exponent to count
+% register #4.
+\def\pgfmathfloattoregisters#1#2#3#4{%
+ \expandafter\pgfmathfloat@decompose#1\relax{#2}{#3}{#4}%
+}
+
+% the same, but writes the mantisse into a token register.
+\def\pgfmathfloattoregisterstok#1#2#3#4{%
+ \expandafter\pgfmathfloat@decompose@tok#1\relax{#2}{#3}{#4}%
+}
+
+% Extracts the flags of #1 into the count register #2.
+\def\pgfmathfloatgetflags#1#2{%
+ \expandafter\pgfmathfloat@decompose@F#1\relax{#2}%
+}
+% Extracts the flags of #1 into the macro #2.
+\def\pgfmathfloatgetflagstomacro#1#2{%
\begingroup
- \edef\pgfmathresult{#1}%
- \expandafter\pgfflt@impl\pgfmathresult\pgfflt@EOI
- \ifpgfmathfloatparsenumberpendingperiod
- \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.0}%
- \fi
- \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
- \pgfmath@smuggleone\pgfmathresult
+ \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
+}%
+
+% Extracts the mantisse of #1 into the dimen register #2.
+\def\pgfmathfloatgetmantisse#1#2{%
+ \expandafter\pgfmathfloat@decompose@M#1\relax{#2}%
+}
+% Extracts the mantisse of #1 into the token register #2.
+\def\pgfmathfloatgetmantissetok#1#2{%
+ \expandafter\pgfmathfloat@decompose@Mtok#1\relax{#2}%
}
+% Extracts the exponent of #1 into the count register #2.
+\def\pgfmathfloatgetexponent#1#2{%
+ \expandafter\pgfmathfloat@decompose@E#1\relax{#2}%
+}
+
% Assigns \pgfmathresult to be a float encoded as
% <FLAGS><MANTISSE>e<EXPONENT>
@@ -121,8 +172,26 @@
% ->
% \pgfmathresult is now '12.0e10' regardless of the internal float
% format.
-\def\pgfmathfloat@to@FMeE@style#1{\expandafter\pgfmathfloat@to@FMeE@style@#1\relax}%
-\def\pgfmathfloat@to@FMeE@style@#1Y#2e#3]\relax{\def\pgfmathresult{#1#2e#3}}%
+\def\pgfmathfloat@to@FMeE@style#1{\expandafter\pgfmathfloat@to@FMeE@style@#1\relax\relax}%
+\def\pgfmathfloat@to@FMeE@style@#1#2{%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@to@FMeE@style@@%
+ \else
+ \expandafter\pgfmathfloat@to@FMeE@style@error%
+ \fi
+ #1#2%
+}%
+\def\pgfmathfloat@to@FMeE@style@@#1Y#2e#3]\relax\relax{\def\pgfmathresult{#1#2e#3}}%
+\def\pgfmathfloat@to@FMeE@style@error#1\relax\relax{%
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{%
+ \noexpand\pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ }%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
+}%
+
% decomposes a lowlevel floating point representation into flags,
% mantisse and exponent.
@@ -130,23 +199,131 @@
% #4: integer register for the flags.
% #5: dimen registers for the mantisse.
% #6: integer register for the exponent.
-\def\pgfmathfloat@decompose#1Y#2e#3]\relax#4#5#6{%
+%
+% \expandafter\pgfmathfloat@decompose\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@M\pgfmathfloat@a@E
+% -> the three temp registers contain flags, mantisse and exponent
+\def\pgfmathfloat@decompose#1#2{% sanitize!
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@decompose@%
+ \else
+ \expandafter\pgfmathfloat@decompose@error%
+ \fi
+ #1#2%
+}
+\def\pgfmathfloat@decompose@#1Y#2e#3]\relax#4#5#6{%
#4=#1\relax
- #5=#2pt%
+ #5=#2pt % keep space here.
#6=#3\relax%
}
+
% overloaded, #5 needs to be a token register for the mantisse.
-\def\pgfmathfloat@decompose@tok#1Y#2e#3]\relax#4#5#6{%
+% @see also \pgfmathfloatvalueof which does also employ the load
+% level repr.
+% \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+% -> the three temp registers contain flags, mantisse and exponent
+\def\pgfmathfloat@decompose@tok#1#2{%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@decompose@tok@%
+ \else
+ \expandafter\pgfmathfloat@decompose@tok@error%
+ \fi
+ #1#2%
+}%
+\def\pgfmathfloat@decompose@tok@#1Y#2e#3]\relax#4#5#6{%
#4=#1\relax
#5={#2}%
#6=#3\relax%
}
% overloaded, returns only ONE of the three components into #4:
-\def\pgfmathfloat@decompose@F#1Y#2e#3]\relax#4{#4=#1\relax}%
-\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}%
+% \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S
+% -> \pgfmathfloat@a@S contains the flags field.
+\def\pgfmathfloat@decompose@F#1#2{%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@decompose@F@%
+ \else
+ \expandafter\pgfmathfloat@decompose@F@error%
+ \fi
+ #1#2%
+}%
+\def\pgfmathfloat@decompose@M#1#2{%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@decompose@M@%
+ \else
+ \expandafter\pgfmathfloat@decompose@M@error%
+ \fi
+ #1#2%
+}%
+\def\pgfmathfloat@decompose@E#1#2{%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@decompose@E@%
+ \else
+ \expandafter\pgfmathfloat@decompose@E@error%
+ \fi
+ #1#2%
+}%
+\def\pgfmathfloat@decompose@Mtok#1#2{%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@decompose@Mtok@%
+ \else
+ \expandafter\pgfmathfloat@decompose@Mtok@error%
+ \fi
+ #1#2%
+}%
+\def\pgfmathfloat@decompose@F@#1Y#2e#3]\relax#4{#4=#1\relax}%
+\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}%
+\def\pgfmathfloat@decompose@error#1\relax#2#3#4{%
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{%
+ \noexpand#2=\the\pgfmathfloat@a@S\space
+ \noexpand#3=\the\pgfmathfloat@a@Mtok pt
+ \noexpand#4=\the\pgfmathfloat@a@E\space
+ }%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
+}%
+\def\pgfmathfloat@decompose@tok@error#1\relax#2#3#4{%
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{%
+ \noexpand#2=\the\pgfmathfloat@a@S\space
+ \noexpand#3={\the\pgfmathfloat@a@Mtok}%
+ \noexpand#4=\the\pgfmathfloat@a@E\space
+ }%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
+}%
+\def\pgfmathfloat@decompose@F@error#1\relax#2{%
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{\noexpand#2=\the\pgfmathfloat@a@S\space}%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
+}%
+\def\pgfmathfloat@decompose@M@error#1\relax#2{%
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{\noexpand#2=\the\pgfmathfloat@a@Mtok pt }%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
+}%
+\def\pgfmathfloat@decompose@Mtok@error#1\relax#2{%
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{\noexpand#2={\the\pgfmathfloat@a@Mtok}}%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
+}%
+\def\pgfmathfloat@decompose@E@error#1\relax#2{%
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{\noexpand#2=\the\pgfmathfloat@a@E\space}%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
+}%
% Takes a floating point number #1 as input and writes flags to macro
% #2, mantisse to macro #3 and exponent to macro #4.
\def\pgfmathfloattomacro#1#2#3#4{%
@@ -161,34 +338,6 @@
\pgfmathfloat@glob@TMP
}
-% Takes a floating point number #1 as input and writes flags to count
-% register #2, mantisse to dimen register #3 and exponent to count
-% register #4.
-\def\pgfmathfloattoregisters#1#2#3#4{%
- \expandafter\pgfmathfloat@decompose#1\relax{#2}{#3}{#4}%
-}
-
-% the same, but writes the mantisse into a token register.
-\def\pgfmathfloattoregisterstok#1#2#3#4{%
- \expandafter\pgfmathfloat@decompose@tok#1\relax{#2}{#3}{#4}%
-}
-
-% Extracts the flags of #1 into the count register #2.
-\def\pgfmathfloatgetflags#1#2{%
- \expandafter\pgfmathfloat@decompose@F#1\relax{#2}%
-}
-% Extracts the mantisse of #1 into the dimen register #2.
-\def\pgfmathfloatgetmantisse#1#2{%
- \expandafter\pgfmathfloat@decompose@M#1\relax{#2}%
-}
-% Extracts the mantisse of #1 into the token register #2.
-\def\pgfmathfloatgetmantissetok#1#2{%
- \expandafter\pgfmathfloat@decompose@Mtok#1\relax{#2}%
-}
-% Extracts the exponent of #1 into the count register #2.
-\def\pgfmathfloatgetexponent#1#2{%
- \expandafter\pgfmathfloat@decompose@E#1\relax{#2}%
-}
% Defines \pgfmathresult as the floating point number encoded by
% the flags #1, mantisse #2 and exponent #3.
@@ -250,6 +399,23 @@
}%
\let\pgfmathfloattosci=\pgfmathfloattosci@
+% Expands a floating point number to scientific format 1.234e5.
+%
+% This operation is very fast.
+\def\pgfmathfloatvalueof#1{\expandafter\pgfmathfloatvalueof@@#1\relax}%
+\def\pgfmathfloatvalueof@@#1Y#2e#3]\relax{%
+ \ifcase#1 %
+ 0.0e0%
+ \or
+ #2e#3%
+ \or
+ -#2e#3%
+ \or nan%
+ \or inf%
+ \or -inf%
+ \fi
+}%
+
% Rounds a fixed point number #1 to \pgfmathfloat@round@precision digits precision and returns
% the result into \pgfmathresult.
@@ -1489,14 +1655,29 @@
/pgf/fpu/handlers/empty number/.style 2 args={%
/pgf/fpu/handlers/invalid number={#1}{#2}%
},
+ /pgf/fpu/empty number is zero/.style={%
+ /pgf/fpu/handlers/empty number/.code 2 args={%
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ }%
+ },%
/pgf/fpu/handlers/invalid number/.code 2 args={%
\pgfmath@error{Could not parse input '#1' as a floating point number, sorry. The unreadable part was near '#2'.}{}%
},
+ /pgf/fpu/handlers/wrong lowlevel format/.code 2 args={%
+ \pgfmath@error{Sorry, an internal routine of the floating point unit got an ill-formatted floating point number `#1'. The unreadable part was near '#2'.}{}%
+ \let\pgfmathresult=\pgfutil@empty
+ },
}
% #1 the error handler
% #2 the number which was invalid.
% #3 the part which produced the error
+%
+% POSTCONDITION: the three registers
+% \pgfmathfloat@a@S
+% \pgfmathfloat@a@Mtok
+% \pgfmathfloat@a@E
+% will contain the number which results from the error handler.
\def\pgfmathfloatparsenumber@handleerror#1#2#3{%
\let\pgfmathresult=\pgfutil@empty
\pgfmathfloatparsenumberpendingperiodfalse
@@ -1545,45 +1726,47 @@
\pgfmathfloatparsenumberpendingperiodtrue
\pgfflt@positiveexp}%
\expandafter\def\csname pgffltA@n\endcsname{\pgfflt@readnan}% FIXME: inlining?
-\expandafter\def\csname pgffltA@N\endcsname{\pgfflt@readNaN}% FIXME: inlining?
+\expandafter\def\csname pgffltA@N\endcsname{\pgfflt@readnan}% FIXME: inlining?
\expandafter\def\csname pgffltA@i\endcsname{\pgfflt@readinf}% FIXME: inlining?
-\expandafter\def\csname pgffltA@I\endcsname{\pgfflt@readINF}% FIXME: inlining?
+\expandafter\def\csname pgffltA@I\endcsname{\pgfflt@readinf}% FIXME: inlining?
+\expandafter\def\csname pgffltA@.\endcsname{% read '.9' like '0.9'
+ \pgfmathfloat@a@E=-1
+ \pgfflt@leadingzero@foundperiod}%
\def\pgfflt@finish#1\pgfflt@EOI{}
-\def\pgfflt@readnan an{%
- \pgfmathfloat@a@S=3\relax%
- \pgfmathfloat@a@Mtok={0.0}%
- \pgfmathfloat@a@E=0%
- \pgfflt@finish
-}
-\def\pgfflt@readNaN aN{%
- \pgfmathfloat@a@S=3\relax%
- \pgfmathfloat@a@Mtok={0.0}%
- \pgfmathfloat@a@E=0%
- \pgfflt@finish
-}
-\def\pgfflt@readinf nf{%
- \ifnum\pgfmathfloat@a@S=1
- \pgfmathfloat@a@S=4\relax%
+\def\pgfflt@readnan #1#2{%
+ \def\pgfflt@readnan@ok{1}%
+ \if#1a\else\if#1A\else\def\pgfflt@readnan@ok{0}\fi\fi
+ \if#2n\else\if#2N\else\def\pgfflt@readnan@ok{0}\fi\fi
+ \if\pgfflt@readnan@ok1%
+ \pgfmathfloat@a@S=3\relax%
\pgfmathfloat@a@Mtok={0.0}%
+ \pgfmathfloat@a@E=0%
+ \expandafter\pgfflt@finish
\else
- \pgfmathfloat@a@S=5\relax%
- \pgfmathfloat@a@Mtok={0.0}%
+ \def\pgfflt@readnan@{\pgfflt@error #1#2}%
+ \expandafter\pgfflt@readnan@
\fi
- \pgfmathfloat@a@E=0%
- \pgfflt@finish
}
-\def\pgfflt@readINF NF{%
- \ifnum\pgfmathfloat@a@S=1
- \pgfmathfloat@a@S=4\relax%
- \pgfmathfloat@a@Mtok={0.0}%
+\def\pgfflt@readinf #1#2{%
+ \def\pgfflt@readinf@ok{1}%
+ \if#1n\else\if#1N\else\def\pgfflt@readinf@ok{0}\fi\fi
+ \if#2f\else\if#2F\else\def\pgfflt@readinf@ok{0}\fi\fi
+ \if\pgfflt@readinf@ok1%
+ \ifnum\pgfmathfloat@a@S=1 %
+ \pgfmathfloat@a@S=4 %
+ \pgfmathfloat@a@Mtok={0.0}%
+ \else
+ \pgfmathfloat@a@S=5 %
+ \pgfmathfloat@a@Mtok={0.0}%
+ \fi
+ \pgfmathfloat@a@E=0 %
+ \expandafter\pgfflt@finish
\else
- \pgfmathfloat@a@S=5\relax%
- \pgfmathfloat@a@Mtok={0.0}%
+ \def\pgfflt@readinf@{\pgfflt@error #1#2}%
+ \expandafter\pgfflt@readinf@
\fi
- \pgfmathfloat@a@E=0%
- \pgfflt@finish
}
\def\pgfflt@leadingzero#1{%
\expandafter\ifx\csname pgffltB@#1\endcsname\relax
@@ -1693,7 +1876,19 @@
}%
\def\pgfflt@readexponent#1\pgfflt@EOI{%
- \advance\pgfmathfloat@a@E by#1\relax
+ \afterassignment\pgfflt@readexponent@
+ \pgfmathfloat@b@E=#1\relax\pgfflt@EOI
+}
+\def\pgfflt@readexponent@{%
+ \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
+ \else
+ \def\pgfmathfloat@loc@TMPb{\pgfflt@error#1\pgfflt@EOI}%
+ \expandafter\pgfmathfloat@loc@TMPb
+ \fi
}
\def\pgfflt@pendingzeros@positiveexp#1{%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty
new file mode 100644
index 00000000000..eefc385245e
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty
@@ -0,0 +1,127 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% 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: Di 29. Dez 22:11:16 CET 2009 %%%
+
+
+
+% Copyright 2008 by Christian Feuersaenger
+%
+% 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.
+%
+% In addition to the above licenses, this particular file may also be
+% directly inlined into other documents and this copyright notice may
+% be removed. Additionally, when you inline this file, you may modify
+% it as needed and you may remove comments.
+%
+% This file is intended to be distributed or even inlined into a file
+% when a document needs to be typeset on a system that does not have
+% pgf/TikZ installed.
+%
+% It replaces \tikzpicture/ \endtikzpicture and \tikz and invokes the
+% \includegraphics with the correct file name instead.
+
+\RequirePackage{graphicx}
+
+\toksdef\t@tikzexternal@tmpa=0
+\toksdef\t@tikzexternal@tmpb=1
+
+\def\tikzexternalize{\@ifnextchar[{\tikzexternalize@opt}{\tikzexternalize@opt[]}}%
+\def\tikzexternalize@opt[#1]#2{\def\tikzexternal@realjob{#2}}
+
+\def\tikzsetnextfilename#1{\gdef\tikzexternal@nextfile{#1}}
+\def\tikzsetexternalprefix#1{\def\tikzexternal@filenameprefix{#1}}
+\def\tikzsetfigurename#1{\def\tikzexternal@figurename{#1}}%
+\tikzsetnextfilename{}
+\tikzsetexternalprefix{}
+\tikzsetfigurename{\tikzexternal@realjob-figure}%
+
+\long\def\tikzpicture#1\end#2{% collect every thing up to \end{tikzpicture}
+ \def\tikzexternal@laTeX@collectpicture@@{#2}%
+ \ifx\tikzexternal@laTeX@collectpicture@@\tikzexternal@laTeX@tikzpicturestring
+ \tikzexternal@image
+ \end{tikzpicture}%
+ \else
+ \expandafter
+ \tikzpicture
+ \fi
+}%
+\def\endtikzpicture{}
+\def\tikzexternal@laTeX@tikzpicturestring{tikzpicture}%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Replacement for \tikz short command:
+\def\tikz{\@ifnextchar[{\tikz@opt}{\tikz@opt[]}}
+\def\tikz@opt[#1]{\@ifnextchar\bgroup{\tikz@opt@{#1}}{\tikz@opt@@{#1}}}
+\def\tikz@opt@#1#2{\tikz@opt@process{#1}{#2}}
+\def\tikz@opt@@#1{%
+ \def\tikz@next{\tikz@collectnormalsemicolon{#1}}%
+ \ifnum\the\catcode`\;=\active\relax%
+ \def\tikz@next{\tikz@collectactivesemicolon{#1}}%
+ \fi%
+ \tikz@next}
+\def\tikz@collectnormalsemicolon#1#2;{\tikz@opt@process{#1}{#2;}}
+{
+ \catcode`\;=\active
+ \gdef\tikz@collectactivesemicolon#1#2;{%
+ \tikz@opt@process{#1}{#2;}%
+ }
+}
+\def\tikz@opt@process#1#2{\tikzexternal@image}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\def\tikzexternal@image{%
+ \leavevmode
+ \begingroup
+ \t@tikzexternal@tmpa=\expandafter{\tikzexternal@filenameprefix}%
+ \ifx\tikzexternal@nextfile\empty
+ \expandafter\ifx\csname c@tikzext@no@\tikzexternal@figurename\endcsname\relax
+ \expandafter\gdef\csname c@tikzext@no@\tikzexternal@figurename\endcsname{0}%
+ \fi
+ \t@tikzexternal@tmpb=\expandafter{\tikzexternal@figurename}%
+ \count0=\csname c@tikzext@no@\tikzexternal@figurename\endcsname
+ \xdef\tikzexternal@curfilename{\the\t@tikzexternal@tmpa\the\t@tikzexternal@tmpb\the\count0 }%
+ \advance\count0 by1\relax
+ \expandafter\xdef\csname c@tikzext@no@\tikzexternal@figurename\endcsname{\the\count0 }%
+ \else
+ \t@tikzexternal@tmpb=\expandafter{\tikzexternal@nextfile}%
+ \xdef\tikzexternal@curfilename{\the\t@tikzexternal@tmpa\the\t@tikzexternal@tmpb}%
+ \fi
+ \endgroup
+ \global\let\tikzexternal@nextfile=\empty
+ \tikzexternalimage\tikzexternal@curfilename
+}%
+\def\tikzexternalimage#1{%
+ % now check for (optional) .dpth files for the 'baseline' option:
+ \begingroup
+ \setbox1=\hbox{\includegraphics{#1}}%
+ \openin1=#1.dpth
+ \ifeof1 \box1
+ \else
+ \read1 to\pgfincludeexternalgraphics@dp \closein1
+ \dimen0=\pgfincludeexternalgraphics@dp\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}}
+
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
new file mode 100644
index 00000000000..1993db33660
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternalshared.code.tex
@@ -0,0 +1,1031 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% 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: Di 29. Dez 22:11:16 CET 2009 %%%
+
+
+
+% Copyright 2008 by Christian Feuersaenger
+%
+% 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.
+%
+% ******************************
+% This here is the shared implementation of TeX-dialect specific files
+% tikzlibraryexternal.code.tex
+% ******************************
+%
+%
+% This file provides a high-level automatic export feature for tikz pictures.
+% It allows to export EACH SINGLE FIGURE into a separate PDF.
+%
+% The simplest way is to use the 'convert with system call' option; it simply converts every figure using the write18 method. If that is not possible, a list of figure file names is generated and you need to generate these figures manually (or with a script).
+%
+%
+% It replaces \tikzpicture/ \endtikzpicture and \tikz and invokes \beginpgfgraphicnamed ... \endpgfgraphicnamed
+% commands if necessary.
+
+% handle with extreme care and only in small, local groups:
+\toksdef\t@tikzexternal@tmpa=0
+\toksdef\t@tikzexternal@tmpb=1
+
+\newwrite\tikzexternal@outfile
+\newif\iftikzexternal@nestedflag
+\newif\iftikzexternal@verboseio
+\newif\iftikzexternal@genfigurelist
+\newif\iftikzexternal@onlynamed
+\newif\iftikzexternal@file@isuptodate
+\newif\iftikzexternal@force@remake
+\newif\iftikzexternal@optimize
+\newif\iftikzexternal@export@enabled
+\tikzexternal@export@enabledtrue
+
+% This 'if' can be used as part of the public user interface.
+%
+% It is set by the 'remake next' key.
+%
+% It disables any up-to-date checks for the *next* picture, forcing a
+% remake of it.
+%
+% It applies only to *one* picture.
+\newif\iftikzexternalremakenext
+\newif\iftikzexternal@verbose@optimize
+\tikzexternal@verbose@optimizetrue
+
+% A global boolean which can be used to skip single figures.
+\newif\iftikzexternalexportnext
+\tikzexternalexportnexttrue
+
+% Invokes '#1' if the external lib is currently externalizing
+% something and '#2' if not.
+%
+% This command must be called *after* \tikzexternalize.
+\def\tikzifexternalizing#1#2{%
+ \ifpgf@external@grabshipout #1\else #2\fi
+}%
+% Invokes '#1' if the external lib is currently externalizing the NEXT FOLLOWING
+% tikzpicture. It invokes '#2' if that is not the case.
+\def\tikzifexternalizingnext#1#2{%
+ \ifpgf@external@grabshipout
+ \tikzexternalgetnextfilename\tikzexternal@temp
+ \tikzifexternaljobnamematches\tikzexternal@temp{#1}{#2}%
+ \else
+ #2
+ \fi
+}%
+
+% Invokes '#2' if \jobname equals '#1' and '#3' if not.
+% I suppose that '#1' is a macro containing the file name.
+%
+\def\tikzifexternaljobnamematches#1#2#3{%
+ \edef\pgf@tempa{\expandafter\string\csname#1\endcsname}%
+ \edef\pgf@tempb{\expandafter\string\csname\jobname\endcsname}%
+ \ifx\pgf@tempa\pgf@tempb #2\else#3 \fi%
+}%
+
+\pgfqkeys{/tikz/external}{
+ figure list/.is if=tikzexternal@genfigurelist,
+ figure list=true,
+ % 'mode' applies only if \jobname==real job name.
+ mode/.is choice,
+ mode/only graphics/.code = {\def\tikzexternal@opmode{0}},
+ mode/no graphics/.code = {\def\tikzexternal@opmode{1}},
+ % an alias for 'no graphics:'
+ mode/only pictures/.code = {\def\tikzexternal@opmode{1}},
+ mode/graphics if exists/.code= {\def\tikzexternal@opmode{2}},
+ mode/list only/.code = {\def\tikzexternal@opmode{3}\tikzexternal@genfigurelisttrue},
+ mode/convert with system call/.code={\def\tikzexternal@opmode{4}\tikzexternal@genfigurelistfalse},
+ mode/list and make/.code = {\def\tikzexternal@opmode{5}\tikzexternal@genfigurelisttrue},
+ mode=convert with system call,
+ system call/.initial={pdflatex -shell-escape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"},
+% system call/.initial={pdflatex -interaction=batchmode -jobname '\image' '\texsource'; pdftops -eps \image.pdf},
+ force remake/.is if=tikzexternal@force@remake,
+ force remake/.default=true,
+ export next/.is if=tikzexternalexportnext,
+ export/.is if=tikzexternal@export@enabled,
+ remake next/.is if=tikzexternalremakenext,
+ remake next/.default=true,
+ verbose IO/.is if=tikzexternal@verboseio,
+ verbose IO/.default=true,
+ verbose IO=true,
+ verbose optimize/.is if=tikzexternal@verbose@optimize,
+ optimize/.is choice,
+ optimize/true/.code={%
+ \tikzexternal@optimizetrue
+ \iftikzexternal@optimize
+ \ifpgf@external@grabshipout
+ % we have already started the externalization! Install
+ % optimization commands to activate the new one:
+ \tikzexternal@optimize@REPLACE
+ \fi
+ \fi
+ },
+ optimize/false/.code={%
+ \tikzexternal@optimizefalse%
+ \tikzexternal@optimize@RESTORE
+ },%
+ optimize=true,
+ optimize/install/.code={},%
+ optimize/restore/.code={},%
+ % Expects two arguments, the command name and (optionally) a count
+ % of expected arguments.
+ % Example:
+ % 'optimize command away=\includegraphics'
+ % 'optimize command away={\mycommand}{3}'
+ %
+ % It accepts commands which have '[]' arguments and whose first
+ % argument always begins with '{'.
+ %
+ % #1: the command name
+ % #2: either empty or a number of EXPECTED arguments. It will be checked
+ % for one optional argument in square brackets as well.
+ optimize command away/.code 2 args={%
+ \expandafter\global\expandafter\let\csname\string#1@ORIG\endcsname=#1%
+ \pgfkeysalso{%
+ /tikz/external/optimize/install/.append code={%
+ \def#1{\tikzexternal@optimize@away@cmd{#1}{#2}}%
+ },
+ /tikz/external/optimize/restore/.append code={%
+ \expandafter\let\expandafter#1\csname\string#1@ORIG\endcsname
+ }
+ }%
+ \iftikzexternal@optimize
+ \ifpgf@external@grabshipout
+ % we have already started the externalization! Install
+ % optimization commands to activate the new one:
+ \tikzexternal@optimize@REPLACE
+ \fi
+ \fi
+ },
+ optimize command away=\includegraphics,
+ % EXPERIMENTAL (UNTESTED):
+ optimize latex env away/.code={%
+ \expandafter\let\expandafter\pgf@tempa\csname #1\endcsname
+ \expandafter\global\expandafter\let\csname #1@ORIG\endcsname=\pgf@tempa%
+ \pgfkeysalso{%
+ /tikz/external/optimize/install/.append code={%
+ \pgfutil@namedef{#1}{\tikzexternal@optimize@away@latex@env{#1}}%
+ },
+ /tikz/external/optimize/restore/.append code={%
+ \pgfutil@namelet{#1}{#1@ORIG}%
+ }%
+ }%
+ },
+ only named/.is if=tikzexternal@onlynamed,
+ only named/.default=true,
+ figure name/.initial=\tikzexternal@realjob-figure,
+ reset counter/.code={%
+ \expandafter\gdef\csname c@tikzext@no@#1\endcsname{0}%
+ },%
+ prefix/.code={\tikzsetexternalprefix{#1}},
+}
+
+\def\tikzsetfigurename#1{\pgfkeyssetvalue{/tikz/external/figure name}{#1}}%
+
+% This method sets the file name prefix used for every import/export.
+%
+% It is invoked by the '/tikz/external/prefix' key.
+\def\tikzsetexternalprefix#1{\def\tikzexternal@filenameprefix{#1}}
+\tikzsetexternalprefix{}
+
+% This method initialises automatic externalization.
+%
+% The first argument is the job's real name, without suffix.
+%
+% \tikzexternalize{myarticle}
+%
+% Doing so will
+% 1. automatically surround EVERY tikzpicture by \beginpgfgraphicnamed % sections.
+% 2. in case that the job's real name and the current \jobname differ,
+% it will process ONLY the matching tikzpicture.
+\def\tikzexternalize{%
+ \pgfutil@ifnextchar[{%
+ \tikzexternalize@opt
+ }{%
+ \tikzexternalize@opt[]%
+ }%
+}%
+\def\tikzexternalize@hasbeencalled{0}%
+\def\tikzexternalize@opt[#1]#2{%
+ \pgfqkeys{/tikz/external}{#1}%
+ \def\tikzexternal@realjob{#2}%
+ \pgfrealjobname{#2}%
+ \def\tikzexternalize@hasbeencalled{1}%
+ \tikzexternalenable
+ \def\tikzexternal@determineimgextension##1:##2\relax{\gdef\tikzexternal@imgext{##1}}%
+ \xdef\pgf@tempa{\pgfsys@imagesuffixlist}%
+ \expandafter\tikzexternal@determineimgextension\pgf@tempa\relax
+ \pgfutil@ifundefined{includegraphics}{%
+ \let\tikzexternal@orig@includegraphics=\relax
+ }{%
+ \let\tikzexternal@orig@includegraphics=\includegraphics
+ }%
+}
+
+% can be used to (temporarily) disable the externalization.
+\def\tikzexternaldisable{%
+ \let\tikz=\tikzexternal@origtikz
+ \tikzexternal@TEXDIALECT@restore@picture
+ \pgfutil@ifundefined{tikzexternal@orig@tikzfadingfrompicture}
+ {}% NOP
+ {%
+ \let\tikzfadingfrompicture=\tikzexternal@orig@tikzfadingfrompicture
+ \let\endtikzfadingfrompicture=\tikzexternal@orig@endtikzfadingfrompicture
+ \let\tikzfading=\tikzexternal@orig@tikzfading
+ }%
+ \iftikzexternal@optimize
+ \ifpgf@external@grabshipout
+ \tikzexternal@optimize@RESTORE
+ \fi
+ \fi
+}%
+% re-enables externalization after a \tikzexternalizedisable.
+\def\tikzexternalenable{%
+ \if\tikzexternalize@hasbeencalled1%
+ \let\tikz=\tikzexternal@tikz@replacement
+ \tikzexternal@TEXDIALECT@installreplacement@picture
+ \pgfutil@ifundefined{tikzfadingfrompicture}%
+ {}% no special handling for 'fading lib'
+ {%
+ % oh, ok -- patch fading lib!
+ \pgfutil@ifundefined{tikzexternal@orig@tikzfadingfrompicture}{%
+ \let\tikzexternal@orig@tikzfadingfrompicture=\tikzfadingfrompicture
+ \let\tikzexternal@orig@endtikzfadingfrompicture=\endtikzfadingfrompicture
+ \let\tikzexternal@orig@tikzfading=\tikzfading
+ }{}%
+ \def\tikzfadingfrompicture{%
+ \begingroup
+ \tikzexternaldisable
+ \tikzexternal@orig@tikzfadingfrompicture}%
+ \def\endtikzfadingfrompicture{%
+ \tikzexternal@orig@endtikzfadingfrompicture
+ \endgroup}%
+ \def\tikzfading[##1]{%
+ \begingroup
+ \tikzexternaldisable
+ \tikzexternal@orig@tikzfading[##1]%
+ \endgroup}%
+ }%
+ \iftikzexternal@optimize
+ \ifpgf@external@grabshipout
+ \tikzexternal@optimize@REPLACE
+ \fi
+ \fi
+ \fi
+}%
+
+% Sets the filename for the next tikzpicture or \tikz shortcommand.
+%
+% It will *only* be used for the next picture.
+%
+% If you don't call \tikzsetnextfilename for a picture, a file name
+% will be assembled automatically.
+%
+% Please note that the global file prefix will be prepended anyway.
+\def\tikzsetnextfilename#1{\gdef\tikzexternal@nextfile{#1}}
+\tikzsetnextfilename{}
+
+
+% These are few TeX dialect-specific commands which need to be overriden when used with
+% something different than plain TeX:
+%
+% 1. this command collects a complete image into a macro, up to (but not including) the
+% final TeX-dialect specific end-image command.
+% This is really difficult for LaTeX because \end{tikzpicture} either involves dirty
+% catcode-hacks to parse the braces or an ugly loop which loops until it
+% finds \end followed by {tikzpicture}.
+%
+% #1: a macro which will be called with the collected environment contents.
+% all following tokens: the environment contents.
+\long\gdef\tikzexternal@TEXDIALECT@collectpicture#1#2\endtikzpicture{#1{#2}}
+%
+% 2. the following commands should expand to the TeX-dialect specific begin and end image command, i.e.
+% \tikzpicture / \endtikzpicture
+% or
+% \begin{tikzpicture} / \end{tikzpicture}
+% or
+% \starttikzpicture / \stoptikzpicture
+\def\tikzexternal@TEXDIALECT@begpicture{\tikzpicture}
+\def\tikzexternal@TEXDIALECT@endpicture{\endtikzpicture}%
+%
+% 3. This installs the replacement macros:
+\def\tikzexternal@TEXDIALECT@installreplacement@picture{%
+ \let\tikzpicture=\tikzexternal@tikzpicture@replacement
+}%
+\def\tikzexternal@TEXDIALECT@restore@picture{%
+ \let\tikzpicture=\tikzexternal@origpicture
+}%
+
+
+
+
+\let\tikzexternal@origtikz=\tikz
+\let\tikzexternal@origpicture=\tikzpicture
+\let\tikzexternal@origendpicture=\endtikzpicture
+
+% Replacement for '\tikzpicture'.
+%
+% There are two different states in which this method is applied:
+% - normal typesetting. Then, the 'mode' key controls its behavior.
+% - externalize mode (i.e. jobname != real job name). Then, it will
+% externalize the picture selected by 'jobname' (and only this picture).
+\def\tikzexternal@tikzpicture@replacement{%
+ \leavevmode
+ \tikzexternal@getnextfilename\tikzexternal@curfilename
+ \ifx\tikzexternal@curfilename\pgfutil@empty
+ \ifpgf@external@grabshipout
+ % This picture won't be externalized.
+ % But maybe we can optimize it away:
+ \iftikzexternal@optimize
+ % -> it won't be shipped out anyway, so save typesetting time!
+ \let\tikzexternal@next=\tikzexternal@skipfigure
+ \else
+ % include this graphics into the output (even if
+ % it will be discarded anyway).
+ \let\tikzexternal@next=\tikzexternal@normalpicture@nographics
+ \fi
+ \else
+ \let\tikzexternal@next=\tikzexternal@normalpicture@nographics
+ \fi
+ \else
+ \ifpgf@external@grabshipout
+ \tikzifexternaljobnamematches\tikzexternal@curfilename{%
+ % ok, this here IS the picture for which
+ % pdflatex --jobname <my name>
+ % has been invoked.
+ \let\tikzexternal@next=\tikzexternal@externalizefig
+ }{%
+ \iftikzexternal@optimize
+ % No, another picture should be exported. Simply skip this one
+ % -> it won't be shipped out anyway, so save typesetting time!
+ \let\tikzexternal@next=\tikzexternal@skipfigure
+ \else
+ % include this graphics into the output (even it
+ % it will be discarded anyway).
+ \let\tikzexternal@next=\tikzexternal@normalpicture@nographics
+ \fi
+ }%
+ \else
+ \ifcase\tikzexternal@opmode\relax
+ % 'mode=only graphics'
+ \let\tikzexternal@next=\tikzexternal@forcegraphics
+ \or
+ % 'mode=no graphics'
+ \let\tikzexternal@next=\tikzexternal@normalpicture@nographics
+ \or
+ % 'mode=graphics if exists'
+ \let\tikzexternal@next=\tikzexternal@externalizefig
+ \or
+ % 'mode=list only'
+ \let\tikzexternal@next=\tikzexternal@listmodepicture
+ \or
+ % 'mode=convert with system call'
+ \let\tikzexternal@next=\tikzexternal@externalizefig@systemcall
+ \or
+ % 'mode=list and make'
+ \let\tikzexternal@next=\tikzexternal@list@and@makefile@mode@picture
+ \fi
+ \fi
+ \fi
+ \tikzexternal@next
+}%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Replacement for \tikz short command:
+\def\tikzexternal@tikz@replacement{%
+ \pgfutil@ifnextchar[{\tikzexternal@tikz@replacement@opt}{\tikzexternal@tikz@replacement@opt[]}%
+}%
+\def\tikzexternal@tikz@replacement@opt[#1]{%
+ \pgfutil@ifnextchar\bgroup{\tikzexternal@tikz@replacement@opt@{#1}}{\tikzexternal@tikz@replacement@opt@@{#1}}%
+}
+\long\def\tikzexternal@tikz@replacement@opt@#1#2{%
+ \tikzexternal@tikz@replacement@opt@process{#1}{#2}%
+}%
+\def\tikzexternal@tikz@replacement@opt@@#1{%
+ \def\tikz@next{\tikzexternal@tikz@replacement@collectnormalsemicolon{#1}}%
+ \ifnum\the\catcode`\;=\active\relax%
+ \def\tikz@next{\tikzexternal@tikz@replacement@collectactivesemicolon{#1}}%
+ \fi%
+ \tikz@next}
+\long\def\tikzexternal@tikz@replacement@collectnormalsemicolon#1#2;{%
+ \tikzexternal@tikz@replacement@opt@process{#1}{#2;}%
+}%
+{
+ \catcode`\;=\active
+ \long\gdef\tikzexternal@tikz@replacement@collectactivesemicolon#1#2;{%
+ \tikzexternal@tikz@replacement@opt@process{#1}{#2;}%
+ }
+}
+\long\def\tikzexternal@tikz@replacement@opt@process#1#2{%
+ \begingroup
+ \t@tikzexternal@tmpa=\expandafter{\tikzexternal@TEXDIALECT@begpicture[#1]#2}%
+ \t@tikzexternal@tmpb=\expandafter{\tikzexternal@TEXDIALECT@endpicture}%
+ \xdef\pgf@tempa{\the\t@tikzexternal@tmpa\the\t@tikzexternal@tmpb}%
+ \endgroup
+ \pgf@tempa
+}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\def\tikzexternal@getnextfilename@advancecount{%
+ \begingroup
+ \c@pgf@counta=\csname c@tikzext@no@\tikzexternal@figurename\endcsname\relax
+ \advance\c@pgf@counta by1
+ \expandafter\xdef\csname c@tikzext@no@\tikzexternal@figurename\endcsname{\the\c@pgf@counta}%
+ \endgroup
+}%
+
+% Returns the file name which will be used for the next tikzpicture (based on the currently available information only, of course).
+\def\tikzexternalgetnextfilename#1{%
+ \begingroup
+ \let\tikzexternal@getnextfilename@advancecount\relax% NOP
+ \tikzexternal@getnextfilename#1%
+ \pgfmath@smuggleone#1%
+ \endgroup
+}%
+
+% Fills #1 with a filename for the current picture.
+%
+% The filename will be generated automatically by appending '-figure<number>' to the real jobname.
+%
+% This method deals with
+% - \tikzsetnextfilename
+% - \tikzexternalexportnextfalse
+%
+% It returns #1={} if the current figure shall NOT be exported.
+%
+% Please note that both, \tikzsetnextfilename and \tikzexternalexportnextfalse
+% affect only ONE picture. They will be reset afterwards.
+\def\tikzexternal@getnextfilename#1{%
+ \let#1=\pgfutil@empty
+ % determine next file name:
+ \iftikzexternal@export@enabled
+ \iftikzexternalexportnext
+ \begingroup
+ \t@tikzexternal@tmpa=\expandafter{\tikzexternal@filenameprefix}%
+ \ifx\tikzexternal@nextfile\pgfutil@empty
+ \iftikzexternal@onlynamed
+ \xdef\pgf@tempa{}%
+ \else
+ \pgfkeysgetvalue{/tikz/external/figure name}\tikzexternal@figurename
+ \pgfutil@ifundefined{c@tikzext@no@\tikzexternal@figurename}{%
+ % initialise on first usage:
+ \expandafter\gdef\csname c@tikzext@no@\tikzexternal@figurename\endcsname{0}%
+ }{}%
+ \t@tikzexternal@tmpb=\expandafter{\tikzexternal@figurename}%
+ \xdef\pgf@tempa{\the\t@tikzexternal@tmpa\the\t@tikzexternal@tmpb\csname c@tikzext@no@\tikzexternal@figurename\endcsname}%
+ % advance the counter for 'figure name':
+ \tikzexternal@getnextfilename@advancecount
+ \fi
+ \else
+ \t@tikzexternal@tmpb=\expandafter{\tikzexternal@nextfile}%
+ \xdef\pgf@tempa{\the\t@tikzexternal@tmpa\the\t@tikzexternal@tmpb}%
+ \fi
+ \endgroup
+ \let#1=\pgf@tempa
+ \fi
+ \fi
+ %
+ % Reset global flags:
+ \global\let\tikzexternal@nextfile=\pgfutil@empty
+ \global\tikzexternalexportnexttrue
+ %
+ % Handle verbose output:
+ \ifpgf@external@grabshipout%
+ \else
+ \iftikzexternal@genfigurelist
+ \ifx#1\pgfutil@empty
+ \else
+ \pgfutil@ifundefined{tikzexternal@listmode@openedfile}{%
+ \message{Opening '\tikzexternal@realjob.figlist' for writing.}%
+ \immediate\openout\tikzexternal@outfile=\tikzexternal@realjob.figlist\relax
+ \gdef\tikzexternal@listmode@openedfile{1}%
+ \if\tikzexternal@opmode5% mode='list and make'
+ \iftikzexternal@verboseio
+ \immediate\write16{Opening '\tikzexternal@realjob.makefile' for writing.}%
+ \fi
+ \begingroup
+ % this makes \tikzexternal@outmakefile global:
+ \globaldefs=1
+ % this gets round '\outer\newwrite' in plain TeX:
+ \csname newwrite\endcsname\tikzexternal@outmakefile
+ \endgroup
+ \immediate\openout\tikzexternal@outmakefile=\tikzexternal@realjob.makefile\relax
+ \immediate\write\tikzexternal@outmakefile{ALL_FIGURE_NAMES=\tikzexternal@DOLLARchar(shell cat \tikzexternal@realjob.figlist)}%
+ \immediate\write\tikzexternal@outmakefile{ALL_FIGURES=\tikzexternal@DOLLARchar(ALL_FIGURE_NAMES:\tikzexternal@PERCENTchar=\tikzexternal@PERCENTchar\tikzexternal@imgext)}%
+ \immediate\write\tikzexternal@outmakefile{}%
+ \immediate\write\tikzexternal@outmakefile{allimages: \tikzexternal@DOLLARchar(ALL_FIGURES)}%
+ \immediate\write\tikzexternal@outmakefile{\tikzexternal@TABchar @echo All images exist now. Use make -B to re-generate them.}%
+ \immediate\write\tikzexternal@outmakefile{}%
+ \pgfutil@ifundefined{AtEndDocument}{}{%
+ \AtEndDocument{\immediate\write16{===== mode=`list and make': Use 'make -f \tikzexternal@realjob.makefile' to generate all images. Then, re-run (pdf)latex \tikzexternal@realjob. =====}}%
+ }%
+ \fi
+ }{}%
+ \iftikzexternal@verboseio
+ \immediate\write16{Writing '#1' to '\tikzexternal@realjob.figlist'.}%
+ \fi
+ \immediate\write\tikzexternal@outfile{#1}%
+ \if\tikzexternal@opmode5% mode='list and make'
+ \tikzexternal@assemble@systemcall{\pgf@tempa}%
+ \iftikzexternal@verboseio
+ \immediate\write16{Writing '#1' to '\tikzexternal@realjob.makefile'.}%
+ \fi
+ \immediate\write\tikzexternal@outmakefile{#1\tikzexternal@imgext:}%
+ \immediate\write\tikzexternal@outmakefile{\tikzexternal@TABchar\pgf@tempa}%
+ \immediate\write\tikzexternal@outmakefile{}%
+ \fi
+ \fi
+ \fi
+ \fi
+}%
+
+% This command is invoked
+% if and only if ( (grab mode && --jobname matches) || 'mode=graphics if exists' )
+%
+% It converts the current tikzpicture into an image in grab mode
+% or processes the 'graphics if exist' mode.
+\def\tikzexternal@externalizefig{%
+ \ifpgf@external@grabshipout%
+ % In this case, we already KNOW that the filename matches.
+ \expandafter\tikzexternal@externalizefig@GRAB%
+ \else
+ \expandafter\tikzexternal@externalizefig@mode@graphics@if@exists
+ \fi%
+}
+\def\tikzexternal@externalizefig@mode@graphics@if@exists{%
+ % check if there is already a file.
+ % In that case, use it. If not, typeset the picture normally.
+ \gdef\pgf@filename{}%
+ \xdef\pgf@tempa{\noexpand\pgf@findfile\pgfsys@imagesuffixlist:+{\tikzexternal@curfilename}}%
+ \pgf@tempa
+ \ifx\pgf@filename\pgfutil@empty%
+ % Note: since we have no 'GRAB' mode, we do not have to deal with optimization.
+ % there is no graphics.
+ \expandafter\tikzexternal@normalpicture@nographics
+ \else
+ \expandafter\tikzexternal@forcegraphics
+ \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
+}%
+
+% FIXME : this does not respect catcode changes!
+%--------------------------------------------------
+% \long\def\tikzexternal@externalizefig@@#1{%
+% \let\tikzpicture=\tikzexternal@origpicture
+% \iftikzexternal@optimize
+% \ifpgf@external@grabshipout
+% \tikzexternal@optimize@RESTORE
+% \fi
+% \fi
+% \expandafter\beginpgfgraphicnamed\expandafter{\tikzexternal@curfilename}%
+% \tikzpicture
+% #1
+% \endtikzpicture
+% \endpgfgraphicnamed
+% \let\tikzpicture=\tikzexternal@tikzpicture@replacement
+% \iftikzexternal@optimize
+% \ifpgf@external@grabshipout
+% \tikzexternal@optimize@REPLACE
+% \fi
+% \fi
+% \tikzexternal@closeenvironments
+% }%
+%--------------------------------------------------
+
+% Used by the optimization code.
+% It will be called if GRAB mode is on.
+% See the 'optimize command away' key.
+\def\tikzexternal@optimize@away@cmd#1#2{%
+ \pgfutil@ifnextchar[{%
+ \tikzexternal@optimize@away@cmd@{#1}{#2}%
+ }{%
+ \tikzexternal@optimize@away@cmd@{#1}{#2}[]%
+ }%
+}%
+\def\tikzexternal@optimize@away@cmd@#1#2[#3]{%
+ \def\tikz@temp{#2}%
+ \ifx\tikz@temp\pgfutil@empty
+ \def\tikz@temp{\tikzexternal@optimize@away@cmd@auto{#1}{#3}}%
+ \else
+ \ifcase#2\relax
+ \def\tikzexternal@optimize@away@cmd@manual{%
+ \tikzexternal@optimize@away@cmd@@@{#1}{#3}{}%
+ }%
+ \or
+ \def\tikzexternal@optimize@away@cmd@manual##1{%
+ \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}}%
+ }%
+ \or
+ \def\tikzexternal@optimize@away@cmd@manual##1##2{%
+ \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}}%
+ }%
+ \or
+ \def\tikzexternal@optimize@away@cmd@manual##1##2##3{%
+ \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}}%
+ }%
+ \or
+ \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4{%
+ \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}}%
+ }%
+ \or
+ \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4##5{%
+ \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}{##5}}%
+ }%
+ \or
+ \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4##5##6{%
+ \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}{##5}{##6}}%
+ }%
+ \or
+ \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4##5##6##7{%
+ \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}{##5}{##6}{##7}}%
+ }%
+ \or
+ \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4##5##6##7##8{%
+ \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}}%
+ }%
+ \or
+ \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4##5##6##7##8##9{%
+ \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}{##9}}%
+ }%
+ \fi
+ \def\tikz@temp{\tikzexternal@optimize@away@cmd@manual}%
+ \fi
+ \tikz@temp
+}%
+\def\tikzexternal@optimize@away@cmd@auto#1#2{%
+ \pgfutil@ifnextchar\bgroup{%
+ \tikzexternal@optimize@away@cmd@auto@{#1}{#2}%
+ }{%
+ \tikzexternal@optimize@away@cmd@auto@{#1}{#2}{<no argument in curly braces>}% give empty argument.
+ }
+}%
+
+\def\tikzexternal@optimize@away@cmd@auto@#1#2#3{%
+ \tikzexternal@optimize@away@cmd@@@{#1}{#2}{{#3}}% <-- provide braces
+}%
+\def\tikzexternal@optimize@away@cmd@@@#1#2#3{%
+ \begingroup
+ \toks0={#1[#2]#3}%
+ \iftikzexternal@verbose@optimize
+ \immediate\write16{The command '\the\toks0' has been optimized away. Use '/tikz/external/optimize=false' to disable this.}%
+ \fi
+ [ {\sc \string#1\ optimized away because it does not contribute to exported PDF}]%
+ \endgroup
+}%
+
+\def\tikzexternal@optimize@away@latex@env#1{%
+ \def\tikzexternal@optimize@away@latex@env@{#1}%
+ \begingroup
+ \def\tikzexternal@laTeX@collect@until@end@tikzpicturetikzpicturestring{#1}%
+ \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@optimize@away@latex@env@close
+}%
+\long\def\tikzexternal@optimize@away@latex@env@close#1{%
+ \iftikzexternal@verbose@optimize
+ \immediate\write16{The complete contents of \string\begin{tikzexternal@optimize@away@latex@env@} up to the next \end{tikzexternal@optimize@away@latex@env@} has been optimized away because it does not contribute to exported PDF. Use '/tikz/external/optimize=false' to disable this.}%
+ \fi
+ \endgroup
+ % we still need to invoke \end{<name>} in latex because \begin{<name>}
+ % starts a local group - that must be closed properly. Make sure then \end<name> does nothing:
+ \expandafter\let\csname end\tikzexternal@optimize@away@latex@env@\endcsname=\relax
+ \expandafter\end\expandafter{\tikzexternal@optimize@away@latex@env@}%
+}%
+
+\def\tikzexternal@optimize@REPLACE{%
+ \pgfkeysvalueof{/tikz/external/optimize/install/.@cmd}\pgfeov
+}%
+
+\def\tikzexternal@optimize@RESTORE{%
+ \pgfkeysvalueof{/tikz/external/optimize/restore/.@cmd}\pgfeov
+}%
+
+% Closes one 'tikzpicture' environment. This is only used for LaTeX,
+% because the '\end{tikzpicture}' command would raise an exception otherwise.
+% It does *not* call \endtikzpicture.
+\def\tikzexternal@closeenvironments{%
+ \let\endtikzpicture=\relax
+ \tikzexternal@TEXDIALECT@endpicture
+ \let\endtikzpicture=\tikzexternal@origendpicture
+}
+
+% Throws a tikzpicture away - without further notice.
+% Used if we are currently converting *another* picture. No need to waste time
+% with expensive pictures if they are not shipped out anyway.
+%
+% See the 'optimize' key to disable this.
+\def\tikzexternal@skipfigure{%
+ \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@skipfigure@@
+}
+\long\def\tikzexternal@skipfigure@@#1{%
+ \iftikzexternal@verbose@optimize
+ \immediate\write16{A tikzpicture has been optimized away. Use '/tikz/external/optimize=false' to disable this.}%
+ \fi
+ \tikzexternal@closeenvironments
+}
+
+% Processes tikzpicture normally; without any externalization.
+%
+% We need to do further work here to deal with NESTED tikzpicture environments
+% because all of them shall also be typeset normally.
+%
+% Idea:
+% 1. restore the original \tikzpicture macro
+% 2. install the replacement \tikzpicture in \end{tikzpicture}.
+% and keep track of nesting.
+%
+% FIXME: could it be possible that nested tikzpictures use other code anyway?
+\def\tikzexternal@normalpicture@nographics{%
+ \tikzexternal@nestedflagfalse
+ \let\tikzpicture=\tikzexternal@normalpicture@begreplace
+ \let\endtikzpicture=\tikzexternal@normalpicture@endreplace
+ \tikzpicture
+}
+\def\tikzexternal@normalpicture@begreplace{%
+ \begingroup
+ \tikzexternal@nestedflagtrue
+ \tikzexternal@origpicture
+}
+\def\tikzexternal@normalpicture@endreplace{%
+ \tikzexternal@origendpicture
+ \endgroup
+ \iftikzexternal@nestedflag
+ \else
+ \let\tikzpicture=\tikzexternal@tikzpicture@replacement
+ \let\endtikzpicture=\tikzexternal@origendpicture
+ \fi
+}%
+
+% Assumes there is an image on disk and reads it. The tikzpicture is thrown away.
+\def\tikzexternal@forcegraphics{%
+ \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@forcegraphics@@
+}
+\long\def\tikzexternal@forcegraphics@@#1{%
+ \expandafter\pgfincludeexternalgraphics\expandafter{\tikzexternal@curfilename}%
+ \tikzexternal@closeenvironments
+}
+
+% Simply replaces the complete picture by some placeholder text.
+% It is used by 'mode=list only' to reduce runtime.
+\def\tikzexternal@listmodepicture{%
+ \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
+ '}~]]%
+ \tikzexternal@closeenvironments
+}
+
+% check if there is already a file.
+% In that case, use it. If not, skip it.
+\def\tikzexternal@list@and@makefile@mode@picture{%
+ \gdef\pgf@filename{}%
+ \xdef\pgf@tempa{\noexpand\pgf@findfile\pgfsys@imagesuffixlist:+{\tikzexternal@curfilename}}%
+ \pgf@tempa
+ \ifx\pgf@filename\pgfutil@empty%
+ % Note: since we have no 'GRAB' mode, we do not have to deal with optimization.
+ % there is no graphics.
+ \expandafter\tikzexternal@listmodepicture
+ \else
+ \expandafter\tikzexternal@forcegraphics
+ \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
+}%
+
+
+% 1. Discards the current picture in this document.
+% 2. Checks whether an image exists already. If that is the case: acquire it.
+% 3. If no image exists: call '/tikz/external/system call'. This will
+% process \tikzexternal@externalizefig.
+% 4. Assert that finally an image exists and use it.
+\def\tikzexternal@externalizefig@systemcall{%
+ \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@externalizefig@systemcall@@
+}
+
+{
+\catcode`\"=12
+\catcode`\'=12
+\catcode`\;=12
+\catcode`\&=12
+\catcode`\-=12
+\xdef\tikzexternal@normal@dq{"}
+\xdef\tikzexternal@normal@sq{'}
+\xdef\tikzexternal@normal@semic{;}
+\xdef\tikzexternal@normal@and{&}
+\xdef\tikzexternal@normal@dash{-}
+\catcode`\"=13
+\catcode`\'=13
+\catcode`\;=13
+\catcode`\&=13
+\catcode`\-=13
+\gdef\tikzexternal@activate@normal@dq{\let"=\tikzexternal@normal@dq}
+\gdef\tikzexternal@activate@normal@sq{\let'=\tikzexternal@normal@sq}
+\gdef\tikzexternal@activate@normal@semic{\let;=\tikzexternal@normal@semic}
+\gdef\tikzexternal@activate@normal@and{\let&=\tikzexternal@normal@and}
+\gdef\tikzexternal@activate@normal@dash{\let-=\tikzexternal@normal@dash}
+\catcode`\|=0
+\catcode`\\=12
+|xdef|tikzexternal@normal@backslash{\}%
+}
+{
+\catcode`\^^I=12
+\catcode`\$=12
+\catcode`\%=12
+\xdef\tikzexternal@TABchar{^^I}\xdef\tikzexternal@PERCENTchar{%}\xdef\tikzexternal@DOLLARchar{$}}
+
+% Creates the '/tikz/external/system call' command as string and
+% returns it into the (global!) macro #1.
+\def\tikzexternal@assemble@systemcall#1{%
+ \begingroup
+ \let\image=\tikzexternal@curfilename
+ \let\texsource=\tikzexternal@realjob
+ \ifnum\the\catcode`\"=13 \tikzexternal@activate@normal@dq\fi
+ \ifnum\the\catcode`\'=13 \tikzexternal@activate@normal@sq\fi
+ \ifnum\the\catcode`\;=13 \tikzexternal@activate@normal@semic\fi
+ \ifnum\the\catcode`\-=13 \tikzexternal@activate@normal@dash\fi
+ \let\\=\tikzexternal@normal@backslash
+ \xdef#1{\pgfkeysvalueof{/tikz/external/system call}}%
+ \endgroup
+}%
+\long\def\tikzexternal@externalizefig@systemcall@@#1{%
+ \tikzexternal@externalizefig@systemcall@uptodatecheck%
+ \iftikzexternal@file@isuptodate
+ \iftikzexternal@verboseio
+ \immediate\write16{===== Image '\tikzexternal@curfilename' is up-to-date. ======}%
+ \fi
+ \let\pgf@filename=\tikzexternal@curfilename
+ \else
+ \begingroup
+ % no such image. Generate it!
+ \tikzexternal@assemble@systemcall{\pgf@tempa}%
+ \iftikzexternal@verboseio
+ \immediate\write16{===== 'mode=convert with system call': Invoking '\pgf@tempa' ========}%
+ \fi
+ \immediate\write18{\pgf@tempa}%
+ \expandafter\tikzexternal@externalizefig@systemcall@assertsuccess\expandafter{\pgf@tempa}%
+ \pgfmath@smuggleone\pgf@filename
+ \endgroup
+ \fi
+ \ifx\pgf@filename\pgfutil@empty
+ % error recovery: something did not work! Try to load it
+ % anyway. Perhaps it was just that shell-escape wasn't
+ % enabled.
+ \begingroup
+ \toks0={%
+ \tikzexternaldisable
+ \pgfutil@ifundefined{scantokens}{\long\def\scantokens##1{##1}}{}%
+ }%
+ % FIXME : THIS WILL FAIL IF THERE IS '##' INSIDE OF '#1'!
+ % for example something like /.style={#1} in the picture environment *will* fail.
+ \toks1={%
+ \tikzpicture#1%
+ }%
+ \toks2={%
+ \tikzexternal@TEXDIALECT@endpicture
+ \tikzexternalenable
+ }%
+ \xdef\tikzexternal@externalizefig@systemcall@next{%
+ \the\toks0
+ % try reading them again as if they were in the input file.
+ \noexpand\scantokens{\the\toks1 }%
+ \the\toks2
+ }%
+ \endgroup
+ \else
+ % ok, take the image!
+ \expandafter\pgfincludeexternalgraphics\expandafter{\tikzexternal@curfilename}%
+ \gdef\tikzexternal@externalizefig@systemcall@next{\tikzexternal@closeenvironments}%
+ \fi
+ \tikzexternal@externalizefig@systemcall@next
+}%
+
+% Checks whether the current picture needs to be externalized.
+%
+% This is the case if
+% a) there is no external image yet,
+% b) the picture has been invalidated manually.
+%
+% It returns \iftikzexternal@file@isuptodate accordingly.
+\def\tikzexternal@externalizefig@systemcall@uptodatecheck{%
+ \iftikzexternal@force@remake
+ \global\tikzexternal@file@isuptodatefalse
+ \else
+ \iftikzexternalremakenext
+ \global\tikzexternal@file@isuptodatefalse
+ \global\tikzexternalremakenextfalse
+ \else
+ % check if there is already a file.
+ % In that case, use it. If that is not the case, generate it and include it afterwards.
+ \gdef\pgf@filename{}%
+ \xdef\pgf@tempa{\noexpand\pgf@findfile\pgfsys@imagesuffixlist:+{\tikzexternal@curfilename}}%
+ \pgf@tempa
+ \ifx\pgf@filename\pgfutil@empty%
+ \global\tikzexternal@file@isuptodatefalse
+ \else
+ \global\tikzexternal@file@isuptodatetrue
+ \fi
+ \fi
+ \fi
+}%
+
+% \pgf@filename will be empty if the assertion failed.
+\def\tikzexternal@externalizefig@systemcall@assertsuccess#1{%
+ % check if there is a file now and raise an error message if not.
+ \gdef\pgf@filename{}%
+ \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.}%
+ \fi
+}%
+
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
new file mode 100644
index 00000000000..ee158b55427
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex
@@ -0,0 +1,83 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% 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: Di 29. Dez 22:11:16 CET 2009 %%%
+
+
+
+% Copyright 2008 by Christian Feuersaenger
+%
+% 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.
+%
+%
+% This file provides a high-level automatic export feature for tikz pictures.
+% It allows to export EACH SINGLE FIGURE into a separate PDF.
+%
+% The simplest way is to use
+%
+% \tikzexternalize{myarticle}
+%
+% it simply converts every figure using the write18 method. If that is not possible,
+% you need to reconfigure \tikzexternalize: it can generate a list of figure file names
+% and you need to generate these figures manually (or with a script).
+%
+% It replaces \tikzpicture/ \endtikzpicture and \tikz and invokes \beginpgfgraphicnamed ... \endpgfgraphicnamed
+% commands if necessary.
+
+% source generic implementation:
+\input pgfplotsoldpgfsupp_tikzexternalshared.code.tex
+
+\def\tikzexternal@TEXDIALECT@begpicture{\begin{tikzpicture}}
+\def\tikzexternal@TEXDIALECT@endpicture{\end{tikzpicture}}%
+
+% this latex specific this assumes it starts at the beginning of an
+% environment. The environment is named
+% '\tikzexternal@laTeX@collect@until@end@tikzpicturetikzpicturestring'.
+%
+% Everything up to \end{<name>} will be collected and passed as
+% argument to the macro '#1'.
+%
+% This does also work if <name> is NOT tikzpicture!
+\def\tikzexternal@TEXDIALECT@collectpicture#1{%
+ \begingroup
+ \t@tikzexternal@tmpa={}%
+ \tikzexternal@laTeX@collect@until@end@tikzpicture{#1}%
+}
+
+% Loop until we find '\end{tikzpicture}'. We have to make sure that
+% even strings like '#1' are allowed inside of the collected argument.
+\long\def\tikzexternal@laTeX@collect@until@end@tikzpicture#1#2\end#3{%
+ \def\tikzexternal@laTeX@collect@until@end@tikzpicture@{#3}%
+ \ifx\tikzexternal@laTeX@collect@until@end@tikzpicture@\tikzexternal@laTeX@collect@until@end@tikzpicturetikzpicturestring
+ \t@tikzexternal@tmpa=\expandafter{\the\t@tikzexternal@tmpa #2}%
+ \edef\tikzexternal@TEXDIALECT@collectpicture@next{%
+ \noexpand\endgroup
+ \noexpand#1{\the\t@tikzexternal@tmpa}%
+ }%
+ \else
+ \t@tikzexternal@tmpa=\expandafter{\the\t@tikzexternal@tmpa #2\end{#3}}%
+ \def\tikzexternal@TEXDIALECT@collectpicture@next{%
+ \tikzexternal@laTeX@collect@until@end@tikzpicture{#1}}%
+ \fi
+ \tikzexternal@TEXDIALECT@collectpicture@next
+}%
+\def\tikzexternal@laTeX@collect@until@end@tikzpicturetikzpicturestring{tikzpicture}%
+