summaryrefslogtreecommitdiff
path: root/graphics/pgf/base/tex
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pgf/base/tex')
-rw-r--r--graphics/pgf/base/tex/pgf.revision.tex8
-rw-r--r--graphics/pgf/base/tex/pgfcalendar.code.tex1
-rw-r--r--graphics/pgf/base/tex/pgfkeys.code.tex16
-rw-r--r--graphics/pgf/base/tex/pgfmathfunctions.misc.code.tex18
-rw-r--r--graphics/pgf/base/tex/pgfmoduleshapes.code.tex37
-rw-r--r--graphics/pgf/base/tex/pgfsys-dvips.def2
-rw-r--r--graphics/pgf/base/tex/pgfsys-dvisvgm4ht.def83
-rw-r--r--graphics/pgf/base/tex/pgfsys.code.tex25
-rw-r--r--graphics/pgf/base/tex/pgfutil-common.tex110
-rw-r--r--graphics/pgf/base/tex/pgfutil-context.def7
-rw-r--r--graphics/pgf/base/tex/pgfutil-latex.def7
-rw-r--r--graphics/pgf/base/tex/pgfutil-plain.def7
-rw-r--r--graphics/pgf/base/tex/tikz.code.tex157
-rw-r--r--graphics/pgf/base/tex/tikzlibrarycalendar.code.tex30
-rw-r--r--graphics/pgf/base/tex/tikzlibrarymath.code.tex3
-rw-r--r--graphics/pgf/base/tex/tikzlibraryspy.code.tex6
16 files changed, 263 insertions, 254 deletions
diff --git a/graphics/pgf/base/tex/pgf.revision.tex b/graphics/pgf/base/tex/pgf.revision.tex
index 796c7fbe8a..18d9909178 100644
--- a/graphics/pgf/base/tex/pgf.revision.tex
+++ b/graphics/pgf/base/tex/pgf.revision.tex
@@ -5,10 +5,10 @@
\catcode`\:=12
\catcode`\+=12
\catcode`\-=12
-\gdef\pgfrevision{3.1.8b}
-\gdef\pgfversion{3.1.8b}
-\gdef\pgfversiondatetime{2020-12-27 19:52:45 +0100}
-\gdef\pgfrevisiondatetime{2020-12-27 19:52:45 +0100}
+\gdef\pgfrevision{3.1.9a}
+\gdef\pgfversion{3.1.9a}
+\gdef\pgfversiondatetime{2021-05-15 12:06:55 +0200}
+\gdef\pgfrevisiondatetime{2021-05-15 12:06:55 +0200}
\gdef\pgf@glob@TMPa#1-#2-#3 #4\relax{#1/#2/#3}
\xdef\pgfversiondate{\expandafter\pgf@glob@TMPa\pgfversiondatetime\relax}
\xdef\pgfrevisiondate{\expandafter\pgf@glob@TMPa\pgfrevisiondatetime\relax}
diff --git a/graphics/pgf/base/tex/pgfcalendar.code.tex b/graphics/pgf/base/tex/pgfcalendar.code.tex
index 579b6dccea..a954d4adf0 100644
--- a/graphics/pgf/base/tex/pgfcalendar.code.tex
+++ b/graphics/pgf/base/tex/pgfcalendar.code.tex
@@ -789,7 +789,6 @@
}
\pgfkeys{/pgf/calendar/Easter/.cd,.default=0,.code={%
- \show\pgfcalendarifdateyear
\pgfcalendareastersunday{\pgfcalendarifdateyear}{\pgf@cal@easter@julianday}%
\ifnum\pgfcalendarifdatejulian=\pgfinteval{\pgf@cal@easter@julianday+#1}
\expandafter\pgfcalendarmatchestrue
diff --git a/graphics/pgf/base/tex/pgfkeys.code.tex b/graphics/pgf/base/tex/pgfkeys.code.tex
index db89141aca..184506a185 100644
--- a/graphics/pgf/base/tex/pgfkeys.code.tex
+++ b/graphics/pgf/base/tex/pgfkeys.code.tex
@@ -45,6 +45,17 @@
\csname @@end\expandafter\endcsname\expandafter\end%
\fi
+% e-TeX primitives and beyond
+
+\ifx\contextversion\undefined
+ \let\pgfkeys@expanded \expanded
+ \let\pgfkeys@unexpanded \unexpanded
+\else
+ \let\pgfkeys@expanded \normalexpanded
+ \let\pgfkeys@unexpanded \normalunexpanded
+\fi
+
+
% Set a key to a value
%
% #1 = key
@@ -74,9 +85,8 @@
}
\long\def\pgfkeyssetevalue#1#2{%
- \edef\pgfkeys@temp##1##2##3##4##5##6##7##8##9{#2}%
- \pgfkeys@temptoks=\expandafter{\pgfkeys@temp{##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}{##9}}%
- \expandafter\edef\csname pgfk@#1\endcsname{\the\pgfkeys@temptoks}%
+ \expandafter\edef\csname pgfk@#1\endcsname
+ {\pgfkeys@unexpanded\expandafter{\pgfkeys@expanded{#2}}}%
}
% Add text to a key at the end
diff --git a/graphics/pgf/base/tex/pgfmathfunctions.misc.code.tex b/graphics/pgf/base/tex/pgfmathfunctions.misc.code.tex
index 6d1ec5b6ab..859d8266a9 100644
--- a/graphics/pgf/base/tex/pgfmathfunctions.misc.code.tex
+++ b/graphics/pgf/base/tex/pgfmathfunctions.misc.code.tex
@@ -272,17 +272,21 @@
\pgfmathdeclarefunction{dim}{1}{%
\begingroup
\pgfmath@count=0\relax
- \expandafter\pgfmath@dim@i\pgfutil@firstofone#1\pgfmath@token@stop
+ \expandafter\pgfmath@dim@i\pgfutil@firstofone#1{\pgfmath@token@stop}%
\edef\pgfmathresult{\the\pgfmath@count}%
\pgfmath@smuggleone\pgfmathresult%
\endgroup}
-\def\pgfmath@dim@i#1{%
- \ifx\pgfmath@token@stop#1%
- \else
- \advance\pgfmath@count by 1\relax
- \expandafter\pgfmath@dim@i
- \fi}
+\def\pgfmath@dim@i#1#{%
+ \pgfutil@ifempty{#1}{}{\advance\pgfmath@count by 1}%
+ \pgfmath@dim@ii{#1}}
+
+\def\pgfmath@dim@ii#1#2{%
+ \ifx\pgfmath@token@stop#2%
+ \else
+ \advance\pgfmath@count by 1\relax
+ \expandafter\pgfmath@dim@i
+ \fi}
% max function.
diff --git a/graphics/pgf/base/tex/pgfmoduleshapes.code.tex b/graphics/pgf/base/tex/pgfmoduleshapes.code.tex
index a22aca4757..efef54af7a 100644
--- a/graphics/pgf/base/tex/pgfmoduleshapes.code.tex
+++ b/graphics/pgf/base/tex/pgfmoduleshapes.code.tex
@@ -617,7 +617,42 @@
\pgf@process{\pgf@shape@interpictureshift{#1}}%%
\advance\pgf@xa by-\pgf@x%
\advance\pgf@ya by-\pgf@y%
- \csname pgf@anchor@\csname pgf@sh@ns@#1\endcsname @border\endcsname{\pgfqpoint{\pgf@xa}{\pgf@ya}}%
+ % Now (\pgf@xa, \pgf@ya) is a coord in shape's coord system, and
+ % relative to the anchor "center". If (xa, ya) is almost identical to
+ % the node center, which is determined by sqrt(xa^2+ya^2) < 0.02pt,
+ % just return the node center.
+ %
+ % \pgf@xb = 10*\pgf@xa if -1pt<\pgf@xa<1pt else 10pt
+ % - "10*\pgf@xa": reduce ruonding errors when \pgf@xa is small
+ % - "-1pt<\pgf@xa<1pt": guard against error "Dimension too large"
+ \pgf@xb=10pt
+ \ifdim\pgf@xa<1pt\ifdim\pgf@xa>-1pt
+ \pgf@xb=10\pgf@xa
+ \fi\fi
+ % \pgf@yb = 10*\pgf@ya if -1pt<\pgf@ya<1pt else 10pt
+ \pgf@yb=10pt
+ \ifdim\pgf@ya<1pt\ifdim\pgf@ya>-1pt
+ \pgf@yb=10\pgf@ya
+ \fi\fi
+ % if xb^2+yb^2 < 0.04pt, which means sqrt(xa^2+ya^2) < 0.02pt,
+ % return node center
+ \ifdim\dimexpr\expandafter\Pgf@geT\the\pgf@xb\pgf@xb
+ +\expandafter\Pgf@geT\the\pgf@yb\pgf@yb\relax<0.04pt
+ \expandafter\pgfutil@firstoftwo
+ \else
+ \expandafter\pgfutil@secondoftwo
+ \fi
+ {% return coord of "center"
+ \pgfwarning
+ {Returning node center instead of a point on node border. Did you
+ specify a point identical to the center of node
+ ``\pgfreferencednodename''?}%
+ \pgf@sh@reanchor{\csname pgf@sh@ns@#1\endcsname}{center}%
+ }
+ {% this calls the corresponding \anchorborder in shape declaration
+ \csname pgf@anchor@\csname pgf@sh@ns@#1\endcsname @border\endcsname
+ {\pgfqpoint{\pgf@xa}{\pgf@ya}}%
+ }%
\pgfsettransform{\csname pgf@sh@nt@#1\endcsname}%
\pgf@pos@transform@glob%
\global\pgf@x=\pgf@x%
diff --git a/graphics/pgf/base/tex/pgfsys-dvips.def b/graphics/pgf/base/tex/pgfsys-dvips.def
index 678fdd4d0b..8a791ff5ad 100644
--- a/graphics/pgf/base/tex/pgfsys-dvips.def
+++ b/graphics/pgf/base/tex/pgfsys-dvips.def
@@ -567,7 +567,7 @@
\wd#1=0pt
\ht#1=0pt
\dp#1=0pt
- \hskip\pgf@picminx\box#1%
+ \hskip\pgf@picminx\box#1\hskip-\pgf@picminx
\pgfsys@outerinvoke{%
/pgffoa pgf@sys@foa def /pgfsoa pgf@sys@soa def
grestore
diff --git a/graphics/pgf/base/tex/pgfsys-dvisvgm4ht.def b/graphics/pgf/base/tex/pgfsys-dvisvgm4ht.def
index 2853147a8d..4235c75d64 100644
--- a/graphics/pgf/base/tex/pgfsys-dvisvgm4ht.def
+++ b/graphics/pgf/base/tex/pgfsys-dvisvgm4ht.def
@@ -15,51 +15,68 @@
%
% Load common pdf commands:
%
- %\input pgfsys-dvisvgm.def
+
+% we load the dvips driver by default. it doesn't support patterns and some other stuff,
+% but it handles better nested images and some formatting. if you use patterns or if you
+% have other issues with the default method, pass the "tikz-dvisvgm" option to make4ht.
+\ifdefined\ifOption
+\ifOption{tikz+}{\input pgfsys-dvisvgm.def}{\input pgfsys-dvips.def}
+\else
+% load the dvips driver by default
\input pgfsys-dvips.def
+\fi
+
+\def\texfourht@tikz@begin{%
+ \bgroup%
+ \def\run@pict@cmd{}% insert the \Picture hooks only in the top nesting level
+ \def\end@pict@cmd{}%
+ \ifdefined\EndPicture\else% We are already inside command that uses \Picture
+ \ifdefined\inside@pict@cmd% handle nested uses
+ \else
+ % use different version of \Picture depending on the vertical mode
+ \ifvmode\def\run@pict@cmd{\Picture*}\else\def\run@pict@cmd{\Picture+}\fi%
+ \def\end@pict@cmd{\EndPicture}%
+ \fi\fi%
+ % command used to detect nesting
+ \def\inside@pict@cmd{}%
+ \csname a:tikzpicture\endcsname%
+}
+\def\texfourht@tikz@end{%
+ \csname b:tikzpicture\endcsname%
+ \egroup%
+}
\AtBeginDocument{
- % configure the output picture format to svg
+ \NewConfigure{tikzpicture}{2}
+ \catcode`\:=11
+ \Configure{tikzpicture}{%
+ \protect\csname nested:math\endcsname% support display math
+ \run@pict@cmd{}%
+ }{\end@pict@cmd}
+ % configure the output picture format to svg, as it will require dvisvgm
+ % post processing.
\Configure{Picture}{.svg}
- % insert tex4ht hook to the code used at the start and end of each TikZ picture
- \def\pgfsys@beginpicture{%
- \bgroup%
- \ifdefined\inside@pict@cmd% handle nested uses
- \def\run@pict@cmd{}% insert the \Picture hooks only in the top nesting level
- \def\end@pict@cmd{}%
- \else
- % use different version of \Picture depending on the vertical mode
- \ifvmode\def\run@pict@cmd{\Picture*}\else\def\run@pict@cmd{\Picture+}\fi%
- \def\end@pict@cmd{\EndPicture}%
- \fi%
- % command used to detect nesting
- \def\inside@pict@cmd{}%
- \csname a:tikzpicture\endcsname%
- \orig@pgfsys@begin%
- }%
- \def\pgfsys@endpicture{%
- \orig@pgfsys@end%
- \csname b:tikzpicture\endcsname%
- \egroup%
- \par%
- }%
+ % insert tex4ht hooks around TikZ picture box
+ \def\pgfsys@typesetpicturebox#1{%
+ \texfourht@tikz@begin%
+ \orig@pgfsys@typesetpicturebox{#1}%
+ \texfourht@tikz@end%
+ }
+ %
+ \ConfigureEnv{tikzpicture}{\ifvmode\Picture*{}\else\Picture+{}\fi\def\inside@pict@cmd{}}{\EndPicture}{}{}
+ \ConfigureEnv{pgfpicture}{\ifvmode\Picture*{}\else\Picture+{}\fi\def\inside@pict@cmd{}}{\EndPicture}{}{}
+ \catcode`\:=12
}
% Make the code inserted by tex4ht configurable
+%
-\NewConfigure{tikzpicture}{2}
-\Configure{tikzpicture}{%
- % \ifvmode\IgnorePar\fi\EndP%\HtmlParOff
- \protect\csname nested:math\endcsname% support display math
- \run@pict@cmd{}%
-}{\end@pict@cmd}
-\let\orig@pgfsys@begin\pgfsys@beginpicture
-\let\orig@pgfsys@end\pgfsys@endpicture
-\def\pgf@sys@postscript@header#1{{\special{! #1}}}
+\let\orig@pgfsys@typesetpicturebox\pgfsys@typesetpicturebox
+%\def\pgf@sys@postscript@header#1{{\special{! #1}}}
\endinput
diff --git a/graphics/pgf/base/tex/pgfsys.code.tex b/graphics/pgf/base/tex/pgfsys.code.tex
index 000eef098c..fd87b09181 100644
--- a/graphics/pgf/base/tex/pgfsys.code.tex
+++ b/graphics/pgf/base/tex/pgfsys.code.tex
@@ -1715,7 +1715,30 @@
% inserted into the resulting .pdf/.ps/.xxx file.
-
+% String comparison
+\ifdefined\pdfstrcmp
+ \let\pgfsys@strcmp\pdfstrcmp
+\else\ifdefined\strcmp
+ \let\pgfsys@strcmp\strcmp
+\else\ifdefined\directlua
+ \directlua{
+ local lft = lua.get_functions_table()
+ lft[\string#lft+1] = function()
+ local lhs = token.scan_string()
+ local rhs = token.scan_string()
+ if lhs < rhs then
+ tex.sprint(-2, "-1")
+ elseif lhs == rhs then
+ tex.sprint(-2, "0")
+ else
+ tex.sprint(-2, "1")
+ end
+ end
+ token.set_lua("pgfsys@strcmp", \string#lft, "global")
+ }
+\else
+ \def\pgfsys@strcmp#1#2{\pgf@sys@fail{string comparison}}%
+\fi\fi\fi
% Discern the driver:
diff --git a/graphics/pgf/base/tex/pgfutil-common.tex b/graphics/pgf/base/tex/pgfutil-common.tex
index 37210d4870..952af70f55 100644
--- a/graphics/pgf/base/tex/pgfutil-common.tex
+++ b/graphics/pgf/base/tex/pgfutil-common.tex
@@ -32,6 +32,10 @@
\newif\ifpgfutil@format@is@plain
\newif\ifpgfutil@format@is@context
+% Aliases
+
+\let\pgfutil@exp\romannumeral
+\chardef\pgfutil@exp@end=0
% Simple stuff
@@ -45,13 +49,43 @@
\def\pgfutil@trimspaces@@#1Q#2{#1}
\catcode`\Q=11
-% \pgfutil@ifempty{<cs>}{<true code>}{<false code>}
+% \pgfutil@ifx{<token 1>}{<token 2>}{<true code>}{<false code>}
+%
+% This macro is expandable.
+\long\def\pgfutil@ifx#1#2{%
+ \ifx#1#2%
+ \expandafter\pgfutil@firstoftwo
+ \else
+ \expandafter\pgfutil@secondoftwo
+ \fi}
+
+% \pgfutil@ifstrequal{<lhs>}{<rhs>}{<true code>}{<false code>}
%
-% Check if <cs> is equal to \pgfutil@empty
+% Check if <lhs> and <rhs> are equal by string comparison
%
% This macro is expandable.
-\def\pgfutil@ifempty#1{%
- \ifx#1\pgfutil@empty
+\long\def\pgfutil@ifstrequal#1#2{%
+ \ifnum\pgfsys@strcmp{\pgfutil@unexpanded{#1}}{\pgfutil@unexpanded{#2}}=0
+ \expandafter\pgfutil@firstoftwo
+ \else
+ \expandafter\pgfutil@secondoftwo
+ \fi
+}
+
+% \pgfutil@ifxempty{<token 1>}{<true code>}{<false code>}
+%
+% Shortcut for \pgfutil@ifx\pgfutil@empty{<token 1>}{<true code>}{<false code>}
+%
+% This macro is expandable.
+\def\pgfutil@ifxempty{\pgfutil@ifx\pgfutil@empty}
+
+% pgfutil@ifempty
+%
+% Check if #1 is empty. No expansion is performed on #1.
+%
+% This macro is expandable.
+\long\def\pgfutil@ifempty#1{%
+ \if\relax\detokenize{#1}\relax
\expandafter\pgfutil@firstoftwo
\else
\expandafter\pgfutil@secondoftwo
@@ -64,11 +98,7 @@
%
% This macro is expandable.
\def\pgfutil@ifundefined#1{%
- \expandafter\ifx\csname#1\endcsname\relax
- \expandafter\pgfutil@firstoftwo
- \else
- \expandafter\pgfutil@secondoftwo
- \fi}
+ \expandafter\pgfutil@ifx\csname#1\endcsname\relax}
% A variant of \pgfutil@ifundefined which will NOT let #1 to \relax it
% is undefined.
@@ -79,6 +109,7 @@
\expandafter\pgfutil@firstoftwo
\fi
}
+
\long\def\pgfutil@firstofone#1{#1}
\long\def\pgfutil@firstoftwo#1#2{#1}
\long\def\pgfutil@secondoftwo#1#2{#2}
@@ -222,45 +253,42 @@
\def\pgfutil@iterate{\pgfutil@body \let\pgfutil@next\pgfutil@iterate \else\let\pgfutil@next\relax\fi \pgfutil@next}
\let\pgfutil@repeat=\fi % this makes \loop...\if...\repeat skippable
-
% \pgfutil@switch
%
-% #1: string to switch on
-% #2: sequence of label-value pairs
+% #1: comparison function of the form
+% \comp{<lhs>}{<rhs>}{<true code>}{<false code>}
+% Has to be expandable!
+% #2: lhs
+% #3: sequence of rhs-value pairs
+% #4: default statement in case of match
+% #5: default statement in case of no match
%
% Example:
%
-% \pgfutil@switch{foo}{%
-% {foo}{1}%
-% {bar}{2}%
-% {default}{X}%
-% }
-%
-% If a statement with the label `default' exists it will be executed
-% if no other label matches.
-
-\long\def\pgfutil@switch#1#2{%
- \begingroup
- \def\pgfutil@switch@selected{}%
- \pgfutil@switch@collect@statements#2{}{}%
- \ifcsname pgfutil@switch@choice@\detokenize{#1}\endcsname
- \expandafter\let\expandafter\pgfutil@switch@selected\csname pgfutil@switch@choice@\detokenize{#1}\endcsname
- \else
- \ifdefined\pgfutil@switch@choice@default
- \let\pgfutil@switch@selected\pgfutil@switch@choice@default
- \fi
- \fi
- \expandafter\endgroup\pgfutil@switch@selected
+% \pgfutil@switch\pgfutil@ifx\pgf@let@token{%
+% {(}{\tikz@movetoabs}%)
+% {+}{\tikz@movetorel}%
+% {-}{\tikz@lineto}%
+% }{}{\tikz@expand}
+
+\let\pgfutil@scan@mark\relax
+\let\pgfutil@scan@stop\relax
+
+\long\def\pgfutil@switch#1#2#3#4#5{%
+ \pgfutil@exp
+ \pgfutil@switch@@{#1}%
+ {#2}#3% user-defined cases
+ {#2}{}% default case
+ \pgfutil@scan@mark{#4}% true code
+ \pgfutil@scan@mark{#5}% false code
+ \pgfutil@scan@stop
}
-
-\long\def\pgfutil@switch@collect@statements#1{%
- \if\relax\detokenize{#1}\relax
- \else
- \afterassignment\pgfutil@switch@collect@statements
- \expandafter\def\csname pgfutil@switch@choice@\detokenize{#1}\expandafter\endcsname
- \fi
+\long\def\pgfutil@switch@@#1#2#3#4{%
+ #1{#2}{#3}%
+ {\pgfutil@switch@end{#4}}%
+ {\pgfutil@switch@@{#1}{#2}}%
}
-
+\long\def\pgfutil@switch@end#1#2#3\pgfutil@scan@mark#4#5\pgfutil@scan@stop{\pgfutil@exp@end#1#4}
% aux-read-hook
diff --git a/graphics/pgf/base/tex/pgfutil-context.def b/graphics/pgf/base/tex/pgfutil-context.def
index 651b1cd169..eddab09aba 100644
--- a/graphics/pgf/base/tex/pgfutil-context.def
+++ b/graphics/pgf/base/tex/pgfutil-context.def
@@ -367,10 +367,7 @@
% e-TeX primitives
-\pgfutil@IfUndefined{normalprotected}{%
- \def\pgfutil@protected{}%
-}{%
- \let\pgfutil@protected\normalprotected
-}
+\let\pgfutil@protected\normalprotected
+\let\pgfutil@unexpanded\normalunexpanded
\endinput
diff --git a/graphics/pgf/base/tex/pgfutil-latex.def b/graphics/pgf/base/tex/pgfutil-latex.def
index a21f3b4d63..07a7fb1a4b 100644
--- a/graphics/pgf/base/tex/pgfutil-latex.def
+++ b/graphics/pgf/base/tex/pgfutil-latex.def
@@ -208,10 +208,7 @@
% e-TeX primitives
-\pgfutil@IfUndefined{protected}{%
- \def\pgfutil@protected{}%
-}{%
- \let\pgfutil@protected\protected
-}
+\let\pgfutil@protected\protected
+\let\pgfutil@unexpanded\unexpanded
\endinput
diff --git a/graphics/pgf/base/tex/pgfutil-plain.def b/graphics/pgf/base/tex/pgfutil-plain.def
index 58fa3eac5f..2d08c5303f 100644
--- a/graphics/pgf/base/tex/pgfutil-plain.def
+++ b/graphics/pgf/base/tex/pgfutil-plain.def
@@ -337,10 +337,7 @@
% e-TeX primitives
-\pgfutil@IfUndefined{protected}{
- \def\pgfutil@protected{}%
-}{%
- \let\pgfutil@protected\protected
-}
+\let\pgfutil@protected\protected
+\let\pgfutil@unexpanded\unexpanded
\endinput
diff --git a/graphics/pgf/base/tex/tikz.code.tex b/graphics/pgf/base/tex/tikz.code.tex
index f848487e70..d5244e9e85 100644
--- a/graphics/pgf/base/tex/tikz.code.tex
+++ b/graphics/pgf/base/tex/tikz.code.tex
@@ -2105,7 +2105,7 @@
\tikz@snakedfalse%
\tikz@decoratepathfalse%
\tikz@node@is@a@labelfalse%
- \tikz@expandcount=100\relax%
+ \tikz@resetexpandcount
\pgf@path@lastx=0pt%
\pgf@path@lasty=0pt%
\tikz@lastx=0pt%
@@ -2123,125 +2123,42 @@
\afterassignment\tikz@handle\let\pgf@let@token=%
}%
\newcount\tikz@expandcount
+\def\tikz@resetexpandcount{\tikz@expandcount=100\relax}
\let\tikz@collected@onpath=\pgfutil@empty%
+\edef\tikz@frozen@relax@token{\ifnum0=0\fi}
+
% Central dispatcher for commands
\def\tikz@handle{%
- \let\pgfutil@next=\tikz@expand%
- \ifx\pgf@let@token(%)
- \let\pgfutil@next=\tikz@movetoabs%
- \else%
- \ifx\pgf@let@token+%
- \let\pgfutil@next=\tikz@movetorel%
- \else%
- \ifx\pgf@let@token-%
- \let\pgfutil@next=\tikz@lineto%
- \else%
- \ifx\pgf@let@token.%
- \let\pgfutil@next=\tikz@dot%
- \else%
- \ifx\pgf@let@token r%
- \let\pgfutil@next=\tikz@rect%
- \else%
- \ifx\pgf@let@token n%
- \let\pgfutil@next=\tikz@fig%
- \else%
- \ifx\pgf@let@token[%]
- \let\pgfutil@next=\tikz@parse@options%
- \else%
- \ifx\pgf@let@token c%
- \let\pgfutil@next=\tikz@cchar%
- \else%
- \ifx\pgf@let@token\bgroup%
- \let\pgfutil@next=\tikz@beginscope%
- \else%
- \ifx\pgf@let@token\egroup%
- \let\pgfutil@next=\tikz@endscope%
- \else%
- \ifx\pgf@let@token;%
- \let\pgfutil@next=\tikz@finish%
- \else%
- \let\pgfutil@next=\tikz@handle@more%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \pgfutil@next%
-}%
-
-% Continued...
-\def\tikz@handle@more{%
- \ifx\pgf@let@token a%
- \let\pgfutil@next=\tikz@a@char%
- \else%
- \ifx\pgf@let@token e%
- \let\pgfutil@next=\tikz@e@char%
- \else%
- \ifx\pgf@let@token g%
- \let\pgfutil@next=\tikz@g@char%
- \else%
- \ifx\pgf@let@token s%
- \let\pgfutil@next=\tikz@schar%
- \else%
- \ifx\pgf@let@token |%
- \let\pgfutil@next=\tikz@vh@lineto%
- \else%
- \ifx\pgf@let@token p%
- \let\pgfutil@next=\tikz@pchar%
- \pgfsetmovetofirstplotpoint%
- \else%
- \ifx\pgf@let@token t%
- \let\pgfutil@next=\tikz@to%
- \else%
- \ifx\pgf@let@token\pgfextra%
- \let\pgfutil@next=\tikz@extra%
- \else%
- \ifx\pgf@let@token\foreach%
- \let\pgfutil@next=\tikz@foreach%
- \else%
- \ifx\pgf@let@token f%
- \let\pgfutil@next=\tikz@fchar%
- \else%
- \ifx\pgf@let@token\pgf@stop%
- \let\pgfutil@next=\relax%
- \else%
- \ifx\pgf@let@token\par%
- \let\pgfutil@next=\tikz@scan@next@command%
- \else%
- \ifx\pgf@let@token d%
- \let\pgfutil@next=\tikz@decoration%
- \else%
- \ifx\pgf@let@token l%
- \let\pgfutil@next=\tikz@l@char%
- \else%
- \ifx\pgf@let@token:%
- \let\pgfutil@next=\tikz@colon@char%
- \else%
- \let\pgfutil@next=\tikz@expand%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \ifx\pgfutil@next\tikz@expand\else\tikz@expandcount=100\relax\fi%
- \pgfutil@next%
+ \pgfutil@switch\pgfutil@ifx\pgf@let@token{%
+ {(}{\let\pgfutil@next\tikz@movetoabs}%)
+ {+}{\let\pgfutil@next\tikz@movetorel}%
+ {-}{\let\pgfutil@next\tikz@lineto}%
+ {.}{\let\pgfutil@next\tikz@dot}%
+ {r}{\let\pgfutil@next\tikz@rect}%
+ {n}{\let\pgfutil@next\tikz@fig}%
+ {[}{\let\pgfutil@next\tikz@parse@options}%]
+ {c}{\let\pgfutil@next\tikz@cchar}%
+ {\bgroup}{\let\pgfutil@next\tikz@beginscope}%
+ {\egroup}{\let\pgfutil@next\tikz@endscope}%
+ {;}{\let\pgfutil@next\tikz@finish}%
+ {a}{\let\pgfutil@next\tikz@a@char}%
+ {e}{\let\pgfutil@next\tikz@e@char}%
+ {g}{\let\pgfutil@next\tikz@g@char}%
+ {s}{\let\pgfutil@next\tikz@schar}%
+ {|}{\let\pgfutil@next\tikz@vh@lineto}%
+ {p}{\pgfsetmovetofirstplotpoint\let\pgfutil@next\tikz@pchar}%
+ {t}{\let\pgfutil@next\tikz@to}%
+ {\pgfextra}{\let\pgfutil@next\tikz@extra}%
+ {\foreach}{\let\pgfutil@next\tikz@foreach}%
+ {f}{\let\pgfutil@next\tikz@fchar}%
+ {\pgf@stop}{\let\pgfutil@next\relax}%
+ {\par}{\let\pgfutil@next\tikz@scan@next@command}%
+ {d}{\let\pgfutil@next\tikz@decoration}%
+ {l}{\let\pgfutil@next\tikz@l@char}%
+ {:}{\let\pgfutil@next\tikz@colon@char}%
+ {\relax}{\relax\let\pgfutil@next\tikz@scan@next@command}%
+ }{\tikz@resetexpandcount\pgfutil@next}{\tikz@expand}%
}%
\def\tikz@l@char{%
@@ -4093,7 +4010,7 @@
\pgfutil@for\pgf@temp:=\tikz@common@matrix@code@styleorder\do{%
\toks0=\expandafter{\romannumeral-`0\expandafter\pgfutil@trimspaces\expandafter{\pgf@temp}}%
\def\pgf@marshal{}%
- \pgfutil@ifempty\pgf@temp{}{%
+ \pgfutil@ifxempty\pgf@temp{}{%
\edef\pgf@marshal{\noexpand\tikzset{matrix/inner style/.cd,\the\toks0}}%
}%
\pgf@marshal
@@ -4754,8 +4671,8 @@
\expandafter\expandafter\expandafter\tikz@parse@child@node%
\fi%
}%
-\def\tikz@parse@child@node@rest#1\pgf@stop{\tikz@expandcount=100\relax\def\tikz@child@node@rest{#1}}%
-\def\tikz@parse@child@node@c c{\tikz@expandcount=100\pgfutil@ifnextchar o{\tikz@parse@child@node@co}{\tikz@parse@child@node@rest c}}%
+\def\tikz@parse@child@node@rest#1\pgf@stop{\tikz@resetexpandcount\def\tikz@child@node@rest{#1}}%
+\def\tikz@parse@child@node@c c{\tikz@resetexpandcount\pgfutil@ifnextchar o{\tikz@parse@child@node@co}{\tikz@parse@child@node@rest c}}%
\def\tikz@parse@child@node@co o{\pgfutil@ifnextchar o{\tikz@parse@child@node@coordinate}{\tikz@parse@child@node@rest co}}%
\def\tikz@parse@child@node@coordinate ordinate{%
\pgfutil@ifnextchar ({\tikz@@parse@child@node@coordinate}{%
@@ -4777,7 +4694,7 @@
\expandafter\expandafter\expandafter{\expandafter\tikz@child@node@text@pre\tikz@marshal}%
\tikz@parse@child@node@rest%
}%
-\def\tikz@parse@child@node@n node{\tikz@expandcount=100%
+\def\tikz@parse@child@node@n node{\tikz@resetexpandcount%
\let\tikz@child@node@text=\pgfutil@empty%
\tikz@p@c@s}%
\def\tikz@p@c@s{%
diff --git a/graphics/pgf/base/tex/tikzlibrarycalendar.code.tex b/graphics/pgf/base/tex/tikzlibrarycalendar.code.tex
index 73a47f6574..98cdffe154 100644
--- a/graphics/pgf/base/tex/tikzlibrarycalendar.code.tex
+++ b/graphics/pgf/base/tex/tikzlibrarycalendar.code.tex
@@ -358,7 +358,7 @@ execute before day scope={\ifdate{day of month=1}{%
\def\tikz@lib@cal@calendar{%
\begingroup%
\let\tikz@lib@cal@ifs=\pgfutil@empty%
- \tikz@expandcount=1000\relax%
+ \tikz@resetexpandcount
\tikzset{name=,at={(0,0)}}%
\let\%=\pgfcalendarshorthand%
\tikzset{every calendar/.try}%
@@ -370,27 +370,13 @@ execute before day scope={\ifdate{day of month=1}{%
}
\def\tikz@lib@cal@handle{%
- \let\pgfutil@next=\tikz@lib@cal@expand%
- \ifx\pgf@let@token;%
- \let\pgfutil@next=\tikz@lib@cal@stop%
- \else%
- \ifx\pgf@let@token(%)
- \let\pgfutil@next=\tikz@lib@cal@name%
- \else%
- \ifx\pgf@let@token a%
- \let\pgfutil@next=\tikz@lib@cal@at%
- \else%
- \ifx\pgf@let@token[%
- \let\pgfutil@next=\tikz@lib@cal@option%
- \else%
- \ifx\pgf@let@token i%
- \let\pgfutil@next=\tikz@lib@cal@if%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \pgfutil@next%
+ \pgfutil@switch\pgfutil@ifx\pgf@let@token{%
+ {;}{\let\pgfutil@next\tikz@lib@cal@stop}%
+ {(}{\let\pgfutil@next\tikz@lib@cal@name}%)
+ {a}{\let\pgfutil@next\tikz@lib@cal@at}%
+ {[}{\let\pgfutil@next\tikz@lib@cal@option}%]
+ {i}{\let\pgfutil@next\tikz@lib@cal@if}%
+ }{\tikz@resetexpandcount\pgfutil@next}{\tikz@lib@cal@expand}%
}
\def\tikz@lib@cal@expand{%
\advance\tikz@expandcount by -1
diff --git a/graphics/pgf/base/tex/tikzlibrarymath.code.tex b/graphics/pgf/base/tex/tikzlibrarymath.code.tex
index 3e703fad98..4683c71cd3 100644
--- a/graphics/pgf/base/tex/tikzlibrarymath.code.tex
+++ b/graphics/pgf/base/tex/tikzlibrarymath.code.tex
@@ -532,7 +532,8 @@
\long\def\tikz@math@for@parselist#1{%
\edef\tikz@math@for@list{#1}%
- \tikz@math@collecttosemicolon{\tikz@math@for@parseaction}}%
+ \tikz@math@gobblespaces{%
+ \tikz@math@collecttosemicolon{\tikz@math@for@parseaction}}}%
\def\tikz@math@for@parseaction{%
\tikz@math@for@namedef{prevvalue}{}%
diff --git a/graphics/pgf/base/tex/tikzlibraryspy.code.tex b/graphics/pgf/base/tex/tikzlibraryspy.code.tex
index 1a5e47b446..7f3a63b045 100644
--- a/graphics/pgf/base/tex/tikzlibraryspy.code.tex
+++ b/graphics/pgf/base/tex/tikzlibraryspy.code.tex
@@ -97,7 +97,7 @@
\pgftransformcm{\pgf@lib@svg@a}{\pgf@lib@svg@b}{\pgf@lib@svg@c}{\pgf@lib@svg@d}{\pgfpointorigin}%
}
}]{};
- \expandafter\pgfutil@switch\expandafter{\tikz@anchor}{%
+ \expandafter\pgfutil@switch\expandafter\pgfutil@ifstrequal\expandafter{\tikz@anchor}{%
{north} {\def\tikz@spy@anchor{south}}%
{north east}{\def\tikz@spy@anchor{south west}}%
{east} {\def\tikz@spy@anchor{west}}%
@@ -106,9 +106,7 @@
{south west}{\def\tikz@spy@anchor{north east}}%
{west} {\def\tikz@spy@anchor{east}}%
{north west}{\def\tikz@spy@anchor{south east}}%
- % default to center
- {default} {\def\tikz@spy@anchor{center}}%
- }
+ }{}{\def\tikz@spy@anchor{center}}%
\node [alias=tikzspyinnode,inner sep=0pt,outer sep=0pt,at={#2},every spy in node/.try,
path picture={\node[anchor=\tikz@spy@anchor,tikz@lib@reset@gs]{\nullfont%
\pgfpicture\relax\pgfsetbaseline{default}\pgfsettrimleft{default}\pgfsettrimright{default}%