summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/utilities')
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex2
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex11
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex23
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex10
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex90
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex579
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def3
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def12
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def32
9 files changed, 510 insertions, 252 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex
index 7cd2e4e1127..1e4960066ed 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/utilities/pgfcalendar.code.tex,v 1.11 2007/07/23 21:23:14 tantau Exp $
+\ProvidesFileRCS{pgfcalendar.code.tex}
% Translation stuff
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
index e984ca06315..47969aaba48 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/utilities/pgffor.code.tex,v 1.25 2013/12/13 11:40:27 tantau Exp $
+\ProvidesPackageRCS{pgffor.code.tex}
% pgfmath is needed
\input pgfmath.code.tex
@@ -288,6 +288,15 @@
\def\pgffor@dots@value@process#1{%
\expandafter\pgffor@dots@stripcontext#1\pgffor@@stop%
\expandafter\pgffor@dots@charcheck\pgffor@dotsvalue\pgffor@@stop%
+ \ifpgffor@alphabeticsequence
+ \else
+ \begingroup
+ \pgfkeys{/pgf/fpu/false/.try}%
+ \pgfmathparse{\pgffor@dotsvalue}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+ \let\pgffor@dotsvalue=\pgfmathresult
+ \fi
\let#1=\pgffor@dotsvalue%
}
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
index 3d79735459d..6d9f08fdcba 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
@@ -76,7 +76,11 @@
\pgfkeys@temptoks{#2}\expandafter\edef\csname pgfk@#1\endcsname{\the\pgfkeys@temptoks}%
}
-
+\long\def\pgfkeyssetevalue#1#2{%
+ \pgfkeys@temptoks={#2}%
+ \pgfkeys@temptoks=\scantokens\expandafter{\expandafter{\the\pgfkeys@temptoks}}%
+ \expandafter\edef\csname pgfk@#1\expandafter\endcsname\expandafter{\the\pgfkeys@temptoks}%
+}
% Add text to a key at the end
%
@@ -608,7 +612,7 @@
\long\def\pgfkeysedef#1#2{%
\long\edef\pgfkeys@temp##1\pgfeov{#2}%
\pgfkeyslet{#1/.@cmd}{\pgfkeys@temp}%
- \pgfkeyssetvalue{#1/.@body}{#2}%
+ \pgfkeyssetevalue{#1/.@body}{#2}%
}
@@ -633,11 +637,12 @@
\pgfkeyssetvalue{#1/.@args}{#2\pgfeov}%
\pgfkeyssetvalue{#1/.@body}{#3}%
}
+
\long\def\pgfkeysedefargs#1#2#3{%
\long\edef\pgfkeys@temp#2\pgfeov{#3}%
\pgfkeyslet{#1/.@cmd}{\pgfkeys@temp}%
\pgfkeyssetvalue{#1/.@args}{#2\pgfeov}%
- \pgfkeyssetvalue{#1/.@body}{#3}%
+ \pgfkeyssetevalue{#1/.@body}{#3}%
}
% Like \pgfkeysdefargs, but `#2' is an integer denoting the expected
@@ -677,10 +682,10 @@
% {2}
% }
% ->defargs: 1=`1', 2=`2'
-%--------------------------------------------------
-\long\def\pgfkeysdefnargs#1#2#3{\pgfkeysdefnargs@{#1}{#2}{#3}{\def}}%
-\long\def\pgfkeysedefnargs#1#2#3{\pgfkeysdefnargs@{#1}{#2}{#3}{\edef}}%
-\long\def\pgfkeysdefnargs@#1#2#3#4{%
+% --------------------------------------------------
+\long\def\pgfkeysdefnargs#1#2#3{\pgfkeysdefnargs@{#1}{#2}{#3}{\def}{\pgfkeyssetvalue}}%
+\long\def\pgfkeysedefnargs#1#2#3{\pgfkeysdefnargs@{#1}{#2}{#3}{\edef}{\pgfkeyssetevalue}}%
+\long\def\pgfkeysdefnargs@#1#2#3#4#5{%
\ifcase#2\relax
\pgfkeyssetvalue{#1/.@args}{}%
\or
@@ -714,11 +719,9 @@
\edef\pgfkeys@tempargs{\noexpand\pgfkeysvalueof{#1/.@@body}}%
\def\pgfkeys@temp{\pgfkeysdef{#1}}%
\expandafter\pgfkeys@temp\expandafter{\pgfkeys@tempargs##1}%
- \pgfkeyssetvalue{#1/.@body}{#3}%
+ #5{#1/.@body}{#3}%
}
-
-
% Defining a key command
\pgfkeysdef{/handlers/.code}{\pgfkeysdef{\pgfkeyscurrentpath}{#1}}
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex
index ef7411da924..1a413536783 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex
@@ -538,7 +538,7 @@
/pgf/key filter handlers/ignore/.code={},
/pgf/key filter handlers/ignore/.install key filter handler,
/pgf/key filter handlers/log/.code={%
- \immediate\write16{LOG: the option '\pgfkeyscurrentkey' (was originally '\pgfkeyscurrentkeyRAW') (case \pgfkeyscasenumber) has not been processed due to pgfkeysfiltered.}%
+ \pgf@typeout{LOG: the option '\pgfkeyscurrentkey' (was originally '\pgfkeyscurrentkeyRAW') (case \pgfkeyscasenumber) has not been processed due to pgfkeysfiltered.}%
},
%
%
@@ -598,7 +598,7 @@
},
/pgf/key filters/active families or no family DEBUG/.code 2 args={%
\if\pgfkeyscasenumber0%
- \immediate\write16{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) invoking unknown handler '#2']}%
+ \pgf@typeout{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) invoking unknown handler '#2']}%
\pgfkeysevalkeyfilterwith{#2}%
\else
\if\pgfkeyscasenumber3%
@@ -609,12 +609,12 @@
\ifpgfkeyssuccess
\pgfkeysisfamilyactive{\pgfkeyspred@TMP}%
\ifpgfkeysfiltercontinue
- \immediate\write16{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) family is ACTIVE]}%
+ \pgf@typeout{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) family is ACTIVE]}%
\else
- \immediate\write16{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) family is NOT active.]}%
+ \pgf@typeout{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) family is NOT active.]}%
\fi
\else% Ok, it does not belong to any family.
- \immediate\write16{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) invoking has-no-family-handler '#1']}%
+ \pgf@typeout{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) invoking has-no-family-handler '#1']}%
\pgfkeysevalkeyfilterwith{#1}%
\fi
\fi
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex
index 1f1ba110830..58fa5b0ef74 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex
@@ -14,19 +14,28 @@
% string. This command will also be available in plain TeX, where it
% prints out a message to the log.
-
-%\def\pgfversion{3.0.1-cvs}
-\def\pgfversion{3.0.1a}
+\pgfutil@IfFileExists{pgf.revision.tex}{\input pgf.revision.tex } {%
+ \def\pgfrevision{0}%
+ \def\pgfversion{0.0}%
+ \def\pgfversiondatetime{2014-07-01 00:00:00 +100}%
+ \def\pgfrevisiondatetime{2014-07-01 00:00:00 +100}%
+ \def\pgfversiondate{2014/07/01}%
+ \def\pgfrevisiondate{2014/07/01}%
+}
\begingroup
\catcode`\"=12
\pgfutil@IfUndefined{directlua}{}{%
- \directlua{pgf = {}; pgf.pgfversion = "\pgfversion"}%
+ \directlua{pgf = {}; pgf.pgfversion = "\pgfversion"}%
}%
\endgroup
-%\def\pgftypesetversion{\oldstylenums{3}.\oldstylenums{0}.\oldstylenums{1}-cvs}
-\def\pgftypesetversion{\oldstylenums{3}.\oldstylenums{0}.\oldstylenums{1}a}
+% \def\pgftypesetversion{\oldstylenums{3}.\oldstylenums{0}.\oldstylenums{1}}
+% XXX : implement pretty-printing:
+% which is better? 'version' is something like 3.0.1 . revision is
+% 3.0.1-151-g62184b3 which might be better for instable builds
+%\let\pgftypesetversion=\pgfversion
+\let\pgftypesetversion=\pgfrevision
\ifx\pgfrcsloaded\undefined
@@ -35,69 +44,40 @@
\edef\pgfrcsatcode{\the\catcode`\@}
\catcode`\@=11
-% Get date and version from RCS Ids
-\def\pgf@parseid $#1: #2.#3,v #4 #5/#6/#7 #8${%
- \pgf@parsercsfile$#2/$
- \def\pgf@rcssuffix{#3}
- \def\pgf@rcsrevision{#4}
- \def\pgf@rcsdate{#5/#6/#7}
-}
-\def\pgf@parsercsfile$#1/#2${
- \def\pgf@temp{#2}
- \ifx\pgf@temp\pgfutil@empty
- \def\pgf@rcsfile{#1}
- \else
- \pgf@parsercsfile$#2$
- \fi}
-
-\def\ProvidesFileRCS{%
- \def\pgfrcs@marshal{\ProvidesFile{\pgf@rcsfile.\pgf@rcssuffix}}%
- \pgfrcs@parserest%
-}
-\def\ProvidesPackageRCS{%
- \def\pgfrcs@marshal{\ProvidesPackage{\pgf@rcsfile}}%
- \pgfrcs@parserest%
+% not used in PGF, deprecated
+\def\ProvidesFileRCS#1{%
+ \ProvidesFile{#1}[\pgfversiondate\space v\pgfversion\space(\pgfrevision)]%
}
-\def\pgfrcs@parserest{%
- \def\pgf@rcsadditional{}%
- \afterassignment\pgfrcs@checkforoptional\let\next=}
-
-\def\pgfrcs@checkforoptional{%
- \ifx\next[%
- \let\next=\pgfrcs@getoptional%
- \else
- \let\next=\pgfrcs@package%
- \fi%
- \next}%}
-
-\def\pgfrcs@getoptional#1] ${%
- \def\pgf@rcsadditional{#1}%
- \pgfrcs@package%
-}
+\def\pgf@remove@ext#1.#2\relax{%
+ \def\pgfretval{#1}%
+}%
-\def\pgfrcs@package#1${
- \pgf@parseid $#1$
- \pgfrcs@marshal[\pgf@rcsdate\space\pgf@rcsadditional\space(rcs-revision \pgf@rcsrevision)]
+\def\ProvidesPackageRCS#1{%
+ \pgf@remove@ext#1.\relax
+ \edef\pgfrcs@marshal{{\pgfretval}[\pgfversiondate\space v\pgfversion\space(\pgfrevision)]}%
+ \expandafter\ProvidesPackage\pgfrcs@marshal
}
-\def\ProvidesClassRCS $#1$ [#2]{%
- \pgf@parseid $#1$
- \ProvidesClass{\pgf@rcsfile}[\pgf@rcsdate\space#2\space (rcs-revision \pgf@rcsrevision)]
+% not used in PGF, deprecated
+\def\ProvidesClassRCS#1{%
+ \pgf@remove@ext#1.\relax
+ \edef\pgfrcs@marshal{{\pgfretval}[\pgfversiondate\space v\pgfversion\space(\pgfrevision)]}%
+ \expandafter\ProvidesClass\pgfrcs@marshal
}
\ifx\ProvidesPackage\@undefined
- % plain tex
- \def\ProvidesPackage#1[#2]{\wlog{Loading package #1 version #2.}}
+ % plain tex
+ \def\ProvidesPackage#1[#2]{\wlog{Loading package #1 version #2.}}
\fi
\ifx\ProvidesFile\@undefined
- % plain tex
- \def\ProvidesFile#1[#2]{\wlog{Loading file #1 version #2.}}
+ % plain tex
+ \def\ProvidesFile#1[#2]{\wlog{Loading file #1 version #2.}}
\fi
-\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/utilities/pgfrcs.code.tex,v 1.31 2015/08/07 10:17:34 cfeuersaenger Exp $
+\ProvidesPackageRCS{pgfrcs.code.tex}
\catcode`\@=\pgfrcsatcode
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex
index 782d0d44748..b2f55e82923 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex
@@ -35,6 +35,16 @@
% Simple stuff
+% \pgfutil@trimspaces{<token list>}
+%
+% Removes spaces on both sides of <token list>. Same as trimspaces.sty
+\catcode`\Q=3
+\def\pgfutil@trimspaces#1{%
+ \romannumeral-`0\pgfutil@trimspaces@\noexpand#1Q Q}
+\def\pgfutil@trimspaces@#1 Q{\pgfutil@trimspaces@@#1Q}
+\def\pgfutil@trimspaces@@#1Q#2{#1}
+\catcode`\Q=11
+
% \pgfutil@ifundefined{<macro name with backslash>}
% {<is undefined code>}{<is defined code>}
%
@@ -99,6 +109,20 @@
\def\:{\pgfutil@xifnch} \expandafter\gdef\: {\futurelet\pgfutil@let@token\pgfutil@ifnch}
}
+% pgfutil@ignorespaces
+
+\def\pgfutil@ignorespaces
+ {\ifx\pgfutil@let@token\pgfutil@sptoken
+ \expandafter\pgfutil@ignorespaces@helper
+ \else
+ \expandafter\pgfutil@next
+ \fi}
+
+{
+ \def\:{\pgfutil@ignorespaces@helper}
+ \expandafter\gdef\: {\futurelet\pgfutil@let@token\pgfutil@ignorespaces}
+}
+
% pgfutil@in@
\newif\ifpgfutil@in@
@@ -106,13 +130,13 @@
% Usage:
% \pgfutil@in@{one}{three two one}
% \ifpgfutil@in@
-% -> will be true!
+% -> will be true!
% \else
% \fi
%
% \pgfutil@in@{,}{1234,456567}
% \ifpgfutil@in@
-% -> will be true!
+% -> will be true!
% \else
% \fi
\def\pgfutil@in@#1#2{%
@@ -145,7 +169,7 @@
% pgfutil@IfFileExists
-%\chardef\pgfutil@inputcheck0
+\chardef\pgfutil@inputcheck0
\def\pgfutil@IfFileExists#1#2#3{%
\openin\pgfutil@inputcheck=#1 %
\ifeof\pgfutil@inputcheck
@@ -308,58 +332,119 @@
%
\begingroup
- \catcode`\"=12
- \edef\pgf@loc@TMPa{"}%
- %
- % prepares file names by checking for double colons.
- %
- % If '#1' is a usual file name without anything fancy, \pgfretval
- % will simply contain it. However, if '#1' contains double colons
- % (introduces, for example, by pdftex because there are white
- % spaces in '#1'), the routine
- % - removes the double colons,
- % - re-inserts them outside of the string.
- %
- % \pgfutilpreparefilename{file.tex} -> file.tex
- % \pgfutilpreparefilename{"A file name".file} -> "A file name.file"
- %
- % The resulting file name is returned in '\pgfretval',
- % furthermore, a *quoted* version of the file name is returned in
- % \pgfretvalquoted. The latter result is to have some sort of
- % output normalisation: if the file name as such contains double
- % quotes, we don't want to insert another set of them.
- %
- % This special handling has the following purposes:
- % 1. Both, treatment of white spaces and double colons is not
- % properly defined in TeX. Thus, we should only work with them if
- % necessary and maintain backwards compatibility as far as
- % possible.
- % 2. It *should* work if there are spaces.
- %
- \gdef\pgfutilpreparefilename#1{%
- \begingroup
- \ifnum\the\catcode`\"=13
- \pgfutilconvertdcolon
- \fi
- \xdef\pgf@temp{#1}%
- \endgroup
- \expandafter\pgfutil@in@\expandafter"\expandafter{\pgf@temp}%
- \ifpgfutil@in@
- \def\pgf@loc@TMPa{\pgfutilstrreplace{"}{}}%
- \expandafter\pgf@loc@TMPa\expandafter{\pgf@temp}%
- \edef\pgfretval{"\pgfretval"}% re-insert quotes! Otherwise, TeX can't use the file name.
- \let\pgfretvalquoted=\pgfretval
- \else
- \let\pgfretval=\pgf@temp
- \edef\pgfretvalquoted{"\pgfretval"}%
- \fi
- }%
- \catcode`\"=13
- \xdef\pgfutilconvertdcolon{%
- \noexpand\def\noexpand"{\pgf@loc@TMPa}%
- }%
+ \catcode`\"=12
+ \edef\pgf@loc@TMPa{"}%
+ %
+ % prepares file names by checking for double colons.
+ %
+ % If '#1' is a usual file name without anything fancy, \pgfretval
+ % will simply contain it. However, if '#1' contains double colons
+ % (introduces, for example, by pdftex because there are white
+ % spaces in '#1'), the routine
+ % - removes the double colons,
+ % - re-inserts them outside of the string.
+ %
+ % \pgfutilpreparefilename{file.tex} -> file.tex
+ % \pgfutilpreparefilename{"A file name".file} -> "A file name.file"
+ %
+ % The resulting file name is returned in '\pgfretval',
+ % furthermore, a *quoted* version of the file name is returned in
+ % \pgfretvalquoted. The latter result is to have some sort of
+ % output normalisation: if the file name as such contains double
+ % quotes, we don't want to insert another set of them.
+ %
+ % This special handling has the following purposes:
+ % 1. Both, treatment of white spaces and double colons is not
+ % properly defined in TeX. Thus, we should only work with them if
+ % necessary and maintain backwards compatibility as far as
+ % possible.
+ % 2. It *should* work if there are spaces.
+ %
+ \gdef\pgfutilpreparefilename#1{%
+ \begingroup
+ \ifnum\the\catcode`\"=13
+ \pgfutilconvertdcolon
+ \fi
+ \xdef\pgf@temp{#1}%
+ \endgroup
+ \expandafter\pgfutil@in@\expandafter"\expandafter{\pgf@temp}%
+ \ifpgfutil@in@
+ \def\pgf@loc@TMPa{\pgfutilstrreplace{"}{}}%
+ \expandafter\pgf@loc@TMPa\expandafter{\pgf@temp}%
+ \edef\pgfretval{"\pgfretval"}% re-insert quotes! Otherwise, TeX can't use the file name.
+ \let\pgfretvalquoted=\pgfretval
+ \else
+ \let\pgfretval=\pgf@temp
+ \edef\pgfretvalquoted{"\pgfretval"}%
+ \fi
+ }%
+ \catcode`\"=13
+ \xdef\pgfutilconvertdcolon{%
+ \noexpand\def\noexpand"{\pgf@loc@TMPa}%
+ }%
\endgroup
+% Converts an arbitrary command (without arguments) to a string in which all characters
+% have category 12.
+%
+% #1: a macro name (which takes no arguments)
+% #2: a macro name which will be assigned to '#1' converted to string.
+%
+% This uses '\meaning#1' hackery.
+\def\pgfutil@command@to@string#1#2{%
+ \expandafter\pgfutil@command@to@string@@\meaning#1\pgfutil@EOI{#2}%
+}%
+\xdef\pgfutil@glob@TMPa{\meaning\pgfutil@empty}%
+\expandafter\def\expandafter\pgfutil@command@to@string@@\pgfutil@glob@TMPa#1\pgfutil@EOI#2{%
+ \def#2{#1}%
+}%
+\begingroup
+\catcode`\|=0
+\catcode`\\=12
+|gdef|pgfutil@backslash@as@other{\}%
+|endgroup
+
+% Checks if the token sequence #1 (unexpanded) contains a macro and
+% invokes #2 if so and #3 if not.
+\def\pgfutilifcontainsmacro#1#2#3{%
+ \def\pgf@marshal{#1}%
+ \pgfutil@command@to@string\pgf@marshal\pgf@marshal
+ \edef\pgf@marshal{\noexpand\pgfutil@in@{\pgfutil@backslash@as@other}{\pgf@marshal}}%
+ \pgf@marshal
+ \ifpgfutil@in@
+ \def\pgf@marshal{#2}%
+ \else
+ \def\pgf@marshal{#3}%
+ \fi
+ \pgf@marshal
+}%
+
+% Tests if string '#2' starts with pattern '#1'.
+%
+% If so, it executes #3 and defines \pgfretval to contain the
+% suffix which is not equal to #1. Otherwise it executes #4.
+\def\pgfutilifstartswith#1#2#3#4{%
+ \def\pgfutilifstartswith@ ##1#1##2\pgf@EOI{%
+ \def\pgfutil@tmp{##1}%
+ \ifx\pgfutil@tmp\pgfutil@empty
+ % Ah - a hit!
+ %
+ % define \pgfretval to be the suffix...
+ \def\pgfutil@tmp#1####1\pgf@EOI{%
+ \def\pgfretval{####1}%
+ }%
+ \pgfutil@tmp#2\pgf@EOI%
+ %
+ % ... and execute the <true> code:
+ #3\relax%
+ \else
+ % hm. No such prefix.
+ #4\relax%
+ \fi
+ }%
+ \pgfutilifstartswith@#2--#1\pgf@EOI%
+}%
+
% Usage:
% \pgfutilstrreplace{<token>}{<replacement>}{<string>}
%
@@ -369,138 +454,286 @@
% #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}%
+ \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
+ \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.
-% It is acceptable if '#1' is a macro which expands to the expected
-% format.
+% {<a11>}{<a12>}
+% {<a21>}{<a22>}
+% where each entry should be a number without unit.
+% It is acceptable if '#1' is a macro which expands to the expected
+% format.
% #2: should contain 2 sets of braces with the right-hand-side,
-% {<r1>}{<r2>}
-% where each entry should be a number without unit.
-% It is acceptable if '#2' is a macro which expands to the expected
-% format.
+% {<r1>}{<r2>}
+% where each entry should be a number without unit.
+% It is acceptable if '#2' is a macro which expands to the expected
+% format.
%
% It will assign \pgfmathresult to contain two sets of braces with the
% result.
%
% Example:
% \pgfutilsolvetwotwoleq{
-% {0.24}{1}
-% {-0.97}{0}
+% {0.24}{1}
+% {-0.97}{0}
% }{
-% {-7}
-% {18}
+% {-7}
+% {18}
% }
% -> yields \pgfmathresult={−18.55618}{−2.54642}
%
% The algorithm employs column pivotisation.
+%
+% If the matrix is singular, the routine will return {}.
\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
+ \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
+ \tmpa=\csname m\Pa a\endcsname pt %
+ \ifdim\tmpa<0pt \tmpa=-\tmpa\fi
+ \ifdim\tmpa<0.0001pt
+ % singular matrix!
+ \let\pgfmathresult=\pgfutil@empty
+ \else
+ \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
+ %
+ \tmpa=\csname \Pb b\endcsname%
+ \ifdim\tmpa<0pt \tmpa=-\tmpa\fi
+ \ifdim\tmpa<0.0001pt
+ % singular matrix!
+ \let\pgfmathresult=\pgfutil@empty
+ \else
+ % 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 := 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}%
+ }%
+ \fi
+ \fi
+ \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
+ \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\pgfutilsolvetwotwoleqfloat@ifislarger#1#2#3#4{%
+ \pgfmathfloatabs@{#1}\let\tmpa=\pgfmathresult
+ \pgfmathfloatabs@{#2}\let\tmpb=\pgfmathresult
+ \pgfmathfloatlessthan@{\tmpb}{\tmpa}%
+ \ifpgfmathfloatcomparison
+ #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\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
+ \ra=#1pt \rb=#2pt
+}%
+\def\pgfutilsolvetwotwoleqfloat@A#1#2#3#4{%
+ \pgfmathfloatparsenumber{#1}\let\maa=\pgfmathresult
+ \pgfmathfloatparsenumber{#2}\let\mab=\pgfmathresult
+ \pgfmathfloatparsenumber{#3}\let\mba=\pgfmathresult
+ \pgfmathfloatparsenumber{#4}\let\mbb=\pgfmathresult
+}
+\def\pgfutilsolvetwotwoleqfloat@r#1#2{%
+ \pgfmathfloatparsenumber{#1}\let\ra=\pgfmathresult
+ \pgfmathfloatparsenumber{#2}\let\rb=\pgfmathresult
+}%
+
+% Same as \pgfutilsolvetwotwoleq, but using floating point
+% arithmetics. The return value is still in fixed point.
+\def\pgfutilsolvetwotwoleqfloat#1#2{%
+ \begingroup
+ \pgfmathfloatcreate{1}{1.0}{-4}% FIXME : use a smaller threshold for FPU?
+ \let\thresh=\pgfmathresult
+ %
+ \edef\pgf@temp{#1}%
+ \expandafter\pgfutilsolvetwotwoleqfloat@A\pgf@temp
+ \edef\pgf@temp{#2}%
+ \expandafter\pgfutilsolvetwotwoleqfloat@r\pgf@temp
+ %
+ \pgfutilsolvetwotwoleqfloat@ifislarger\maa\mba{%
+ % identity "permutation":
+ \def\Pa{a}%
+ \def\Pb{b}%
+ }{%
+ % permutation matrix: switch rows!
+ \def\Pa{b}%
+ \def\Pb{a}%
+ }%
+ % \pivot := 1/aa
+ \expandafter\pgfmathfloatabs@\expandafter{\csname m\Pa a\endcsname}%
+ \let\tmpa=\pgfmathresult
+ \pgfmathfloatlessthan@{\tmpa}{\thresh}%
+ \ifpgfmathfloatcomparison
+ % singular matrix!
+ \let\pgfmathresult=\pgfutil@empty
+ \else
+ \expandafter\pgfmathfloatreciprocal@\expandafter{\csname m\Pa a\endcsname}%
+ \let\pivot=\pgfmathresult
+ %
+ % \factor := 1/aa * ba
+ \expandafter\pgfmathfloatmultiply@\expandafter{\csname m\Pb a\endcsname}{\pivot}%
+ \let\factor=\pgfmathresult
+ \expandafter\let\csname m\Pb a\endcsname=\factor
+ %
+ % bb -= ba/aa * ab
+ \expandafter\pgfmathfloatmultiply@\expandafter{\csname m\Pa b\endcsname}{\factor}%
+ \let\tmpa=\pgfmathresult
+ \expandafter\pgfmathfloatsubtract@\expandafter{\csname m\Pb b\endcsname}{\tmpa}%
+ \expandafter\let\csname m\Pb b\endcsname=\pgfmathresult
+ %
+ % rb -= ba/aa * ra
+ \expandafter\pgfmathfloatmultiply@\expandafter{\csname r\Pa\endcsname}{\factor}%
+ \let\tmpa=\pgfmathresult
+ \expandafter\pgfmathfloatsubtract@\expandafter{\csname r\Pb\endcsname}{\tmpa}%
+ \expandafter\let\csname r\Pb\endcsname=\pgfmathresult
+ %
+ \expandafter\pgfmathfloatabs@\expandafter{\csname m\Pb b\endcsname}%
+ \let\tmpa=\pgfmathresult
+ \pgfmathfloatlessthan@{\tmpa}{\thresh}%
+ \ifpgfmathfloatcomparison
+ % singular matrix!
+ \let\pgfmathresult=\pgfutil@empty
+ \else
+ % xb := rb / bb (the modified rb and modified bb!)
+ \edef\pgf@marshal{
+ \noexpand\pgfmathfloatdivide@
+ {\csname r\Pb\endcsname}
+ {\csname m\Pb b\endcsname}%
+ }%
+ \pgf@marshal
+ \expandafter\let\csname pgfmathresult\Pb\endcsname=\pgfmathresult
+ \let\tmpa=\pgfmathresult
+ %
+ % ra := ra - xb * ab
+ \expandafter\pgfmathfloatmultiply@\expandafter{\csname m\Pa b\endcsname}{\tmpa}%
+ \let\tmpa=\pgfmathresult
+ \expandafter\pgfmathfloatsubtract@\expandafter{\csname r\Pa\endcsname}{\tmpa}%
+ \expandafter\let\csname r\Pa\endcsname=\pgfmathresult
+ %
+ % xa := 1/aa * ra (the modified ra!)
+ \expandafter\pgfmathfloatmultiply@\expandafter{\csname r\Pa\endcsname}{\pivot}%
+ \expandafter\let\csname pgfmathresult\Pa\endcsname=\pgfmathresult
+ %
+ \edef\pgfmathresult{%
+ {\csname pgfmathresult\Pa\endcsname}%
+ {\csname pgfmathresult\Pb\endcsname}%
+ }%
+ \expandafter\pgfutilsolvetwotwoleqfloat@to@pgf@range\pgfmathresult
+ \fi
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+
+\def\pgfutilsolvetwotwoleqfloat@to@pgf@range#1#2{%
+ \pgfmathfloatcreate{1}{1.6}{4}\let\pgfutilsolvetwotwoleqfloat@to@pgf@range@max=\pgfmathresult
+ \pgfmathfloatabs@{#1}%
+ \expandafter\pgfmathfloatlessthan@\expandafter{\pgfmathresult}{\pgfutilsolvetwotwoleqfloat@to@pgf@range@max}%
+ \ifpgfmathfloatcomparison
+ \pgfmathfloatabs@{#2}%
+ \expandafter\pgfmathfloatlessthan@\expandafter{\pgfmathresult}{\pgfutilsolvetwotwoleqfloat@to@pgf@range@max}%
+ \ifpgfmathfloatcomparison
+ % ok.
+ \pgfmathfloattofixed{#1}\let\tmpa=\pgfmathresult
+ \pgfmathfloattofixed{#2}%
+ \edef\pgfmathresult{{\tmpa}{\pgfmathresult}}%
+ \else
+ % singular (because PGF cannot represent its result
+ \let\pgfmathresult=\pgfutil@empty
+ \fi
+ \else
+ % singular (because PGF cannot represent its result
+ \let\pgfmathresult=\pgfutil@empty
+ \fi
}%
% there are funny programs which overwrite \read and \write (like
@@ -544,18 +777,36 @@
\def\pgfutil@directlua#1{}
\def\pgfutil@luaescapestring#1{}
\fi
+
+
+\def\pgfutil@shellescape@lua@eightseven#1{%
+ \pgfutil@directlua{os.execute("\pgfutil@luaescapestring{#1}")}%
+}%
+\def\pgfutil@shellescape#1{%
+ \immediate\write18{#1}%
+}%
+\pgfutil@IfUndefined{directlua}{%
+}{%
+ \pgfutil@IfUndefined{lastsavedimageresourcepages}{%
+ % Ah - an old version of luatex. It still supports \write18
+ }{%
+ % take the new variant...
+ \let\pgfutil@shellescape=\pgfutil@shellescape@lua@eightseven
+ }%
+}%
+
% End of luatex stuff
% Advances a number stored in a macro and writes the result back into
% the macro.
% #1 is a macro containing a number.
\def\pgfutil@advancestringcounter#1{%
- \begingroup
- \c@pgf@counta=#1\relax
- \advance\c@pgf@counta by1
- \edef#1{\the\c@pgf@counta}%
- \pgfmath@smuggleone#1%
- \endgroup
+ \begingroup
+ \c@pgf@counta=#1\relax
+ \advance\c@pgf@counta by1
+ \edef#1{\the\c@pgf@counta}%
+ \pgfmath@smuggleone#1%
+ \endgroup
}%
\input pgfutil-common-lists.tex
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def
index ebc04d012e9..16ba0611783 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def
@@ -17,7 +17,7 @@
\def\pgfutil@aux@read@hook{%
\pgfutil@IfFileExists{\jobname.pgf}{\input \jobname.pgf\relax}{}
\csname newwrite\endcsname\pgfutil@auxout
- \csname openout\endcsname\pgfutil@auxout\jobname.pgf\relax
+ \immediate\csname openout\endcsname\pgfutil@auxout\jobname.pgf\relax
}
\def\pgfutil@writetoaux#1{\write\pgfutil@auxout{#1}}
@@ -27,6 +27,7 @@
\def\pgfutil@emu@rgb#1#2,#3,#4\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{rgb}{#2,#3,#4}}}
\def\pgfutil@emu@gray#1#2\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{rgb}{#2,#2,#2}}}
+\def\pgfutil@emu@cmyk#1#2,#3,#4,#5\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{cmyk}{#2,#3,#4,#5}}}
% no need for x colors (users can load it if needed)
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
index 6c740514bba..aad781a60ef 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
@@ -28,7 +28,17 @@
\def\pgfutil@definecolor{\definecolor}
\def\pgfutil@color{\color}
-\def\pgfutil@colorlet{\colorlet}
+\def\pgfutil@colorlet#1#2{%
+ % If the color is a defined named color, we have to use the [named]
+ % option for colorlet to force xcolor to perform color model
+ % conversion.
+ \expandafter\ifx\csname\expandafter\string\csname color@#2\endcsname\endcsname\relax
+ \colorlet{#1}{#2}%
+ \else
+ \colorlet[named]{#1}{#2}%
+ \fi
+}
+
\def\pgfutil@extractcolorspec{\extractcolorspec}
\def\pgfutil@convertcolorspec{\convertcolorspec}
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def
index b05887f84cf..3d7573f7071 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def
@@ -16,7 +16,7 @@
\def\pgfutil@aux@read@hook{
\pgfutil@IfFileExists{\jobname.pgf}{\input \jobname.pgf\relax}{}
\csname newwrite\endcsname\pgfutil@auxout
- \csname openout\endcsname\pgfutil@auxout\jobname.pgf
+ \immediate\csname openout\endcsname\pgfutil@auxout\jobname.pgf
}
\def\pgfutil@writetoaux#1{\write\pgfutil@auxout{#1}}
@@ -160,19 +160,23 @@
\ifx\pdfoutput\relax\alloc@0\count\countdef\insc@unt\pdfoutput\fi
\def\pgfutil@guessdriver{
- \ifx\HCode\@undefined%
- \ifcase\pdfoutput%
- \ifx\XeTeXversion\@undefined
- \def\pgfsysdriver{pgfsys-dvips.def}% hopefully
- \else
- \def\pgfsysdriver{pgfsys-xetex.def}% should be right
- \fi
- \else%
- \def\pgfsysdriver{pgfsys-pdftex.def}% should be right
- \fi%
- \else%
- \def\pgfsysdriver{pgfsys-tex4ht.def}% should be right
- \fi%
+ \ifx\directlua\@undefined
+ \ifx\HCode\@undefined%
+ \ifcase\pdfoutput%
+ \ifx\XeTeXversion\@undefined
+ \def\pgfsysdriver{pgfsys-dvips.def}% hopefully
+ \else
+ \def\pgfsysdriver{pgfsys-xetex.def}% should be right
+ \fi
+ \else%
+ \def\pgfsysdriver{pgfsys-pdftex.def}% should be right
+ \fi%
+ \else%
+ \def\pgfsysdriver{pgfsys-tex4ht.def}% should be right
+ \fi%
+ \else
+ \def\pgfsysdriver{pgfsys-luatex.def}%
+ \fi
}