diff options
author | Karl Berry <karl@freefriends.org> | 2006-10-15 22:37:32 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-10-15 22:37:32 +0000 |
commit | 237df1eb06d422ff243a05b9a25501ba287681c1 (patch) | |
tree | 4cc4f2032474921cb986d1ca63b3cf9a267b480a /Master/texmf-dist/tex/generic/pgf/frontendlayer | |
parent | 15e21b5bab66eca251ac48fdc052126505428d4e (diff) |
pgf/tikz 1.09 big update (13oct06)
git-svn-id: svn://tug.org/texlive/trunk@2332 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/frontendlayer')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz.code.tex | 1622 |
1 files changed, 1162 insertions, 460 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz.code.tex index 8541b57607a..ceeaaacb863 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz.code.tex @@ -1,10 +1,22 @@ -\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz.code.tex,v 1.35 2005/11/09 15:49:25 tantau Exp $ - -% Copyright 2005 by Till Tantau <tantau@cs.tu-berlin.de>. +% Copyright 2006 by Till Tantau +% +% This file may be distributed and/or modified % -% This program can be redistributed and/or modified under the terms -% of the GNU Public License, version 2. +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz.code.tex,v 1.65 2006/10/11 15:22:25 tantau Exp $ + + +% Always-present libraries: + +\usepgflibrary{plothandlers} + +\let\tikz@orig@setkeys=\setkeys % guard against changes, later +\let\tikz@orig@define@key=\define@key \newdimen\tikz@lastx \newdimen\tikz@lasty @@ -26,8 +38,7 @@ \newif\iftikz@node@is@a@label \newif\iftikz@snaked -\let\tikz@options=\@empty -\let\tikz@transform=\relax +\let\tikz@options=\pgf@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}} \def\tikz@addtransform#1{% @@ -40,30 +51,38 @@ +% TikZ options: + +\def\tikzoption{\tikz@orig@define@key{tikz}} + + + % Baseline options -\define@key{tikz}{baseline}[0pt]{\pgfsetbaseline{#1}}% +\tikzoption{baseline}[0pt]{\pgf@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\@firstofone#1}} % Draw options -\define@key{tikz}{line width}{\tikz@semiaddlinewidth{#1}}% +\tikzoption{line width}{\tikz@semiaddlinewidth{#1}}% \def\tikz@semiaddlinewidth#1{\tikz@addoption{\pgfsetlinewidth{#1}}\setlength\pgflinewidth{#1}} -\define@key{tikz}{cap}{\tikz@addoption{\csname pgfset#1cap\endcsname}} -\define@key{tikz}{join}{\tikz@addoption{\csname pgfset#1join\endcsname}} -\define@key{tikz}{miter limit}{\tikz@addoption{\pgfsetmiterlimit{#1}}} +\tikzoption{cap}{\tikz@addoption{\csname pgfset#1cap\endcsname}} +\tikzoption{join}{\tikz@addoption{\csname pgfset#1join\endcsname}} +\tikzoption{miter limit}{\tikz@addoption{\pgfsetmiterlimit{#1}}} -\define@key{tikz}{dash pattern}{% syntax: on 2pt off 3pt on 4pt ... +\tikzoption{dash pattern}{% syntax: on 2pt off 3pt on 4pt ... \def\tikz@temp{#1}% - \ifx\tikz@temp\@empty% + \ifx\tikz@temp\pgf@empty% \def\tikz@dashpattern{}% \tikz@addoption{\pgfsetdash{}{0pt}}% \else% \def\tikz@dashpattern{}% - \expandafter\tikz@scandashon\@gobble#1o\@nil% + \expandafter\tikz@scandashon\pgf@gobble#1o\@nil% \edef\tikz@temp{{\tikz@dashpattern}{\noexpand\tikz@dashphase}}% \expandafter\tikz@addoption\expandafter{\expandafter\pgfsetdash\tikz@temp}% \fi} -\define@key{tikz}{dash phase}{% +\tikzoption{dash phase}{% \def\tikz@dashphase{#1}% \edef\tikz@temp{{\tikz@dashpattern}{\noexpand\tikz@dashphase}}% \expandafter\tikz@addoption\expandafter{\expandafter\pgfsetdash\tikz@temp}% @@ -72,22 +91,26 @@ \def\tikz@scandashon n#1o{% \expandafter\def\expandafter\tikz@dashpattern\expandafter{\tikz@dashpattern{#1}}% - \@ifnextchar\@nil{\@gobble}{\tikz@scandashoff}} + \pgf@ifnextchar\@nil{\pgf@gobble}{\tikz@scandashoff}} \def\tikz@scandashoff ff#1o{% \expandafter\def\expandafter\tikz@dashpattern\expandafter{\tikz@dashpattern{#1}}% - \@ifnextchar\@nil{\@gobble}{\tikz@scandashon}} + \pgf@ifnextchar\@nil{\pgf@gobble}{\tikz@scandashon}} -\define@key{tikz}{draw opacity}{\tikz@addoption{\pgfsetstrokeopacity{#1}}} +\tikzoption{draw opacity}{\tikz@addoption{\pgfsetstrokeopacity{#1}}} % Double draw options -\define@key{tikz}{double}[]{% +\tikzoption{double}[]{% \def\tikz@temp{#1}% - \ifx\tikz@temp\@empty% + \ifx\tikz@temp\tikz@nonetext% + \tikz@addmode{\tikz@mode@doublefalse}% \else% - \def\tikz@double@color{#1}% - \fi% - \tikz@addmode{\tikz@mode@doubletrue}} -\define@key{tikz}{double distance}{% + \ifx\tikz@temp\pgf@empty% + \else% + \def\tikz@double@color{#1}% + \fi% + \tikz@addmode{\tikz@mode@doubletrue}% + \fi} +\tikzoption{double distance}{% \setlength{\pgf@x}{#1}% \edef\tikz@double@width@distance{\the\pgf@x}% \tikz@addmode{\tikz@mode@doubletrue}} @@ -97,51 +120,53 @@ % Fill options -\define@key{tikz}{even odd rule}[]{\tikz@addoption{\pgfseteorule}} -\define@key{tikz}{nonzero rule}[]{\tikz@addoption{\pgfsetnonzerorule}} +\tikzoption{even odd rule}[]{\tikz@addoption{\pgfseteorule}} +\tikzoption{nonzero rule}[]{\tikz@addoption{\pgfsetnonzerorule}} -\define@key{tikz}{fill opacity}{\tikz@addoption{\pgfsetfillopacity{#1}}} +\tikzoption{fill opacity}{\tikz@addoption{\pgfsetfillopacity{#1}}} % Joined fill/draw options -\define@key{tikz}{opacity}{\tikz@addoption{\pgfsetstrokeopacity{#1}\pgfsetfillopacity{#1}}} +\tikzoption{opacity}{\tikz@addoption{\pgfsetstrokeopacity{#1}\pgfsetfillopacity{#1}}} % Main color options -\define@key{tikz}{color}{% +\tikzoption{color}{% \tikz@addoption{% - \ifx\tikz@fillcolor\@empty% - \ifx\tikz@strokecolor\@empty% + \ifx\tikz@fillcolor\pgf@empty% + \ifx\tikz@strokecolor\pgf@empty% \else% \pgfsys@color@reset@inorderfalse% - \let\tikz@strokecolor\@empty% - \let\tikz@fillcolor\@empty% + \let\tikz@strokecolor\pgf@empty% + \let\tikz@fillcolor\pgf@empty% \fi% \else% \pgfsys@color@reset@inorderfalse% - \let\tikz@strokecolor\@empty% - \let\tikz@fillcolor\@empty% + \let\tikz@strokecolor\pgf@empty% + \let\tikz@fillcolor\pgf@empty% \fi% \colorlet{tikz@color}{#1}% - \color{tikz@color}% + \colorlet{.}{tikz@color}% + \pgfsetcolor{.}% \pgfsys@color@reset@inordertrue% }% \def\tikz@textcolor{#1}} + % Rounding options -\define@key{tikz}{rounded corners}[4pt]{\pgfsetcornersarced{\pgfpoint{#1}{#1}}} -\define@key{tikz}{sharp corners}[]{\pgfsetcornersarced{\pgfpointorigin}} +\tikzoption{rounded corners}[4pt]{\pgfsetcornersarced{\pgfpoint{#1}{#1}}} +\tikzoption{sharp corners}[]{\pgfsetcornersarced{\pgfpointorigin}} % Coordinate options -\define@key{tikz}{x}{\tikz@handle@vec{\pgfsetxvec}{\tikz@handle@x}#1\relax} -\define@key{tikz}{y}{\tikz@handle@vec{\pgfsetyvec}{\tikz@handle@y}#1\relax} -\define@key{tikz}{z}{\tikz@handle@vec{\pgfsetzvec}{\tikz@handle@z}#1\relax} +\tikzoption{x}{\tikz@handle@vec{\pgfsetxvec}{\tikz@handle@x}#1\relax} +\tikzoption{y}{\tikz@handle@vec{\pgfsetyvec}{\tikz@handle@y}#1\relax} +\tikzoption{z}{\tikz@handle@vec{\pgfsetzvec}{\tikz@handle@z}#1\relax} -\def\tikz@handle@vec#1#2{\@ifnextchar({\tikz@handle@coordinate#1}{\tikz@handle@single#2}} +\def\tikz@handle@vec#1#2{\pgf@ifnextchar({\tikz@handle@coordinate#1}{\tikz@handle@single#2}} \def\tikz@handle@coordinate#1{\tikz@scan@one@point#1} \def\tikz@handle@single#1#2\relax{#1{#2}} \def\tikz@handle@x#1{\pgfsetxvec{\pgfpoint{#1}{0pt}}} @@ -150,13 +175,13 @@ % Transformation options -\define@key{tikz}{scale}{\tikz@addtransform{\pgftransformscale{#1}}} -\define@key{tikz}{xscale}{\tikz@addtransform{\pgftransformxscale{#1}}} -\define@key{tikz}{xslant}{\tikz@addtransform{\pgftransformxslant{#1}}} -\define@key{tikz}{yscale}{\tikz@addtransform{\pgftransformyscale{#1}}} -\define@key{tikz}{yslant}{\tikz@addtransform{\pgftransformyslant{#1}}} -\define@key{tikz}{rotate}{\tikz@addtransform{\pgftransformrotate{#1}}} -\define@key{tikz}{rotate around}{\tikz@addtransform{\tikz@rotatearound{#1}}} +\tikzoption{scale}{\tikz@addtransform{\pgftransformscale{#1}}} +\tikzoption{xscale}{\tikz@addtransform{\pgftransformxscale{#1}}} +\tikzoption{xslant}{\tikz@addtransform{\pgftransformxslant{#1}}} +\tikzoption{yscale}{\tikz@addtransform{\pgftransformyscale{#1}}} +\tikzoption{yslant}{\tikz@addtransform{\pgftransformyslant{#1}}} +\tikzoption{rotate}{\tikz@addtransform{\pgftransformrotate{#1}}} +\tikzoption{rotate around}{\tikz@addtransform{\tikz@rotatearound{#1}}} \def\tikz@rotatearound#1{% \edef\tikz@temp{#1}% get rid of active stuff \expandafter\tikz@rotateparseA\tikz@temp% @@ -169,16 +194,16 @@ \pgf@process{#1}% \pgf@xc=\pgf@x% \pgf@yc=\pgf@y% - \pgftransformshift{\pgfpoint{\pgf@xc}{\pgf@yc}}% + \pgftransformshift{\pgfqpoint{\pgf@xc}{\pgf@yc}}% \pgftransformrotate{\tikz@temp@rot}% - \pgftransformshift{\pgfpoint{-\pgf@xc}{-\pgf@yc}}% + \pgftransformshift{\pgfqpoint{-\pgf@xc}{-\pgf@yc}}% } -\define@key{tikz}{shift}{\tikz@addtransform{\tikz@scan@one@point\pgftransformshift#1\relax}} -\define@key{tikz}{xshift}{\tikz@addtransform{\pgftransformxshift{#1}}} -\define@key{tikz}{yshift}{\tikz@addtransform{\pgftransformyshift{#1}}} -\define@key{tikz}{cm}{\tikz@addtransform{\tikz@parse@cm#1\relax}} -\define@key{tikz}{reset cm}{\tikz@addtransform{\pgftransformreset}} +\tikzoption{shift}{\tikz@addtransform{\tikz@scan@one@point\pgftransformshift#1\relax}} +\tikzoption{xshift}{\tikz@addtransform{\pgftransformxshift{#1}}} +\tikzoption{yshift}{\tikz@addtransform{\pgftransformyshift{#1}}} +\tikzoption{cm}{\tikz@addtransform{\tikz@parse@cm#1\relax}} +\tikzoption{reset cm}{\tikz@addtransform{\pgftransformreset}} \def\tikz@parse@cm#1,#2,#3,#4,{% \def\tikz@p@cm{{#1}{#2}{#3}{#4}}% @@ -190,9 +215,11 @@ % Grid options -\define@key{tikz}{xstep}{\def\tikz@grid@x{#1}} -\define@key{tikz}{ystep}{\def\tikz@grid@y{#1}} -\define@key{tikz}{step}{\def\tikz@grid@x{#1}\def\tikz@grid@y{#1}} +\tikzoption{xstep}{\def\tikz@grid@x{#1}} +\tikzoption{ystep}{\def\tikz@grid@y{#1}} +\tikzoption{step}{\tikz@handle@vec{\tikz@step@point}{\tikz@step@single}#1\relax} +\def\tikz@step@single#1{\def\tikz@grid@x{#1}\def\tikz@grid@y{#1}} +\def\tikz@step@point#1{\pgf@process{#1}\edef\tikz@grid@x{\the\pgf@x}\edef\tikz@grid@y{\the\pgf@y}} \def\tikz@grid@x{1cm} \def\tikz@grid@y{1cm} @@ -205,18 +232,18 @@ \newif\iftikz@mode@clip \newif\iftikz@mode@boundary \newif\iftikz@mode@shade -\let\tikz@mode=\@empty +\let\tikz@mode=\pgf@empty \def\tikz@nonetext{none} -\define@key{tikz}{path only}[]{\let\tikz@mode=\@empty} -\define@key{tikz}{shade}[]{\tikz@addmode{\tikz@mode@shadetrue}} -\define@key{tikz}{fill}[]{% +\tikzoption{path only}[]{\let\tikz@mode=\pgf@empty} +\tikzoption{shade}[]{\tikz@addmode{\tikz@mode@shadetrue}} +\tikzoption{fill}[]{% \def\tikz@temp{#1}% \ifx\tikz@temp\tikz@nonetext% \tikz@addmode{\tikz@mode@fillfalse}% \else% - \ifx\tikz@temp\@empty% + \ifx\tikz@temp\pgf@empty% \else% \tikz@addoption{\pgfsetfillcolor{#1}}% \def\tikz@fillcolor{#1}% @@ -224,12 +251,12 @@ \tikz@addmode{\tikz@mode@filltrue}% \fi% } -\define@key{tikz}{draw}[]{% +\tikzoption{draw}[]{% \def\tikz@temp{#1}% \ifx\tikz@temp\tikz@nonetext% \tikz@addmode{\tikz@mode@drawfalse}% \else% - \ifx\tikz@temp\@empty% + \ifx\tikz@temp\pgf@empty% \else% \tikz@addoption{\pgfsetstrokecolor{#1}}% \def\tikz@strokecolor{#1}% @@ -237,40 +264,59 @@ \tikz@addmode{\tikz@mode@drawtrue}% \fi% } -\define@key{tikz}{clip}[]{\tikz@addmode{\tikz@mode@cliptrue}} -\define@key{tikz}{use as bounding box}[]{\tikz@addmode{\tikz@mode@boundarytrue}} +\tikzoption{clip}[]{\tikz@addmode{\tikz@mode@cliptrue}} +\tikzoption{use as bounding box}[]{\tikz@addmode{\tikz@mode@boundarytrue}} -\define@key{tikz}{save path}{\tikz@addmode{\pgfsyssoftpath@getcurrentpath#1\global\let#1=#1}} +\tikzoption{save path}{\tikz@addmode{\pgfsyssoftpath@getcurrentpath#1\global\let#1=#1}} -\let\tikz@fillcolor=\@empty -\let\tikz@strokecolor=\@empty +\let\tikz@fillcolor=\pgf@empty +\let\tikz@strokecolor=\pgf@empty + + +% Pattern options +\tikzoption{pattern color}{\def\tikz@pattern@color{#1}} +\tikzoption{pattern}[]{% + \def\tikz@temp{#1}% + \ifx\tikz@temp\tikz@nonetext% + \tikz@addmode{\tikz@mode@fillfalse}% + \else% + \ifx\tikz@temp\pgf@empty% + \else% + \tikz@addoption{\pgfsetfillpattern{#1}{\tikz@pattern@color}}% + \def\tikz@pattern{#1}% + \fi% + \tikz@addmode{\tikz@mode@filltrue}% + \fi% +} +\def\tikz@pattern@color{black} +\def\tikz@pattern{dots} % Shading options -\define@key{tikz}{shading}{\def\tikz@shading{#1}\tikz@addmode{\tikz@mode@shadetrue}} -\define@key{tikz}{shading angle}{\def\tikz@shade@angle{#1}\tikz@addmode{\tikz@mode@shadetrue}} -\define@key{tikz}{top color}{% +\tikzoption{shading}{\def\tikz@shading{#1}\tikz@addmode{\tikz@mode@shadetrue}} +\tikzoption{shading angle}{\def\tikz@shade@angle{#1}\tikz@addmode{\tikz@mode@shadetrue}} +\tikzoption{top color}{% \colorlet{tikz@axis@top}{#1}% \colorlet{tikz@axis@middle}{tikz@axis@top!50!tikz@axis@bottom}% \def\tikz@shading{axis}\def\tikz@shade@angle{0}\tikz@addmode{\tikz@mode@shadetrue}} -\define@key{tikz}{bottom color}{% +\tikzoption{bottom color}{% \colorlet{tikz@axis@bottom}{#1}% \colorlet{tikz@axis@middle}{tikz@axis@top!50!tikz@axis@bottom}% \def\tikz@shading{axis}\def\tikz@shade@angle{0}\tikz@addmode{\tikz@mode@shadetrue}} -\define@key{tikz}{middle color}{% +\tikzoption{middle color}{% \colorlet{tikz@axis@middle}{#1}% \def\tikz@shading{axis}\tikz@addmode{\tikz@mode@shadetrue}} -\define@key{tikz}{left color}{% +\tikzoption{left color}{% \colorlet{tikz@axis@top}{#1}% \colorlet{tikz@axis@middle}{tikz@axis@top!50!tikz@axis@bottom}% \def\tikz@shading{axis}\def\tikz@shade@angle{90}\tikz@addmode{\tikz@mode@shadetrue}} -\define@key{tikz}{right color}{% +\tikzoption{right color}{% \colorlet{tikz@axis@bottom}{#1}% \colorlet{tikz@axis@middle}{tikz@axis@top!50!tikz@axis@bottom}% \def\tikz@shading{axis}\def\tikz@shade@angle{90}\tikz@addmode{\tikz@mode@shadetrue}} -\define@key{tikz}{ball color}{\colorlet{tikz@ball}{#1}\def\tikz@shading{ball}\tikz@addmode{\tikz@mode@shadetrue}} -\define@key{tikz}{inner color}{\colorlet{tikz@radial@inner}{#1}\def\tikz@shading{radial}\tikz@addmode{\tikz@mode@shadetrue}} -\define@key{tikz}{outer color}{\colorlet{tikz@radial@outer}{#1}\def\tikz@shading{radial}\tikz@addmode{\tikz@mode@shadetrue}} +\tikzoption{ball color}{\colorlet{tikz@ball}{#1}\def\tikz@shading{ball}\tikz@addmode{\tikz@mode@shadetrue}} +\tikzoption{inner color}{\colorlet{tikz@radial@inner}{#1}\def\tikz@shading{radial}\tikz@addmode{\tikz@mode@shadetrue}} +\tikzoption{outer color}{\colorlet{tikz@radial@outer}{#1}\def\tikz@shading{radial}\tikz@addmode{\tikz@mode@shadetrue}} \def\tikz@shading{axis} \def\tikz@shade@angle{0} @@ -286,7 +332,7 @@ \colorlet{tikz@axis@middle}{gray!50!white} \colorlet{tikz@axis@bottom}{white} -\pgfdeclareradialshading[tikz@ball]{ball}{\pgfpoint{-10bp}{10bp}}{% +\pgfdeclareradialshading[tikz@ball]{ball}{\pgfqpoint{-10bp}{10bp}}{% color(0bp)=(tikz@ball!15!white); color(9bp)=(tikz@ball!75!white); color(18bp)=(tikz@ball!70!black); @@ -304,46 +350,170 @@ \colorlet{tikz@radial@outer}{white} +% Pin options +\tikzoption{pin}{\pgf@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]% +} + +\def\tikz@pin@distance{3ex} +\def\tikz@pin@edge@style{} + +\def\tikz@parse@pin[#1]#2:#3\pgf@nil{% + \tikz@add@after@node@path{\bgroup + \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] + {#3} \egroup} +} + + +% Label and pin options + +\tikzoption{label}{\pgf@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} + +\def\tikz@parse@label[#1]#2:#3\pgf@nil{% + \tikz@add@after@node@path{ + \bgroup + \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]% + {#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}} +\expandafter\def\csname tikz@label@angle@is@above right\endcsname{\def\tikz@label@angle{45}} +\expandafter\def\csname tikz@label@angle@is@above\endcsname{\def\tikz@label@angle{90}} +\expandafter\def\csname tikz@label@angle@is@above left\endcsname{\def\tikz@label@angle{135}} +\expandafter\def\csname tikz@label@angle@is@left\endcsname{\def\tikz@label@angle{180}} +\expandafter\def\csname tikz@label@angle@is@below left\endcsname{\def\tikz@label@angle{225}} +\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{% + \let\tikz@do@auto@anchor=\relax + \c@pgf@counta=#1\relax% + \ifnum\c@pgf@counta<0\relax + \advance\c@pgf@counta by 360\relax% + \fi% + \ifnum\c@pgf@counta>359\relax + \advance\c@pgf@counta by-360\relax% + \fi% + \ifnum\c@pgf@counta<4\relax% + \def\tikz@anchor{west}% + \else\ifnum\c@pgf@counta<87\relax% + \def\tikz@anchor{south west}% + \else\ifnum\c@pgf@counta<94\relax% + \def\tikz@anchor{south}% + \else\ifnum\c@pgf@counta<177\relax% + \def\tikz@anchor{south east}% + \else\ifnum\c@pgf@counta<184\relax% + \def\tikz@anchor{east}% + \else\ifnum\c@pgf@counta<267\relax% + \def\tikz@anchor{north east}% + \else\ifnum\c@pgf@counta<274\relax% + \def\tikz@anchor{north}% + \else\ifnum\c@pgf@counta<357\relax% + \def\tikz@anchor{north west}% + \else% + \def\tikz@anchor{west}% + \fi\fi\fi\fi\fi\fi\fi\fi% + \tikz@addtransform{\pgftransformshift{\pgfpointpolar{#1}{#2}}}% +} % General shape options -\define@key{tikz}{name}{\edef\tikz@fig@name{#1}} +\tikzoption{name}{\edef\tikz@fig@name{#1}} + +\tikzoption{at}{\tikz@scan@one@point\tikz@set@at#1} +\def\tikz@set@at#1{\def\tikz@node@at{#1}}% -\define@key{tikz}{shape}{\edef\tikz@shape{#1}} +\tikzoption{shape}{\edef\tikz@shape{#1}} -\define@key{tikz}{inner sep}{\def\pgfshapeinnerxsep{#1}\def\pgfshapeinnerysep{#1}} -\define@key{tikz}{inner xsep}{\def\pgfshapeinnerxsep{#1}} -\define@key{tikz}{inner ysep}{\def\pgfshapeinnerysep{#1}} +\tikzoption{inner sep}{\def\pgfshapeinnerxsep{#1}\def\pgfshapeinnerysep{#1}} +\tikzoption{inner xsep}{\def\pgfshapeinnerxsep{#1}} +\tikzoption{inner ysep}{\def\pgfshapeinnerysep{#1}} -\define@key{tikz}{outer sep}{\def\pgfshapeouterxsep{#1}\def\pgfshapeouterysep{#1}} -\define@key{tikz}{outer xsep}{\def\pgfshapeouterxsep{#1}} -\define@key{tikz}{outer ysep}{\def\pgfshapeouterysep{#1}} +\tikzoption{outer sep}{\def\pgfshapeouterxsep{#1}\def\pgfshapeouterysep{#1}} +\tikzoption{outer xsep}{\def\pgfshapeouterxsep{#1}} +\tikzoption{outer ysep}{\def\pgfshapeouterysep{#1}} -\define@key{tikz}{minimum width}{\def\pgfshapeminwidth{#1}} -\define@key{tikz}{minimum height}{\def\pgfshapeminheight{#1}} -\define@key{tikz}{minimum size}{\def\pgfshapeminwidth{#1}\def\pgfshapeminheight{#1}} +\tikzoption{minimum width}{\def\pgfshapeminwidth{#1}} +\tikzoption{minimum height}{\def\pgfshapeminheight{#1}} +\tikzoption{minimum size}{\def\pgfshapeminwidth{#1}\def\pgfshapeminheight{#1}} -\define@key{tikz}{anchor}{\def\tikz@anchor{#1}} +\tikzoption{aspect}{\pgfsetshapeaspect{#1}} -\define@key{tikz}{left}[]{\def\tikz@anchor{east}\tikz@possibly@transform{x}{-}{#1}} -\define@key{tikz}{right}[]{\def\tikz@anchor{west}\tikz@possibly@transform{x}{}{#1}} -\define@key{tikz}{above}[]{\def\tikz@anchor{south}\tikz@possibly@transform{y}{}{#1}} -\define@key{tikz}{below}[]{\def\tikz@anchor{north}\tikz@possibly@transform{y}{-}{#1}} -\define@key{tikz}{above left}[]% +\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=\pgf@empty + +\tikzoption{anchor}{\def\tikz@anchor{#1}\let\tikz@do@auto@anchor=\relax} + +\tikzoption{left}[]{\def\tikz@anchor{east}\tikz@possibly@transform{x}{-}{#1}} +\tikzoption{right}[]{\def\tikz@anchor{west}\tikz@possibly@transform{x}{}{#1}} +\tikzoption{above}[]{\def\tikz@anchor{south}\tikz@possibly@transform{y}{}{#1}} +\tikzoption{below}[]{\def\tikz@anchor{north}\tikz@possibly@transform{y}{-}{#1}} +\tikzoption{above left}[]% {\def\tikz@anchor{south east}% \tikz@possibly@transform{x}{-}{#1}\tikz@possibly@transform{y}{}{#1}} -\define@key{tikz}{above right}[]% +\tikzoption{above right}[]% {\def\tikz@anchor{south west}% \tikz@possibly@transform{x}{}{#1}\tikz@possibly@transform{y}{}{#1}} -\define@key{tikz}{below left}[]% +\tikzoption{below left}[]% {\def\tikz@anchor{north east}% \tikz@possibly@transform{x}{-}{#1}\tikz@possibly@transform{y}{-}{#1}} -\define@key{tikz}{below right}[]% +\tikzoption{below right}[]% {\def\tikz@anchor{north west}% \tikz@possibly@transform{x}{}{#1}\tikz@possibly@transform{y}{-}{#1}} -\define@key{tikz}{transform shape}[true]{% +\tikzoption{node distance}{\def\tikz@node@distance{#1}} +\def\tikz@node@distance{1cm} + +\tikzoption{above of}{\tikz@of{#1}{90}}% +\tikzoption{below of}{\tikz@of{#1}{-90}}% +\tikzoption{left of}{\tikz@of{#1}{180}}% +\tikzoption{right of}{\tikz@of{#1}{0}}% +\tikzoption{above left of}{\tikz@of{#1}{135}}% +\tikzoption{below left of}{\tikz@of{#1}{-135}}% +\tikzoption{above right of}{\tikz@of{#1}{45}}% +\tikzoption{below right of}{\tikz@of{#1}{-45}}% + +\def\tikz@of#1#2{% + \def\tikz@anchor{center}% + \let\tikz@do@auto@anchor=\relax% + \tikz@addtransform{\pgftransformshift{\pgfpointpolar{#2}{\tikz@node@distance}}}% + \def\tikz@node@at{\pgfpointanchor{#1}{center}}} + +\tikzoption{transform shape}[true]{% \csname tikz@fullytransformed#1\endcsname% \iftikz@fullytransformed% \pgfresetnontranslationattimefalse% @@ -359,8 +529,9 @@ \def\tikz@shape{rectangle}% \def\tikz@possibly@transform#1#2#3{% + \let\tikz@do@auto@anchor=\relax% \def\tikz@test{#3}% - \ifx\tikz@test\@empty% + \ifx\tikz@test\pgf@empty% \else% \setlength{\pgf@x}{#3}% \pgf@x=#2\pgf@x\relax% @@ -371,45 +542,78 @@ } +% Inter-picture options +\tikzoption{remember picture}[true]{\csname pgfrememberpicturepositiononpage#1\endcsname} +\tikzoption{overlay}[]{\pgf@relevantforpicturesizefalse} + + + % Line/curve label placement options -\define@key{tikz}{sloped}[true]{\csname pgfslopedattime#1\endcsname} +\tikzoption{sloped}[true]{\csname pgfslopedattime#1\endcsname} +\tikzoption{allow upside down}[true]{\csname pgfallowupsidedownattime#1\endcsname} -\define@key{tikz}{pos}{\edef\tikz@time{#1}} +\tikzoption{pos}{\edef\tikz@time{#1}} + +\tikzoption{auto}[]{\csname tikz@install@auto@anchor@#1\endcsname} +\tikzoption{swap}[]{% + \def\tikz@temp{left}% + \ifx\tikz@auto@anchor@direction\tikz@temp% + \def\tikz@auto@anchor@direction{right}% + \else% + \def\tikz@auto@anchor@direction{left}% + \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}} +\def\tikz@install@auto@anchor@right{\let\tikz@do@auto@anchor=\tikz@auto@anchor@on\def\tikz@auto@anchor@direction{right}} +\let\tikz@do@auto@anchor=\relax% + +\def\tikz@auto@anchor@on{\csname tikz@auto@anchor@\tikz@auto@anchor@direction\endcsname} + +\def\tikz@auto@anchor@left{\tikz@auto@pre\tikz@auto@anchor\tikz@auto@post} +\def\tikz@auto@anchor@right{\tikz@auto@pre\tikz@auto@anchor@prime\tikz@auto@post} + +\def\tikz@auto@anchor@direction{left} % Text options -\define@key{tikz}{text}{\def\tikz@textcolor{#1}} -\define@key{tikz}{font}{\def\tikz@textfont{#1}} -\define@key{tikz}{text opacity}{\def\tikz@textopacity{#1}} -\define@key{tikz}{text width}{\def\tikz@text@width{#1}} -\define@key{tikz}{text ragged}[]% +\tikzoption{text}{\def\tikz@textcolor{#1}} +\tikzoption{font}{\def\tikz@textfont{#1}} +\tikzoption{text opacity}{\def\tikz@textopacity{#1}} +\tikzoption{text width}{\def\tikz@text@width{#1}} +\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}} -\define@key{tikz}{text badly ragged}[]{\def\tikz@text@action{\raggedright\relax}} -\define@key{tikz}{text ragged left}[]% +\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}} -\define@key{tikz}{text badly ragged left}[]{\def\tikz@text@action{\raggedleft\relax}} -\define@key{tikz}{text justified}[]{\def\tikz@text@action{\leftskip\z@\rightskip\z@\relax}} -\define@key{tikz}{text centered}[]{\def\tikz@text@action{% +\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 centered}[]{\def\tikz@text@action{% \leftskip\z@ plus2em% \rightskip\z@ plus2em% \spaceskip.3333em \xspaceskip.5em% \parfillskip=0pt% \let\\=\@centercr% for latex \relax}} -\define@key{tikz}{text badly centered}[]% +\tikzoption{text badly centered}[]% {\def\tikz@text@action{% \let\\=\@centercr% for latex \parfillskip=0pt% \rightskip\@flushglue% \leftskip\@flushglue\relax}} -\let\tikz@text@width=\@empty -\let\tikz@textcolor=\@empty -\let\tikz@textfont=\@empty -\let\tikz@textopacity=\@empty +\let\tikz@text@width=\pgf@empty +\let\tikz@text@height=\pgf@empty +\let\tikz@text@depth=\pgf@empty +\let\tikz@textcolor=\pgf@empty +\let\tikz@textfont=\pgf@empty +\let\tikz@textopacity=\pgf@empty \def\tikz@text@action{\raggedright\rightskip\z@ plus2em \spaceskip.3333em \xspaceskip.5em\relax} @@ -418,18 +622,18 @@ % Arrow options -\define@key{tikz}{arrows}{\tikz@processarrows{#1}} +\tikzoption{arrows}{\tikz@processarrows{#1}} -\define@key{tikz}{>}{% +\tikzoption{>}{% \tikz@set@pointed{\csname pgf@arrows@invert#1\endcsname}{#1}% \expandafter\tikz@processarrows\expandafter{\tikz@current@arrows}% } -\define@key{tikz}{shorten <}{\pgfsetshortenstart{#1}} -\define@key{tikz}{shorten >}{\pgfsetshortenend{#1}} +\tikzoption{shorten <}{\pgfsetshortenstart{#1}} +\tikzoption{shorten >}{\pgfsetshortenend{#1}} \def\tikz@set@pointed#1#2{% - \@ifundefined{pgf@arrow@code@tikze@>@#2} + \pgf@ifundefined{pgf@arrow@code@tikze@>@#2} {% \pgfarrowsdeclarealias{tikzs@<@#2}{tikze@>@#2}{#1}{#2}% \pgfarrowsdeclarereversed{tikzs@>@#2}{tikze@<@#2}{#1}{#2}% @@ -437,22 +641,22 @@ \pgfarrowsdeclaredouble[\pgflinewidth]{tikzs@<<@#2}{tikze@>>@#2}{#1}{#2}% \pgfarrowsdeclarereversed{tikzs@>>@#2}{tikze@<<@#2}{tikzs@<<@#2}{tikze@>>@#2}% }{}% - \@namedef{tikz@special@arrow@start<}{tikzs@<@#2}% - \@namedef{tikz@special@arrow@end>}{tikze@>@#2}% - \@namedef{tikz@special@arrow@start>}{tikzs@>@#2}% - \@namedef{tikz@special@arrow@end<}{tikze@<@#2}% - \@namedef{tikz@special@arrow@start|<}{tikz@|<@#2}% - \@namedef{tikz@special@arrow@end>|}{tikz@>|@#2}% - \@namedef{tikz@special@arrow@start<<}{tikzs@<<@#2}% - \@namedef{tikz@special@arrow@end>>}{tikze@>>@#2}% - \@namedef{tikz@special@arrow@start>>}{tikzs@<<@#2}% - \@namedef{tikz@special@arrow@end<<}{tikze@>>@#2}% + \pgf@namedef{tikz@special@arrow@start<}{tikzs@<@#2}% + \pgf@namedef{tikz@special@arrow@end>}{tikze@>@#2}% + \pgf@namedef{tikz@special@arrow@start>}{tikzs@>@#2}% + \pgf@namedef{tikz@special@arrow@end<}{tikze@<@#2}% + \pgf@namedef{tikz@special@arrow@start|<}{tikz@|<@#2}% + \pgf@namedef{tikz@special@arrow@end>|}{tikz@>|@#2}% + \pgf@namedef{tikz@special@arrow@start<<}{tikzs@<<@#2}% + \pgf@namedef{tikz@special@arrow@end>>}{tikze@>>@#2}% + \pgf@namedef{tikz@special@arrow@start>>}{tikzs@<<@#2}% + \pgf@namedef{tikz@special@arrow@end<<}{tikze@>>@#2}% } \def\tikz@processarrows#1{% \def\tikz@current@arrows{#1}% \def\tikz@temp{#1}% - \ifx\tikz@temp\@empty% + \ifx\tikz@temp\pgf@empty% \else% \tikz@@processarrows#1\@nil \fi% @@ -474,9 +678,9 @@ \def\tikz@current@arrows{-} % Parabola options -\define@key{tikz}{bend}{\tikz@scan@one@point\tikz@set@parabola@bend#1\relax}% -\define@key{tikz}{bend pos}{\def\tikz@parabola@bend@factor{#1}} -\define@key{tikz}{parabola height}{% +\tikzoption{bend}{\tikz@scan@one@point\tikz@set@parabola@bend#1\relax}% +\tikzoption{bend pos}{\def\tikz@parabola@bend@factor{#1}} +\tikzoption{parabola height}{% \def\tikz@parabola@bend@factor{.5}% \def\tikz@parabola@bend{\pgfpointadd{\pgfpoint{0pt}{#1}}{\tikz@last@position@saved}}} @@ -486,37 +690,43 @@ \def\tikz@set@parabola@bend#1{\def\tikz@parabola@bend{#1}} % Axis options -\define@key{tikz}{domain}{\def\tikz@plot@domain{#1}} -\define@key{tikz}{range}{\def\tikz@plot@range{#1}} +\tikzoption{domain}{\def\tikz@plot@domain{#1}} +\tikzoption{range}{\def\tikz@plot@range{#1}} % Plot options -\define@key{tikz}{smooth}[]{\let\tikz@plot@handler=\pgfplothandlercurveto} -\define@key{tikz}{smooth cycle}[]{\let\tikz@plot@handler=\pgfplothandlerclosedcurve} -\define@key{tikz}{sharp plot}[]{\let\tikz@plot@handler\pgfplothandlerlineto} +\tikzoption{smooth}[]{\let\tikz@plot@handler=\pgfplothandlercurveto} +\tikzoption{smooth cycle}[]{\let\tikz@plot@handler=\pgfplothandlerclosedcurve} +\tikzoption{sharp plot}[]{\let\tikz@plot@handler\pgfplothandlerlineto} + +\tikzoption{tension}{\pgfsetplottension{#1}} -\define@key{tikz}{tension}{\pgfsetplottension{#1}} +\tikzoption{xcomb}[]{\let\tikz@plot@handler=\pgfplothandlerxcomb} +\tikzoption{ycomb}[]{\let\tikz@plot@handler=\pgfplothandlerycomb} +\tikzoption{polar comb}[]{\let\tikz@plot@handler=\pgfplothandlerpolarcomb} -\define@key{tikz}{xcomb}[]{\let\tikz@plot@handler=\pgfplothandlerxcomb} -\define@key{tikz}{ycomb}[]{\let\tikz@plot@handler=\pgfplothandlerycomb} -\define@key{tikz}{polar comb}[]{\let\tikz@plot@handler=\pgfplothandlerpolarcomb} +\tikzoption{raw gnuplot}[true]{\csname tikz@plot@raw@gnuplot#1\endcsname} +\tikzoption{prefix}{\def\tikz@plot@prefix{#1}} +\tikzoption{id}{\def\tikz@plot@id{#1}} -\define@key{tikz}{raw gnuplot}[true]{\csname tikz@plot@raw@gnuplot#1\endcsname} -\define@key{tikz}{prefix}{\def\tikz@plot@prefix{#1}} -\define@key{tikz}{id}{\def\tikz@plot@id{#1}} +\tikzoption{samples}{\def\tikz@plot@sampels{#1}} +\tikzoption{parametric}[true]{\csname tikz@plot@parametric#1\endcsname} -\define@key{tikz}{samples}{\def\tikz@plot@sampels{#1}} -\define@key{tikz}{parametric}[true]{\csname tikz@plot@parametric#1\endcsname} +\tikzoption{only marks}[]{\let\tikz@plot@handler\pgfplothandlerdiscard} -\define@key{tikz}{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 size}{\pgfsetplotmarksize{#1}} -\define@key{tikz}{mark}{\def\tikz@plot@mark{#1}} -\define@key{tikz}{mark options}{\def\tikz@plot@mark@options{#1}} -\define@key{tikz}{mark size}{\pgfsetplotmarksize{#1}} +\tikzoption{mark indices}{\def\tikz@mark@list{#1}} +\tikzoption{mark phase}{\pgfsetplotmarkphase{#1}} +\tikzoption{mark repeat}{\pgfsetplotmarkrepeat{#1}} -\let\tikz@plot@mark@options=\@empty +\let\tikz@mark@list=\pgf@empty + +\let\tikz@plot@mark@options=\pgf@empty \let\tikz@plot@handler=\pgfplothandlerlineto -\let\tikz@plot@mark=\@empty +\let\tikz@plot@mark=\pgf@empty \def\tikz@plot@sampels{25} \def\tikz@plot@domain{-5:5} @@ -528,18 +738,25 @@ \newif\iftikz@plot@raw@gnuplot +% To options +\tikzoption{to path}{\def\tikz@to@path{#1}} + +\def\tikz@to@path{-- (\tikztotarget) \tikztonodes} + + + % Tree options -\define@key{tikz}{edge from parent path}{\def\tikz@edge@to@parent@path{#1}} +\tikzoption{edge from parent path}{\def\tikz@edge@to@parent@path{#1}} -\define@key{tikz}{parent anchor}{\def\tikzparentanchor{.#1}\ifx\tikzparentanchor\tikz@border@text\let\tikzparentanchor\@empty\fi} -\define@key{tikz}{child anchor}{\def\tikzchildanchor{.#1}\ifx\tikzchildanchor\tikz@border@text\let\tikzchildanchor\@empty\fi} +\tikzoption{parent anchor}{\def\tikzparentanchor{.#1}\ifx\tikzparentanchor\tikz@border@text\let\tikzparentanchor\pgf@empty\fi} +\tikzoption{child anchor}{\def\tikzchildanchor{.#1}\ifx\tikzchildanchor\tikz@border@text\let\tikzchildanchor\pgf@empty\fi} -\define@key{tikz}{level distance}{\setlength\tikzleveldistance{#1}} -\define@key{tikz}{sibling distance}{\setlength\tikzsiblingdistance{#1}} +\tikzoption{level distance}{\setlength\tikzleveldistance{#1}} +\tikzoption{sibling distance}{\setlength\tikzsiblingdistance{#1}} -\define@key{tikz}{growth function}{\let\tikz@grow=#1} -\define@key{tikz}{grow}{\tikz@set@growth{#1}\edef\tikz@special@level{\the\tikztreelevel}}% -\define@key{tikz}{grow'}{\tikz@set@growth{#1}\tikz@swap@growth\edef\tikz@special@level{\the\tikztreelevel}}% +\tikzoption{growth function}{\let\tikz@grow=#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}}% \def\tikz@special@level{-1}% never @@ -566,8 +783,8 @@ } \def\tikz@border@text{.border} -\let\tikzparentanchor=\@empty -\let\tikzchildanchor=\@empty +\let\tikzparentanchor=\pgf@empty +\let\tikzchildanchor=\pgf@empty \def\tikz@edge@to@parent@path{(\tikzparentnode\tikzparentanchor) -- (\tikzchildnode\tikzchildanchor)} \tikzleveldistance=15mm @@ -601,15 +818,15 @@ \fi% } -\setkeys{tikz}{grow=down} +\tikz@orig@setkeys{tikz}{grow=down} % Snake options -\define@key{tikz}{snake}[]{% +\tikzoption{snake}[]{% \def\tikz@@snake{#1}% - \ifx\tikz@@snake\@empty% + \ifx\tikz@@snake\pgf@empty% \tikz@snakedtrue% \else% \ifx\tikz@@snake\tikz@nonetext% @@ -620,83 +837,97 @@ \fi% \fi} -\define@key{tikz}{segment amplitude}{\setlength{\pgfsnakesegmentamplitude}{#1}} -\define@key{tikz}{segment length}{\setlength{\pgfsnakesegmentlength}{#1}} -\define@key{tikz}{segment angle}{\def\pgfsnakesegmentangle{#1}} -\define@key{tikz}{segment aspect}{\def\pgfsnakesegmentaspect{#1}} +\tikzoption{segment amplitude}{\setlength{\pgfsnakesegmentamplitude}{#1}} +\tikzoption{segment length}{\setlength{\pgfsnakesegmentlength}{#1}} +\tikzoption{segment angle}{\def\pgfsnakesegmentangle{#1}} +\tikzoption{segment aspect}{\def\pgfsnakesegmentaspect{#1}} -\define@key{tikz}{segment object length}{\def\pgfsnakesegmentobjectlength{#1}} +\tikzoption{segment object length}{\def\pgfsnakesegmentobjectlength{#1}} -\define@key{tikz}{raise snake}{\def\pgf@snake@raise{\pgftransformyshift{#1}}} -\define@key{tikz}{mirror snake}[true]{% +\tikzoption{raise snake}{\def\pgf@snake@raise{\pgftransformyshift{#1}}} +\tikzoption{mirror snake}[true]{% \csname if#1\endcsname \def\pgf@snake@mirror{\pgftransformyscale{-1}}% \else% - \let\pgf@snake@mirror=\@empty% + \let\pgf@snake@mirror=\pgf@empty% \fi } -\define@key{tikz}{gap before snake}{\def\tikz@presnake{{moveto}{#1}}} -\define@key{tikz}{line before snake}{\def\tikz@presnake{{lineto}{#1}}} +\tikzoption{gap before snake}{\def\tikz@presnake{{moveto}{#1}}} +\tikzoption{line before snake}{\def\tikz@presnake{{lineto}{#1}}} -\define@key{tikz}{gap after snake}{\def\tikz@postsnake{{moveto}{#1}}\def\tikz@mainsnakelength{\pgfsnakeremainingdistance-#1}} -\define@key{tikz}{line after snake}{\def\tikz@postsnake{{lineto}{#1}}\def\tikz@mainsnakelength{\pgfsnakeremainingdistance-#1}} +\tikzoption{gap after snake}{\def\tikz@postsnake{{moveto}{#1}}\def\tikz@mainsnakelength{\pgfsnakeremainingdistance-#1}} +\tikzoption{line after snake}{\def\tikz@postsnake{{lineto}{#1}}\def\tikz@mainsnakelength{\pgfsnakeremainingdistance-#1}} -\define@key{tikz}{gap around snake}{% +\tikzoption{gap around snake}{% \def\tikz@presnake{{moveto}{#1}}% \def\tikz@postsnake{{moveto}{#1}}% \def\tikz@mainsnakelength{\pgfsnakeremainingdistance-#1}% } -\define@key{tikz}{line around snake}{% +\tikzoption{line around snake}{% \def\tikz@presnake{{lineto}{#1}}% \def\tikz@postsnake{{lineto}{#1}}% \def\tikz@mainsnakelength{\pgfsnakeremainingdistance-#1}% } -\let\pgf@snake@mirror=\@empty -\let\pgf@snake@raise=\@empty +\let\pgf@snake@mirror=\pgf@empty +\let\pgf@snake@raise=\pgf@empty \pgfsetsnakesegmenttransformation{\pgf@snake@mirror\pgf@snake@raise} \def\tikz@snake{zigzag} -\let\tikz@presnake=\@empty -\let\tikz@postsnake=\@empty +\let\tikz@presnake=\pgf@empty +\let\tikz@postsnake=\pgf@empty \def\tikz@mainsnakelength{\pgfsnakeremainingdistance} % Execute option -\define@key{tikz}{execute at begin picture}{\expandafter\def\expandafter\tikz@atbegin@picture\expandafter{\tikz@atbegin@picture#1}} -\define@key{tikz}{execute at end picture}{\expandafter\def\expandafter\tikz@atend@picture\expandafter{\tikz@atend@picture#1}} -\define@key{tikz}{execute at begin scope}{\expandafter\def\expandafter\tikz@atbegin@scope\expandafter{\tikz@atbegin@scope#1}} -\define@key{tikz}{execute at end scope}{\expandafter\def\expandafter\tikz@atend@scope\expandafter{\tikz@atend@scope#1}} +\tikzoption{execute at begin picture}{\expandafter\def\expandafter\tikz@atbegin@picture\expandafter{\tikz@atbegin@picture#1}} +\tikzoption{execute at end picture}{\expandafter\def\expandafter\tikz@atend@picture\expandafter{\tikz@atend@picture#1}} +\tikzoption{execute at begin scope}{\expandafter\def\expandafter\tikz@atbegin@scope\expandafter{\tikz@atbegin@scope#1}} +\tikzoption{execute at end scope}{\expandafter\def\expandafter\tikz@atend@scope\expandafter{\tikz@atend@scope#1}} +\tikzoption{execute at begin to}{\expandafter\def\expandafter\tikz@atbegin@to\expandafter{\tikz@atbegin@to#1}} +\tikzoption{execute at end to}{\expandafter\def\expandafter\tikz@atend@to\expandafter{\tikz@atend@to#1}} +\tikzoption{execute at begin node}{\expandafter\def\expandafter\tikz@atbegin@node\expandafter{\tikz@atbegin@node#1}} +\tikzoption{execute at end node}{\expandafter\def\expandafter\tikz@atend@node\expandafter{\tikz@atend@node#1}} -\let\tikz@atbegin@picture=\@empty -\let\tikz@atend@picture=\@empty -\let\tikz@atbegin@scope=\@empty -\let\tikz@atend@scope=\@empty +\let\tikz@atbegin@picture=\pgf@empty +\let\tikz@atend@picture=\pgf@empty +\let\tikz@atbegin@scope=\pgf@empty +\let\tikz@atend@scope=\pgf@empty +\let\tikz@atbegin@to=\pgf@empty +\let\tikz@atend@to=\pgf@empty +\let\tikz@atbegin@node=\pgf@empty +\let\tikz@atend@node=\pgf@empty % Styles -\define@key{tikz}{set style}{\tikzstyle#1} +\tikzoption{set style}{\tikzstyle#1} % Handled in a special way. -\def\tikzstyle#1=#2[#3]{% #2 is dummy - \in@+{#1}% +\def\tikzstyle#1#2=#3[#4]{% #2 and #3 are dummy + \in@+{#2}% \ifin@% - \tikz@style#1{#3}% + \tikz@style{#1}{#4}% \else% - \expandafter\def\csname tikz@st@#1\endcsname{#3}% + \expandafter\def\csname tikz@st@#1\endcsname{#4}% \fi} -\def\tikz@style#1+#2{% - \edef\tikz@marshal{\def\expandafter\noexpand\csname tikz@st@#1\endcsname}% - \expandafter\expandafter\expandafter\tikz@marshal\expandafter\expandafter\expandafter{\csname tikz@st@#1\endcsname,#2}} +\def\tikz@style#1#2{% + \iftikzstyleempty{#1} + {\expandafter\def\csname tikz@st@#1\endcsname{#2}}% + {% + \edef\tikz@marshal{\def\expandafter\noexpand\csname tikz@st@#1\endcsname}% + \expandafter\expandafter\expandafter\tikz@marshal\expandafter\expandafter\expandafter{\csname + tikz@st@#1\endcsname,#2}% + }% +} \def\iftikzstyleempty#1#2#3{% - \expandafter\ifx\csname tikz@st@#1\endcsname\@empty% + \expandafter\ifx\csname tikz@st@#1\endcsname\pgf@empty% \let\pgf@next=\@firstoftwo% \else% \expandafter\ifx\csname tikz@st@#1\endcsname\relax% @@ -708,7 +939,6 @@ \pgf@next{#2}{#3}} - % % % Predefined styles @@ -724,6 +954,11 @@ \tikzstyle{every node}= [] \tikzstyle{every child}= [] \tikzstyle{every child node}= [] +\tikzstyle{every to}= [] +\tikzstyle{every edge}= [draw] +\tikzstyle{every label}= [draw=none,fill=none] +\tikzstyle{every pin}= [draw=none,fill=none] +\tikzstyle{every pin edge}= [help lines] \tikzstyle{ultra thin}= [line width=0.1pt] \tikzstyle{very thin}= [line width=0.2pt] @@ -773,11 +1008,11 @@ % Setting keys % -\let\tikz@late@keys=\@empty% +\let\tikz@late@keys=\pgf@empty% \def\tikz@set@one@key#1{% - \setkeys*{tikz}{#1}% - \ifx\XKV@rm\@empty% + \tikz@orig@setkeys*{tikz}{#1}% + \ifx\XKV@rm\pgf@empty% % fine \else% \expandafter\in@\expandafter!\expandafter{\XKV@rm}% @@ -813,11 +1048,11 @@ \def\tikz@@setkeys#1,#2\pgf@stop{% \def\tikz@key@test{#1}% \def\tikz@key@rest{#2}% - \ifx\tikz@key@test\@empty% + \ifx\tikz@key@test\pgf@empty% \else% - \@ifnextchar s{\tikz@parse@key}{\tikz@parse@key}#1==\pgf@stop% + \pgf@ifnextchar s{\tikz@parse@key}{\tikz@parse@key}#1==\pgf@stop% \fi% - \ifx\tikz@key@rest\@empty% + \ifx\tikz@key@rest\pgf@empty% \else% \expandafter\expandafter\expandafter\tikz@@setkeys\expandafter\tikz@key@rest\expandafter\pgf@stop% \fi% @@ -829,7 +1064,7 @@ \def\tikz@key@test{#1}% \ifx\tikz@key@test\tikz@style@text% % Ok, style! - \@ifundefined{tikz@st@#2}% + \pgf@ifundefined{tikz@st@#2}% {\PackageError{tikz}{Unknown style ``#2}''{}} {% \expandafter\let\expandafter\tikz@temp\expandafter=\csname tikz@st@#2\endcsname% @@ -841,7 +1076,7 @@ \expandafter\ifx\csname tikz@st@#1\endcsname\relax% % Ok, normal! \def\tikz@test{#3}% - \ifx\tikz@test\@empty% + \ifx\tikz@test\pgf@empty% \tikz@set@one@key{#1}% \else% \tikz@set@one@key{#1={#2}}% @@ -872,19 +1107,22 @@ % Main TikZ Environment % -\def\tikzpicture{\@ifnextchar[\tikz@picture{\tikz@picture[]}}%} +\def\tikzpicture{\pgf@ifnextchar[\tikz@picture{\tikz@picture[]}}%} \def\tikz@picture[#1]{% \pgfpicture% - \let\tikz@atbegin@picture=\@empty% - \let\tikz@atend@picture=\@empty% + \let\tikz@atbegin@picture=\pgf@empty% + \let\tikz@atend@picture=\pgf@empty% + \let\tikz@transform=\relax% \tikz@installcommands\scope[style=every picture,#1]% \tikz@atbegin@picture% } \def\endtikzpicture{% \tikz@atend@picture% \global\let\pgf@shift@baseline=\pgf@baseline% + \global\let\pgf@remember@smuggle=\ifpgfrememberpicturepositiononpage% \endscope% \let\pgf@baseline=\pgf@shift@baseline% + \let\ifpgfrememberpicturepositiononpage=\pgf@remember@smuggle% \endpgfpicture} @@ -901,8 +1139,8 @@ % The rectangle \tikz{\draw (0,0) rectangle (1em,1ex)} has width 1em and % height 1ex. -\def\tikz{\@ifnextchar[{\tikz@opt}{\tikz@opt[]}} -\def\tikz@opt[#1]{\@ifnextchar\bgroup{\tikz@[#1]}{\tikz@@[#1]}} +\def\tikz{\pgf@ifnextchar[{\tikz@opt}{\tikz@opt[]}} +\def\tikz@opt[#1]{\pgf@ifnextchar\bgroup{\tikz@[#1]}{\tikz@@[#1]}} \def\tikz@[#1]#2{\tikzpicture[#1]#2\endtikzpicture} \def\tikz@@{% \let\tikz@next=\tikz@collectnormalsemicolon% @@ -921,14 +1159,14 @@ % % Environment for scoping graphic state settings % -\def\tikz@scope@env{\@ifnextchar[\tikz@@scope@env{\tikz@@scope@env[]}} +\def\tikz@scope@env{\pgf@ifnextchar[\tikz@@scope@env{\tikz@@scope@env[]}} \def\tikz@@scope@env[#1]{% \pgfscope% \begingroup% - \let\tikz@atbegin@scope=\@empty% - \let\tikz@atend@scope=\@empty% - \let\tikz@options=\@empty% - \let\tikz@mode=\@empty% + \let\tikz@atbegin@scope=\pgf@empty% + \let\tikz@atend@scope=\pgf@empty% + \let\tikz@options=\pgf@empty% + \let\tikz@mode=\pgf@empty% \tikz@every@style{every scope}% \tikz@setkeys{#1}% \tikz@options% @@ -950,9 +1188,12 @@ \ifnum\the\catcode`\|=\active\relax\expandafter\let\expandafter\tikz@origbar\expandafter=\tikz@activebar\fi% \let\tikz@origscope=\scope% \let\tikz@origendscope=\endscope% + \let\tikz@origstartscope=\startscope% + \let\tikz@origstopscope=\stopscope% \let\tikz@origpath=\path% \let\tikz@origagainpath=\againpath% \let\tikz@origdraw=\draw% + \let\tikz@origpattern=\pattern% \let\tikz@origfill=\fill% \let\tikz@origfilldraw=\filldraw% \let\tikz@origshade=\shade% @@ -960,16 +1201,19 @@ \let\tikz@origclip=\clip% \let\tikz@origuseasboundingbox=\useasboundingbox% \let\tikz@orignode=\node% - \let\tikz@orignode=\coordiante% + \let\tikz@origcoordinate=\coordinate% % \tikz@deactivatthings% % \let\scope=\tikz@scope@env% \let\endscope=\endtikz@scope@env% + \let\startscope=\scope% + \let\stopscope=\endscope% \let\path=\tikz@command@path% \let\againpath=\tikz@command@againpath% % \def\draw{\path[draw]} + \def\pattern{\path[pattern]} \def\fill{\path[fill]} \def\filldraw{\path[fill,draw]} \def\shade{\path[shade]} @@ -986,9 +1230,12 @@ \ifnum\the\catcode`\|=\active\relax\expandafter\let\tikz@activebar=\tikz@origbar\fi% \let\scope=\tikz@origscope% \let\endscope=\tikz@origendscope% + \let\startscope=\tikz@origstartscope% + \let\stopscope=\tikz@origstopscope% \let\path=\tikz@origpath% \let\againpath=\tikz@origagainpath% \let\draw=\tikz@origdraw% + \let\pattern=\tikz@origpattern% \let\fill=\tikz@origfill% \let\filldraw=\tikz@origfilldraw% \let\shade=\tikz@origshade% @@ -996,6 +1243,7 @@ \let\clip=\tikz@origclip% \let\useasboundingbox=\tikz@origuseasboundingbox% \let\node=\tikz@orignode% + \let\coordinate=\tikz@origcoordinate% } @@ -1029,10 +1277,10 @@ % settings. \def\tikz@command@path{% - \@ifnextchar[{\tikz@check@earg}%] - {\@ifnextchar<{\tikz@doopt}{\tikz@@command@path}}} + \pgf@ifnextchar[{\tikz@check@earg}%] + {\pgf@ifnextchar<{\tikz@doopt}{\tikz@@command@path}}} \def\tikz@check@earg[#1]{% - \@ifnextchar<{\tikz@swap@args[#1]}{\tikz@@command@path[#1]}} + \pgf@ifnextchar<{\tikz@swap@args[#1]}{\tikz@@command@path[#1]}} \def\tikz@swap@args[#1]<#2>{\tikz@command@path<#2>[#1]} \def\tikz@doopt{% @@ -1050,11 +1298,11 @@ \def\tikz@@command@path{% \edef\tikzscope@linewidth{\the\pgflinewidth}% \begingroup% - \let\tikz@options=\@empty% - \let\tikz@mode=\@empty% + \let\tikz@options=\pgf@empty% + \let\tikz@mode=\pgf@empty% \let\tikz@moveto@waiting=\relax% \let\tikz@timer=\relax% - \let\tikz@collected@onpath=\@empty% + \let\tikz@collected@onpath=\pgf@empty% \tikz@snakedfalse% \tikz@node@is@a@labelfalse% \tikz@expandcount=1000\relax% @@ -1066,7 +1314,7 @@ \tikz@scan@next@command% } \def\tikz@scan@next@command{% - \ifx\tikz@collected@onpath\@empty% + \ifx\tikz@collected@onpath\pgf@empty% \else% \tikz@invoke@collected@onpath% \fi% @@ -1129,17 +1377,21 @@ \let\@next=\tikz@pchar% \pgfsetmovetofirstplotpoint% \else% - \ifx\@let@token\pgfextra% - \let\@next=\tikz@extra% + \ifx\@let@token t% + \let\@next=\tikz@to% \else% - \ifx\@let@token\foreach% - \let\@next=\tikz@foreach% + \ifx\@let@token\pgfextra% + \let\@next=\tikz@extra% \else% - \ifx\@let@token\pgf@stop% - \let\@next=\relax% + \ifx\@let@token\foreach% + \let\@next=\tikz@foreach% \else% - \ifx\@let@token\par% - \let\@next=\tikz@scan@next@command% + \ifx\@let@token\pgf@stop% + \let\@next=\relax% + \else% + \ifx\@let@token\par% + \let\@next=\tikz@scan@next@command% + \fi% \fi% \fi% \fi% @@ -1164,14 +1416,16 @@ \@next% } -\def\tikz@pchar{\@ifnextchar l{\tikz@plot}{\tikz@parabola}} +\def\tikz@pchar{\pgf@ifnextchar l{\tikz@plot}{\tikz@parabola}} \def\tikz@cchar{% - \@ifnextchar i{\tikz@circle}% - {\@ifnextchar h{\tikz@children}{\tikz@cochar}}}% + \pgf@ifnextchar i{\tikz@circle}% + {\pgf@ifnextchar h{\tikz@children}{\tikz@cochar}}}% \def\tikz@cochar o{% - \@ifnextchar o{\tikz@coordinate}{\tikz@cosine}} + \pgf@ifnextchar o{\tikz@coordinate}{\tikz@cosine}} \def\tikz@e@char{% - \@ifnextchar l{\tikz@ellipse}{\tikz@edgetoparent}} + \pgf@ifnextchar l{\tikz@ellipse}{\tikz@@e@char}}% +\def\tikz@@e@char dge{% + \pgf@ifnextchar f{\tikz@edgetoparent}{\tikz@edge@plain}}% \def\tikz@finish{% @@ -1181,15 +1435,15 @@ \tikz@mode@clipfalse% \tikz@mode@boundaryfalse% \edef\tikz@pathextend{% - {\noexpand\pgfpoint{\the\pgf@pathminx}{\the\pgf@pathminy}}% - {\noexpand\pgfpoint{\the\pgf@pathmaxx}{\the\pgf@pathmaxy}}% + {\noexpand\pgfqpoint{\the\pgf@pathminx}{\the\pgf@pathminy}}% + {\noexpand\pgfqpoint{\the\pgf@pathmaxx}{\the\pgf@pathmaxy}}% }% \tikz@mode% installs the mode settings % Rendering pipeline: % % Step 1: Setup options % - \ifx\tikz@options\@empty% + \ifx\tikz@options\pgf@empty% \else% \pgfsys@beginscope% \begingroup% @@ -1263,7 +1517,7 @@ % % Step 8: Close option brace % - \ifx\tikz@options\@empty% + \ifx\tikz@options\pgf@empty% \else% \endgroup% \pgfsys@endscope% @@ -1313,8 +1567,12 @@ % Syntax for pgfextra: % \pgfextra {normal tex text} +% \pgfextra normal tex text \endpgfextra + +\def\tikz@extra{\pgf@ifnextchar\bgroup\tikz@@extra\relax} +\long\def\tikz@@extra#1{#1\tikz@scan@next@command} +\let\endpgfextra=\tikz@scan@next@command -\long\def\tikz@extra#1{#1\tikz@scan@next@command} \def\pgfextra{pgfextra} @@ -1327,7 +1585,7 @@ \def\tikz@foreach{% \def\pgffor@beginhook{\setbox\tikz@figbox=\box\tikz@tempbox\expandafter\tikz@scan@next@command\@firstofone}% - \def\pgffor@endhook{\pgfextra{\global\setbox\tikz@tempbox=\copy\tikz@figbox\@gobble}}% + \def\pgffor@endhook{\pgfextra{\global\setbox\tikz@tempbox=\copy\tikz@figbox\pgf@gobble}}% \def\pgffor@afterhook{\setbox\tikz@figbox=\box\tikz@tempbox\tikz@scan@next@command}% \global\setbox\tikz@tempbox=\copy\tikz@figbox% \foreach} @@ -1338,7 +1596,7 @@ \def\tikz@command@againpath#1{% \pgfextra{% \pgfsyssoftpath@getcurrentpath\tikz@temp% - \expandafter\g@addto@macro\expandafter\tikz@temp\expandafter{#1}% + \expandafter\pgf@g@addto@macro\expandafter\tikz@temp\expandafter{#1}% \pgfsyssoftpath@setcurrentpath\tikz@temp% } } @@ -1395,8 +1653,8 @@ \pgf@process{\pgfpointshapeborder{\tikz@moveto@waiting}{#1}}% #2=\pgf@x% #3=\pgf@y% - \edef\tikz@timer@start{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% - \pgfpathmoveto{\pgfpoint{\pgf@x}{\pgf@y}}% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \pgfpathmoveto{\pgfqpoint{\pgf@x}{\pgf@y}}% \fi% \let\tikz@moveto@waiting=\relax% } @@ -1407,9 +1665,9 @@ % \def\tikz@collect@coordinate@onpath#1coordinate{% - \@ifnextchar[{\tikz@@collect@coordinate@opt#1}{\tikz@@collect@coordinate@opt#1[]}}%} + \pgf@ifnextchar[{\tikz@@collect@coordinate@opt#1}{\tikz@@collect@coordinate@opt#1[]}}%} \def\tikz@@collect@coordinate@opt#1[#2]{% - \@ifnextchar({\tikz@@collect@coordinate#1[#2]}{% + \pgf@ifnextchar({\tikz@@collect@coordinate#1[#2]}{% \tikz@collect@label@onpath#1node[shape=coordinate,#2]{}}}%} \def\tikz@@collect@coordinate#1[#2](#3){% \tikz@collect@label@onpath#1node[shape=coordinate,#2](#3){}} @@ -1419,9 +1677,9 @@ \tikz@collect@label@scan#1} \def\tikz@collect@label@scan#1{% - \@ifnextchar({\tikz@collect@paran#1}% - {\@ifnextchar[{\tikz@collect@options#1}% - {\@ifnextchar\bgroup{\tikz@collect@arg#1}% + \pgf@ifnextchar({\tikz@collect@paran#1}% + {\pgf@ifnextchar[{\tikz@collect@options#1}% + {\pgf@ifnextchar\bgroup{\tikz@collect@arg#1}% {#1}}}% }%}} @@ -1442,7 +1700,7 @@ \def\tikz@invoke@collected@onpath{% \tikz@node@is@a@labeltrue% \let\tikz@temp=\tikz@collected@onpath% - \let\tikz@collected@onpath=\@empty% + \let\tikz@collected@onpath=\pgf@empty% \expandafter\tikz@scan@next@command\tikz@temp\pgf@stop% \tikz@node@is@a@labelfalse% } @@ -1454,26 +1712,26 @@ % -- <point> \def\tikz@lineto{% - \@ifnextchar |% - {\expandafter\tikz@hv@lineto\@gobble}% - {\expandafter\@ifnextchar\tikz@activebar{\expandafter\tikz@hv@lineto\@gobble}% - {\expandafter\tikz@lineto@mid\@gobble}}} + \pgf@ifnextchar |% + {\expandafter\tikz@hv@lineto\pgf@gobble}% + {\expandafter\pgf@ifnextchar\tikz@activebar{\expandafter\tikz@hv@lineto\pgf@gobble}% + {\expandafter\tikz@lineto@mid\pgf@gobble}}} \def\tikz@lineto@mid{% - \@ifnextchar n{\tikz@collect@label@onpath\tikz@lineto@mid}% + \pgf@ifnextchar n{\tikz@collect@label@onpath\tikz@lineto@mid}% {% - \@ifnextchar c{\tikz@close}{% - \@ifnextchar p{\pgfsetlinetofirstplotpoint\expandafter\tikz@plot\@gobble}% + \pgf@ifnextchar c{\tikz@close}{% + \pgf@ifnextchar p{\pgfsetlinetofirstplotpoint\expandafter\tikz@plot\pgf@gobble}% {\tikz@scan@one@point{\tikz@@lineto}}}}} \def\tikz@@lineto#1{% % Record the starting point for later labels on the path: - \edef\tikz@timer@start{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}} + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}} \iftikz@shapeborder% % ok, target is a shape. recalculate end \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\tikz@last@position}}% - \tikz@make@last@position{\pgfpoint{\pgf@x}{\pgf@y}}% + \tikz@make@last@position{\pgfqpoint{\pgf@x}{\pgf@y}}% \tikz@flush@moveto@toward{\tikz@last@position}\pgf@x\pgf@y% \tikz@path@lineto{\tikz@last@position}% - \edef\tikz@timer@end{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% \tikz@make@last@position{#1}% \edef\tikz@moveto@waiting{\tikz@shapeborder@name}% \else% @@ -1482,7 +1740,7 @@ \tikz@make@last@position{#1}% \tikz@flush@moveto@toward{\tikz@last@position}\pgf@x\pgf@y% \tikz@path@lineto{\tikz@last@position}% - \edef\tikz@timer@end{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% \fi% \let\tikz@timer=\tikz@timer@line% \tikz@scan@next@command% @@ -1500,7 +1758,10 @@ % snake or lineto? \def\tikz@path@close#1{% \iftikz@snaked% - \pgfpathsnakesto{\tikz@presnake,{\tikz@snake}{\tikz@mainsnakelength},\tikz@postsnake}{#1}% + {% + \pgftransformreset% + \pgfpathsnakesto{\tikz@presnake,{\tikz@snake}{\tikz@mainsnakelength},\tikz@postsnake}{#1}% + }% \pgfpathclose% \else% \pgfpathclose% @@ -1512,30 +1773,30 @@ % -| <point> \def\tikz@hv@lineto{% - \@ifnextchar n + \pgf@ifnextchar n {\tikz@collect@label@onpath\tikz@hv@lineto} - {\@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@hv@lineto}% + {\pgf@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@hv@lineto}% {\tikz@scan@one@point{\tikz@@hv@lineto}}}} \def\tikz@@hv@lineto#1{% - \edef\tikz@timer@start{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% \pgf@yc=\tikz@lasty% \tikz@make@last@position{#1}% - \tikz@flush@moveto@toward{\pgfpoint{\tikz@lastx}{\pgf@yc}}\pgf@x\pgf@yc% + \tikz@flush@moveto@toward{\pgfqpoint{\tikz@lastx}{\pgf@yc}}\pgf@x\pgf@yc% \iftikz@shapeborder% % ok, target is a shape. have to work now: {% - \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfpoint{\tikz@lastx}{\pgf@yc}}}% - \tikz@make@last@position{\pgfpoint{\pgf@x}{\pgf@y}}% - \tikz@path@lineto{\pgfpoint{\tikz@lastx}{\pgf@yc}}% + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\tikz@lastx}{\pgf@yc}}}% + \tikz@make@last@position{\pgfqpoint{\pgf@x}{\pgf@y}}% + \tikz@path@lineto{\pgfqpoint{\tikz@lastx}{\pgf@yc}}% \tikz@path@lineto{\tikz@last@position}% - \xdef\tikz@timer@end@temp{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% move out of group + \xdef\tikz@timer@end@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% move out of group }% \let\tikz@timer@end=\tikz@timer@end@temp% \edef\tikz@moveto@waiting{\tikz@shapeborder@name}% \else% - \tikz@path@lineto{\pgfpoint{\tikz@lastx}{\pgf@yc}}% + \tikz@path@lineto{\pgfqpoint{\tikz@lastx}{\pgf@yc}}% \tikz@path@lineto{\tikz@last@position}% - \edef\tikz@timer@end{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% move out of group + \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% move out of group \fi% \let\tikz@timer=\tikz@timer@hvline% \tikz@scan@next@command% @@ -1546,30 +1807,30 @@ \def\tikz@vh@lineto-{\tikz@vh@lineto@next} \def\tikz@vh@lineto@next{% - \@ifnextchar n + \pgf@ifnextchar n {\tikz@collect@label@onpath\tikz@vh@lineto@next} - {\@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@vh@lineto@next}% + {\pgf@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@vh@lineto@next}% {\tikz@scan@one@point\tikz@@vh@lineto}}} \def\tikz@@vh@lineto#1{% - \edef\tikz@timer@start{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% \pgf@xc=\tikz@lastx% \tikz@make@last@position{#1}% - \tikz@flush@moveto@toward{\pgfpoint{\pgf@xc}{\tikz@lasty}}\pgf@xc\pgf@y% + \tikz@flush@moveto@toward{\pgfqpoint{\pgf@xc}{\tikz@lasty}}\pgf@xc\pgf@y% \iftikz@shapeborder% % ok, target is a shape. have to work now: {% - \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfpoint{\pgf@xc}{\tikz@lasty}}}% - \tikz@make@last@position{\pgfpoint{\pgf@x}{\pgf@y}}% - \tikz@path@lineto{\pgfpoint{\pgf@xc}{\tikz@lasty}}% + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfqpoint{\pgf@xc}{\tikz@lasty}}}% + \tikz@make@last@position{\pgfqpoint{\pgf@x}{\pgf@y}}% + \tikz@path@lineto{\pgfqpoint{\pgf@xc}{\tikz@lasty}}% \tikz@path@lineto{\tikz@last@position}% - \xdef\tikz@timer@end@temp{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% move out of group + \xdef\tikz@timer@end@temp{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% move out of group }% \let\tikz@timer@end=\tikz@timer@end@temp% \edef\tikz@moveto@waiting{\tikz@shapeborder@name}% \else% - \tikz@path@lineto{\pgfpoint{\pgf@xc}{\tikz@lasty}}% + \tikz@path@lineto{\pgfqpoint{\pgf@xc}{\tikz@lasty}}% \tikz@path@lineto{\tikz@last@position}% - \edef\tikz@timer@end{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% \fi% \let\tikz@timer=\tikz@timer@vhline% \tikz@scan@next@command% @@ -1578,7 +1839,7 @@ % Syntax for cycle: % -- cycle \def\tikz@close c{% - \@ifnextchar o{\tikz@collect@coordinate@onpath\tikz@lineto@mid c}% oops, a coordinate + \pgf@ifnextchar o{\tikz@collect@coordinate@onpath\tikz@lineto@mid c}% oops, a coordinate {\tikz@@close c}}% \def\tikz@@close cycle{% \tikz@flush@moveto% @@ -1596,13 +1857,100 @@ \tikz@scan@next@command% } +% Syntax for edges: +% edge [options] (coordinate) +% edge [options] node {node text} (coordinate) +\def\tikz@edge@plain{% + \begingroup% + \tikz@to@use@whom% + \let\tikz@to@or@edge@function=\tikz@do@edge% + \tikz@to@or@edge} + +% Syntax for to paths: +% to [options] (coordinate) +% to [options] node {node text} (coordinate) +\def\tikz@to o{% + \tikz@to@use@last@coordinate% + \let\tikz@to@or@edge@function=\tikz@do@to% + \tikz@to@or@edge} + +\def\tikz@to@or@edge{\pgf@ifnextchar[\tikz@@to@or@edge{\tikz@@to@or@edge[]}}%} +\def\tikz@@to@or@edge[#1]{% + \def\tikz@@to@local@options{[#1]}% + \let\tikz@collected@onpath=\pgf@empty% + \tikz@@to@collect% +} +\def\tikz@@to@collect{% + \pgf@ifnextchar(\tikz@@to@or@edge@coordinate + {\pgf@ifnextchar n{\tikz@collect@label@onpath\tikz@@to@collect}% + {\pgf@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@@to@collect} + {\PackageError{tikz}{( expected}{}%} + \tikz@@to@or@edge@coordinate()}}}% +} + +\def\tikz@@to@or@edge@coordinate(#1){% + \def\tikztotarget{#1}% + \tikz@to@or@edge@function% +} + +\def\tikz@do@edge{% + \setbox\tikz@figbox=\hbox\bgroup% + \unhbox\tikz@figbox% + \hbox\bgroup + \bgroup% + \pgfinterruptpath% + \pgfscope% + \let\tikz@transform=\pgf@empty% + \let\tikz@options=\pgf@empty% + \let\tikz@tonodes=\tikz@collected@onpath% + \def\tikztonodes{{\pgfextra{\tikz@node@is@a@labeltrue}\tikz@tonodes}}% + \let\tikz@collected@onpath=\pgf@empty% + \tikz@options% + \tikz@transform% + % Typeset node: + \tikz@atbegin@to% + \path[style=every edge]\tikz@@to@local@options(\tikztostart)\tikz@to@path;% + \tikz@atend@to% + \endpgfscope% + \endpgfinterruptpath% + \egroup + \egroup% + \egroup% + \global\setbox\tikz@tempbox=\copy\tikz@figbox% + \endgroup% + \setbox\tikz@figbox=\box\tikz@tempbox% + \tikz@scan@next@command% +} + +\def\tikz@do@to{% + \let\tikz@tonodes=\tikz@collected@onpath% + \def\tikztonodes{{\pgfextra{\tikz@node@is@a@labeltrue}\tikz@tonodes}}% + \let\tikz@collected@onpath=\pgf@empty% + \tikz@scan@next@command% + \pgfextra{\tikz@atbegin@to}% + [style=every to]\tikz@@to@local@options\tikz@to@path% + \pgfextra{\tikz@atend@to}% +} + + +\def\tikz@to@use@last@coordinate{% + \iftikz@shapeborder% + \edef\tikztostart{\tikz@shapeborder@name}% + \else% + \edef\tikztostart{\the\tikz@lastx,\the\tikz@lasty}% + \fi% +} +\def\tikz@to@use@last@fig@name{% + \edef\tikztostart{\tikz@to@last@fig@name}% +} + % Syntax for edge from parent: % edge from parent [options] -\def\tikz@edgetoparent dge from parent{\@ifnextchar[\tikz@@edgetoparent{\tikz@@edgetoparent[]}}%} +\def\tikz@edgetoparent from parent{\pgf@ifnextchar[\tikz@@edgetoparent{\tikz@@edgetoparent[]}}%} \def\tikz@@edgetoparent[#1]{% - \let\tikz@edge@to@parent@needed=\@empty% + \let\tikz@edge@to@parent@needed=\pgf@empty% \tikz@node@is@a@labeltrue% \tikz@scan@next@command [style=edge from parent,#1] \tikz@edge@to@parent@path% } @@ -1615,23 +1963,23 @@ \def\tikz@dot.{\tikz@@dot}% \def\tikz@@dot{% - \@ifnextchar n% + \pgf@ifnextchar n% {\tikz@collect@label@onpath\tikz@@dot}% - {\@ifnextchar c{\tikz@curveto@double}{\tikz@curveto@auto}}} + {\pgf@ifnextchar c{\tikz@curveto@double}{\tikz@curveto@auto}}} \def\tikz@curveto@double co{% - \@ifnextchar o{\tikz@collect@coordinate@onpath\tikz@@dot co} + \pgf@ifnextchar o{\tikz@collect@coordinate@onpath\tikz@@dot co} {\tikz@cureveto@@double}} \def\tikz@cureveto@@double ntrols#1{% \tikz@scan@one@point\tikz@curveA#1% } \def\tikz@curveA#1{% - \edef\tikz@timer@start{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% {% \tikz@make@last@position{#1}% - \xdef\tikz@curve@first{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \xdef\tikz@curve@first{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% }% - \@ifnextchar a + \pgf@ifnextchar a {\tikz@curveBand}% {\let\tikz@curve@second\tikz@curve@first\tikz@curveCdots}% } @@ -1652,19 +2000,19 @@ \tikz@curveCcheck% } \def\tikz@curveCcheck{% - \@ifnextchar n% + \pgf@ifnextchar n% {\tikz@collect@label@onpath\tikz@curveCcheck} - {\@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@curveCcheck} + {\pgf@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@curveCcheck} {\tikz@scan@one@point\tikz@curveC}}% } \def\tikz@curveC#1{% \tikz@make@last@position{#1}% - \edef\tikz@curve@third{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \edef\tikz@curve@third{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% {% \tikz@lastxsaved=\tikz@lastx% \tikz@lastysaved=\tikz@lasty% \tikz@make@last@position{\tikz@curve@second}% - \xdef\tikz@curve@second{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \xdef\tikz@curve@second{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% }% % % Start recalculating things in case start and end are shapes. @@ -1673,8 +2021,8 @@ \ifx\tikz@moveto@waiting\relax% \else% \pgf@process{\pgfpointshapeborder{\tikz@moveto@waiting}{\tikz@curve@first}}% - \edef\tikz@timer@start{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% - \pgfpathmoveto{\pgfpoint{\pgf@x}{\pgf@y}}% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \pgfpathmoveto{\pgfqpoint{\pgf@x}{\pgf@y}}% \fi% \let\tikz@timer@cont@one=\tikz@curve@first% \let\tikz@timer@cont@two=\tikz@curve@second% @@ -1683,8 +2031,8 @@ % ok, target is a shape. recalculate third {% \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\tikz@curve@second}}% - \tikz@make@last@position{\pgfpoint{\pgf@x}{\pgf@y}}% - \edef\tikz@curve@third{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \tikz@make@last@position{\pgfqpoint{\pgf@x}{\pgf@y}}% + \edef\tikz@curve@third{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% \pgfpathcurveto{\tikz@curve@first}{\tikz@curve@second}{\tikz@curve@third}% \global\let\tikz@timer@end@temp=\tikz@curve@third% move out of group }% @@ -1704,26 +2052,26 @@ % rectangle <corner point> \def\tikz@rect ectangle{% \tikz@flush@moveto% - \edef\tikz@timer@start{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \edef\tikz@timer@start{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% \tikz@@rect}% \def\tikz@@rect{% - \@ifnextchar n + \pgf@ifnextchar n {\tikz@collect@label@onpath\tikz@@rect} - {\@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@@rect}% + {\pgf@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@@rect}% { \pgf@xa=\tikz@lastx\relax% \pgf@ya=\tikz@lasty\relax% \tikz@scan@one@point\tikz@rectB}}} \def\tikz@rectB#1{% \tikz@make@last@position{#1}% - \edef\tikz@timer@end{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \edef\tikz@timer@end{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% \let\tikz@timer=\tikz@timer@line% - \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}}% - \tikz@path@lineto{\pgfpoint{\pgf@xa}{\tikz@lasty}}% - \tikz@path@lineto{\pgfpoint{\tikz@lastx}{\tikz@lasty}}% - \tikz@path@lineto{\pgfpoint{\tikz@lastx}{\pgf@ya}}% - \tikz@path@close{\pgfpoint{\pgf@xa}{\pgf@ya}}% - \pgfpathmoveto{\pgfpoint{\tikz@lastx}{\tikz@lasty}}% + \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% + \tikz@path@lineto{\pgfqpoint{\pgf@xa}{\tikz@lasty}}% + \tikz@path@lineto{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}% + \tikz@path@lineto{\pgfqpoint{\tikz@lastx}{\pgf@ya}}% + \tikz@path@close{\pgfqpoint{\pgf@xa}{\pgf@ya}}% + \pgfpathmoveto{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}% \def\pgfstrokehook{}% \tikz@scan@next@command% } @@ -1736,11 +2084,33 @@ \tikz@flush@moveto% \pgf@xa=\tikz@lastx\relax% \pgf@ya=\tikz@lasty\relax% + \pgf@ifnextchar[{\tikz@gridA}{\tikz@gridA[]}}%} +\def\tikz@gridA[#1]{% + \def\tikz@grid@options{#1}% \tikz@scan@one@point\tikz@gridB}% \def\tikz@gridB#1{% \tikz@make@last@position{#1}% - \pgfpathgrid[stepx=\tikz@grid@x,stepy=\tikz@grid@y]% - {\pgfpoint{\pgf@xa}{\pgf@ya}}{\pgfpoint{\tikz@lastx}{\tikz@lasty}}% + {% + \expandafter\tikz@setkeys\expandafter{\tikz@grid@options} + \tikz@checkunit{\tikz@grid@x}% + \iftikz@isdimension% + \pgf@process{\pgfpoint{\tikz@grid@x}{0pt}}% + \else% + \pgf@process{\pgfpointxy{\tikz@grid@x}{0}}% + \fi% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \tikz@checkunit{\tikz@grid@y}% + \iftikz@isdimension% + \pgf@process{\pgfpoint{0pt}{\tikz@grid@y}}% + \else% + \pgf@process{\pgfpointxy{0}{\tikz@grid@y}}% + \fi% + \advance\pgf@xb by\pgf@x% + \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% } @@ -1751,29 +2121,29 @@ % -- plot [local options] ... % starts with a lineto \def\tikz@plot lot{% \tikz@flush@moveto% - \@ifnextchar[{\tikz@@plot}{\tikz@@plot[]}}%} + \pgf@ifnextchar[{\tikz@@plot}{\tikz@@plot[]}}%} \def\tikz@@plot[#1]{% \begingroup% - \let\tikz@options=\@empty% + \let\tikz@options=\pgf@empty% \tikz@every@style{every plot}% \tikz@setkeys{#1}% - \@ifnextchar f{\tikz@plot@f}% - {\@ifnextchar c{\tikz@plot@scan@points}% + \pgf@ifnextchar f{\tikz@plot@f}% + {\pgf@ifnextchar c{\tikz@plot@scan@points}% {\PackageError{tikz}{Cannot parse this plotting data}{}% \endgroup}}} -\def\tikz@plot@f f{\@ifnextchar i{\tikz@plot@file}{\tikz@plot@function}} +\def\tikz@plot@f f{\pgf@ifnextchar i{\tikz@plot@file}{\tikz@plot@function}} \def\tikz@plot@file ile#1{\def\tikz@plot@data{\pgfplotxyfile{#1}}\tikz@@@plot}% \def\tikz@plot@scan@points coordinates#1{% \pgfplothandlerrecord\tikz@plot@data% \pgfplotstreamstart% - \@ifnextchar\pgf@stop{\pgfplotstreamend\expandafter\tikz@@@plot\@gobble} + \pgf@ifnextchar\pgf@stop{\pgfplotstreamend\expandafter\tikz@@@plot\pgf@gobble} {\tikz@scan@one@point\tikz@plot@next@point}% #1\pgf@stop% } \def\tikz@plot@next@point#1{% \pgfplotstreampoint{#1}% - \@ifnextchar\pgf@stop{\pgfplotstreamend\expandafter\tikz@@@plot\@gobble}% + \pgf@ifnextchar\pgf@stop{\pgfplotstreamend\expandafter\tikz@@@plot\pgf@gobble}% {\tikz@scan@one@point\tikz@plot@next@point}% } \def\tikz@plot@function unction#1{% @@ -1807,7 +2177,7 @@ \tikz@plot@handler% \tikz@plot@data% \global\let\tikz@@@temp=\pgfplotlastpoint% - \ifx\tikz@plot@mark\@empty% + \ifx\tikz@plot@mark\pgf@empty% \else% % Marks are drawn after the path. \setbox\tikz@figbox=\hbox{% @@ -1815,11 +2185,15 @@ \hbox{{% \pgfinterruptpath% \pgfscope% - \let\tikz@options=\@empty% - \let\tikz@transform=\@empty% + \let\tikz@options=\pgf@empty% + \let\tikz@transform=\pgf@empty% \expandafter\tikz@setkeys\expandafter{\tikz@plot@mark@options}% \tikz@options% - \pgfplothandlermark{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}}% + \ifx\tikz@mark@list\pgf@empty% + \pgfplothandlermark{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}}% + \else + \pgfplothandlermarklisted{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}}{\tikz@mark@list}% + \fi \tikz@plot@data% \endpgfscope \endpgfinterruptpath% @@ -1858,7 +2232,7 @@ \tikz@lastxsaved=\tikz@lastx% \tikz@lastysaved=\tikz@lasty% \tikz@updatecurrenttrue% - \pgfpathcosine{\pgfpoint{\pgf@xc}{\pgf@yc}}% + \pgfpathcosine{\pgfqpoint{\pgf@xc}{\pgf@yc}}% \tikz@scan@next@command% } @@ -1877,24 +2251,25 @@ \tikz@lastxsaved=\tikz@lastx% \tikz@lastysaved=\tikz@lasty% \tikz@updatecurrenttrue% - \pgfpathsine{\pgfpoint{\pgf@xc}{\pgf@yc}}% + \pgfpathsine{\pgfqpoint{\pgf@xc}{\pgf@yc}}% \tikz@scan@next@command% } % Syntax for parabolas: % parabola[options] bend <coordinate> <coordinate> \def\tikz@parabola arabola{% - \@ifnextchar[{\tikz@parabola@options}{\tikz@parabola@options[]}}%} + \pgf@ifnextchar[{\tikz@parabola@options}{\tikz@parabola@options[]}}%} \def\tikz@parabola@options[#1]{% \def\tikz@parabola@option{#1}% - \@ifnextchar b{\tikz@parabola@scan@bend}{\tikz@scan@one@point\tikz@parabola@semifinal}} + \pgf@ifnextchar b{\tikz@parabola@scan@bend}{\tikz@scan@one@point\tikz@parabola@semifinal}} \def\tikz@parabola@scan@bend bend{\tikz@scan@one@point\tikz@parabola@scan@bendB} \def\tikz@parabola@scan@bendB#1{% \def\tikz@parabola@bend{#1}% \tikz@scan@one@point\tikz@parabola@semifinal% } \def\tikz@parabola@semifinal#1{% + \tikz@flush@moveto% % Save original start: \pgf@xb=\tikz@lastx% \pgf@yb=\tikz@lasty% @@ -1916,7 +2291,7 @@ % Ok, now calculate delta to bend \advance\tikz@lastx by-\pgf@xb% \advance\tikz@lasty by-\pgf@yb% - \xdef\tikz@parabola@b{{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}{\noexpand\pgfpoint{\the\pgf@xc}{\the\pgf@yc}}}% + \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% @@ -1927,12 +2302,13 @@ % circle (radius) % % Syntax for ellipses: -% ellipse (x-radius/y-radius) -\def\tikz@circle ircle{\tikz@@circle} -\def\tikz@ellipse llipse{\tikz@@circle} +% ellipse (x-radius and y-radius) +% +% 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{% - \tikz@flush@moveto% - \@ifnextchar(\tikz@@@circle{%) + \pgf@ifnextchar(\tikz@@@circle{%) \advance\tikz@expandcount by -1% \ifnum\tikz@expandcount<0\relax% \let\@next=\tikz@@circle@scangiveup% @@ -1954,42 +2330,64 @@ \tikz@scan@next@command% } \def\tikz@@ellipseB(#1 and #2){% - \pgfpathellipse{\tikz@last@position}{\pgfpoint{#1}{0pt}}{\pgfpoint{0pt}{#2}}% + \tikz@checkunit{#1}% + \iftikz@isdimension% + \pgfpathellipse{\tikz@last@position}{\pgfpoint{#1}{0pt}}{\pgfpoint{0pt}{#2}}% + \else% + \pgfpathellipse{\tikz@last@position}{\pgfpointxy{#1}{0}}{\pgfpointxy{0}{#2}}% + \fi% } % Syntax 1 for arcs: % arc (start angle:end angle:radius) % % Syntax 2 for arcs: -% arc (start angle:end angle:x-radius/y-radius) +% 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% - \@ifnextchar({\tikz@@arcto}{\expandafter\tikz@arcA\expandafter r\expandafter c}} + \pgf@ifnextchar({\tikz@@arcto}{\expandafter\tikz@arcA\expandafter r\expandafter c}} \def\tikz@@arcto(#1){% \edef\tikz@temp{(#1)}% - \expandafter\tikz@@@arcto@and\tikz@temp% + \expandafter\tikz@@@arcto@check@slashand\tikz@temp% } -\def\tikz@@@arcto@and(#1:#2:#3){% - \in@{ and }{#3}% +\def\tikz@@@arcto@check@slashand(#1:#2:#3){% + \in@{/}{#3}% \ifin@% - \tikz@parse@arc@and(#1:#2:#3)% + \tikz@parse@arc@replace@slash@and(#1:#2:#3)% \else% - \tikz@@@arcto(#1:#2:#3)% + \in@{ and }{#3}% + \ifin@% + \tikz@parse@arc@and(#1:#2:#3)% + \else% + \tikz@parse@arc@and(#1:#2:#3 and #3)% + \fi% \fi% } +\def\tikz@parse@arc@replace@slash@and(#1:#2:#3/#4){\tikz@parse@arc@and(#1:#2:#3 and #4)} + \def\tikz@parse@arc@and(#1:#2:#3 and #4){% - \tikz@@@arcto(#1:#2:#3/#4)% + \tikz@checkunit{#3}% + \iftikz@isdimension% + \tikz@@@arcfinal{\pgfpatharc{#1}{#2}{#3/#4}} + {\pgfpointpolar{#1}{#3/#4}} + {\pgfpointpolar{#2}{#3/#4}}% + \else% + \tikz@@@arcfinal{\pgfpatharcaxes{#1}{#2}{\pgfpointxy{#3}{0}}{\pgfpointxy{0}{#4}}} + {\pgfpointpolarxy{#1}{#3/#4}}{\pgfpointpolarxy{#2}{#3/#4}}% + \fi% } -\def\tikz@@@arcto(#1:#2:#3){% - \pgfpatharc{#1}{#2}{#3}% - \pgf@process{\pgfpointpolar{#1}{#3}}% +\def\tikz@@@arcfinal#1#2#3{% + #1% + \pgf@process{#2}% \advance\tikz@lastx by-\pgf@x% \advance\tikz@lasty by-\pgf@y% - \pgf@process{\pgfpointpolar{#2}{#3}}% + \pgf@process{#3}% \advance\tikz@lastx by\pgf@x% \advance\tikz@lasty by\pgf@y% \tikz@lastxsaved=\tikz@lastx% @@ -1999,16 +2397,18 @@ % Syntax for coordinates: -% coordinate (coordinate name) at (point) +% coordinate[options] (coordinate name) at (point) % where ``at (point)'' is optional \def\tikz@coordinate ordinate{% - \@ifnextchar({\tikz@@coordinate} - {\tikz@fig ode[shape=coordinate]{}}}%} -\def\tikz@@coordinate(#1){% - \@ifnextchar a{\tikz@@coordinate@at(#1)} - {\tikz@fig ode[shape=coordinate](#1){}}} -\def\tikz@@coordinate@at(#1)at#2(#3){% - \tikz@fig ode[shape=coordinate](#1)at(#3){}} + \pgf@ifnextchar[{\tikz@@coordinate@opt}{\tikz@@coordinate@opt[]}} +\def\tikz@@coordinate@opt[#1]{% + \pgf@ifnextchar({\tikz@@coordinate[#1]} + {\tikz@fig ode[shape=coordinate,#1]{}}}%} +\def\tikz@@coordinate[#1](#2){% + \pgf@ifnextchar a{\tikz@@coordinate@at[#1](#2)} + {\tikz@fig ode[shape=coordinate,#1](#2){}}} +\def\tikz@@coordinate@at[#1](#2)at#3(#4){% + \tikz@fig ode[shape=coordinate,#1](#2)at(#4){}} @@ -2021,25 +2421,28 @@ % % A label text always ``ends'' the node. \def\tikz@fig ode{% + \edef\tikz@save@line@width{\the\pgflinewidth}% \begingroup% - \let\tikz@fig@name=\@empty% + \let\tikz@fig@name=\pgf@empty% \begingroup% \let\nodepart=\tikz@nodepart% - \let\tikz@options=\@empty% - \let\tikz@transform=\@empty% - \let\tikz@mode=\@empty% - \def\tikz@node@at{\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \let\tikz@options=\pgf@empty% + \let\tikz@after@node=\pgf@empty% + \let\tikz@afternodepathoptions=\pgf@empty% + \let\tikz@transform=\pgf@empty% + \let\tikz@mode=\pgf@empty% + \def\tikz@node@at{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% \iftikz@node@is@a@label% \else% - \let\tikz@time=\@empty% + \let\tikz@time=\pgf@empty% \fi% \tikz@every@style{every node}% \tikz@@scan@fig}% \def\tikz@@scan@fig{% - \@ifnextchar a{\tikz@fig@scan@at} - {\@ifnextchar({\tikz@fig@scan@name} - {\@ifnextchar[{\tikz@fig@scan@options}% - {\@ifnextchar\bgroup{\tikz@fig@main}% + \pgf@ifnextchar a{\tikz@fig@scan@at} + {\pgf@ifnextchar({\tikz@fig@scan@name} + {\pgf@ifnextchar[{\tikz@fig@scan@options}% + {\pgf@ifnextchar\bgroup{\tikz@fig@main}% {\PackageError{tikz}{A node must have a (possibly empty) label text}{}% \tikz@fig@main{}}}}}}%}} \def\tikz@fig@scan@at at{% @@ -2047,10 +2450,10 @@ \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]{\tikz@setkeys{#1}\tikz@@scan@fig}% +\def\tikz@fig@scan@options[#1]{\tikz@setkeys{#1}\def\test{#1}\tikz@@scan@fig}% \def\tikz@fig@main{\afterassignment\tikz@@fig@main\let\next=} \def\tikz@@fig@main{% - \@ifundefined{pgf@sh@s@\tikz@shape}% + \pgf@ifundefined{pgf@sh@s@\tikz@shape}% {\PackageError{tikz}% {Unknown shape ``\tikz@shape.'' Using ``rectangle'' instead}{}% \def\tikz@shape{rectangle}}% @@ -2059,47 +2462,53 @@ \setbox\pgfnodeparttextbox=\hbox% \bgroup% \tikz@every@style{every text node part}% - \ifx\tikz@textopacity\@empty% + \ifx\tikz@textopacity\pgf@empty% \else% \pgfsetfillopacity{\tikz@textopacity}% \pgfsetstrokeopacity{\tikz@textopacity}% \fi% \pgfinterruptpicture% - \ifx\tikz@text@width\@empty% + \tikz@textfont% + \ifx\tikz@text@width\pgf@empty% \else% \begingroup% \minipage[t]{\tikz@text@width}% \tikz@text@action% \fi% + \tikz@atbegin@node% \bgroup% \aftergroup\unskip% - \ifx\tikz@textcolor\@empty% - \color{.}% + \ifx\tikz@textcolor\pgf@empty% \else% - \color{\tikz@textcolor}% + \colorlet{.}{\tikz@textcolor}% \fi% - \tikz@textfont% + \pgfsetcolor{.}% \setbox\tikz@figbox=\box\voidb@x% \tikz@uninstallcommands% \aftergroup\tikz@fig@collectresetcolor% \ignorespaces% } \def\tikz@fig@collectresetcolor{% - \@ifnextchar\reset@color% + \pgf@ifnextchar\reset@color% {\reset@color\afterassignment\tikz@fig@collectresetcolor\let\tikz@temp=}% {\tikz@fig@boxdone}% } \def\tikz@fig@boxdone{% - \ifx\tikz@text@width\@empty% + \tikz@atend@node% + \ifx\tikz@text@width\pgf@empty% \else% \endminipage% \endgroup% \fi% \endpgfinterruptpicture% \egroup% - \@ifnextchar c{\tikz@fig@withchildren}{\@ifnextchar[{\tikz@fig@withchildren}{\tikz@fig@continue}}}%} -\def\tikz@fig@withchildren{% - \ifx\tikz@fig@name\@empty% + \pgf@ifnextchar c{\tikz@fig@mustbenamed}% + {\pgf@ifnextchar[{\tikz@fig@mustbenamed}% + {\pgf@ifnextchar t{\tikz@fig@mustbenamed} + {\pgf@ifnextchar e{\tikz@fig@mustbenamed} + {\ifx\tikz@after@node\pgf@empty\expandafter\tikz@fig@continue\else\expandafter\tikz@fig@mustbenamed\fi}}}}}%} +\def\tikz@fig@mustbenamed{% + \ifx\tikz@fig@name\pgf@empty% % Assign a dummy name \global\advance\tikz@fig@count by1\relax \edef\tikz@fig@name{tikz@f@\the\tikz@fig@count}% @@ -2107,19 +2516,30 @@ \tikz@fig@continue% } \def\tikz@fig@continue{% - \ifx\tikz@text@width\@empty% + \ifx\tikz@text@width\pgf@empty% \else% \setlength{\pgf@x}{\tikz@text@width}% \wd\pgfnodeparttextbox=\pgf@x% \fi% + \ifx\tikz@text@height\pgf@empty% + \else% + \setlength{\pgf@x}{\tikz@text@height}% + \ht\pgfnodeparttextbox=\pgf@x% + \fi% + \ifx\tikz@text@depth\pgf@empty% + \else% + \setlength{\pgf@x}{\tikz@text@depth}% + \dp\pgfnodeparttextbox=\pgf@x% + \fi% % Possibly, we are ``online'' - \ifx\tikz@time\@empty% + \ifx\tikz@time\pgf@empty% \pgftransformshift{\tikz@node@at}% \iftikz@fullytransformed% \else% \pgftransformresetnontranslations \fi% \else% + \tikz@do@auto@anchor% \tikz@timer% \fi% % Invoke local transformations @@ -2141,24 +2561,35 @@ \endpgfinterruptpath% }}% }% + % + \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% % shift box outside group \global\setbox\tikz@tempbox=\copy\tikz@figbox% - \global\let\tikz@last@fig@name=\tikz@fig@name% \endgroup\endgroup% - \setbox\tikz@figbox=\box\tikz@tempbox% + \setbox\tikz@figbox=\box\tikz@tempbox% + \pgflinewidth=\tikz@save@line@width% + \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\pgf@empty% + \else% + \tikz@scan@next@command{\pgfextra{\tikz@afternodepathoptions@smuggle}\tikz@after@node@smuggle}\pgf@stop% + \fi% \tikz@scan@next@command% } \let\tikz@fig@continue@orig=\tikz@fig@continue - % Syntax for parts of nodes: % node ... {... \nodepart{name} ... \nodepart{name} ...} \def\tikz@nodepart#1{% + \tikz@atend@node% \unskip% \gdef\tikz@nodepart@name{#1}% \global\let\tikz@fig@continue=\tikz@nodepart@continue% - \@ifnextchar x{\egroup\relax}{\egroup\relax}% gobble spaces + \pgf@ifnextchar x{\egroup\relax}{\egroup\relax}% gobble spaces } \def\tikz@nodepart@continue{% \global\let\tikz@fig@continue=\tikz@fig@continue@orig% @@ -2167,7 +2598,8 @@ \bgroup% \tikz@every@style{every \tikz@nodepart@name\space node part}% \pgfinterruptpicture% - \ifx\tikz@text@width\@empty% + \tikz@textfont% + \ifx\tikz@text@width\pgf@empty% \else% \begingroup% \minipage[t]{\tikz@text@width}% @@ -2175,44 +2607,117 @@ \fi% \bgroup% \aftergroup\unskip% - \ifx\tikz@textcolor\@empty% - \color{.}% + \ifx\tikz@textcolor\pgf@empty% \else% - \color{\tikz@textcolor}% + \colorlet{.}{\tikz@textcolor}% \fi% - \tikz@textfont% + \pgfsetcolor{.}% \setbox\tikz@figbox=\box\voidb@x% \tikz@uninstallcommands% + \tikz@atbegin@node% \aftergroup\tikz@fig@collectresetcolor% \ignorespaces% } +% Auto placement + +\def\tikz@auto@pre{% + \begingroup + \pgfresetnontranslationattimefalse + \pgfslopedattimetrue% + \pgfallowupsidedownattimetrue% + \tikz@timer% + \pgf@x=\pgf@pt@aa pt% + \pgf@y=\pgf@pt@ab pt% + \pgfpointnormalised{}% +} + +\def\tikz@auto@post{% + \global\let\tikz@anchor@smuggle=\tikz@anchor% + \endgroup% + \let\tikz@anchor=\tikz@anchor@smuggle% +} + +\def\tikz@auto@anchor{% + \ifdim\pgf@x>0.05pt% + \ifdim\pgf@y>0.05pt% + \def\tikz@anchor{south east}% + \else\ifdim\pgf@y<-0.05pt% + \def\tikz@anchor{south west}% + \else + \def\tikz@anchor{south}% + \fi\fi% + \else\ifdim\pgf@x<-0.05pt% + \ifdim\pgf@y>0.05pt% + \def\tikz@anchor{north east}% + \else\ifdim\pgf@y<-0.05pt% + \def\tikz@anchor{north west}% + \else + \def\tikz@anchor{north}% + \fi\fi% + \else% + \ifdim\pgf@y>0pt% + \def\tikz@anchor{east}% + \else% + \def\tikz@anchor{west}% + \fi% + \fi\fi% +} + +\def\tikz@auto@anchor@prime{% + \ifdim\pgf@x>0.05pt% + \ifdim\pgf@y>0.05pt% + \def\tikz@anchor{north west}% + \else\ifdim\pgf@y<-0.05pt% + \def\tikz@anchor{north east}% + \else + \def\tikz@anchor{north}% + \fi\fi% + \else\ifdim\pgf@x<-0.05pt% + \ifdim\pgf@y>0.05pt% + \def\tikz@anchor{south west}% + \else\ifdim\pgf@y<-0.05pt% + \def\tikz@anchor{south east}% + \else + \def\tikz@anchor{south}% + \fi\fi% + \else% + \ifdim\pgf@y>0pt% + \def\tikz@anchor{west}% + \else% + \def\tikz@anchor{east}% + \fi% + \fi\fi% +} + + + % Syntax for trees: % node {...} child [options] {...} child [options] {...} ... -% node {...} children [options] \var in {list} [options] {...} ... +% node {...} child [options] foreach \var in {list} [options] {...} ... \def\tikz@children{% % Start collecting the children: - \let\tikz@children@list=\@empty% + \let\tikz@children@list=\pgf@empty% \tikznumberofchildren=0\relax% \tikz@collect@children c} -\def\tikz@collect@children{\@ifnextchar c{\tikz@collect@children@cchar}{\tikz@children@collected}} -\def\tikz@collect@children@cchar c{\@ifnextchar h{\tikz@collect@child}{\tikz@children@collected c}} -\def\tikz@collect@child hild{\@ifnextchar[{\tikz@collect@childA}{\tikz@collect@childA[]}}%} -\def\tikz@collect@childA[#1]{\@ifnextchar f{\tikz@collect@children@foreach[#1]}{\tikz@collect@childB[#1]}} +\def\tikz@collect@children{\pgf@ifnextchar c{\tikz@collect@children@cchar}{\tikz@children@collected}} +\def\tikz@collect@children@cchar c{\pgf@ifnextchar h{\tikz@collect@child}{\tikz@children@collected c}} +\def\tikz@collect@child hild{\pgf@ifnextchar[{\tikz@collect@childA}{\tikz@collect@childA[]}}%} +\def\tikz@collect@childA[#1]{\pgf@ifnextchar f{\tikz@collect@children@foreach[#1]}{\tikz@collect@childB[#1]}} \def\tikz@collect@childB[#1]{% \advance\tikznumberofchildren by1\relax \expandafter\def\expandafter\tikz@children@list\expandafter{\tikz@children@list \tikz@childnode[#1]}% - \@ifnextchar\bgroup{\tikz@collect@child@code}{\tikz@collect@child@code{}}} + \pgf@ifnextchar\bgroup{\tikz@collect@child@code}{\tikz@collect@child@code{}}} \def\tikz@collect@child@code#1{% \expandafter\def\expandafter\tikz@children@list\expandafter{\tikz@children@list{#1}}% \tikz@collect@children% } \def\tikz@collect@children@foreach[#1]foreach#2in#3{% - \@ifnextchar\bgroup{\tikz@collect@children@foreachA{#1}{#2}{#3}}{\tikz@collect@children@foreachA{#1}{#2}{#3}{}}} + \pgf@ifnextchar\bgroup{\tikz@collect@children@foreachA{#1}{#2}{#3}}{\tikz@collect@children@foreachA{#1}{#2}{#3}{}}} \def\tikz@collect@children@foreachA#1#2#3#4{% \expandafter\def\expandafter\tikz@children@list\expandafter {\tikz@children@list\tikz@childrennodes[#1]{#2}{#3}{#4}}% @@ -2227,10 +2732,9 @@ \long\def\tikz@children@collected{% \begingroup% \advance\tikztreelevel by 1\relax% - \let\tikz@options=\@empty% - \let\tikz@transform=\@empty% + \let\tikz@options=\pgf@empty% + \let\tikz@transform=\pgf@empty% \tikz@every@style{level \the\tikztreelevel}% - \tikz@options% \tikz@transform% \let\tikzparentnode=\tikz@last@fig@name% % Transform to center of node @@ -2246,7 +2750,7 @@ % Syntax for children: % -% children [all children options] \var in {values} [child options] {...} +% child [all children options] foreach \var in {values} [child options] {...} \def\tikz@childrennodes[#1]#2#3#4{% \c@pgf@counta=\tikznumberofcurrentchild\relax% \setbox\tikz@tempbox=\box\tikz@figbox% @@ -2280,8 +2784,7 @@ \hbox\bgroup\bgroup% \pgfinterruptpath% \pgfscope% - \let\tikz@options=\@empty% - \let\tikz@transform=\@empty% + \let\tikz@transform=\pgf@empty% \tikz@every@style{every child}% \tikz@setkeys{#1}% \tikz@options% @@ -2298,7 +2801,7 @@ \let\tikzchildnode=\tikz@childnode@name% {% \def\tikz@edge@to@parent@needed{edge from parent} - \ifx\tikz@child@node@rest\@empty% + \ifx\tikz@child@node@rest\pgf@empty% \path edge from parent;% \else% \path (0,0) \tikz@child@node@rest \tikz@edge@to@parent@needed;% @@ -2311,31 +2814,31 @@ } \def\tikz@parse@child@node{% - \@ifnextchar n{\tikz@parse@child@node@n}% - {\@ifnextchar c{\tikz@parse@child@node@c}% + \pgf@ifnextchar n{\tikz@parse@child@node@n}% + {\pgf@ifnextchar c{\tikz@parse@child@node@c}% {\tikz@parse@child@node@rest}}} \def\tikz@parse@child@node@rest#1\pgf@stop{\def\tikz@child@node@rest{#1}} -\def\tikz@parse@child@node@c c{\@ifnextchar o{\tikz@parse@child@node@co}{\tikz@parse@child@node@rest c}} -\def\tikz@parse@child@node@co o{\@ifnextchar o{\tikz@parse@child@node@coordinate}{\tikz@parse@child@node@rest co}} +\def\tikz@parse@child@node@c c{\pgf@ifnextchar o{\tikz@parse@child@node@co}{\tikz@parse@child@node@rest c}} +\def\tikz@parse@child@node@co o{\pgf@ifnextchar o{\tikz@parse@child@node@coordinate}{\tikz@parse@child@node@rest co}} \def\tikz@parse@child@node@coordinate ordinate{% - \@ifnextchar ({\tikz@@parse@child@node@coordinate}{% + \pgf@ifnextchar ({\tikz@@parse@child@node@coordinate}{% \def\tikz@child@node@text{[shape=coordinate]{}}% \tikz@parse@child@node@rest}}%} \def\tikz@@parse@child@node@coordinate(#1){% - \@ifnextchar a{\tikz@p@c@n@c@at(#1)}{% + \pgf@ifnextchar a{\tikz@p@c@n@c@at(#1)}{% \def\tikz@child@node@text{[shape=coordinate,name=#1]{}}% \tikz@parse@child@node@rest}} \def\tikz@p@c@n@c@at(#1)at#2(#3){% \def\tikz@child@node@text{[shape=coordinate,name=#1]at(#3){}}% \tikz@parse@child@node@rest}% \def\tikz@parse@child@node@n node{% - \let\tikz@child@node@text=\@empty% + \let\tikz@child@node@text=\pgf@empty% \tikz@p@c@s}% \def\tikz@p@c@s{% - \@ifnextchar a{\tikz@p@c@s@at} - {\@ifnextchar ({\tikz@p@c@s@paran} - {\@ifnextchar [{\tikz@p@c@s@bra} - {\@ifnextchar \bgroup{\tikz@p@c@s@group} + \pgf@ifnextchar a{\tikz@p@c@s@at} + {\pgf@ifnextchar ({\tikz@p@c@s@paran} + {\pgf@ifnextchar [{\tikz@p@c@s@bra} + {\pgf@ifnextchar \bgroup{\tikz@p@c@s@group} {\PackageError{tikz}{Cannot parse this node}{}}}}}}%}} \def\tikz@p@c@s@at at#1(#2){% \expandafter\def\expandafter\tikz@child@node@text\expandafter{\tikz@child@node@text at(#2)} @@ -2368,7 +2871,7 @@ \pgf@xb=\tikz@time pt% \pgf@xb=2\pgf@xb% \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}{\noexpand\tikz@timer@start}{% - \noexpand\pgfpoint{\the\pgf@xa}{\the\pgf@y}}}% + \noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@y}}}% \tikz@marshal% \else% second half \pgf@process{\tikz@timer@start}% @@ -2379,7 +2882,7 @@ \pgf@xb=2\pgf@xb% \advance\pgf@xb by-1pt% \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% - {\noexpand\pgfpoint{\the\pgf@xa}{\the\pgf@y}}{\noexpand\tikz@timer@end}}% + {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@y}}{\noexpand\tikz@timer@end}}% \tikz@marshal% \fi% } @@ -2393,7 +2896,7 @@ \pgf@xb=\tikz@time pt% \pgf@xb=2\pgf@xb% \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}{\noexpand\tikz@timer@start}{% - \noexpand\pgfpoint{\the\pgf@x}{\the\pgf@ya}}}% + \noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@ya}}}% \tikz@marshal% \else% second half \pgf@process{\tikz@timer@start}% @@ -2404,7 +2907,7 @@ \pgf@xb=2\pgf@xb% \advance\pgf@xb by-1pt% \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% - {\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@ya}}{\noexpand\tikz@timer@end}}% + {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@ya}}{\noexpand\tikz@timer@end}}% \tikz@marshal% \fi% } @@ -2415,6 +2918,128 @@ +% +% Coordinate systems +% + +\def\tikzdeclarecoordinatesystem#1#2{% + \expandafter\def\csname tikz@parse@cs@#1\endcsname(##1){% + \pgf@process{% + #2% + % Smuggle outside: + \iftikz@shapeborder% + \global\let\tikz@smuggle@a=\tikz@shapebordertrue% + \else% + \global\let\tikz@smuggle@a=\tikz@shapeborderfalse% + \fi% + \global\let\tikz@smubble@b=\tikz@shapeborder@name% + }% + \tikz@smuggle@a% + \let\tikz@shapeborder@name=\tikz@smubble@b% + \edef\tikz@return@coordinate{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}% +} +\def\tikzaliascoordinatesystem#1#2{% + \edef\pgf@marshal{\noexpand\let\expandafter\noexpand\csname + tikz@parse@cs@#1\endcsname=\expandafter\noexpand\csname + tikz@parse@cs@#2\endcsname}% + \pgf@marshal% +} + + +% Default coodinate systems: + +\tikzdeclarecoordinatesystem{canvas} +{% + \tikz@orig@setkeys{tikzcskeys}{x=0pt,y=0pt,#1}% + \pgfpoint{\tikz@cs@x}{\tikz@cs@y}% +} + +\tikzdeclarecoordinatesystem{canvas polar} +{% + \tikz@orig@setkeys{tikzcskeys}{angle=0,radius=0cm,#1}% + \pgfpointpolar{\tikz@cs@angle}{\tikz@cs@xradius/\tikz@cs@yradius}% +} + +\tikzdeclarecoordinatesystem{xyz} +{% + \tikz@orig@setkeys{tikzcskeys}{x=0,y=0,z=0,#1}% + \pgfpointxyz{\tikz@cs@x}{\tikz@cs@y}{\tikz@cs@z}% +} + +\tikzdeclarecoordinatesystem{xyz polar} +{% + \tikz@orig@setkeys{tikzcskeys}{angle=0,radius=0,#1}% + \pgfpointpolarxy{\tikz@cs@angle}{\tikz@cs@xradius/\tikz@cs@yradius}% +} +\tikzaliascoordinatesystem{xy polar}{xyz polar} + + +\tikzdeclarecoordinatesystem{node} +{% + \tikz@orig@setkeys{tikzcskeys}{name=,anchor=none,angle=none,#1}% + \ifx\tikz@cs@anchor\tikz@nonetext% + \ifx\tikz@cs@angle\tikz@nonetext% + \expandafter\ifx\csname pgf@sh@ns@\tikz@cs@node\endcsname\tikz@coordinate@text% + \else + \tikz@shapebordertrue% + \edef\tikz@shapeborder@name{\tikz@cs@node}% + \fi% + \pgfpointanchor{\tikz@cs@node}{center}% + \else% + \pgfpointanchor{\tikz@cs@node}{\tikz@cs@angle}% + \fi% + \else% + \pgfpointanchor{\tikz@cs@node}{\tikz@cs@anchor}% + \fi% +} + +\tikzdeclarecoordinatesystem{intersection} +{% + \tikz@orig@setkeys{tikzcskeys}{#1}% + \expandafter\tikz@@@scan@@absolute\expandafter\tikz@parse@intersection@a\tikz@cs@line@a@begin% + \expandafter\tikz@@@scan@@absolute\expandafter\tikz@parse@intersection@b\tikz@cs@line@a@end% + \expandafter\tikz@@@scan@@absolute\expandafter\tikz@parse@intersection@c\tikz@cs@line@b@begin% + \expandafter\tikz@@@scan@@absolute\expandafter\tikz@parse@intersection@d\tikz@cs@line@b@end% + \edef\pgf@marshal{% + {\noexpand\pgfpointintersectionoflines% + {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}}% + \pgf@marshal% +} + +\tikzdeclarecoordinatesystem{perpendicular} +{% + \tikz@orig@setkeys{tikzcskeys}{#1}% + \expandafter\tikz@@@scan@@absolute\expandafter\tikz@parse@intersection@a\tikz@cs@hori@line% + \expandafter\tikz@@@scan@@absolute\expandafter\tikz@parse@intersection@b\tikz@cs@vert@line% + \pgfqpoint{\the\pgf@xb}{\the\pgf@ya} +} + +\tikz@orig@define@key{tikzcskeys}{x}{\def\tikz@cs@x{#1}} +\tikz@orig@define@key{tikzcskeys}{y}{\def\tikz@cs@y{#1}} +\tikz@orig@define@key{tikzcskeys}{z}{\def\tikz@cs@z{#1}} +\tikz@orig@define@key{tikzcskeys}{angle}{\def\tikz@cs@angle{#1}} +\tikz@orig@define@key{tikzcskeys}{radius}{\def\tikz@cs@xradius{#1}\def\tikz@cs@yradius{#1}} +\tikz@orig@define@key{tikzcskeys}{x radius}{\def\tikz@cs@xradius{#1}} +\tikz@orig@define@key{tikzcskeys}{y radius}{\def\tikz@cs@yradius{#1}} +\tikz@orig@define@key{tikzcskeys}{name}{\def\tikz@cs@node{#1}} +\tikz@orig@define@key{tikzcskeys}{anchor}{\def\tikz@cs@anchor{#1}} + +\tikz@orig@define@key{tikzcskeys}{first line}{\tikz@parse@cs@line{tikz@cs@line@a}#1} +\tikz@orig@define@key{tikzcskeys}{second line}{\tikz@parse@cs@line{tikz@cs@line@b}#1} + +\def\tikz@parse@cs@line#1(#2)--(#3){% + \expandafter\def\csname #1@begin\endcsname{(#2)}% + \expandafter\def\csname #1@end\endcsname{(#3)}% +} + +\tikz@orig@define@key{tikzcskeys}{horizontal line through}{\def\tikz@cs@hori@line{#1}} +\tikz@orig@define@key{tikzcskeys}{vertical line through}{\def\tikz@cs@vert@line{#1}} + + + % % Coordinate management @@ -2422,8 +3047,8 @@ % Last position visited -\def\tikz@last@position{\pgfpoint{\tikz@lastx}{\tikz@lasty}} -\def\tikz@last@position@saved{\pgfpoint{\tikz@lastxsaved}{\tikz@lastysaved}} +\def\tikz@last@position{\pgfqpoint{\tikz@lastx}{\tikz@lasty}} +\def\tikz@last@position@saved{\pgfqpoint{\tikz@lastxsaved}{\tikz@lastysaved}} % Make given point the last position visited \def\tikz@make@last@position#1{% @@ -2447,16 +3072,17 @@ % appropriate pgf command representing that point. \def\tikz@scan@one@point#1{% + \let\tikz@to@use@whom=\tikz@to@use@last@coordinate% \tikz@shapeborderfalse% - \@ifnextchar+{\tikz@scan@relative#1}{\tikz@scan@absolute#1}} + \pgf@ifnextchar+{\tikz@scan@relative#1}{\tikz@scan@absolute#1}} \def\tikz@scan@absolute#1{% - \@ifnextchar({\tikz@scan@@absolute#1}%) + \pgf@ifnextchar({\tikz@scan@@absolute#1}%) {% \advance\tikz@expandcount by -1% \ifnum\tikz@expandcount<0\relax% \let\@next=\tikz@@scangiveup% \else% - \let\@next=\tikz@@scanexpand + \let\@next=\tikz@@scanexpand% \fi% \@next{#1}% }% @@ -2468,7 +3094,7 @@ \expandafter\tikz@@scan@@absolute\expandafter#1\tikz@temp% } \def\tikz@@scan@@absolute#1({% - \@ifnextchar[% uhoh... options! + \pgf@ifnextchar[% uhoh... options! {\def\tikz@scan@point@recall{#1}\tikz@scan@options}% {\tikz@@@scan@@absolute#1(}% } @@ -2483,11 +3109,11 @@ % Ok, compute point with options set and zero transformation % matrix: \pgftransformreset% - \let\tikz@transform=\@empty% + \let\tikz@transform=\pgf@empty% \expandafter\tikz@setkeys\expandafter{\tikz@scan@point@options}% \tikz@transform% \pgf@process{\pgfpointtransformed{#1}}% - \xdef\tikz@marshal{\expandafter\noexpand\tikz@scan@point@recall{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}}% + \xdef\tikz@marshal{\expandafter\noexpand\tikz@scan@point@recall{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}% }% \tikz@marshal% } @@ -2506,15 +3132,20 @@ \let\@next\tikz@parse@vh% \fi% \else% - \in@:{#2}% - \ifin@ - \let\@next\tikz@parse@polar% + \in@{cs:}{#2}% + \ifin@% + \let\@next\tikz@parse@coordinatesystem% \else% - \in@,{#2}% - \ifin@% - \let\@next\tikz@parse@regular% + \in@:{#2}% + \ifin@ + \let\@next\tikz@parse@polar% \else% - \let\@next\tikz@parse@node% + \in@,{#2}% + \ifin@% + \let\@next\tikz@parse@regular% + \else% + \let\@next\tikz@parse@node% + \fi% \fi% \fi% \fi% @@ -2522,23 +3153,47 @@ \@next#1(#2)% } +\def\tikz@parse@coordinatesystem#1(#2 cs:#3){% + \let\tikz@return@coordinate=\pgfpointorigin% + \pgf@ifundefined{tikz@parse@cs@#2} + {\PackageError{tikz}{Unknown coordinate system '#2'}{}} + {\csname tikz@parse@cs@#2\endcsname(#3)}% + \expandafter#1\expandafter{\tikz@return@coordinate}% +} + + \newif\iftikz@isdimension \def\tikz@checkunit#1{% \@tempdima\z@% \afterassignment\tikz@@checkunit% \@tempdima#1\@tempdima\tikz@unique% } -\def\tikz@@checkunit{\@ifnextchar\tikz@unique{\tikz@checkunit@number}{\tikz@checkunit@dimension}} +\def\tikz@@checkunit{\pgf@ifnextchar\tikz@unique{\tikz@checkunit@number}{\tikz@checkunit@dimension}} \def\tikz@checkunit@number\tikz@unique{\tikz@isdimensionfalse} \def\tikz@checkunit@dimension#1\tikz@unique{\tikz@isdimensiontrue} \def\tikz@parse@polar#1(#2:#3){% - \@ifundefined{tikz@polar@dir@#2} - {#1{\pgfpointpolar{#2}{#3}}} - {% - \edef\tikz@marshal{\noexpand#1{\noexpand\pgfpointpolar{\csname tikz@polar@dir@#2\endcsname}{#3}}}% - \tikz@marshal% - }% + \pgf@ifundefined{tikz@polar@dir@#2} + {\tikz@@parse@polar#1(#2:#3)} + {\tikz@@parse@polar#1(\csname tikz@polar@dir@#2\endcsname:#3)}% +} +\def\tikz@@parse@polar#1(#2:#3){% + \in@{ and }{#3}% + \ifin@% + \edef\tikz@args{(#2:#3)}% + \else% + \edef\tikz@args{(#2:#3 and #3)}% + \fi% + \expandafter\tikz@@@parse@polar\expandafter#1\tikz@args% +} +\def\tikz@@@parse@polar#1(#2:#3 and #4){% + \tikz@checkunit{#3}% + \iftikz@isdimension% + \def\tikz@next{#1{\pgfpointpolar{#2}{#3/#4}}}% + \else% + \def\tikz@next{#1{\pgfpointpolarxy{#2}{#3/#4}}}% + \fi% + \tikz@next% } \def\tikz@polar@dir@up{90} \def\tikz@polar@dir@down{-90} @@ -2587,7 +3242,7 @@ \def\tikz@shapeborder@name{#2}% \fi% \fi% - \edef\tikz@marshal{\noexpand#1{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}}% + \edef\tikz@marshal{\noexpand#1{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}% \tikz@marshal% } @@ -2644,7 +3299,7 @@ {% \tikz@@@scan@@absolute\tikz@parse@vh@mid(#2)% \tikz@@@scan@@absolute\tikz@parse@vh@end(#3)% - \xdef\tikz@marshal{\noexpand#1{\noexpand\pgfpoint{\the\pgf@xa}{\the\pgf@ya}}}% + \xdef\tikz@marshal{\noexpand#1{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}}% }% \tikz@shapeborderfalse% \tikz@marshal% @@ -2659,10 +3314,10 @@ \tikz@@@scan@@absolute\tikz@parse@intersection@c(#4)% \tikz@@@scan@@absolute\tikz@parse@intersection@d(#5)% \xdef\tikz@marshal{\noexpand#1{\noexpand\pgfpointintersectionoflines% - {\noexpand\pgfpoint{\the\pgf@xa}{\the\pgf@ya}}% - {\noexpand\pgfpoint{\the\pgf@xb}{\the\pgf@yb}}% - {\noexpand\pgfpoint{\the\pgf@xc}{\the\pgf@yc}}% - {\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}}}% + {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}}% }% \tikz@shapeborderfalse% \tikz@marshal% @@ -2674,7 +3329,7 @@ \def\tikz@parse@intersection@d#1{\pgf@process{#1}} \def\tikz@scan@relative#1+{% - \@ifnextchar+{\tikz@scan@plusplus#1}{\tikz@scan@oneplus#1}} + \pgf@ifnextchar+{\tikz@scan@plusplus#1}{\tikz@scan@oneplus#1}} \def\tikz@scan@plusplus#1+{% \def\tikz@doafter{#1}% @@ -2690,4 +3345,51 @@ } + +% Loading further libraries + +% Include a library file. +% +% #1 = List of names of library file. +% +% Description: +% +% This command includes a list of TikZ library files. For each file X in the +% list, the file pgflibrarytikzX.code.tex is included, provided this has +% not been done earlier. +% +% For the convenience of Context users, both round and square brackets +% are possible for the argument. +% +% Example: +% +% \usetikzlibrary{arrows} +% \usetikzlibrary[patterns,topaths] + +\def\usetikzlibrary{\pgf@ifnextchar[{\use@tikzlibrary}{\use@@tikzlibrary}}%} +\def\use@tikzlibrary[#1]{\use@@tikzlibrary{#1}} +\def\use@@tikzlibrary#1{% + \edef\pgf@list{#1}% + \@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=\pgf@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 pgflibrarytikz\pgf@temp.code.tex + \catcode`\@=\csname tikz@library@#1@atcode\endcsname + \catcode`\|=\csname tikz@library@#1@barcode\endcsname + \fi% + }% +} + + +% Always-present libraries: + +\usetikzlibrary{topaths} + + + + \endinput |