summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex100
1 files changed, 54 insertions, 46 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex
index d08717c533a..743f4545eea 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex
@@ -937,6 +937,7 @@
}
% \pgfplotsforeachlogarithmicungrouped[<samples>] \x/\logx in {a:b} {#3}
+% \pgfplotsforeachlogarithmicungrouped[<samples>][<math id>] \x/\logx in {a:b} {#3}
%
% samples \x between a and b using a logarithmic scale.
%
@@ -947,75 +948,82 @@
% configured otherwise with \pgfplotsforeachlogarithmicsetoutput,
% see above.
%
-% Arithmethics will be carried out with the math class
-% '\pgfplotsforeachlogarithmicmathid'.
+% Arithmethics will be carried out with the math class '<math id>'
+% (defaults to '\pgfplotsforeachlogarithmicmathid').
% This macro should expand to something which is usable inside of
-% \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{....}
+% \pgfplotscoordmath{<math id>}{....}
% the default is 'float'
%
% FIXME : THIS CAN'T BE NESTED YET!
-\def\pgfplotsforeachlogarithmicungrouped[#1]#2/#3{\pgfplotsforeachlogarithmicungrouped@[#1]{#2}{#3}}%
-\long\def\pgfplotsforeachlogarithmicungrouped@[#1]#2#3in #4#5{%
+\def\pgfplotsforeachlogarithmicungrouped[#1]{%
+ \pgfutil@ifnextchar[{%
+ \pgfplotsforeachlogarithmicungrouped@[#1]%
+ }{%
+ \pgfplotsforeachlogarithmicungrouped@[#1][\pgfplotsforeachlogarithmicmathid]%
+ }%
+}%
+\def\pgfplotsforeachlogarithmicungrouped@[#1][#2]#3/#4{\pgfplotsforeachlogarithmicungrouped@@[#1][#2]{#3}{#4}}%
+\long\def\pgfplotsforeachlogarithmicungrouped@@[#1][#2]#3#4in #5#6{%
% define
- % \pgfplots@foreach@loc@TMPd = N in fixed point
- % \pgfplots@foreach@loc@TMPc = N-1 in float :
+ % \pgfplots@foreachlog@loc@TMPd = N in fixed point
+ % \pgfplots@foreachlog@loc@TMPc = N-1 in float :
\edef\pgfplots@plot@samples@@{#1}%
- \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{one}%
- \let\pgfplots@foreach@loc@TMPa=\pgfmathresult
- \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{parsenumber}{\pgfplots@plot@samples@@}%
- \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{op}{subtract}{{\pgfmathresult}{\pgfplots@foreach@loc@TMPa}}%
- \let\pgfplots@foreach@loc@TMPc=\pgfmathresult
+ \pgfplotscoordmath{#2}{one}%
+ \let\pgfplots@foreachlog@loc@TMPa=\pgfmathresult
+ \pgfplotscoordmath{#2}{parsenumber}{\pgfplots@plot@samples@@}%
+ \pgfplotscoordmath{#2}{op}{subtract}{{\pgfmathresult}{\pgfplots@foreachlog@loc@TMPa}}%
+ \let\pgfplots@foreachlog@loc@TMPc=\pgfmathresult
%
- \edef\pgfplots@loc@TMPb{#4}%
- \expandafter\pgfplotsforeachlogarithmicungrouped@readdomain\pgfplots@loc@TMPb\relax
- \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{if is bounded}{\pgfplots@foreach@loc@TMPb}{%
+ \edef\pgfplots@loc@TMPb{#5}%
+ \expandafter\pgfplotsforeachlogarithmicungrouped@readdomain\pgfplots@loc@TMPb\relax{#2}%
+ \pgfplotscoordmath{#2}{if is bounded}{\pgfplots@foreachlog@loc@TMPb}{%
}{%
- \pgfplotsforeachlogarithmicmath@unbounded@domain{#4}%
- \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{parsenumber}{-10000}%
- \let\pgfplots@foreach@loc@TMPb=\pgfmathresult
+ \pgfplotsforeachlogarithmicmath@unbounded@domain{#5}%
+ \pgfplotscoordmath{#2}{parsenumber}{-10000}%
+ \let\pgfplots@foreachlog@loc@TMPb=\pgfmathresult
}%
- \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{if is bounded}{\pgfplots@foreach@loc@TMPa}{%
+ \pgfplotscoordmath{#2}{if is bounded}{\pgfplots@foreachlog@loc@TMPa}{%
}{%
- \pgfplotsforeachlogarithmicmath@unbounded@domain{#4}%
- \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{parsenumber}{-10000}%
- \let\pgfplots@foreach@loc@TMPa=\pgfmathresult
+ \pgfplotsforeachlogarithmicmath@unbounded@domain{#5}%
+ \pgfplotscoordmath{#2}{parsenumber}{-10000}%
+ \let\pgfplots@foreachlog@loc@TMPa=\pgfmathresult
}%
- % compute mesh width into \pgfplots@foreach@loc@TMPc:
- % \pgfplots@foreach@loc@TMPc := h := ( log(xmax) - log(xmin) ) / (N-1)
- \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{op}{subtract}{{\pgfplots@foreach@loc@TMPb}{\pgfplots@foreach@loc@TMPa}}%
- \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{op}{divide}{{\pgfmathresult}{\pgfplots@foreach@loc@TMPc}}%
- \let\pgfplots@foreach@loc@TMPc=\pgfmathresult
+ % compute mesh width into \pgfplots@foreachlog@loc@TMPc:
+ % \pgfplots@foreachlog@loc@TMPc := h := ( log(xmax) - log(xmin) ) / (N-1)
+ \pgfplotscoordmath{#2}{op}{subtract}{{\pgfplots@foreachlog@loc@TMPb}{\pgfplots@foreachlog@loc@TMPa}}%
+ \pgfplotscoordmath{#2}{op}{divide}{{\pgfmathresult}{\pgfplots@foreachlog@loc@TMPc}}%
+ \let\pgfplots@foreachlog@loc@TMPc=\pgfmathresult
%
% apply local scoping here:
- \edef\pgfplots@foreach@loc@TMPd{%
+ \edef\pgfplots@foreachlog@loc@TMPd{%
\noexpand\c@pgf@counta=\the\c@pgf@counta\noexpand\relax
}%
- \long\def\pgfplots@foreach@loc@TMPf{#5}%
+ \long\def\pgfplots@foreachlog@loc@TMPf{#6}%
\c@pgf@counta=0
\pgfutil@loop
\ifnum\c@pgf@counta<\pgfplots@plot@samples@@
% compute exp(log(min) + i * h)
\edef\pgfplots@loc@TMPa{\the\c@pgf@counta}%
- \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{parsenumber}{\pgfplots@loc@TMPa}%
- \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{op}{multiply}{{\pgfmathresult}{\pgfplots@foreach@loc@TMPc}}%
- \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{op}{add}{{\pgfmathresult}{\pgfplots@foreach@loc@TMPa}}%
+ \pgfplotscoordmath{#2}{parsenumber}{\pgfplots@loc@TMPa}%
+ \pgfplotscoordmath{#2}{op}{multiply}{{\pgfmathresult}{\pgfplots@foreachlog@loc@TMPc}}%
+ \pgfplotscoordmath{#2}{op}{add}{{\pgfmathresult}{\pgfplots@foreachlog@loc@TMPa}}%
\let\pgfplots@loc@TMPa=\pgfmathresult
\pgfplotsforeachlogarithmicungrouped@finalizeresult%
- \let#3=\pgfmathresult
- \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{exp}{\pgfplots@loc@TMPa}%
+ \let#4=\pgfmathresult
+ \pgfplotscoordmath{#2}{exp}{\pgfplots@loc@TMPa}%
\pgfplotsforeachlogarithmicungrouped@finalizeresult%
- \let#2=\pgfmathresult
+ \let#3=\pgfmathresult
%
% ok, invoke it!
% -> store \c@pgf@counta before doing so. We need to scope
% manually here.
- \edef\pgfplots@foreach@loc@TMPe{\the\c@pgf@counta}%
- \pgfplots@foreach@loc@TMPf\relax
- \c@pgf@counta=\pgfplots@foreach@loc@TMPe\relax
+ \edef\pgfplots@foreachlog@loc@TMPe{\the\c@pgf@counta}%
+ \pgfplots@foreachlog@loc@TMPf\relax
+ \c@pgf@counta=\pgfplots@foreachlog@loc@TMPe\relax
\advance\c@pgf@counta by 1
\pgfutil@repeat
% restore scoped variables:
- \pgfplots@foreach@loc@TMPd
+ \pgfplots@foreachlog@loc@TMPd
}
\def\pgfplotsforeachlogarithmicmath@unbounded@domain#1{%
@@ -1030,16 +1038,16 @@
\def\pgfplotsforeachlogarithmicmathid{float}
% defines
-% \pgfplots@foreach@loc@TMPa := log(firstintervalpt)
+% \pgfplots@foreachlog@loc@TMPa := log(firstintervalpt)
% and
-% \pgfplots@foreach@loc@TMPb := log(secondintervalpt)
-\def\pgfplotsforeachlogarithmicungrouped@readdomain#1:#2\relax{%
+% \pgfplots@foreachlog@loc@TMPb := log(secondintervalpt)
+\def\pgfplotsforeachlogarithmicungrouped@readdomain#1:#2\relax#3{%
\pgfplotscoordmath{default}{parse}{#1}%
- \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{log}{\pgfmathresult}%
- \let\pgfplots@foreach@loc@TMPa=\pgfmathresult
+ \pgfplotscoordmath{#3}{log}{\pgfmathresult}%
+ \let\pgfplots@foreachlog@loc@TMPa=\pgfmathresult
\pgfplotscoordmath{default}{parse}{#2}%
- \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{log}{\pgfmathresult}%
- \let\pgfplots@foreach@loc@TMPb=\pgfmathresult
+ \pgfplotscoordmath{#3}{log}{\pgfmathresult}%
+ \let\pgfplots@foreachlog@loc@TMPb=\pgfmathresult
}
% invokes '#2' if #1 expands (\edef) to the empty string or '#3' if not.