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.tex29
1 files changed, 28 insertions, 1 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 58ae93cbc1a..655c96f2c86 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex
@@ -458,7 +458,8 @@
% for two-dimensional plots and shall be optimized.
\def\pgfplotsqpointxy@orthogonal#1#2{%
\global\pgf@x=#1\pgf@xx%
- \global\pgf@y=#2\pgf@yy}
+ \global\pgf@y=#2\pgf@yy
+}
% Takes a domain as input and generates a foreach argument which
@@ -1278,6 +1279,32 @@
}%
}%
+% Tests if string '#2' starts with pattern '#1'.
+%
+% If so, it executes #3 and defines \pgfplotsretval to contain the
+% suffix which is not equal to #1. Otherwise it executes #4.
+\def\pgfplotsutilifstartswith#1#2#3#4{%
+ \def\pgfplotsutilifstartswith@ ##1#1##2\pgfplots@EOI{%
+ \def\pgfplotsutil@tmp{##1}%
+ \ifx\pgfplotsutil@tmp\pgfutil@empty
+ % Ah - a hit!
+ %
+ % define \pgfplotsretval to be the suffix...
+ \def\pgfplotsutil@tmp#1####1\pgfplots@EOI{%
+ \def\pgfplotsretval{####1}%
+ }%
+ \pgfplotsutil@tmp#2\pgfplots@EOI
+ %
+ % ... and execute the <true> code:
+ #3\relax
+ \else
+ % hm. No such prefix.
+ #4\relax
+ \fi
+ }%
+ \pgfplotsutilifstartswith@#2--#1\pgfplots@EOI
+}%
+
% Usage:
% \pgfplotsutilstrreplace{<token>}{<replacement>}{<string>}
%