summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/pgfplots/liststructure.sty196
-rw-r--r--Master/texmf-dist/tex/latex/pgfplots/pgfmathlog.sty443
-rw-r--r--Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty1580
3 files changed, 2219 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/pgfplots/liststructure.sty b/Master/texmf-dist/tex/latex/pgfplots/liststructure.sty
new file mode 100644
index 00000000000..8a0a9568449
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/pgfplots/liststructure.sty
@@ -0,0 +1,196 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This is a helper package with an elementary list datastructure.
+%
+% Its implementation is based on Knuth's list macros in "The TeXbook".
+%
+% The following macros are supplied:
+%
+% \listnewempty
+% \listnew
+% \listcopy
+% \listpopfront
+% \listpushback
+% \listpushfront
+% \listsize
+% \listselect
+% \listcheckempty
+% \listforeach
+%
+% Copyright 2007/2008 by Christian Feuersänger.
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ProvidesPackage{liststructure}[2008/26/01 Version 0.9]
+
+\newtoks\TOKL@ta
+\newtoks\TOKL@tb
+\newif\iflistempty
+
+% Creates a new, empty list.
+\long\def\listnewempty#1{\let#1=\empty}
+
+% Creates a new list with an abirtrary number of elements.
+% Arguments:
+% #1: the list's name (a macro name)
+% #2: the elements in the form
+% first\\second\\third\\ ...\\
+% like in tabular with one column.
+%
+% Example:
+% \listnew\foolist{First Element\\Second Element\\Third Element\\}
+%
+% WARNING: do NOT forget the final '\\'!
+\long\def\listnew#1#2{%
+ \listnewempty{#1}%
+ \long\def\listnew@impl@rest{#2}%
+ \loop
+ \ifx\listnew@impl@rest\empty
+ \else
+ \expandafter\listnew@impl\listnew@impl@rest\tolist#1\relax
+ \repeat
+}
+
+% Copies list #1 to list #2.
+\def\listcopy#1\to#2{\let#2=#1}
+
+
+% helper macro for \listnew
+\long\def\listnew@impl#1\\#2\tolist#3{%
+ \listpushback#1\to#3\relax%
+ \def\listnew@impl@rest{#2}%
+}
+
+
+% #1: the item to prepend
+% #2: the list as macro name
+% Example:
+% \listpushfront Next first Element\to\foolist
+\long\def\listpushfront#1\to#2{%
+ \TOKL@ta={\list@sep{#1}}%
+ \TOKL@tb=\expandafter{#2}%
+ \edef#2{\the\TOKL@ta\the\TOKL@tb}%
+}
+
+% #1: the item to append
+% #2: the list as macro name
+% Example:
+% \listpushback Next last element\to\foolist
+\long\def\listpushback#1\to#2{%
+ \TOKL@ta={\list@sep{#1}}%
+ \TOKL@tb=\expandafter{#2}%
+ \edef#2{\the\TOKL@tb\the\TOKL@ta}%
+}
+
+% Concatenates two lists #2 and #3 into #1
+% Example:
+% \listconcat\result=\foolist&\bar
+\long\def\listconcat#1=#2&#3{%
+ \TOKL@ta=\expandafter{#2}%
+ \TOKL@tb=\expandafter{#3}%
+ \edef#1{\the\TOKL@ta\the\TOKL@tb}%
+}
+
+% implements #2 := pop_front(#1)
+% Example:
+% \listpopfront\foolist\to\poppedfirstelem
+\long\def\listpopfront#1\to#2{%
+ \listcheckempty#1\relax
+ \iflistempty
+ \errmessage{ERROR: \string\listpopfront\ from \string#1\ although list is EMPTY}%
+ \else
+ \expandafter\listpopfront@impl#1\listpopfront@macronames#1#2%
+ \fi
+}
+
+% implementation helper for listpopfront
+\long\def\listpopfront@impl\list@sep#1#2\listpopfront@macronames#3#4{%
+ \def#4{#1}%
+ \def#3{#2}%
+}
+
+% Counts the number of elements in list #1, storing it into the count
+% register #2.
+% Example:
+% \listsize\foo\to{\count0}%
+% \the\count0
+\long\def\listsize#1\to#2{%
+ #2=0%
+ \long\def\list@sep##1{\advance#2 by 1 }%
+ #1%
+}
+
+% Returns the #1th element of list #2 into macro #3
+% Arguments:
+% #1: a count 0,...,N-1 where N is the list size.
+% You may specify a number of a count.
+% #2: a list
+% #3: a macro name
+% Example:
+% Element 0:
+% \listselect0\of\foo\to\elem
+% \elem
+% Element \count1:
+% \listselect\count1\of\foo\to\elem
+\long\def\listselect#1\of#2\to#3{%
+ \def#3{\errmessage{The requested item #1 of \string#2 is OUT OF RANGE.}}%
+ \begingroup
+ \count0=#1\relax
+ \long\def\list@sep##1{%
+ \advance\count0-1
+ \ifnum\count0=-1
+ \global\def\listselect@tmp{\def#3{##1}}%
+ % the command \listselect@tmp will be expander AFTER
+ % '\endgroup'
+ \aftergroup\listselect@tmp%
+ \fi%
+ }%
+ #2%
+ \endgroup
+}
+
+% Sets the boolean \iflistempty depending on whether list #1 is empty
+% or not.
+% Example:
+%
+% \listcheckempty\foolist
+% \iflistempty
+% List foolist is empty!
+% \else
+% List is not empty.
+% \fi
+\def\listcheckempty#1{%
+ \ifx#1\empty
+ \listemptytrue
+ \else
+ \listemptyfalse
+ \fi
+}
+
+
+% Iterates through each list element, names it #2 and calls code #3.
+% Example:
+% \listnew\foolist{Eins\\Zwei\\Drei\\}%
+% \listforeach\foolist\as\foo{Element \foo\par}%
+% results in
+% Element Eins
+% Element Zwei
+% Element Drei
+\long\def\listforeach#1\as#2#3{{%
+ \long\def\list@sep##1{\def#2{##1}#3}%
+ #1\relax
+}}
diff --git a/Master/texmf-dist/tex/latex/pgfplots/pgfmathlog.sty b/Master/texmf-dist/tex/latex/pgfplots/pgfmathlog.sty
new file mode 100644
index 00000000000..acb02e3b143
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/pgfplots/pgfmathlog.sty
@@ -0,0 +1,443 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Package pgfmathlog.sty.
+%
+% This file provides the public functions
+%
+% \pgfmathnormalisedfloatingpoint#1\to#2\powten#3
+% like
+% \pgfmathnormalisedfloatingpoint 412.02451e-5to\M\powten\E
+%
+% and
+% \pgfmathlog
+% \pgfmathlog@
+% which both assign \pgfmathresult to the natural number of a given
+% number (without units).
+%
+% It is based on Till Tantaus pgfmath package which comes as part of
+% the PGF bundle, but it provides its own number parsing routines to
+% circumvent TeXs limited real number representations.
+%
+% Copyright 2007/2008 by Christian Feuersänger.
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\ProvidesPackage{pgfmathlog}[2008/26/01 Version 0.9.]
+\RequirePackage{pgf}[2007/01/01]
+
+% Computes a normalised floating point representation for #1 of the
+% form
+% [+-]X.XXXXXXX*10^C
+% where
+% X.XXXXXX is a mantisse with first number != 0
+% and C is a count.
+%
+% This method does NOT use TeX Registers to represent the numbers! The
+% computation is COMPLETELY STRING BASED.
+% This allows numbers such at 10000000 or 5.23e-10 to be represented
+% properly, although TeX-registers would produce overflow/underflow
+% errors in these cases.
+%
+% It is to be used to compute logs, because log(X*10^Y) = log(X) + log(10)*Y
+%
+% Arguments:
+% #1 a -possibly non-normalized- number representation. Accepted input
+% format is
+% [+-]XXXXX.XXXXXX
+% [+-]XXXXX.XXXXXXeXXXX
+% [+-]0.0000XXXXXX
+% [+-]0.0000XXXXXXeXXXX
+% NOT accepted input format is
+% [+-]XXXXX [the period is missing]
+% [+-]XXXXXe10 [the period is missing]
+% [+-]0000.XXXXXX [leading zeros not supported]
+% [+-]XXXXX.XXXXXXEXXXXX [E notation not yet implemented]
+% #2 a macro name. \def#2{.....} will be used to assign the mantisse.
+% #3 a macro name. \def#3{.....} will be used to assign the exponent (base 10).
+%
+% Example:
+% \def\normalize#1{%
+% \pgfmathnormalisedfloatingpoint#1\to\M\powten\E
+% \[ #1 \mapsto \M\cdot 10^{\E} \]
+% }
+% \normalize{123.41251}%
+% \normalize{3.26101452e-06}%
+\def\pgfmathnormalisedfloatingpoint#1\to#2\powten#3{%
+ \pgfmathnormalisedfloatingpoint@impl@possibly@signed#1\to#2\powten{#3}%
+}
+
+% first character MAY be + or -. This is checked, then
+% \pgfmathnormalisedfloatingpoint@impl@positive will be called for the
+% absolute value. The sign is inserted afterwards.
+\def\pgfmathnormalisedfloatingpoint@impl@possibly@signed#1#2\to#3\powten#4{%
+ \def\pgfmathlogTMP{#1}%
+ \def\pgfmathlogTMPB{-}%
+ \if\pgfmathlogTMP\pgfmathlogTMPB
+ \pgfmathnormalisedfloatingpoint@impl@positive@possibly@noperiod#2.\to#3\powten{#4}%
+ \edef#3{-#3}%
+ \else
+ \def\pgfmathlogTMPB{+}%
+ \if\pgfmathlogTMP\pgfmathlogTMPB
+ \pgfmathnormalisedfloatingpoint@impl@positive@possibly@noperiod#2.\to#3\powten{#4}%
+ \else
+ \pgfmathnormalisedfloatingpoint@impl@positive@possibly@noperiod#1#2.\to#3\powten{#4}%
+ \fi
+ \fi
+}
+
+% XXXX -> XXXX.0
+% XXXX.YYY -> XXXX.YYYY
+\def\pgfmathnormalisedfloatingpoint@impl@positive@possibly@noperiod#1.#2\to#3\powten#4{%
+ %\tracingmacros=2\tracingcommands=2
+ \def\pgfmathlogTMP{#2}%
+ \ifx\pgfmathlogTMP\empty
+ \pgfmathnormalisedfloatingpoint@impl@positive@noperiod@possibly@SCI#1e\to#3\powten{#4}%
+ \else
+ \expandafter\pgfmathnormalisedfloatingpoint@impl@positive\pgfmathlog@pop@last@of@two@dots#1.#2\to#3\powten{#4}%
+ \fi
+}
+\def\pgfmathlog@pop@last@of@two@dots#1.#2.{#1.#2}%
+
+\def\pgfmathnormalisedfloatingpoint@impl@positive@noperiod@possibly@SCI#1e#2\to#3\powten#4{%
+ \def\pgfmathlogTMP{#2}%
+ \ifx\pgfmathlogTMP\empty
+ % this case applies to
+ % 1234 -> 1234.0
+ \pgfmathnormalisedfloatingpoint@impl@positive#1.0\to#3\powten{#4}%
+ \else
+ % this case applies to
+ % 1e1 -> 1.0e1
+ % in this case, #1e#2 = 1e1e, so we have to discard a suffix 'e'.
+ \edef\pgfmathlogTMP{#1.0e\pgfmathlog@popsuffix@e@expansion#2}%
+ \expandafter\pgfmathnormalisedfloatingpoint@impl@positive\pgfmathlogTMP\to#3\powten{#4}%
+ \fi
+}
+
+% XXXXX.XXXXX -> X.XXXXXXX * 10^4
+% 0.0000XXXXX -> X.XXXX * 10^{-5}
+%
+% or
+% XXXX.XXXXXeYYY -> X.XXXXXX* 10^{3+YYY}
+% 0.0000XXXXeYYY -> X.XXX* 10^{-5+YYY}
+%
+% this version does not accept a sign. A period is required.
+\def\pgfmathnormalisedfloatingpoint@impl@positive#1#2.#3\to#4\powten#5{%
+% \begingroup
+% FIXME! restore variables!!
+ %\tracingmacros=2\tracingcommands=2
+ %\tracingmacros=0\tracingcommands=0
+ \pgfmathnormalisedfloatingpoint@positive@getexisting@exponent@e#3e\preexponentto\preexponentstring\exponenttocount\c@pgf@counta
+ % will \c@pgf@counta will be initialised in the line above
+ % \c@pgf@counta=0
+ \ifnum#1=0
+ % the case 0.0000XXXX
+ % does also handle 0.0000XXXXeXXX
+ \def\pgfmathlogTMP{#2}%
+ \ifx\pgfmathlogTMP\empty
+ \c@pgf@countb=0
+ \expandafter\pgfmathlog@count@leading@zeros\preexponentstring\to\c@pgf@countb
+ \advance\c@pgf@countb by1
+ \advance\c@pgf@counta by-\c@pgf@countb
+ \edef#5{\the\c@pgf@counta}%
+ \expandafter\pgfmathlog@assignmantisse\preexponentstring\to#4\countdownzerosfrom\c@pgf@countb
+ \else
+ % the case 000.0000XXXXX
+ % is not allowed and does not make sense.
+ \errmessage{INVALID NUMBER FORMAT: leading zeros 00*.* not supported yet}%
+ \fi
+ \else
+ % the case NXXXXX.XXXXXXX
+ % or NXXXXXX.XXXXXXeXXXX
+ % where N in [1-9]
+ \pgfmathlog@strlen#1#2\to\c@pgf@counta
+ \advance\c@pgf@counta by-1
+ \edef#4{#1.#2\preexponentstring}%
+ \edef#5{\the\c@pgf@counta}%
+ \fi
+ %\tracingmacros=0\tracingcommands=0
+% \endgroup
+}
+
+% parses scientific notation and returns the exponent and everything
+% before the exponent like
+%
+% XXXXXXXeYYYY -> \def#2{XXXXXXX} #3=YYYY
+% or
+% XXXXXXXXe -> \def#2{XXXXXXXX} #3=0
+%
+% Examples:
+% - \pgfmathnormalisedfloatingpoint@exponent@e123456e\preexponentto\M\exponenttocount\acount
+% \M->123456
+% \acount=0
+% Please note that the input was 123456e -> at least 'e' is expected!
+%
+% - \pgfmathnormalisedfloatingpoint@exponent@e123456e-10e\preexponentto\M\exponenttocount\acount
+% \M->123456
+% \acount=-10
+% Again, the suffix 'e' is REQUIRED. This allows to reduce \ifs.
+\def\pgfmathnormalisedfloatingpoint@positive@getexisting@exponent@e#1e#2\preexponentto#3\exponenttocount#4{%
+ \def#3{#1}%
+ \def\pgfmathlogTMP{#2}%
+ \ifx\pgfmathlogTMP\empty
+ #4=0
+ \else
+ \pgfmathlog@popsuffix@e#2\tocount{#4}%
+ \fi
+}
+
+% XXXXXe -> #2=XXXXX where X in [+-0-9].
+\def\pgfmathlog@popsuffix@e#1e\tocount#2{%
+ #2=#1
+}
+
+\def\pgfmathlog@popsuffix@e@expansion#1e{%
+ #1%
+}%
+
+% 00000XXXXXX -> X.XXXXX
+% Inputs:
+% #1 = 00000XXXXXX
+% #2 a macro name
+% #3 a count in which the number of zeros plus one is contained (i.e.
+% the number of shifts).
+\def\pgfmathlog@assignmantisse#1\to#2\countdownzerosfrom#3{%
+ \toks0={#1}%
+ \loop
+ \ifnum#3=1
+ \else
+ \expandafter\pgfmathlog@popfirst\the\toks0\to{\toks0}%
+ \advance#3 by-1
+ \repeat
+ \edef\pgfmathlog@assignmantisseTMP{\the\toks0}%
+ \ifx\pgfmathlog@assignmantisseTMP\empty
+ % The case 0.0 * 10^0
+ \def#2{0.0}%
+ \else
+ \expandafter\pgfmathlog@insertperiod\the\toks0\to{#2}%
+ \fi
+}
+
+% XXXXXX -> X.XXXXX into #3
+\def\pgfmathlog@insertperiod#1#2\to#3{%
+ \def\pgfmathlogTMP{#2}%
+ \ifx\pgfmathlogTMP\empty
+ \def#3{#1.0}%
+ \else
+ \def#3{#1.#2}%
+ \fi
+}
+
+% discards the first token.
+\def\pgfmathlog@popfirst#1#2\to#3{%
+ #3={#2}%
+}
+
+% adds the string length of #1#2 into the count register #3.
+%
+% The register won't be initialised to zero!
+\def\pgfmathlog@strlen#1#2\to#3{%
+ \advance#3 by1
+ \def\pgfmathlogTMP{#2}%
+ \ifx\pgfmathlogTMP\empty
+ \else
+ \pgfmathlog@strlen#2\to{#3}%
+ \fi
+}
+
+% Adds the number of leadings zeros of #1#2 into the count register
+% #3.
+%
+% The register won't be initialised to zero!
+\def\pgfmathlog@count@leading@zeros#1#2\to#3{%
+ \ifnum#1=0
+ \advance#3 by1
+ \def\pgfmathlogTMP{#2}%
+ \ifx\pgfmathlogTMP\empty
+ \else
+ \pgfmathlog@count@leading@zeros#2\to{#3}%
+ \fi
+ \fi
+}
+
+% Evaluates the natural logarithm, log(x) for 0.1<=x<=1.
+% @see \pgfmathlog@ for the general method.
+% NON ACCURATE ENOUGH!
+\def\pgfmathlogzeroone#1{%
+ \begingroup%
+ \message{EVAL log(#1) STARTS:}%
+ \pgfmath@x=#1pt\relax
+ \pgfmath@y=\pgfmath@x
+ \advance\pgfmath@x by-1pt
+ \advance\pgfmath@y by 1pt
+ \pgfmathdivide{\pgfmath@x}{\pgfmath@y}%
+ % pgfmath@ya = tmp := (#1 -1)/ (#1+1)
+ \expandafter\pgfmath@ya\pgfmathresult pt
+ % pgfmath@xa := [ (#1 -1)/ (#1+1) ]^2
+ \pgfmathmultiply{\pgfmathresult}{\pgfmathresult}%
+ \expandafter\pgfmath@xa\pgfmathresult pt
+ % returnvalue:
+ \pgfmath@y=0pt
+ % loop counter:
+ \c@pgfmath@counta=0
+ % j:
+ \c@pgfmath@countb=1
+ \loop
+ \ifnum\c@pgfmath@counta<6
+ \let\multmp=\pgfmath@ya
+ \divide\pgfmath@ya by\c@pgfmath@countb
+ \advance\pgfmath@y by\pgfmath@ya
+ \let\pgfmath@ya=\multmp
+ \advance\c@pgfmath@countb by2
+ \message{[tmp *= x*x tmp =\the\pgfmath@ya, x*x=\the\pgfmath@xa]}%
+ \pgfmathmultiply{\pgfmath@ya}{\pgfmath@xa}%
+ \expandafter\pgfmath@ya\pgfmathresult pt
+ \advance\c@pgfmath@counta by1
+ \message{[cur/2 = \the\pgfmath@y]}%
+ \repeat
+ \multiply\pgfmath@y by2
+ \message{fertiges Resultat fuer log(#1): \the\pgfmath@y}%
+ \pgfmath@returnone\pgfmath@y%
+ \endgroup%
+}
+
+
+% Computes a good guess for log(X.XXXX) where the input number should
+% be between 0 < x < 10.
+%
+% If it is not in this range, the returned value will be bad.
+%
+% For use in the newton implementation of log(x). Please note that we
+% first compute a normalized floating point representation of x, and
+% the mantisse is always between 0 and 10.
+\def\pgfmathlog@smaller@ten@newton@startval#1#2#3\to#4{%
+ \ifnum0<#1\relax
+ \def\axis@TMP{#2}%
+ \def\axis@TMPB{.}%
+ \ifx\axis@TMP\axis@TMPB
+ \ifcase#1
+ \errmessage{pgfmathlog.sty: INTERNAL ERROR: should not happen!
+ [\#1=0 should have been caught before!]}%
+ \or#4=0.53062825106217pt
+ \or#4=0.993pt
+ \or#4=1.308pt
+ \or#4=1.5pt
+ \or#4=1.71pt
+ \or#4=1.872pt
+ \or#4=2.01pt
+ \or#4=2.145pt
+ \or#4=2.24pt
+ \fi
+% \message{Newton: Start value \the#4 assigned}%
+ \else
+% \message{Kein Komma an zweiter stelle (statt dessen: #2); Nehme standardstartwert.}%
+ #4=0.1pt
+ \fi
+ \else
+% \message{Argument #1 <= 0. Nehme standardstartwert.}%
+ #4=0.1pt
+ \fi
+}
+
+% Computes log(x) into \pgfmathresult.
+%
+% REMARK
+% This method does NOT use TeX Registers to represent the numbers! The
+% computation is COMPLETELY STRING BASED.
+% This allows numbers such at 10000000 or 5.23e-10 to be represented
+% properly, although TeX-registers would produce overflow/underflow
+% errors in these cases.
+%
+% The natural logarithm is computed using log(X*10^Y) = log(X) + log(10)*Y
+\def\pgfmathlog@#1{%
+ \pgfmathlog@newton{#1}%
+}
+
+% Public interface method. This is expected to use \pgfmathparse but
+% it DOESN'T do that. \pgfmathparse naturally can't handle numbers
+% which exceed TeX's numerical capabilities. However, exponentials are
+% typically either too large or too small for TeX.
+%
+% @see \pgfmathnormalisedfloatingpoint for how we parse arguments.
+% @see \pgfmathlog@
+\def\pgfmathlog#1{%
+ \pgfmathlog@newton{#1}%
+}
+
+\def\pgfmathlog@tonumber#1pt{#1}
+
+% Invokes command #1 with #2 without the 'pt' suffix.
+\def\invokepgf@math@one#1#2{%
+ %\edef\pgfmath@resulttemp{\pgf@sys@tonumber{#2}}%
+ %\expandafter#1\expandafter{\pgfmath@resulttemp}%
+ \edef\pgfmath@resulttemp{{\pgf@sys@tonumber{#2}}}%
+ \expandafter#1\pgfmath@resulttemp%
+}
+
+% Expands #2 using \edef and invokes #1 with the resulting string.
+%
+% Example:
+% \pgfmath@y=7.9pt
+% \pgfmathlog@invoke@expanded\pgfmathexp@{{\pgf@sys@tonumber{\pgfmath@y}}}%
+% will invoke
+% \pgfmathexp@{7.9}
+\def\pgfmathlog@invoke@expanded#1#2{%
+ \edef\pgfmath@resulttemp{#2}%
+ \expandafter#1\pgfmath@resulttemp
+}
+
+% This implementation of log(X) is done with a newton method applied to x-exp(y) = 0.
+% The implementation \pgfmathexp is used for exp(y).
+%
+% see \pgfmathlog@
+\def\pgfmathlog@newton#1{%
+ \begingroup%
+ % compute #1 = M*10^E with normalised mantisse M = [+-]*[1-9].XXXXX
+ \pgfmathnormalisedfloatingpoint#1\to\newtoninput@mantisse\powten\newtoninput@exponent
+ %
+ % Now, compute log(#1) = log(M) + E*log(10)
+% \message{EVAL log(#1) = log(\newtoninput@mantisse) + \newtoninput@exponent*log(10) mit newton STARTS:}%
+ % input argument into \pgfmath@x
+ \expandafter\pgfmath@x\newtoninput@mantisse pt
+ \ifdim\pgfmath@x>0pt
+ % return value:
+ \expandafter\pgfmathlog@smaller@ten@newton@startval\newtoninput@mantisse\to\pgfmath@y
+ % loop counter:
+ \c@pgfmath@counta=0
+ \loop
+ %\message{Newton iter \#\the\c@pgfmath@counta: log(\newtoninput@mantisse) = \the\pgfmath@y }%
+ \ifnum\c@pgfmath@counta<2
+ % \pgfmathexp\pgfmath@y%
+ \pgfmathlog@invoke@expanded\pgfmathexp@{{\pgf@sys@tonumber{\pgfmath@y}}}%
+ \let\tmp=\pgfmathresult
+ %\pgfmathdivide\pgfmath@x\tmp%
+ \pgfmathlog@invoke@expanded\pgfmathdivide@{{\pgf@sys@tonumber{\pgfmath@x}}{\tmp}}%
+ \expandafter\pgfmath@ya\pgfmathresult pt
+ \advance\pgfmath@y by\pgfmath@ya
+ \advance\pgfmath@y by-1pt
+ \advance\c@pgfmath@counta by1
+ \repeat
+ \pgfmath@x=2.302585pt% = log(10)
+ \multiply\expandafter\pgfmath@x\newtoninput@exponent
+ \advance\pgfmath@y by\pgfmath@x
+%\message{Newton final result: log(\newtoninput@mantisse)+\newtoninput@exponent*log(10) = \the\pgfmath@y [ nur \newtoninput@exponent * log(10) = \the\pgfmath@x]}%
+ \pgfmath@returnone\pgfmath@y%
+ \else
+ \global\let\pgfmathresult=\empty%
+ \fi
+ \endgroup%
+}
+
diff --git a/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty b/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty
new file mode 100644
index 00000000000..daf042622ee
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty
@@ -0,0 +1,1580 @@
+%--------------------------------------------
+%
+% Package pgfplots.sty
+%
+% 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 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/>.
+%
+%--------------------------------------------
+\def\pgfplotsversion{0.9}
+\ProvidesPackage{pgfplots}[2008/26/01 Version \pgfplotsversion]
+\RequirePackage{xkeyval}[2006/11/18]
+\RequirePackage{ifthen}
+\RequirePackage{liststructure}
+\RequirePackage{tikz}[2007/06/07]
+\RequirePackage{pgfmathlog}
+\usetikzlibrary{plotmarks}
+
+\def\prefix{pgfplots}
+
+\newcount\axisticknum
+\newcount\axis@tickposnum
+\newcount\axis@xmode
+\newcount\axis@ymode
+\newcount\axis@numplots
+\newdimen\axis@xcoordminTEX
+\newdimen\axis@xcoordmaxTEX
+\newdimen\axis@ycoordminTEX
+\newdimen\axis@ycoordmaxTEX
+\newdimen\axis@tmpa
+\newdimen\axis@tmpb
+\newif\ifaxis@isuniformtick
+\let\axis@TMP=\empty
+\let\axis@TMPB=\empty
+
+\def\axis@leftover{}
+\def\axis@rightover{}
+\def\axisdefaultwidth{240pt}
+\def\axisdefaultheight{207pt}
+
+\listnew{\blackwhiteplotspeclist}{%
+ mark options={fill=gray},mark=*\\%
+ mark options={fill=gray},mark=square*\\%
+ mark options={fill=gray},mark=otimes*\\%
+ mark=star\\%
+ mark options={fill=gray},mark=diamond*\\%
+ loosely dashed,mark options={solid,fill=gray},mark=*\\%
+ loosely dashed,mark options={solid,fill=gray},mark=square*\\%
+ loosely dashed,mark options={solid,fill=gray},mark=otimes*\\%
+ loosely dashed,mark options={solid},mark=star\\%
+ loosely dashed,mark options={solid,fill=gray},mark=diamond*\\%
+}
+\listnew{\coloredplotspeclist}{%
+ blue,mark options={fill=blue!80!black},mark=*\\%
+ red,mark options={fill=red!80!black},mark=square*\\%
+ brown!60!black,mark options={fill=brown!80!black},mark=otimes*\\%
+ black,mark=star\\%
+ blue,mark options={fill=blue!80!black},mark=diamond*\\%
+ red,loosely dashed,mark options={solid,fill=red!80!black},mark=*\\%
+ brown!60!black,loosely dashed,mark options={solid,fill=brown!80!black},mark=square*\\%
+ black,loosely dashed,mark options={solid,fill=gray},mark=otimes*\\%
+ blue,loosely dashed,mark=star,mark options=solid\\%
+ red,loosely dashed,mark options={solid,fill=red!80!black},mark=diamond*\\%
+}
+
+
+\listcopy\coloredplotspeclist\to\autoplotspeclist%
+%\listcopy\blackwhiteplotspeclist\to\autoplotspeclist%
+
+%--------------------------------------------------
+%
+% MARKERS:
+% mark repeat=3,mark phase=2
+% mark options={color=blue,rotate=180}
+% ball,ball color=blue
+% {*}
+% {x}
+% {+}
+% \usetikzlibrary{plotmarks}
+% {-}
+% {|}
+% {o}
+% {asterisk}
+% {star}
+% {oplus}
+% {oplus*}
+% {otimes}
+% {otimes*}
+% {square}
+% {square*}
+% {triangle}
+% {triangle*}
+% {diamond}
+% {diamond*}
+% {pentagon}
+% {pentagon*}
+%
+% LINES:
+% line width=2cm
+% [snake=zigzag]
+% [snake=brace]
+% [snake=triangles]
+% [snake=coil,segment length=4pt]
+% [snake=coil,segment aspect=0]
+% [snake=expanding waves,segment angle=7]
+% style=solid
+% style=dotted
+% style=densely dotted
+% style=loosely dotted
+% style=dashed
+% style=densely dashed
+% style=loosely dashed
+% dash pattern=on 2pt off 3pt on 4pt off 4pt
+% dash phase=10pt
+% Mit der 'double' und 'double distance' option gibts lustige effekte:
+% \draw[draw=white,double=red,very thick] (0,1) -- (1,0);
+% \draw[very thick,double distance=2pt] (1,0) arc (180:90:1cm);
+%--------------------------------------------------
+
+\tikzstyle{every axis}=[]
+\tikzstyle{every axis plot}=[]
+\tikzstyle{every axis label}=[]
+\tikzstyle{every axis x label}=[at={(0.5,0)},below,yshift=-15pt]
+\tikzstyle{every axis y label}=[at={(0,0.5)},xshift=-35pt,rotate=90]
+\tikzstyle{every tick}=[very thin,gray]
+\tikzstyle{every minor tick}=[]
+\tikzstyle{every tick label}=[]
+\tikzstyle{every x tick label}=[]
+\tikzstyle{every y tick label}=[]
+
+% specifies how and where to draw the axis.
+% \tikzstyle{every axis legend}+=[at={(0,0)}]
+% will draw it at the lower left corner of the axis while
+% \tikzstyle{every axis legend}+=[at={(1,1)}]
+% means the upper right corner.
+%
+% The legend is a 'node' so you can use any tikz option which affects
+% nodes. The option 'text width' is set automatically, depending on
+% the \legend[textwidth=...] option.
+%
+% Examples:
+% - \tikzstyle{every axis legend}+=[at={(1.02,1)},anchor=north west]
+% draws the legend OUTSIDE TOP RIGHT.
+%
+% - \tikzstyle{every axis legend}+=[at={(1,0.5)},anchor=east,outer sep=0.5cm]
+% draws the legend INSIDE MIDDLE RIGHT, separated by 0.5cm from the axis.
+\tikzstyle{every axis legend}=[%
+ anchor=north east,%
+ shape=rectangle,%
+ fill=white,%
+ draw=black,
+ at={(0.98,0.98)}
+ ]
+% at={(1,1)},
+% outer sep=0.1cm]
+
+
+%
+% xticklabel:
+% im argument kann man '\axisticknum' und '\tick' verwenden.
+% '\tick' ist der eintrag aus '\xtick', der gerade bearbeitet wird,
+% '\axisticknum' seine nummer.
+%
+% yticklabel:
+% analog zu xticklabel.
+%
+% xfilter/yfilter
+% \def\meinxfilter#1\to#2{\def#2{1.4}}
+% xfilter=\meinxfilter
+%
+% if the filtered coordinate is empty string, it will be skipped.
+\define@cmdkeys[\prefix]{axis}[axis@]{%
+ xmin,xmax,xticklabel,xtick,xtickten,xlabel,%
+ ymin,ymax,yticklabel,ytick,ytickten,ylabel,%
+ trimxmin,trimxmax,trimymin,trimymax,%
+ subtickwidth,tickwidth,%
+ xfilter,yfilter,%
+ width,height,%
+ execute at begin plot,%
+ execute at end plot,%
+ x,y}%
+
+% sets \axis@tickposnum to
+% left=0
+% right=1
+% both=2
+\define@choicekey[\prefix]{axis}{tickpos}[\val\nr]{left,right,both}{%
+ \axis@tickposnum=\nr\relax
+}
+\define@boolkeys[\prefix]{axis}[axis@]{%
+ xminorticks,%
+ yminorticks,%
+ disablelogfilter,%
+ enlargelimits}[true]
+
+% sets \axis@xmode to
+% normal=0
+% log=1
+\define@choicekey[\prefix]{axis}{xmode}[\val\nr]{normal,log}{%
+ \axis@xmode=\nr\relax
+}
+
+% sets \axis@ymode to
+% normal=0
+% log=1
+\define@choicekey[\prefix]{axis}{ymode}[\val\nr]{normal,log}{%
+ \axis@ymode=\nr\relax
+}
+
+% Options to legend:
+% textwidth=auto
+% textwidth=none
+% textwidth=DIMENSION
+\define@cmdkey[\prefix]{legend}[axis@legend@]{textwidth}[auto]{}%
+
+\define@cmdkey[\prefix]{legend}[axis@legend@]{font}[]{}
+
+\long\def\axispreset#1{%
+ \presetkeys[\prefix]{axis}{#1}{}%
+}
+\long\def\legendpreset#1{%
+ \presetkeys[\prefix]{legend}{#1}{}%
+}
+
+\presetkeys[\prefix]{axis}{%
+ xmode=normal,
+ xmin=,
+ xmax=,
+ trimxmin=,
+ trimxmax=,
+ xlabel=,
+ xtick=,
+ xtickten=,
+ xticklabel=,
+ xminorticks=true,
+ ymode=normal,
+ ymin=,
+ ymax=,
+ trimymin=,
+ trimymax=,
+ ylabel=,
+ ytick=,
+ ytickten=,
+ yticklabel=,
+ yminorticks=true,
+ tickpos=both,
+ xfilter=,
+ yfilter=,
+ width=,
+ height=,
+ subtickwidth=0.1cm,
+ tickwidth=0.15cm,
+ x=,% is implicitly set by 'width' and/or '\axisdefaultwidth'
+ y=,% is implicitly set by 'height' and/or '\axisdefaultheight'
+ execute at begin plot=,%
+ execute at end plot=,%
+ enlargelimits=false,
+ disablelogfilter=false}{}
+
+\presetkeys[\prefix]{legend}{%
+ textwidth=auto,
+ font=}{}
+
+
+\def\logten{2.302585}
+
+\newcommand{\logi}[1]{%
+ \ifcase#1
+ \or0
+ \or0.693147
+ \or1.098612
+ \or1.386294
+ \or1.60943791
+ \or1.7917594
+ \or1.94591014
+ \or2.07944154
+ \or2.197224
+ \fi
+}
+
+\newcommand{\show@yticklabel}[2]{{%
+ \let\ticknum=#1%
+ \def\tick{#2}%
+ \axis@yticklabel
+}}
+
+% x-Achsenbeschriftung zum #1.ten Tick:
+% #1: die ticknum
+% #2: der x wert dafuer
+\newcommand{\show@xticklabel}[2]{{%
+ \let\ticknum=#1%
+ \def\tick{#2}%
+ \axis@xticklabel
+}}
+
+\newcommand{\axisdefaultticklabel}[0]{%
+ $\tick$%
+}
+
+\newcommand{\axisdefaultticklabellog}[0]{%
+ $10^{\logtologten\tick}$%
+}
+
+
+\newcommand{\showxlabel}{%
+ \node
+ [style=every axis label,%
+ style=every axis x label]
+ {\axis@xlabel};
+}
+\newcommand{\showylabel}{%
+ \node
+ [style=every axis label,
+ style=every axis y label]
+ {\axis@ylabel};
+}
+
+% Y-Achsen und Achsenbeschriftung LOG:
+% 1: Ticks
+\newcommand{\yachse}[1]{%
+ \axisticknum=0
+ \foreach \y in {#1} {
+ %\pgfextracty{\axis@tmpa}{\pgfpointxy{0}{\logten*\y}}%
+ \pgfextracty{\axis@tmpa}{\pgfpointxy{0}{\y}}%
+ %
+ \ifdim\axis@tmpa<\axis@ycoordminTEX
+ \else
+ \ifdim\axis@tmpa>\axis@ycoordmaxTEX
+ \else
+ % Achsenbeschriftung:
+ \ifnum\axis@tickposnum=1
+ \node at
+ (\axis@xcoordmaxTEX\axis@leftover,\axis@tmpa)
+ [right,style=every tick label,style=every y tick label]
+ {\show@yticklabel\axisticknum\y};
+ \else
+ \node at
+ (\axis@xcoordminTEX\axis@leftover,\axis@tmpa)
+ [left,style=every tick label,style=every y tick label]
+ {\show@yticklabel\axisticknum\y};
+ \fi
+ \global\advance\axisticknum by1
+ \fi
+ \fi
+ \begin{scope}
+ \clip (\axis@xcoordminTEX\axis@leftover, \axis@ycoordminTEX\axis@leftover)
+ rectangle (\axis@xcoordmaxTEX\axis@rightover, \axis@ycoordmaxTEX\axis@rightover);
+ % Y-Achsenticks links und rechts
+ % in log:
+ % beachte: log( i*10^k ) = log\i + k\log10 -> male ticks für i=1..9
+ \ifaxis@yminorticks
+ \foreach \i in {1,...,9} {
+ \pgfextracty{\axis@tmpb}{\pgfpointxy{0}{\logi\i}}%
+ \advance\axis@tmpa by\axis@tmpb
+ \draw[style=every tick,style=every minor tick]
+ \ifcase\axis@tickposnum
+ (\axis@xcoordminTEX\axis@leftover, \axis@tmpa)
+ -- (\axis@xcoordminTEX+\axis@subtickwidth, \axis@tmpa)
+ \or
+ (\axis@xcoordmaxTEX\axis@rightover, \axis@tmpa)
+ -- (\axis@xcoordmaxTEX-\axis@subtickwidth, \axis@tmpa)
+ \or
+ (\axis@xcoordminTEX\axis@leftover, \axis@tmpa)
+ -- (\axis@xcoordminTEX+\axis@subtickwidth, \axis@tmpa)
+
+ (\axis@xcoordmaxTEX\axis@rightover, \axis@tmpa)
+ -- (\axis@xcoordmaxTEX-\axis@subtickwidth, \axis@tmpa)
+ \fi
+ ;
+ }%
+ \fi
+ \draw[style=every tick]
+ \ifcase\axis@tickposnum
+ (\axis@xcoordminTEX\axis@leftover,\axis@tmpa)
+ -- (\axis@xcoordminTEX+\axis@tickwidth,\axis@tmpa)
+ \or
+ (\axis@xcoordmaxTEX\axis@rightover,\axis@tmpa)
+ -- (\axis@xcoordmaxTEX-\axis@tickwidth,\axis@tmpa)
+ \or
+ (\axis@xcoordminTEX\axis@leftover,\axis@tmpa)
+ -- (\axis@xcoordminTEX+\axis@tickwidth,\axis@tmpa)
+ (\axis@xcoordmaxTEX\axis@rightover,\axis@tmpa)
+ -- (\axis@xcoordmaxTEX-\axis@tickwidth,\axis@tmpa)
+ \fi
+ ;
+ \end{scope}
+ }
+}
+
+% X-Achsen und Achsenbeschriftung
+% 1: Ticks
+\newcommand{\xachse}[1]{%
+ \axisticknum=0
+ \foreach \x in {#1} {
+ % \pgfextractx{\axis@tmpa}{\pgfpointxy{\logten*\x}{0}}%
+ \pgfextractx{\axis@tmpa}{\pgfpointxy{\x}{0}}%
+ %
+ \ifdim\axis@tmpa<\axis@xcoordminTEX
+ \else
+ \ifdim\axis@tmpa>\axis@xcoordmaxTEX
+ \else
+ % Achsenbeschriftung:
+ \ifnum\axis@tickposnum=1
+ \node at
+ (\axis@tmpa,\axis@ycoordmaxTEX\axis@leftover)
+ [above,style=every tick label,style=every x tick label]
+ {\show@xticklabel\axisticknum\x};
+ \else
+ \node at
+ (\axis@tmpa,\axis@ycoordminTEX\axis@leftover)
+ [below,style=every tick label,style=every x tick label]
+ {\show@xticklabel\axisticknum\x};
+ \fi
+ \global\advance\axisticknum by1
+ \fi
+ \fi
+
+ \begin{scope}
+ \clip (\axis@xcoordminTEX\axis@leftover, \axis@ycoordminTEX\axis@leftover)
+ rectangle (\axis@xcoordmaxTEX\axis@rightover, \axis@ycoordmaxTEX\axis@rightover);
+ % Y-Achsenticks links und rechts
+ % in log:
+ % beachte: log( i*10^k ) = log\i + k\log10 -> male ticks für i=1..9
+ \ifaxis@xminorticks
+ \foreach \i in {1,...,9} {
+ \pgfextractx{\axis@tmpb}{\pgfpointxy{\logi\i}{0}}%
+ \advance\axis@tmpa by\axis@tmpb
+ \draw[style=every tick,style=every minor tick]
+ \ifcase\axis@tickposnum
+ (\axis@tmpa, \axis@ycoordminTEX\axis@leftover)
+ -- (\axis@tmpa, \axis@ycoordminTEX+\axis@subtickwidth)
+ \or
+ (\axis@tmpa, \axis@ycoordmaxTEX\axis@rightover)
+ -- (\axis@tmpa, \axis@ycoordmaxTEX-\axis@subtickwidth)
+ \or
+ (\axis@tmpa, \axis@ycoordminTEX\axis@leftover)
+ -- (\axis@tmpa, \axis@ycoordminTEX+\axis@subtickwidth)
+
+ (\axis@tmpa, \axis@ycoordmaxTEX\axis@rightover)
+ -- (\axis@tmpa, \axis@ycoordmaxTEX-\axis@subtickwidth)
+ \fi
+ ;
+ }%
+ \fi
+ \draw[style=every tick]
+ \ifcase\axis@tickposnum
+ (\axis@tmpa, \axis@ycoordminTEX\axis@leftover)
+ -- (\axis@tmpa, \axis@ycoordminTEX+\axis@tickwidth)
+ \or
+ (\axis@tmpa, \axis@ycoordmaxTEX\axis@rightover)
+ -- (\axis@tmpa, \axis@ycoordmaxTEX-\axis@tickwidth)
+ \or
+ (\axis@tmpa, \axis@ycoordminTEX\axis@leftover)
+ -- (\axis@tmpa, \axis@ycoordminTEX+\axis@tickwidth)
+ (\axis@tmpa, \axis@ycoordmaxTEX\axis@rightover)
+ -- (\axis@tmpa, \axis@ycoordmaxTEX-\axis@tickwidth)
+ \fi
+ ;
+ \end{scope}
+ }
+}
+
+\def\axis@rememberplotspec#1{{%
+ \globaldefs=1
+ \listpushback#1\to\axis@plotspeclist
+ \advance\axis@numplots by1%
+}}
+
+\def\axis@getautoplotspec into#1{%
+ \listsize\autoplotspeclist\to\c@pgf@counta
+ \ifnum\c@pgf@counta=0
+ \let#1=\empty
+ \else
+ \c@pgf@countb=\axis@numplots
+ \loop
+ \ifnum\c@pgf@countb<\c@pgf@counta
+ \else
+ \advance\c@pgf@countb by-\c@pgf@counta
+ \repeat
+ \listselect\c@pgf@countb\of\autoplotspeclist\to#1
+ %\message{pgfplots.sty: using \string\autoplotspeclist\ specification no\#\the\c@pgf@countb (of \the\c@pgf@counta): #1}%
+ \fi
+}
+
+% The main interface to draw a plot into an axis.
+%
+% Usage:
+% \addplot
+% plot coordinates {
+% (0,0)
+% (1,1)
+% };
+%
+% or
+%
+% \addplot[color=blue,mark=*]
+% plot coordinates {
+% (0,0)
+% (1,1)
+% };
+%
+% The first syntax will use the next plot specification in the list
+% \autoplotspeclist
+% and the first will use blue color and * markers.
+%
+% The linespec. will be used in the legend.
+\long\def\addplot{%
+ \@ifnextchar[{%
+ \axis@addplotimpl%
+ }{%
+ \axis@getautoplotspec into\nextplotspec
+ % the space after ']' is required here:
+ % FIXME:
+ % - \addplot[]plot coordinates is NOT allowed!?
+ \expandafter\axis@addplotimpl\expandafter[\nextplotspec]
+ }%
+}
+
+\long\def\axis@addplotimpl[#1] #2;{%
+ % #2 = plot coordinates {...}
+ \ifx\csname axis@execute at begin plot\endcsname\empty
+ \else
+ \csname axis@execute at begin plot\endcsname
+ \fi
+ \axis@rememberplotspec{[#1]}
+ \ifaxis@filtercoords
+ % FIXME : FREE THIS VARIABLE:
+ \axis@filtercoords#2\newplotcmdto\axis@filteredcoordinateplotcmd
+ \ifaxis@draw@at@end
+ \expandafter\axis@update@limits\axis@filteredcoordinateplotcmd;%
+ \fi
+ \def\axis@TMP{\axispath\draw[style=every axis plot,#1] }%
+ \expandafter\axis@TMP\axis@filteredcoordinateplotcmd;%
+ %\tracingmacros=2\tracingcommands=2
+ %\tracingmacros=0\tracingcommands=0
+ \else
+ \ifaxis@draw@at@end
+ \axis@update@limits#2;%
+ \fi
+ \axispath\draw[style=every axis plot,#1] #2;%
+ \fi
+ \ifx\csname axis@execute at end plot\endcsname\empty
+ \else
+ \csname axis@execute at end plot\endcsname
+ \fi
+}%
+
+\long\def\axis@update@limits plot coordinates #1;{%
+%\axis@update@limits@forpoint#1\axis@restinto\axis@TMP
+ \def\axis@TMP{#1}%
+ \def\axis@TMPB{ }%
+ \ifx\axis@TMPB\axis@TMP% FIXME isn't there a better way to exclude spaces!?
+ \let\axis@TMP=\empty
+ \fi
+ \loop
+ \ifx\axis@TMP\empty
+ \else
+ \expandafter\axis@update@limits@forpoint\axis@TMP\axis@restinto\axis@TMP
+ \ifx\axis@TMPB\axis@TMP% FIXME isn't there a better way to exclude spaces!?
+ \let\axis@TMP=\empty
+ \fi
+ \repeat
+}
+
+% #1: optional white spaces (will be ignored). FIXME is there a better
+% way? I could not get \ignorespaces into this ...
+\long\def\axis@update@limits@forpoint#1(#2,#3)#4\axis@restinto#5{%
+ \ifaxis@autocompute@xlim
+ \pgfmathlog@invoke@expanded\pgfmathmin@{{\axis@xmin}{#2}}%
+ \let\axis@xmin=\pgfmathresult
+ \pgfmathlog@invoke@expanded\pgfmathmax@{{\axis@xmax}{#2}}%
+ \let\axis@xmax=\pgfmathresult
+ \fi
+ \ifaxis@autocompute@ylim
+ \pgfmathlog@invoke@expanded\pgfmathmin@{{\axis@ymin}{#3}}%
+ \let\axis@ymin=\pgfmathresult
+ \pgfmathlog@invoke@expanded\pgfmathmax@{{\axis@ymax}{#3}}%
+ \let\axis@ymax=\pgfmathresult
+ \fi
+ \def#5{#4}%
+ \axis@limits@are@computedtrue
+}
+
+% Filters coordinates and writes a new, modified 'plot coordinates'
+% command to macro #2.
+\long\def\axis@filtercoords plot coordinates #1\newplotcmdto#2{%
+ %\edef#2{plot coordinates \verb|}|}%
+ \let#2=\empty
+ \def\axis@TMP{#1}%
+ \def\axis@TMPB{ }%
+ \ifx\axis@TMPB\axis@TMP% FIXME isn't there a better way to exclude spaces!?
+ \let\axis@TMP=\empty
+ \fi
+ \loop
+ \ifx\axis@TMP\empty
+ \else
+ \expandafter\axis@filter@point\axis@TMP\appendto#2\axis@restinto\axis@TMP
+ \ifx\axis@TMPB\axis@TMP% FIXME isn't there a better way to exclude spaces!?
+ \let\axis@TMP=\empty
+ \fi
+ \repeat
+ \edef#2{plot coordinates {#2}}%
+}
+
+% #1: optional white spaces (will be ignored). FIXME is there a better
+% way? I could not get \ignorespaces into this ...
+\long\def\axis@filter@point#1(#2,#3)#4\appendto#5\axis@restinto#6{%
+ \ifx\axis@xfilter\empty
+ \def\axis@filter@tmpx{#2}%
+ \else
+ \let\axis@filter@tmpx=\empty
+ \axis@xfilter#2\to\axis@filter@tmpx\relax
+ \fi
+ \ifx\axis@yfilter\empty
+ \def\axis@filter@tmpy{#3}%
+ \else
+ \let\axis@filter@tmpy=\empty
+ \axis@yfilter#3\to\axis@filter@tmpy\relax
+ \fi
+ \ifx\axis@filter@tmpx\empty
+ \message{NOTE: coordinate (#2,#3) has been dropped because of the x-coordinate filter.}%
+ \else
+ \ifx\axis@filter@tmpy\empty
+ \message{NOTE: coordinate (#2,#3) has been dropped because of the y-coordinate filter.}%
+ \else
+ \edef#5{#5 (\axis@filter@tmpx,\axis@filter@tmpy)}%
+ \fi
+ \fi
+ \def#6{#4}%
+}
+
+\long\def\axispath#1;{%
+ \ifaxis@draw@at@end
+ \listpushback{#1;}\to\axis@draw@stored@plots%
+ \else
+ #1;%
+ \fi
+}
+
+
+% Assigns a legend.
+% Syntax:
+% \legend{entry 1\\entry2\\entry3}
+% or
+% \legend[OPTIONS]{entry 1\\entry2\\}
+%
+% where OPTIONS is
+% - textwidth=auto | DIMEN | none
+% like
+% \legend[textwidth=auto]{entry 1\\entry2\\}
+% \legend[textwidth=2cm}{...}
+% \legend[textwidth=none}{...}
+%
+% The option "textwidth=auto" chooses the correct width automatically;
+% the option "textwidth=none" does not perform any line breaking and
+% "textwidth=DIMEN" uses the fixed dimenion DIMEN for the (total)
+% width of the legend.
+%
+% - font={...}
+% \legend[font=\Huge}{...}
+\newcommand{\legend}[2][]{
+ {%
+ \globaldefs=1% this will ONLY store the options and the legend into global variables
+ \setkeys[\prefix]{legend}{#1}%
+ \def\axis@TMP{#2}%
+ \ifx\axis@TMP\empty
+ \else
+ \listnew\axis@legend{#2}%
+ \fi
+ }
+}
+
+\newcommand{\addlegendentry}[1]{%
+ {%
+ \globaldefs=1% this will ONLY store the options and the legend into global variables
+ \listpushback#1\to\axis@legend
+ }%
+}
+
+\def\getnextlegend{{%
+ \globaldefs=1
+ \listcheckempty\axis@plotspeclist
+ \iflistempty
+ \let\axis@curplotlist=\empty
+ \else
+ \listpopfront\axis@plotspeclist\to\axis@curplotlist
+ \fi
+ %
+ \listcheckempty\axis@legend
+ \iflistempty
+ \let\axis@curlegend=\empty
+ \else
+ \listpopfront\axis@legend\to\axis@curlegend
+ \fi
+ \advance\axis@numplots by-1
+}}
+
+\def\axis@setlegendfont{%
+ \tikz@textfont
+ \axis@legend@font
+}
+
+% Helper function for \axis@createlegend
+% It assigns the TOTAL width of the legend node to
+% the dimension register #1 and the option to #2 as macro.
+% Arguments:
+% #1 a temporary dimension register which will be filled with the
+% width.
+% #2 a macro name which will be filled with 'text width=XXXX'.
+% WARNING:
+% this function use the variables
+% - \axis@legend@textwidth (from keyval, see above)
+% - \axis@TMP
+% - \legendCOORDC
+% - \legendHSEP
+\def\axis@legend@determinewidth\to#1\optionto#2{%
+ \def\axis@TMP{auto}%
+ \ifx\axis@legend@textwidth\axis@TMP
+ % OPTION
+ % \legend[textwidth=auto]
+ %
+ % STEP 1: maximum width legend entries
+ #1=0cm
+ \begingroup
+ \listforeach\axis@legend\as\axis@curlegend{%
+ \setbox0=\hbox{{%
+ \pgfutil@selectfont% RESTORE normal fonts (have been resetted by PGF)
+ \axis@setlegendfont
+ \axis@curlegend%
+ }}%
+ \ifdim\wd0>#1
+ \global#1=\wd0
+ \fi
+ }%
+ \endgroup
+ % STEP 2: add plot spec width:
+ \expandafter\axis@tmpb\legendCOORDC
+ \advance#1 by\axis@tmpb
+ % STEP 3: hspace between plot spec and legend:
+ \advance#1 by\legendHSEP
+ %\advance#1 by1pt% FIXME I don't know why there was to few place!?
+ \def#2{text width=\the#1,}%
+ \else
+ \def\axis@TMP{none}%
+ \ifx\axis@legend@textwidth\axis@TMP
+ % OPTION
+ % \legend[textwidth=none]
+ % don't make a '\node[text width=XX]' option:
+ #1=0cm
+ \def#2{}%
+ \else
+ % OPTION
+ % \legend[textwidth=2cm]
+ % just use it:
+ \expandafter#1\axis@legend@textwidth
+ \def#2{text width=\the#1,}%
+ \fi
+ \fi
+ %
+}
+
+\newcommand\axis@createlegend{%
+ \listcheckempty\axis@legend
+ \iflistempty
+ \else
+ %
+ \def\legendHSEP{5pt}%
+ \def\legendCOORDB{0.3cm}%
+ \def\legendCOORDC{0.6cm}%
+ %
+ \axis@legend@determinewidth\to\pgf@xa\optionto\axis@TMP
+ %
+ %
+ % This code here invokes
+ % \node[<CONTENTS OF \axis@TMP>,
+ % ...
+ % ]
+ % where \axis@TMP contains a "text width=XXX" option.
+ %DEBUG:
+ %\draw[red] (0,0) rectangle (1,1);
+ \expandafter\node\expandafter[\axis@TMP%
+ style=every axis legend]
+ {%
+ \loop\ifnum0<\axis@numplots
+ \getnextlegend
+ \ifx\axis@curlegend\empty
+ \else
+ \vbox{%
+ \noindent
+ \begin{minipage}[c]{\legendCOORDC}%
+ \tikz
+ \expandafter\draw\axis@curplotlist
+ [mark repeat=2,mark phase=2]
+ plot coordinates {
+ (0cm,0cm)
+ (\legendCOORDB,0cm)
+ (\legendCOORDC,0cm)};%
+ \hss
+ \end{minipage}
+ %\expandafter\hskip\legendHSEP
+ \axis@setlegendfont
+ \axis@curlegend
+ }%
+ \fi
+ \repeat
+ };
+ \fi
+}
+
+% Checks whether the argument to xtick or ytick is a UNIFORM tick
+% sequence.
+%
+% A uniform tick sequence is 0,...,10 and 3,4,5 and -5,-4,-2 but
+% NOT 0,2,4 or 4,10.
+%
+% Furthermore, any NON-integer tick arguments are also assumed to be
+% NOT uniform.
+%
+% INPUT:
+% #1: a tick argument (i.e. something which can be put to
+% \foreach \x in {#1})
+%
+% OUTPUT:
+% \axis@isuniformticktrue
+% or
+% \axis@isuniformtickfalse
+% depending on the check.
+% This variable will be set globally.
+\def\axis@checkisuniformLOGtick#1{%
+ \begingroup
+ \global\axis@isuniformticktrue
+ \newif\ifisfirst
+ \isfirsttrue
+ \foreach \x in {#1}{%
+ \pgfmathlog@invoke@expanded\pgfmathdivide@{{\x}{\logten}}%
+ \let\cur=\pgfmathresult
+ % check whether
+ % \cur - last == 1 (last = \axis@TMPB)
+ \ifisfirst
+ \global\isfirstfalse
+ \else
+ \pgfmathlog@invoke@expanded\pgfmathsubtract@{{\cur}{\axis@TMPB}}%
+ \def\axis@TMP{1.0}%
+ \ifx\axis@TMP\pgfmathresult
+ \else
+ \global\axis@isuniformtickfalse
+ \breakforeach
+ \fi
+ \fi
+ \global\let\axis@TMPB=\cur
+ }%
+ \endgroup
+}
+
+\def\skipsuffixzero#1.#2|{
+ {%
+ \def\axis@TMP{#2}%
+ \def\axis@TMPB{0}%
+ \ifx\axis@TMP\axis@TMPB
+ \global\def\pgfmathresult{#1}%
+ \else
+ \global\def\pgfmathresult{#1.#2}%
+ \fi
+ }%
+}
+
+% Expands to #1/log(10). It will also skip a suffix '.0'
+\def\logtologten#1{%
+ \pgfmathlog@invoke@expanded\pgfmathdivide@{{#1}{\logten}}%
+ \expandafter\skipsuffixzero\pgfmathresult|%
+ \pgfmathresult
+}
+
+% helper method which computes log10*\x foreach \x in {#1}.
+% The result will be \xdef'ed into #2.
+\def\axis@compute@tick@times@logten#1\to#2{%
+ \global\let#2=\empty
+ \foreach \axis@TMPB in {#1} {%
+ \pgfmathlog@invoke@expanded\pgfmathmultiply@{{\axis@TMPB}{\logten}}%
+ \ifx#2\empty
+ \xdef#2{\pgfmathresult}%
+ \else
+ \xdef#2{#2,\pgfmathresult}%
+ \fi
+ }%
+}
+
+\def\axis@enlarge@xlim{%
+ \ifcase\axis@xmode
+ \pgfmathlog@invoke@expanded\pgfmathsubtract@{{\axis@xmin}{0.5}}%
+ \let\axis@xmin=\pgfmathresult
+ \pgfmathlog@invoke@expanded\pgfmathadd@{{\axis@xmax}{0.5}}%
+ \let\axis@xmax=\pgfmathresult
+ \or
+ % compute
+ % \pgfmathsetmacro{\axis@xmin}{\axis@xmin - 0.5*\logten}%
+ % \pgfmathsetmacro{\axis@xmax}{\axis@xmax + 0.5*\logten}%
+ % just a more efficiently (I hope so):
+ \expandafter\pgfmath@x\logten pt
+ \divide\pgfmath@x by2
+ \pgfmathlog@invoke@expanded\pgfmathsubtract@{{\axis@xmin}{\pgf@sys@tonumber{\pgfmath@x}}}%
+ \let\axis@xmin=\pgfmathresult
+ \pgfmathlog@invoke@expanded\pgfmathadd@{{\axis@xmax}{\pgf@sys@tonumber{\pgfmath@x}}}%
+ \let\axis@xmax=\pgfmathresult
+ \fi
+}
+\def\axis@enlarge@ylim{%
+ \ifcase\axis@ymode
+ \pgfmathlog@invoke@expanded\pgfmathsubtract@{{\axis@ymin}{0.5}}%
+ \let\axis@ymin=\pgfmathresult
+ \pgfmathlog@invoke@expanded\pgfmathadd@{{\axis@ymax}{0.5}}%
+ \let\axis@ymax=\pgfmathresult
+ \or
+ % compute
+ % \pgfmathsetmacro{\axis@ymin}{\axis@ymin - 0.5*\logten}%
+ % \pgfmathsetmacro{\axis@ymax}{\axis@ymax + 0.5*\logten}%
+ % just a more efficiently (I hope so):
+ \expandafter\pgfmath@y\logten pt
+ \divide\pgfmath@y by2
+ \pgfmathlog@invoke@expanded\pgfmathsubtract@{{\axis@ymin}{\pgf@sys@tonumber{\pgfmath@y}}}%
+ \let\axis@ymin=\pgfmathresult
+ \pgfmathlog@invoke@expanded\pgfmathadd@{{\axis@ymax}{\pgf@sys@tonumber{\pgfmath@y}}}%
+ \let\axis@ymax=\pgfmathresult
+ \fi
+}
+
+
+\def\axis@determinedefaultvalues{%
+ % NOTIZ:
+ %
+ % wenn ich AUTOMATISCH aus (x_i,y_i)
+ % [xy]min und [xy]max ausrechnen will, muss ich
+ % ggf.
+ % xmin = min_{i} { untere_gaussklammer(log(x_i) / log10) }
+ % rechnen
+ %
+ \ifx\axis@xmin\empty
+ \errmessage{Sorry, the argument 'xmin=NUM' is mandatory to draw axes }%
+ \fi
+ \ifx\axis@xmax\empty
+ \errmessage{Sorry, the argument 'xmax=NUM' is mandatory to draw axes }%
+ \fi
+ \ifx\axis@ymin\empty
+ \errmessage{Sorry, the argument 'ymin=NUM' is mandatory to draw axes }%
+ \fi
+ \ifx\axis@ymax\empty
+ \errmessage{Sorry, the argument 'ymax=NUM' is mandatory to draw axes }%
+ \fi
+ %
+ %
+ \ifx\axis@trimxmin\empty
+ \else
+ \pgfmathlog@invoke@expanded\pgfmathmax@{{\axis@xmin}{\axis@trimxmin}}%
+ \let\axis@xmin=\pgfmathresult
+ \fi
+ \ifx\axis@trimxmax\empty
+ \else
+ \pgfmathlog@invoke@expanded\pgfmathmin@{{\axis@xmax}{\axis@trimxmax}}%
+ \let\axis@xmax=\pgfmathresult
+ \fi
+ \ifx\axis@trimymin\empty
+ \else
+ \pgfmathlog@invoke@expanded\pgfmathmax@{{\axis@ymin}{\axis@trimymin}}%
+ %\pgfmathmax\axis@ymin\axis@trimymin%
+ \let\axis@ymin=\pgfmathresult
+ \fi
+ \ifx\axis@trimymax\empty
+ \else
+ \pgfmathlog@invoke@expanded\pgfmathmin@{{\axis@ymax}{\axis@trimymax}}%
+ %\pgfmathmin\axis@ymax\axis@trimymax%
+ \let\axis@ymax=\pgfmathresult
+ \fi
+ %
+ %
+ \ifnum\axis@xmode=0
+ \axis@xminorticksfalse
+ \fi
+ \ifnum\axis@ymode=0
+ \axis@yminorticksfalse
+ \fi
+ \ifaxis@enlargelimits
+ % relax the sizes.
+ %
+ % Idea: if the user chose his xmin,xmax tight to his data,
+ % this here will look better.
+ \axis@enlarge@xlim
+ \axis@enlarge@ylim
+ \else
+ \ifaxis@autocompute@xlim
+ \axis@enlarge@xlim
+ \fi
+ \ifaxis@autocompute@ylim
+ \axis@enlarge@ylim
+ \fi
+ \fi
+%
+ \newif\ifaxis@xisuniform
+ \newif\ifaxis@yisuniform
+ \axis@xisuniformtrue
+ \axis@yisuniformtrue
+ \newif\ifaxis@needs@check@uniformtick
+ \axis@needs@check@uniformticktrue
+ \ifx\axis@xtick\empty
+ \begingroup
+ \ifcase\axis@xmode
+ \pgfmathsetcount{\c@pgf@counta}{\axis@xmin-1}%
+ \edef\tmp@min{\the\c@pgf@counta}%
+ \pgfmathsetcount{\c@pgf@counta}{\axis@xmax}%
+ \edef\tmp@max{\the\c@pgf@counta}%
+ \xdef\axis@TMP{\tmp@min,...,\tmp@max}%
+ \aftergroup\axis@needs@check@uniformtickfalse
+ \or
+ \ifx\axis@xtickten\empty
+ % I want ticks at 10^k. So determine k_min and k_max.
+ \pgfmathsetcount{\c@pgf@counta}{\axis@xmin/\logten-1}%
+ \pgfmathsetmacro{\tmp@min}{\c@pgf@counta*\logten}%
+ \pgfmathsetcount{\c@pgf@counta}{\axis@xmax/\logten}%
+ \pgfmathsetmacro{\tmp@max}{\c@pgf@counta*\logten}%
+ \pgfmathadd\tmp@min\logten%
+ \xdef\axis@TMP{\tmp@min,\pgfmathresult,...,\tmp@max}%
+ \aftergroup\axis@needs@check@uniformtickfalse
+ \else
+ \expandafter\axis@compute@tick@times@logten\axis@xtickten\to\axis@TMP
+ \aftergroup\axis@needs@check@uniformticktrue
+ \fi
+ \fi
+ \endgroup
+ \let\axis@xtick=\axis@TMP
+ %\message{pgfplots.sty: xtick set to \axis@xtick [xmode=\the\axis@xmode].}%
+ \fi
+ \ifaxis@needs@check@uniformtick
+ \ifnum\axis@xmode=1
+ \expandafter\axis@checkisuniformLOGtick\expandafter{\axis@xtick}%
+ \fi
+ \ifaxis@isuniformtick
+ \axis@xisuniformtrue
+ \else
+ \axis@xminorticksfalse
+ \axis@xisuniformfalse
+ \fi
+ \fi
+ %
+ %
+ %
+ \axis@needs@check@uniformticktrue
+ \ifx\axis@ytick\empty
+ \begingroup
+ \ifcase\axis@ymode
+ \pgfmathsetcount{\c@pgf@counta}{\axis@ymin-1}%
+ \edef\tmp@min{\the\c@pgf@counta}%
+ \pgfmathsetcount{\c@pgf@counta}{\axis@ymax}%
+ \edef\tmp@max{\the\c@pgf@counta}%
+ \xdef\axis@TMP{\tmp@min,...,\tmp@max}%
+ \aftergroup\axis@needs@check@uniformtickfalse
+ \or
+ \ifx\axis@ytickten\empty
+ % I want ticks at 10^k. So determine k_min and k_max.
+ \pgfmathsetcount{\c@pgf@counta}{\axis@ymin/\logten-1}%
+ \pgfmathsetmacro{\tmp@min}{\c@pgf@counta*\logten}%
+ \pgfmathsetcount{\c@pgf@counta}{\axis@ymax/\logten}%
+ \pgfmathsetmacro{\tmp@max}{\c@pgf@counta*\logten}%
+ \pgfmathadd\tmp@min\logten%
+ \xdef\axis@TMP{\tmp@min,\pgfmathresult,...,\tmp@max}%
+ \aftergroup\axis@needs@check@uniformtickfalse
+ \else
+ \expandafter\axis@compute@tick@times@logten\axis@ytickten\to\axis@TMP
+ \aftergroup\axis@needs@check@uniformticktrue
+ \fi
+ \fi
+ \endgroup
+ \let\axis@ytick=\axis@TMP
+ %\message{pgfplots.sty: ytick set to \axis@ytick[ymode=\the\axis@ymode.}%
+ \fi
+ \ifaxis@needs@check@uniformtick
+ \ifnum\axis@ymode=1
+ \expandafter\axis@checkisuniformLOGtick\expandafter{\axis@ytick}%
+ \fi
+ \ifaxis@isuniformtick
+ \axis@yisuniformtrue
+ \else
+ \axis@yminorticksfalse
+ \axis@yisuniformfalse
+ \fi
+ \fi
+ \ifx\axis@xticklabel\empty
+ \ifcase\axis@xmode
+ \def\axis@xticklabel{\axisdefaultticklabel}%
+ \or
+ \def\axis@xticklabel{\axisdefaultticklabellog}%
+ \fi
+ \fi
+ \ifx\axis@yticklabel\empty
+ \ifcase\axis@ymode
+ \def\axis@yticklabel{\axisdefaultticklabel}%
+ \or
+ \def\axis@yticklabel{\axisdefaultticklabellog}%
+ %--------------------------------------------------
+ % \def\axis@yticklabel{%
+ % \pgfmathexp\tick
+ % \expandafter\skipsuffixzero\pgfmathresult|%
+ % $\pgfmathresult$}%
+ %--------------------------------------------------
+ \fi
+ \fi
+}
+
+% Helper method for initsizes.
+%
+% It computes a scaling such that \axis@width = SCALE * ACTUAL WIDTH.
+%
+% The actual width is
+% c + x*(xmax-xmin)
+% based on
+% - x*xmax = \axis@xcoordmaxTEX
+% - x*xmin = \axis@xcoordminTEX
+% - c = estimated, a constant for the axis label/tick labels
+%
+% Arguments:
+% #1: the output argument for the SCALE.
+\def\axis@initsizes@getXscale\into#1{%
+ \expandafter\axis@tmpa\axis@width\relax
+ % EXPECTED WIDTH = X = \axis@width
+ % ACTUAL WIDTH = c + x * (xmax-xmin)
+ % where c is a CONSTANT (for the axis labels/tick labels).
+ % -> \axis@tmpXscale = (X - c) / (x *(xmax-xmin))
+ %
+ % \axis@tmpa := X-c:
+ \advance\axis@tmpa by-45pt% FIXME determine 'c' correctly!
+ % \axis@tmpb := x*(xmax-xmin):
+ \axis@tmpb=\axis@xcoordmaxTEX
+ \advance\axis@tmpb by-\axis@xcoordminTEX
+ \pgfmathlog@invoke@expanded\pgfmathdivide@{%
+ {\pgf@sys@tonumber\axis@tmpa}%
+ {\pgf@sys@tonumber\axis@tmpb}%
+ }%
+ \let#1=\pgfmathresult
+ %--------------------------------------------------
+ % \message{pgfplots.sty: Computing 'x' such that 'width = c + x*(xmax-xmin)';
+ % c=estimated,
+ % width-c =\the\axis@tmpa,
+ % x*(xmax[=\the\axis@xcoordmaxTEX] - xmin[=\the\axis@xcoordminTEX)]) = \the\axis@tmpb
+ % -> x-scale =#1 }%
+ %--------------------------------------------------
+}
+
+% The same as \axis@initsizes@getXscale, just for the height.
+\def\axis@initsizes@getYscale\into#1{%
+ \expandafter\axis@tmpa\axis@height\relax
+ % EXPECTED WIDTH = X = \axis@width
+ % ACTUAL WIDTH = c + x * (xmax-xmin)
+ % where c is a CONSTANT (for the axis labels/tick labels).
+ % -> \axis@tmpXscale = (X - c) / (x *(xmax-xmin))
+ %
+ % \axis@tmpa := X-c:
+ \advance\axis@tmpa by-45pt% FIXME determine 'c' correctly!
+ % \axis@tmpb := x*(xmax-xmin):
+ \axis@tmpb=\axis@ycoordmaxTEX
+ \advance\axis@tmpb by-\axis@ycoordminTEX
+ \pgfmathlog@invoke@expanded\pgfmathdivide@{%
+ {\pgf@sys@tonumber\axis@tmpa}%
+ {\pgf@sys@tonumber\axis@tmpb}%
+ }%
+ \let#1=\pgfmathresult
+ %--------------------------------------------------
+ % \message{pgfplots.sty: Computing 'y' such that 'height = c + y*(ymax-ymin)';
+ % %height=\axis@height,
+ % c=estimated,
+ % height-c =\the\axis@tmpa,
+ % y*(ymax[=\the\axis@ycoordmaxTEX] - ymin[=\the\axis@ycoordminTEX)]) = \the\axis@tmpb
+ % -> y-scale =#1 }%
+ %--------------------------------------------------
+}
+
+\def\axis@initsizes{%
+ % INIT.
+ %
+ % The axes 'x' and 'y' vectors will be scaled such that the total
+ % size is (\axisdefaultwidth, \axisdefaultheight).
+ %
+ % If the user specifies ONE of width OR height,
+ % the plot will be resized; keeping the aspect ratio.
+ \expandafter\pgfmath@x\axisdefaultwidth
+ \expandafter\pgfmath@y\axisdefaultheight
+ \pgfmathlog@invoke@expanded\pgfmathdivide@{%
+ {\pgf@sys@tonumber{\pgfmath@x}}%
+ {\pgf@sys@tonumber{\pgfmath@y}}%
+ }%
+ \let\axis@default@aspect@ratio=\pgfmathresult
+ %
+ \pgfpointxy{\axis@xmin}{\axis@ymin}%
+ \axis@xcoordminTEX=\pgf@x
+ \axis@ycoordminTEX=\pgf@y
+ \pgfpointxy{\axis@xmax}{\axis@ymax}%
+ \axis@xcoordmaxTEX=\pgf@x
+ \axis@ycoordmaxTEX=\pgf@y
+ %
+ %-----------------------------------------
+ % PROCESS THE 'width' and 'height' options
+ %-----------------------------------------
+ %
+ % FIXME: make these variables LOCAL:
+ \let\axis@tmpXscale=\empty%
+ \let\axis@tmpYscale=\empty%
+ % CASES:
+ % hasx := 'x' option non-empty
+ % hasy := 'y' option non-empty
+ % W := 'width' option non-empty
+ % H := 'height' option non-empty
+ %
+ % hasx hasy
+ % 0 0 -> work depend on W and H:
+ % W H
+ % 0 0 -> use \axisdefaultwidth and \axisdefaultheight
+ % 0 1 -> determine s:=\axis@tmpYscale and y*=s, x*=s (aspect ratio)
+ % 1 0 -> determine s:=\axis@tmpXscale and " " "
+ % 1 1 -> use specified width and height
+ % 0 1 -> use specified y vector, xscale by 'W' option (NO ASPECT RATIO)
+ % W
+ % 0 -> use \axisdefaultwidth
+ % 1 -> determine s:=\axis@tmpXscale
+ % 1 0 -> use specified x vector, yscale by 'H' option (NO ASPECT RATIO)
+ % H
+ % 0 -> use \axisdefaultheight
+ % 1 -> determine s:=\axis@tmpYscale
+ % 1 1 -> use specified x AND y vector (ignore W and H)
+ %
+ \ifx\axis@x\empty
+ \ifx\axis@y\empty
+ % The case hasx=0, hasy=0, W=0 H=0:
+ % the other cases for hasx=0, hasy=0 follow below.
+ \ifx\axis@width\empty\ifx\axis@height\empty
+ \let\axis@width=\axisdefaultwidth
+ \let\axis@height=\axisdefaultheight
+ \fi\fi
+ \else
+ % hasx=0, hasy=1, W=0:
+ \ifx\axis@width\empty
+ \let\axis@width=\axisdefaultwidth
+ \fi
+ \fi
+ \else
+ \ifx\axis@y\empty
+ % hasx=1, hasy=0, H=0
+ \ifx\axis@height\empty
+ \let\axis@height=\axisdefaultheight
+ \fi
+ \fi
+ \fi
+ %
+ % common code for the cases if one of W,H is 1:
+ \ifx\axis@x\empty
+ \ifx\axis@width\empty
+ \else
+ \axis@initsizes@getXscale\into\axis@tmpXscale
+ \fi
+ \else
+ \def\axis@tmpXscale{1}%
+ \fi
+ %
+ \ifx\axis@y\empty
+ \ifx\axis@height\empty
+ \else
+ \axis@initsizes@getYscale\into\axis@tmpYscale
+ \fi
+ \else
+ \def\axis@tmpYscale{1}%
+ \fi
+ %
+ \ifx\axis@x\empty\ifx\axis@y\empty
+ % hasx=0, hasy=0 and ...
+ %
+ % -> KEEP ASPECT RATIO!
+ %
+ % CASE W=0 H=1:
+ \ifx\axis@width\empty
+ \ifx\axis@height\empty
+ \else
+ \expandafter\pgfmath@y\axis@height
+ \pgfmathlog@invoke@expanded\pgfmathmultiply@{%
+ {\pgf@sys@tonumber{\pgfmath@y}}%
+ {\axis@default@aspect@ratio}%
+ }%
+ \edef\axis@width{\pgfmathresult pt}%
+ \axis@initsizes@getXscale\into\axis@tmpXscale
+ \fi
+ \else% CASE W=1 H=0:
+ \ifx\axis@height\empty
+ \expandafter\pgfmath@x\axis@width
+ \pgfmathlog@invoke@expanded\pgfmathdivide@{%
+ {\pgf@sys@tonumber{\pgfmath@x}}%
+ {\axis@default@aspect@ratio}%
+ }%
+ \edef\axis@height{\pgfmathresult pt}%
+ \axis@initsizes@getYscale\into\axis@tmpYscale
+ \fi
+ \fi
+ \fi\fi
+ % IMPLEMENTATION NOTE:
+ % if(Xscale=empty or Yscale=empty)
+ % -> LOGIC ERROR above.
+ %
+ % Apply scaling:
+ \pgfpointxy{\axis@tmpXscale}{\axis@tmpYscale}%
+ \axis@tmpa=\pgf@x
+ \axis@tmpb=\pgf@y
+ \ifx\axis@x\empty
+ \pgfsetxvec{\pgfpoint{\axis@tmpa}{0pt}}%
+ \else
+ \pgfsetxvec{\pgfpoint{\axis@x}{0pt}}%
+ \fi
+ \ifx\axis@y\empty
+ \pgfsetyvec{\pgfpoint{0pt}{\axis@tmpb}}%
+ \else
+ \pgfsetyvec{\pgfpoint{0pt}{\axis@y}}%
+ \fi
+ %
+ \pgfpointxy{\axis@xmin}{\axis@ymin}%
+ \axis@xcoordminTEX=\pgf@x
+ \axis@ycoordminTEX=\pgf@y
+ \pgfpointxy{\axis@xmax}{\axis@ymax}%
+ \axis@xcoordmaxTEX=\pgf@x
+ \axis@ycoordmaxTEX=\pgf@y
+ %-----------------------------------------
+}
+
+\def\axis@BEGIN@init@and@draw@axis{%
+ \axis@determinedefaultvalues
+ \axis@initsizes
+
+ % X-Achsenbeschriftung:
+ % LADE DIE \axis@xtick -variable REIN
+ \expandafter\xachse\expandafter{\axis@xtick}
+ %
+ % Y-Achsen und Achsenbeschriftung:
+ \expandafter\yachse\expandafter{\axis@ytick}%
+
+ % Äußerer Rahmen:
+ \draw
+ (\axis@xcoordminTEX, \axis@ycoordminTEX)
+ rectangle (\axis@xcoordmaxTEX, \axis@ycoordmaxTEX);
+
+ \begin{scope}
+ \clip
+ (\axis@xcoordminTEX, \axis@ycoordminTEX)
+ rectangle (\axis@xcoordmaxTEX, \axis@ycoordmaxTEX);
+}
+
+\def\axis@END@init@and@draw@axis{%
+ \end{scope}%
+}
+
+% Writes output to \axis@TMP
+\def\axis@filter@input@ticks@with@log#1{%
+ \let\axis@TMP=\empty
+ \foreach \axis@TMPB in {#1} {%
+ \expandafter\pgfmathlog@\expandafter{\axis@TMPB}%
+ \ifx\axis@TMP\empty
+ \xdef\axis@TMP{\pgfmathresult}%
+ \else
+ \xdef\axis@TMP{\axis@TMP,\pgfmathresult}%
+ \fi
+ }%
+}
+
+% In case of (semi-) logplots, this command will
+% - assign a filter which invokes \pgfmathlog@{} for each coordinate
+% - replace any user-specified coordinate by its log.
+%
+% All subsequent commands will then work with logarithmic coordinates.
+%
+% @see pgfmathlog.sty for details about the implementation of log().
+\def\axis@preparelog@filtering{%
+ \ifnum\axis@xmode=1
+ % any user-specified axis limits:
+ \ifx\axis@xmin\empty
+ \else
+ \expandafter\pgfmathlog@\expandafter{\axis@xmin}%
+ \let\axis@xmin=\pgfmathresult
+ \fi
+ \ifx\axis@xmax\empty
+ \else
+ \expandafter\pgfmathlog@\expandafter{\axis@xmax}%
+ \let\axis@xmax=\pgfmathresult
+ \fi
+ %
+ % any user specified axis ticks:
+ \ifx\axis@xtick\empty
+ \else
+ \expandafter\axis@filter@input@ticks@with@log\expandafter{\axis@xtick}%
+ \edef\axis@xtick{\axis@TMP}%
+ \fi
+ \ifx\axis@xfilter\empty
+ \def\addplot@log@compute@xfilter##1\to##2{%
+ \pgfmathlog@{##1}%
+ \let##2=\pgfmathresult
+ }%
+ \else
+ \let\axis@xfilter@orig=\axis@xfilter
+ \def\addplot@log@compute@xfilter##1\to##2{%
+ \pgfmathlog@{##1}%
+ \ifx\pgfmathresult\empty
+ \let##2=\empty
+ \else
+ \expandafter\axis@xfilter@orig\pgfmathresult\to##2\relax
+ \fi
+ }%
+ \fi
+ \def\axis@xfilter{\addplot@log@compute@xfilter}%
+ \fi
+ %
+ \ifnum\axis@ymode=1
+ % any user-specified axis limits:
+ \ifx\axis@ymin\empty
+ \else
+ \pgfmathlog@\expandafter{\axis@ymin}%
+ \let\axis@ymin=\pgfmathresult
+ \fi
+ \ifx\axis@ymax\empty
+ \else
+ \pgfmathlog@\expandafter{\axis@ymax}%
+ \let\axis@ymax=\pgfmathresult
+ \fi
+ %
+ % any user specified axis ticks:
+ \ifx\axis@ytick\empty
+ \else
+ \expandafter\axis@filter@input@ticks@with@log\expandafter{\axis@ytick}%
+ \edef\axis@ytick{\axis@TMP}%
+ \fi
+ \ifx\axis@yfilter\empty
+ \def\addplot@log@compute@yfilter##1\to##2{%
+ \pgfmathlog@{##1}%
+ \let##2=\pgfmathresult
+ }%
+ \else
+ \let\axis@yfilter@orig=\axis@yfilter
+ \def\addplot@log@compute@yfilter##1\to##2{%
+ \pgfmathlog@{##1}%
+ \ifx\pgfmathresult\empty
+ \let##2=\empty
+ \else
+ \expandafter\axis@yfilter@orig\pgfmathresult\to##2\relax
+ \fi
+ }%
+ \fi
+ \def\axis@yfilter{\addplot@log@compute@yfilter}%
+ \fi
+}
+
+\newenvironment{axis}[1][]{%
+ \begingroup
+ \begin{scope}[style=every axis]
+%--------------------------------------------------
+% \draw[very thin,color=gray,xstep=1,ystep=\logten]
+% (\xcoordmin\axis@leftover,\ycoordmin)
+% grid (\xcoordmax\axis@rightover,\ycoordmax);
+%--------------------------------------------------
+ \setkeys[\prefix]{axis}{#1}%
+ \setkeys[\prefix]{legend}{}%
+ %
+ \listnewempty\axis@plotspeclist
+ \listnewempty\axis@legend
+ \listnewempty\axis@draw@stored@plots
+ %
+ \ifaxis@disablelogfilter
+ \else
+ \axis@preparelog@filtering
+ \fi
+ %
+ \newif\ifaxis@filtercoords
+ \ifx\axis@xfilter\empty
+ \else
+ \axis@filtercoordstrue
+ \fi
+ \ifx\axis@yfilter\empty
+ \else
+ \axis@filtercoordstrue
+ \fi
+ %
+ \axis@numplots=0
+ %
+ \newif\ifaxis@autocompute@xlim
+ \newif\ifaxis@autocompute@ylim
+ \newif\ifaxis@draw@at@end
+ \newif\ifaxis@limits@are@computed
+ \axis@limits@are@computedtrue
+ \ifx\axis@xmin\empty
+ \axis@autocompute@xlimtrue
+ \def\axis@xmin{16300}%
+ \fi
+ \ifx\axis@xmax\empty
+ \axis@autocompute@xlimtrue
+ \def\axis@xmax{-16300}%
+ \fi
+ \ifx\axis@ymin\empty
+ \axis@autocompute@ylimtrue
+ \def\axis@ymin{16300}%
+ \fi
+ \ifx\axis@ymax\empty
+ \axis@autocompute@ylimtrue
+ \def\axis@ymax{-16300}%
+ \fi
+ %
+ \ifaxis@autocompute@xlim
+ \axis@draw@at@endtrue
+ \axis@limits@are@computedfalse
+ \fi
+ \ifaxis@autocompute@ylim
+ \axis@draw@at@endtrue
+ \axis@limits@are@computedfalse
+ \fi
+ %
+ %
+ \ifaxis@draw@at@end
+ \else
+ \axis@BEGIN@init@and@draw@axis
+ \fi
+}{%
+ \ifaxis@draw@at@end
+ \ifaxis@limits@are@computed
+ \else
+ % EMPTY AXIS:
+ \def\axis@xmin{0}%
+ \def\axis@xmax{1}%
+ \def\axis@ymin{0}%
+ \def\axis@ymax{1}%
+ \fi
+ \axis@BEGIN@init@and@draw@axis
+ \listforeach\axis@draw@stored@plots\as\plotcmd{\plotcmd}%
+ \fi
+ \axis@END@init@and@draw@axis
+ %
+ \begin{scope}[%
+ xshift=+\axis@xcoordminTEX,
+ yshift=\axis@ycoordminTEX,
+ x={\axis@xcoordmaxTEX-\axis@xcoordminTEX},
+ y={\axis@ycoordmaxTEX-\axis@ycoordminTEX}
+ ]%
+ \showxlabel
+ \showylabel
+ \axis@createlegend
+ \end{scope}%
+ %
+ \end{scope}%
+ \endgroup
+}
+
+\newenvironment{semilogxaxis}[1][]{%
+ \begin{axis}[xmode=log,ymode=normal,#1]
+}{%
+ \end{axis}%
+}
+
+\newenvironment{semilogyaxis}[1][]{%
+ \begin{axis}[xmode=normal,ymode=log,#1]
+}{%
+ \end{axis}%
+}
+
+\newenvironment{loglogaxis}[1][]{%
+ \begin{axis}[xmode=log,ymode=log,#1]
+}{%
+ \end{axis}%
+}