summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex935
1 files changed, 721 insertions, 214 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex
index cb8ad420ea8..e2a9cb2d649 100644
--- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex
@@ -7,19 +7,13 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/tikz.code.tex,v 1.27 2008/02/13 19:48:11 tantau Exp $
+\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/tikz.code.tex,v 1.76 2010/10/13 09:20:31 ludewich Exp $
-% Always-present libraries:
-
+% Always-present libraries (|\usepgflibrary| defined in
+% \file{pgfutil-common.tex}).
\usepgflibrary{plothandlers}
-% TikZ is a key family
-\pgfkeys{/tikz/.is family}
-
-\def\tikzset{\pgfqkeys{/tikz}}
-
-
\newdimen\tikz@lastx
\newdimen\tikz@lasty
\newdimen\tikz@lastxsaved
@@ -41,32 +35,61 @@
\newif\iftikz@snaked
\newif\iftikz@decoratepath
+% |\pgfutil@empty| is defined in \file{pgfutil-common.tex}.
\let\tikz@options=\pgfutil@empty
-\def\tikz@addoption#1{\expandafter\def\expandafter\tikz@options\expandafter{\tikz@options#1}}
-\def\tikz@addmode#1{\expandafter\def\expandafter\tikz@mode\expandafter{\tikz@mode#1}}
+% |\tikz@addoption| adds \texttt{#1} at the end of the replacement
+% text of |\tikz@options| without expansion.
+\def\tikz@addoption#1{%
+ \expandafter\def\expandafter\tikz@options\expandafter{\tikz@options#1}}
+% Same as |tikz@addoption| for |\tikz@mode|. Note that |\tikz@mode| is
+% initially let to |\pgfutil@empty| later (see path usage options).
+\def\tikz@addmode#1{%
+ \expandafter\def\expandafter\tikz@mode\expandafter{\tikz@mode#1}}
+% Same as |tikz@addoption| for |\tikz@transform|. Works even if
+% |\tikz@transform| is not defined. In that case, nothing is added to
+% |\tikz@transform|: \texttt{#1} is expanded.
\def\tikz@addtransform#1{%
- \ifx\tikz@transform\relax%
+ \ifx\tikz@transform\relax
#1%
- \else%
+ \else
\expandafter\def\expandafter\tikz@transform\expandafter{\tikz@transform#1}%
- \fi%
-}
-
+ \fi}
-% TikZ options:
+% TikZ options management.
-% This command is supported for compatibility only:
+% Setting up the tikz key family (key management needs
+% \file{pgfkeys.code.tex});
+\pgfkeys{/tikz/.is family}
-\def\tikzoption#1{\pgfutil@ifnextchar[{\tikzoption@opt{#1}}{\tikzoption@noopt{#1}}}%}
+% |\tikzset| is a shortcut to set keys that belongs to the tikz
+% family.
+\def\tikzset{\pgfqkeys{/tikz}}
-\def\tikzoption@opt#1[#2]#3{\pgfkeysdef{/tikz/#1}{#3}\pgfkeyssetvalue{/tikz/#1/.@def}{#2}}
-\def\tikzoption@noopt#1#2{\pgfkeysdef{/tikz/#1}{#2}\pgfkeyssetvalue{/tikz/#1/.@def}{\pgfkeysvaluerequired}}
+% Note: |\tikzoption| is supported for compatibility only. |\tikzset|
+% should be used instead.
+\def\tikzoption#1{%
+ \pgfutil@ifnextchar[%]
+ {\tikzoption@opt{#1}}{\tikzoption@noopt{#1}}}
+\def\tikzoption@opt#1[#2]#3{%
+ \pgfkeysdef{/tikz/#1}{#3}%
+ \pgfkeyssetvalue{/tikz/#1/.@def}{#2}}
+\def\tikzoption@noopt#1#2{%
+ \pgfkeysdef{/tikz/#1}{#2}%
+ \pgfkeyssetvalue{/tikz/#1/.@def}{\pgfkeysvaluerequired}}
% Baseline options
-\tikzoption{baseline}[0pt]{\pgfutil@ifnextchar({\tikz@baseline@coordinate}{\tikz@baseline@simple}#1\@nil}%)
+\tikzoption{baseline}[0pt]{%
+ \pgfutil@ifnextchar(%)
+ {\tikz@baseline@coordinate}{\tikz@baseline@simple}#1\@nil}
\def\tikz@baseline@simple#1\@nil{\pgfsetbaseline{#1}}
-\def\tikz@baseline@coordinate#1\@nil{\pgfsetbaselinepointlater{\tikz@scan@one@point\pgfutil@firstofone#1}}
+\def\tikz@baseline@coordinate#1\@nil{%
+ \pgfsetbaselinepointlater{\tikz@scan@one@point\pgfutil@firstofone#1}}
+
+\tikzoption{trim left}[0pt]{\pgfutil@ifnextchar({\tikz@trim@coordinate{left}}{\tikz@trim@simple{left}}#1\@nil}%)
+\tikzoption{trim right}{\pgfutil@ifnextchar({\tikz@trim@coordinate{right}}{\tikz@trim@simple{right}}#1\@nil}%)
+\def\tikz@trim@simple#1#2\@nil{\csname pgfsettrim#1\endcsname{#2}}
+\def\tikz@trim@coordinate#1#2\@nil{\csname pgfsettrim#1pointlater\endcsname{\tikz@scan@one@point\pgfutil@firstofone#2}}
% Draw options
\tikzoption{line width}{\tikz@semiaddlinewidth{#1}}%
@@ -96,6 +119,7 @@
\expandafter\tikz@addoption\expandafter{\expandafter\pgfsetdash\tikz@temp}%
}%
\def\tikz@dashphase{0pt}
+\def\tikz@dashpattern{}
\def\tikz@scandashon n#1o{%
\expandafter\def\expandafter\tikz@dashpattern\expandafter{\tikz@dashpattern{#1}}%
@@ -114,17 +138,44 @@
\else%
\ifx\tikz@temp\pgfutil@empty%
\else%
- \def\tikz@double@color{#1}%
+ \pgfsetinnerstrokecolor{#1}%
\fi%
\tikz@addmode{\tikz@mode@doubletrue}%
+ \tikzset{every double/.try}%
\fi}
\tikzoption{double distance}{%
\pgfmathsetlength{\pgf@x}{#1}%
- \edef\tikz@double@width@distance{\the\pgf@x}%
- \tikz@addmode{\tikz@mode@doubletrue}}
+ \edef\tikz@double@setup{%
+ \pgf@x=\the\pgf@x%
+ \advance\pgf@x by2\pgflinewidth%
+ \pgflinewidth=\pgf@x%
+ \noexpand\pgfsetlinewidth{\pgflinewidth}%
+ \noexpand\pgfsetinnerlinewidth{\the\pgf@x}%
+ }%
+ \tikzset{double}}
+\def\tikz@double@setup{%
+ \pgf@x=2\pgflinewidth%
+ \advance\pgf@x by0.6pt%
+ \pgflinewidth=\pgf@x%
+ \pgfsetlinewidth{\pgflinewidth}%
+ \pgfsetinnerlinewidth{0.6pt}%
+}%
+\tikzset{double distance between line centers/.code={
+ \pgfmathsetlength{\pgf@x}{#1}%
+ \edef\tikz@double@setup{%
+ \pgf@x=\pgflinewidth%
+ \pgf@xa=\the\pgf@x%
+ \advance\pgf@x by\pgf@xa%
+ \advance\pgf@xa by-\pgflinewidth%
+ \pgflinewidth=\pgf@x%
+ \noexpand\pgfsetlinewidth{\pgflinewidth}%
+ \noexpand\pgfsetinnerlinewidth{\pgf@xa}%
+ }%
+ \tikzset{double}}}
+\tikzset{double equal sign distance/.style={double distance between line centers=0.45ex}}
+
+
-\def\tikz@double@width@distance{0.6pt}
-\def\tikz@double@color{white}
% Fill options
@@ -167,6 +218,13 @@
\tikzoption{rounded corners}[4pt]{\pgfsetcornersarced{\pgfpoint{#1}{#1}}}
\tikzoption{sharp corners}[]{\pgfsetcornersarced{\pgfpointorigin}}
+% Radii and arc options
+\tikzset{x radius/.initial=0pt}
+\tikzset{y radius/.initial=0pt}
+\tikzset{radius/.style={/tikz/x radius=#1,/tikz/y radius=#1}}
+\tikzset{start angle/.initial=}
+\tikzset{end angle/.initial=}
+\tikzset{delta angle/.initial=}
% Coordinate options
@@ -302,13 +360,17 @@
\let\tikz@fillcolor=\pgfutil@empty
\let\tikz@strokecolor=\pgfutil@empty
+% Insert a path using an option
+\tikzset{insert path/.code=\tikz@scan@next@command#1\pgf@stop}
% Pattern options
\tikzset{pattern/.code=\PackageError{tikz}{You need to say \string\usetikzlibrary{patterns}}{},
pattern color/.style=pattern}
+% Path pictures
+\tikzset{path picture/.code=\tikz@addmode{\def\tikz@path@picture{#1}}}
-% Shading options
+% Fading options
\tikzset{path fading/.code={
\def\tikz@temp{#1}%
\ifx\tikz@temp\tikz@nonetext%
@@ -412,59 +474,139 @@
% Pin options
-\tikzoption{pin}{\pgfutil@ifnextchar[{\tikz@parse@pin}{\tikz@parse@pin[]}#1\pgf@nil}
-\tikzoption{pin distance}{\def\tikz@pin@distance{#1}}
-\tikzoption{pin edge}{\def\tikz@pin@edge@style{#1}}
-
-\tikzoption{tikz@pin@post}[]{%
- \tikz@compute@direction{\tikz@label@angle}{\tikz@pin@distance}%
- \global\let\tikz@pin@edge@style@smuggle=\tikz@pin@edge@style%
-}
-\tikzoption{tikz@pre@pin@edge}[]{\def\pgf@marshal{\tikzstyle{tikz@pin@options}=}
- \expandafter\pgf@marshal\expandafter[\tikz@pin@edge@style@smuggle]%
+\tikzset{
+ pin/.code={\pgfutil@ifnextchar[{\tikz@parse@pin}{\tikz@parse@pin[]}#1:\pgf@nil},%}
+ pin distance/.store in=\tikz@pin@distance,
+ pin distance=3ex,
+ pin position/.store in=\tikz@pin@default@pos,
+ pin position=above,
+ pin edge/.store in=\tikz@pin@edge@style,
+ pin edge={},
+ tikz@pin@post/.code={\global\let\tikz@pin@edge@style@smuggle=\tikz@pin@edge@style},
+ tikz@pre@pin@edge/.code={%
+ \def\pgf@marshal{\tikzstyle{tikz@pin@options}=}
+ \expandafter\pgf@marshal\expandafter[\tikz@pin@edge@style@smuggle]%
+ }%
}
-\def\tikz@pin@distance{3ex}
-\def\tikz@pin@edge@style{}
+\long\def\tikz@parse@pin[#1]#2:#3\pgf@nil{%
+ \def\tikz@temp{#3}%
+ \ifx\tikz@temp\pgfutil@empty%
+ % no position, use default
+ \tikz@@parse@pin[#1]\tikz@pin@default@pos:#2:\pgf@nil%
+ \else%
+ \tikz@@parse@pin[#1]#2:#3\pgf@nil%
+ \fi%
+}
-\def\tikz@parse@pin[#1]#2:#3\pgf@nil{%
- \tikz@add@after@node@path{%
+\long\def\tikz@@parse@pin[#1]#2:#3:\pgf@nil{%
+ \tikzset{append after command={%
\bgroup
[current point is local=true]
\pgfextra{\let\tikz@save@last@node=\tikzlastnode}%
- node [every pin,tikz@label@angle=#2,#1,at=(\tikzlastnode.\tikz@label@angle),%
- after node path={(\tikz@save@last@node) edge[every pin edge,tikz@pre@pin@edge,tikz@pin@options] (\tikzlastnode)},
- tikz@pin@post]
+ node [every pin,tikz@label@angle=#2,#1,%
+ append after command={(\tikz@save@last@node) edge[every pin edge,tikz@pre@pin@edge,tikz@pin@options] (\tikzlastnode)},
+ tikz@label@post=\tikz@pin@distance,tikz@pin@post]
{#3}
\egroup%
- }
+ }}
}
% Label and pin options
-\tikzoption{label}{\pgfutil@ifnextchar[{\tikz@parse@label}{\tikz@parse@label[]}#1\pgf@nil}
-\tikzoption{label distance}{\def\tikz@label@distance{#1}}
-
-\tikzoption{tikz@label@angle}{\def\tikz@label@angle{#1}\csname tikz@label@angle@is@#1\endcsname}
-
-\tikzoption{tikz@label@post}[]{\tikz@compute@direction{\tikz@label@angle}{\tikz@label@distance}}
-
-\def\tikz@label@distance{0pt}
+\tikzset{
+ label/.code={\pgfutil@ifnextchar[{\tikz@parse@label}{\tikz@parse@label[]}#1:\pgf@nil},%}
+ label distance/.store in=\tikz@label@distance,
+ label distance=0pt,
+ label position/.store in=\tikz@label@default@pos,
+ label position=above,
+ absolute/.is if=tikz@absolute,
+ tikz@label@angle/.store in=\tikz@label@angle
+}
+
+\newif\iftikz@absolute
+\def\tikz@on@text{center}
+
+\tikzset{tikz@label@post/.code 2 args={
+ \edef\tikz@label@angle{\tikz@label@angle}%
+ \csname tikz@label@angle@is@\tikz@label@angle\endcsname
+ \ifx\tikz@label@angle\tikz@on@text%
+ \def\tikz@node@at{\pgfpointanchor{\tikzlastnode}{center}}%
+ \def\tikz@anchor{center}%
+ \else%
+ \iftikz@absolute%
+ \pgftransformreset%
+ \pgf@process{%
+ \pgfpointshapeborder{\tikzlastnode}%
+ {\pgfpointadd{\pgfpointanchor{\tikzlastnode}{center}}{\pgfpointpolar{\tikz@label@angle}{1pt}}}}%
+ \edef\tikz@node@at{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ \tikz@compute@direction{\tikz@label@angle}%
+ \tikz@addtransform{\pgftransformshift{\pgfpointpolar{\tikz@label@angle}{#1}}}%
+ \else%
+ \pgf@process{\pgfpointanchor{\tikzlastnode}{\tikz@label@angle}}%
+ \edef\tikz@node@at{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ \pgf@xb=\pgf@x%
+ \pgf@yb=\pgf@y%
+ \pgf@process{\pgfpointanchor{\tikzlastnode}{center}}%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \tikz@label@simplefalse%
+ \iftikz@fullytransformed%
+ \tikz@label@simpletrue%
+ \else
+ \ifdim\pgf@xc=\pgf@xb\relax%
+ \ifdim\pgf@yc=\pgf@yb\relax%
+ \tikz@label@simpletrue%
+ \fi%
+ \fi%
+ \fi%
+ \iftikz@label@simple%
+ \tikz@compute@direction{\tikz@label@angle}%
+ \tikz@addtransform{\pgftransformshift{\pgfpointpolar{\tikz@label@angle}{#1}}}%
+ \else%
+ \pgf@process{\pgfpointnormalised{%
+ \pgfpointdiff{\pgfpointtransformed{\pgfqpoint{\pgf@xc}{\pgf@yc}}}{\pgfpointtransformed{\pgfqpoint{\pgf@xb}{\pgf@yb}}}}}%
+ \edef\pgf@marshal{%
+ \noexpand\tikz@addtransform{\noexpand\pgftransformshift{\noexpand\pgfpointscale{#1}{
+ \noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}}}%
+ \pgf@marshal%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgf@x=\pgf@yc%
+ \pgf@y=-\pgf@xc%
+ \tikz@auto@anchor%
+ \fi%
+ \fi%
+ \fi}
+}
+
+\newif\iftikz@label@simple%
\def\tikz@parse@label[#1]#2:#3\pgf@nil{%
- \tikz@add@after@node@path{
+ \def\tikz@temp{#3}%
+ \ifx\tikz@temp\pgfutil@empty%
+ % no position, use default
+ \tikz@@parse@label[#1]\tikz@label@default@pos:#2:\pgf@nil%
+ \else%
+ \tikz@@parse@label[#1]#2:#3\pgf@nil%
+ \fi%
+}
+
+\def\tikz@@parse@label[#1]#2:#3:\pgf@nil{%
+ \tikzset{append after command={
\bgroup
+ [current point is local=true]
\pgfextra{\let\tikz@save@last@fig@name=\tikz@last@fig@name}%
node
[every label,%
tikz@label@angle=#2,%
#1,%
- at=(\tikzlastnode.\tikz@label@angle),tikz@label@post]%
+ tikz@label@post=\tikz@label@distance]%
{#3}%
\pgfextra{\global\let\tikz@last@fig@name=\tikz@save@last@fig@name}%
\egroup%
- }
+ }}
}
\expandafter\def\csname tikz@label@angle@is@right\endcsname{\def\tikz@label@angle{0}}
@@ -476,9 +618,9 @@
\expandafter\def\csname tikz@label@angle@is@below\endcsname{\def\tikz@label@angle{270}}
\expandafter\def\csname tikz@label@angle@is@below right\endcsname{\def\tikz@label@angle{315}}
-\def\tikz@compute@direction#1#2{%
+\def\tikz@compute@direction#1{%
\let\tikz@do@auto@anchor=\relax
- \c@pgf@counta=#1\relax%
+ \pgfmathsetcount{\c@pgf@counta}{#1}%
\ifnum\c@pgf@counta<0\relax
\advance\c@pgf@counta by 360\relax%
\fi%
@@ -504,11 +646,9 @@
\else%
\def\tikz@anchor{west}%
\fi\fi\fi\fi\fi\fi\fi\fi%
- \tikz@addtransform{\pgftransformshift{\pgfpointpolar{#1}{#2}}}%
}
-
% General node options
\tikzoption{name}{\edef\tikz@fig@name{#1}}
@@ -521,14 +661,9 @@
\tikzset{alias/.code={\tikz@fig@mustbenamed\expandafter\def\expandafter\tikz@alias\expandafter{\tikz@alias\pgfnodealias{#1}{\tikz@fig@name}}}}
-\tikzoption{after node path}{\tikz@add@after@node@path{#1}}%
-\def\tikz@add@after@node@path#1{\expandafter\def\expandafter\tikz@after@node\expandafter{\tikz@after@node#1}}
-
-\def\tikzaddafternodepathoption#1{%
- #1%
- \expandafter\def\expandafter\tikz@afternodepathoptions\expandafter{\tikz@afternodepathoptions#1}}
-
-\let\tikz@afternodepathoptions=\pgfutil@empty
+% deprecated:
+\def\tikzaddafternodepathoption#1{#1\tikzset{prefix after command={\pgfextra{#1}}}}
+\tikzset{after node path/.style={append after command={#1}}}
\tikzoption{anchor}{\def\tikz@anchor{#1}\let\tikz@do@auto@anchor=\relax}
@@ -623,8 +758,6 @@
\fi%
}
-\def\tikz@time{.5}
-
\def\tikz@install@auto@anchor@{\let\tikz@do@auto@anchor=\tikz@auto@anchor@on}
\def\tikz@install@auto@anchor@false{\let\tikz@do@auto@anchor=\relax}
\def\tikz@install@auto@anchor@left{\let\tikz@do@auto@anchor=\tikz@auto@anchor@on\def\tikz@auto@anchor@direction{left}}
@@ -647,15 +780,15 @@
\tikzoption{text height}{\def\tikz@text@height{#1}}
\tikzoption{text depth}{\def\tikz@text@depth{#1}}
\tikzoption{text ragged}[]%
-{\def\tikz@text@action{\raggedright\rightskip\z@ plus2em \spaceskip.3333em \xspaceskip.5em\relax}}
+{\def\tikz@text@action{\raggedright\rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax}}
\tikzoption{text badly ragged}[]{\def\tikz@text@action{\raggedright\relax}}
\tikzoption{text ragged left}[]%
-{\def\tikz@text@action{\raggedleft\leftskip\z@ plus2em \spaceskip.3333em \xspaceskip.5em\relax}}
+{\def\tikz@text@action{\raggedleft\leftskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax}}
\tikzoption{text badly ragged left}[]{\def\tikz@text@action{\raggedleft\relax}}
-\tikzoption{text justified}[]{\def\tikz@text@action{\leftskip\z@\rightskip\z@\relax}}
+\tikzoption{text justified}[]{\def\tikz@text@action{\leftskip0pt\rightskip0pt\relax}}
\tikzoption{text centered}[]{\def\tikz@text@action{%
- \leftskip\z@ plus2em%
- \rightskip\z@ plus2em%
+ \leftskip0pt plus2em%
+ \rightskip0pt plus2em%
\spaceskip.3333em \xspaceskip.5em%
\parfillskip=0pt%
\let\\=\@centercr% for latex
@@ -674,9 +807,25 @@
\let\tikz@textfont=\pgfutil@empty
\let\tikz@textopacity=\pgfutil@empty
-\def\tikz@text@action{\raggedright\rightskip\z@ plus2em \spaceskip.3333em \xspaceskip.5em\relax}
+\def\tikz@text@action{\raggedright\rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax}
+% Alignment
+\tikzset{
+ node halign header/.initial=,
+ align/.is choice,
+ align/left/.style ={text ragged,node halign header=\tikz@align@left@header},
+ align/flush left/.style ={text badly ragged,node halign header=\tikz@align@left@header},
+ align/right/.style ={text ragged left,node halign header=\tikz@align@right@header},
+ align/flush right/.style ={text badly ragged left,node halign header=\tikz@align@right@header},
+ align/center/.style={text centered,node halign header=\tikz@align@center@header},
+ align/flush center/.style={text badly centered,node halign header=\tikz@align@center@header},
+ align/justify/.style ={text justified,node halign header=\tikz@align@left@header},
+ align/none/.style ={text justified,node halign header=}
+}
+\def\tikz@align@left@header{##\hfil\cr}
+\def\tikz@align@right@header{\hfil##\cr}
+\def\tikz@align@center@header{\hfil##\hfil\cr}
@@ -708,8 +857,8 @@
\pgfutil@namedef{tikz@special@arrow@end>|}{tikz@>|@#2}%
\pgfutil@namedef{tikz@special@arrow@start<<}{tikzs@<<@#2}%
\pgfutil@namedef{tikz@special@arrow@end>>}{tikze@>>@#2}%<<
- \pgfutil@namedef{tikz@special@arrow@start>>}{tikzs@<<@#2}%<<
- \pgfutil@namedef{tikz@special@arrow@end<<}{tikze@>>@#2}%<<
+ \pgfutil@namedef{tikz@special@arrow@start>>}{tikzs@>>@#2}%<<
+ \pgfutil@namedef{tikz@special@arrow@end<<}{tikze@<<@#2}%<<
}
\def\tikz@processarrows#1{%
@@ -749,7 +898,7 @@
\def\tikz@set@parabola@bend#1{\def\tikz@parabola@bend{#1}}
% Axis options
-\tikzoption{domain}{\def\tikz@plot@domain{#1}\expandafter\tikz@plot@samples@recalc\tikz@plot@domain\relax}
+\tikzoption{domain}{\edef\tikz@plot@domain{#1}\expandafter\tikz@plot@samples@recalc\tikz@plot@domain\relax}
\tikzoption{range}{\def\tikz@plot@range{#1}}
% Plot options
@@ -762,6 +911,15 @@
\tikzoption{xcomb}[]{\let\tikz@plot@handler=\pgfplothandlerxcomb}
\tikzoption{ycomb}[]{\let\tikz@plot@handler=\pgfplothandlerycomb}
\tikzoption{polar comb}[]{\let\tikz@plot@handler=\pgfplothandlerpolarcomb}
+\tikzoption{ybar}[]{\let\tikz@plot@handler=\pgfplothandlerybar}
+\tikzoption{ybar interval}[]{\let\tikz@plot@handler=\pgfplothandlerybarinterval}
+\tikzoption{xbar interval}[]{\let\tikz@plot@handler=\pgfplothandlerxbarinterval}
+\tikzoption{xbar}[]{\let\tikz@plot@handler=\pgfplothandlerxbar}
+\tikzoption{const plot}[]{\let\tikz@plot@handler=\pgfplothandlerconstantlineto}
+\tikzoption{const plot mark left}[]{\let\tikz@plot@handler=\pgfplothandlerconstantlineto}
+\tikzoption{const plot mark right}[]{\let\tikz@plot@handler=\pgfplothandlerconstantlinetomarkright}
+\tikzoption{jump mark right}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkright}
+\tikzoption{jump mark left}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkleft}
\tikzoption{raw gnuplot}[true]{\csname tikz@plot@raw@gnuplot#1\endcsname}
\tikzoption{prefix}{\def\tikz@plot@prefix{#1}}
@@ -775,8 +933,20 @@
\tikzoption{only marks}[]{\let\tikz@plot@handler\pgfplothandlerdiscard}
-\tikzoption{mark}{\def\tikz@plot@mark{#1}}
-\tikzoption{mark options}{\def\tikz@plot@mark@options{#1}}
+\tikzoption{mark}{%
+ \def\tikz@plot@mark{#1}%
+ \def\tikz@temp{none}%
+ \ifx\tikz@temp\tikz@plot@mark
+ \let\tikz@plot@mark=\pgfutil@empty
+ \fi
+}
+\tikzset{
+ no marks/.style={mark=none},%
+ no markers/.style={mark=none},%
+ every mark/.style={},
+ mark options/.style={%
+ every mark/.style={#1}%
+ }}
\tikzoption{mark size}{\pgfsetplotmarksize{#1}}
\tikzoption{mark indices}{\def\tikz@mark@list{#1}}
@@ -785,21 +955,19 @@
\let\tikz@mark@list=\pgfutil@empty
-\let\tikz@plot@mark@options=\pgfutil@empty
-
\let\tikz@plot@handler=\pgfplothandlerlineto
\let\tikz@plot@mark=\pgfutil@empty
\def\tikz@plot@samples{25}
\def\tikz@plot@domain{-5:5}
\def\tikz@plot@var{\x}
-\def\tikz@plot@samplesat{-5,-4.6,...,5}
+\def\tikz@plot@samplesat{-5,-4.5833333,...,5}
\def\tikz@plot@samples@recalc#1:#2\relax{%
\pgfmathparse{#1}%
\let\tikz@temp@start=\pgfmathresult%
\pgfmathparse{#2}%
\let\tikz@temp@end=\pgfmathresult%
- \pgfmathparse{\tikz@temp@start+(\tikz@temp@end-\tikz@temp@start)/\tikz@plot@samples}%
+ \pgfmathparse{\tikz@temp@start+(\tikz@temp@end-\tikz@temp@start)/(\tikz@plot@samples-1)}%
\edef\tikz@plot@samplesat{\tikz@temp@start,\pgfmathresult,...,\tikz@temp@end}%
}
@@ -817,6 +985,19 @@
\def\tikz@to@path{-- (\tikztotarget) \tikztonodes}
+% After command options
+\tikzset{
+ append after command/.code=\expandafter\def\expandafter\tikz@after@path\expandafter{\tikz@after@path#1},
+ prefix after command/.code={%
+ \def\tikz@temp{#1}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\tikz@after@path%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\tikz@temp\tikz@after@path}%
+ }
+}
+\let\tikz@after@path\pgfutil@empty
+
% Tree options
\newif\iftikz@child@missing
@@ -831,6 +1012,9 @@
\tikzoption{sibling distance}{\pgfmathsetlength\tikzsiblingdistance{#1}}
\tikzoption{growth function}{\let\tikz@grow=#1}
+
+\tikzset{grow siblings on line/.style={growth function=\tikz@grow@direction}}
+
\tikzoption{growth parent anchor}{\def\tikz@growth@anchor{#1}}
\tikzoption{grow}{\tikz@set@growth{#1}\edef\tikz@special@level{\the\tikztreelevel}}%
\tikzoption{grow'}{\tikz@set@growth{#1}\tikz@swap@growth\edef\tikz@special@level{\the\tikztreelevel}}%
@@ -1026,6 +1210,13 @@
\tikzstyle{dashed}= [dash pattern=on 3pt off 3pt]
\tikzstyle{densely dashed}= [dash pattern=on 3pt off 2pt]
\tikzstyle{loosely dashed}= [dash pattern=on 3pt off 6pt]
+\tikzstyle{dashdotted}= [dash pattern=on 3pt off 2pt on \the\pgflinewidth off 2pt]
+\tikzstyle{densely dashdotted}= [dash pattern=on 3pt off 1pt on \the\pgflinewidth off 1pt]
+\tikzstyle{loosely dashdotted}= [dash pattern=on 3pt off 4pt on \the\pgflinewidth off 4pt]
+\tikzstyle{dashdotdotted}= [dash pattern=on 3pt off 2pt on \the\pgflinewidth off 2pt on \the\pgflinewidth off 2pt]
+\tikzstyle{densely dashdotdotted}= [dash pattern=on 3pt off 1pt on \the\pgflinewidth off 1pt on \the\pgflinewidth off 1pt]
+\tikzstyle{loosely dashdotdotted}= [dash pattern=on 3pt off 4pt on \the\pgflinewidth off 4pt on \the\pgflinewidth off 4pt]
+
\tikzstyle{transparent}= [opacity=0]
\tikzstyle{ultra nearly transparent}=[opacity=0.05]
@@ -1105,6 +1296,7 @@
\let\tikz@atbegin@picture=\pgfutil@empty%
\let\tikz@atend@picture=\pgfutil@empty%
\let\tikz@transform=\relax%
+ \def\tikz@time{.5}%
\tikz@installcommands\scope[every picture,#1]%
\expandafter\tikz@atbegin@picture%
\tikz@lib@scope@check%
@@ -1112,9 +1304,13 @@
\def\endtikzpicture{%
\tikz@atend@picture%
\global\let\pgf@shift@baseline=\pgf@baseline%
+ \global\let\pgf@trimleft@final=\pgf@trimleft%
+ \global\let\pgf@trimright@final=\pgf@trimright%
\global\let\pgf@remember@smuggle=\ifpgfrememberpicturepositiononpage%
\endscope%
\let\pgf@baseline=\pgf@shift@baseline%
+ \let\pgf@trimleft=\pgf@trimleft@final%
+ \let\pgf@trimright=\pgf@trimright@final%
\let\ifpgfrememberpicturepositiononpage=\pgf@remember@smuggle%
\endpgfpicture}
@@ -1131,6 +1327,16 @@
% The rectangle \tikz{\draw (0,0) rectangle (1em,1ex)} has width 1em and
% height 1ex.
+% This code does not work for some inline \tikz. For example
+% \tikz\foreach \x in {1,...,10} \draw (\x,0) circle (0.4cm);
+% makes tikz crash.
+% Begin suspected code
+% \def\tikz{\pgfutil@ifnextchar[{\tikz@opt}{\tikz@opt[]}}
+% \def\tikz@opt[#1]{\tikzpicture[#1]\pgfutil@ifnextchar\bgroup{\tikz@}{\tikz@@}}
+% \def\tikz@{\bgroup\tikz@auto@end@pathtrue\aftergroup\endtikzpicture\let\pgf@temp=}
+% \def\tikz@@{\begingroup\def\tikz@path@do@at@end{\endgroup\endtikzpicture}}
+% End suspected code
+% Begin old code
\def\tikz{\pgfutil@ifnextchar[{\tikz@opt}{\tikz@opt[]}}
\def\tikz@opt[#1]{\tikzpicture[#1]\pgfutil@ifnextchar\bgroup{\tikz@}{\tikz@@}}
\def\tikz@#1{#1\endtikzpicture}
@@ -1145,8 +1351,14 @@
\catcode`\;=\active
\gdef\tikz@collectactivesemicolon#1;{#1;\endtikzpicture}
}
+% End old code
-
+% Invokes '#1' if the command is invoked withing a tikzpicture and
+% '#2' if not.
+\def\tikzifinpicture#1#2{%
+ \pgfutil@ifundefined{filldraw}{#2}{#1}% TT: This is a wrong
+ % test! Who uses this?...
+}%
%
% Environment for scoping graphic state settings
@@ -1174,6 +1386,28 @@
\tikz@lib@scope@check%
}
+% Install a shortcut command which is only valid inside of a
+% tikzpicture.
+%
+% It works in the same way as the '\path' shortcut does: it introduces
+% a \let#1=#2 at the beginning of tikzpicture.
+%
+% #1: shortcut command inside of tikzpicture
+% #2: real command name
+\def\tikzaddtikzonlycommandshortcutlet#1#2{%
+ \expandafter\def\expandafter\tikz@installcommands\expandafter{\tikz@installcommands
+ \let#1=#2
+ }%
+}%
+
+% Has the same effect as \tikzaddtikzonlycommandshortcutlet but uses
+% \def#1{#2} instead of \let.
+\def\tikzaddtikzonlycommandshortcutdef#1#2{%
+ \expandafter\def\expandafter\tikz@installcommands\expandafter{\tikz@installcommands
+ \def#1{#2}%
+ }%
+}%
+
%
% Install the abbreviated commands
%
@@ -1199,6 +1433,8 @@
\let\tikz@origcoordinate=\coordinate%
\let\tikz@origmatrix=\matrix%
\let\tikz@origcalendar=\calendar%
+ \let\tikz@origdv=\datavisualization%
+ \let\tikz@origgraph=\graph%
%
\tikz@deactivatthings%
%
@@ -1216,14 +1452,19 @@
\def\shade{\path[shade]}
\def\shadedraw{\path[shade,draw]}
\def\clip{\path[clip]}
+ \def\graph{\path graph}
\def\useasboundingbox{\path[use as bounding box]}
\def\node{\tikz@path@overlay{node}}
\def\coordinate{\tikz@path@overlay{coordinate}}
\def\matrix{\tikz@path@overlay{node[matrix]}}
- \def\calendar{\tikz@lib@cal@calendar}%
+ \def\calendar{\tikz@lib@cal@calendar}%
+ \def\datavisualization{\tikz@lib@datavisualization}%
}
\ifx\tikz@lib@cal@calendar\@undefined
-\def\tikz@lib@cal@calendar{\PackageError{tikz}{You need to load the calendar library}{}}
+\def\tikz@lib@cal@calendar{\PackageError{tikz}{You need to say \string\usetikzlibrary{calendar} to use the \string\calendar{} command}{}}
+\fi
+\ifx\tikz@lib@datavisualization\@undefined
+\def\tikz@lib@datavisualization{\PackageError{tikz}{You need to say \string\usetikzlibrary{datavisualization} to use the \string\datavisualization{} command}{}}
\fi
\def\tikz@path@overlay#1{%
@@ -1253,6 +1494,8 @@
\let\coordinate=\tikz@origcoordinate%
\let\matrix=\tikz@origmatrix%
\let\calendar=\tikz@origcalendar%
+ \let\datavisualization=\tikz@origdv%
+ \let\graph=\tikz@origgraph%
}
@@ -1263,18 +1506,23 @@
\gdef\tikz@nonactivecolon{:}
\catcode`\|=12
\gdef\tikz@nonactivebar{|}
+ \catcode`\!=12
+ \gdef\tikz@nonactiveexlmark{!}
\catcode`\;=\active
\catcode`\:=\active
\catcode`\|=\active
\catcode`\"=\active
+ \catcode`\!=\active
\gdef\tikz@activesemicolon{;}%
\gdef\tikz@activecolon{:}%
\gdef\tikz@activebar{|}%
\gdef\tikz@activequotes{"}%
+ \gdef\tikz@activeexlmark{!}%
\gdef\tikz@deactivatthings{%
- \def;{\tikz@nonactivesemicolon}
- \def:{\tikz@nonactivecolon}
- \def|{\tikz@nonactivebar}
+ \def;{\tikz@nonactivesemicolon}%
+ \def:{\tikz@nonactivecolon}%
+ \def|{\tikz@nonactivebar}%
+ \def!{\tikz@nonactiveexlmark}%
}
}
@@ -1300,15 +1548,16 @@
\let\tikz@next=\tikz@eargactivesemicolon%
\fi%
\tikz@next}
-\long\def\tikz@eargnormalsemicolon<#1>#2;{\only<#1>{\tikz@@command@path#2;}}
+\long\def\tikz@eargnormalsemicolon<#1>#2;{\alt<#1>{\tikz@@command@path#2;}{\tikz@path@do@at@end}}
{
\catcode`\;=\active
- \long\global\def\tikz@eargactivesemicolon<#1>#2;{\only<#1>{\tikz@@command@path#2;}}
+ \long\global\def\tikz@eargactivesemicolon<#1>#2;{\alt<#1>{\tikz@@command@path#2;}{\tikz@path@do@at@end}}
}
\def\tikz@@command@path{%
\edef\tikzscope@linewidth{\the\pgflinewidth}%
\begingroup%
+ \let\tikz@path@do@at@end=\tikz@lib@scope@check%
\let\tikz@options=\pgfutil@empty%
\let\tikz@mode=\pgfutil@empty%
\let\tikz@moveto@waiting=\relax%
@@ -1319,7 +1568,7 @@
\tikz@snakedfalse%
\tikz@decoratepathfalse%
\tikz@node@is@a@labelfalse%
- \tikz@expandcount=1000\relax%
+ \tikz@expandcount=100\relax%
\tikz@lastx=0pt%
\tikz@lasty=0pt%
\tikz@lastxsaved=0pt%
@@ -1396,10 +1645,10 @@
\let\@next=\tikz@e@char%
\else%
\ifx\@let@token g%
- \let\@next=\tikz@grid%
+ \let\@next=\tikz@g@char%
\else%
\ifx\@let@token s%
- \let\@next=\tikz@sine%
+ \let\@next=\tikz@schar%
\else%
\ifx\@let@token |%
\let\@next=\tikz@vh@lineto%
@@ -1427,7 +1676,7 @@
\let\@next=\tikz@decoration%
\else%
\ifx\@let@token l%
- \let\@next=\tikz@let@command%
+ \let\@next=\tikz@l@char%\tikz@let@command%
\else%
\let\@next=\tikz@expand%
\fi%
@@ -1446,6 +1695,24 @@
\@next%
}
+\def\tikz@l@char{%
+ \pgfutil@ifnextchar e{\tikz@let@command}{%
+ \pgfutil@ifnextchar i{\tikz@lsystem}{%
+ \pgfutil@ifnextchar-{\tikz@@lsystem}{\tikz@expand}%
+ }%
+ }%
+}
+
+\def\tikz@lsystem{%
+ \PackageError{tikz}{You need to say \string\usetikzlibrary{lindenmayersystems} to
+ draw Lindenmayer systems}{}
+}
+
+\def\tikz@@lsystem{%
+ \PackageError{tikz}{You need to say \string\usetikzlibrary{lindenmayersystems} to
+ draw L-systems}{}
+}
+
\def\tikz@pchar{\pgfutil@ifnextchar l{\tikz@plot}{\tikz@parabola}}
\def\tikz@cchar{%
\pgfutil@ifnextchar i{\tikz@circle}%
@@ -1457,6 +1724,18 @@
\def\tikz@@e@char dge{%
\pgfutil@ifnextchar f{\tikz@edgetoparent}{\tikz@edge@plain}}%
+\def\tikz@schar{\pgfutil@ifnextchar i{\tikz@sine}{\tikz@svg@path}}
+
+\def\tikz@g@char r{\pgfutil@ifnextchar i{\tikz@grid}{\tikz@graph}}
+
+% svg syntax
+% svg[options] "..."
+
+\def\tikz@svg@path{%
+ \PackageError{tikz}{You need to say \string\usetikzlibrary{svg.path} to
+ use the svg path command}{}
+}
+
\def\tikz@finish{%
% Rendering pipeline
@@ -1480,6 +1759,7 @@
%
% Reset modes
%
+ \let\tikz@path@picture=\pgfutil@empty%
\tikz@mode@fillfalse%
\tikz@mode@drawfalse%
\tikz@mode@doublefalse%
@@ -1525,7 +1805,7 @@
\tikz@options%
\fi%
%
- % Step 4: Do a fill if shade follows.
+ % Step 4: Do a fill if shade or a path picture follows.
%
\iftikz@mode@fill%
\iftikz@mode@shade%
@@ -1535,6 +1815,16 @@
\pgfsyssoftpath@invokecurrentpath%
\pgfsys@fill%
\tikz@mode@fillfalse% no more filling...
+ \else%
+ \ifx\tikz@path@picture\pgfutil@empty%
+ \else%
+ \pgfsyssoftpath@getcurrentpath\tikz@temppath
+ \pgfprocessround{\tikz@temppath}{\tikz@temppath}% change the path
+ \pgfsyssoftpath@setcurrentpath\tikz@temppath%
+ \pgfsyssoftpath@invokecurrentpath%
+ \pgfsys@fill%
+ \tikz@mode@fillfalse% no more filling...
+ \fi%
\fi%
\fi%
%
@@ -1548,6 +1838,34 @@
\tikz@mode@shadefalse% no more shading...
\fi%
%
+ % Step 5a: Do a path picture if necessary.
+ %
+ \ifx\tikz@path@picture\pgfutil@empty%
+ \else%
+ \begingroup%
+ \pgfsys@beginscope%
+ \pgfsyssoftpath@getcurrentpath\tikz@temppath
+ \pgfprocessround{\tikz@temppath}{\tikz@temppath}% change the path
+ \pgfsyssoftpath@setcurrentpath\tikz@temppath%
+ \pgfsyssoftpath@invokecurrentpath%
+ \pgfsys@clipnext%
+ \pgfsys@discardpath%
+ \pgf@relevantforpicturesizefalse%
+ \expandafter\def\csname pgf@sh@ns@path picture bounding box\endcsname{rectangle}
+ \expandafter\edef\csname pgf@sh@np@path picture bounding box\endcsname{%
+ \def\noexpand\southwest{\noexpand\pgfqpoint{\the\pgf@pathminx}{\the\pgf@pathminy}}%
+ \def\noexpand\northeast{\noexpand\pgfqpoint{\the\pgf@pathmaxx}{\the\pgf@pathmaxy}}%
+ }
+ \expandafter\def\csname pgf@sh@nt@path picture bounding box\endcsname{{1}{0}{0}{1}{0pt}{0pt}}
+ \expandafter\def\csname pgf@sh@pi@path picture bounding box\endcsname{\pgfpictureid}
+ \pgfinterruptpath%
+ \tikz@path@picture%
+ \endpgfinterruptpath%
+ \pgfsys@endscope%
+ \endgroup%
+ \let\tikz@path@picture=\pgfutil@empty%
+ \fi%
+ %
% Step 6: Double stroke, if necessary
%
\iftikz@mode@draw%
@@ -1555,10 +1873,7 @@
% Change line width
\begingroup%
\pgfsys@beginscope%
- \pgf@x=2\pgflinewidth%
- \advance\pgf@x by\tikz@double@width@distance%
- \pgflinewidth=\pgf@x%
- \pgfsetlinewidth{\the\pgflinewidth}%
+ \tikz@double@setup%
\fi%
\fi%
%
@@ -1576,16 +1891,7 @@
%
\iftikz@mode@draw%
\iftikz@mode@double%
- \pgfsyssoftpath@setcurrentpath\pgf@last@used@path% reinstall
- \pgf@x=\tikz@double@width@distance%
- \pgfsetlinewidth{\the\pgf@x}%
- \pgfsetstrokecolor{\tikz@double@color}%
- \pgfsyssoftpath@flushcurrentpath%
- \pgfsys@stroke%
\pgfsys@endscope%
- \ifpgf@drawarrows% set in pgfusepath...
- \pgf@add@arrows@as@needed%
- \fi%
\endgroup%
\fi%
\fi%
@@ -1617,16 +1923,17 @@
\fi%
\endgroup%
\global\pgflinewidth=\tikzscope@linewidth%
- \tikz@lib@scope@check%
+ \tikz@path@do@at@end%
}
\let\tikz@lib@scope@check\pgfutil@empty% this is a hook for the scopes library
+\def\tikz@path@do@at@end{\tikz@lib@scope@check}
% Extra actions
\def\tikz@extra@preaction#1{%
{%
\pgfsys@beginscope%
- \setbox\tikz@figbox=\box\voidb@x%
+ \setbox\tikz@figbox=\box\pgfutil@voidb@x%
\path[#1];% do extra path
\pgfsyssoftpath@setcurrentpath\tikz@actions@path% restore
\tikz@restorepathsize%
@@ -1637,7 +1944,7 @@
\def\tikz@extra@postaction#1{%
{%
\pgfsys@beginscope%
- \setbox\tikz@figbox=\box\voidb@x%
+ \setbox\tikz@figbox=\box\pgfutil@voidb@x%
\tikz@restorepathsize%
\path[#1]\pgfextra{\pgfsyssoftpath@setcurrentpath\tikz@actions@path};% do extra path
\pgf@resetpathsizes%
@@ -1666,22 +1973,36 @@
% Syntax for scopes:
% {scoped path commands}
-\def\tikz@beginscope{\begingroup\tikz@scan@next@command}
+\newif\iftikz@auto@end@path
+
+\def\tikz@beginscope{\begingroup\tikz@auto@end@pathfalse\tikz@scan@next@command}
\def\tikz@endscope{%
+ \iftikz@auto@end@path\expandafter\tikz@finish\expandafter\egroup\else\expandafter\tikz@@endscope\fi%
+}
+\def\tikz@@endscope{%
\global\setbox\tikz@tempbox=\box\tikz@figbox%
- \xdef\tikz@scope@save@lastx{\the\tikz@lastx}%
- \xdef\tikz@scope@save@lasty{\the\tikz@lasty}%
- \iftikz@current@point@local%
- \endgroup%
- \else%
- \xdef\tikz@scope@save@lastxsaved{\the\tikz@lastxsaved}%
- \xdef\tikz@scope@save@lastysaved{\the\tikz@lastysaved}%
- \endgroup%
- \tikz@lastxsaved=\tikz@scope@save@lastxsaved%
- \tikz@lastysaved=\tikz@scope@save@lastysaved%
- \fi%
- \tikz@lastx=\tikz@scope@save@lastx%
- \tikz@lasty=\tikz@scope@save@lasty%
+ \edef\tikz@marshal{%
+ \tikz@lastx=\the\tikz@lastx%
+ \tikz@lasty=\the\tikz@lasty%
+ \iftikz@current@point@local%
+ \else%
+ \tikz@lastxsaved=\the\tikz@lastxsaved%
+ \tikz@lastysaved=\the\tikz@lastysaved%
+ \ifx\tikz@moveto@waiting\relax%
+ \let\tikz@moveto@waiting\relax%
+ \else%
+ \def\noexpand\tikz@moveto@waiting{\tikz@moveto@waiting}%
+ \fi%
+ \iftikz@shapeborder%
+ \noexpand\tikz@shapebordertrue%
+ \def\noexpand\tikz@shapeborder@name{\tikz@shapeborder@name}%
+ \else%
+ \noexpand\tikz@shapeborderfalse%
+ \fi%
+ \fi%
+ }%
+ \expandafter%
+ \endgroup\tikz@marshal%
\setbox\tikz@figbox=\box\tikz@tempbox%
\tikz@scan@next@command}
@@ -1705,7 +2026,12 @@
% \draw (0,0) \foreach \x in {1,2,3} {-- (\x,0) circle (1cm)} -- (5,5);
\def\tikz@foreach{%
- \def\pgffor@beginhook{\setbox\tikz@figbox=\box\tikz@tempbox\expandafter\tikz@scan@next@command\pgfutil@firstofone}%
+ \def\pgffor@beginhook{%
+ \tikz@lastx=\tikz@foreach@save@lastx%
+ \tikz@lasty=\tikz@foreach@save@lasty%
+ \tikz@lastxsaved=\tikz@foreach@save@lastxsaved%
+ \tikz@lastysaved=\tikz@foreach@save@lastysaved%
+ \setbox\tikz@figbox=\box\tikz@tempbox\expandafter\tikz@scan@next@command\pgfutil@firstofone}%
\def\pgffor@endhook{\pgfextra{%
\xdef\tikz@foreach@save@lastx{\the\tikz@lastx}%
\xdef\tikz@foreach@save@lasty{\the\tikz@lasty}%
@@ -1719,6 +2045,10 @@
\tikz@lastysaved=\tikz@foreach@save@lastysaved%
\setbox\tikz@figbox=\box\tikz@tempbox\tikz@scan@next@command}%
\global\setbox\tikz@tempbox=\copy\tikz@figbox%
+ \xdef\tikz@foreach@save@lastx{\the\tikz@lastx}%
+ \xdef\tikz@foreach@save@lasty{\the\tikz@lasty}%
+ \xdef\tikz@foreach@save@lastxsaved{\the\tikz@lastxsaved}%
+ \xdef\tikz@foreach@save@lastysaved{\the\tikz@lastysaved}%
\foreach}
@@ -1987,17 +2317,15 @@
% [options]
\def\tikz@parse@options#1]{%
\tikzset{#1}%
- \tikz@lib@dec@hook% for decorations...
\tikz@scan@next@command%
}
-\let\tikz@lib@dec@hook=\relax
% Syntax for edges:
% edge [options] (coordinate)
% edge [options] node {node text} (coordinate)
\def\tikz@edge@plain{%
\begingroup%
- \tikz@to@use@whom%
+ \ifx\tikz@to@use@whom\pgfutil@undefined\else\tikz@to@use@whom\fi
\let\tikz@to@or@edge@function=\tikz@do@edge%
\tikz@to@or@edge}
@@ -2016,11 +2344,12 @@
\tikz@@to@collect%
}
\def\tikz@@to@collect{%
- \pgfutil@ifnextchar(\tikz@@to@or@edge@coordinate
+ \pgfutil@ifnextchar(\tikz@@to@or@edge@coordinate%)
{\pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikz@@to@collect}%
- {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@@to@collect}
- {\PackageError{tikz}{( expected}{}%}
- \tikz@@to@or@edge@coordinate()}}}%
+ {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@@to@collect}%
+ {\pgfutil@ifnextchar +{\tikz@scan@one@point\tikz@@to@or@edge@math}%
+ {\PackageError{tikz}{(, +, coordinate, or node expected}{}%)
+ \tikz@@to@or@edge@coordinate()}}}}%
}
\def\tikz@@to@or@edge@coordinate({%
@@ -2061,8 +2390,10 @@
\tikz@options%
\tikz@transform%
% Typeset node:
+ \let\tikz@after@path\pgfutil@empty%
\tikz@atbegin@to%
- \path[style=every edge]\tikz@@to@local@options(\tikztostart)\tikz@to@path;%
+ \path[style=every edge]\tikz@@to@local@options(\tikztostart)\tikz@to@path
+ \pgfextra{\global\let\tikz@after@path@smuggle=\tikz@after@path};%
\tikz@atend@to%
\endpgfscope%
\endpgfinterruptpath%
@@ -2072,7 +2403,7 @@
\global\setbox\tikz@tempbox=\copy\tikz@figbox%
\endgroup%
\setbox\tikz@figbox=\box\tikz@tempbox%
- \tikz@scan@next@command%
+ \expandafter\tikz@scan@next@command\tikz@after@path%
}
\def\tikz@do@to{%
@@ -2080,9 +2411,14 @@
\def\tikztonodes{{\pgfextra{\tikz@node@is@a@labeltrue}\tikz@tonodes}}%
\let\tikz@collected@onpath=\pgfutil@empty%
\tikz@scan@next@command%
- \pgfextra{\tikz@atbegin@to}%
- [style=every to]\tikz@@to@local@options\tikz@to@path%
- \pgfextra{\tikz@atend@to}%
+ {%
+ \pgfextra{\let\tikz@after@path\pgfutil@empty}%
+ \pgfextra{\tikz@atbegin@to}%
+ [style=every to]\tikz@@to@local@options\tikz@to@path%
+ \pgfextra{\tikz@atend@to}%
+ \pgf@stop%
+ \expandafter\tikz@scan@next@command\expandafter%
+ }\tikz@after@path%
}
@@ -2099,6 +2435,26 @@
+% Syntax for graph path command:
+% graph {...}
+% See the graph library for details
+
+\def\tikz@graph aph{\tikz@lib@graph@parser}
+
+\def\tikz@lib@graph@parser{\pgfutil@ifnextchar[\tikz@graph@error{\tikz@graph@error[]}}%]
+\def\tikz@graph@error[#1]#2{%
+ \PackageError{tikz}{You need to say \string\usetikzlibrary{graph} in
+ order to use the graph syntax}{}%
+ \tikz@lib@graph@parser@done%
+}
+
+\def\tikz@lib@graph@parser@done{%
+ \tikz@scan@next@command%
+}
+
+
+
+
% Syntax for edge from parent:
% edge from parent [options]
\def\tikz@edgetoparent from parent{\pgfutil@ifnextchar[\tikz@@edgetoparent{\tikz@@edgetoparent[]}}%}
@@ -2236,7 +2592,7 @@
% Syntax for grids:
% grid <corner point>
-\def\tikz@grid rid{%
+\def\tikz@grid id{%
\tikz@flush@moveto%
\pgf@xa=\tikz@lastx\relax%
\pgf@ya=\tikz@lasty\relax%
@@ -2247,6 +2603,7 @@
\def\tikz@gridB#1{%
\tikz@make@last@position{#1}%
{%
+ \let\tikz@after@path\pgfutil@empty%
\expandafter\tikzset\expandafter{\tikz@grid@options}
\tikz@checkunit{\tikz@grid@x}%
\iftikz@isdimension%
@@ -2266,8 +2623,8 @@
\advance\pgf@yb by\pgf@y%
\pgfpathgrid[stepx=\pgf@xb,stepy=\pgf@yb]%
{\pgfqpoint{\pgf@xa}{\pgf@ya}}{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}%
- }
- \tikz@scan@next@command%
+ \expandafter}%
+ \expandafter\tikz@scan@next@command\tikz@after@path%
}
@@ -2280,6 +2637,7 @@
\pgfutil@ifnextchar[{\tikz@@plot}{\tikz@@plot[]}}%}
\def\tikz@@plot[#1]{%
\begingroup%
+ \let\tikz@after@path\pgfutil@empty%
\let\tikz@options=\pgfutil@empty%
\tikzset{every plot/.try}%
\tikzset{#1}%
@@ -2349,7 +2707,7 @@
\pgfscope%
\let\tikz@options=\pgfutil@empty%
\let\tikz@transform=\pgfutil@empty%
- \expandafter\tikzset\expandafter{\tikz@plot@mark@options}%
+ \tikzset{every mark}%
\tikz@options%
\ifx\tikz@mark@list\pgfutil@empty%
\pgfplothandlermark{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}}%
@@ -2363,17 +2721,18 @@
}%
\fi%
\global\setbox\tikz@tempbox=\copy\tikz@figbox%
+ \global\let\tikz@after@path@smuggle=\tikz@after@path
\endgroup%
\setbox\tikz@figbox=\box\tikz@tempbox%
\tikz@make@last@position{\tikz@@@temp}%
- \tikz@scan@next@command%
+ \expandafter\tikz@scan@next@command\tikz@after@path@smuggle%
}
\pgfdeclareplotmark{ball}
{%
\def\tikz@shading{ball}%
- \shade (0,0) circle (\pgfplotmarksize);%
+ \shade (0pt,0pt) circle (\pgfplotmarksize);%
}
@@ -2439,6 +2798,7 @@
\pgf@xc=\tikz@lastx%
\pgf@yc=\tikz@lasty%
\begingroup% now calculate bend:
+ \let\tikz@after@path\pgfutil@empty%
\expandafter\tikzset\expandafter{\tikz@parabola@option}%
\tikz@lastxsaved=\tikz@parabola@bend@factor\tikz@lastx%
\tikz@lastysaved=\tikz@parabola@bend@factor\tikz@lasty%
@@ -2454,51 +2814,73 @@
\advance\tikz@lastx by-\pgf@xb%
\advance\tikz@lasty by-\pgf@yb%
\xdef\tikz@parabola@b{{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}}%
- \endgroup%
- \expandafter\pgfpathparabola\tikz@parabola@b%
- \tikz@scan@next@command%
+ \expandafter\endgroup%
+ \expandafter\expandafter\expandafter\pgfpathparabola\expandafter\tikz@parabola@b%
+ \expandafter\tikz@scan@next@command\tikz@after@path%
}
% Syntax for circles:
-% circle (radius)
+% circle [options] % where options should set, at least, radius
+% circle (radius) % deprecated
%
% Syntax for ellipses:
-% ellipse (x-radius and y-radius)
+% ellipse [options] % identical to circle.
+% ellipse (x-radius and y-radius) % deprecated
%
% radii can be dimensionless, then they are in the xy-system
\def\tikz@circle ircle{\tikz@flush@moveto\tikz@@circle}
\def\tikz@ellipse llipse{\tikz@flush@moveto\tikz@@circle}
\def\tikz@@circle{%
- \pgfutil@ifnextchar(\tikz@@@circle{%)
- \advance\tikz@expandcount by -1%
+ \pgfutil@ifnextchar(\tikz@@@circle
+ {\pgfutil@ifnextchar[\tikz@circle@opt{%])
+ \advance\tikz@expandcount by -10\relax% go down quickly
\ifnum\tikz@expandcount<0\relax%
- \let\@next=\tikz@@circle@scangiveup%
+ \let\@next=\tikz@@circle@normal%
\else%
\let\@next=\tikz@@circle@scanexpand%
\fi%
\@next%
- }%
+ }}%
}
\def\tikz@@circle@scanexpand{\expandafter\tikz@@circle}
-\def\tikz@@circle@scangiveup#1{\PackageError{tikz}{Cannot parse this radius}{}#1{\tikz@scan@next@command}}
+\def\tikz@@circle@normal{\tikz@circle@opt[]}
+
+\def\tikz@circle@opt[#1]{%
+ {%
+ \def\tikz@node@at{\tikz@last@position}%
+ \let\tikz@transform=\pgfutil@empty%
+ \tikzset{every circle/.try,#1}%
+ \pgftransformshift{\tikz@node@at}%
+ \tikz@transform%
+ \tikz@do@circle{\pgfkeysvalueof{/tikz/x radius}}{\pgfkeysvalueof{/tikz/y radius}}
+ }%
+ \tikz@scan@next@command%
+}
+
\def\tikz@@@circle(#1){%
- \pgfutil@in@{ and }{#1}%
- \ifpgfutil@in@%
- \tikz@@ellipseB(#1)%
- \else%
- \tikz@@ellipseB({#1} and {#1})%
- \fi%
+ {%
+ \pgftransformshift{\tikz@last@position}%
+ \pgfutil@in@{ and }{#1}%
+ \ifpgfutil@in@%
+ \tikz@@ellipseB(#1)%
+ \else%
+ \tikz@do@circle{#1}{#1}%
+ \fi%
+ }%
\tikz@scan@next@command%
}
\def\tikz@@ellipseB(#1 and #2){%
+ \tikz@do@circle{#1}{#2}
+}
+\def\tikz@do@circle#1#2{
\pgfmathparse{#1}%
\let\tikz@ellipse@x=\pgfmathresult%
\ifpgfmathunitsdeclared%
\pgfmathparse{#2}%
\let\tikz@ellipse@y=\pgfmathresult%
\ifpgfmathunitsdeclared%
- \pgfpathellipse{\tikz@last@position}{%
+ \pgfpathellipse{\pgfpointorigin}{%
\pgfqpoint{\tikz@ellipse@x pt}{0pt}}{\pgfpoint{0pt}{\tikz@ellipse@y pt}}%
\else%
\PackageError{tikz}{You cannot mix dimensions and dimensionless values in an ellipse}{}%
@@ -2509,7 +2891,7 @@
\ifpgfmathunitsdeclared%
\PackageError{tikz}{You cannot mix dimensions and dimensionless values in an ellipse}{}%
\else%
- \pgfpathellipse{\tikz@last@position}{%
+ \pgfpathellipse{\pgfpointorigin}{%
\pgfpointxy{\tikz@ellipse@x}{0}}{\pgfpointxy{0}{\tikz@ellipse@y}}%
\fi%
\fi%
@@ -2522,13 +2904,50 @@
% arc (start angle:end angle:x-radius and y-radius)
%
% radius can be dimensionless, then the arc is in the xy-coordinate system
-\def\tikz@arcA rc{%
- \tikz@flush@moveto%
- \pgfutil@ifnextchar({\tikz@@arcto}{\expandafter\tikz@arcA\expandafter r\expandafter c}}
+\def\tikz@arcA rc{\tikz@flush@moveto\tikz@arc@cont}%
+\def\tikz@arc@cont{%
+ \pgfutil@ifnextchar(%)
+ {\tikz@@arcto}{%
+ \pgfutil@ifnextchar[%]
+ {\tikz@arc@opt}%
+ {%
+ \advance\tikz@expandcount by -10\relax% go down quickly
+ \ifnum\tikz@expandcount<0\relax%
+ \let\@next=\tikz@@arc@normal%
+ \else%
+ \let\@next=\tikz@@arc@scanexpand%
+ \fi%
+ \@next%
+ }%
+ }%
+}
+\def\tikz@@arc@scanexpand{\expandafter\tikz@arc@cont}
+\def\tikz@@arc@normal{\tikz@arc@opt[]}
+
+
+\def\tikz@arc@opt[#1]{%
+ {%
+ \tikzset{every arc/.try,#1}%
+ \pgfkeysgetvalue{/tikz/start angle}\tikz@s
+ \pgfkeysgetvalue{/tikz/end angle}\tikz@e
+ \pgfkeysgetvalue{/tikz/delta angle}\tikz@d
+ \ifx\tikz@s\pgfutil@empty%
+ \pgfmathsetmacro\tikz@s{\tikz@e-\tikz@d}
+ \else
+ \ifx\tikz@e\pgfutil@empty%
+ \pgfmathsetmacro\tikz@e{\tikz@s+\tikz@d}
+ \fi%
+ \fi
+ \tikz@do@arc{\tikz@s}{\tikz@e}
+ {\pgfkeysvalueof{/tikz/x radius}}
+ {\pgfkeysvalueof{/tikz/y radius}}
+ }%
+ \tikz@arcfinal%
+}
\def\tikz@@arcto(#1){%
\edef\tikz@temp{(#1)}%
- \expandafter\tikz@@@arcto@check@slashand\tikz@temp%
+ \expandafter\tikz@@@arcto@check@slashand\tikz@temp%
}
\def\tikz@@@arcto@check@slashand(#1:#2:#3){%
@@ -2538,9 +2957,13 @@
\else%
\tikz@parse@arc@and(#1:#2:{#3} and {#3})%
\fi%
+ \tikz@arcfinal%
}
\def\tikz@parse@arc@and(#1:#2:#3 and #4){%
+ \tikz@do@arc{#1}{#2}{#3}{#4}%
+}
+\def\tikz@do@arc#1#2#3#4{%
\pgfmathparse{#3}%
\let\tikz@arc@x=\pgfmathresult%
\ifpgfmathunitsdeclared%
@@ -2567,10 +2990,17 @@
\def\tikz@@@arcfinal#1#2#3{%
#1%
- \pgf@process{#2}%
+ \pgf@process{#2}
+ \xdef\tikz@arc@save@first{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ \pgf@process{#3}
+ \xdef\tikz@arc@save@second{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+}
+
+\def\tikz@arcfinal{%
+ \pgf@process{\tikz@arc@save@first}%
\advance\tikz@lastx by-\pgf@x%
\advance\tikz@lasty by-\pgf@y%
- \pgf@process{#3}%
+ \pgf@process{\tikz@arc@save@second}%
\advance\tikz@lastx by\pgf@x%
\advance\tikz@lasty by\pgf@y%
\tikz@lastxsaved=\tikz@lastx%
@@ -2590,7 +3020,11 @@
\def\tikz@@coordinate[#1](#2){%
\pgfutil@ifnextchar a{\tikz@@coordinate@at[#1](#2)}
{\tikz@fig ode[shape=coordinate,#1](#2){}}}
-\def\tikz@@coordinate@at[#1](#2)at#3({%
+\def\tikz@@coordinate@at[#1](#2)a{%
+ \pgfutil@ifnextchar t{\tikz@@coordinate@@at[#1](#2)a}%
+ {\tikz@fig ode[shape=coordinate,#1](#2){}a}%
+}
+\def\tikz@@coordinate@@at[#1](#2)at#3({%
\def\tikz@coordinate@caller{\tikz@fig ode[shape=coordinate,#1](#2)at}%
\tikz@scan@one@point\tikz@@coordinate@at@math(%
}
@@ -2617,9 +3051,9 @@
\begingroup%
\tikz@is@matrixfalse%
\let\nodepart=\tikz@nodepart%
+ \let\tikz@do@after@node=\tikz@scan@next@command%
\let\tikz@options=\pgfutil@empty%
- \let\tikz@after@node=\pgfutil@empty%
- \let\tikz@afternodepathoptions=\pgfutil@empty%
+ \let\tikz@after@path=\pgfutil@empty%
\let\tikz@transform=\pgfutil@empty%
\let\tikz@mode=\pgfutil@empty%
\tikz@decoratepathfalse%
@@ -2645,8 +3079,11 @@
\tikz@scan@one@point\tikz@@fig@scan@at}
\def\tikz@@fig@scan@at#1{%
\def\tikz@node@at{#1}\tikz@@scan@fig}%
-\def\tikz@fig@scan@name(#1){\edef\tikz@fig@name{#1}\tikz@@scan@fig}%
-\def\tikz@fig@scan@options[#1]{\tikzset{#1}\tikz@@scan@fig}%
+\def\tikz@fig@scan@name(#1){%
+ \pgfkeysvalueof{/tikz/name/.@cmd}#1\pgfeov% CF : this is now ALWAYS consistent with 'name=' option; allows overrides.
+ \tikz@@scan@fig}%
+% make it \long to allow \par in "pin" options etc:
+\long\def\tikz@fig@scan@options[#1]{\tikzset{#1}\tikz@@scan@fig}%
\let\tikz@node@reset@hook=\pgfutil@empty%
\let\tikz@node@begin@hook=\pgfutil@empty%
\def\tikz@fig@main{\afterassignment\tikz@@fig@main\let\next=}
@@ -2679,7 +3116,8 @@
\ifx\tikz@text@width\pgfutil@empty%
\else%
\begingroup%
- \pgfutil@minipage[t]{\tikz@text@width}%
+ \pgfmathsetlength{\pgf@x}{\tikz@text@width}%
+ \pgfutil@minipage[t]{\pgf@x}\leavevmode\hbox{}%
\tikz@text@action%
\fi%
\tikz@atbegin@node%
@@ -2690,9 +3128,10 @@
\pgfutil@colorlet{.}{\tikz@textcolor}%
\fi%
\pgfsetcolor{.}%
- \setbox\tikz@figbox=\box\voidb@x%
+ \setbox\tikz@figbox=\box\pgfutil@voidb@x%
\tikz@uninstallcommands%
\aftergroup\tikz@fig@collectresetcolor%
+ \tikz@halign@check%
\ignorespaces%
}
\def\tikz@fig@collectresetcolor{%
@@ -2713,7 +3152,7 @@
{\pgfutil@ifnextchar[{\tikz@fig@mustbenamed\tikz@fig@continue}%
{\pgfutil@ifnextchar t{\tikz@fig@mustbenamed\tikz@fig@continue}
{\pgfutil@ifnextchar e{\tikz@fig@mustbenamed\tikz@fig@continue}
- {\ifx\tikz@after@node\pgfutil@empty\expandafter\tikz@fig@continue\else\expandafter\tikz@fig@mustbenamed\expandafter\tikz@fig@continue\fi}}}}}%}
+ {\ifx\tikz@after@path\pgfutil@empty\expandafter\tikz@fig@continue\else\expandafter\tikz@fig@mustbenamed\expandafter\tikz@fig@continue\fi}}}}}%}
\def\tikz@do@matrix{%
\tikzset{every matrix/.try}%
@@ -2726,7 +3165,7 @@
\pgfinterruptpath%
\pgfscope%
\tikz@options%
- \setbox\tikz@figbox=\box\voidb@x%
+ \setbox\tikz@figbox=\box\pgfutil@voidb@x%
\let\tikzmatrixname=\tikz@fig@name%
\edef\tikz@m@anchor{\ifx\tikz@matrix@anchor\pgfutil@empty\tikz@anchor\else\tikz@matrix@anchor\fi}%
\expandafter\pgfutil@in@\expandafter{\expandafter.\expandafter}\expandafter{\tikz@m@anchor}%
@@ -2840,7 +3279,7 @@
\pgfinterruptpath%
\pgfscope%
\tikz@options%
- \setbox\tikz@figbox=\box\voidb@x%
+ \setbox\tikz@figbox=\box\pgfutil@voidb@x%
\pgfmultipartnode{\tikz@shape}{\tikz@anchor}{\tikz@fig@name}{%
\pgfutil@tempdima=\pgflinewidth%
{\begingroup\tikz@finish}%
@@ -2884,8 +3323,7 @@
\def\tikz@node@finish{%
\global\let\tikz@last@fig@name=\tikz@fig@name%
- \global\let\tikz@after@node@smuggle=\tikz@after@node%
- \global\let\tikz@afternodepathoptions@smuggle=\tikz@afternodepathoptions%
+ \global\let\tikz@after@path@smuggle=\tikz@after@path%
% shift box outside group
\global\setbox\tikz@tempbox=\copy\tikz@figbox%
\endgroup\endgroup%
@@ -2894,23 +3332,83 @@
\let\tikz@to@last@fig@name=\tikz@last@fig@name%
\let\tikz@to@use@whom=\tikz@to@use@last@fig@name%
\let\tikzlastnode=\tikz@last@fig@name%
- \ifx\tikz@after@node@smuggle\pgfutil@empty%
+ \ifx\tikz@after@path@smuggle\pgfutil@empty%
\else%
- \tikz@scan@next@command{\pgfextra{\tikz@afternodepathoptions@smuggle}\tikz@after@node@smuggle}\pgf@stop%
+ \tikz@scan@next@command{\tikz@after@path@smuggle}\pgf@stop%
\fi%
- \tikz@scan@next@command%
+ \tikz@do@after@node%
}
\let\tikz@fig@continue@orig=\tikz@fig@continue
+\def\tikz@do@after@node{\tikz@scan@next@command}
+
+\newif\iftikz@do@align
+
+% Alignment handling
+\def\tikz@halign@check{%
+ \tikz@do@alignfalse
+ \ifx\tikz@text@width\pgfutil@empty%
+ \pgfkeysgetvalue{/tikz/node halign header}\tikz@align@header%
+ \ifx\tikz@align@header\pgfutil@empty%
+ \else%
+ \tikz@do@aligntrue%
+ \fi%
+ \fi%
+ \iftikz@do@align%
+ % Bingo
+ \setbox\tikz@align@aligned@box=\box\pgfutil@voidb@x% void
+ \let\\=\tikz@align@newline%
+ \expandafter\tikz@start@align%
+ \fi%
+}
+\def\tikz@align@newline{\unskip\pgfutil@ifnextchar[\tikz@@align@newline{\tikz@@align@newline[0pt]}}%}
+\def\tikz@@align@newline[#1]{\egroup\tikz@align@continue\pgfmathparse{#1}\let\tikz@align@temp=\pgfmathresult\tikz@start@align}%
+% Two safe boxes for alignment:
+\let\tikz@align@aligned@box=\pgfnodeparttextbox
+\let\tikz@align@line@box=\tikz@figbox
+
+\def\tikz@start@align{%
+ % Start collecting text:
+ \setbox\tikz@align@line@box=\hbox\bgroup\bgroup%
+ \aftergroup\tikz@align@collectresetcolor\ignorespaces%
+}
+\def\tikz@align@collectresetcolor{%
+ \pgfutil@ifnextchar\reset@color%
+ {\reset@color\afterassignment\tikz@align@collectresetcolor\let\tikz@temp=}%
+ {\tikz@align@end@check}%
+}
+\def\tikz@align@end@check{%
+ \egroup%
+ \ifvoid\tikz@align@aligned@box%
+ \setbox\tikz@align@aligned@box=\box\tikz@align@line@box%
+ \else%
+ \setbox\tikz@align@aligned@box=\vbox{%
+ \expandafter\expandafter\expandafter\halign\expandafter\expandafter\expandafter{\tikz@align@header%
+ \box\tikz@align@aligned@box\cr%
+ \noalign{\vskip\tikz@align@temp pt}%
+ \unhbox\tikz@align@line@box\unskip\cr}}%
+ \fi%
+ \pgfutil@ifnextchar\tikz@align@continue{}
+ {%
+ % Main continue
+ \box\tikz@align@aligned@box%
+ \egroup%
+ }%
+}
+\def\tikz@align@continue{\tikz@@align@continue}
+\let\tikz@@align@continue=\pgfutil@empty
+
% Syntax for parts of nodes:
-% node ... {... \nodepart{name} ... \nodepart{name} ...}
+% node ... {... \nodepart[options]{name} ... \nodepart{name} ...}
-\def\tikz@nodepart#1{%
+\def\tikz@nodepart{\pgfutil@ifnextchar[\tikz@@nodepart{\tikz@@nodepart[]}}%}
+\def\tikz@@nodepart[#1]#2{%
\tikz@atend@node%
\unskip%
- \gdef\tikz@nodepart@name{#1}%
+ \gdef\tikz@nodepart@options{#1}%
+ \gdef\tikz@nodepart@name{#2}%
\global\let\tikz@fig@continue=\tikz@nodepart@continue%
\pgfutil@ifnextchar x{\egroup\relax}{\egroup\relax}% gobble spaces
}
@@ -2920,12 +3418,14 @@
\expandafter\setbox\csname pgfnodepart\tikz@nodepart@name box\endcsname=\hbox%
\bgroup%
\tikzset{every \tikz@nodepart@name\space node part/.try}%
+ \expandafter\tikzset\expandafter{\tikz@nodepart@options}%
\pgfinterruptpicture%
\tikz@textfont%
\ifx\tikz@text@width\pgfutil@empty%
\else%
\begingroup%
- \pgfutil@minipage[t]{\tikz@text@width}%
+ \pgfmathsetlength{\pgf@x}{\tikz@text@width}%
+ \pgfutil@minipage[t]{\pgf@x}\leavevmode\hbox{}%
\tikz@text@action%
\fi%
\bgroup%
@@ -2935,10 +3435,11 @@
\pgfutil@colorlet{.}{\tikz@textcolor}%
\fi%
\pgfsetcolor{.}%
- \setbox\tikz@figbox=\box\voidb@x%
+ \setbox\tikz@figbox=\box\pgfutil@voidb@x%
\tikz@uninstallcommands%
\tikz@atbegin@node%
\aftergroup\tikz@fig@collectresetcolor%
+ \tikz@halign@check%
\ignorespaces%
}
@@ -2956,7 +3457,7 @@
\fi%
\tikz@is@matrixfalse%
\let\tikz@options=\pgfutil@empty%
- \let\tikz@after@node=\pgfutil@empty%
+ \let\tikz@after@path=\pgfutil@empty%
\let\tikz@afternodepathoptions=\pgfutil@empty%
\let\tikz@alias=\pgfutil@empty%
\let\tikz@transform=\pgfutil@empty%
@@ -2970,15 +3471,14 @@
\tikz@node@begin@hook%
\tikz@alias%
\global\let\tikz@last@fig@name=\tikz@fig@name%
- \global\let\tikz@after@node@smuggle=\tikz@after@node%
- \global\let\tikz@afternodepathoptions@smuggle=\tikz@afternodepathoptions%
+ \global\let\tikz@after@path@smuggle=\tikz@after@path%
\endgroup%
\let\tikz@to@last@fig@name=\tikz@last@fig@name%
\let\tikz@to@use@whom=\tikz@to@use@last@fig@name%
\let\tikzlastnode=\tikz@last@fig@name%
- \ifx\tikz@after@node@smuggle\pgfutil@empty%
+ \ifx\tikz@after@path@smuggle\pgfutil@empty%
\else%
- \tikz@scan@next@command{\pgfextra{\tikz@afternodepathoptions@smuggle}\tikz@after@node@smuggle}\pgf@stop%
+ \tikz@scan@next@command{\tikz@after@path@smuggle}\pgf@stop%
\fi%
}
@@ -3500,8 +4000,6 @@
-
-
%
% Coordinate management
%
@@ -3693,12 +4191,18 @@
% Check to see if the y-coordinate is inside {}. If it is, scan it and
% reinsert it into the stream inside an extra group.
%
+% MW:
+% Check to see if the y-coordinate is inside {}. If it is, scan it and
+% reinsert it into the stream inside an extra group.
+%
\def\tikz@parse@regular#1(#2,{%
\pgfutil@ifnextchar\bgroup{\tikz@@parse@regular#1{#2}}{\tikz@@@parse@regular#1{#2}}%
}
-\def\tikz@@parse@regular#1#2#3{\tikz@@@parse@regular#1{#2}{{#3}}}%
-
-
+\def\tikz@@parse@regular#1#2#3{%
+ \pgfutil@ifnextchar[{% Uh oh! An array index.
+ \tikz@@@parse@regular#1{#2}{#3}}%
+ {\tikz@@@parse@regular#1{#2}{{#3}}}}
+
% Originally \def\tikz@parse@regular#1(#2,#3){%
%
\def\tikz@@@parse@regular#1#2#3){%
@@ -3859,7 +4363,6 @@
}
-
% Loading further libraries
% Include a library file.
@@ -3885,16 +4388,20 @@
\def\use@@tikzlibrary#1{%
\edef\pgf@list{#1}%
\pgfutil@for\pgf@temp:=\pgf@list\do{%
- \expandafter\ifx\csname tikz@library@\pgf@temp @loaded\endcsname\relax%
- \expandafter\global\expandafter\let\csname tikz@library@\pgf@temp @loaded\endcsname=\pgfutil@empty%
- \expandafter\edef\csname tikz@library@#1@atcode\endcsname{\the\catcode`\@}
- \expandafter\edef\csname tikz@library@#1@barcode\endcsname{\the\catcode`\|}
- \catcode`\@=11
- \catcode`\|=12
- \input tikzlibrary\pgf@temp.code.tex
- \catcode`\@=\csname tikz@library@#1@atcode\endcsname
- \catcode`\|=\csname tikz@library@#1@barcode\endcsname
- \fi%
+ \expandafter\pgfkeys@spdef\expandafter\pgf@temp\expandafter{\pgf@temp}%
+ \ifx\pgf@temp\pgfutil@empty
+ \else
+ \expandafter\ifx\csname tikz@library@\pgf@temp @loaded\endcsname\relax%
+ \expandafter\global\expandafter\let\csname tikz@library@\pgf@temp @loaded\endcsname=\pgfutil@empty%
+ \expandafter\edef\csname tikz@library@#1@atcode\endcsname{\the\catcode`\@}
+ \expandafter\edef\csname tikz@library@#1@barcode\endcsname{\the\catcode`\|}
+ \catcode`\@=11
+ \catcode`\|=12
+ \input tikzlibrary\pgf@temp.code.tex
+ \catcode`\@=\csname tikz@library@#1@atcode\endcsname
+ \catcode`\|=\csname tikz@library@#1@barcode\endcsname
+ \fi%
+ \fi
}%
}