diff --git a/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalendar.code.tex b/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalendar.code.tex index 3ade8fa1c..73a47f657 100644 --- a/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalendar.code.tex +++ b/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalendar.code.tex @@ -393,7 +393,7 @@ \pgfutil@next% } \def\tikz@lib@cal@expand{% - \advance\tikz@expandcount by -1% + \advance\tikz@expandcount by -1 \ifnum\tikz@expandcount<0\relax% \tikzerror{Giving up on this calendar}% \let\pgfutil@next=\tikz@lib@cal@end% diff --git a/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex b/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex index 70f8da088..a9ae8351b 100644 --- a/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex +++ b/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex @@ -2120,10 +2120,15 @@ \else% \tikz@invoke@collected@onpath% \fi% - \afterassignment\tikz@handle\let\pgf@let@token=% + \tikz@scan@@next@command }% +\def\tikz@scan@@next@command{% + \afterassignment\tikz@handle\let\pgf@let@token=% +} + \newcount\tikz@expandcount \let\tikz@collected@onpath=\pgfutil@empty% +\edef\tikz@frozen@relax@token{\ifnum0=0\fi} % Central dispatcher for commands \def\tikz@handle{% @@ -2224,7 +2229,7 @@ \ifx\pgf@let@token:% \let\pgfutil@next=\tikz@colon@char% \else% - \let\pgfutil@next=\tikz@expand% + \let\pgfutil@next=\tikz@handle@evenmore \fi% \fi% \fi% @@ -2240,10 +2245,26 @@ \fi% \fi% \fi% - \ifx\pgfutil@next\tikz@expand\else\tikz@expandcount=100\relax\fi% \pgfutil@next% }% +% Continued... +\def\tikz@handle@evenmore{% + % if \pgf@let@token is \relax or frozen \relax, skip it and + % scan from the next token + \ifx\pgf@let@token\relax + \let\pgfutil@next=\tikz@scan@@next@command + \else + \ifx\pgf@let@token\tikz@frozen@relax@token + \let\pgfutil@next=\tikz@scan@@next@command + \else + \let\pgfutil@next=\tikz@expand + \fi + \fi + \ifx\pgfutil@next\tikz@expand\else\tikz@expandcount=100\relax\fi + \pgfutil@next +} + \def\tikz@l@char{% \pgfutil@ifnextchar e{\tikz@let@command}{% \pgfutil@ifnextchar i{\tikz@lsystem}{% @@ -2566,7 +2587,7 @@ \def\tikz@skip#1{\tikz@scan@next@command#1}% \def\tikz@expand{% - \advance\tikz@expandcount by -1% + \advance\tikz@expandcount by -1 \ifnum\tikz@expandcount<0\relax% \tikzerror{Giving up on this path. Did you forget a semicolon?}% \let\pgfutil@next=\tikz@finish% @@ -2939,7 +2960,7 @@ % -| \def\tikz@hv@lineto{% - \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikz@hv@lineto}{ + \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikz@hv@lineto}{% \pgfutil@ifnextchar p{\tikz@collect@pic@onpath\tikz@hv@lineto}% {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@hv@lineto}% {\tikz@scan@one@point{\tikz@@hv@lineto}}}}}% @@ -3204,13 +3225,13 @@ \let\tikz@collected@onpath=\pgfutil@empty% \tikz@edgetoparentcollect% }% -\def\tikz@edgetoparentcollect{ +\def\tikz@edgetoparentcollect{% \pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikz@edgetoparentcollect}% {% \expandafter% \endgroup% \expandafter\tikz@edgetoparent@rollout\expandafter{\tikz@collected@onpath}% - } + }% }% \def\tikz@edgetoparent@rollout#1{% @@ -3840,7 +3861,7 @@ % A label text always ``ends'' the node. % \def\tikz@fig ode{% - \pgfutil@ifnextchar a\tikz@test@also{ + \pgfutil@ifnextchar a\tikz@test@also{% \pgfutil@ifnextchar f{\tikz@nodes@start}\tikz@normal@fig}}% \def\tikz@test@also a{\pgfutil@ifnextchar l\tikz@node@also{\tikz@normal@fig a}}% \def\tikz@normal@fig{% @@ -5240,7 +5261,7 @@ \def\tikz@scan@absolute#1{% \pgfutil@ifnextchar({\tikz@scan@@absolute#1}%) {% - \advance\tikz@expandcount by -1% + \advance\tikz@expandcount by -1 \ifnum\tikz@expandcount<0\relax% \let\pgfutil@next=\tikz@@scangiveup% \else%