From 6bc1f5497cfb2f56d65c80a4c36ea3bad6dc046c Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 29 Oct 2010 00:31:31 +0000 Subject: pgf 2.10 (28oct10) git-svn-id: svn://tug.org/texlive/trunk@20236 c570f23f-e606-0410-a88d-b1316a301751 --- .../circuits/tikzlibrarycircuits.code.tex | 265 +++ .../circuits/tikzlibrarycircuits.ee.IEC.code.tex | 376 ++++ .../circuits/tikzlibrarycircuits.ee.code.tex | 158 ++ .../tikzlibrarycircuits.logic.CDH.code.tex | 29 + .../tikzlibrarycircuits.logic.IEC.code.tex | 76 + .../circuits/tikzlibrarycircuits.logic.US.code.tex | 65 + .../circuits/tikzlibrarycircuits.logic.code.tex | 46 + .../tikzlibrarydatavisualization.3d.code.tex | 80 + ...tikzlibrarydatavisualization.barcharts.code.tex | 43 + .../tikzlibrarydatavisualization.code.tex | 2278 ++++++++++++++++++++ ...arydatavisualization.formats.functions.code.tex | 16 + .../tikzlibrarydatavisualization.polar.code.tex | 62 + ...ikzlibrarydatavisualization.sparklines.code.tex | 38 + .../graphs/tikzlibrarygraphs.basic.code.tex | 29 + .../libraries/graphs/tikzlibrarygraphs.code.tex | 877 ++++++++ .../tikz/libraries/tikzexternalshared.code.tex | 1394 ++++++++++++ .../tikz/libraries/tikzlibraryautomata.code.tex | 3 +- .../tikz/libraries/tikzlibrarybackgrounds.code.tex | 8 +- .../tikz/libraries/tikzlibrarycalc.code.tex | 4 +- .../tikz/libraries/tikzlibrarychains.code.tex | 4 +- .../tikz/libraries/tikzlibrarydecorations.code.tex | 4 +- .../tikzlibrarydecorations.pathreplacing.code.tex | 23 + .../tikz/libraries/tikzlibraryfadings.code.tex | 9 +- .../tikz/libraries/tikzlibraryfit.code.tex | 56 +- .../tikzlibraryfixedpointarithmetic.code.tex | 10 + .../tikz/libraries/tikzlibraryfpu.code.tex | 10 + .../libraries/tikzlibraryintersections.code.tex | 156 ++ .../tikzlibrarylindenmayersystems.code.tex | 81 + .../tikz/libraries/tikzlibrarymatrix.code.tex | 18 +- .../tikz/libraries/tikzlibrarymindmap.code.tex | 139 +- .../tikz/libraries/tikzlibrarypetri.code.tex | 8 +- .../tikz/libraries/tikzlibrarypositioning.code.tex | 7 +- .../tikz/libraries/tikzlibraryscopes.code.tex | 22 +- .../tikz/libraries/tikzlibraryshadings.code.tex | 21 + .../tikz/libraries/tikzlibraryspy.code.tex | 122 ++ .../tikz/libraries/tikzlibrarysvg.path.code.tex | 31 + .../tikz/libraries/tikzlibrarytopaths.code.tex | 7 +- .../tikz/libraries/tikzlibrarytrees.code.tex | 8 +- .../tikz/libraries/tikzlibraryturtle.code.tex | 84 + .../generic/pgf/frontendlayer/tikz/tikz.code.tex | 935 ++++++-- 40 files changed, 7317 insertions(+), 285 deletions(-) create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.ee.IEC.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.ee.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.CDH.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.IEC.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.US.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.3d.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.barcharts.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.formats.functions.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.polar.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.sparklines.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.basic.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzexternalshared.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfixedpointarithmetic.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfpu.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryintersections.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarylindenmayersystems.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshadings.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryspy.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarysvg.path.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryturtle.code.tex (limited to 'Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz') diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.code.tex new file mode 100644 index 00000000000..693da7c5907 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.code.tex @@ -0,0 +1,265 @@ +% Copyright 2008 by Till Tantau and others Wibrow +% +% This file may be distributed and/or modified +% +% 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. + +\usetikzlibrary{decorations.markings,calc} + + +% +% Indicate that the picture contains a circuit +% +\tikzset{ + circuit/.style={ + every circuit/.try, + /utils/exec=\tikz@lib@circ@on@tofalse, + execute at begin to={ + \tikz@lib@circ@on@totrue + \let\tikz@lib@circ@start@node\pgfutil@empty + \def\tikz@lib@circ@end{-- (\tikztotarget) \tikztonodes} + } + } +} + +\newif\iftikz@lib@circ@on@to + + +% +% General management +% + +\tikzset{ + circuit handle symbol/.code={% + \global\advance\tikz@lib@circ@count by1\relax% + \iftikz@lib@circ@on@to + {% + % Compute the tikz@time... + \pgfkeys{ + /pgf/key filters/active families or no family/.install key filter={/pgf/key filters/false}{/pgf/key filters/false}, + /tikz/circuits/pos grabber/.activate family} + \pgfqkeysfiltered{/tikz}{pos=.5,#1}% + \expandafter% + }% + \expandafter\def\expandafter\tikz@lib@circ@pos\expandafter{\tikz@time}% + \pgfkeysalso{to path={ + \pgfextra{\tikz@lib@circ@on@tofalse} + decorate [decoration={markings,mark connection node=mark node}] + { + \tikz@lib@circ@start@node + \tikz@lib@circ@end + } + }} + \ifx\tikz@lib@circ@pos\tikz@zero@text% + \def\tikz@lib@circ@start@node{% + {\pgfextra{\tikz@lib@circ@compute@direction{\tikz@lib@circ@start}}% + node[alias=tikz@lib@circ@node@start,at={(0,0)},#1,pos=]{}}(tikz@lib@circ@node@start)}% + \else% + \ifx\tikz@lib@circ@pos\tikz@one@text% + \def\tikz@lib@circ@end{ + {\pgfextra{\tikz@lib@circ@compute@direction{\tikz@lib@circ@target}}% + node[alias=tikz@lib@circ@node\the\tikz@lib@circ@count,at={(0,0)},#1,pos=]{}} + --(tikz@lib@circ@node\the\tikz@lib@circ@count)\tikztonodes + }% + \else% + \edef\tikz@marshal{mark=at position \tikz@lib@circ@pos\space with}% + \def\tikz@marshala{decoration=}% + \expandafter\expandafter\expandafter\tikzset% + \expandafter\expandafter\expandafter{\expandafter\tikz@marshala\expandafter{\tikz@marshal{\node[alias=mark node,#1,pos=]{};}}} + \fi% + \fi% + \else + \pgfkeysalso{#1} + \fi + } +} +\newcount\tikz@lib@circ@count +\def\tikz@zero@text{0} +\def\tikz@one@text{1} + +\def\tikz@lib@circ@compute@direction#1{% + \tikz@scan@one@point\tikz@lib@circ@save@start(\tikztostart)% + \tikz@scan@one@point\tikz@lib@circ@save@target(\tikztotarget)% + \pgf@process{\pgfpointnormalised{\pgfpointdiff{\tikz@lib@circ@start}{\tikz@lib@circ@target}}}% + \pgf@ya=-\pgf@y% + \pgftransformcm{\the\pgf@x}{\the\pgf@y}{\the\pgf@ya}{\the\pgf@x}{#1}% +} +\def\tikz@lib@circ@save@start#1{\def\tikz@lib@circ@start{#1}} +\def\tikz@lib@circ@save@target#1{\def\tikz@lib@circ@target{#1}} + +\tikzset{ + circuits/pos grabber/.is family, + pos/.belongs to family=/tikz/circuits/pos grabber, + at start/.belongs to family=/tikz/circuits/pos grabber, + very near start/.belongs to family=/tikz/circuits/pos grabber, + near start/.belongs to family=/tikz/circuits/pos grabber, + midway/.belongs to family=/tikz/circuits/pos grabber, + near end/.belongs to family=/tikz/circuits/pos grabber, + very near end/.belongs to family=/tikz/circuits/pos grabber, + at end/.belongs to family=/tikz/circuits/pos grabber +} + + +% +% Declaring a new symbol +% +\tikzset{ + circuit declare symbol/.style args={#1}{ + % Declares a new circuit symbol. + % + % #1 = name + % #2 = factor for default minimum width + % #3 = factor for default minimum height + % + % The following styles are defined: + % + % #1 + % Can be given as an option to a "node" command or to a "to" + % command. It takes a set of options as parameter that will be + % passed to the option. + % + % set #1 graphic + % This keys can be set to the necessary options to make a normal + % node look like the symbol. For instance, for a resistor that is + % rendered as a rectangle, this keys can be set, basically, to + % "rectangle,draw". Set this key to use a different appearance for + % symbols of kind #1. + % + % every #1 + % This style will be included with every symbols of this kind and + % can be used to configure them further. + % + % every circuit symbol + % This style is also included with every symbol. + #1/.style={circuit handle symbol={ + inner sep=0.5pt, + every circuit symbol, + #1/graphic, + every #1/.try, + ##1} + }, + #1/graphic/.style={}, + set #1 graphic/.style={#1/graphic/.style={##1}} + }, + circuit symbol unit/.code=\pgfmathsetlength\tikzcircuitssizeunit{#1}, + circuit symbol size/.style args={width #1 height #2}{ + minimum width=#1*\tikzcircuitssizeunit, + minimum height=#2*\tikzcircuitssizeunit + }, + huge circuit symbols/.style={circuit symbol unit=10pt}, + large circuit symbols/.style={circuit symbol unit=8pt}, + medium circuit symbols/.style={circuit symbol unit=7pt}, + small circuit symbols/.style={circuit symbol unit=6pt}, + tiny circuit symbols/.style={circuit symbol unit=5pt}, +} + +\newdimen\tikzcircuitssizeunit +\tikzcircuitssizeunit=7pt + + +% +% Annotations +% + +\tikzset{ + circuit declare annotation/.style args={#1#2#3}{% + #1/.style={ + append after command={% + \bgroup + [current point is local=true] + [every circuit annotation/.try] + [every #1/.try] + [shift={(\tikzlastnode.north)}] + [annotation arrow,->] + [label distance=#2,##1] + #3 + \egroup% + } + }, + #1'/.style={ + append after command={% + \bgroup + [current point is local=true] + [every circuit annotation/.try] + [every #1/.try] + [shift={(\tikzlastnode.south)},yscale=-1] + [annotation arrow,->] + [label distance=#2,##1] + #3 + \egroup% + } + } + }, + annotation arrow/.style = { + /utils/exec={\pgfsetarrowoptions{direction ee}{.4*\the\tikzcircuitssizeunit+.3*\the\pgflinewidth}}, + >=direction ee + } +} + + + +% +% Rotating symbols +% +\tikzset{ + point up/.style={rotate=90}, + point down/.style={rotate=-90}, + point left/.style={rotate=180}, + point right/.style={} +} + + + +% +% Basic theming +% + +\tikzset{ + every circuit symbol/.style={}, + circuit symbol open/.style={draw}, + circuit symbol filled/.style={draw,fill=black}, + circuit symbol lines/.style={draw}, + circuit symbol wires/.style={draw}, +} + + + + + +% +% Labels +% + +\tikzset{ + info/.code={\pgfutil@ifnextchar[\tikz@lib@circ@lab@plain{\tikz@lib@circ@lab@plain[]}#1\pgf@stop},%} + info'/.code={\pgfutil@ifnextchar[\tikz@lib@circ@labp@plain{\tikz@lib@circ@labp@plain[]}#1\pgf@stop},%} + info sloped/.code={\pgfutil@ifnextchar[\tikz@lib@circ@lab@sloped@plain{\tikz@lib@circ@lab@sloped@plain[]}#1\pgf@stop},%} + info' sloped/.code={\pgfutil@ifnextchar[\tikz@lib@circ@lab@slopedp@plain{\tikz@lib@circ@lab@slopedp@plain[]}#1\pgf@stop},%} + circuit declare unit/.style 2 args={ + % + % Defines four styles that can be used to add labels to a node. + % + #1/.code={\pgfutil@ifnextchar[\tikz@lib@circ@lab{\tikz@lib@circ@lab[]}##1\pgf@stop{#2}{#1}},%} + #1 sloped/.code={\pgfutil@ifnextchar[\tikz@lib@circ@lab@sloped{\tikz@lib@circ@lab@sloped[]}##1\pgf@stop{#2}{#1}},%} + #1'/.code={\pgfutil@ifnextchar[\tikz@lib@circ@labp{\tikz@lib@circ@labp[]}##1\pgf@stop{#2}{#1}},%} + #1' sloped/.code={\pgfutil@ifnextchar[\tikz@lib@circ@lab@slopedp{\tikz@lib@circ@lab@slopedp[]}##1\pgf@stop{#2}{#1}}%} + } +} + +\def\tikz@lib@circ@lab[#1]#2\pgf@stop#3#4{\tikzset{label={[every info/.try,every #4/.try,#1]$\mathrm{#2#3}$}}} +\def\tikz@lib@circ@lab@sloped[#1]#2\pgf@stop#3#4{\tikzset{label={[every info/.try,every #4/.try,transform shape,#1]$\mathrm{#2#3}$}}} +\def\tikz@lib@circ@labp[#1]#2\pgf@stop#3#4{\tikzset{label={[every info/.try,every #4/.try,#1]below:$\mathrm{#2#3}$}}} +\def\tikz@lib@circ@lab@slopedp[#1]#2\pgf@stop#3#4{\tikzset{label={[every info/.try,every #4/.try,transform shape,#1]below:$\mathrm{#2#3}$}}} + +\def\tikz@lib@circ@lab@plain[#1]#2\pgf@stop{\tikzset{label={[every info/.try,#1]#2}}} +\def\tikz@lib@circ@lab@sloped@plain[#1]#2\pgf@stop{\tikzset{label={[every info/.try,transform shape,#1]#2}}} +\def\tikz@lib@circ@labp@plain[#1]#2\pgf@stop{\tikzset{label={[every info/.try,#1]below:#2}}} +\def\tikz@lib@circ@lab@slopedp@plain[#1]#2\pgf@stop{\tikzset{label={[every info/.try,transform shape,#1]below:#2}}} + + + +\endinput + diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.ee.IEC.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.ee.IEC.code.tex new file mode 100644 index 00000000000..1de9232e63c --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.ee.IEC.code.tex @@ -0,0 +1,376 @@ +% Copyright 2008 by Till Tantau and others Wibrow +% +% This file may be distributed and/or modified +% +% 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. + +\usetikzlibrary{circuits.ee} +\usetikzlibrary{arrows} + +\usepgflibrary{shapes.gates.ee.IEC} + + +% +% When this lib is loaded, all symbols default to IEC +% + +\tikzset{ + circuit ee IEC/.style= + { + circuit ee, + set resistor graphic = resistor IEC graphic, + set inductor graphic = inductor IEC graphic, + set capacitor graphic = capacitor IEC graphic, + set contact graphic = contact IEC graphic, + set ground graphic = ground IEC graphic, + set battery graphic = battery IEC graphic, + set diode graphic = diode IEC graphic, + set Zener diode graphic = Zener diode IEC graphic, + set tunnel diode graphic = tunnel diode IEC graphic, + set backward diode graphic = backward diode IEC graphic, + set Schottky diode graphic = Schottky diode IEC graphic, + set breakdown diode graphic = breakdown diode IEC graphic, + set bulb graphic = bulb IEC graphic, + set voltage source graphic = voltage source IEC graphic, + set current source graphic = current source IEC graphic, + set make contact graphic = make contact IEC graphic, + set break contact graphic = break contact IEC graphic, + } +} + + +% +% Resistors +% + +\tikzset{ + resistor IEC graphic/.style={ + circuit symbol open, + circuit symbol size=width 4 height 1, + shape=rectangle ee, + transform shape + }, + var resistor IEC graphic/.style={ + circuit symbol lines, + circuit symbol size=width 4.8 height 0.8, + shape=var resistor IEC, + transform shape, + outer sep=0pt, + cap=round + } +} + + + +% +% Inductors +% + +\tikzset{ + inductor IEC graphic/.style={ + circuit symbol lines, + circuit symbol size=width 4 height .5, + transform shape, + shape=inductor IEC, + outer sep=0pt, + cap=round + }, + var inductor IEC graphic/.style={ + circuit symbol filled, + circuit symbol size=width 4 height 1, + transform shape, + shape=rectangle ee + } +} + + + +% +% Capacitors +% + +\tikzset{ + capacitor IEC graphic/.style={ + circuit symbol lines, + circuit symbol size=width .5 height 2, + transform shape, + shape=capacitor IEC + } +} + + + +% +% Ground +% + +\tikzset{ + ground IEC graphic/.style={ + circuit symbol lines, + circuit symbol size=width .75 height 2, + transform shape, + shape=ground IEC + } +} + + + + +% +% Battery +% + +\tikzset{ + battery IEC graphic/.style={ + circuit symbol lines, + circuit symbol size=width .5 height 2.5, + transform shape, + shape=battery IEC, + transform shape + } +} + + + +% +% Diodes +% + +\tikzset{ + % + % normal diode + % + diode IEC graphic/.style={ + circuit symbol open, + circuit symbol size=width 1.25 height 1.25, + transform shape, + shape=generic diode IEC, + /pgf/generic diode IEC/before background={ + \pgfpathmoveto{\pgfqpoint{0pt}{-1pt}} + \pgfpathlineto{\pgfqpoint{0pt}{1pt}} + \pgfusepathqstroke + }, + }, + var diode IEC graphic/.style={ + diode IEC graphic, + circuit symbol filled + } +} + +\tikzset{ + % + % Zener diode + % + Zener diode IEC graphic/.style={ + diode IEC graphic, + /pgf/generic diode IEC/before background={ + \pgfpathmoveto{\pgfqpoint{-.5pt}{-1pt}} + \pgfpathlineto{\pgfqpoint{0pt}{-1pt}} + \pgfpathlineto{\pgfqpoint{0pt}{1pt}} + \pgfusepathqstroke + }, + }, + var Zener diode IEC graphic/.style={ + Zener diode IEC graphic, + circuit symbol filled + } +} + +\tikzset{ + % + % Schottky diode + % + Schottky diode IEC graphic/.style={ + diode IEC graphic, + /pgf/generic diode IEC/before background={ + \pgfpathmoveto{\pgfqpoint{-.4pt}{-.6pt}} + \pgfpathlineto{\pgfqpoint{-.4pt}{-1pt}} + \pgfpathlineto{\pgfqpoint{0pt}{-1pt}} + \pgfpathlineto{\pgfqpoint{0pt}{1pt}} + \pgfpathlineto{\pgfqpoint{.4pt}{1pt}} + \pgfpathlineto{\pgfqpoint{.4pt}{.6pt}} + \pgfusepathqstroke + }, + }, + var Schottky diode IEC graphic/.style={ + Schottky diode IEC graphic, + circuit symbol filled + } +} + +\tikzset{ + % + % tunnel diode + % + tunnel diode IEC graphic/.style={ + diode IEC graphic, + /pgf/generic diode IEC/before background={ + \pgfpathmoveto{\pgfqpoint{-.5pt}{-1pt}} + \pgfpathlineto{\pgfqpoint{0pt}{-1pt}} + \pgfpathlineto{\pgfqpoint{0pt}{1pt}} + \pgfpathlineto{\pgfqpoint{-.5pt}{1pt}} + \pgfusepathqstroke + }, + }, + var tunnel diode IEC graphic/.style={ + tunnel diode IEC graphic, + circuit symbol filled + } +} + +\tikzset{ + % + % backward diode + % + backward diode IEC graphic/.style={ + diode IEC graphic, + /pgf/generic diode IEC/before background={ + \pgfpathmoveto{\pgfqpoint{-.5pt}{-1pt}} + \pgfpathlineto{\pgfqpoint{.5pt}{-1pt}} + \pgfpathmoveto{\pgfqpoint{0pt}{-1pt}} + \pgfpathlineto{\pgfqpoint{0pt}{1pt}} + \pgfpathmoveto{\pgfqpoint{-.5pt}{1pt}} + \pgfpathlineto{\pgfqpoint{.5pt}{1pt}} + \pgfusepathqstroke + }, + }, + var backward diode IEC graphic/.style={ + backward diode IEC graphic, + circuit symbol filled + } +} + + +\tikzset{ + % + % breakdown diode + % + breakdown diode IEC graphic/.style={ + circuit symbol open, + circuit symbol size=width 2.5 height 1.25, + transform shape, + shape=breakdown diode IEC, + }, + var breakdown diode IEC graphic/.style={ + breakdown diode IEC graphic, + circuit symbol filled + } +} + + + +% +% Contacts +% + +\tikzset{ + contact IEC graphic/.style={ + circuit symbol filled, + circuit symbol size=width .5 height .5, + shape=circle ee, + outer sep=.25\pgflinewidth + }, +% connection IEC graphic/.style={ +% circuit symbol open, +% circuit symbol size=width 1 height 1, +% shape=circle ee, +% outer sep=.25\pgflinewidth +% } +} + + +% +% Bulbs +% + +\tikzset{ + bulb IEC graphic/.style={ + circuit symbol lines, + circuit symbol size=width 1.5 height 1.5, + shape=generic circle IEC, + /pgf/generic circle IEC/before background={ + \pgfpathmoveto{\pgfpointpolar{-135}{1pt}} + \pgfpathlineto{\pgfpointpolar{45}{1pt}} + \pgfpathmoveto{\pgfpointpolar{-45}{1pt}} + \pgfpathlineto{\pgfpointpolar{135}{1pt}} + \pgfusepathqstroke + }, + transform shape + } +} + + +% +% Current and voltage sources +% + +\tikzset{ + current source IEC graphic/.style={ + circuit symbol lines, + circuit symbol size=width 2 height 2, + shape=generic circle IEC, + /pgf/generic circle IEC/before background={ + \pgfpathmoveto{\pgfqpoint{0pt}{-1pt}} + \pgfpathlineto{\pgfqpoint{0pt}{1pt}} + \pgfusepathqstroke + }, + transform shape + }, + voltage source IEC graphic/.style={ + circuit symbol lines, + circuit symbol size=width 2 height 2, + shape=generic circle IEC, + /pgf/generic circle IEC/before background={ + \pgfpathmoveto{\pgfqpoint{-1pt}{0pt}} + \pgfpathlineto{\pgfqpoint{1pt}{0pt}} + \pgfusepathqstroke + }, + transform shape + } +} + + + +% +% Contacts +% + +\tikzset{ + make contact IEC graphic/.style={ + circuit symbol wires, + circuit symbol size=width 2 height 1, + transform shape, + shape=make contact IEC, + outer sep=0pt, + cap=round + }, + var make contact IEC graphic/.style={ + circuit symbol wires, + circuit symbol size=width 2.4 height 1, + transform shape, + shape=var make contact IEC, + outer sep=0pt, + cap=round + } +} + + +\tikzset{ + break contact IEC graphic/.style={ + circuit symbol wires, + circuit symbol size=width 2 height 1, + transform shape, + shape=break contact IEC, + outer sep=0pt, + cap=round + }, +} + + + + +\endinput + diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.ee.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.ee.code.tex new file mode 100644 index 00000000000..91641309ab5 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.ee.code.tex @@ -0,0 +1,158 @@ + +% Copyright 2008 by Till Tantau and others Wibrow +% +% This file may be distributed and/or modified +% +% 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. + +\usetikzlibrary{circuits} +\usepgflibrary{shapes.gates.ee} + + +% +% Setting up an ee circuit +% +\tikzset{ + circuit ee/.style={ + circuit, + every circuit ee/.try + } +} + + +% +% The default symbols (you need to load a sublib to install the actual rendering). +% + +\tikzset{ + circuit declare symbol = resistor, + circuit declare symbol = inductor, + circuit declare symbol = capacitor, + circuit declare symbol = contact, + circuit declare symbol = ground, + circuit declare symbol = battery, + circuit declare symbol = diode, + circuit declare symbol = Zener diode, + circuit declare symbol = Schottky diode, + circuit declare symbol = tunnel diode, + circuit declare symbol = backward diode, + circuit declare symbol = breakdown diode, + circuit declare symbol = bulb, + circuit declare symbol = current source, + circuit declare symbol = voltage source, + circuit declare symbol = current direction, + circuit declare symbol = current direction', + circuit declare symbol = make contact, + circuit declare symbol = break contact, + % + set current direction graphic = current direction ee graphic, + set current direction' graphic = current direction' ee graphic, +} + + +% +% The default labels +% + +\tikzset{ + circuit declare unit={ampere}{A}, + circuit declare unit={volt}{V}, + circuit declare unit={ohm}{\Omega}, + circuit declare unit={siemens}{S}, + circuit declare unit={henry}{H}, + circuit declare unit={farad}{F}, + circuit declare unit={coulomb}{C}, + circuit declare unit={voltampere}{VA}, + circuit declare unit={watt}{W}, + circuit declare unit={hertz}{Hz}, +} + + + +% +% The direction and arrow settings +% + +\tikzset{ + % These styles should set the end-arrow. + % + % This arrow will generally be used to indicate current directions in a circuit: + current direction arrow/.style = { + /utils/exec={\pgfsetarrowoptions{direction ee}{1.3065*.5*\the\tikzcircuitssizeunit+1.3065*.3*\the\pgflinewidth}}, + >=direction ee, + direction ee arrow = direction ee, + } +} + + + + +\tikzset{ + current direction ee graphic/.style = { + shape=direction ee, + circuit symbol filled, + current direction arrow, + minimum width = .5*\the\tikzcircuitssizeunit+.3*\the\pgflinewidth, + minimum height = .5*\the\tikzcircuitssizeunit+.3*\the\pgflinewidth, + transform shape + }, + current direction' ee graphic/.style = { + current direction ee graphic, + rotate=180 + } +} + + + +% +% Annotations +% + +\tikzset{ + circuit declare annotation={direction info}{.5\tikzcircuitssizeunit} + { + (-1.25\tikzcircuitssizeunit,.3333\tikzcircuitssizeunit) edge[line to] (1.25\tikzcircuitssizeunit,.3333\tikzcircuitssizeunit) + }, + circuit declare annotation={light emitting}{1.75\tikzcircuitssizeunit} + { + (-.2\tikzcircuitssizeunit,.65\tikzcircuitssizeunit) edge[line to] ++(45:1.25\tikzcircuitssizeunit) + (.2\tikzcircuitssizeunit,.25\tikzcircuitssizeunit) edge[line to] ++(45:1.25\tikzcircuitssizeunit) + }, + circuit declare annotation={light dependent}{1.75\tikzcircuitssizeunit} + { + [shift=(135:1.25\tikzcircuitssizeunit)] + (.2\tikzcircuitssizeunit,.65\tikzcircuitssizeunit) edge[line to] ++(-45:1.25\tikzcircuitssizeunit) + (-.2\tikzcircuitssizeunit,.25\tikzcircuitssizeunit) edge[line to] ++(-45:1.25\tikzcircuitssizeunit) + }, + adjustable/.style={ + append after command={% + \bgroup + [current point is local=true] + [every adjustable/.try] + [annotation arrow,->] + let \p1=(\tikzlastnode.north), \p2=(\tikzlastnode.south) in + [label distance=1.5\tikzcircuitssizeunit-.5*abs(\y2-\y1),#1] + (-1.5\tikzcircuitssizeunit,-1.5\tikzcircuitssizeunit) edge[line to] (1.5\tikzcircuitssizeunit,1.5\tikzcircuitssizeunit) + \egroup% + } + }, + adjustable'/.style={ + append after command={% + \bgroup + [current point is local=true,yscale=-1] + [every adjustable/.try] + [annotation arrow,->] + let \p1=(\tikzlastnode.north), \p2=(\tikzlastnode.south) in + [label distance=1.5\tikzcircuitssizeunit-.5*abs(\y2-\y1),#1] + (-1.5\tikzcircuitssizeunit,-1.5\tikzcircuitssizeunit) edge[line to] (1.5\tikzcircuitssizeunit,1.5\tikzcircuitssizeunit) + \egroup% + } + } +} + + +\endinput + diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.CDH.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.CDH.code.tex new file mode 100644 index 00000000000..4fe276ff0a0 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.CDH.code.tex @@ -0,0 +1,29 @@ +% Copyright 2008 by Till Tantau and others Wibrow +% +% This file may be distributed and/or modified +% +% 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. + +\usetikzlibrary{circuits.logic.US} + +\tikzset{ + circuit logic CDH/.style = + { + circuit logic US, + set and gate graphic = and gate CDH graphic, + set nand gate graphic = nand gate CDH graphic, + } +} + +\tikzset{ + circuit logic US make graphic=and gate CDH, + circuit logic US make graphic=nand gate CDH, +} + + + +\endinput + diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.IEC.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.IEC.code.tex new file mode 100644 index 00000000000..64d1f764b71 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.IEC.code.tex @@ -0,0 +1,76 @@ +% Copyright 2008 by Till Tantau and others Wibrow +% +% This file may be distributed and/or modified +% +% 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. + +\usetikzlibrary{circuits.logic} +\usepgflibrary{shapes.gates.logic.IEC} + + +% +% When this lib is loaded, all symbols default to IEC +% + +\tikzset{ + circuit logic IEC/.style= + { + circuit logic, + set and gate graphic = and gate IEC graphic, + set nand gate graphic = nand gate IEC graphic, + set or gate graphic = or gate IEC graphic, + set nor gate graphic = nor gate IEC graphic, + set xor gate graphic = xor gate IEC graphic, + set xnor gate graphic = xnor gate IEC graphic, + set not gate graphic = not gate IEC graphic, + set buffer gate graphic = buffer gate IEC graphic, + % + and gate IEC symbol = {$\scriptstyle\char`\&$}, + nand gate IEC symbol = {$\scriptstyle\char`\&$}, + or gate IEC symbol = {$\scriptstyle\geq1$}, + nor gate IEC symbol = {$\scriptstyle\geq1$}, + xor gate IEC symbol = {$\scriptstyle=1$}, + xnor gate IEC symbol = {$\scriptstyle=1$}, + not gate IEC symbol = {$\scriptstyle1$}, + buffer gate IEC symbol = {$\scriptstyle1$}, + }, +} + + +% +% The logical gate graphics are all nearly identical, so we provide a +% simple style for creating them: +% +\tikzset{ + circuit logic IEC make graphic/.style= + { + #1 graphic/.style={ + circuit symbol open, + circuit symbol size=width 2.5 height 4, + shape=#1, + inner sep=.5ex + } + } +} + + +\tikzset{ + circuit logic IEC make graphic=and gate IEC, + circuit logic IEC make graphic=nand gate IEC, + circuit logic IEC make graphic=or gate IEC, + circuit logic IEC make graphic=nor gate IEC, + circuit logic IEC make graphic=xor gate IEC, + circuit logic IEC make graphic=xnor gate IEC, + circuit logic IEC make graphic=not gate IEC, + circuit logic IEC make graphic=buffer gate IEC, + circuit logic IEC make graphic=and gate CDH, + circuit logic IEC make graphic=nand gate CDH, +} + + + +\endinput + diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.US.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.US.code.tex new file mode 100644 index 00000000000..1f724912549 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.US.code.tex @@ -0,0 +1,65 @@ +% Copyright 2008 by Till Tantau and others Wibrow +% +% This file may be distributed and/or modified +% +% 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. + +\usetikzlibrary{circuits.logic} +\usepgflibrary{shapes.gates.logic.US} + + +% +% When this lib is loaded, all symbols default to IEC +% + +\tikzset{ + circuit logic US/.style= + { + circuit logic, + set and gate graphic = and gate US graphic, + set nand gate graphic = nand gate US graphic, + set or gate graphic = or gate US graphic, + set nor gate graphic = nor gate US graphic, + set xor gate graphic = xor gate US graphic, + set xnor gate graphic = xnor gate US graphic, + set not gate graphic = not gate US graphic, + set buffer gate graphic = buffer gate US graphic + } +} + + +% +% The logical gate graphics are all nearly identical, so we provide a +% simple style for creating them: +% +\tikzset{ + circuit logic US make graphic/.style= + { + #1 graphic/.style={ + circuit symbol open, + circuit symbol size=width 0 height 2.5, + shape=#1, + transform shape + } + } +} + + +\tikzset{ + circuit logic US make graphic=and gate US, + circuit logic US make graphic=nand gate US, + circuit logic US make graphic=or gate US, + circuit logic US make graphic=nor gate US, + circuit logic US make graphic=xor gate US, + circuit logic US make graphic=xnor gate US, + circuit logic US make graphic=not gate US, + circuit logic US make graphic=buffer gate US, +} + + + +\endinput + diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.code.tex new file mode 100644 index 00000000000..0fc662f92c5 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.code.tex @@ -0,0 +1,46 @@ +% Copyright 2008 by Till Tantau and Mark Wibrow +% +% This file may be distributed and/or modified +% +% 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. + +\usetikzlibrary{circuits} + + + +% +% Provides a shortcut to the "logic gates inputs" key. +% + +\tikzset{ + circuit logic/.style={ + circuit, + inputs/.style={logic gate inputs={##1}}, + logic gate inverted radius=.25\tikzcircuitssizeunit, + every circuit logic/.try, + } +} + + + +% +% The default symbols (you need to load a sublib to install the actual rendering). +% + +\tikzset{ + circuit declare symbol = and gate, + circuit declare symbol = nand gate, + circuit declare symbol = or gate, + circuit declare symbol = nor gate, + circuit declare symbol = xor gate, + circuit declare symbol = xnor gate, + circuit declare symbol = not gate, + circuit declare symbol = buffer gate +} + + +\endinput + diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.3d.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.3d.code.tex new file mode 100644 index 00000000000..8018de58018 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.3d.code.tex @@ -0,0 +1,80 @@ +% Copyright 2008 by Till Tantau +% +% This file may be distributed and/or modified +% +% 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. + +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.3d.code.tex,v 1.1 2008/12/17 22:48:46 tantau Exp $ + +\usetikzlibrary{datavisualization} + + + +% The following is not yet really implement. But you might get the idea... + + + +% A 3d version of the school book plot + +\tikzdatavisualizationset{ + school book 3d plot/.style={ + xyz Cartesian, + x axis={ + visualize axis={y axis={goto=0},z axis={goto=0},styling/.style=->}, + visualize ticks={common={y axis={goto=0},z axis={goto=0},direction axis=y axis},only ticks={tick text at min extend}}, +% visualize ticks={common={y axis={goto=0},z axis={goto=0},direction axis=z axis}}, + }, + y axis={ + visualize axis={x axis={goto=0},z axis={goto=0},styling/.style=->}, + visualize ticks={common={x axis={goto=0},z axis={goto=0},direction axis=x axis},only ticks={tick text at min extend}}, +% visualize ticks={common={x axis={goto=0},z axis={goto=0},direction axis=z axis}}, + }, + z axis={ + visualize axis={x axis={goto=0},y axis={goto=0},styling/.style=->}, + visualize ticks={common={x axis={goto=0},y axis={goto=0},direction axis=x axis},only ticks={tick text at min extend}}, +% visualize ticks={common={x axis={goto=0},y axis={goto=0},direction axis=y axis}} + }, + new line plot, + every school book plot/.try + } +} + + +% A 3d version of the scientific plot +% +% Here, a "length" is used for the length of the three +% axes, rather than a predetermined rectangle (this does not really +% make sense for the z-axis. You overrule these settings easily. + +\tikzdatavisualizationset{ + scientific 3d plot/length/.initial=100pt, + scientific 3d plot/.style={ + xyz Cartesian, + x axis={ + length=\pgfkeysvalueof{/tikz/data visualization/scientific 3d plot/length}, + visualize axis={y axis={goto=min},z axis={goto=min}}, + visualize axis={y axis={goto=max},z axis={goto=min}}, + visualize axis={y axis={goto=min},z axis={goto=max}}, + visualize axis={y axis={goto=max},z axis={goto=max}} + }, + y axis={ + length=\pgfkeysvalueof{/tikz/data visualization/scientific 3d plot/length}, + visualize axis={x axis={goto=min},z axis={goto=min}}, + visualize axis={x axis={goto=max},z axis={goto=min}}, + visualize axis={x axis={goto=min},z axis={goto=max}}, + visualize axis={x axis={goto=max},z axis={goto=max}} + }, + z axis={ + length=\pgfkeysvalueof{/tikz/data visualization/scientific 3d plot/length}, + visualize axis={x axis={goto=min},y axis={goto=min}}, + visualize axis={x axis={goto=max},y axis={goto=min}}, + visualize axis={x axis={goto=min},y axis={goto=max}}, + visualize axis={x axis={goto=max},y axis={goto=max}} + }, + new line plot + } +} + diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.barcharts.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.barcharts.code.tex new file mode 100644 index 00000000000..40fa0e87169 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.barcharts.code.tex @@ -0,0 +1,43 @@ +% Copyright 2008 by Till Tantau +% +% This file may be distributed and/or modified +% +% 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. + +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.barcharts.code.tex,v 1.2 2008/07/21 06:22:22 tantau Exp $ + +\usetikzlibrary{datavisualization} +\usepgflibrary{datavisualization.barcharts} + + +\tikzdatavisualizationset{% + candle stick plot/.style={ + new object={ + store=/tikz/data visualization/count, + class=count, + arg1=day + }, + new axis=y axis, + y axis/source=dax, + y axis/source max=100, + y axis/vec=\pgfqpoint{0cm}{1cm}, + new object={ + store=/tikz/data visualization/x line trans, + class=line transformer, + arg1=day, + arg2=\pgfqpoint{3mm}{0mm} + }, + new object={ + store=/tikz/data visualization/index, + class=candle stick visualizer, + arg1 from key=index/source + }, + }, + index/source/.initial=index, +} + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.code.tex new file mode 100644 index 00000000000..c717e95cf7b --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.code.tex @@ -0,0 +1,2278 @@ +% Copyright 2008 by Till Tantau +% +% This file may be distributed and/or modified +% +% 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. + +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.code.tex,v 1.31 2010/09/15 22:27:36 tantau Exp $ + +\usepgfmodule{datavisualization} +\usetikzlibrary{backgrounds} + + +\tikzset{/tikz/data visualization/.is family, + /tikz/data visualization/.unknown/.code={ + \let\tikz@dv@key\pgfkeyscurrentname% + \pgfkeys{/tikz/\tikz@dv@key/.try={#1}}% + \ifpgfkeyssuccess% + \else% + \pgfkeys{/errors/unknown key={/tikz/data visualization/\tikz@dv@key}{#1}}% + \fi% + }, + /tikz/data visualization/data/.unknown/.code={% + % Redirect to /pgf/data + \let\tikz@dv@key\pgfkeyscurrentname% + \pgfkeys{/pgf/data/\tikz@dv@key/.try={#1}}% + \ifpgfkeyssuccess% + \else% + \pgfkeys{/errors/unknown key={/pgf/data/\tikz@dv@key}{#1}}% + \fi% + } +} + +\def\tikzdatavisualizationset{\pgfqkeys{/tikz/data visualization}} + + + + +% The main \datavisualization command +% +% This command must, as always, be given inside a tikz picture. It +% will add a data visualization to the picture; use "shift" option and +% friends to place the data visualization somewhere other than at the +% origin. +% +% The \datavisualization is followed by a sequence of blocks and ended +% with a semicolon. Each block may be one of the following: +% +% "data" blocks. +% +% Syntax: data [options] % options specify an external source +% Syntax: data [options] { inline data } +% +% The optional arguments may either specify an +% external data source or the data may follow inline. +% +% The options are executed for the path /pgf/data. The style +% /tikz/every data is executed for each data, which can be useful to +% generally set, say, a certain data format. +% +% "info" blocks. +% +% Syntax: info [options] {code} +% +% A block starting with "info" may contain any code. It +% will be executed after the visualization. In order to execute code +% at some other time (like, say, before the visualization), use +% options like "before visualization". +% +% Options blocks. +% +% Syntax: [options] +% +% The options will be executed immediately. +% +% Scope blocks. +% +% Syntax: scope[options] { blocks } +% +% The blocks are executed inside a scope for which the options are +% set. This can be used to group data blocks. +% +% Examples: +% +% \datavisualization[schoolbook plot] +% data [source=my_data_file.csv] +% ; +% +% \datavisualization[schoolbook plot] +% data [format=key value pairs] +% { +% x=0, y=0 +% x=1, y=1 +% x=2, y=4 +% x=3, y=9 +% }; +% +% \datavisualization[schoolbook plot] +% data [format=function] +% { +% var x: interval [0:3]; +% func y = \value x*\value x; +% } +% [before visualization={ +% \fill [black!10] (visualization cs:x=0,y=0) -- (visualization cs:x=3,y=9); +% }] +% info[red] +% { +% \draw (visualization cs:x=0,y=0) -- (visualization cs:x=3,y=9); +% }; +% +% \datavisualization[schoolbook plot] +% data [/data point/label=first experiment,source=file_1] +% data [/data point/label=second experiment,source=file_2] +% data [/data point/label=third experiment,source=file_3] +% data [/data point/label=prediction,format=function] +% { var x: interval [0,1]; func y = rand(\value x); } +% ; + +\def\tikz@lib@datavisualization{ + \begingroup% + % Ok, first, start a new data visualization + \pgfoonew \tikz@main@dv=new data visualization()% + % Next, create a scope for the dv + \pgfset{local bounding box=data visualization bounding box}% + % Clear the axis list + \pgfkeyslet{/tikz/data visualization/axes list}\pgfutil@empty% + \pgfkeyslet{/tikz/data visualization/axes actions}\pgfutil@empty% + \pgfkeyslet{/tikz/data visualization/label actions}\pgfutil@empty% + \pgfkeyslet{/tikz/data visualization/legend actions}\pgfutil@empty% + \pgfkeyslet{/tikz/data visualization/grid actions}\pgfutil@empty% + \pgfkeyslet{/tikz/data visualization/major grid actions}\pgfutil@empty% + \pgfkeyslet{/tikz/data visualization/minor grid actions}\pgfutil@empty% + \pgfkeyslet{/tikz/data visualization/subminor grid actions}\pgfutil@empty% + \pgfkeyslet{/tikz/data visualization/ticks actions}\pgfutil@empty% + \pgfkeyslet{/tikz/data visualization/major ticks actions}\pgfutil@empty% + \pgfkeyslet{/tikz/data visualization/minor ticks actions}\pgfutil@empty% + \pgfkeyslet{/tikz/data visualization/subminor ticks actions}\pgfutil@empty% + \tikz@main@dv.before visualization(% + )% + \tikz@main@dv.after visualization(% + \pgfkeysvalueof{/tikz/data visualization/grid actions} + \pgfkeysvalueof{/tikz/data visualization/subminor grid actions} + \pgfkeysvalueof{/tikz/data visualization/minor grid actions} + \pgfkeysvalueof{/tikz/data visualization/major grid actions} + \pgfkeysvalueof{/tikz/data visualization/ticks actions} + \pgfkeysvalueof{/tikz/data visualization/subminor ticks actions} + \pgfkeysvalueof{/tikz/data visualization/minor ticks actions} + \pgfkeysvalueof{/tikz/data visualization/major ticks actions} + \pgfkeysvalueof{/tikz/data visualization/axes actions} + \pgfkeysvalueof{/tikz/data visualization/label actions} + \pgfkeysvalueof{/tikz/data visualization/legend actions} + )% + % + \pgfset{/pgf/data/continue code=\tikz@lib@dv@parse@loop}% + % Now enter parse loop + \tikz@lib@dv@parse@loop +} + +\def\tikz@lib@dv@parse@loop{% + \pgfutil@ifnextchar d\tikz@lib@dv@handle@data{% + \pgfutil@ifnextchar ;\tikz@lib@dv@parse@end{% + \pgfutil@ifnextchar \par\tikz@lib@dv@handle@par{% + \pgfutil@ifnextchar s\tikz@lib@dv@handle@beginscope{% + \pgfutil@ifnextchar i\tikz@lib@dv@handle@info{% + \pgfutil@ifnextchar [\tikz@lib@dv@handle@options{% + \pgfutil@ifnextchar \egroup\tikz@lib@dv@handle@endscope{% + \PackageError{tikz}{Semicolon expected}{}% + \endgroup% + }% + }% + }% + }% + }% + }% + }% +} +\def\tikz@lib@dv@parse@end{% + % Go! + \tikz@main@dv.survey()% + \tikz@main@dv.visualize()% + \endgroup% +} +\def\tikz@lib@dv@handle@par\par{\tikz@lib@dv@parse@loop} + +\def\tikz@lib@dv@handle@options[#1]{% + \tikzdatavisualizationset{#1}% + \tikz@lib@dv@parse@loop% +} + +\def\tikz@lib@dv@handle@beginscope scope{% + \begingroup% + \pgfutil@ifnextchar[\tikz@lib@dv@beg@opt{\tikz@lib@dv@beg@opt[]}%} +} +\def\tikz@lib@dv@beg@opt[#1]{% + \pgfkeys{/pgf/data/.cd,/pgf/every data/.try,#1}% + \pgfkeysvalueof{/pgf/data visualization/obj}.add data({{\begingroup\pgfkeys{/pgf/data/.cd,/pgf/every data/.try,#1}}})% + \pgfutil@ifnextchar\bgroup{ + \afterassignment\tikz@lib@dv@parse@loop% + \let\tikz@dummy=%get rid of \bgroup + }{% + \PackageError{pgf}{Opening brace expected}{}% + }% +} +\def\tikz@lib@dv@handle@endscope{% + \pgfkeysvalueof{/pgf/data visualization/obj}.add data(\endgroup)% + \endgroup% + \afterassignment\tikz@lib@dv@parse@loop% + \let\tikz@dummy=%get rid of \egroup +} + +\def\tikz@lib@dv@handle@data data{\pgfdata} + +\def\tikz@lib@dv@handle@info info{ + \pgfutil@ifnextchar[{\tikz@lib@dv@handle@info@block@opt}{\tikz@lib@dv@handle@info@block@opt[]}}%} +\def\tikz@lib@dv@handle@info@block@opt[#1]#2{% + \tikz@main@dv.after visualization({{\scope[#1]#2\endscope}})% + \tikz@lib@dv@parse@loop +} + + +\pgfset{/pgf/every data/.style={/tikz/every data/.try,/tikz/data visualization/every data/.try}} + + +% +% Performing before/after stuff via keys +% + +\tikzdatavisualizationset{ + before survey/.code=\tikz@main@dv.before survey({{#1}}), + after survey/.code=\tikz@main@dv.after survey({{#1}}), + before visualization/.code=\tikz@main@dv.before visualization({{#1}}), + after visualization/.code=\tikz@main@dv.after visualization({{#1}}), + at start survey/.code=\tikz@main@dv.at start survey({{#1}}), + at end survey/.code=\tikz@main@dv.at end survey({{#1}}), + at start visualization/.code=\tikz@main@dv.at start visualization({{#1}}), + at end visualization/.code=\tikz@main@dv.at end visualization({{#1}}), +} + + + +% +% Object setup +% + +% The following key is used to create objects for the rendering +% pipeline. They cannot be created "directly" because when it is known +% that the objects needs to be created, in principle, many keys may +% not yet be known. +% +% The following options are used: +% +% store = key that will store the object (handle) +% class = class of the object +% arg1 = argument1 of the constructor +% ... +% arg8 = argument8 of the constructor +% when = specifies when the object will be created. Defaults to +% "before survey", other possible values are "after survey" and +% "before/after visualization" +% before creation = code to be executed just before the object is +% created +% after creation = code to be executed just after the object has been created +% +% The following styles may be useful: +% +% arg1 from key = use the contents of the given key as arg1. Similar +% for other args +% arg1 handle from key = the contents of the given key should contain +% an object. Then arg1 will be a handle to this +% object. Similar for other args + +\tikzdatavisualizationset{% + new object/.code={% + \def\tikz@dv@grabbed@when{before survey}% + \let\tikz@dv@grabbed@store\pgfutil@empty + \pgfkeys{/tikz/data visualization/new object/grab/.cd,#1}% + \ifx\tikz@dv@grabbed@store\pgfutil@empty + \else + \pgfkeyslet{\tikz@dv@grabbed@store}\pgfutil@empty% + \fi + \edef\tikz@marshal{\noexpand\tikz@main@dv.\tikz@dv@grabbed@when(\noexpand\tikz@dv@newobject{\tikz@dv@grabbed@store}}% + \tikz@marshal{#1})% + }, + new object/grab/store/.store in=\tikz@dv@grabbed@store, + new object/grab/when/.store in=\tikz@dv@grabbed@when, + new object/grab/.unknown/.code={},%ignore +} + +\def\tikz@dv@newobject#1#2{% + \def\tikz@dv@new@obj@store{#1}% + \ifx\tikz@dv@new@obj@store\pgfutil@empty% + \let\tikz@dv@new@obj=\pgfutil@empty% + \else% + \pgfkeysgetvalue\tikz@dv@new@obj@store\tikz@dv@new@obj% + \fi% + \ifx\tikz@dv@new@obj\pgfutil@empty + \let\tikz@dv@arg@a=\tikz@lib@notused% + \let\tikz@dv@arg@b=\tikz@lib@notused% + \let\tikz@dv@arg@c=\tikz@lib@notused% + \let\tikz@dv@arg@d=\tikz@lib@notused% + \let\tikz@dv@arg@e=\tikz@lib@notused% + \let\tikz@dv@arg@f=\tikz@lib@notused% + \let\tikz@dv@arg@g=\tikz@lib@notused% + \let\tikz@dv@arg@h=\tikz@lib@notused% + \let\tikz@dv@new@after=\relax% + \pgfkeys{/tikz/data visualization/new object/parse/.cd,#2} + \edef\pgf@marshal{\noexpand\pgfoonew\noexpand\tikzdvobj=new \tikz@dv@new@class(}% + \tikz@dv@add@arg{}\tikz@dv@arg@a% + \tikz@dv@add@arg{\expandafter,}\tikz@dv@arg@b% + \tikz@dv@add@arg{\expandafter,}\tikz@dv@arg@c% + \tikz@dv@add@arg{\expandafter,}\tikz@dv@arg@d% + \tikz@dv@add@arg{\expandafter,}\tikz@dv@arg@e% + \tikz@dv@add@arg{\expandafter,}\tikz@dv@arg@f% + \tikz@dv@add@arg{\expandafter,}\tikz@dv@arg@g% + \tikz@dv@add@arg{\expandafter,}\tikz@dv@arg@h% + \expandafter\def\expandafter\pgf@marshal\expandafter{\pgf@marshal)}% + \pgf@marshal% + \tikzdvobj.default connects()% + \ifx\tikz@dv@new@obj@store\pgfutil@empty% + \else% + \pgfkeyslet\tikz@dv@new@obj@store\tikzdvobj% + \fi% + \tikz@dv@new@after% + \fi +} +\def\tikz@lib@notused{\tikz@lib@notused} + +\def\tikz@dv@add@arg#1#2{% + \ifx#2\tikz@lib@notused% + \else% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\pgf@marshal% + \expandafter\expandafter\expandafter{\expandafter\pgf@marshal#1#2}% + \fi% +} + +\tikzdatavisualizationset{% + new object/parse/.cd, + store/.code=,% ignore + when/.code=,% ignore + class/.store in=\tikz@dv@new@class, + before creation/.code=#1, + after creation/.store in=\tikz@dv@new@after, + arg1/.store in=\tikz@dv@arg@a, + arg2/.store in=\tikz@dv@arg@b, + arg3/.store in=\tikz@dv@arg@c, + arg4/.store in=\tikz@dv@arg@d, + arg5/.store in=\tikz@dv@arg@e, + arg6/.store in=\tikz@dv@arg@f, + arg7/.store in=\tikz@dv@arg@g, + arg8/.store in=\tikz@dv@arg@h, + arg1 from key/.code=\pgfkeysgetvalue{#1}{\tikz@dv@arg@a}, + arg2 from key/.code=\pgfkeysgetvalue{#1}{\tikz@dv@arg@b}, + arg3 from key/.code=\pgfkeysgetvalue{#1}{\tikz@dv@arg@c}, + arg4 from key/.code=\pgfkeysgetvalue{#1}{\tikz@dv@arg@d}, + arg5 from key/.code=\pgfkeysgetvalue{#1}{\tikz@dv@arg@e}, + arg6 from key/.code=\pgfkeysgetvalue{#1}{\tikz@dv@arg@f}, + arg7 from key/.code=\pgfkeysgetvalue{#1}{\tikz@dv@arg@g}, + arg8 from key/.code=\pgfkeysgetvalue{#1}{\tikz@dv@arg@h} + arg1 handle from key/.code=\tikz@dv@handle@from@key{#1}{\tikz@dv@handle@a}{\tikz@dv@arg@a}, + arg2 handle from key/.code=\tikz@dv@handle@from@key{#1}{\tikz@dv@handle@b}{\tikz@dv@arg@b}, + arg3 handle from key/.code=\tikz@dv@handle@from@key{#1}{\tikz@dv@handle@c}{\tikz@dv@arg@c}, + arg4 handle from key/.code=\tikz@dv@handle@from@key{#1}{\tikz@dv@handle@d}{\tikz@dv@arg@d}, + arg5 handle from key/.code=\tikz@dv@handle@from@key{#1}{\tikz@dv@handle@e}{\tikz@dv@arg@e}, + arg6 handle from key/.code=\tikz@dv@handle@from@key{#1}{\tikz@dv@handle@f}{\tikz@dv@arg@f}, + arg7 handle from key/.code=\tikz@dv@handle@from@key{#1}{\tikz@dv@handle@g}{\tikz@dv@arg@g}, + arg8 handle from key/.code=\tikz@dv@handle@from@key{#1}{\tikz@dv@handle@h}{\tikz@dv@arg@h} +} + +\def\tikz@dv@handle@from@key#1#2#3{% + \pgfkeysvalueof{#1}.get handle(#2)% + \def#3{#2}% +} + + + + +% +% Data visualization coordinate system +% +% +% This cs is used to refer to points in a datavisualization. The +% parameters are keys that are set in the /data point key +% directory. Then, a (virtual) data point is created and the +% calculated position is returned + +\tikzdeclarecoordinatesystem{visualization} +{% + \tikzset{/data point/.cd,#1}% + \pgfpointdvlocaldatapoint% +} + + + + +% +% +% Axes +% +% + + + +% +% Axis base +% + +\tikzdatavisualizationset{% + new axis/.style={ + new object={ + class=scaling mapper, + store=/tikz/data visualization/#1/scaling mapper, + before creation={ + \pgfkeysgetvalue{/tikz/data visualization/#1/scaling}\tikz@temp + \ifx\tikz@temp\pgfutil@empty% + \pgfkeysgetvalue{/tikz/data visualization/#1/scaling/default}\tikz@temp + \fi + \expandafter\tikz@dv@lib@parse@scaling\tikz@temp\pgf@stop% + \pgfkeyslet{/tikz/data visualization/#1/scaling}\tikz@temp + }, + arg1 from key=/tikz/data visualization/#1/attribute, + arg2/.expanded=\pgfkeysvalueof{/tikz/data visualization/#1/attribute}/scaled, + arg3 from key=/tikz/data visualization/#1/scaling, + arg4 from key=/tikz/data visualization/#1/function + }, + #1/attribute/.initial=#1, + #1/function/.initial=, + #1/scaling/.initial=, + #1/scaling/default/.initial=0 at 0 and 1 at 1, + #1/ticks at/.initial=, + #1/default ticks at/.initial=, + #1/major ticks/.initial=, + #1/minor ticks/.initial=, + #1/subminor ticks/.initial=, + #1/grid at/.initial=, + #1/default grid at/.initial=, + #1/major grid/.initial=, + #1/minor grid/.initial=, + #1/subminor grid/.initial=, + #1/label/.initial=, + #1/padding min/.initial=, + #1/padding max/.initial=, + #1/.code={ + \let\tikz@temp\tikz@dv@axis% + \def\tikz@dv@axis{/tikz/data visualization/#1}% + \expandafter\tikz@do@axis@options\expandafter{\tikz@temp}{##1}% + }, + #1/@compute at positions/.initial=\tikz@lib@dv@compute@at@linear, + axes list/.append={\tikz@lib@dv@do@axis{#1}} + }, + all axes/.code={ + \def\tikz@lib@dv@args{#1}% + \pgfkeysvalueof{/tikz/data visualization/axes list}% + }, + % General styling + styling/.style=, + style/.style={styling/.append style={#1}}, + @node styling/.initial=, + node styling/.style={% + /utils/exec={\pgfkeysgetvalue{/tikz/data visualization/@node styling}\tikz@temp\expandafter\tikzset\expandafter{\tikz@temp}}}, + node style/.style={/tikz/data visualization/@node styling/.append={,#1}}, + grid styling/.style=, + grid style/.style={grid styling/.append style={#1}}, + % General extends (both axes, grid and ticks) + low/.initial=0, + high/.initial=0, + padded/.style={low=padded min,high=padded max}, + tick length/.style={low={-#1},high={#1}}, + % General tick and grid keys: + common/.initial=, + major/.initial=, + minor/.initial=, + subminor/.initial=, + @setup at setters/.style={ + common/.code=\tikz@lib@dv@add@{common}{##1}, + major/.code=\tikz@lib@dv@add@{major}{##1}, + minor/.code=\tikz@lib@dv@add@{minor}{##1}, + subminor/.code=\tikz@lib@dv@add@{subminor}{##1} + }, + @setup at setters, + % Tick keys + direction axis/.initial=, + value/.initial=, + pos/.initial=, + tick text at low/.is if=tikz@dv@min@tick@node, + tick text at high/.is if=tikz@dv@max@tick@node, + no tick text/.style={tick text at low=false,tick text at high=false}, + every major ticks/.style={style={line cap=round},tick length=2pt}, + every minor ticks/.style={style={help lines,thin,line cap=round},tick length=1.4pt}, + every subminor ticks/.style={style={help lines,line cap=round},tick length=0.8pt}, + clean ticks/.style={node style={fill=white}}, + % Default grid styles + grid style={high=max,low=min}, + every major grid/.style={style={help lines,thin,black!25}}, + every minor grid/.style={style={help lines,black!25}}, + every subminor grid/.style={style={help lines,black!10}}, + at default ticks/.code={% + \expandafter\pgfkeysalso\expandafter{\tikz@lib@dv@ticks@default@at}}, + at ticks/.code={% + \expandafter\pgfkeysalso\expandafter{\tikz@lib@dv@ticks@default@at}% + \expandafter\pgfkeysalso\expandafter{\tikz@lib@dv@ticks@at}}, +} + +\def\tikz@lib@dv@add@#1#2{\pgfkeysaddvalue{/tikz/data visualization/#1}{}{,#2}} + +\def\tikz@dv@lib@parse@scaling#1 at#2and #3 at#4\pgf@stop{% + \pgfmathsetmacro{\tikz@dv@lib@min@at}{#2} + \pgfmathsetmacro{\tikz@dv@lib@max@at}{#4} + \edef\tikz@temp{#1 at \tikz@dv@lib@min@at and #3 at \tikz@dv@lib@max@at}% +} + + +% Ticks at +\tikzdatavisualizationset{ + at/.code={\def\tikz@dv@at@list{#1}}, + also at/.code={\expandafter\def\expandafter\tikz@dv@at@list\expandafter{\tikz@dv@at@list,{#1}}}, + major at/.style={major={at={#1}}}, + minor at/.style={minor={at={#1}}}, + subminor at/.style={subminor={at={#1}}}, + major also at/.style={major={also at={#1}}}, + minor also at/.style={minor={also at={#1}}}, + subminor also at/.style={subminor={also at={#1}}}, + options at/.code={\expandafter\def\expandafter\tikz@dv@style@at@list\expandafter{\tikz@dv@style@at@list,{#1}}}, + no tick text at/.style={options at={#1 as [no tick text]}} +} + + +\def\tikz@lib@dv@do@axis#1{% + \def\tikz@marshal{#1=} + \expandafter\expandafter\expandafter\tikzdatavisualizationset% + \expandafter\expandafter\expandafter{\expandafter\tikz@marshal\expandafter{\tikz@lib@dv@args}} +} + +\def\tikz@do@axis@options#1#2{ + \pgfkeys{/tikz/data visualization/axis options/.cd,#2} + \def\tikz@dv@axis{#1} +} +\let\tikz@dv@axis\pgfutil@empty + +\tikzdatavisualizationset{ + every ticks/.style={ + node style={% + font=\pgfutil@font@footnotesize, + inner sep=1pt, + outer sep=.1666em, + rounded corners=1.5pt + } + }, + every visualizer label/.style={ + every ticks, + node style={ + font=\pgfutil@font@small + } + }, + @color of visualizer labels/.style={text=black}, + every visualizer legend label/.style={ + node style={ + fill=none + } + }, + every axis label/.style={ + node style={% + font=\pgfutil@font@small + } + } +} + + +\tikzset{ + /tikz/data visualization/axis options/.cd, + % + % Basic setters + % + attribute/.style={\tikz@dv@axis/attribute={#1}}, + function/.style={\tikz@dv@axis/function={#1}}, + scaling/.style={\tikz@dv@axis/scaling={#1}}, + padding min/.style={\tikz@dv@axis/padding min={#1}}, + padding max/.style={\tikz@dv@axis/padding max={#1}}, + padding/.style={padding min={-#1},padding max={#1}}, + label/.style={\tikz@dv@axis/label={#1}}, + % + % Strategies + % + tick placement strategy/.style={\tikz@dv@axis/@compute at positions={#1}}, + linear steps/.style={tick placement strategy=\tikz@lib@dv@compute@at@linear}, + % + % Attribute setter + % + goto/.code={\tikz@dv@goto{\tikz@dv@axis}{#1}}, + % + % Modification of the range + % + include values/.style={% + /tikz/data visualization/before survey/.expanded={% + \noexpand\pgfkeysgetvalue{\tikz@dv@axis/scaling mapper}\noexpand\tikz@dv@axis@mapper% + \noexpand\foreach \noexpand\tikz@lib@dv@temp in {#1} {% + \noexpand\tikz@dv@axis@mapper.include in value(\noexpand\tikz@lib@dv@temp)% + }% + }% + }, + % + % Visualization setters + % + visualize axis/.code=\expandafter\tikz@lib@dv@av\expandafter{\tikz@dv@axis}{#1}, + % + % Ticks settings + % + ticks/.style={\tikz@dv@axis/ticks at/.append={,#1}}, + visualize ticks/.code=\expandafter\tikz@lib@dv@tv\expandafter{\tikz@dv@axis}{#1}, + % + % Grid settings + % + grid/.style={\tikz@dv@axis/grid at/.append={,#1}}, + grid/.default=at default ticks, + visualize grid/.code=\expandafter\tikz@lib@dv@gv\expandafter{\tikz@dv@axis}{#1}, + % + % Visualizing axis labels + % + visualize label/.code=\expandafter\tikz@lib@dv@lv\expandafter{\tikz@dv@axis}{#1}, +} + + +% Layer options +\tikzdatavisualizationset{ + axis layer/.style=on background layer, + ticks layer/.style=on background layer, + ticks node layer/.style=, + grid layer/.style=on background layer, +} + + +% Axis visualization +% +% #1 = name of the to-be-visualized axis name +% #2 = options for the visualization + +\def\tikz@lib@dv@av#1#2{ + \tikzdatavisualizationset{ + axes actions/.append={\tikz@lib@dv@show@axis{#1}{#2}} + } +} + +\def\tikz@lib@dv@show@axis#1#2{% + \scope[data visualization/axis layer,/tikz/data visualization/.cd,low=min,high=max,every axis/.try,#2] + \pgfkeysgetvalue{#1/scaling mapper}\tikz@dv@axis@mapper + % Ok, calculate direction vector: + \tikzpointandanchordirection{\tikz@dv@axis@mapper.set in to(min)}{\tikz@dv@axis@mapper.set in to(max)} + \xdef\tikz@dv@axis@dir{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}} + \path[draw,/tikz/data visualization/styling] + \pgfextra{ + { + \tikz@dv@goto{#1}{\pgfkeysvalueof{/tikz/data visualization/low}}% + \pgfpathdvmoveto% + } + { + \tikz@dv@goto{#1}{\pgfkeysvalueof{/tikz/data visualization/high}}% + \pgfpathdvlineto% + } + }; + \endscope +} + +\def\tikz@dv@goto#1#2{% + \edef\pgf@temp{#2}% + \ifx\pgf@temp\tikz@lib@dv@padded@min@text% + \pgfkeysvalueof{#1/scaling mapper}.set in to(min)% + \pgfkeysvalueof{#1/scaling mapper}.get out()% + \pgfkeysgetvalue{#1/padding min}\pgf@temp% + \pgfmathparse{\pgf@temp}% + \pgfkeyslet{/data point/\pgfdvout/offset}\pgfmathresult% + \else% + \ifx\pgf@temp\tikz@lib@dv@padded@max@text% + \pgfkeysvalueof{#1/scaling mapper}.set in to(max)% + \pgfkeysvalueof{#1/scaling mapper}.get out()% + \pgfkeysgetvalue{#1/padding max}\pgf@temp% + \pgfmathparse{\pgf@temp}% + \pgfkeyslet{/data point/\pgfdvout/offset}\pgfmathresult% + \else% + \pgfkeysvalueof{#1/scaling mapper}.set in to(#2)% + \fi% + \fi% +} + +\def\tikz@lib@dv@padded@min@text{padded min} +\def\tikz@lib@dv@padded@max@text{padded max} + +% Ticks visualization +% +% #1 = name of axis on which ticks should be shown +% #2 = options for the visualization + +\def\tikz@lib@dv@tv#1#2{ + \tikzdatavisualizationset{ + ticks actions/.append={\tikz@lib@dv@default@action{ticks}{#1}{#2}}, + major ticks actions/.append={\tikz@lib@dv@show@ticks{major}{#1}{#2}}, + minor ticks actions/.append={\tikz@lib@dv@show@ticks{minor}{#1}{#2}}, + subminor ticks actions/.append={\tikz@lib@dv@show@ticks{subminor}{#1}{#2}} + } +} + +\def\tikz@lib@dv@default@action#1#2#3{% + \let\tikz@marshal\pgfutil@empty% + {% + \let\tikz@lib@dv@ticks@at\pgfutil@empty% + \pgfkeysgetvalue{#2/ticks at}\tikz@lib@dv@ticks@default@at% + \pgfkeysgetvalue{#2/#1 at}\tikz@lib@dv@settings% + \pgfkeysgetvalue{#2/scaling mapper}\tikz@lib@dv@mapper + % Normal minor etc. have no effect. + \tikzdatavisualizationset{major/.code=,minor/.code=,subminor/.code=,common/.code=} + \expandafter\tikzdatavisualizationset\expandafter{\tikz@lib@dv@settings}% + \tikzdatavisualizationset{@setup at setters}% + \pgfkeysgetvalue{/tikz/data visualization/compute step}\tikz@temp@step% + \ifx\tikz@temp@step\pgfutil@empty% + % do nothing + \else% + \pgfkeysvalueof{#2/@compute at positions}% + \xdef\tikz@marshal{ + major={\pgfkeysvalueof{/tikz/data visualization/major}}, + minor={\pgfkeysvalueof{/tikz/data visualization/minor}}, + subminor={\pgfkeysvalueof{/tikz/data visualization/subminor}}} + \fi + }% + \pgfkeyslet{#2/default #1 at}\tikz@marshal +} + +\def\tikz@lib@dv@show@ticks#1#2#3{% + % First, check whether there is anything to do at all: + \pgfkeysgetvalue{#2/default ticks at}\tikz@lib@dv@default@settings% + \ifx\tikz@lib@dv@default@settings\pgfutil@empty% + \pgfkeysgetvalue{#2/ticks at}\tikz@lib@dv@settings% + \else% + \pgfkeysgetvalue{#2/ticks at}\tikz@lib@dv@settings% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\tikz@lib@dv@settings% + \expandafter\expandafter\expandafter{\expandafter\tikz@lib@dv@default@settings\expandafter,\tikz@lib@dv@settings} + \fi% + \ifx\tikz@lib@dv@settings\pgfutil@empty% + % Great, nothing to do + \else + {% + \let\tikz@dv@at@list\pgfutil@empty% + \let\tikz@dv@style@at@list\pgfutil@empty% + \scope[/tikz/data visualization/.cd,every ticks/.try,every #1 ticks/.try,#3]% + % Setup options + \pgfkeysgetvalue{#2/scaling mapper}\tikz@lib@dv@mapper + \expandafter\tikzdatavisualizationset\expandafter{\tikz@lib@dv@settings}% + \pgfkeysgetvalue{/tikz/data visualization/common}\tikz@temp + \expandafter\tikzdatavisualizationset\expandafter{\tikz@temp} + \pgfkeysgetvalue{/tikz/data visualization/#1}\tikz@temp + \expandafter\tikzdatavisualizationset\expandafter{\tikz@temp} + \pgfkeysgetvalue{/tikz/data visualization/\pgfkeysvalueof{/tikz/data visualization/direction axis}/scaling mapper}\pgf@dv@tick@dir@mapper + % Ok, now it's time to draw the ticks! + \foreach \tikz@dv@tick@pos in \tikz@dv@at@list + { + \ifx\tikz@dv@tick@pos\pgfutil@empty + \else + \expandafter\tikz@lib@dv@parse\tikz@dv@tick@pos\pgf@stop% + \expandafter\tikzdatavisualizationset\expandafter{\tikz@lib@dv@tick@opt}% + \tikz@lib@dv@mapper.set in to(\tikz@dv@tick@pos)% + % First, compute position of tick: + \pgf@process{\pgfpointdvlocaldatapoint} + \xdef\pgf@dv@tick@origin{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}} + % Ok, calculate direction vector: + \tikzpointandanchordirection{\pgf@dv@tick@dir@mapper.set in to(min)}{\pgf@dv@tick@dir@mapper.set in to(max)} + \xdef\pgf@dv@tick@dir{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}} + % Now, show something: + \tikz@lib@handle@at@style% + \scope[/tikz/data visualization/styling] + \pgf@process{\pgfpointadd{\pgf@dv@tick@origin}{\pgfpointscale{\pgfkeysvalueof{/tikz/data visualization/high}}{\pgf@dv@tick@dir}}} + \xdef\tikz@dv@max@tick{\the\pgf@x,\the\pgf@y} + \pgf@process{\pgfpointadd{\pgf@dv@tick@origin}{\pgfpointscale{\pgfkeysvalueof{/tikz/data visualization/low}}{\pgf@dv@tick@dir}}} + \xdef\tikz@dv@min@tick{\the\pgf@x,\the\pgf@y} + \scope[data visualization/ticks layer] \draw (\tikz@dv@min@tick) -- (\tikz@dv@max@tick); \endscope + \iftikz@dv@min@tick@node \scope[data visualization/ticks node layer] \path (\tikz@dv@min@tick) \tikz@dv@handle@tick{\tikz@dv@min@anchor}; \endscope \fi + \iftikz@dv@max@tick@node \scope[data visualization/ticks node layer] \path (\tikz@dv@max@tick) \tikz@dv@handle@tick{\tikz@dv@max@anchor}; \endscope\fi + \endscope + \fi + } + \endscope + } + \fi +} + +\def\tikz@lib@dv@parse#1\pgf@stop{% + \pgfutil@in@{as}{#1}% + \ifpgfutil@in@% + \tikz@lib@dv@parse@as#1\pgf@stop% + \else% + \tikz@lib@dv@parse@as#1as\tikz@lib@dv@typeset\pgf@stop% + \fi% +} +\def\tikz@lib@dv@parse@as#1as{% + \def\tikz@dv@tick@pos{#1}% + \pgfutil@ifnextchar[{\tikz@lib@dv@parse@as@opt}{\tikz@lib@dv@parse@as@opt[]}%] +} +\def\tikz@lib@dv@parse@as@opt[#1]{% + \def\tikz@lib@dv@tick@opt{#1}% + \pgfutil@ifnextchar\pgf@stop{\tikz@lib@dv@parse@as@text\tikz@lib@dv@typeset}{\tikz@lib@dv@parse@as@text} +} +\def\tikz@lib@dv@parse@as@text#1\pgf@stop{% + \def\tikz@lib@dv@tick@text{#1}% +} + +\def\tikz@lib@dv@typeset{% + \pgfdvmathenter{\tikz@lib@dv@typesetnum}{\tikz@dv@tick@pos}% + \pgfdvmathexitbyscientificformat{\tikz@lib@dv@typesetnum}{\tikz@lib@dv@typesetnum}% hmm... not sure about this... + \pgfkeysvalueof{/tikz/data visualization/tick prefix}% + \pgfkeysvalueof{/tikz/data visualization/tick typesetter}{\tikz@lib@dv@typesetnum}% + \pgfkeysvalueof{/tikz/data visualization/tick suffix}% +} + +\newif\iftikz@dv@min@tick@node +\newif\iftikz@dv@max@tick@node + +\def\tikz@dv@handle@tick#1{% + \pgfextra{ + \ifx\tikz@lib@dv@tick@text\pgfutil@empty% + \global\let\tikz@dv@tick@marshal=\pgfutil@empty% Skip! + \else + \def\tikz@dv@tick@marshal{node[anchor=#1,/tikz/data visualization/node styling]}% + \expandafter\pgfutil@g@addto@macro\expandafter\tikz@dv@tick@marshal\expandafter{\expandafter{\tikz@lib@dv@tick@text}} + \fi + \expandafter}% + \tikz@dv@tick@marshal +} + + +\def\tikz@lib@handle@at@style{% + \ifx\tikz@dv@style@at@list\pgfutil@empty% nothing to do + \else% + \let\tikz@dv@lib@this@at@style=\pgfutil@empty% + \pgfdvmathenter{\tikz@temp}{\tikz@dv@tick@pos}% + \pgfdvmathexitbyscientificformat{\tikz@dv@compare@to}{\tikz@temp}% + \foreach \tikz@dv@at@style in \tikz@dv@style@at@list {% + \ifx\tikz@dv@at@style\pgfutil@empty% + \else% + \expandafter\tikz@dv@lib@handle@one@at@style\tikz@dv@at@style\tikz@stop% + \fi% + } + \ifx\tikz@dv@lib@this@at@style\pgfutil@empty% + \else% + \expandafter\tikzdatavisualizationset\expandafter{\tikz@dv@lib@this@at@style}% + \fi% + \fi% +} + +\def\tikz@dv@lib@handle@one@at@style#1as#2[#3]#4\tikz@stop{% + \pgfdvmathenter{\tikz@lib@dv@at@math@var}{#1}% + \pgfdvmathexitbyscientificformat{\tikz@dv@temp}{\tikz@lib@dv@at@math@var}% + \ifx\tikz@dv@temp\tikz@dv@compare@to% + % Bingo! + \expandafter\gdef\expandafter\tikz@dv@lib@this@at@style\expandafter{\tikz@dv@lib@this@at@style,#3}% + \fi% +} + + +% Help function +\def\tikzpointandanchordirection#1#2{% + % This function works like pgfpointdvdirection, but also computes + % appriate "min" and "max" anchors. + \pgf@process{\pgfpointdvdirection{#1}{#2}} + { + \pgf@ya=\pgf@y + \pgf@y=-\pgf@x + \pgf@x=\pgf@ya + \tikz@auto@anchor + \xdef\tikz@dv@max@anchor{\tikz@anchor} + \tikz@auto@anchor@prime + \xdef\tikz@dv@min@anchor{\tikz@anchor} + } +} + + + + +% Grid visualization +% +% #1 = name of axis on which grid lines should be shown +% #2 = options for the visualization + +\def\tikz@lib@dv@gv#1#2{ + \tikzdatavisualizationset{ + grid actions/.append={\tikz@lib@dv@default@action{grid}{#1}{#2}}, + major grid actions/.append={\tikz@lib@dv@show@grid{major}{#1}{#2}}, + minor grid actions/.append={\tikz@lib@dv@show@grid{minor}{#1}{#2}}, + subminor grid actions/.append={\tikz@lib@dv@show@grid{subminor}{#1}{#2}}, + } +} + +\def\tikz@lib@dv@show@grid#1#2#3{% + % First, check whether there is anything to do at all: + \pgfkeysgetvalue{#2/default grid at}\tikz@lib@dv@default@settings% + \ifx\tikz@lib@dv@default@settings\pgfutil@empty% + \pgfkeysgetvalue{#2/grid at}\tikz@lib@dv@settings% + \else% + \pgfkeysgetvalue{#2/grid at}\tikz@lib@dv@settings% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\tikz@lib@dv@settings% + \expandafter\expandafter\expandafter{\expandafter\tikz@lib@dv@default@settings\expandafter,\tikz@lib@dv@settings} + \fi% + \ifx\tikz@lib@dv@settings\pgfutil@empty% + % Great, nothing to do + \else + {% + \let\tikz@dv@at@list\pgfutil@empty + \let\tikz@dv@style@at@list\pgfutil@empty + \scope[data visualization/grid layer,/tikz/data visualization/.cd,every #1 grid/.try,grid styling,grid styling/.style=,#3] + % Setup options + \pgfkeysgetvalue{#2/scaling mapper}\tikz@lib@dv@mapper + \let\tikz@lib@dv@ticks@default@at\pgfutil@empty% + \pgfkeysgetvalue{#2/ticks at}\tikz@lib@dv@ticks@at% + \expandafter\tikzdatavisualizationset\expandafter{\tikz@lib@dv@settings}% + \pgfkeysgetvalue{/tikz/data visualization/common}\tikz@temp + \expandafter\tikzdatavisualizationset\expandafter{\tikz@temp} + \pgfkeysgetvalue{/tikz/data visualization/#1}\tikz@temp + \expandafter\tikzdatavisualizationset\expandafter{\tikz@temp} + \edef\tikz@lib@dv@dir@axis{/tikz/data visualization/\pgfkeysvalueof{/tikz/data visualization/direction axis}}% + % Ok, now it's time to draw the grid! + \foreach \tikz@dv@grid@pos in \tikz@dv@at@list + { + \ifx\tikz@dv@grid@pos\pgfutil@empty + \else + \expandafter\tikz@lib@dv@parse\tikz@dv@grid@pos\pgf@stop% + \expandafter\tikzdatavisualizationset\expandafter{\tikz@lib@dv@tick@opt}% + \tikzdatavisualizationset{grid styling}% + \tikz@lib@dv@mapper.set in to(\tikz@dv@tick@pos)% + \draw[/tikz/data visualization/styling] + \pgfextra{ + % First, compute start of grid: + \tikz@dv@goto{\tikz@lib@dv@dir@axis}{\pgfkeysvalueof{/tikz/data visualization/low}}% + \pgfpathdvmoveto% + \tikz@dv@goto{\tikz@lib@dv@dir@axis}{\pgfkeysvalueof{/tikz/data visualization/high}}% + \pgfpathdvlineto% + }; + \fi + } + \endscope + } + \fi +} + + + + + + + + + +% +% Label visualization +% + +\def\tikz@lib@dv@lv#1#2{ + \tikzdatavisualizationset{ + label actions/.append={\tikz@lib@dv@show@label{#1}{#2}} + } +} + +\def\tikz@lib@dv@show@label#1#2{% + % First, check whether there is anything to do at all: + \pgfkeysgetvalue{#1/label}\tikz@dv@lib@label% + \ifx\tikz@dv@lib@label\pgfutil@empty% + % Great, nothing to do + \else + \scope[/tikz/data visualization/.cd,every axis label/.try,#2] + \pgfkeysgetvalue{/tikz/data visualization/value}\tikz@lib@dv@at% + \pgfkeysgetvalue{/tikz/data visualization/pos}\tikz@lib@dv@pos% + \pgfkeysgetvalue{#1/scaling mapper}\tikz@dv@mapper + \ifx\tikz@lib@dv@pos\pgfutil@empty% + \ifx\tikz@lib@dv@at\pgfutil@empty% + % Well, hopefully the node options setup things correctly... + \else% + % Special treatment of "min" and "max" + \ifx\tikz@lib@dv@at\pgf@min@text% + \tikz@lib@dv@special@at{\tikz@dv@min@anchor} + \else \ifx\tikz@lib@dv@at\tikz@lib@dv@padded@min@text% + \tikz@lib@dv@special@at{\tikz@dv@min@anchor} + \else \ifx\tikz@lib@dv@at\pgf@max@text% + \tikz@lib@dv@special@at{\tikz@dv@max@anchor} + \else \ifx\tikz@lib@dv@at\tikz@lib@dv@padded@max@text% + \tikz@lib@dv@special@at{\tikz@dv@max@anchor} + \fi\fi\fi\fi% + \tikz@dv@goto{#1}{\tikz@lib@dv@at}% + \pgftransformshift{\pgfpointdvlocaldatapoint}% + \fi% + \else% + \tikz@dv@mapper.set in to(min)% + \pgftransformshift{\pgfpointscale{1-\tikz@lib@dv@pos}{\pgfpointdvlocaldatapoint}} + \tikz@dv@mapper.set in to(max)% + \pgftransformshift{\pgfpointscale{\tikz@lib@dv@pos}{\pgfpointdvlocaldatapoint}} + \fi + \expandafter\tikz@lib@dv@parse@node\tikz@dv@lib@label\pgf@stop + \endscope + \fi +} +\def\tikz@lib@dv@special@at#1{% + % Ok, calculate direction vector: + \tikzpointandanchordirection{\tikz@dv@mapper.set in to(min)}{\tikz@dv@mapper.set in to(max)} + \tikzset{anchor=#1} +} + +\def\tikz@lib@dv@parse@node{\pgfutil@ifnextchar[\tikz@lib@dv@parse@node@opt{\tikz@lib@dv@parse@node@opt[]}}%} +\def\tikz@lib@dv@parse@node@opt[#1]#2\pgf@stop{ + \node [/tikz/data visualization/node styling,#1] {#2}; +} + + + +% +% Tick placement strategies +% + +\tikzdatavisualizationset{ + compute step/.initial=, + step/.style={compute step=\def\tikz@lib@dv@step{#1}}, + minor steps between steps/.initial=, + minor steps between steps/.default=9, + phase/.initial=0, + tick typesetter/.initial=\pgfmathprintnumber, + tick prefix/.initial=, + tick suffix/.initial=, + tick unit/.style={tick suffix={#1}},% this is an alias +} + +\def\tikz@lib@dv@compute@at@linear{% + % Setup about: + \let\tikz@lib@dv@compute@about=\tikz@lib@dv@about@linear% + \let\tikz@lib@dv@step\relax% + \pgfkeysvalueof{/tikz/data visualization/compute step} + \ifx\tikz@lib@dv@step\relax% + \else% + % Gather interesting values + \tikz@lib@dv@mapper.get in range interval()% + \pgfdvinrangeinterval.get min and max()% + \pgfkeysgetvalue{/tikz/data visualization/phase}\tikz@temp + \pgfdvmathenter{\tikz@dv@lib@phase}{\tikz@temp} + \pgfdvmathenter{\tikz@dv@lib@step}{\tikz@lib@dv@step} + % Compute start: + \pgfdvmathsub{\tikz@dv@lib@temp}{\pgfdvmin}{\tikz@dv@lib@phase}% temp = dvmin - phase + \pgfdvmathdiv{\tikz@dv@lib@temp}{\tikz@dv@lib@temp}{\tikz@dv@lib@step}% temp = temp/step + \pgfdvmathfloor{\tikz@dv@lib@temp}{\tikz@dv@lib@temp}% temp = floor(temp) + \pgfdvmathmul{\tikz@lib@dv@current}{\tikz@dv@lib@temp}{\tikz@dv@lib@step}% current = temp*step ... + \pgfdvmathadd{\tikz@lib@dv@current}{\tikz@lib@dv@current}{\tikz@dv@lib@phase}% + phase + \let\tikz@lib@dv@ats\pgfutil@empty% + \let\tikz@lib@dv@minor@ats\pgfutil@empty% + \tikz@lib@dv@mapper.get function(\tikz@temp)% + \ifx\tikz@temp\pgfutil@empty% + \pgfdvmathenter{\tikz@one@hundreth}{0.001}% + \pgfdvmathsub{\tikz@lib@temp}{\pgfdvmax}{\pgfdvmin}% + \pgfdvmathmul{\tikz@lib@dv@epsilon}{\tikz@lib@temp}{\tikz@one@hundreth}% epsilon = (max - min)/1000 + \else + \let\tikz@lib@dv@epsilon\pgfdvmathalwayszero + \fi + \pgfdvmathsub{\tikz@lib@dv@min@minus@epsilon}{\pgfdvmin}{\tikz@lib@dv@epsilon}% + \pgfdvmathadd{\tikz@lib@dv@max@plus@epsilon}{\pgfdvmax}{\tikz@lib@dv@epsilon}% + \pgfkeysgetvalue{/tikz/data visualization/minor steps between steps}\tikz@lib@dv@substeps% + \ifx\tikz@lib@dv@substeps\pgfutil@empty + \else + \pgfmathsetmacro\tikz@temp{\tikz@lib@dv@substeps+1}% + \pgfdvmathenter{\tikz@dv@lib@substeps}{\tikz@temp}% + \pgfdvmathdiv{\tikz@lib@dv@substep}{\tikz@dv@lib@step}{\tikz@dv@lib@substeps}% + \fi + \loop% + \ifx\tikz@lib@dv@substeps\pgfutil@empty% + \else% + \let\tikz@lib@dv@subcurrent=\tikz@lib@dv@current% + \pgfmathsetcount{\c@pgf@counta}{\tikz@lib@dv@substeps}% + \let\tikz@lib@dv@next=\tikz@lib@dv@subloop% + \tikz@lib@dv@subloop + \fi% + \pgfdvmathifless{\tikz@lib@dv@current}{\tikz@lib@dv@min@minus@epsilon}{}{% + \pgfdvmathexitbyserializing{\tikz@temp}{\tikz@lib@dv@current}% + \edef\tikz@lib@dv@ats{\tikz@lib@dv@ats,\tikz@temp}% + } + \pgfdvmathadd{\tikz@lib@dv@current}{\tikz@lib@dv@current}{\tikz@dv@lib@step}% + \pgfdvmathifless{\tikz@lib@dv@current}{\tikz@lib@dv@max@plus@epsilon}{\tikz@lib@dv@continuetrue}{\tikz@lib@dv@continuefalse}% + \iftikz@lib@dv@continue% + \repeat% + \tikzdatavisualizationset{major/.expanded={at={\tikz@lib@dv@ats}},minor/.expanded={at={\tikz@lib@dv@minor@ats}}}% + \fi% +} +\newif\iftikz@lib@dv@continue + +\def\tikz@lib@dv@subloop{ + \pgfdvmathadd{\tikz@lib@dv@subcurrent}{\tikz@lib@dv@subcurrent}{\tikz@lib@dv@substep}% + \pgfdvmathifless{\tikz@lib@dv@subcurrent}{\pgfdvmin}{}{% + \pgfdvmathifless{\tikz@lib@dv@subcurrent}{\pgfdvmax}{% + \pgfdvmathexitbyserializing{\tikz@temp}{\tikz@lib@dv@subcurrent}% + \edef\tikz@lib@dv@minor@ats{\tikz@lib@dv@minor@ats,\tikz@temp} + }{}} + \advance\c@pgf@counta by-1\relax% + \ifnum\c@pgf@counta=0\relax% + \let\tikz@lib@dv@next=\relax + \fi + \tikz@lib@dv@next +} + + + +% +% Ticks about settings +% + +\tikzdatavisualizationset{ + about/.style={compute step=\tikz@lib@dv@compute@about{#1}}, + about strategy/.initial=, + standard about strategy/.style={about strategy={1.5/1.0,2.3/2.0,4/2.5,7/5,11/10}}, + standard about strategy, + euro about strategy/.style={about strategy={1.5/1.0,3/2.0,7/5,11/10}}, + half about strategy/.style={about strategy={2/1.0,7/5,11/10}}, + quarter about strategy/.style={about strategy={1.8/1.0,4/2.5,7/5,11/10}}, + int about strategy/.style={about strategy={1.5/1.0,2.5/2.0,3.5/3.0,4.5/4.0,7/5,11/10}}, + none/.style={compute step=}, + few/.style={about=3}, + some/.style={about=5}, + many/.style={about=10}, +} + +\def\tikz@lib@dv@about@linear#1{% + \tikz@lib@dv@mapper.get in range interval()% + \pgfdvinrangeinterval.get min and max()% + \pgfdvmathsub{\tikz@lib@dv@diff}{\pgfdvmax}{\pgfdvmin} + \pgfdvmathenter{\tikz@lib@dv@about@val}{#1}% + \pgfdvmathdiv{\tikz@lib@dv@around}{\tikz@lib@dv@diff}{\tikz@lib@dv@about@val}% + % Make mantisse sensible + \pgfmathfloattomacro{\tikz@lib@dv@around}{\tikz@lib@dv@flags}{\tikz@lib@dv@mant}{\tikz@lib@dv@exp} + \pgf@xc=\tikz@lib@dv@mant pt% + \pgfkeysgetvalue{/tikz/data visualization/about strategy}\tikz@lib@dv@strat + \foreach \tikz@lib@dv@threshold/\tikz@lib@replace in \tikz@lib@dv@strat + { + \ifdim\pgf@xc<\tikz@lib@dv@threshold pt% + \global\pgf@xc=\tikz@lib@replace pt% + \breakforeach + \fi + } + \ifdim\pgf@xc<10pt% + \pgfmathfloatcreate{\tikz@lib@dv@flags}{\pgf@sys@tonumber{\pgf@xc}}{\tikz@lib@dv@exp} + \else + \pgfmathsetmacro\tikz@lib@dv@exp{\tikz@lib@dv@exp+1} + \divide\pgf@xc by 10\relax + \pgfmathfloatcreate{\tikz@lib@dv@flags}{\pgf@sys@tonumber{\pgf@xc}}{\tikz@lib@dv@exp} + \fi + \pgfmathfloattofixed{\pgfmathresult} + \let\tikz@lib@dv@step=\pgfmathresult +} + + + + + +% +% Logarithmic axes +% + +\tikzset{ + /tikz/data visualization/axis options/.cd, + exponential steps/.style={tick placement strategy=\tikz@lib@dv@compute@at@log}, + % + % Basic setters + % + logarithmic/.style={ + \tikz@dv@axis/function=\pgfdvmathln{\pgfvalue}{\pgfvalue}, + \tikz@dv@axis/scaling/default=1 at 0 and 10 at 1, + exponential steps + } +} + +\def\tikz@lib@dv@compute@at@log{% + % Setup about: + \let\tikz@lib@dv@compute@about=\tikz@lib@dv@about@log% + \let\tikz@lib@dv@step\relax% + \pgfkeysvalueof{/tikz/data visualization/compute step} + \ifx\tikz@lib@dv@step\relax% + \else% + % Gather interesting values + \tikz@lib@dv@mapper.get in range interval()% + \pgfdvinrangeinterval.get min and max()% + \pgfdvmathlog{\pgfdvminlog}{\pgfdvmin}% + \pgfdvmathlog{\pgfdvmaxlog}{\pgfdvmax}% + \pgfkeysgetvalue{/tikz/data visualization/phase}\tikz@temp + \pgfdvmathenter{\tikz@dv@lib@phase}{\tikz@temp} + \pgfdvmathenter{\tikz@dv@lib@step}{\tikz@lib@dv@step} + % Compute start: + \pgfdvmathsub{\tikz@dv@lib@temp}{\pgfdvminlog}{\tikz@dv@lib@phase}% temp = dvmin - phase + \pgfdvmathdiv{\tikz@dv@lib@temp}{\tikz@dv@lib@temp}{\tikz@dv@lib@step}% temp = temp/step + \pgfdvmathfloor{\tikz@dv@lib@temp}{\tikz@dv@lib@temp}% temp = floor(temp) + \pgfdvmathmul{\tikz@lib@dv@current}{\tikz@dv@lib@temp}{\tikz@dv@lib@step}% current = temp*step ... + \pgfdvmathadd{\tikz@lib@dv@current}{\tikz@lib@dv@current}{\tikz@dv@lib@phase}% + phase + \let\tikz@lib@dv@ats\pgfutil@empty% + \let\tikz@lib@dv@minor@ats\pgfutil@empty% + \pgfdvmathenter{\tikz@one@hundreth}{0.001}% + \pgfdvmathsub{\tikz@lib@temp}{\pgfdvmaxlog}{\pgfdvminlog}% + \pgfdvmathmul{\tikz@lib@dv@epsilon}{\tikz@lib@temp}{\tikz@one@hundreth}% epsilon = (max - min)/100 + \pgfdvmathsub{\tikz@lib@dv@min@minus@epsilon}{\pgfdvminlog}{\tikz@lib@dv@epsilon}% + \pgfdvmathadd{\tikz@lib@dv@max@plus@epsilon}{\pgfdvmaxlog}{\tikz@lib@dv@epsilon}% + \pgfkeysgetvalue{/tikz/data visualization/minor steps between steps}\tikz@lib@dv@substeps% + \ifx\tikz@lib@dv@substeps\pgfutil@empty + \else + \pgfmathsetmacro\tikz@temp{\tikz@lib@dv@substeps+1}% + \pgfdvmathenter{\tikz@dv@lib@substeps}{\tikz@temp}% + \fi + \loop% + \ifx\tikz@lib@dv@substeps\pgfutil@empty% + \else% + \let\tikz@lib@dv@subcurrent=\tikz@lib@dv@current% + \pgfdvmathadd{\tikz@lib@dv@subcurrent@next}{\tikz@lib@dv@subcurrent}{\tikz@dv@lib@step}% + \pgfdvmathpowten{\tikz@lib@dv@subcurrent}{\tikz@lib@dv@subcurrent}% + \pgfdvmathpowten{\tikz@lib@dv@subcurrent@max}{\tikz@lib@dv@subcurrent@next}% + \pgfdvmathsub{\tikz@lib@dv@subcurrent@diff}{\tikz@lib@dv@subcurrent@max}{\tikz@lib@dv@subcurrent}% + \pgfdvmathdiv{\tikz@lib@dv@substep}{\tikz@lib@dv@subcurrent@diff}{\tikz@dv@lib@substeps}% + \pgfmathsetcount{\c@pgf@counta}{\tikz@lib@dv@substeps}% + \let\tikz@lib@dv@next=\tikz@lib@dv@subloop% + \tikz@lib@dv@subloop + \fi% + \pgfdvmathifless{\tikz@lib@dv@current}{\tikz@lib@dv@min@minus@epsilon}{}{% + \pgfdvmathpowten{\tikz@lib@dv@current@pow}{\tikz@lib@dv@current}% + \pgfdvmathexitbyserializing{\tikz@temp}{\tikz@lib@dv@current@pow}% + \edef\tikz@lib@dv@ats{\tikz@lib@dv@ats,\tikz@temp}% + } + \pgfdvmathadd{\tikz@lib@dv@current}{\tikz@lib@dv@current}{\tikz@dv@lib@step}% + \pgfdvmathifless{\tikz@lib@dv@current}{\tikz@lib@dv@max@plus@epsilon}{\tikz@lib@dv@continuetrue}{\tikz@lib@dv@continuefalse}% + \iftikz@lib@dv@continue% + \repeat% + \tikzdatavisualizationset{major/.expanded={at={\tikz@lib@dv@ats}},minor/.expanded={at={\tikz@lib@dv@minor@ats}}}% + \fi% +} +\newif\iftikz@lib@dv@continue + + +\def\tikz@lib@dv@about@log#1{% + \tikz@lib@dv@mapper.get in range interval()% + \pgfdvinrangeinterval.get min and max()% + \pgfdvmathlog{\pgfdvmin}{\pgfdvmin}% + \pgfdvmathlog{\pgfdvmax}{\pgfdvmax}% + \pgfdvmathsub{\tikz@lib@dv@diff}{\pgfdvmax}{\pgfdvmin} + \pgfdvmathenter{\tikz@lib@dv@about@val}{#1}% + \pgfdvmathdiv{\tikz@lib@dv@around}{\tikz@lib@dv@diff}{\tikz@lib@dv@about@val}% + % Make mantisse sensible + \pgfmathfloattomacro{\tikz@lib@dv@around}{\tikz@lib@dv@flags}{\tikz@lib@dv@mant}{\tikz@lib@dv@exp} + \ifdim\tikz@lib@dv@exp pt<0pt% + \pgfmathfloatcreate{1}{1.0}{0}% + \else + \pgf@xc=\tikz@lib@dv@mant pt\relax% + \ifdim\pgf@xc<2.5pt + \pgfmathfloatcreate{1}{1.0}{\tikz@lib@dv@exp} + \else\ifdim\pgf@xc<5.1pt + \pgfmathfloatcreate{1}{3.0}{\tikz@lib@dv@exp} + \else + \pgfmathfloatcreate{1}{6.0}{\tikz@lib@dv@exp} + \fi\fi + \fi% + \pgfmathfloattofixed{\pgfmathresult} + \let\tikz@lib@dv@step=\pgfmathresult +} + + + + + + + +% +% Cartesian axes +% + +\tikzdatavisualizationset{% + new Cartesian axis/.style={ + new axis={#1}, + new object={ + class=linear transformer, + store=/tikz/data visualization/#1/linear transformer, + arg1/.expanded=\pgfkeysvalueof{/tikz/data visualization/#1/attribute}/scaled, + arg2 from key=/tikz/data visualization/#1/unit vector, + }, + #1/scaling/default/.initial=0 at 0 and 1 at 1cm, + #1/unit vector/.initial=, + } +} + +\tikzset{ + /tikz/data visualization/axis options/.cd, + unit vector/.code=\tikz@scan@one@point\tikz@lib@dv@uv#1, + length/.style={\tikz@dv@axis/scaling=min at 0 and max at #1}, + positive length/.style={\tikz@dv@axis/scaling=0 at 0 and max at #1}, + negative length/.style={\tikz@dv@axis/scaling=min at -#1 and 0 at 0}, + unit length/.code={\tikz@dv@parse@unit@length{#1}}, + power unit length/.style={\tikz@dv@axis/scaling=1 at 0 and 10 at #1} +} + +\def\tikz@lib@dv@uv#1{% + \pgfkeyssetvalue{\tikz@dv@axis/unit vector}{#1} +} + +\def\tikz@dv@parse@unit@length#1{ + \pgfutil@in@{per}{#1} + \ifpgfutil@in@% + \tikz@dv@parse@unit@length@#1\pgf@stop% + \else% + \tikz@dv@parse@unit@length@#1per1units\pgf@stop% + \fi% +} +\def\tikz@dv@parse@unit@length@#1per#2units{ + \pgfkeysalso{\tikz@dv@axis/scaling=0 at 0 and #2 at #1} +} + + +% +% Common visualizer interface +% + +\tikzdatavisualizationset{ + new visualizer/.style 2 args={ + /pgf/data/#1/.style={/data point/visualizer=#1}, + #1/.code={ + \def\tikz@visualizer{#1}% + \pgfkeys{/tikz/data visualization/visualizer options/.cd,##1} + }, + /utils/exec={ + \advance\tikzdvvisualizercounter by 1\relax + \edef\tikz@temp{/data point/visualizer/#1/.initial=\the\tikzdvvisualizercounter} + \expandafter\tikzset\expandafter{\tikz@temp} + }, + /data point/#1/execute at begin/.initial={ + \pgfkeyssetvalue{/data point/visualizer}{#1} + \scope[ + /tikz/data visualization/every visualizer/.try, + #2, + /utils/exec=\pgf@signalstyle.emit(), + /tikz/data visualization/visualizers/#1/styling/.try] + }, + /data point/#1/execute at end/.initial={ + \path; % invokes every path implicitly + \endscope + }, + /tikz/data visualization/visualizers/#1/styling/.style=, + }, + visualizer style sheet/.style={/data point/visualizer/.style sheet={#1}} +} + +\def\tikz@do@visualizer#1#2{% + \tikzdatavisualizationset{ + #2=#1 + } +} + +\newcount\tikzdvvisualizercounter + +\newif\iftikz@dv@visualizer@label@inline + +\tikzset{ + @set plot handler/.code={\let\tikz@plot@handler=#1}, + no lines/.style={@set plot handler=\pgfplothandlerdiscard,/utils/exec=\tikzdatavisualizationset{default label in legend mark}}, + smooth line/.style={@set plot handler=\pgfplothandlercurveto,/utils/exec=\tikzdatavisualizationset{default label in legend path}}, + smooth cycle/.style={@set plot handler=\pgfplothandlerclosedcurve,/utils/exec=\tikzdatavisualizationset{default label in legend closed path}}, + straight line/.style={@set plot handler=\pgfplothandlerlineto,/utils/exec=\tikzdatavisualizationset{default label in legend path}}, + straight cycle/.style={@set plot handler=\pgfplothandlerpolygon,/utils/exec=\tikzdatavisualizationset{default label in legend closed path}}, + polygon/.style={straight cycle=cycle},% alias + gapped line/.style={@set plot handler=\pgfplothandlergaplineto,/utils/exec=\tikzdatavisualizationset{default label in legend path}}, + gapped cycle/.style={@set plot handler=\pgfplothandlergapcycle,/utils/exec=\tikzdatavisualizationset{gapped circular label in legend line}} +} + + + +% +% Label visualizer +% + +\tikzdatavisualizationset{ + new label visualizer/.style 2 args={ + new object={ + when=before visualization, + class=label visualizer, + before creation={ + \begingroup + \def\tikz@visualizer{#1}% + \pgfkeys{/tikz/data visualization/visualizer label options/.cd, + /tikz/data visualization/every label visualizer/.try, + #2} + \pgfkeysgetvalue{/tikz/data visualization/visualizer label options/text}\tikz@dv@temp@lab + \def\tikz@tempa{ + \scope[/tikz/data visualization/visualizer label options/.cd, + /tikz/data visualization/every label visualizer/.try, + #2] + \path [ + /data point/visualizer=#1,/utils/exec=\pgf@signalstyle.emit(), + /tikz/data visualization/.cd,every visualizer label] + (label visualizer coordinate') -- + (label visualizer coordinate) + node [ + auto, + at end, + /tikz/data visualization/node styling] + } + \expandafter\def\expandafter\tikz@tempb\expandafter{\expandafter{\tikz@dv@temp@lab};}% + \expandafter\expandafter\expandafter\gdef% + \expandafter\expandafter\expandafter\tikz@dv@label@code% + \expandafter\expandafter\expandafter{\expandafter\expandafter\expandafter\relax% + \expandafter\expandafter\expandafter{\expandafter\tikz@tempa\tikz@tempb\endscope}} + \global\let\tikz@dv@label@attribute=\tikz@dv@label@attribute + \global\let\tikz@dv@label@threshold=\tikz@dv@label@threshold + \endgroup + }, + arg1/.expand once=\tikz@dv@label@attribute, + arg2/.expand once=\tikz@dv@label@threshold, + arg3/.expand once=\tikz@dv@label@code, + arg4=\pgfdvvisualizerfilter{#1} + }, + /utils/exec=\tikz@create@label@count{#1} + }, + % Label style + text colored/.style={node style={text=visualizer color}} +} + +\def\tikz@create@label@count#1{ + \tikzdatavisualizationset{ + new object={ + when=after survey, + store=/tikz/data visualization/visualizers/#1/count/obj, + class=count, + arg1=visualizers/#1/count, + after creation={ + \tikzdvobj.set filter({% + \pgfkeysgetvalue{/data point/visualizer}\pgf@tempa% + \def\pgf@tempb{#1}% + \ifx\pgf@tempa\pgf@tempb% + \else + \pgfdvfilterpassedfalse% + \fi + }) + } + } + } +} + +\pgfkeys{ + /tikz/data visualization/visualizer label options/.cd, + at/.code args={#1>=#2}{% + \def\tikz@dv@label@attribute{#1}% + \def\tikz@dv@label@threshold{#2}% + }, + index/.code={% + \edef\tikz@dv@label@attribute{visualizers/\tikz@visualizer/count}% + \def\tikz@dv@label@threshold{#1}% + }, + text/.initial=, + text'/.style={text={#1},node style=swap}, + node style/.style={/tikz/data visualization/node style={#1}}, + text colored/.style=/tikz/data visualization/text colored, +} + +\let\tikz@dv@label@attribute\pgfutil@empty +\let\tikz@dv@label@threshold\pgfutil@empty +\let\tikz@dv@label@code\pgfutil@empty + + + + +% +% Legend handling +% + +\tikzdatavisualizationset{ + new legend/.code={ + \pgfkeysifdefined{/tikz/data visualization/#1/at}{} + {\tikzdatavisualizationset{ + new object={ + class=legend, + store=/tikz/data visualization/#1/obj, + arg1 from key=/tikz/data visualization/#1/@columns or rows, + arg2 from key=/tikz/data visualization/#1/@ideal, + arg3 from key=/tikz/data visualization/#1/max entries, + arg4 from key=/tikz/data visualization/#1/@strategy, + after creation={ + \tikzdatavisualizationset{ + legend actions/.append={ + \pgfkeysgetvalue{/tikz/data visualization/#1/obj}\pgf@dv@legend% + { + \pgf@dv@legend.get arrangement(\pgf@dv@temp)% + \pgfkeysgetvalue{/tikz/data visualization/#1/at}\pgf@dv@at% + \pgfkeysgetvalue{/tikz/data visualization/#1/anchor}\pgf@dv@anchor% + \let\pgfdvnextcell=\pgfmatrixnextcell% + \let\pgfdvendrow=\pgfmatrixendrow% + \def\pgf@marshal{ + \matrix[at/.expand once=\pgf@dv@at,matrix anchor/.expand + once=\pgf@dv@anchor,/tikz/data visualization/#1/styling] + } + \expandafter\pgf@marshal\expandafter{\pgf@dv@temp}; + } + } + } + } + }, + #1/@columns or rows/.initial=columns, + #1/@ideal/.initial=1, + #1/max entries/.initial=100, + #1/@strategy/.initial=down then right, + #1/anchor/.initial=west, + #1/at/.initial=(data visualization bounding box.east), + #1/styling/.style={row sep=0pt,column sep=.8em}, + % + % + % + #1/.code={ + \let\tikz@temp\tikz@dv@legend% + \def\tikz@dv@legend{/tikz/data visualization/#1}% + \expandafter\tikz@do@legend@options\expandafter{\tikz@temp}{##1}% + }, + #1={every new legend} + }}}, + legend/.style={new legend=legend,legend={#1}} +} + +\def\tikz@do@legend@options#1#2{ + \pgfkeys{/tikz/data visualization/legend options/.cd,#2} + \def\tikz@dv@legend{#1} +} +\let\tikz@dv@legend\pgfutil@empty + + +\tikzset{ + /tikz/data visualization/legend options/.cd, + % + % How to arrange the entries in the legend + % + ideal number of columns/.style={\tikz@dv@legend/@columns or rows=columns,\tikz@dv@legend/@ideal={#1}}, + ideal number of rows/.style={\tikz@dv@legend/@columns or rows=rows,\tikz@dv@legend/@ideal={#1}}, + columns/.style={ideal number of columns={#1}},% alias + rows/.style={ideal number of rows={#1}},% alias + max rows/.style={\tikz@dv@legend/@columns or rows=columns,\tikz@dv@legend/max entries={#1}}, + max columns/.style={\tikz@dv@legend/@columns or rows=rows,\tikz@dv@legend/max entries={#1}}, + down then right/.style={\tikz@dv@legend/@strategy=down then right}, + down then left/.style={\tikz@dv@legend/@strategy=down then left}, + up then right/.style={\tikz@dv@legend/@strategy=up then right}, + up then left/.style={\tikz@dv@legend/@strategy=up then left}, + right then down/.style={\tikz@dv@legend/@strategy=right then down}, + left then down/.style={\tikz@dv@legend/@strategy=left then down}, + right then up/.style={\tikz@dv@legend/@strategy=right then up}, + left then up/.style={\tikz@dv@legend/@strategy=left then up}, + % + % Where to put the legend + % + anchor/.style={\tikz@dv@legend/anchor={#1}}, + at/.style={\tikz@dv@legend/at={#1}}, + right/.style={ + columns=1, + at={([xshift=.8em]data visualization bounding box.east)}, + anchor=west, + }, + left/.style={ + columns=1, + at={([xshift=-.8em]data visualization bounding box.west)}, + anchor=east, + }, + below/.style={ + rows=1, + at={([yshift=-.5em]data visualization bounding box.south)}, + anchor=north, + }, + above/.style={ + rows=1, + at={([yshift=.5em]data visualization bounding box.north)}, + anchor=south, + }, + every new legend/.style={right,label style=text right}, + % + % Label text styling + % + label style/.style={ + style={/tikz/data visualization/legend entry options/every label + in legend/.append style={#1}} + }, + % + % Styling + % + style/.style={\tikz@dv@legend/styling/.append style={#1}}, +} + + +\tikzdatavisualizationset{ + new legend entry/.code={ + \begingroup + \pgfkeys{/tikz/data visualization/legend entry options/.cd,#1} + \pgfkeysgetvalue{/tikz/data visualization/legend entry options/legend}\tikz@dv@temp@legend + \global\let\tikz@dv@temp@legend\tikz@dv@temp@legend + \endgroup + \tikzdatavisualizationset{new legend/.expanded=\tikz@dv@temp@legend}% + \expandafter\tikz@dv@add@legend@entry\expandafter{\tikz@dv@temp@legend}{#1} + } +} + +\def\tikz@dv@add@legend@entry#1#2{ + \tikz@main@dv.at start survey({{ + \pgfkeysgetvalue{/tikz/data visualization/#1/obj}\pgf@temp + \pgf@temp.add entry(\tikz@dv@render@legend@entry{legend=#1,#2}) + }}) +} + +\def\tikz@dv@render@legend@entry#1{ + \pgfkeys{/tikz/data visualization/.cd, + every visualizer label, + every visualizer legend label + } + \pgfkeys{/tikz/data visualization/legend entry options/.cd,#1} + \pgfkeysgetvalue{/tikz/data visualization/legend entry options/text}\tikz@dv@temp@lab + \pgfkeysgetvalue{/tikz/data visualization/@node styling}\tikz@dv@temp@style + \pgfkeysgetvalue{/tikz/data visualization/legend entry options/setup}\tikz@dv@temp@setup + \pgfkeysgetvalue{/tikz/data visualization/legend entry options/value visualizer}\tikz@dv@temp@visual + \pgfkeysgetvalue{/tikz/data visualization/legend entry options/value visualizer styling}\tikz@dv@temp@visual@styling + \scope[/utils/exec=\expandafter\pgfkeysalso\expandafter{\tikz@dv@temp@setup}, + /utils/exec=\pgf@signalstyle.emit()] + \node[/tikz/data visualization/node styling, + /utils/exec=\expandafter\pgfkeysalso\expandafter{\tikz@dv@temp@style}] + {\tikz@dv@pre@height\tikz@dv@temp@lab\tikz@dv@post@height}; + \scope[/utils/exec=\expandafter\pgfkeysalso\expandafter{\tikz@dv@temp@visual@styling}] + \tikz@dv@temp@visual + \endscope + \endscope +} + +\def\tikz@dv@pre@height{\hbox{\vrule height .75em width0pt}} +\def\tikz@dv@post@height{\hbox{\vrule depth .25em width0pt}} + + + +\pgfkeys{ + /tikz/data visualization/legend entry options/.cd, + % + % General options + % + text/.initial=, + node style/.style={/tikz/data visualization/node style={#1}}, + legend/.initial=legend, + setup/.initial=, + value visualizer/.initial=, + value visualizer styling/.initial=, + value visualizer style/.style={value visualizer styling/.append={,#1}}, + value visualizer macro/.initial=, + % + % Legend visualizers for plots + % + text right/.style={ + node style={anchor=mid west,inner ysep=1pt,inner xsep=0pt,reset cm,xshift=.333em}, + value visualizer style={reset cm}, + value visualizer macro=\tikz@dv@legend@entry@as@example + }, + text left/.style={ + node style={anchor=mid east,inner ysep=1pt,inner xsep=0pt,reset + cm,xshift=-.333em,align=right}, + value visualizer style={reset cm,xscale=-1}, + value visualizer macro=\tikz@dv@legend@entry@as@example + }, + text only/.style={ + node style={anchor=mid west,inner ysep=1pt,inner xsep=0pt,reset cm,text=visualizer color}, + value visualizer style={}, + value visualizer macro=\relax, + }, + text colored/.style=/tikz/data visualization/text colored, +} + + +\pgfkeys{ + /tikz/data visualization/visualizer options/.cd, + label in legend/.code={\expandafter\tikz@dv@new@label@in@legend@for@visualizer\expandafter{\tikz@visualizer}{#1}}, + label in data/.code=\tikzdatavisualizationset{new label visualizer/.expand once=\expandafter{\tikz@visualizer}{#1}}, + style/.style={/tikz/data visualization/visualizers/\tikz@visualizer/styling/.append style={#1}}, +} + +\def\tikz@dv@new@label@in@legend@for@visualizer#1#2{ + \tikzdatavisualizationset{ + new legend entry={ + every legend entry/.try, + every label in legend/.try, + /tikz/data visualization/every label/.try, + #2, + setup={/data point/visualizer=#1}, + /utils/exec=\pgfkeysgetvalue{/tikz/data visualization/legend entry options/value visualizer macro}\tikz@dv@visualizer@macro, + value visualizer={ + \scope[/tikz/data visualization/visualizers/#1/styling/.try] + \def\tikz@visualizer{#1} + \tikz@dv@visualizer@macro + \endscope + } + } + } +} + +\def\tikz@dv@legend@entry@as@example{ + \pgfkeysvalueof{/data point/\tikz@visualizer/execute at begin} + \tikz@plot@handler + \pgfplotstreamstart + \pgfkeysgetvalue{/tikz/data visualization/label in legend line coordinates}{\tikz@dv@temp} + \foreach \coordinate in \tikz@dv@temp + { \pgfplotstreampoint{\expandafter\tikz@scan@one@point\expandafter\pgfutil@firstofone\coordinate} } + \pgfplotstreamend + \pgfkeysvalueof{/data point/\tikz@visualizer/execute at end} + \pgfkeysvalueof{/data point/\tikz@visualizer/execute at begin} + \tikz@dv@plot@mark@maker + \pgfplotstreamstart + \pgfkeysgetvalue{/tikz/data visualization/label in legend mark coordinates}{\tikz@dv@temp} + \foreach \coordinate in \tikz@dv@temp + { \pgfplotstreampoint{\expandafter\tikz@scan@one@point\expandafter\pgfutil@firstofone\coordinate} } + \pgfplotstreamend + \pgfkeysvalueof{/data point/\tikz@visualizer/execute at end} +} + + +\tikzdatavisualizationset{ + label in legend line coordinates/.initial=, + label in legend mark coordinates/.initial=, + label in legend one mark/.style={ + label in legend line coordinates={}, + label in legend mark coordinates={(0,0)}, + }, + label in legend three marks/.style={ + label in legend line coordinates={}, + label in legend mark coordinates={(-3ex,-.3ex),(-1.5ex,.3ex),(0,0)}, + }, + straight label in legend line/.style={ + label in legend line coordinates={(-2em,0),(0,0)}, + label in legend mark coordinates={(-1.5em,0),(-.5em,0)}, + }, + zig zag label in legend line/.style={ + label in legend line coordinates={(-2em,0),(-1.5em,.3ex),(-.5em,-.3ex),(0,0)}, + label in legend mark coordinates={(-1.5em,.3ex),(-.5em,-.3ex)}, + }, + circular label in legend line/.style={ + label in legend line coordinates={% + ([xshift=-1em]0:.9em and .35ex),% + ([xshift=-1em]30:.9em and .35ex),% + ([xshift=-1em]60:.9em and .35ex),% + ([xshift=-1em]90:.9em and .35ex),% + ([xshift=-1em]120:.9em and .35ex),% + ([xshift=-1em]150:.9em and .35ex),% + ([xshift=-1em]180:.9em and .35ex),% + ([xshift=-1em]210:.9em and .35ex),% + ([xshift=-1em]240:.9em and .35ex), + ([xshift=-1em]270:.9em and .35ex),% + ([xshift=-1em]300:.9em and .35ex),% + ([xshift=-1em]330:.9em and .35ex)}, + label in legend mark coordinates={([xshift=-1em]120:.9em and .35ex),([xshift=-1em]-60:.9em and .35ex)}, + }, + gapped circular label in legend line/.style={ + label in legend line coordinates={% + ([xshift=-1em,yshift=.2ex]90:1.4ex and 0.9ex),% + ([xshift=-1em,yshift=.2ex]162:1.4ex and 0.9ex),% + ([xshift=-1em,yshift=.2ex]234:1.4ex and 0.9ex),% + ([xshift=-1em,yshift=.2ex]306:1.4ex and 0.9ex),% + ([xshift=-1em,yshift=.2ex]18:1.4ex and 0.9ex)}, + label in legend mark coordinates={ + ([xshift=-1em,yshift=.2ex]90:1.4ex and 0.9ex),% + ([xshift=-1em,yshift=.2ex]162:1.4ex and 0.9ex),% + ([xshift=-1em,yshift=.2ex]234:1.4ex and 0.9ex),% + ([xshift=-1em,yshift=.2ex]306:1.4ex and 0.9ex),% + ([xshift=-1em,yshift=.2ex]18:1.4ex and 0.9ex)} + }, + default label in legend path/.style={zig zag label in legend line}, + default label in legend closed path/.style={circular label in legend line}, + default label in legend mark/.style={label in legend one mark}, +} + + +\def\tikz@dv@legend@entry@visualizer@visualizer{ +} + + + +% +% Basic visualizers +% + +\tikzdatavisualizationset{ + visualize as line/.style={ + new object={ + when=after survey, + store=/tikz/data visualization/visualizers/#1, + class=plot handler visualizer, + arg1=#1, + arg2={\tikz@plot@handler,\tikz@dv@plot@mark@maker} + }, + new visualizer={#1}{% + every path/.style={draw}, + style={every mark/.append style={color=visualizer color}}, + straight line, + semithick, + color=visualizer color, + mark=none, + /tikz/data visualization/every visualize as line/.try, + }, + /data point/visualizer=#1 + }, + visualize as line/.default=line, + visualize as smooth line/.style={ + visualize as line={#1}, + #1={style=smooth line} + }, + visualize as smooth line/.default=line, + visualize as scatter/.style={ + visualize as line={#1}, + #1={style=no lines, + /tikz/data visualization/every visualize as scatter/.try}, + visualizer style sheet=cross marks + }, + visualize as scatter/.default=scatter +} + +\def\tikz@dv@plot@mark@maker{ + \let\tikz@options=\pgfutil@empty% + \let\tikz@transform=\pgfutil@empty% + \tikzset{solid,shift only,every mark}% + \tikz@options% + \pgfplothandlermark{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}} +} + + + + +% The following needs to be fixed... +\tikzdatavisualizationset{ + new rectangles visualizer/.style={ + new object={ + store=/tikz/data visualization/visualizers/#1, + class=rectangle visualizer, + arg1 from key=/tikz/data visualization/#1/attribute 1, + arg2 from key=/tikz/data visualization/#1/attribute 2, + arg3=#1/use path + }, + #1/attribute 1/.initial=x, + #1/attribute 2/.initial=y, + /data point/#1/use path/.initial=\pgfusepath{stroke}, + /data point/#1/style/.code=\pgfkeysalso{/data point/#1/use path={\path[every rectangles/.try,##1];}} + }, + rectangle visualizer/.default=rectangles +} + + + + + +% +% Style sheets +% + +% Style sheet handler + +\pgfkeysdef{/handlers/.style sheet}{% + \edef\pgf@marshal{ + \noexpand \pgfoonew \noexpand\tikz@dv@temp=new style attribute(\pgfkeyscurrentpath,#1) + \noexpand \tikz@dv@temp.default connects() + } + \pgf@marshal +} + +\tikzset{ + visualizer color/.code=\colorlet{visualizer color}{#1}, + visualizer color=black +} + +% Default style sheets + +\pgfdvdeclarestylesheet{vary thickness} +{ + default style/.style={line width={0.3pt+#1*0.2pt}} +} + +\pgfdvdeclarestylesheet{vary dashing} +{ + default style/.style=solid, + 1/.style=solid, + 2/.style={dash pattern=on 5\pgflinewidth off 2\pgflinewidth}, + 3/.style={dash pattern=on 1.5\pgflinewidth off 1.5\pgflinewidth}, + 4/.style={dash pattern=on 5\pgflinewidth off 1.5\pgflinewidth on 1.5\pgflinewidth off 1.5\pgflinewidth}, + 5/.style={dash pattern=on 10\pgflinewidth off 3\pgflinewidth}, + 6/.style={dash pattern=on 10\pgflinewidth off 2\pgflinewidth on 2\pgflinewidth off 2\pgflinewidth}, + 7/.style={dash pattern=on 8\pgflinewidth off 2\pgflinewidth on + 1.5\pgflinewidth off 1.5\pgflinewidth on 1.5\pgflinewidth off + 1.5\pgflinewidth on 1.5\pgflinewidth off 1.5\pgflinewidth} +} + +\pgfdvdeclarestylesheet{vary thickness and dashing} +{ + default style/.style=thin, + 1/.style=thin, + 2/.style=thick, + 3/.style={ + dash pattern=on 5\pgflinewidth off 2\pgflinewidth, + thin + }, + 4/.style={ + dash pattern=on 5\pgflinewidth off 2\pgflinewidth, + thick, + }, + 5/.style={ + dash pattern=on 1.5\pgflinewidth off 1.5\pgflinewidth, + thin + }, + 6/.style={ + dash pattern=on 1.5\pgflinewidth off 1.5\pgflinewidth, + thick + }, + 7/.style={ + dash pattern=on 5\pgflinewidth off 1.5\pgflinewidth on + 1.5\pgflinewidth off 1.5\pgflinewidth, + thin + }, + 8/.style={ + dash pattern=on 5\pgflinewidth off 1.5\pgflinewidth on + 1.5\pgflinewidth off 1.5\pgflinewidth, + thick + }, + 9/.style={ + dash pattern=on 10\pgflinewidth off 3\pgflinewidth, + thin + }, + 10/.style={ + dash pattern=on 10\pgflinewidth off 3\pgflinewidth, + thick + }, + 11/.style={ + dash pattern=on 10\pgflinewidth off 2\pgflinewidth on + 2\pgflinewidth off 2\pgflinewidth, + thin + }, + 12/.style={ + dash pattern=on 10\pgflinewidth off 2\pgflinewidth on + 2\pgflinewidth off 2\pgflinewidth, + thick + }, + 13/.style={ + dash pattern=on 8\pgflinewidth off 2\pgflinewidth on + 1.5\pgflinewidth off 1.5\pgflinewidth on 1.5\pgflinewidth off + 1.5\pgflinewidth on 1.5\pgflinewidth off 1.5\pgflinewidth, + thin + }, + 14/.style={ + dash pattern=on 8\pgflinewidth off 2\pgflinewidth on + 1.5\pgflinewidth off 1.5\pgflinewidth on 1.5\pgflinewidth off + 1.5\pgflinewidth on 1.5\pgflinewidth off 1.5\pgflinewidth, + thick + } +} + + +\pgfdvdeclarestylesheet{strong colors} +{ + default style/.style={black}, + 1/.style={visualizer color=black}, + 2/.style={visualizer color=red!80!black}, + 3/.style={visualizer color=blue!80!black}, + 4/.style={visualizer color=green!60!black}, + 5/.style={visualizer color=orange!80!black}, + 6/.style={visualizer color=black!60} +} + + +\pgfdvdeclarestylesheet{cross marks} +{ + default style/.style={mark=x,every mark/.append style=thin,mark size=1.8pt}, + 1/.style={mark=x,every mark/.append style=thin,mark size=1.8pt}, + 2/.style={mark=+,every mark/.append style=thin,mark size=1.8pt}, + 3/.style={mark=Mercedes star,every mark/.append style=thin,mark size=1.8pt}, + 4/.style={mark=Mercedes star flipped,every mark/.append style=thin,mark size=1.8pt}, + 5/.style={mark=star,every mark/.append style=thin,mark size=1.8pt}, + 6/.style={mark=10-pointed star,every mark/.append style={line width=.3pt,mark size=1.6pt}} +} + + + +% Declare a color series style sheet +% +% #1 = name of the style sheet +% #2 = color model +% #3 = initial color +% #4 = step +% +% Description: +% +% This function declares a style sheet that changes colors according +% to the value of the attribute. No test is made that the attribute is +% a number. + +\def\tikzdvdeclarestylesheetcolorseries#1#2#3#4{ + \definecolorseries{tikzdvcolorseries#1}{#2}{step}[#2]{#3}{#4} + \resetcolorseries{tikzdvcolorseries#1} + \pgfdvdeclarestylesheet{#1} + { + default style/.style={ + /utils/exec=\colorlet{tikz@dv@temp}[rgb]{tikzdvcolorseries#1!![##1]}, + visualizer color=tikz@dv@temp + } + } +} + +\tikzdvdeclarestylesheetcolorseries{varying hue}{hsb}{.4,0.9,0.8}{.213,0,0} +\tikzdvdeclarestylesheetcolorseries{shades of blue}{hsb}{.65,1.4,1}{0,-.4,-.0} +\tikzdvdeclarestylesheetcolorseries{shades of red}{hsb}{0,1.4,1}{0,-.4,-.0} + + + + + +% +% Basic Axes & Coordinate Systems +% + + +% +% +% Basic axis systems +% +% + +\tikzdatavisualizationset{ + xy Cartesian/.style={ + new Cartesian axis=x axis, + x axis={attribute=x,unit vector={(1pt,0cm)}}, + new Cartesian axis=y axis, + y axis={attribute=y,unit vector={(0cm,1pt)}} + }, + xy axes/.style={x axis={#1},y axis={#1}}, + uv Cartesian/.style={ + new Cartesian axis=u axis, + u axis={attribute=u,unit vector={(1pt,0cm)}}, + new Cartesian axis=v axis, + v axis={attribute=v,unit vector={(0cm,1pt)}} + }, + uv axes/.style={u axis={#1},v axis={#1}}, +} + +\tikzdatavisualizationset{ + xyz Cartesian cabinet/.style={ + xy Cartesian, + new Cartesian axis=z axis, + z axis={attribute=z,unit vector={(-0.353553pt,-0.353553pt)}} + }, + xyz axes/.style={x axis={#1},y axis={#1},z axis={#1}}, + uvw Cartesian cabinet/.style={ + uv Cartesian, + new Cartesian axis=w axis, + w axis={attribute=w,unit vector={(-0.353553pt,-0.353553pt)}} + } + uvw axes/.style={u axis={#1},v axis={#1},w axis={#1}}, +} + + + + +% The school book axes +% +% This coordinate system can be used to create plots that look like +% plots in a typical school book: There are two axes called "x axis" +% and "y axis" that meet at the origin, there are arrows at the ends +% of the axes, pointing in the directions of the positive axes. No +% scaling is done by default, rather one unit equals one 1cm. This +% ensures that the even when multiple plots are created, the same +% scaling will be used each time. +% +% To change the scaling, say "all axes={unit length=1mm}" for +% instance. + +\tikzdatavisualizationset{ + school book axes/.style={ + xy Cartesian, + x axis={ + include values=0, + visualize axis={y axis={goto=0},style=->,padded}, + visualize ticks={common={y axis={goto=0},direction axis=y axis}, + major={tick text at low, + options at=0 as [{style={draw=none},no tick text}] + }}, + visualize grid={common={direction axis=y axis,padded}}, + ticks={step=1}, + padding=0.75em, + visualize label={visualize x axis label} + }, + y axis={ + include values=0, + visualize axis={x axis={goto=0},style=->,padded}, + visualize ticks={ + common={x axis={goto=0},direction axis=x axis}, + major={tick text at low,options at=0 as [{high=0,low=0,style={draw=none},node style={anchor=north east}}]} + }, + visualize grid={common={direction axis=x axis,padded}}, + ticks={step=1}, + padding=0.75em, + visualize label={visualize y axis label} + }, + school book axes standard labels, + every school book axes/.try + } +} + + +% Possible axis positionings: + +\tikzdatavisualizationset{ + % + % Place labels at the ends of the axes + school book axes standard labels/.style={ + visualize x axis label/.style={ + value=padded max, + y axis={goto=0} + }, + visualize y axis label/.style={ + value=padded max, + x axis={goto=0} + } + } +} + + +% The scientific axes +% +% The scientific axes is a 2d plot that has a predetermined width and +% height. The data is then scaled in such a way that it fits inside +% this given rectangle. + +\tikzdatavisualizationset{ + scientific axes/width/.initial=5cm, + scientific axes/height/.initial=0.618*\pgfkeysvalueof{/tikz/data visualization/scientific axes/width},% golden ratio... + scientific axes/.style={ + xy Cartesian, + every axis/.append style={style={draw=black!50}}, + every ticks/.append style={style={draw=black!50}}, + x axis={ + length=\pgfkeysvalueof{/tikz/data visualization/scientific axes/width}, + ticks={some}, + visualize ticks={common={y axis={goto=padded min},direction axis=y axis,high=0pt},major={tick text at low}}, + visualize ticks={common={y axis={goto=padded max},direction axis=y axis,low=0pt}}, + visualize axis={y axis={goto=padded min},padded}, + visualize axis={y axis={goto=padded max},padded}, + visualize grid={common={direction axis=y axis,padded}}, + visualize label=visualize x axis label + }, + y axis={ + length=\pgfkeysvalueof{/tikz/data visualization/scientific axes/height}, + ticks={some}, + visualize ticks={common={x axis={goto=padded min},direction axis=x axis,high=0pt},major={tick text at low}}, + visualize ticks={common={x axis={goto=padded max},direction axis=x axis,low=0pt}}, + visualize axis={x axis={goto=padded min},padded}, + visualize axis={x axis={goto=padded max},padded}, + visualize grid={common={direction axis=x axis,padded}}, + visualize label=visualize y axis label + }, + scientific axes standard labels, + every scientific axes/.try + }, + scientific inner axes/.style={ + xy Cartesian, + every axis/.append style={style={draw=black!50}}, + every ticks/.append style={style={draw=black!50}}, + x axis={ + length=\pgfkeysvalueof{/tikz/data visualization/scientific axes/width}, + ticks={some}, + visualize ticks={common={y axis={goto=padded min},direction axis=y axis,low=0pt},major={tick text at low}}, + visualize ticks={common={y axis={goto=padded max},direction axis=y axis,high=0pt}}, + visualize axis={y axis={goto=padded min},padded}, + visualize axis={y axis={goto=padded max},padded}, + visualize grid={common={direction axis=y axis,padded}}, + visualize label=visualize x axis label + }, + y axis={ + length=\pgfkeysvalueof{/tikz/data visualization/scientific axes/height}, + ticks={some}, + visualize ticks={common={x axis={goto=padded min},direction axis=x axis,low=0pt},major={tick text at low}}, + visualize ticks={common={x axis={goto=padded max},direction axis=x axis,high=0pt}}, + visualize axis={x axis={goto=padded min},padded}, + visualize axis={x axis={goto=padded max},padded}, + visualize grid={common={direction axis=x axis,padded}}, + visualize label=visualize y axis label + }, + scientific axes standard labels, + every scientific axes/.try + }, + scientific clean axes/.style={ + xy Cartesian, + x axis={ + length=\pgfkeysvalueof{/tikz/data visualization/scientific axes/width}, + ticks={some}, + visualize ticks={common={y axis={goto=padded min},direction axis=y axis,high=0pt},major={tick text at low}}, + visualize axis={y axis={goto=padded min}}, + visualize grid={common={direction axis=y axis}}, + visualize label=visualize x axis label, + grid={major={also at=min,also at=max}}, + }, + y axis={ + length=\pgfkeysvalueof{/tikz/data visualization/scientific axes/height}, + ticks={some}, + visualize ticks={common={x axis={goto=padded min},direction axis=x axis,high=0pt},major={tick text at low}}, + visualize axis={x axis={goto=padded min}}, + visualize grid={common={direction axis=x axis}}, + visualize label=visualize y axis label, + grid={major={also at=min,also at=max}}, + }, + all axes={padding=.5em}, + scientific axes standard labels, + every scientific axes/.try + }, +} + + + +% Possible axis positionings: + +\tikzdatavisualizationset{ + % + % Place axes labels below and left, where left label is rotated + % + scientific axes standard labels/.style={ + visualize x axis label/.style={ + % Horizontal position is middle of axis: + pos=0.5, + y axis={goto=padded min}, + % Vertical position comes from bounding box: + node style={ + at={(0,0 |- data visualization bounding box.south)}, + below + } + }, + visualize y axis label/.style={% + % Vertical position is middle of axis: + pos=0.5, + x axis={goto=padded min}, + % Horizontal position comes from bounding box: + node style={ + at={(0,0 -| data visualization bounding box.west)}, + rotate=90, + above} + } + }, + % + % Place axes labels below and left, no rotation + % + scientific axes upright labels/.style={ + scientific axes standard labels, + visualize y axis label/.style={% + % Vertical position is middle of axis: + pos=0.5, + x axis={goto=padded min}, + % Horizontal position comes from bounding box: + node style={ + at={(0,0 -| data visualization bounding box.west)}, + left + } + } + }, + % + % Place axes at the ends of the axes + % + scientific axes end labels/.style={ + visualize x axis label/.style={ + value=max, + y axis={goto=padded min}, + % Vertical position comes from bounding box: + node style={ + at={(0,0 -| data visualization bounding box.east)}, + right + } + }, + visualize y axis label/.style={ + value=max, + x axis={goto=padded min}, + % Horizontal position comes from bounding box: + node style={ + at={(0,0 |- data visualization bounding box.north)}, + above + } + } + } +} + + + +\endinput + diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.formats.functions.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.formats.functions.code.tex new file mode 100644 index 00000000000..4a4d0896ec8 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.formats.functions.code.tex @@ -0,0 +1,16 @@ +% Copyright 2008 by Till Tantau +% +% This file may be distributed and/or modified +% +% 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. + +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.formats.functions.code.tex,v 1.1 2008/12/09 00:12:10 tantau Exp $ + +\usetikzlibrary{datavisualization} +\usepgflibrary{datavisualization.formats.functions} + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.polar.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.polar.code.tex new file mode 100644 index 00000000000..8b4d99f49dd --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.polar.code.tex @@ -0,0 +1,62 @@ +% Copyright 2008 by Till Tantau +% +% This file may be distributed and/or modified +% +% 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. + +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.polar.code.tex,v 1.3 2008/11/24 18:31:22 tantau Exp $ + +\usetikzlibrary{datavisualization} +\usepgflibrary{datavisualization.polar} + + +\tikzdatavisualizationset{% + new polar/.style={ + new axis=angle axis, + angle axis={attribute=angle}, + new axis=radius axis, + radius axis={attribute=radius}, + radius axis/scaling/default=0 at 0 and 1 at 1cm, + new object={ + store=/tikz/data visualization/polar transformer, + class=polar transformer, + arg1/.expanded=\pgfkeysvalueof{/tikz/data visualization/angle axis/attribute}/scaled, + arg2/.expanded=\pgfkeysvalueof{/tikz/data visualization/radius axis/attribute}/scaled, + arg3 from key=/tikz/data visualization/#1/unit vector 0 degrees, + arg4 from key=/tikz/data visualization/#1/unit vector 90 degrees + }, + /tikz/data visualization/#1/unit vector 0 degrees/.initial=\pgfqpoint{1pt}{0pt}, + /tikz/data visualization/#1/unit vector 90 degrees/.initial=\pgfqpoint{0pt}{1pt}, + /tikz/data visualization/#1/unit vectors/.code 2 args={ + \def\tikz@dv@polar{/tikz/data visualization/#1} + \tikz@scan@one@point\tikz@lib@dv@polar@a##1 + \tikz@scan@one@point\tikz@lib@dv@polar@b##2 + } + }, + new polar/.default=polar +} +\def\tikz@lib@dv@polar@a#1{ + \pgfkeyssetvalue{\tikz@dv@polar/unit vector 0 degrees}{#1} +} +\def\tikz@lib@dv@polar@b#1{ + \pgfkeyssetvalue{\tikz@dv@polar/unit vector 90 degrees}{#1} +} + + +\tikzset{ + /tikz/data visualization/axis options/.cd, + deg/.style={\tikz@dv@axis/scaling=0 at 0 and 360 at 360}, + rad/.style={\tikz@dv@axis/scaling=0 at 0 and pi at 180}, + grad/.style={\tikz@dv@axis/scaling=0 at 0 and 400 at 360}, + percent/.style={\tikz@dv@axis/scaling=0 at 0 and 100 at 360}, + full circle/.style={\tikz@dv@axis/scaling=min at 0 and max at 360}, + half circle/.style={\tikz@dv@axis/scaling=min at 0 and max at 180}, + quarter circle/.style={\tikz@dv@axis/scaling=min at 0 and max at 90} +} + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.sparklines.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.sparklines.code.tex new file mode 100644 index 00000000000..69736423596 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.sparklines.code.tex @@ -0,0 +1,38 @@ +% Copyright 2008 by Till Tantau +% +% This file may be distributed and/or modified +% +% 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. + +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.sparklines.code.tex,v 1.1 2008/12/17 22:48:46 tantau Exp $ + +\usetikzlibrary{datavisualization} + + + + +% +% Sparklines (not yet usable...) +% + +\tikzdatavisualizationset{ + spark line/.style={ + xy Cartesian, + x axis={ + unit length={1pt} + }, + y axis={ + scaling={min at -0.2em and max at 0.8em} + }, + new line plot, + every spark line plot/.try + } +} + + + +\endinput + diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.basic.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.basic.code.tex new file mode 100644 index 00000000000..7464369161c --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.basic.code.tex @@ -0,0 +1,29 @@ +% Copyright 2010 by Till Tantau +% +% This file may be distributed and/or modified +% +% 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. + +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.basic.code.tex,v 1.1 2010/10/23 16:35:41 tantau Exp $ + + + +% +% This is jsut a place-holder +% + +\tikzset{graphs/n/.initial=1} + +\tikzdefgraph{K} +{ + \pgfkeysgetvalue{/tikz/graphs/n}\tikz@lib@graph@temp@n +} +{ + [connect as=clique] + \foreach \tikz@lib@graph@temp@i in {1,...,\tikz@lib@graph@temp@n} + { \tikz@lib@graph@temp@i [at=(\tikz@lib@graph@temp@i*360/\tikz@lib@graph@temp@n:2cm)] } +} + diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.code.tex new file mode 100644 index 00000000000..32fd3a374a7 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.code.tex @@ -0,0 +1,877 @@ +% Copyright 2010 by Till Tantau +% +% This file may be distributed and/or modified +% +% 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. + +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.code.tex,v 1.1 2010/10/23 16:35:41 tantau Exp $ + + +% +% Interface keys +% + +\tikzset{ + graphs/new edge directed/.code n args={3}{\path (#1) edge[->,#3] (#2);}, + graphs/new edge undirected/.code n args={3}{\path (#1) edge[-,#3] (#2);}, + graphs/new edge bidirected/.code n args={3}{\path (#1) edge[<->,#3] (#2);}, + graphs/new edge back directed/.style n args={3}{new edge directed={#2}{#1}{#3}}, + graphs/default edge kind/.initial=undirected +} + + +% +% Keys for using nodes declared outside a graph inside a graph as if +% it were declared there +% + +\tikzset{ + graphs/use existing nodes/.code=\tikz@lib@graph@alltrue +} + +\tikzset{ + new set/.code={ + \expandafter\global\expandafter\let\csname tikz@lg@node@set #1\endcsname\pgfutil@empty% + }, + set/.code={ + \expandafter\def\expandafter\tikz@alias\expandafter{\tikz@alias% + \expandafter\def\expandafter\pgf@temp\expandafter{\csname tikz@lg@node@set #1\endcsname}% + \expandafter\expandafter\expandafter\pgfutil@g@addto@macro\expandafter\pgf@temp\expandafter{\expandafter\tikz@lg@do\expandafter{\tikz@fig@name}}% + }% + },% +} + +\newif\iftikz@lib@graph@all + + +% +% Basic options +% + +\tikzset{ + graphs/@nodes styling/.style=, + graphs/nodes/.style={/tikz/graphs/@nodes styling/.append style={,#1}}, + graphs/@edges styling/.initial=, + graphs/edges/.style={/tikz/graphs/@edges styling/.append={,#1}}, + graphs/join/.initial=match, + graphs/connect as/.initial=, +} + + +% +% The parser +% + +\def\tikz@lib@graph@parser{% + \pgfutil@ifnextchar[{\tikz@lib@graph@parser@}{\tikz@lib@graph@parser@[]}%] +} + +\long\def\tikz@lib@graph@parser@[#1]#2{% + \scope[graphs/.cd,every graph/.try,#1]% + \let\tikz@lib@graph@options\pgfutil@empty% + \let\tikz@lib@graph@node@list\pgfutil@empty% + \tikz@lib@graph@parse@group{#2}% + \let\tikz@lg@do=\tikz@lib@graph@cleanup% + \tikz@lib@graph@node@list% + \endscope% + \tikz@lib@graph@parser@done% +} + + + + +\long\def\tikz@lib@graph@parse@group#1{% + \let\tikz@lib@graph@group@c\pgfutil@empty% + \let\tikz@lib@graph@group@cont\pgfutil@empty% + \let\tikz@lib@graph@group@conta\pgfutil@empty% + \tikz@lib@graph@par#1\par\pgf@stop@eogroup% +} + + + +% +% Remove \par +% + +\long\def\tikz@lib@graph@par#1\par{% + \pgfutil@ifnextchar\pgf@stop@eogroup{% + \expandafter\tikz@lib@graph@encloser\tikz@lib@graph@group@c#1[}{% + \expandafter\def\expandafter\tikz@lib@graph@group@c\expandafter{\tikz@lib@graph@group@c#1}% + \tikz@lib@graph@par% + }% +} + + +% +% Replace ...[...]... by ...[{...}]... +% +\def\tikz@lib@graph@encloser#1[{% + \pgfutil@ifnextchar\pgf@stop@eogroup{% + \expandafter\tikz@lib@graph@semi\tikz@lib@graph@group@cont#1;% + }{% + \expandafter\def\expandafter\tikz@lib@graph@group@cont\expandafter{\tikz@lib@graph@group@cont#1[}%] + \tikz@lib@graph@encloser@cont% + }% +} + +\def\tikz@lib@graph@encloser@cont#1]#2[{% + \pgfutil@ifnextchar\pgf@stop@eogroup{% + \expandafter\tikz@lib@graph@semi\tikz@lib@graph@group@cont{#1}]#2;}{% + \expandafter\def\expandafter\tikz@lib@graph@group@cont\expandafter{\tikz@lib@graph@group@cont{#1}]#2[}% + \tikz@lib@graph@encloser@cont}% +} + + +% +% Replace ; by , +% + +\def\tikz@lib@graph@semi#1;{% + \pgfutil@ifnextchar\pgf@stop@eogroup{% + \expandafter\tikz@lib@graph@start@group\tikz@lib@graph@group@conta#1,}{% + \expandafter\def\expandafter\tikz@lib@graph@group@conta\expandafter{\tikz@lib@graph@group@conta#1,}% + \tikz@lib@graph@semi% + }% +} + + + +% +% Start of a group +% +\def\tikz@lib@graph@start@group{% + \pgfutil@ifnextchar[\tikz@lib@graph@start@group@opt{\tikz@lib@graph@start@group@opt[]}%] +} + +\def\tikz@lib@graph@start@group@opt[#1]{% + \pgfkeys{/tikz/graphs/.cd,connect as=,every group/.try,#1}% + \tikz@lib@graph@main@parser% +} + + +% +% Main parse +% + +\def\tikz@lib@graph@main@parser#1,{% + \begingroup% + \let\tikz@lib@graph@stored@actions\pgfutil@empty% + \let\tikz@lib@graph@node@list\pgfutil@empty% reset + \tikz@lib@graph@parse@one#1-\pgf@stop@eodashes% +} + + +\def\tikz@lib@graph@parse@one{% + \pgfutil@ifnextchar\bgroup\tikz@lib@graph@scope\tikz@lib@graph@node% +} + + + + +% A normal node + +\def\tikz@lib@graph@node#1-{% + % Detect trailing < + \tikz@lib@graph@@node#1<\pgf@stop% +} + +\def\tikz@lib@graph@@node#1<#2\pgf@stop% +{ + % + % #1 will be a node (not a group) + % + % Syntax: node name [options] + % + % Grab node name + \tikz@lib@graph@grab@name#1[\pgf@stop% + \tikz@lib@graph@stored@actions% + \pgfutil@ifnextchar\pgf@stop@eodashes{% + \tikz@lib@graph@graph@done% + }{% + % + % Now, get arrow kind + % + \def\pgf@test{#2}% + \ifx\pgf@test\pgfutil@empty% + \expandafter\tikz@lib@graph@no@back@arrow% + \else% + \expandafter\tikz@lib@graph@back@arrow% + \fi% + }% +} + +\def\tikz@lib@graph@no@back@arrow{% + \pgfutil@ifnextchar>\tikz@lib@graph@forward@arrow{% + \pgfutil@ifnextchar-\tikz@lib@graph@undirected@arrow{% + \PackageError{graphs library}{One of the arrow types <-, --, ->, or <-> expected}{}% + \tikz@lib@graph@undirected@arrow% + }% + }% +} + +\def\tikz@lib@graph@undirected@arrow-{% + \def\tikz@lib@graph@arrow@type{undirected}% + \tikz@lib@graph@after@arrow% +} + +\def\tikz@lib@graph@forward@arrow>{% + \def\tikz@lib@graph@arrow@type{directed}% + \tikz@lib@graph@after@arrow% +} + +\def\tikz@lib@graph@bi@arrow>{% + \def\tikz@lib@graph@arrow@type{bidirected}% + \tikz@lib@graph@after@arrow% +} + +\def\tikz@lib@graph@back@arrow{% + \pgfutil@ifnextchar>{\tikz@lib@graph@bi@arrow}{% + \def\tikz@lib@graph@arrow@type{back directed}% + \tikz@lib@graph@after@arrow% + }% +} + +\def\tikz@lib@graph@after@arrow{% + \pgfutil@ifnextchar[{\tikz@lib@graph@after@arrow@opt}{\tikz@lib@graph@after@arrow@opt[]}%] +} + +\def\tikz@lib@graph@after@arrow@opt[#1]{% + % + % Ok, first recolor + % + \pgfkeys{/tikz/graph node/recolor in by=in''} + \pgfkeys{/tikz/graph node/recolor out by=out'} + % Save action for next node + \expandafter\def\expandafter\tikz@lib@graph@stored@actions\expandafter{% + \expandafter\tikz@lib@graph@joiner\expandafter{\tikz@lib@graph@arrow@type}{#1}}% + \tikz@lib@graph@parse@one% +} + +\def\tikz@lib@graph@joiner#1#2{% + \pgfkeys{/tikz/graph node/recolor in by=in'} + \pgfkeys{/tikz/graph node/recolor in'' by=in} + {% + \pgfkeyssetvalue{/tikz/graphs/default edge kind}{#1}% + \pgfkeys{/tikz/graphs/.cd,#2}% + \pgfkeysgetvalue{/tikz/graphs/join}\pgf@temp% + \expandafter\tikz@lg@do@connector\expandafter{\pgf@temp}% + }% + \pgfkeys{/tikz/graph node/!in',/tikz/graph node/!out'} +} + +\def\tikz@lib@graph@graph@done\pgf@stop@eodashes{% + % Get node list outside... + \expandafter% + \endgroup% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\tikz@lib@graph@node@list% + \expandafter\expandafter\expandafter{\expandafter\tikz@lib@graph@node@list\tikz@lib@graph@node@list}% + \pgfutil@ifnextchar\pgf@stop@eogroup% + \tikz@lib@graph@graph@group@done% + \tikz@lib@graph@main@parser% +} + +\def\tikz@lib@graph@graph@group@done\pgf@stop@eogroup{% + \pgfkeysgetvalue{/tikz/graphs/connect as}\tikz@lib@graph@group@connector + \expandafter\tikz@lg@do@connector\expandafter{\tikz@lib@graph@group@connector} +} + +\def\tikz@lg@do@connector#1{% + \tikzset{/tikz/connectors/.cd,#1} +} + + + +% +% Handle node +% +\def\tikz@lib@graph@grab@name{% + \pgfutil@ifnextchar\foreach\tikz@lib@graph@do@foreach\tikz@lib@graph@grab@name@@% +} + +\def\tikz@lib@graph@do@foreach\foreach#1in#2#3[\pgf@stop{% + % Ok, we do a parse on a foreach loop. + % We have to make sure that we + \begingroup + \let\tikz@lib@graph@node@list@saved\pgfutil@empty% + \foreach #1 in {#2}% + {% + \let\tikz@lib@graph@node@list\tikz@lib@graph@node@list@saved% + \tikz@lib@graph@parse@group{#3}% + \global\let\tikz@lib@graph@node@list@saved\tikz@lib@graph@node@list% + }% + \expandafter% + \endgroup% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\tikz@lib@graph@node@list% + \expandafter\expandafter\expandafter{\expandafter\tikz@lib@graph@node@list\tikz@lib@graph@node@list@saved}% +} + + +\def\tikz@lib@graph@grab@name@@#1[{% + \tikz@lib@graph@read#1\pgf@stop% + \let\tikz@lib@graph@as\tikz@lib@graph@as@default% + \pgfutil@ifnextchar\pgf@stop{% + \ifx\tikz@lib@graph@name\pgfutil@empty% + \else + \expandafter\tikz@lib@graph@noskip% + \fi% + }{\tikz@lib@graph@node@opt[}% +} +\def\tikz@lib@graph@noskip{\tikz@lib@graph@node@opt[][}%] + +\def\tikz@lib@graph@as@default{% + \let\tikzgraphnodename\tikz@lib@graph@name% + \tikz@lib@graph@typesetter% +} + +\def\tikz@lib@graph@read#1\pgf@stop{% + \pgfkeys@spdef\tikz@lib@graph@name{#1}% + \edef\tikz@lib@graph@name{\tikz@lib@graph@path\tikz@lib@graph@name}% +} + + +\def\tikz@lib@graph@node@opt[#1]#2[\pgf@stop{% + \ifx\tikz@lib@graph@name\tikz@lib@graph@usetext + % Ok, make a list of the nodes stored in #1: + \let\tikz@lg@temp\pgfutil@empty% + \foreach \tikz@lg@node@name in {#1} {\expandafter\tikz@lib@graph@handle@use\expandafter{\tikz@lg@node@name}} + % Ok, now add the nodes to the node list + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\tikz@lib@graph@node@list% + \expandafter\expandafter\expandafter{% + \expandafter\tikz@lib@graph@node@list\tikz@lg@temp}% + % Then color and initialize them: + \let\tikz@lg@do\tikz@lib@graph@do@use% + \tikz@lg@temp% + \else% + \expandafter\ifx\csname tikz@lib@graph@def@\tikz@lib@graph@name\endcsname\relax% + {% + \edef\tikz@lib@graph@node@list{\noexpand\tikz@lg@do{\tikz@lib@graph@name}}% + \tikz@lg@if@local@node{\tikz@lib@graph@name}% + {\tikzset{/tikz/graph node/.cd,in,out,#1}}% + {% + \tikz@lg@init@color{\tikz@lib@graph@name}{\tikz@lgc@all@true\tikz@lgc@in@true\tikz@lgc@out@true}% + \iftikz@lib@graph@all% + \tikzset{/tikz/graph node/.cd,#1}% + \else% + \node [name=\tikz@lib@graph@name,/tikz/graph + node/.cd,/tikz/graphs/@nodes styling,#1] + {\tikz@lib@graph@as};% + \fi + }% + }% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\tikz@lib@graph@node@list% + \expandafter\expandafter\expandafter{% + \expandafter\tikz@lib@graph@node@list\expandafter\tikz@lg@do\expandafter{\tikz@lib@graph@name}}% + \else + % The name of the node is a graph name + \tikz@lib@graph@handle@graph{#1}% + \fi + \fi% +} + +\def\tikz@lib@graph@handle@use#1{% + % Is #1 the name of a node set? + \expandafter\let\expandafter\pgf@temp\csname tikz@lg@node@set #1\endcsname + \ifx\pgf@temp\relax + \pgfutil@g@addto@macro\tikz@lg@temp{\tikz@lg@do{#1}} + \else% + \expandafter\pgfutil@g@addto@macro\expandafter\tikz@lg@temp\expandafter{\pgf@temp} + \fi +} + +\def\tikz@lib@graph@do@use#1{% + \tikz@lg@init@color{#1}{\tikz@lgc@all@true\tikz@lgc@in@true\tikz@lgc@out@true}% +} + +\def\tikz@lib@graph@usetext{use} + +\def\tikz@lib@graph@typeset@def#1 as #2\pgf@stop{ + \def\tikz@lib@graph@typesetter#1\pgf@stop{#2} +} + +\tikzset{ + graphs/typeset/.store in=\tikz@lib@graph@typesetter, + graphs/math nodes/.style={/tikz/graphs/typeset=$\tikzgraphnodename$}, + graphs/empty nodes/.style={/tikz/graphs/typeset=}, + graphs/typeset=\tikzgraphnodename +} + + +% +% Handle scope +% +\def\tikz@lib@graph@scope#1{ + \begingroup + \let\tikz@lib@graph@node@list\pgfutil@empty% + \tikz@lib@graph@parse@group{#1}% + \expandafter% + \endgroup% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\tikz@lib@graph@node@list% + \expandafter\expandafter\expandafter{\expandafter\tikz@lib@graph@node@list\tikz@lib@graph@node@list}% + \tikz@lib@graph@stored@actions% + \pgfutil@ifnextchar-{\tikz@lib@graph@scope@minus}{% + \pgfutil@ifnextchar<{\tikz@lib@graph@scope@less}{% + \PackageError{graphs library}{One of the arrow types <-, --, ->, + or <-> expected}{}% + }% + }% +} + +\def\tikz@lib@graph@scope@minus-{ + \pgfutil@ifnextchar>\tikz@lib@graph@forward@arrow{% + \pgfutil@ifnextchar-\tikz@lib@graph@undirected@arrow{% + \pgfutil@ifnextchar\pgf@stop@eodashes\tikz@lib@graph@graph@done{% + \PackageError{graphs library}{One of the arrow types <-, --, ->, or <-> expected}{}% + \tikz@lib@graph@undirected@arrow% + }% + }% + }% +} + +\def\tikz@lib@graph@scope@less<-{\tikz@lib@graph@back@arrow}% + + + + +% +% Predefining graphs +% + +\def\tikzdefgraph#1#2#3{% + \expandafter\def\csname tikz@lib@graph@def@#1\endcsname{\tikz@lib@graph@do@graph{#2}{#3}}% +} + +\def\tikz@lib@graph@handle@graph#1{% + \begingroup% + \let\tikz@lib@graph@node@list\pgfutil@empty% + \tikzset{graphs/.cd,#1}% + \csname tikz@lib@graph@def@\tikz@lib@graph@name\endcsname% + \expandafter% + \endgroup% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\tikz@lib@graph@node@list% + \expandafter\expandafter\expandafter{\expandafter\tikz@lib@graph@node@list\tikz@lib@graph@node@list}% +} + +\def\tikz@lib@graph@do@graph#1#2{% + #1% + \tikz@lib@graph@parse@group{#2}% +} + +\let\tikz@lib@graph@path\pgfutil@empty + +\tikzset{graphs/name/.code={% + \edef\tikz@lib@graph@path{#1\space\tikz@lib@graph@path}% + }% +} + + +% +% Colors +% + +\tikzset{ + graph node/.unknown/.code={% + \let\tikz@key\pgfkeyscurrentname% + \pgfkeys{/tikz/\tikz@key={#1}}% + }, + graph node/as/.code=\def\tikz@lib@graph@as{#1}% +} + + +\tikzset{% + new graph color/.style={% + /utils/exec=\expandafter\newif\csname iftikz@lgc@#1@\endcsname, + graph node/#1/.code={% + \edef\tikz@lg@col{\expandafter\noexpand\csname tikz@lgc@#1@true\endcsname}% + \let\tikz@lg@do\tikz@lg@colorize% + \tikz@lib@graph@node@list% + }, + graph node/!#1/.code={% + \edef\tikz@lg@old@col{\expandafter\noexpand\csname tikz@lgc@#1@true\endcsname}% + \def\tikz@lg@new@col{}% + \let\tikz@lg@do\tikz@lg@change@color% + \tikz@lib@graph@node@list% + }, + graph node/recolor #1 by/.code={% + \edef\tikz@lg@old@col{\expandafter\noexpand\csname tikz@lgc@#1@true\endcsname}% + \edef\tikz@lg@new@col{\expandafter\noexpand\csname tikz@lgc@##1@true\endcsname}% + \let\tikz@lg@do\tikz@lg@change@color% + \tikz@lib@graph@node@list% + }, + graph node/not #1/.style=!#1, + }, + new graph color=in, + new graph color=in', + new graph color=in'', + new graph color=out, + new graph color=out', + new graph color=all +} + +\def\tikz@lg@init@color#1#2{% + \expandafter\gdef\csname tikz@lgc@#1\endcsname{#2}% +} + +\def\tikz@lib@graph@cleanup#1{% + \expandafter\global\expandafter\let\csname tikz@lgc@#1\endcsname\relax% +} + +\def\tikz@lg@colorize#1{% + \expandafter\let\expandafter\pgf@temp\csname tikz@lgc@#1\endcsname% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\pgf@temp% + \expandafter\expandafter\expandafter{% + \expandafter\tikz@lg@col\pgf@temp}% + \expandafter\global\expandafter\let\csname tikz@lgc@#1\endcsname\pgf@temp% +} + +\def\tikz@lg@change@color#1{% + \def\tikz@lg@temp@save{#1}% + \let\tikz@lg@collect\pgfutil@empty% + \expandafter\let\expandafter\pgf@temp\csname tikz@lgc@#1\endcsname% + \expandafter\tikz@lg@change@check\pgf@temp\pgf@stop% +} +\def\tikz@lg@change@check#1{% + \ifx#1\pgf@stop% + \tikz@lg@change@write@back% + \else% + \def\pgf@temp{#1}% + \ifx\pgf@temp\tikz@lg@old@col% + \expandafter\tikz@lg@change@add\expandafter{\tikz@lg@new@col}% Found! + \else% + \tikz@lg@change@add{#1}% + \fi% + \expandafter\tikz@lg@change@check + \fi% +} +\def\tikz@lg@change@add#1{% + \expandafter\def\expandafter\tikz@lg@collect\expandafter{\tikz@lg@collect#1}% +} + +\def\tikz@lg@change@write@back{% + \expandafter\global\expandafter\let\csname tikz@lgc@\tikz@lg@temp@save\endcsname\tikz@lg@collect% +} + + + +\def\tikz@lg@if@has@color#1#2#3#4{% + {% + \csname tikz@lgc@#1\endcsname% + \expandafter\let\expandafter\pgf@temp\csname iftikz@lgc@#2@\endcsname% + \ifx\pgf@temp\relax% + \tikz@lib@reset@temp% + \fi% + \pgf@temp% + \global\tikz@color@testtrue% + \else% + \global\tikz@color@testfalse% + \fi% + }% + \iftikz@color@test#3\else#4\fi% +} +\newif\iftikz@color@test + +\def\tikz@lg@if@local@node#1#2#3{\expandafter\ifx\csname tikz@lgc@#1\endcsname\relax#3\else#2\fi} + +\def\tikz@lib@reset@temp{\let\pgf@temp\iffalse} + + + +% +% Color functions +% + +% Do something for all nodes having a certain color +% +% #1 = the color name +% #2 = a macro +% +% Description: +% +% For each node having color #1, the macro #2 will be called. This +% macro should take a single parameter, which will be set +% to the node's name. + +\def\tikzlibgraphforeachcolorednode#1#2{% + \expandafter\def\expandafter\iftikz@lib@graph@color@picker\expandafter{\csname iftikz@lgc@#1@\endcsname}% + \let\tikz@lib@graph@action#2% + \let\tikz@lg@do\tikz@lg@pick% + \tikz@lib@graph@node@list% +} +\def\tikz@lg@pick#1{ + {% + \csname tikz@lgc@#1\endcsname% + \iftikz@lib@graph@color@picker + \global\tikz@color@testtrue% + \else% + \global\tikz@color@testfalse% + \fi% + }% + \iftikz@color@test\tikz@lib@graph@action{#1}\fi% +} + + +% Prepare a color +% +% #1 is the color name +% #2 is a counter +% #3 is a prefix +% +% Description: +% +% You can call this function inside a connector. It will do the +% following: First, its counts how many nodes exist that have color +% #1. This number is stored in the counter passed as #2. Furthermore, +% let be the name of the -th vertex that has color #1. Then, a +% macro called \#3 will store . For instance, if #1 is "red" +% and the third red node is called foo and if #3 is "bar", then a +% macro called "\bar3" is set to "foo" as if you had said +% "\expandafter\def\csname bar3\endcsname{foo}". +% +% The bottom line of all this is that after a preparation you can +% easily iterate over nodes having a certain color. If you wish to +% iterate over a single color, it will be quicker and easier to call +% \tikzlibgraphforeachcolorednode, but if you need to iterate over two +% colors simultaneously, it will be better to first prepare the color. + +\def\tikzlibgraphpreparecolor#1#2#3{% + \let\tikz@lib@graph@count#2% + \def\tikz@lib@graph@prefix{#3}% + \tikzlibgraphforeachcolorednode{#1}\tikz@lib@graph@prepare% +} + +\def\tikz@lib@graph@prepare#1{% + \advance\tikz@lib@graph@count by1\relax% + \expandafter\def\csname \tikz@lib@graph@prefix\the\tikz@lib@graph@count\endcsname{#1}% +} + + + + +% +% The bipartite connector +% + +\tikzset{ + connectors/bipartite/.code 2 args={ + \def\tikz@lg@shoreb{#2}% + \tikzlibgraphforeachcolorednode{#1}\tikz@lib@graph@bipartite@outer + }, + connectors/bipartite/.default={out'}{in'} +} + +\def\tikz@lib@graph@bipartite@outer#1{% + \def\tikz@lib@graph@from{#1}% + {% + \tikzlibgraphforeachcolorednode{\tikz@lg@shoreb}\tikz@lib@graph@bipartite@inner% + }% +} + +\def\tikz@lib@graph@bipartite@inner#1{% + \def\pgf@temp{#1}% + \ifx\pgf@temp\tikz@lib@graph@from\else% + \tikz@lib@graph@default@new@edge{\tikz@lib@graph@from}{#1}% + \fi% +} + +\def\tikz@lib@graph@default@new@edge{% + \pgfkeysgetvalue{/tikz/graphs/@edges styling}\pgf@temp + \expandafter\tikz@lib@graph@default@new@edge@\expandafter{\pgf@temp}% +} +\def\tikz@lib@graph@default@new@edge@#1#2#3{% + \pgfkeys{/tikz/graphs/.cd,new edge \pgfkeysvalueof{/tikz/graphs/default edge kind}={#2}{#3}{#1}}% +} + + +% +% The clique connector +% + +\tikzset{ + connectors/clique/.code={ + \tikzlibgraphpreparecolor{#1}\c@pgf@counta{tikz@lg}% + \tikz@lg@clique@loop% + }, + connectors/clique/.default=all +} + +\def\tikz@lg@clique@loop{% + \ifnum\c@pgf@counta=0\relax% + \else + \c@pgf@countb=\c@pgf@counta\relax% + \tikz@lg@clique@loop@inner% + \advance\c@pgf@counta by-1\relax% + \expandafter\tikz@lg@clique@loop% + \fi% +} + +\def\tikz@lg@clique@loop@inner{% + \advance\c@pgf@countb by-1\relax% + \ifnum\c@pgf@countb>0\relax% + \tikz@lib@graph@default@new@edge{\csname tikz@lg\the\c@pgf@counta\endcsname}{\csname tikz@lg\the\c@pgf@countb\endcsname}% + \expandafter\tikz@lg@clique@loop@inner% + \fi% +} + + +% +% The path connector +% + +\tikzset{ + connectors/path/.code={% + \let\tikz@lg@prev\relax% + \tikzlibgraphforeachcolorednode{#1}\tikz@lib@graph@path@do% + }, + connectors/path/.default=all +} + +\def\tikz@lib@graph@path@do#1{% + \ifx\tikz@lg@prev\relax% + \else% + \tikz@lib@graph@default@new@edge{\tikz@lg@prev}{#1}% + \fi + \def\tikz@lg@prev{#1}% +} + + +% +% The cycle connector +% + +\tikzset{ + connectors/cycle/.code={% + \let\tikz@lg@prev\relax% + \let\tikz@lg@first\relax% + \tikzlibgraphforeachcolorednode{#1}\tikz@lib@graph@cycle@do% + \ifx\tikz@lg@first\relax% + \else% + \tikz@lib@graph@default@new@edge{\tikz@lg@prev}{\tikz@lg@first}% + \fi% + }, + connectors/cycle/.default=all +} + +\def\tikz@lib@graph@cycle@do#1{% + \ifx\tikz@lg@prev\relax% + \def\tikz@lg@prev{#1}% + \let\tikz@lg@first\tikz@lg@prev% + \else% + \tikz@lib@graph@default@new@edge{\tikz@lg@prev}{#1}% + \def\tikz@lg@prev{#1}% + \fi% +} + + + + +% +% The match connector +% + +\tikzset{ + connectors/match/.code 2 args={ + {% + \tikzlibgraphpreparecolor{#1}\c@pgf@counta{tikz@lg} + \c@pgf@countb=0\relax% + \let\tikz@lg@prev\relax + \tikzlibgraphforeachcolorednode{#2}\tikz@lib@graph@match@do% + \tikz@lib@graph@match@rest% + }% + }, + connectors/match/.default={out'}{in'} +} + +\def\tikz@lib@graph@match@do#1{% + \advance\c@pgf@countb by1\relax% + \ifnum\c@pgf@countb>\c@pgf@counta\relax% + \c@pgf@countb=\c@pgf@counta\relax% + \fi% + \tikz@lib@graph@default@new@edge{\csname tikz@lg\the\c@pgf@countb\endcsname}{#1}% + \def\tikz@lg@prev{#1}% +} + +\def\tikz@lib@graph@match@rest{% + \ifnum\c@pgf@countb<\c@pgf@counta\relax% + \advance\c@pgf@countb by1\relax% + \tikz@lib@graph@default@new@edge{\csname tikz@lg\the\c@pgf@countb\endcsname}{\tikz@lg@prev}% + \expandafter\tikz@lib@graph@match@rest% + \fi% +} + + + +% +% The butterfly connector +% + +\tikzset{ + connectors/butterfly/.code={ + {}{% + \pgfkeys{/tikz/connectors/butterfly/.cd,#1}% + \ifnum\pgfkeysvalueof{/tikz/connectors/butterfly/level}=0\relax% + \pgfkeysalso{/tikz/connectors/match={\pgfkeysvalueof{/tikz/connectors/butterfly/from}}{\pgfkeysvalueof{/tikz/connectors/butterfly/to}}}% + \else% + {% + \tikzlibgraphpreparecolor{\pgfkeysvalueof{/tikz/connectors/butterfly/from}}\c@pgf@counta{tikz@lg} + \c@pgf@countb=0\relax% + \tikzlibgraphforeachcolorednode{\pgfkeysvalueof{/tikz/connectors/butterfly/to}}\tikz@lib@graph@butterfly@do% + }% + \iftikz@butterfly@prime\else\pgfkeysalso{/tikz/connectors/match={\pgfkeysvalueof{/tikz/connectors/butterfly/from}}{\pgfkeysvalueof{/tikz/connectors/butterfly/to}}}\fi% + \fi% + }% + }, + connectors/butterfly/.default=, + connectors/butterfly/level/.initial=1, + connectors/butterfly/from/.initial=out', + connectors/butterfly/to/.initial=in', + connectors/butterfly'/.code={% + {}{\tikz@butterfly@primetrue\pgfkeysalso{butterfly={#1}}}}, + connectors/butterfly'/.default=, +} + +\newif\iftikz@butterfly@prime + +\def\tikz@lib@graph@butterfly@do#1{% + \advance\c@pgf@countb by1\relax% + % Compute other side... + \c@pgf@countc=\pgfkeysvalueof{/tikz/connectors/butterfly/level}\relax% + {% + % Computer countb mod (2level) + \count0=\c@pgf@countc\relax% + \multiply\count0 by2\relax% + \count1=\c@pgf@countb\relax% + \advance\count1 by-1\relax% + \count2=\count1\relax% + \count3=\count1\relax% + \divide\count1 by\count0\relax% + \multiply\count1 by\count0\relax% + \advance\count2 by-\count1\relax% + % count0 = 2*level + % count2 = countb mod (2level) (starting with 0) + % count1 = countb - count2 (starting with 0) + \ifnum\count2<\c@pgf@countc\relax% + \advance\count3 by \c@pgf@countc\relax% + \else% + \advance\count3 by -\c@pgf@countc\relax% + \fi% + \expandafter% + }% + \expandafter\c@pgf@countc\the\count3\relax% + \advance\c@pgf@countc by1\relax% + \ifnum\c@pgf@countc>\c@pgf@counta\relax% + \c@pgf@countc=\c@pgf@counta\relax% + \fi% + \tikz@lib@graph@default@new@edge{\csname tikz@lg\the\c@pgf@countc\endcsname}{#1}% +} + + + diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzexternalshared.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzexternalshared.code.tex new file mode 100644 index 00000000000..8c22215eda4 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzexternalshared.code.tex @@ -0,0 +1,1394 @@ +% Copyright 2008-2010 by Christian Feuersaenger +% +% This file may be distributed and/or modified +% +% 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. +% +% ****************************** +% This here is the shared implementation of TeX-dialect specific files +% tikzlibraryexternal.code.tex +% ****************************** +% +% +% This file provides a high-level automatic export feature for tikz pictures. +% It allows to export EACH SINGLE FIGURE into a separate PDF. +% +% The simplest way is to use the 'convert with system call' option; it simply converts every figure using the write18 method. If that is not possible, a list of figure file names is generated and you need to generate these figures manually (or with a script). +% +% +% It replaces \tikzpicture/ \endtikzpicture and \tikz and invokes \beginpgfgraphicnamed ... \endpgfgraphicnamed +% commands if necessary. + +% handle with extreme care and only in small, local groups: +\toksdef\t@tikzexternal@tmpa=0 +\toksdef\t@tikzexternal@tmpb=1 + +\newwrite\tikzexternal@outfile +\newif\iftikzexternal@nestedflag +\newif\iftikzexternal@verboseio +\newif\iftikzexternal@genfigurelist +\newif\iftikzexternal@onlynamed +\newif\iftikzexternal@file@isuptodate +\newif\iftikzexternal@force@remake +\newif\iftikzexternal@optimize +\newif\iftikzexternal@export@enabled +\tikzexternal@export@enabledtrue + +% This 'if' can be used as part of the public user interface. +% +% It is set by the 'remake next' key. +% +% It disables any up-to-date checks for the *next* picture, forcing a +% remake of it. +% +% It applies only to *one* picture. +\newif\iftikzexternalremakenext +\newif\iftikzexternal@verbose@optimize +\tikzexternal@verbose@optimizetrue + +% A global boolean which can be used to skip single figures. +\newif\iftikzexternalexportnext +\tikzexternalexportnexttrue + +% Invokes '#1' if the external lib is currently externalizing +% something and '#2' if not. +% +% This command must be called *after* \tikzexternalize. +\def\tikzifexternalizing#1#2{% + \ifpgf@external@grabshipout #1\else #2\fi +}% +% Invokes '#1' if the external lib is currently externalizing the NEXT FOLLOWING +% tikzpicture. It invokes '#2' if that is not the case. +\def\tikzifexternalizingnext#1#2{% + \ifpgf@external@grabshipout + \tikzexternalgetnextfilename\tikzexternal@temp + \tikzifexternaljobnamematches\tikzexternal@temp{#1}{#2}% + \else + #2% + \fi +}% +% Invokes '#1' if the external lib is currently externalizing the +% current picture. It invokes '#2' if that is not the case. +% +% If the command is invoked outside of a picture, '#2' will be +% invoked. +\def\tikzifexternalizingcurrent#1#2{% + \ifpgf@external@grabshipout + \tikzexternalgetcurrentfilename\tikzexternal@temp + \ifx\tikzexternal@temp\pgfutil@empty + #2% + \else + \tikzifexternaljobnamematches\tikzexternal@temp{#1}{#2}% + \fi + \else + #2% + \fi +}% + +% Invokes '#2' if \jobname equals '#1' and '#3' if not. +% I suppose that '#1' is a macro containing the file name. +% +\def\tikzifexternaljobnamematches#1#2#3{% + \edef\pgf@tempa{\expandafter\string\csname#1\endcsname}% + \edef\pgf@tempb{\expandafter\string\csname\pgfactualjobname\endcsname}% + \ifx\pgf@tempa\pgf@tempb #2\else#3 \fi% +}% + + +\pgfutil@ifundefined{pdfshellescape}{% + \def\tikzexternalcheckshellescape{}% +}{% + \ifnum\pdfshellescape=1 + \def\tikzexternalcheckshellescape{\pgfkeysvalueof{/tikz/external/shell escape}\space}% + \else + \def\tikzexternalcheckshellescape{}% + \fi +}% +\newif\iftikzexternal@auto@detect@jobname + +\pgfqkeys{/tikz/external}{ + figure list/.is if=tikzexternal@genfigurelist, + aux in dpth/.style={/pgf/images/aux in dpth=#1},% + % 'mode' applies only if \jobname==real job name. + mode/.is choice, + mode/only graphics/.code = {% + \def\tikzexternal@opmode{0}% + \pgfkeysalso{/pgf/images/aux in dpth=true}% + }, + mode/no graphics/.code = {\def\tikzexternal@opmode{1}}, + % an alias for 'no graphics:' + mode/only pictures/.code = {\def\tikzexternal@opmode{1}}, + mode/graphics if exists/.code= {% + \def\tikzexternal@opmode{2}% + \pgfkeysalso{/pgf/images/aux in dpth=true}% + }, + mode/list only/.code = {\def\tikzexternal@opmode{3}\tikzexternal@genfigurelisttrue}, + mode/convert with system call/.code={% + \def\tikzexternal@opmode{4}% + \pgfkeysalso{/tikz/external/figure list=false,/pgf/images/aux in dpth=true}% ATTENTION: this *can't* work if \label{} contains pictures! + }, + mode/list and make/.code = {% + \def\tikzexternal@opmode{5}% + \pgfkeysalso{/tikz/external/figure list=true,/pgf/images/aux in dpth=true}% + }, + mode=convert with system call, + system call/.initial={pdflatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"}, +% system call/.initial={pdflatex -interaction=batchmode -jobname '\image' '\texsource'; pdftops -eps \image.pdf}, + force remake/.is if=tikzexternal@force@remake, + force remake/.default=true, + failed ref warnings for/.initial={\ref,\cite,\pageref}, + export next/.is if=tikzexternalexportnext, + export/.is if=tikzexternal@export@enabled, + remake next/.is if=tikzexternalremakenext, + remake next/.default=true, + verbose IO/.is if=tikzexternal@verboseio, + verbose IO/.default=true, + verbose IO=true, + verbose optimize/.is if=tikzexternal@verbose@optimize, + verbose/.style={ + verbose IO=#1, + verbose optimize=#1, + }, + shell escape/.initial=-shell-escape, + read main aux/.is if=pgfexternalreadmainaux, + image discarded text/.initial={% + [[ \textsc{Image Discarded Due To} \texttt{`/tikz/external/% + \ifcase\tikzexternal@opmode\relax + mode=only graphics% + \or + mode=no graphics% + \or + mode=graphics if exists% + \or + mode=list only% + \or + mode=convert with system call% + \or + mode=list and make% + \fi + '}~]]% + \pgfutil@ifundefined{tikzexternal@warning@at@end}{% + \pgfutil@ifundefined{AtEndDocument}{}{% + \AtEndDocument{% + \message{! Package tikz Warning: Some images are not up-to-date and need to be generated. }% + }% + }% + \gdef\tikzexternal@warning@at@end{1}% + }{}% + }, + optimize/.is choice, + optimize/true/.code={% + \tikzexternal@optimizetrue + \iftikzexternal@optimize + \ifpgf@external@grabshipout + % we have already started the externalization! Install + % optimization commands to activate the new one: + \tikzexternal@optimize@REPLACE + \fi + \fi + }, + optimize/false/.code={% + \tikzexternal@optimizefalse% + \tikzexternal@optimize@RESTORE + },% + optimize=true, + optimize away text/.code={[ \textsc{\string#1\ optimized away because it does not contribute to exported PDF}]}, + optimize/install/.code={},% + optimize/restore/.code={},% + % Expects two arguments, the command name and (optionally) a count + % of expected arguments. + % Example: + % 'optimize command away=\includegraphics' + % 'optimize command away={\mycommand}{3}' + % + % It accepts commands which have '[]' arguments and whose first + % argument always begins with '{'. + % + % #1: the command name + % #2: either empty or a number of EXPECTED arguments. It will be checked + % for one optional argument in square brackets as well. + optimize command away/.code 2 args={% + \expandafter\global\expandafter\let\csname\string#1@ORIG\endcsname=#1% + \pgfkeysalso{% + /tikz/external/optimize/install/.append code={% + \def#1{\tikzexternal@optimize@away@cmd{#1}{#2}}% + }, + /tikz/external/optimize/restore/.append code={% + \expandafter\let\expandafter#1\csname\string#1@ORIG\endcsname + } + }% + \iftikzexternal@optimize + \ifpgf@external@grabshipout + % we have already started the externalization! Install + % optimization commands to activate the new one: + \tikzexternal@optimize@REPLACE + \fi + \fi + }, + optimize command away=\includegraphics, + % EXPERIMENTAL (UNTESTED): + optimize latex env away/.code={% + \expandafter\let\expandafter\pgf@tempa\csname #1\endcsname + \expandafter\global\expandafter\let\csname #1@ORIG\endcsname=\pgf@tempa% + \pgfkeysalso{% + /tikz/external/optimize/install/.append code={% + \pgfutil@namedef{#1}{\tikzexternal@optimize@away@latex@env{#1}}% + }, + /tikz/external/optimize/restore/.append code={% + \pgfutil@namelet{#1}{#1@ORIG}% + }% + }% + }, + only named/.is if=tikzexternal@onlynamed, + only named/.default=true, + figure name/.initial=\tikzexternal@realjob-figure, + reset counter/.code={% + \expandafter\gdef\csname c@tikzext@no@#1\endcsname{0}% + },% + prefix/.code={\tikzsetexternalprefix{#1}}, +} + +\def\tikzsetfigurename#1{\pgfkeyssetvalue{/tikz/external/figure name}{#1}}% +\def\tikzappendtofigurename#1{\pgfkeys{/tikz/external/figure name/.add={}{#1}}} + +% This method sets the file name prefix used for every import/export. +% +% It is invoked by the '/tikz/external/prefix' key. +\def\tikzsetexternalprefix#1{\def\tikzexternal@filenameprefix{#1}} +\tikzsetexternalprefix{} + +% This method initialises automatic externalization. +% +% The command does need any argument, but it has two optional ones: +% +% 1. \tikzexternalize[] +% +% 2. \tikzexternalize{} +% +% 3. \tikzexternalize[]{} +% +% The is the job's file name, without the suffix +% .tex . +% If the is omitted, it will be deduced +% automatically. +% +% The effect is: +% 1. automatically surround EVERY tikzpicture by \beginpgfgraphicnamed % sections. +% 2. in case that the job's real name and the current \jobname differ, +% it will process ONLY the matching tikzpicture. +\def\tikzexternalize{% + \pgfutil@ifnextchar[{% + \tikzexternalize@opt + }{% + \tikzexternalize@opt[]% + }% +}% +\def\tikzexternalize@opt[#1]{% + \pgfutil@ifnextchar\bgroup{% + \tikzexternal@auto@detect@jobnamefalse + \tikzexternalize@opt@withname[#1]% + }{% + \tikzexternal@auto@detect@jobnametrue + \pgfutil@ifundefined{tikzexternalrealjob}{% + % ok, \tikzexternalrealjob is not known. + % Assume we are currently *not* externalizing. + \let\tikzexternalrealjob=\jobname + }{}% + \def\pgf@tempa{\tikzexternalize@opt@withname[#1]}% + \expandafter\pgf@tempa\expandafter{\tikzexternalrealjob}% + }% +}% +\def\tikzexternalize@opt@withname[#1]#2{% + \gdef\tikzexternalrealjob{#2}% + \if1\tikzexternalize@hasbeencalled + \else + \pgfqkeys{/tikz/external}{#1}% + \def\tikzexternal@realjob{#2}% + \tikzexternalauxlock@init + \pgfrealjobname{#2}% + \def\tikzexternalize@hasbeencalled{1}% + \tikzexternalenable + \def\tikzexternal@determineimgextension##1:##2\relax{\gdef\tikzexternalimgextension{##1}}% + \xdef\pgf@tempa{\pgfsys@imagesuffixlist}% + \expandafter\tikzexternal@determineimgextension\pgf@tempa:\relax + \pgfutil@ifundefined{includegraphics}{% + \let\tikzexternal@orig@includegraphics=\relax + }{% + \let\tikzexternal@orig@includegraphics=\includegraphics + }% + \let\tikzexternalfiledependsonfile=\tikzexternalfiledependsonfile@ACTIVE + \let\tikzpicturedependsonfile=\tikzpicturedependsonfile@ACTIVE + \fi +} +\def\tikzexternalize@hasbeencalled{0}% + +% If mode=`convert with system call', the boolean \ifpgfexternalreadmainaux +% will be set depending on the current lock file. +% +% The idea is as follows: Suppose +% pdflatex -shell-escape mainjob.tex +% is running. +% +% While it runs, +% a) it modifies its mainjob.aux file, +% b) it issues pdflatex -jobname mainjob-figure0 mainjob.tex . +% +% The call (b) will try to read mainjob.aux in order to resolve \ref +% commands. This may fail since the aux +% file is not complete; it may be subject to output buffering. To +% avoid such failure, a locking mechanism is established. +% +% The locking mechanisms causes (a) to write a lock command into +% mainjob.auxlock +% just before (b) is called. Then, (b) will check it. After (b) has +% completed, the lock will be reset. +% +% Thus: mode=convert with system call does NOT support \ref commands +% inside of images. You will need to call the externalization command +% manually. In this case, it should work. +% +% The lock file allows to detect automatically whether an image is created by +% 'convert with system call' or if the user issued the required command manually. +% +% @PRECONDITION : this command must be invoked AFTER +% \tikzexternal@realjob has been defined but BEFORE \pgfrealjobname is +% called. +% +% @POSTCONDITION : If \ifpgfexternalreadmainaux=\iffalse, we won't do +% anything. Otherwise, it will be changed depending for 'mode=convert +% with system call' if necessary. +\def\tikzexternalauxlock@init{% + \if4\tikzexternal@opmode + % mode=convert with system call + \ifpgfexternalreadmainaux + % ohoh. This case needs care because the main.aux might + % not be ready at this time! + % check. + % + \edef\pgf@tempa{\expandafter\string\csname\tikzexternal@realjob\endcsname}% + \edef\pgf@tempb{\expandafter\string\csname\jobname\endcsname}% + \ifx\pgf@tempa\pgf@tempb + % we are *not* externalizing. Set lock into its + % initial "unlocked" state. + \tikzexternalauxlock@setlock{0}% + \else + % we are externalizing. Query the lock's value: + \tikzexternalauxlock@getlockvalue + \if1\tikzexternallocked + \pgfexternalreadmainauxfalse + % the main .aux file won't be read. Handle \ref commands: + \tikzexternalauxlock@handleref + \else + \pgfexternalreadmainauxtrue + \fi + \fi + \else + % NO-OP. We won't read the main aux file anyway. + \def\tikzexternalauxlock@setlock##1{}% + \fi + \fi +} +% defines \tikzexternallocked to be either 0 or 1, depending on the +% lock file. +\def\tikzexternalauxlock@getlockvalue{% + \openin\r@pgf@reada=\tikzexternal@realjob.auxlock + \ifeof\r@pgf@reada + % no lock file. Unlock. + \def\tikzexternallocked{0}% + \else + % read first line... + \read\r@pgf@reada to\pgf@tempa + % ... and execute it. + \pgf@tempa + % it should contain a definition of \tikzexternallocked. If + % not, lock it anyway. + \pgfutil@ifundefined + {tikzexternallocked} + {\def\tikzexternallocked{1}}% + {}% + \fi + \closein\r@pgf@reada +}% +\def\tikzexternalauxlock@setlock#1{% + \immediate\openout\w@pgf@writea=\tikzexternal@realjob.auxlock + \immediate\write\w@pgf@writea{\noexpand\def\noexpand\tikzexternallocked{#1}}% + \immediate\closeout\w@pgf@writea +} + + +% Installs a special \ref{} command such that externalized pictures +% can use \ref and the user gets a warning if something fails. +% +% The special \ref handling is installed for every reference command +% in the list '/tikz/external/failed ref warnings for' which contains +% '\ref,\pageref,\cite'. +% +% For use in the aux lock handling only. +\def\tikzexternalauxlock@handleref{% + \let\pgf@external@grab@refundefinedtrue=\pgf@external@grab@refundefinedtrue@orig + % + \pgfkeysgetvalue{/tikz/external/failed ref warnings for}\tikzexternal@temp + \expandafter\tikzexternalauxlock@handleref@loop\tikzexternal@temp,\@EOI,% +} +\def\tikzexternalauxlock@handleref@loop#1,{% + \def\tikzexternal@temp{#1}% + \ifx\tikzexternal@temp\pgfutil@empty + \expandafter\tikzexternalauxlock@handleref@loop + \else + \ifx#1\@EOI + \else + {% + % strip the leading '\' + % this allows proper \protect ion when you write + % \caption{...\cite{..}} and #1=\cite + \escapechar=-1 + \xdef\pgf@temp{\string#1}% + }% + \expandafter\let\csname tikzexternalauxlock@handleref@orig@\pgf@temp\endcsname=#1% + \edef#1{\noexpand\pgf@texdist@protect\noexpand\tikzexternalauxlock@handleref@repl{\pgf@temp}}% + \expandafter\expandafter\expandafter\tikzexternalauxlock@handleref@loop + \fi + \fi +}% +\def\tikzexternalauxlock@handleref@repl#1{\pgfutil@ifnextchar[{\tikzexternalauxlock@handleref@repl@{#1}}{\tikzexternalauxlock@handleref@repl@{#1}[]}}% +\def\tikzexternalauxlock@handleref@repl@#1[#2]#3{% + \tikzifexternalizingcurrent{% + % note that '#1' is NO control sequence! it is a protected string + \csname tikzexternalauxlock@handleref@orig@#1\endcsname{#3}% + \begingroup + \def\n{\pgfexternal@hat\pgfexternal@hat J}% + \tikzexternal@assemble@systemcall{\pgfactualjobname}{\pgf@tempa}% + \def\space{\noexpand\space}% + \pgfexternalstorecommand{% + \noexpand\begingroup + \noexpand\toks0={\pgf@tempa}% + \noexpand\immediate\noexpand\write16{\tikzexternalauxlock@handleref@warning{#3}{\noexpand\the\noexpand\toks0}}% + \noexpand\G@refundefinedtrue + \noexpand\endgroup + }% + \endgroup + }{% + % ok. We are not externalizing this part of the document. + % Throw the citation away without further notice. + }% +}% +\def\tikzexternalauxlock@handleref@warning#1#2{% + \n + LaTeX Warning: Reference `#1' in external picture `\pgfactualjobname' could not be resolved\noexpand\on@line.\n + This is because the \tikzexternal@realjob.aux file is not accessable in this context, you will need to issue the externalize command\n + \space\space\space#2\n + manually.\n% +} + +% Expands to the default image extension (it is set by +% \tikzexternalize). +% +% This image extension may not resemble the correct one; you may need +% to overwrite this macro *after* \tikzexternalize in this case. +% +% The default setting uses the first registered image extension. +\def\tikzexternalimgextension{}% + +% can be used to (temporarily) disable the externalization. +\def\tikzexternaldisable{% + \let\tikz=\tikzexternal@origtikz + \tikzexternal@TEXDIALECT@restore@picture + \pgfutil@ifundefined{tikzexternal@orig@tikzfadingfrompicture} + {}% NOP + {% + \let\tikzfadingfrompicture=\tikzexternal@orig@tikzfadingfrompicture + \let\endtikzfadingfrompicture=\tikzexternal@orig@endtikzfadingfrompicture + \let\tikzfading=\tikzexternal@orig@tikzfading + }% + \iftikzexternal@optimize + \ifpgf@external@grabshipout + \tikzexternal@optimize@RESTORE + \fi + \fi +}% +% re-enables externalization after a \tikzexternalizedisable. +\def\tikzexternalenable{% + \if\tikzexternalize@hasbeencalled1% + \let\tikz=\tikzexternal@tikz@replacement + \tikzexternal@TEXDIALECT@installreplacement@picture + \pgfutil@ifundefined{tikzfadingfrompicture}% + {}% no special handling for 'fading lib' + {% + % oh, ok -- patch fading lib! + \pgfutil@ifundefined{tikzexternal@orig@tikzfadingfrompicture}{% + \let\tikzexternal@orig@tikzfadingfrompicture=\tikzfadingfrompicture + \let\tikzexternal@orig@endtikzfadingfrompicture=\endtikzfadingfrompicture + \let\tikzexternal@orig@tikzfading=\tikzfading + }{}% + \def\tikzfadingfrompicture{% + \begingroup + \tikzexternaldisable + \tikzexternal@orig@tikzfadingfrompicture}% + \def\endtikzfadingfrompicture{% + \tikzexternal@orig@endtikzfadingfrompicture + \endgroup}% + \def\tikzfading[##1]{% + \begingroup + \tikzexternaldisable + \tikzexternal@orig@tikzfading[##1]% + \endgroup}% + }% + \iftikzexternal@optimize + \ifpgf@external@grabshipout + \tikzexternal@optimize@REPLACE + \fi + \fi + \fi +}% + +% Sets the filename for the next tikzpicture or \tikz shortcommand. +% +% It will *only* be used for the next picture. +% +% If you don't call \tikzsetnextfilename for a picture, a file name +% will be assembled automatically. +% +% Please note that the global file prefix will be prepended anyway. +\def\tikzsetnextfilename#1{\gdef\tikzexternal@nextfile{#1}} +\tikzsetnextfilename{} + + +% These are few TeX dialect-specific commands which need to be overriden when used with +% something different than plain TeX: +% +% 1. this command collects a complete image into a macro, up to (but not including) the +% final TeX-dialect specific end-image command. +% This is really difficult for LaTeX because \end{tikzpicture} either involves dirty +% catcode-hacks to parse the braces or an ugly loop which loops until it +% finds \end followed by {tikzpicture}. +% +% #1: a macro which will be called with the collected environment contents. +% all following tokens: the environment contents. +\long\gdef\tikzexternal@TEXDIALECT@collectpicture#1#2\endtikzpicture{#1{#2}} +% +% 2. the following commands should expand to the TeX-dialect specific begin and end image command, i.e. +% \tikzpicture / \endtikzpicture +% or +% \begin{tikzpicture} / \end{tikzpicture} +% or +% \starttikzpicture / \stoptikzpicture +\def\tikzexternal@TEXDIALECT@begpicture{\tikzpicture} +\def\tikzexternal@TEXDIALECT@endpicture{\endtikzpicture}% +% +% 3. This installs the replacement macros: +\def\tikzexternal@TEXDIALECT@installreplacement@picture{% + \let\tikzpicture=\tikzexternal@tikzpicture@replacement +}% +\def\tikzexternal@TEXDIALECT@restore@picture{% + \let\tikzpicture=\tikzexternal@origpicture +}% + + + + +\let\tikzexternal@origtikz=\tikz +\let\tikzexternal@origpicture=\tikzpicture +\let\tikzexternal@origendpicture=\endtikzpicture +\let\tikzexternal@curfilename=\relax + +% Replacement for '\tikzpicture'. +% +% There are two different states in which this method is applied: +% - normal typesetting. Then, the 'mode' key controls its behavior. +% - externalize mode (i.e. jobname != real job name). Then, it will +% externalize the picture selected by 'jobname' (and only this picture). +\def\tikzexternal@tikzpicture@replacement{% + \leavevmode + \global\tikzexternal@file@isuptodatetrue% may be set to false during checks. + \tikzexternal@getnextfilename\tikzexternal@curfilename + \ifx\tikzexternal@curfilename\pgfutil@empty + \ifpgf@external@grabshipout + % This picture won't be externalized. + % But maybe we can optimize it away: + \iftikzexternal@optimize + % -> it won't be shipped out anyway, so save typesetting time! + \let\tikzexternal@next=\tikzexternal@skipfigure + \else + % include this graphics into the output (even if + % it will be discarded anyway). + \let\tikzexternal@next=\tikzexternal@normalpicture@nographics + \fi + \else + \let\tikzexternal@next=\tikzexternal@normalpicture@nographics + \fi + \else + \ifpgf@external@grabshipout + \tikzifexternaljobnamematches\tikzexternal@curfilename{% + % ok, this here IS the picture for which + % pdflatex --jobname + % has been invoked. + \let\tikzexternal@next=\tikzexternal@externalizefig + }{% + \iftikzexternal@optimize + % No, another picture should be exported. Simply skip this one + % -> it won't be shipped out anyway, so save typesetting time! + \let\tikzexternal@next=\tikzexternal@skipfigure + \else + % include this graphics into the output (even it + % it will be discarded anyway). + \let\tikzexternal@next=\tikzexternal@normalpicture@nographics + \fi + }% + \else + \ifcase\tikzexternal@opmode\relax + % 'mode=only graphics' + \let\tikzexternal@next=\tikzexternal@forcegraphics + \or + % 'mode=no graphics' + \let\tikzexternal@next=\tikzexternal@normalpicture@nographics + \or + % 'mode=graphics if exists' + \let\tikzexternal@next=\tikzexternal@externalizefig + \or + % 'mode=list only' + \let\tikzexternal@next=\tikzexternal@listmodepicture + \or + % 'mode=convert with system call' + \let\tikzexternal@next=\tikzexternal@externalizefig@systemcall + \or + % 'mode=list and make' + \let\tikzexternal@next=\tikzexternal@list@and@makefile@mode@picture + \fi + \fi + \fi + \tikzexternal@next +}% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Replacement for \tikz short command: +\def\tikzexternal@tikz@replacement{% + \pgfutil@ifnextchar[{\tikzexternal@tikz@replacement@opt}{\tikzexternal@tikz@replacement@opt[]}% +}% +\def\tikzexternal@tikz@replacement@opt[#1]{% + \pgfutil@ifnextchar\bgroup{\tikzexternal@tikz@replacement@opt@{#1}}{\tikzexternal@tikz@replacement@opt@@{#1}}% +} +\long\def\tikzexternal@tikz@replacement@opt@#1#2{% + \tikzexternal@tikz@replacement@opt@process{#1}{#2}% +}% +\def\tikzexternal@tikz@replacement@opt@@#1{% + \def\tikz@next{\tikzexternal@tikz@replacement@collectnormalsemicolon{#1}}% + \ifnum\the\catcode`\;=\active\relax% + \def\tikz@next{\tikzexternal@tikz@replacement@collectactivesemicolon{#1}}% + \fi% + \tikz@next} +\long\def\tikzexternal@tikz@replacement@collectnormalsemicolon#1#2;{% + \tikzexternal@tikz@replacement@opt@process{#1}{#2;}% +}% +{ + \catcode`\;=\active + \long\gdef\tikzexternal@tikz@replacement@collectactivesemicolon#1#2;{% + \tikzexternal@tikz@replacement@opt@process{#1}{#2;}% + } +} +\long\def\tikzexternal@tikz@replacement@opt@process#1#2{% + \begingroup + \t@tikzexternal@tmpa=\expandafter{\tikzexternal@TEXDIALECT@begpicture[#1]#2}% + \t@tikzexternal@tmpb=\expandafter{\tikzexternal@TEXDIALECT@endpicture}% + \xdef\pgf@tempa{\the\t@tikzexternal@tmpa\the\t@tikzexternal@tmpb}% + \endgroup + \pgf@tempa +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\def\tikzexternal@getnextfilename@advancecount{% + \begingroup + \c@pgf@counta=\csname c@tikzext@no@\tikzexternal@figurename\endcsname\relax + \advance\c@pgf@counta by1 + \expandafter\xdef\csname c@tikzext@no@\tikzexternal@figurename\endcsname{\the\c@pgf@counta}% + \endgroup +}% + +% Returns the file name which will be used for the next tikzpicture (based on the currently available information only, of course). +\def\tikzexternalgetnextfilename#1{% + \begingroup + \let\tikzexternal@getnextfilename@advancecount\relax% NOP + \def\tikzexternal@protocol@to@file##1{}% NOP + \tikzexternal@getnextfilename#1% + \pgfmath@smuggleone#1% + \endgroup +}% + +% Returns the file name of the current picture. +% +% It returns the empty string in case the command is invoked outside +% of a picture. +% #1 the macro which will contain the file name. +% @see \tikzexternalgetnextfilename +\def\tikzexternalgetcurrentfilename#1{% + \ifx\tikzexternal@curfilename\relax + % we are outside of a picture. + \let#1=\pgfutil@empty + \else + % we are inside of a picture. + \let#1=\tikzexternal@curfilename + \fi +} + +% Fills #1 with a filename for the current picture. +% +% The filename will be generated automatically by appending '-figure' to the real jobname. +% +% This method deals with +% - \tikzsetnextfilename +% - \tikzexternalexportnextfalse +% +% It returns #1={} if the current figure shall NOT be exported. +% +% Please note that both, \tikzsetnextfilename and \tikzexternalexportnextfalse +% affect only ONE picture. They will be reset afterwards. +\def\tikzexternal@getnextfilename#1{% + \let#1=\pgfutil@empty + % determine next file name: + \iftikzexternal@export@enabled + \iftikzexternalexportnext + \begingroup + \t@tikzexternal@tmpa=\expandafter{\tikzexternal@filenameprefix}% + \ifx\tikzexternal@nextfile\pgfutil@empty + \iftikzexternal@onlynamed + \xdef\pgf@tempa{}% + \else + \pgfkeysgetvalue{/tikz/external/figure name}\tikzexternal@figurename + \pgfutil@ifundefined{c@tikzext@no@\tikzexternal@figurename}{% + % initialise on first usage: + \expandafter\gdef\csname c@tikzext@no@\tikzexternal@figurename\endcsname{0}% + }{}% + \t@tikzexternal@tmpb=\expandafter{\tikzexternal@figurename}% + \xdef\pgf@tempa{\the\t@tikzexternal@tmpa\the\t@tikzexternal@tmpb\csname c@tikzext@no@\tikzexternal@figurename\endcsname}% + % advance the counter for 'figure name': + \tikzexternal@getnextfilename@advancecount + \fi + \else + \t@tikzexternal@tmpb=\expandafter{\tikzexternal@nextfile}% + \xdef\pgf@tempa{\the\t@tikzexternal@tmpa\the\t@tikzexternal@tmpb}% + \fi + \endgroup + \let#1=\pgf@tempa + \fi + \fi + % + % Reset global flags: + \global\let\tikzexternal@nextfile=\pgfutil@empty + \global\tikzexternalexportnexttrue + % + \tikzexternal@protocol@to@file#1% +}% + +% #1: the image file name which should be protocolled. (can be a +% macro) +\def\tikzexternal@protocol@to@file#1{% + \ifpgf@external@grabshipout% + \else + \iftikzexternal@genfigurelist + \edef\tikzexternal@temp{#1}% + \ifx\tikzexternal@temp\pgfutil@empty + \else + \pgfutil@ifundefined{tikzexternal@listmode@openedfile}{% + \message{Opening '\tikzexternal@realjob.figlist' for writing.}% + \immediate\openout\tikzexternal@outfile=\tikzexternal@realjob.figlist\relax + \gdef\tikzexternal@listmode@openedfile{1}% + \if\tikzexternal@opmode5% mode='list and make' + \tikzexternal@list@and@make@prepare + \fi + }{}% + \iftikzexternal@verboseio + \immediate\write16{Writing '#1' to '\tikzexternal@realjob.figlist'.}% + \fi + \immediate\write\tikzexternal@outfile{#1}% + \if\tikzexternal@opmode5% mode='list and make' + \tikzexternal@list@and@make@gentarget{#1}% + \fi + \fi + \fi + \fi +}% + +\def\tikzexternal@list@and@make@gentarget#1{% + \tikzexternal@assemble@systemcall{#1}{\pgf@tempa}% + \iftikzexternal@verboseio + \immediate\write16{Writing '#1' to '\tikzexternal@realjob.makefile'.}% + \fi + \global\tikzexternal@file@isuptodatetrue% only check for force remake: + \tikzexternal@checkforceremake% + \immediate\write\tikzexternal@outmakefile{#1\tikzexternalimgextension: \iftikzexternal@file@isuptodate\else FORCEREMAKE\fi}% + \immediate\write\tikzexternal@outmakefile{\tikzexternal@TABchar\pgf@tempa}% + \immediate\write\tikzexternal@outmakefile{}% +} + +\def\tikzexternal@list@and@make@prepare{% + \iftikzexternal@verboseio + \immediate\write16{Opening '\tikzexternal@realjob.makefile' for writing.}% + \fi + \begingroup + % this makes \tikzexternal@outmakefile global: + \globaldefs=1 + % this gets round '\outer\newwrite' in plain TeX: + \csname newwrite\endcsname\tikzexternal@outmakefile + \endgroup + \immediate\openout\tikzexternal@outmakefile=\tikzexternal@realjob.makefile\relax + \immediate\write\tikzexternal@outmakefile{ALL_FIGURE_NAMES=\tikzexternal@DOLLARchar(shell cat \tikzexternal@realjob.figlist)}% + \immediate\write\tikzexternal@outmakefile{ALL_FIGURES=\tikzexternal@DOLLARchar(ALL_FIGURE_NAMES:\tikzexternal@PERCENTchar=\tikzexternal@PERCENTchar\tikzexternalimgextension)}% + \immediate\write\tikzexternal@outmakefile{}% + \immediate\write\tikzexternal@outmakefile{allimages: \tikzexternal@DOLLARchar(ALL_FIGURES)}% + \immediate\write\tikzexternal@outmakefile{\tikzexternal@TABchar @echo All images exist now. Use make -B to re-generate them.}% + \immediate\write\tikzexternal@outmakefile{}% + \immediate\write\tikzexternal@outmakefile{FORCEREMAKE:}% + \immediate\write\tikzexternal@outmakefile{}% + % + % support for .dep files and auto-dependencies: + \immediate\write\tikzexternal@outmakefile{include $(ALL_FIGURE_NAMES:\tikzexternal@PERCENTchar=\tikzexternal@PERCENTchar.\tikzexternaldepext)}% + \immediate\write\tikzexternal@outmakefile{}% + \tikzexternalmakefiledefaultdeprule + \immediate\write\tikzexternal@outmakefile{}% + \tikzexternal@outmakefile@pendingcommands + \pgfutil@ifundefined{AtEndDocument}{}{% + \AtEndDocument{\immediate\write16{===== mode=`list and make': Use 'make -f \tikzexternal@realjob.makefile' to generate all images. Then, re-run (pdf)latex \tikzexternal@realjob. =====}}% + }% +}% +\def\tikzexternaldepext{dep} + +\def\tikzexternalmakefiledefaultdeprule{% + \immediate\write\tikzexternal@outmakefile{\tikzexternal@PERCENTchar.\tikzexternaldepext:}% + \immediate\write\tikzexternal@outmakefile{\tikzexternal@TABchar touch $@ \tikzexternal@HASHchar\space will be filled later.}% +}% + +% Invokes '#1' if a makefile is to be written and '#2' if not. +\def\tikzexternalifwritesmakefile#1#2{% + \if5\tikzexternal@opmode #1\else #2\fi +}% +\def\tikzexternal@outmakefile@pendingcommands{}% + +% Will write something to the make file. If the makefile is not yet +% opened, #1 will be written as soon as it *is* opened. +\def\tikzexternalwritetomakefile#1{% + \pgfutil@ifundefined{tikzexternal@outmakefile}{% + \expandafter\gdef\expandafter\tikzexternal@outmakefile@pendingcommands\expandafter{% + \tikzexternal@outmakefile@pendingcommands + \immediate\write\tikzexternal@outmakefile{#1}% + }% + }{% + \immediate\write\tikzexternal@outmakefile{#1}% + }% +}% + +\def\tikzexternal@dep@file@name{} + +% Adds a dependency for the externalized picture file name `#1', +% namely another file `#2'. +% +% #1: the fully qualified path name (without image extension) of the +% external graphics for which we are adding a dependency. +% #2: a file name. If this file gets changed, #1 shall be remade. +% +% This command will be actived as soons as \tikzexternalize has been +% called. +\def\tikzexternalfiledependsonfile@ACTIVE#1#2{% + \begingroup + \def\tikzpicturedependsonfile@name{#1}% + \ifx\tikzpicturedependsonfile@name\pgfutil@empty + % could be auto-generated: empty file name means "picture + % won't be externalized". Skip it. + \else + \edef\tikzpicturedependsonfile@name{#1.\tikzexternaldepext}% + \ifx\tikzexternal@dep@file@name\tikzpicturedependsonfile@name + % file is open and ready. + \else + % create new output file. + \pgfutil@ifundefined{tikzexternal@dep@file}{% + \begingroup + % this makes \tikzexternal@dep@file global: + \globaldefs=1 + % this gets round '\outer\newwrite' in plain TeX: + \csname newwrite\endcsname\tikzexternal@dep@file + \endgroup + }{}% + \ifx\tikzexternal@dep@file@name\pgfutil@empty + \else + % it is already open. Close it. + \immediate\closeout\tikzexternal@dep@file + \fi + \global\let\tikzexternal@dep@file@name=\tikzpicturedependsonfile@name + \immediate\openout\tikzexternal@dep@file=\tikzexternal@dep@file@name\relax + \fi + \immediate\write\tikzexternal@dep@file{#1\tikzexternalimgextension: #2}% + \fi + \endgroup +}% +\def\tikzexternalfiledependsonfile#1#2{}% NO-OP until \tikzexternalize has been called. + +% Adds a dependency for the NEXT picture which is about to be +% externalized. If we are currently inside of a picture, the +% dependency is added for this current picture. +% +% #1: a file name. If this file gets changed, the tikzpicture's +% externalized graphics shall be remade. +% +% This command will be actived as soons as \tikzexternalize has been +% called. +\def\tikzpicturedependsonfile@ACTIVE#1{% + \begingroup + \tikzexternalgetcurrentfilename\tikzpicturedependsonfile@name + \ifx\tikzpicturedependsonfile@name\pgfutil@empty + \tikzexternalgetnextfilename\tikzpicturedependsonfile@name + \fi + \expandafter\tikzexternalfiledependsonfile\expandafter{\tikzpicturedependsonfile@name}{#1}% + \endgroup +}% +\def\tikzpicturedependsonfile#1{}% NO-OP until \tikzexternalize has been called. + + +% This command is invoked +% if and only if ( (grab mode && --jobname matches) || 'mode=graphics if exists' ) +% +% It converts the current tikzpicture into an image in grab mode +% or processes the 'graphics if exist' mode. +\def\tikzexternal@externalizefig{% + \ifpgf@external@grabshipout% + % In this case, we already KNOW that the filename matches. + \expandafter\tikzexternal@externalizefig@GRAB% + \else + \expandafter\tikzexternal@externalizefig@mode@graphics@if@exists + \fi% +} +\def\tikzexternal@externalizefig@mode@graphics@if@exists{% + % check if there is already a file. + % In that case, use it. If not, typeset the picture normally. + \gdef\pgf@filename{}% + \xdef\pgf@tempa{\noexpand\pgf@findfile\pgfsys@imagesuffixlist:+{\tikzexternal@curfilename}}% + \pgf@tempa + \ifx\pgf@filename\pgfutil@empty% + % Note: since we have no 'GRAB' mode, we do not have to deal with optimization. + % there is no graphics. + \expandafter\tikzexternal@normalpicture@nographics + \else + \expandafter\tikzexternal@forcegraphics + \fi +}% + + +% Used by the optimization code. +% It will be called if GRAB mode is on. +% See the 'optimize command away' key. +\def\tikzexternal@optimize@away@cmd#1#2{% + \pgfutil@ifnextchar[{% + \tikzexternal@optimize@away@cmd@{#1}{#2}% + }{% + \tikzexternal@optimize@away@cmd@{#1}{#2}[]% + }% +}% +\def\tikzexternal@optimize@away@cmd@#1#2[#3]{% + \def\tikz@temp{#2}% + \ifx\tikz@temp\pgfutil@empty + \def\tikz@temp{\tikzexternal@optimize@away@cmd@auto{#1}{#3}}% + \else + \ifcase#2\relax + \def\tikzexternal@optimize@away@cmd@manual{% + \tikzexternal@optimize@away@cmd@@@{#1}{#3}{}% + }% + \or + \def\tikzexternal@optimize@away@cmd@manual##1{% + \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}}% + }% + \or + \def\tikzexternal@optimize@away@cmd@manual##1##2{% + \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}}% + }% + \or + \def\tikzexternal@optimize@away@cmd@manual##1##2##3{% + \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}}% + }% + \or + \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4{% + \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}}% + }% + \or + \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4##5{% + \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}{##5}}% + }% + \or + \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4##5##6{% + \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}{##5}{##6}}% + }% + \or + \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4##5##6##7{% + \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}{##5}{##6}{##7}}% + }% + \or + \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4##5##6##7##8{% + \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}}% + }% + \or + \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4##5##6##7##8##9{% + \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}{##9}}% + }% + \fi + \def\tikz@temp{\tikzexternal@optimize@away@cmd@manual}% + \fi + \tikz@temp +}% +\def\tikzexternal@optimize@away@cmd@auto#1#2{% + \pgfutil@ifnextchar\bgroup{% + \tikzexternal@optimize@away@cmd@auto@{#1}{#2}% + }{% + \tikzexternal@optimize@away@cmd@auto@{#1}{#2}{}% give empty argument. + } +}% + +\def\tikzexternal@optimize@away@cmd@auto@#1#2#3{% + \tikzexternal@optimize@away@cmd@@@{#1}{#2}{{#3}}% <-- provide braces +}% +\def\tikzexternal@optimize@away@cmd@@@#1#2#3{% + \begingroup + \toks0={#1[#2]#3}% + \iftikzexternal@verbose@optimize + \immediate\write16{The command '\the\toks0' has been optimized away. Use '/tikz/external/optimize=false' to disable this.}% + \fi + \endgroup + \begingroup + \pgfkeysvalueof{/tikz/external/optimize away text/.@cmd}#1\pgfeov% + \endgroup +}% + +\def\tikzexternal@optimize@away@latex@env#1{% + \def\tikzexternal@optimize@away@latex@env@{#1}% + \begingroup + \def\tikzexternal@laTeX@collect@until@end@tikzpicturetikzpicturestring{#1}% + \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@optimize@away@latex@env@close +}% +\long\def\tikzexternal@optimize@away@latex@env@close#1{% + \iftikzexternal@verbose@optimize + \immediate\write16{The complete contents of \string\begin{tikzexternal@optimize@away@latex@env@} up to the next \end{tikzexternal@optimize@away@latex@env@} has been optimized away because it does not contribute to exported PDF. Use '/tikz/external/optimize=false' to disable this.}% + \fi + \endgroup + % we still need to invoke \end{} in latex because \begin{} + % starts a local group - that must be closed properly. Make sure then \end does nothing: + \expandafter\let\csname end\tikzexternal@optimize@away@latex@env@\endcsname=\relax + \expandafter\end\expandafter{\tikzexternal@optimize@away@latex@env@}% +}% + +\def\tikzexternal@optimize@REPLACE{% + \pgfkeysvalueof{/tikz/external/optimize/install/.@cmd}\pgfeov +}% + +\def\tikzexternal@optimize@RESTORE{% + \pgfkeysvalueof{/tikz/external/optimize/restore/.@cmd}\pgfeov +}% + +% Closes one 'tikzpicture' environment. This is only used for LaTeX, +% because the '\end{tikzpicture}' command would raise an exception otherwise. +% It does *not* call \endtikzpicture. +\def\tikzexternal@closeenvironments{% + \let\endtikzpicture=\relax + \tikzexternal@TEXDIALECT@endpicture + \let\endtikzpicture=\tikzexternal@origendpicture + \let\tikzexternal@curfilename=\relax +} + +% Throws a tikzpicture away - without further notice. +% Used if we are currently converting *another* picture. No need to waste time +% with expensive pictures if they are not shipped out anyway. +% +% See the 'optimize' key to disable this. +\def\tikzexternal@skipfigure{% + \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@skipfigure@@ +} +\long\def\tikzexternal@skipfigure@@#1{% + \iftikzexternal@verbose@optimize + \immediate\write16{A tikzpicture has been optimized away. Use '/tikz/external/optimize=false' to disable this.}% + \fi + \tikzexternal@closeenvironments +} + +% Processes tikzpicture normally; without any externalization. +% +% We need to do further work here to deal with NESTED tikzpicture environments +% because all of them shall also be typeset normally. +% +% Idea: +% 1. restore the original \tikzpicture macro +% 2. install the replacement \tikzpicture in \end{tikzpicture}. +% and keep track of nesting. +% +% FIXME: could it be possible that nested tikzpictures use other code anyway? +\def\tikzexternal@normalpicture@nographics{% + \tikzexternal@nestedflagfalse + \let\tikzpicture=\tikzexternal@normalpicture@begreplace + \let\endtikzpicture=\tikzexternal@normalpicture@endreplace + \tikzpicture +} +\def\tikzexternal@normalpicture@begreplace{% + \begingroup + \tikzexternal@nestedflagtrue + \tikzexternal@origpicture +} +\def\tikzexternal@normalpicture@endreplace{% + \tikzexternal@origendpicture + \endgroup + \iftikzexternal@nestedflag + \else + \let\tikzpicture=\tikzexternal@tikzpicture@replacement + \let\endtikzpicture=\tikzexternal@origendpicture + \fi +}% + +% Assumes there is an image on disk and reads it. The tikzpicture is thrown away. +\def\tikzexternal@forcegraphics{% + \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@forcegraphics@@ +} +\long\def\tikzexternal@forcegraphics@@#1{% + \expandafter\pgfincludeexternalgraphics\expandafter{\tikzexternal@curfilename}% + \tikzexternal@closeenvironments +} + +% Simply replaces the complete picture by some placeholder text. +% It is used by 'mode=list only' to reduce runtime. +\def\tikzexternal@listmodepicture{% + \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@listmodepicture@@ +} +\long\def\tikzexternal@listmodepicture@@#1{% + \pgfkeysvalueof{/tikz/external/image discarded text}% + \tikzexternal@closeenvironments +} + +% check if there is already a file. +% In that case, use it. If not, skip it. +\def\tikzexternal@list@and@makefile@mode@picture{% + \gdef\pgf@filename{}% + \xdef\pgf@tempa{\noexpand\pgf@findfile\pgfsys@imagesuffixlist:+{\tikzexternal@curfilename}}% + \pgf@tempa + \ifx\pgf@filename\pgfutil@empty% + % Note: since we have no 'GRAB' mode, we do not have to deal with optimization. + % there is no graphics. + \expandafter\tikzexternal@listmodepicture + \else + \expandafter\tikzexternal@forcegraphics + \fi +}% + +\def\tikzexternal@externalizefig@GRAB{% + \iftikzexternal@optimize + \ifpgf@external@grabshipout + \tikzexternal@optimize@RESTORE + \fi + \fi + \def\tikzpicture{% + \def\tikzpicture{% make sure that nested \tikzpicture are processed normally. + \begingroup + \def\endtikzpicture{% + \tikzexternal@origendpicture + \endgroup + }% + \tikzexternal@origpicture + }% + \pgf@external@grab{\tikzexternal@curfilename}% + \tikzexternal@origpicture + }% + \def\endtikzpicture{% + \tikzexternal@origendpicture + \pgf@externalend + \let\tikzpicture=\tikzexternal@tikzpicture@replacement + \let\endtikzpicture=\tikzexternal@origendpicture + \iftikzexternal@optimize + \ifpgf@external@grabshipout + \tikzexternal@optimize@REPLACE + \fi + \fi + }% + \tikzpicture +}% + + +% 1. Discards the current picture in this document. +% 2. Checks whether an image exists already. If that is the case: acquire it. +% 3. If no image exists: call '/tikz/external/system call'. This will +% process \tikzexternal@externalizefig. +% 4. Assert that finally an image exists and use it. +\def\tikzexternal@externalizefig@systemcall{% + \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@externalizefig@systemcall@@ +} + +{ +\catcode`\"=12 +\catcode`\'=12 +\catcode`\;=12 +\catcode`\&=12 +\catcode`\-=12 +\xdef\tikzexternal@normal@dq{"} +\xdef\tikzexternal@normal@sq{'} +\xdef\tikzexternal@normal@semic{;} +\xdef\tikzexternal@normal@and{&} +\xdef\tikzexternal@normal@dash{-} +\catcode`\"=13 +\catcode`\'=13 +\catcode`\;=13 +\catcode`\&=13 +\catcode`\-=13 +\gdef\tikzexternal@activate@normal@dq{\let"=\tikzexternal@normal@dq} +\gdef\tikzexternal@activate@normal@sq{\let'=\tikzexternal@normal@sq} +\gdef\tikzexternal@activate@normal@semic{\let;=\tikzexternal@normal@semic} +\gdef\tikzexternal@activate@normal@and{\let&=\tikzexternal@normal@and} +\gdef\tikzexternal@activate@normal@dash{\let-=\tikzexternal@normal@dash} +\catcode`\|=0 +\catcode`\\=12 +|xdef|tikzexternal@normal@backslash{\}% +} +{ +\catcode`\^^I=12 +\catcode`\$=12 +\catcode`\%=12 +\catcode`\#=12 +\gdef\tikzexternal@HASHchar{#} +\gdef\tikzexternal@TABchar{^^I}\gdef\tikzexternal@PERCENTchar{%}\xdef\tikzexternal@DOLLARchar{$}} + +% Creates the '/tikz/external/system call' command as string and +% returns it into the (global!) macro #2. +% #1: the image file name (as returned by +% \tikzexternalgetnextfilename) +% #2: the global return value macro +% +\def\tikzexternal@assemble@systemcall#1#2{% + \begingroup + \def\image{#1}% + \iftikzexternal@auto@detect@jobname + \edef\texsource{\string\def\string\tikzexternalrealjob{\tikzexternal@realjob}\string\input{\tikzexternal@realjob}}% + \else + \let\texsource=\tikzexternal@realjob + \fi + \ifnum\the\catcode`\"=13 \tikzexternal@activate@normal@dq\fi + \ifnum\the\catcode`\'=13 \tikzexternal@activate@normal@sq\fi + \ifnum\the\catcode`\;=13 \tikzexternal@activate@normal@semic\fi + \ifnum\the\catcode`\-=13 \tikzexternal@activate@normal@dash\fi + \let\\=\tikzexternal@normal@backslash + \xdef#2{\pgfkeysvalueof{/tikz/external/system call}}% + \endgroup +}% +\long\def\tikzexternal@externalizefig@systemcall@@#1{% + \tikzexternal@externalizefig@systemcall@uptodatecheck% + \iftikzexternal@file@isuptodate + \iftikzexternal@verboseio + \immediate\write16{===== Image '\tikzexternal@curfilename' is up-to-date. ======}% + \fi + \let\pgf@filename=\tikzexternal@curfilename + \else + \begingroup + % no such image. Generate it! + \tikzexternal@assemble@systemcall{\tikzexternal@curfilename}{\pgf@tempa}% + \iftikzexternal@verboseio + \immediate\write16{===== 'mode=convert with system call': Invoking '\pgf@tempa' ========}% + \fi + % + \tikzexternalauxlock@setlock1% + \immediate\write18{\pgf@tempa}% + \tikzexternalauxlock@setlock0% + \expandafter\tikzexternal@externalizefig@systemcall@assertsuccess\expandafter{\pgf@tempa}% + \pgfmath@smuggleone\pgf@filename + \endgroup + \fi + \ifx\pgf@filename\pgfutil@empty + % error recovery: something did not work! Try to load it + % anyway. Perhaps it was just that shell-escape wasn't + % enabled. + \begingroup + \toks0={% + \tikzexternaldisable + \pgfutil@ifundefined{scantokens}{\long\def\scantokens##1{##1}}{}% + }% + % FIXME : THIS WILL FAIL IF THERE IS '##' INSIDE OF '#1'! + % for example something like /.style={#1} in the picture environment *will* fail. + \toks1={% + \tikzpicture#1% + }% + \toks2={% + \tikzexternal@TEXDIALECT@endpicture + \tikzexternalenable + }% + \xdef\tikzexternal@externalizefig@systemcall@next{% + \the\toks0 + % try reading them again as if they were in the input file. + \noexpand\scantokens{\the\toks1 }% + \the\toks2 + }% + \endgroup + \else + % ok, take the image! + \expandafter\pgfincludeexternalgraphics\expandafter{\tikzexternal@curfilename}% + \gdef\tikzexternal@externalizefig@systemcall@next{\tikzexternal@closeenvironments}% + \fi + \tikzexternal@externalizefig@systemcall@next +}% + +% Sets \iftikzexternal@file@isuptodate to false if one of the "force +% remake" things is active. +\def\tikzexternal@checkforceremake{% + \iftikzexternal@force@remake + \global\tikzexternal@file@isuptodatefalse + \else + \iftikzexternalremakenext + \global\tikzexternal@file@isuptodatefalse + \global\tikzexternalremakenextfalse + \fi + \fi +} + +% Checks whether the current picture needs to be externalized. +% +% This is the case if +% a) there is no external image yet, +% b) the picture has been invalidated manually. +% +% It returns \iftikzexternal@file@isuptodate accordingly. +\def\tikzexternal@externalizefig@systemcall@uptodatecheck{% + \tikzexternal@checkforceremake + \iftikzexternal@file@isuptodate + % check if there is already a file. + % In that case, use it. If that is not the case, generate it and include it afterwards. + \gdef\pgf@filename{}% + \xdef\pgf@tempa{\noexpand\pgf@findfile\pgfsys@imagesuffixlist:+{\tikzexternal@curfilename}}% + \pgf@tempa + \ifx\pgf@filename\pgfutil@empty% + \global\tikzexternal@file@isuptodatefalse + \fi + \fi +}% + +% \pgf@filename will be empty if the assertion failed. +\def\tikzexternal@externalizefig@systemcall@assertsuccess#1{% + % check if there is a file now and raise an error message if not. + \gdef\pgf@filename{}% + \xdef\pgf@tempa{\noexpand\pgf@findfile\pgfsys@imagesuffixlist:+{\tikzexternal@curfilename}}% + \pgf@tempa + \ifx\pgf@filename\pgfutil@empty% + \PackageError{tikz}{Sorry, the system call '#1' did NOT result in a usable output file '\tikzexternal@curfilename' (expected one of \pgfsys@imagesuffixlist). Please verify that you have enabled system calls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes it is also named 'write 18' or something like that. Or maybe the command simply failed? Error messages can be found in '\tikzexternal@curfilename.log'. If you continue now, I'll try to typeset the picture}% + \fi +}% + +% Overwrite error message of pgf. +% This happens if the generated image was empty, i.e. if there was no \shipout. +\def\pgfexternal@error@no@shipout{% + \begingroup + \tikzexternal@assemble@systemcall{\pgfactualjobname}{\pgf@tempa}% + \toks0=\expandafter{\pgf@tempa}% + \PackageError{tikz}{Sorry, image externalization failed: the resulting image was EMPTY. I tried to externalize '\pgfactualjobname', but it seems there is no such image in the document!? + \if\tikzexternal@opmode4 ^^J +\space\space You are currently using 'mode=convert with system call'. This problem can happen if the image (or one of the images preceeding it) was declared inside of a \string\label{} (i.e. in the .aux file): 'convert with system call' has no access to the main aux file.^^J +\space\space Possible solutions in this case:^^J +\space\space a) Try using 'mode=list and make',^^J +\space\space b) Issue the externalization command '\the\toks0' *manually* (also check the preceeding externalized images, perhaps the file name sequence is not correct).^^J +\space\space Repeat: the resulting image was EMPTY, your attention is required +\else + \if\tikzexternal@opmode5 ^^J +\space\space You are currently using 'mode=list and make'. Possible solutions:^^J +\space\space a) Try to delete `\tikzexternal@realjob.makefile'. Perhaps it is not up-to-date.^^J +\space\space b) Perhaps pictures are declared inside of \string\label{} and the .aux file is not up-to-date. Re-run latex, perhaps re-generate the graphics as well.^^J +\space\space Repeat: the resulting image was EMPTY, your attention is required + \fi +\fi}% + \endgroup +}% diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryautomata.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryautomata.code.tex index 12b6bddfe0d..d2aa190d618 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryautomata.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryautomata.code.tex @@ -7,8 +7,9 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryautomata.code.tex,v 1.2 2008/02/14 10:31:22 tantau Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryautomata.code.tex,v 1.3 2008/07/14 10:30:36 tantau Exp $ +\usetikzlibrary{shapes.multipart} % Styles for states: diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarybackgrounds.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarybackgrounds.code.tex index c1a25628a08..cd68855bbab 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarybackgrounds.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarybackgrounds.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarybackgrounds.code.tex,v 1.1 2008/01/09 17:57:15 tantau Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarybackgrounds.code.tex,v 1.2 2010/02/08 11:21:46 tantau Exp $ % Layers @@ -16,6 +16,12 @@ \pgfsetlayers{background,main} +% Switch command +\tikzset{on background layer/.style={ + execute at begin scope={\pgfonlayer{background}}, + execute at end scope={\endpgfonlayer}}} + + % Main style \tikzstyle{background rectangle}= [draw] diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalc.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalc.code.tex index f79f5343bb5..1a0ea356c24 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalc.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalc.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalc.code.tex,v 1.5 2008/02/04 17:19:55 tantau Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalc.code.tex,v 1.6 2009/09/04 17:22:59 tantau Exp $ % % @@ -378,7 +378,7 @@ \pgfmathparse{veclen(\the\pgf@xa,\the\pgf@ya)} \pgfmathparse{acos(\the\pgf@xc/\pgfmathresult)} \ifnum\pgfkeysvalueof{/tikz/cs/solution}>1\relax% - \pgfmathsubtract{0}{\pgfmathresult}% + \pgfmathparse{0-\pgfmathresult}% \fi% \let\tikz@lib@temp=\pgfmathresult% % diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarychains.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarychains.code.tex index 0f7e0082611..24019031a36 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarychains.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarychains.code.tex @@ -7,7 +7,9 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarychains.code.tex,v 1.4 2008/02/12 23:41:59 tantau Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarychains.code.tex,v 1.5 2008/02/27 09:14:09 tantau Exp $ + +\usetikzlibrary{positioning} \tikzset{start chain/.default=, start chain/.code={% diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.code.tex index 62d1cbda803..4ab723f711c 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.code.tex @@ -110,8 +110,9 @@ \pgfpathmoveto{\pgfqpoint{\the\tikz@lastxsaved}{\the\tikz@lastysaved}}% \fi% } - +\newbox\tikz@lib@dec@box \def\tikz@enddecoration{% + \global\setbox\tikz@lib@dec@box=\box\tikz@tempbox% \ifx\tikz@decoration@name\tikz@nonetext% % ignore this. \else @@ -123,6 +124,7 @@ \fi% \fi \endgroup% + \setbox\tikz@tempbox=\box\tikz@lib@dec@box% } diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.pathreplacing.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.pathreplacing.code.tex index f7c86aeba5d..ec4c6001f55 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.pathreplacing.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.pathreplacing.code.tex @@ -10,4 +10,27 @@ \usetikzlibrary{decorations} \usepgflibrary{decorations.pathreplacing} + +\def\tikz@lib@dec@installinputsegmentpoints{% + \pgf@process{\pgf@decorate@inputsegment@first}% + \edef\tikzinputsegmentfirst{\the\pgf@x,\the\pgf@y}% + % + \pgf@process{\pgf@decorate@inputsegment@last}% + \edef\tikzinputsegmentlast{\the\pgf@x,\the\pgf@y}% + % + \pgf@process{\pgf@decorate@inputsegment@supporta}% + \edef\tikzinputsegmentsupporta{\the\pgf@x,\the\pgf@y}% + % + \pgf@process{\pgf@decorate@inputsegment@supportb}% + \edef\tikzinputsegmentsupportb{\the\pgf@x,\the\pgf@y}% +} + +\pgfkeys{ + /pgf/decoration/.cd, + moveto code/.code=\def\pgfdecoratedinputsegmentmovetocode{\tikz@lib@dec@installinputsegmentpoints#1}, + lineto code/.code=\def\pgfdecoratedinputsegmentlinetocode{\tikz@lib@dec@installinputsegmentpoints#1}, + curveto code/.code=\def\pgfdecoratedinputsegmentcurvetocode{\tikz@lib@dec@installinputsegmentpoints#1}, + closepath code/.code=\def\pgfdecoratedinputsegmentclosepathcode{\tikz@lib@dec@installinputsegmentpoints#1} +} + \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfadings.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfadings.code.tex index ec43475f6a0..589c3356f65 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfadings.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfadings.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfadings.code.tex,v 1.1 2008/01/09 17:57:16 tantau Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfadings.code.tex,v 1.2 2009/11/15 18:53:00 ludewich Exp $ \usepgflibrary{fadings} @@ -28,8 +28,9 @@ \endgroup% } -\let\starttikzfadingfrompicture=\tikzfadingfrompicture -\let\stopttikzfadingfrompicture=\endtikzfadingfrompicture +% This makes it easier to maintain compatibility with the external lib: +\def\starttikzfadingfrompicture{\tikzfadingfrompicture} +\def\stopttikzfadingfrompicture{\endtikzfadingfrompicture} \def\tikzfading[#1]{% {% @@ -44,4 +45,4 @@ }% \pgfdeclarefading{\tikz@smuggle}{\box\pgfpic}% }% -} \ No newline at end of file +} diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfit.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfit.code.tex index 1181dabea5f..2ae21de0420 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfit.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfit.code.tex @@ -7,15 +7,22 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfit.code.tex,v 1.2 2008/02/06 22:18:29 tantau Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfit.code.tex,v 1.3 2008/06/21 18:59:25 vibrovski Exp $ -\pgfkeys{/tikz/fit/.code=\tikz@lib@fit{#1}} +\pgfkeys{/tikz/fit/.code=\tikz@lib@fit{#1}, + /tikz/rotate fit/.code=\def\tikz@lib@fit@rotate{#1}\pgfkeysalso{/tikz/rotate=#1} +} + +\def\tikz@lib@fit@rotate{0} \def\tikz@lib@fit#1{% \pgf@xb=-16000pt\relax% \pgf@xa=16000pt\relax% \pgf@yb=-16000pt\relax% \pgf@ya=16000pt\relax% + % + \pgfmathsetmacro\tikz@lib@fit@rotate{\tikz@lib@fit@rotate}% + % % Now iterate over the coordinates \tikz@lib@fit@scan#1\pgf@stop% % Now, let's see what has happend @@ -29,6 +36,30 @@ \advance\pgf@y by-\pgf@ya% \advance\pgf@xa by.5\pgf@x% \advance\pgf@ya by.5\pgf@y% + \ifdim\tikz@lib@fit@rotate pt=0pt\relax% + \edef\tikz@node@at{\noexpand\pgfpoint{\the\pgf@xa}{\the\pgf@ya}}% + \else% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + {% + \pgf@xc=\pgf@xa% + \pgf@yc=\pgf@ya% + \pgfgettransform\tikz@lib@fit@transform% + \pgftransforminvert% + \pgf@pos@transform{\pgf@xc}{\pgf@yc}% + \pgftransformreset% + \pgftransformrotate{\tikz@lib@fit@rotate}% + \pgf@pos@transform{\pgf@xc}{\pgf@yc}% + \pgfsettransform\tikz@lib@fit@transform% + \pgf@pos@transform{\pgf@xc}{\pgf@yc}% + \global\pgf@x=\pgf@xc% + \global\pgf@y=\pgf@yc% + }% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@x=\pgf@xc% + \pgf@y=\pgf@yc% + \fi% \edef\tikz@node@at{\noexpand\pgfpoint{\the\pgf@xa}{\the\pgf@ya}}% \pgfkeysalso{/tikz/anchor=center,/tikz/text centered}% \pgfkeysalso{/tikz/text width/.expanded=\the\pgf@x}% @@ -59,7 +90,25 @@ } \def\tikz@lib@fit@adjust#1{% - \pgf@process{#1}% + \ifdim\tikz@lib@fit@rotate pt=0pt\relax% + \pgf@process{#1}% + \else% + {% + #1% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgfgettransform\tikz@lib@fit@transform% + \pgftransforminvert% + \pgf@pos@transform{\pgf@xc}{\pgf@yc}% + \pgftransformreset% + \pgftransformrotate{-\tikz@lib@fit@rotate}% + \pgf@pos@transform{\pgf@xc}{\pgf@yc}% + \pgfsettransform\tikz@lib@fit@transform% + \pgf@pos@transform{\pgf@xc}{\pgf@yc}% + \global\pgf@x=\pgf@xc% + \global\pgf@y=\pgf@yc% + }% + \fi% \ifdim\pgf@x<\pgf@xa% \pgf@xa=\pgf@x% \fi% @@ -74,4 +123,5 @@ \fi% } + \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfixedpointarithmetic.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfixedpointarithmetic.code.tex new file mode 100644 index 00000000000..56d35c5008b --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfixedpointarithmetic.code.tex @@ -0,0 +1,10 @@ +% Copyright 2008 by Mark Wibrow +% +% This file may be distributed and/or modified +% +% 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. + +\usepgflibrary{fixedpointarithmetic} diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfpu.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfpu.code.tex new file mode 100644 index 00000000000..eda3ce51996 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfpu.code.tex @@ -0,0 +1,10 @@ +% Copyright 2008/2009 by Christian Feuersaenger +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU General Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\usepgflibrary{fpu} diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryintersections.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryintersections.code.tex new file mode 100644 index 00000000000..dd842033fc8 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryintersections.code.tex @@ -0,0 +1,156 @@ +% Copyright 2008 by Mark Wibrow +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\usepgflibrary{intersections} + +\let\tikz@intersect@def=\def + +\pgfkeys{% + /tikz/name path global/.code={% + % it might have been more efficient to eliminate the storage macro + % \tikz@intersect@namedpaths. But I keep it maintain compatibility + % with mixed occurances of local/global names. + \let\tikz@intersect@def=\gdef + \pgfkeys{/tikz/name path={#1}}% + }, + /tikz/name path local/.code={% + \let\tikz@intersect@def=\def + \pgfkeys{/tikz/name path={#1}}% + }, + /tikz/name path/.code={% + \tikz@addmode{% + \pgfsyssoftpath@getcurrentpath\tikz@intersect@temppath% + \ifx\tikz@intersect@namedpaths\pgfutil@empty% + \else% + \tikz@intersect@namedpaths% + \pgfutil@ifundefined{tikz@intersect@path@name@#1}{}% + {% + \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\tikz@intersect@@temppath% + \expandafter\expandafter\expandafter{\csname tikz@intersect@path@name@#1\endcsname}% + \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\tikz@intersect@temppath% + \expandafter\expandafter\expandafter{\expandafter\tikz@intersect@temppath\tikz@intersect@temppath}% + }% + \fi% + \tikz@intersect@addto@path@names{#1}% + }% + } +} + +\def\tikz@intersect@addto@path@names#1{% + % FIXME : I have the impression that something is not correct + % here... the \tikz@intersect@def is not used correctly! + % if I am not mistaken, the \tikz@intersect@def will NOT be + % invoked until \tikz@intersect@namedpaths. CHECK IT + % It seems it works, but only partially. + \def\tikz@marshal{\expandafter\tikz@intersect@def\csname tikz@intersect@path@name@#1\endcsname}% + \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\tikz@marshal% + \expandafter\expandafter\expandafter{\expandafter\tikz@marshal\expandafter{\tikz@intersect@temppath}}% + \ifx\tikz@intersect@def\gdef + % This here is to *ensure* that the \gdef is invoked. + % + % I think this solves the problem. + % + % Please revise this routine such that it works better. + \tikz@marshal + \fi + \expandafter\pgfutil@g@addto@macro\expandafter\tikz@intersect@namedpaths\expandafter{\tikz@marshal}% +} + + +\let\tikz@finish@orig=\tikz@finish +\def\tikz@finish{% + \tikz@finish@orig% + \tikz@intersect@finish% +} + +\def\tikz@intersect@finish{% + \ifx\tikz@intersect@namedpaths\pgfutil@empty% + \else% + \tikz@intersect@namedpaths% + \let\tikz@intersect@namedpaths=\pgfutil@empty% + \fi% +} + +\let\tikz@intersect@namedpaths=\pgfutil@empty +\let\tikz@intersect@path@a=\pgfutil@empty +\let\tikz@intersect@path@b=\pgfutil@empty +\let\tikz@intersect@name=\pgfutil@empty +\let\tikz@intersect@total=\pgfutil@empty + +\tikzset{ + name intersections/.code={% + \tikzset{/tikz/intersection/.cd, + by=, + #1}% + \pgfutil@ifundefined{tikz@intersect@path@name@\tikz@intersect@path@a}{% + \PackageError{tikz}{I do not know the path named `\tikz@intersect@path@a'. Perhaps you misspelt it}{}}% + {\pgfutil@ifundefined{tikz@intersect@path@name@\tikz@intersect@path@b}{% + \PackageError{tikz}{I do not know the path named `\tikz@intersect@path@b'. Perhaps you misspelt it}{}}% + {% + \pgfintersectionofpaths% + {% + \expandafter\pgfsetpath\csname tikz@intersect@path@name@\tikz@intersect@path@a\endcsname% + }% + {% + \expandafter\pgfsetpath\csname tikz@intersect@path@name@\tikz@intersect@path@b\endcsname% + }% + \ifx\tikz@intersect@total\pgfutil@empty% + \else% + \expandafter\let\tikz@intersect@total=\pgfintersectionsolutions% + \fi% + \ifx\tikz@intersect@name\pgfutil@empty% + \def\tikz@intersect@@name{intersection}% + \else% + \let\tikz@intersect@@name=\tikz@intersect@name% + \fi% + \pgfmathloop% + \ifnum\pgfmathcounter>\pgfintersectionsolutions\relax% + \else% + \path[reset cm]\pgfextra{\pgftransformshift{\pgfpointintersectionsolution{\pgfmathcounter}}}% + coordinate (\tikz@intersect@@name-\pgfmathcounter); + \repeatpgfmathloop% + \ifx\tikz@intersect@by\pgfutil@empty% + \else% + \foreach\tikz@intersect@name[count=\tikz@intersection@count] in \tikz@intersect@by% + {\expandafter\tikz@intersect@name@parse\tikz@intersect@name\pgf@stop}% + \fi% + }% + }% + },% + intersection/.cd, + of/.code=\tikz@intersect@path@names@parse#1\tikz@stop,% + name/.store in=\tikz@intersect@name, + total/.store in=\tikz@intersect@total, + by/.store in=\tikz@intersect@by, + sort by/.code=\edef\tikz@intersect@sort@by{#1}\tikz@intersect@check@sort@by% +} + + +\def\tikz@intersect@check@sort@by{% + \ifx\tikz@intersect@sort@by\tikz@intersect@path@a% + \pgfintersectionsortbyfirstpath% + \else% + \ifx\tikz@intersect@sort@by\tikz@intersect@path@b% + \pgfintersectionsortbysecondpath% + \else% + \pgf@intersect@sortfalse% + \fi% + \fi% +} +\def\tikz@intersect@path@names@parse#1 and #2\tikz@stop{% + \def\tikz@intersect@path@a{#1}% + \def\tikz@intersect@path@b{#2}% +} + +\def\tikz@intersect@name@parse{\pgfutil@ifnextchar[\tikz@intersect@name@parse@opt{\tikz@intersect@name@parse@opt[]}}%} +\def\tikz@intersect@name@parse@opt[#1]#2\pgf@stop{% + \coordinate [#1] (#2) at (\tikz@intersect@@name-\tikz@intersection@count); +}% + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarylindenmayersystems.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarylindenmayersystems.code.tex new file mode 100644 index 00000000000..4095f3a376c --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarylindenmayersystems.code.tex @@ -0,0 +1,81 @@ +% Copyright 2008 by Mark Wibrow +% +% This file may be distributed and/or modified +% +% 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. + +\usepgflibrary{lindenmayersystems} + +\def\tikz@@lsystem-system{% + \pgfutil@ifnextchar[{\tikz@lsystem@options}{\tikz@lsystem@options[]}} + +\def\tikz@lsystem indenmayer system{% + \pgfutil@ifnextchar[{\tikz@lsystem@options}{\tikz@lsystem@options[]}} + +\def\tikz@lsystem@options[#1]{% + \tikzset{#1}% + \ifx\tikz@lsystem@rules\pgfutil@empty% + \else% + \tikz@lsystem@declare% + \def\tikz@lsystem@name{tikz@temp}% + \fi% + \ifx\tikz@lsystem@anchor\pgfutil@empty% + \pgfpathmoveto{\pgfqpoint{\tikz@lastxsaved}{\tikz@lastysaved}}% + \pgflindenmayersystem{\tikz@lsystem@name}{\tikz@lsystem@axiom}{\tikz@lsystem@order}% + \else% + \pgfextract@process\tikz@lsystem@pos{\pgfqpoint{\tikz@lastxsaved}{\tikz@lastysaved}}% + \setbox\pgfnodeparttextbox=\hbox{% + \pgfinterruptpicture% + \pgfpicture% + \pgfpathmoveto{\pgfpointorigin}% + \pgflindenmayersystem{\tikz@lsystem@name}{\tikz@lsystem@axiom}{\tikz@lsystem@order}% + \begingroup% + \tikz@finish% + \endpgfpicture% + \endpgfinterruptpicture% + }% + {% + \pgftransformshift{\tikz@lsystem@pos}% + \tikzset{inner sep=0pt, outer sep=0pt, minimum size=0pt}% + \pgfmultipartnode{rectangle}{\tikz@lsystem@anchor}{lindenmayer system}{\pgfusepath{discard}}% + }% + \fi% + \tikz@scan@next@command} + +\tikzset{% + lindenmayer system/.style={/pgf/lindenmayer system/.cd, #1,/tikz/.cd}, + l-system/.style={lindenmayer system={#1}}, +} +\pgfkeys{/pgf/lindenmayer system/.cd, + name/.code=\edef\tikz@lsystem@name{#1}\let\tikz@lsystem@rules=\pgfutil@empty,% + axiom/.store in=\tikz@lsystem@axiom,% + order/.store in=\tikz@lsystem@order, + .unknown/.code={% + \pgfutil@ifundefined{pgf@lsystem@\pgfkeyscurrentname}{% + \pgfkeys{/errors/unknown key={/pgf/lindenmayer system/\pgfkeyscurrentname}{#1}}% + \let\tikz@lsystem@name=\pgfutil@empty% + }% + {\edef\tikz@lsystem@name{\pgfkeyscurrentname}} + },% + anchor/.store in=\tikz@lsystem@anchor,% + rule set/.store in=\tikz@lsystem@rules +} +\let\tikz@lsystem@anchor=\pgfutil@empty% +\let\tikz@lsystem@rules=\pgfutil@empty% + +\def\tikz@lsystem@declare{% + \expandafter\let\csname pgf@lsystem@tikz@temp\endcsname=\relax% + \pgfdeclarelindenmayersystem{tikz@temp}{% + \expandafter\tikz@lsystem@parse@rules\tikz@lsystem@rules,\tikz@stop,% + }% +} +\def\tikz@lsystem@parse@rules#1,{% + \ifx#1\tikz@stop% + \else% + \rule{#1}% + \expandafter\tikz@lsystem@parse@rules% + \fi% +} diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarymatrix.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarymatrix.code.tex index 124e70f2278..f1f03c457dd 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarymatrix.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarymatrix.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarymatrix.code.tex,v 1.1 2008/01/09 17:57:16 tantau Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarymatrix.code.tex,v 1.2 2008/06/18 23:34:49 tantau Exp $ % A matrix of nodes contains a node in each cell. @@ -84,7 +84,7 @@ % Provide a delimiter -\tikzoption{left delimiter}{\tikz@add@after@node@path{\tikz@delimiter% +\tikzoption{left delimiter}{\tikzset{append after command={\tikz@delimiter% {south east}% {south west}% {every delimiter,every left delimiter}% @@ -92,9 +92,9 @@ {north}% {#1}% {.}% - {\pgf@y}}} + {\pgf@y}}}} -\tikzoption{right delimiter}{\tikz@add@after@node@path{\tikz@delimiter% +\tikzoption{right delimiter}{\tikzset{append after command={\tikz@delimiter% {south west}% {south east}% {every delimiter,every right delimiter}% @@ -102,9 +102,9 @@ {north}% {.}% {#1}% - {\pgf@y}}} + {\pgf@y}}}} -\tikzoption{above delimiter}{\tikz@add@after@node@path{\tikz@delimiter% +\tikzoption{above delimiter}{\tikzset{append after command={\tikz@delimiter% {south east}% {north west}% {every delimiter,every above delimiter,rotate=-90}% @@ -112,9 +112,9 @@ {east}% {#1}% {.}% - {\pgf@x}}} + {\pgf@x}}}} -\tikzoption{below delimiter}{\tikz@add@after@node@path{\tikz@delimiter% +\tikzoption{below delimiter}{\tikzset{append after command={\tikz@delimiter% {south west}% {south west}% {every delimiter,every below delimiter,rotate=-90}% @@ -122,7 +122,7 @@ {east}% {.}% {#1}% - {\pgf@x}}} + {\pgf@x}}}} \def\tikz@delimiter#1#2#3#4#5#6#7#8{% \bgroup diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarymindmap.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarymindmap.code.tex index 06f42f5c457..981d747a3e5 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarymindmap.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarymindmap.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarymindmap.code.tex,v 1.5 2008/02/10 16:29:07 tantau Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarymindmap.code.tex,v 1.9 2009/11/12 09:53:02 ludewich Exp $ \usetikzlibrary{trees,decorations} @@ -99,11 +99,12 @@ \tikzstyle{circle connection bar}= [to path={ \pgfextra{\tikz@compute@circle@radii\tikz@compute@segmentamplitude} - [fill=\tikz@concept@color,draw=none] [every circle connection bar] decorate [decoration=circle connection bar] { -- (\tikztotarget) \tikztonodes} -}] +}, +append after command={[fill=\tikz@concept@color,draw=none]} +] \tikzstyle{every circle connection bar}=[] \def\tikz@compute@circle@radii{% @@ -132,21 +133,87 @@ \tikzoption{circle connection bar switch color}{\tikz@parse@switch#1\pgf@unique} \def\tikz@parse@switch from (#1) to (#2)\pgf@unique{% - \def\tikz@to@path{% - \pgfextra{% - \pgfutil@colorlet{tikz@switch@from}{#1}% - \pgfutil@colorlet{tikz@switch@to}{#2}% - \tikz@compute@circle@radii\tikz@compute@segmentamplitude% - \tikz@compute@rotation% - } - [fill=none,draw=none] - [every circle connection bar] - decorate [decoration=circle connection bar] - {-- (\tikztotarget) \tikztonodes} - [shading=tikz@shade@bar] + \tikzset{to path={% + \pgfextra{% + \tikz@compute@circle@radii\tikz@compute@segmentamplitude% + \global\let\tikz@lib@save@start=\tikztostart% + \global\let\tikz@lib@save@target=\tikztotarget% + \pgfkeysgetvalue{/pgf/decoration/start radius}\pgf@temp% + \global\let\tikz@lib@saved@start@radius=\pgf@temp% + \pgfkeysgetvalue{/pgf/decoration/end radius}\pgf@temp% + \global\let\tikz@lib@saved@end@radius=\pgf@temp% + }% + [every circle connection bar] + decorate [decoration=circle connection bar] + { -- (\tikztotarget) \tikztonodes} + }, + append after command={ + [fill=none,draw=none,path picture=\tikz@lib@shade@pic] + \pgfextra{ + \pgfutil@colorlet{tikz@switch@from}{#1}% + \pgfutil@colorlet{tikz@switch@to}{#2}% + }} } } +\def\tikz@lib@shade@pic{% + % We have to draw the shading... + % compute start point: + \pgftransformreset% + \pgf@process{\pgfpointnormalised{\pgfpointdiff{\pgfpointanchor{\tikz@lib@save@start}{center}}{\pgfpointanchor{\tikz@lib@save@target}{center}}}}% + \edef\tikz@lib@mm@vec{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \pgfmathsetlength\pgf@xc{\tikz@lib@saved@start@radius} + \pgf@process{\pgfpointadd{\pgfpointtransformed{\pgfpointanchor{\tikz@lib@save@start}{center}}} + {\pgfpointscale{\pgf@sys@tonumber{\pgf@xc}}{\tikz@lib@mm@vec}}} + \edef\tikz@lib@mm@start{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \pgfmathsetlength\pgf@xc{\tikz@lib@saved@end@radius} + \pgf@process{\pgfpointdiff{\tikz@lib@mm@start}{\pgfpointadd{\pgfpointtransformed{\pgfpointanchor{\tikz@lib@save@target}{center}}} + {\pgfpointscale{-\pgf@sys@tonumber{\pgf@xc}}{\tikz@lib@mm@vec}}}} + \edef\tikz@lib@mm@end{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \pgftransformshift{\tikz@lib@mm@start} + \pgflowlevelsynccm + \pgf@process{\tikz@lib@mm@vec} + { + \pgf@xa=-\pgf@x% + \pgftransformcm{\pgf@sys@tonumber{\pgf@x}}{\pgf@sys@tonumber{\pgf@y}}% + {\pgf@sys@tonumber{\pgf@y}}{\pgf@sys@tonumber{\pgf@xa}}% + {\pgfpointorigin}% + \pgf@process{\pgfpointtransformed{\tikz@lib@mm@end}}% + \expandafter + } + \edef\tikz@lib@mm@length{\the\pgf@x}% + \pgf@process{\tikz@lib@mm@vec} + \pgf@ya=-\pgf@y% + \pgftransformcm{\pgf@sys@tonumber{\pgf@x}}{\pgf@sys@tonumber{\pgf@y}}% + {\pgf@sys@tonumber{\pgf@ya}}{\pgf@sys@tonumber{\pgf@x}}% + {\pgfpointorigin}% + % Y scale: + \pgfmathsetlength\pgf@y{\tikz@lib@saved@start@radius}% + \pgfmathsetlength\pgf@ya{\tikz@lib@saved@end@radius}% + \ifdim\pgf@y<\pgf@ya% + \pgf@y=\pgf@ya% + \fi% + \pgf@y=0.01992528\pgf@y% + \pgftransformyscale{\pgf@sys@tonumber{\pgf@y}}% + \pgfpathrectanglecorners + {\pgfpoint{-\tikz@lib@saved@start@radius}{-50bp}} + {\pgfpoint{1pt}{50bp}} + \pgfsetfillcolor{tikz@switch@from} + \pgfusepath{fill} + \pgfpathrectanglecorners + {\pgfpoint{\tikz@lib@mm@length+\tikz@lib@saved@end@radius}{-50bp}} + {\pgfpoint{\tikz@lib@mm@length-1pt}{50bp}} + \pgfsetfillcolor{tikz@switch@to} + \pgfusepath{fill} + % X scale: + \pgf@x=\tikz@lib@mm@length% + \pgf@x=0.009962\pgf@x% + \pgftransformxscale{\pgf@sys@tonumber{\pgf@x}}% + \pgftransformxshift{50bp} + \pgflowlevelsynccm% + \pgfuseshading{tikz@shade@bar} +} + \tikzoption{concept color}{% \let\tikz@old@concept@color=\tikz@concept@color% \def\tikz@edge@to@parent@path{ @@ -158,24 +225,8 @@ \pgfdeclarehorizontalshading[tikz@switch@from,tikz@switch@to]{tikz@shade@bar}{100bp}{% color(0pt)=(tikz@switch@from); - color(50bp)=(tikz@switch@from); - color(55bp)=(tikz@switch@to); color(100bp)=(tikz@switch@to)} -\def\tikz@compute@rotation{% - \pgf@process{\pgfpointnormalised{\pgfpointdiff{\pgfpointanchor{\tikztostart}{center}}{\pgfpointanchor{\tikztotarget}{center}}}}% - \pgf@ya=-\pgf@y% - \edef\pgf@marshal{% - \noexpand\pgfsetadditionalshadetransform{% - \noexpand\pgftransformcm - {\pgf@sys@tonumber{\pgf@x}}{\pgf@sys@tonumber{\pgf@y}}% - {\pgf@sys@tonumber{\pgf@ya}}{\pgf@sys@tonumber{\pgf@x}}% - {\noexpand\pgfpointorigin}% - }% - }% - \pgf@marshal% -} - @@ -234,6 +285,32 @@ level distance=1.85cm,% sibling angle=30,% font=\pgfutil@font@tiny] + +\tikzstyle{small mindmap}= + [% + root concept/.style={minimum size=2.3cm,text width=2.1cm,font=\pgfutil@font@footnotesize}, + level 1 concept/.style={% + minimum size=1.5cm, + level distance=2.8cm, + text width=1.4cm, + sibling angle=75, + font=\pgfutil@font@scriptsize},% + level 2 concept/.style={% + minimum size=1.1cm,% + level distance=2.2cm,% + text width=1.1cm,% + sibling angle=60,% + font=\pgfutil@font@tiny},% + level 3 concept/.style={% + level 2 concept, + sibling angle=30,% + font=\pgfutil@font@tiny},% + level 4 concept/.style={% + level 3 concept, + }, + mindmap,% + line width=2pt + ] \tikzstyle{large mindmap}= [% diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypetri.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypetri.code.tex index e9e79e986bb..524bea7a28f 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypetri.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypetri.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypetri.code.tex,v 1.1 2008/01/09 17:57:16 tantau Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypetri.code.tex,v 1.2 2008/06/18 23:34:49 tantau Exp $ % Styles for places: @@ -48,17 +48,17 @@ \tikzoption{tokens}{% \ifnum#1>0\relax% - \tikz@add@after@node@path{% + \tikzset{append after command={} {[children are tokens]child foreach \tikz@dummy in {1,...,#1} {node[token]{}}}}% \fi} \tikzoption{colored tokens}{% - \tikz@add@after@node@path{% + \tikzset{append after command={}% {[children are tokens]child foreach \tikz@child@color in {#1} {node[token,\tikz@child@color]{}}}}% } \tikzoption{structured tokens}{% - \tikz@add@after@node@path{% + \tikzset{append after command={}% {[children are tokens]child foreach \tikz@child@name in {#1} {node[token]{\tikz@child@name}}}}% } diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypositioning.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypositioning.code.tex index 0ebb15e18ca..7a9066e691e 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypositioning.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypositioning.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypositioning.code.tex,v 1.5 2008/02/12 23:41:59 tantau Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypositioning.code.tex,v 1.7 2008/10/06 09:35:29 tantau Exp $ \tikzset{above/.code=\tikz@lib@place@handle@{#1}{south}{0}{1}{north}{1}} @@ -19,8 +19,8 @@ \tikzset{below left/.code=\tikz@lib@place@handle@{#1}{north east}{-1}{-1}{south west}{0.707106781}} \tikzset{below right/.code=\tikz@lib@place@handle@{#1}{north west}{1}{-1}{south east}{0.707106781}} \tikzset{left/.code =\tikz@lib@place@handle@{#1}{east}{-1}{0}{west}{1}} -\tikzset{mid left/.code =\tikz@lib@place@handle@{#1}{mid east}{-1}{0}{base west}{1}} -\tikzset{mid right/.code=\tikz@lib@place@handle@{#1}{mid west}{1}{0}{base east}{1}} +\tikzset{mid left/.code =\tikz@lib@place@handle@{#1}{mid east}{-1}{0}{mid west}{1}} +\tikzset{mid right/.code=\tikz@lib@place@handle@{#1}{mid west}{1}{0}{mid east}{1}} \tikzset{right/.code=\tikz@lib@place@handle@{#1}{west}{1}{0}{east}{1}} \newif\iftikz@lib@ignore@size @@ -34,6 +34,7 @@ \def\tikz@lib@place@handle@#1#2#3#4#5#6{% \def\tikz@anchor{#2}% + \let\tikz@do@auto@anchor=\relax% \edef\tikz@temp{#1}% \def\tikz@lib@place@single@factor{#6}% \expandafter\tikz@lib@place@handle@@\expandafter{\tikz@temp}{#3}{#4}{#5}% diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryscopes.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryscopes.code.tex index 4209c3e939d..808e34578d6 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryscopes.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryscopes.code.tex @@ -7,19 +7,23 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryscopes.code.tex,v 1.1 2008/02/08 01:18:38 tantau Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryscopes.code.tex,v 1.2 2008/06/27 17:00:24 vibrovski Exp $ % Redefine the after command hook... \def\tikz@lib@scope@check{% - \pgfutil@ifnextchar\par{% - \afterassignment\tikz@lib@scope@check\let\tikz@next% - }% - {\pgfutil@ifnextchar\bgroup{%gotcha - \afterassignment\tikz@lib@scope@gotcha\let\tikz@next% - }% - {}% - } + \pgfutil@ifnextchar\tikz@intersect@finish{% + \tikz@intersect@finish\afterassignment\tikz@lib@scope@check\let\tikz@next% + }{% + \pgfutil@ifnextchar\par{% + \afterassignment\tikz@lib@scope@check\let\tikz@next% + }% + {\pgfutil@ifnextchar\bgroup{%gotcha + \afterassignment\tikz@lib@scope@gotcha\let\tikz@next% + }% + {}% + }% + }% } \def\tikz@lib@scope@gotcha{% diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshadings.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshadings.code.tex new file mode 100644 index 00000000000..962d9956af9 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshadings.code.tex @@ -0,0 +1,21 @@ +% Copyright 2008 by Till Tantau +% +% This file may be distributed and/or modified +% +% 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. + +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshadings.code.tex,v 1.1 2008/10/29 21:58:38 tantau Exp $ + +\usepgflibrary{shadings} + +\tikzset{ + lower left/.style={shading=bilinear interpolation,/utils/exec=\colorlet{lower left}{#1}}, + upper left/.style={shading=bilinear interpolation,/utils/exec=\colorlet{upper left}{#1}}, + lower right/.style={shading=bilinear interpolation,/utils/exec=\colorlet{lower right}{#1}}, + upper right/.style={shading=bilinear interpolation,/utils/exec=\colorlet{upper right}{#1}} +} + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryspy.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryspy.code.tex new file mode 100644 index 00000000000..fd45a761535 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryspy.code.tex @@ -0,0 +1,122 @@ +% Copyright 2008 by Till Tantau +% +% This file may be distributed and/or modified +% +% 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. + +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryspy.code.tex,v 1.2 2009/12/04 11:59:38 tantau Exp $ + + + +% Spy styles + +\tikzset{ + spy using outlines/.style={ + spy scope={ + every spy on node/.style={very thin,draw}, + every spy in node/.style={thick,draw}, + #1 + } + }, + spy using overlays/.style={ + spy scope={ + every spy on node/.style={fill,fill opacity=0.2,text opacity=1}, + every spy in node/.style={fill,fill opacity=0.2,text opacity=1}, + #1 + } + }, + connect spies/.style={ + spy connection path={\draw[thin] (tikzspyonnode) -- (tikzspyinnode);} + } +} + +\newbox\tikz@lib@spybox + +\let\tikz@lib@spy@collection=\pgfutil@empty% + +\tikzset{spy scope/.style={ + size/.style={minimum size=##1}, + height/.style={minimum height=##1}, + width/.style={minimum width=##1}, + execute at begin scope={% + \let\tikz@lib@spy@save=\tikz@lib@spy@collection% + \setbox\tikz@lib@spybox=\hbox\bgroup% + \let\spy=\tikz@lib@spy@parse}, + execute at end scope={% + \egroup% + {% + \copy\tikz@lib@spybox% + \tikz@lib@spy@collection% + }% + \global\let\tikz@lib@spy@collection=\tikz@lib@spy@save% + },% + tikz@lib@spy@style/.style={#1}, + tikz@lib@reset@gs + }, + lens/.store in=\tikz@lib@spy@lens, + lens=, + magnification/.style={lens={scale=#1}}, + spy connection path/.store in=\tikz@lib@spy@path, + spy connection path= +} + +\tikzset{ + tikz@lib@reset@gs/.style={black,thin,solid,opaque,line cap=butt,line join=miter} +} + +\def\tikz@lib@spy@parse{% + \pgfutil@ifnextchar[{\tikz@lib@spy@parse@opt}{\tikz@lib@spy@parse@opt[]}%] +} +\def\tikz@lib@spy@parse@opt[#1]{ + \pgfutil@ifnextchar x{\tikz@lib@spy@parse@opta[#1]}{\tikz@lib@spy@parse@opta[#1]}%] +} +\def\tikz@lib@spy@parse@opta[#1]on#2in node#3;{% + \pgfutil@g@addto@macro\tikz@lib@spy@collection{\tikz@lib@spy@do{#1}{#2}{#3}}% +} + +\def\tikz@lib@spy@do#1#2#3{% + \scope[tikz@lib@spy@style,#1] + \node [alias=tikzspyonnode,inner sep=0pt,outer sep=0pt,every spy on node/.try, + /utils/exec={ + {% + \let\tikz@transform=\relax + \pgftransformreset% + \expandafter\tikzset\expandafter{\tikz@lib@spy@lens} + \pgftransforminvert% + \pgfgettransformentries\a\b\c\d\e\f% + \global\let\pgf@lib@svg@a=\a% + \global\let\pgf@lib@svg@b=\b% + \global\let\pgf@lib@svg@c=\c% + \global\let\pgf@lib@svg@d=\d% + }% + \tikz@addtransform{% + \tikz@scan@one@point\pgftransformshift#2% + \pgftransformcm{\pgf@lib@svg@a}{\pgf@lib@svg@b}{\pgf@lib@svg@c}{\pgf@lib@svg@d}{\pgfpointorigin}% + } + }]{}; + \node [alias=tikzspyinnode,inner sep=0pt,outer sep=0pt,at={#2},every spy in node/.try, + path picture={\node[anchor=center,tikz@lib@reset@gs]{\nullfont% + \pgftransformreset% + \let\tikz@transform=\relax% + \expandafter\tikzset\expandafter{\tikz@lib@spy@lens}% + \pgflowlevelsynccm% + \tikz@scan@one@point\tikz@lib@spy@shift#2% + \pgflowlevelsynccm% + \copy\tikz@lib@spybox};}]#3{}; + \tikz@lib@spy@path + \endscope +} + +\def\tikz@lib@spy@shift#1{% + \pgf@process{#1}% + \pgf@x=-\pgf@x% + \pgf@y=-\pgf@y% + \pgftransformshift{}% +} + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarysvg.path.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarysvg.path.code.tex new file mode 100644 index 00000000000..0cee69a2fde --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarysvg.path.code.tex @@ -0,0 +1,31 @@ +% Copyright 2009 by Till Tantau +% +% This file may be distributed and/or modified +% +% 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. + +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarysvg.path.code.tex,v 1.1 2009/01/24 17:07:14 tantau Exp $ + +\usepgflibrary{svg.path} + +\def\tikz@svg@path vg{\pgfutil@ifnextchar[\tikz@svg@@path{\tikz@svg@@path[]}}%} + +\def\tikz@svg@@path[#1]#2"#3"{% + {% + \tikzset{#1}% + \pgfpathsvg{#3}% + }% + { + \pgftransforminvert + \pgf@process{\pgfpointtransformed{\pgfqpoint{\pgf@path@lastx}{\pgf@path@lasty}}} + } + \tikz@lastx=\pgf@x% + \tikz@lasty=\pgf@y% + \tikz@lastxsaved=\tikz@lastx% + \tikz@lastysaved=\tikz@lasty% + \tikz@updatecurrenttrue% + \tikz@scan@next@command +} \ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytopaths.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytopaths.code.tex index 2be37e7d3d3..ea87a5bd394 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytopaths.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytopaths.code.tex @@ -7,7 +7,12 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytopaths.code.tex,v 1.1 2008/01/09 17:57:16 tantau Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytopaths.code.tex,v 1.2 2008/06/17 21:23:44 tantau Exp $ + + +% Move to + +\tikzstyle{move to}= [to path={(\tikztotarget) \tikztonodes}] % Straight to diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytrees.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytrees.code.tex index 838bb20be21..7d34c2d6819 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytrees.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytrees.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytrees.code.tex,v 1.1 2008/01/09 17:57:16 tantau Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytrees.code.tex,v 1.2 2008/02/24 10:00:52 tantau Exp $ @@ -53,6 +53,8 @@ \pgf@temp% } + + % % Circle grow % @@ -81,6 +83,10 @@ + + + + % % Connections % diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryturtle.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryturtle.code.tex new file mode 100644 index 00000000000..c0306b4d304 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryturtle.code.tex @@ -0,0 +1,84 @@ +% Copyright 2008 by Till Tantau +% +% This file may be distributed and/or modified +% +% 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. + +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryturtle.code.tex,v 1.3 2008/06/18 23:34:49 tantau Exp $ + + +\tikzset{turtle/.style={/tikz/turtle/.cd,#1}} + +% The current angle is stored in this key. +\tikzset{turtle/direction/.code=\gdef\tikz@lib@turtle@dir{#1},turtle/direction=90} + +% The current angle is stored in this key. +\tikzset{turtle/distance/.initial=1cm} + +% The to path options that are used to move the turtle +\tikzset{turtle/how/.style=} + +% Let the turtle jump home +\tikzset{turtle/home/.style={/tikz/insert path={(0,0) [turtle/direction=90]}}} + +% Moves the turtle forward by the given distance or, if no distance is +% given, by turtle distance +\tikzset{ + turtle/forward/.default=\pgfkeysvalueof{/tikz/turtle/distance}, + turtle/forward/.style={/tikz/insert path={to[/tikz/turtle/how]++(\tikz@lib@turtle@dir:#1)}} +} + + + +% Moves the turtle backward by the given distance or, if no distance is +% given, by turtle distance +\tikzset{ + turtle/back/.default=\pgfkeysvalueof{/tikz/turtle/distance}, + turtle/back/.style={turtle forward=-#1} +} + + + +% Turns the turle left by the given number of degrees +\tikzset{ + turtle/left/.default=90, + turtle/left/.code={% + \pgfmathparse{#1+\tikz@lib@turtle@dir}% + \ifdim\pgfmathresult pt>360pt\relax% + \pgfmathparse{\pgfmathresult-360}% + \fi% + \global\let\tikz@lib@turtle@dir\pgfmathresult + } +} + + +% Turns the turle left by the given number of degrees +\tikzset{ + turtle/right/.default=90, + turtle/right/.code={% + \pgfmathparse{#1} + \pgfmathparse{\tikz@lib@turtle@dir-\pgfmathresult}% + \ifdim\pgfmathresult pt<0pt\relax% + \pgfmathparse{\pgfmathresult+360}% + \fi% + \global\let\tikz@lib@turtle@dir\pgfmathresult + } +} + + +% Shortcuts: +\tikzset{turtle/.cd, + fd/.style={forward=#1}, + fd/.default=\pgfkeysvalueof{/tikz/turtle/distance}, + bk/.style={back=#1}, + bk/.default=\pgfkeysvalueof{/tikz/turtle/distance}, + lt/.style={left=#1}, + lt/.default=90, + rt/.style={right=#1}, + rt/.default=90} + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex index cb8ad420ea8..e2a9cb2d649 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex @@ -7,19 +7,13 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/tikz.code.tex,v 1.27 2008/02/13 19:48:11 tantau Exp $ +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz/tikz.code.tex,v 1.76 2010/10/13 09:20:31 ludewich Exp $ -% Always-present libraries: - +% Always-present libraries (|\usepgflibrary| defined in +% \file{pgfutil-common.tex}). \usepgflibrary{plothandlers} -% TikZ is a key family -\pgfkeys{/tikz/.is family} - -\def\tikzset{\pgfqkeys{/tikz}} - - \newdimen\tikz@lastx \newdimen\tikz@lasty \newdimen\tikz@lastxsaved @@ -41,32 +35,61 @@ \newif\iftikz@snaked \newif\iftikz@decoratepath +% |\pgfutil@empty| is defined in \file{pgfutil-common.tex}. \let\tikz@options=\pgfutil@empty -\def\tikz@addoption#1{\expandafter\def\expandafter\tikz@options\expandafter{\tikz@options#1}} -\def\tikz@addmode#1{\expandafter\def\expandafter\tikz@mode\expandafter{\tikz@mode#1}} +% |\tikz@addoption| adds \texttt{#1} at the end of the replacement +% text of |\tikz@options| without expansion. +\def\tikz@addoption#1{% + \expandafter\def\expandafter\tikz@options\expandafter{\tikz@options#1}} +% Same as |tikz@addoption| for |\tikz@mode|. Note that |\tikz@mode| is +% initially let to |\pgfutil@empty| later (see path usage options). +\def\tikz@addmode#1{% + \expandafter\def\expandafter\tikz@mode\expandafter{\tikz@mode#1}} +% Same as |tikz@addoption| for |\tikz@transform|. Works even if +% |\tikz@transform| is not defined. In that case, nothing is added to +% |\tikz@transform|: \texttt{#1} is expanded. \def\tikz@addtransform#1{% - \ifx\tikz@transform\relax% + \ifx\tikz@transform\relax #1% - \else% + \else \expandafter\def\expandafter\tikz@transform\expandafter{\tikz@transform#1}% - \fi% -} - + \fi} -% TikZ options: +% TikZ options management. -% This command is supported for compatibility only: +% Setting up the tikz key family (key management needs +% \file{pgfkeys.code.tex}); +\pgfkeys{/tikz/.is family} -\def\tikzoption#1{\pgfutil@ifnextchar[{\tikzoption@opt{#1}}{\tikzoption@noopt{#1}}}%} +% |\tikzset| is a shortcut to set keys that belongs to the tikz +% family. +\def\tikzset{\pgfqkeys{/tikz}} -\def\tikzoption@opt#1[#2]#3{\pgfkeysdef{/tikz/#1}{#3}\pgfkeyssetvalue{/tikz/#1/.@def}{#2}} -\def\tikzoption@noopt#1#2{\pgfkeysdef{/tikz/#1}{#2}\pgfkeyssetvalue{/tikz/#1/.@def}{\pgfkeysvaluerequired}} +% Note: |\tikzoption| is supported for compatibility only. |\tikzset| +% should be used instead. +\def\tikzoption#1{% + \pgfutil@ifnextchar[%] + {\tikzoption@opt{#1}}{\tikzoption@noopt{#1}}} +\def\tikzoption@opt#1[#2]#3{% + \pgfkeysdef{/tikz/#1}{#3}% + \pgfkeyssetvalue{/tikz/#1/.@def}{#2}} +\def\tikzoption@noopt#1#2{% + \pgfkeysdef{/tikz/#1}{#2}% + \pgfkeyssetvalue{/tikz/#1/.@def}{\pgfkeysvaluerequired}} % Baseline options -\tikzoption{baseline}[0pt]{\pgfutil@ifnextchar({\tikz@baseline@coordinate}{\tikz@baseline@simple}#1\@nil}%) +\tikzoption{baseline}[0pt]{% + \pgfutil@ifnextchar(%) + {\tikz@baseline@coordinate}{\tikz@baseline@simple}#1\@nil} \def\tikz@baseline@simple#1\@nil{\pgfsetbaseline{#1}} -\def\tikz@baseline@coordinate#1\@nil{\pgfsetbaselinepointlater{\tikz@scan@one@point\pgfutil@firstofone#1}} +\def\tikz@baseline@coordinate#1\@nil{% + \pgfsetbaselinepointlater{\tikz@scan@one@point\pgfutil@firstofone#1}} + +\tikzoption{trim left}[0pt]{\pgfutil@ifnextchar({\tikz@trim@coordinate{left}}{\tikz@trim@simple{left}}#1\@nil}%) +\tikzoption{trim right}{\pgfutil@ifnextchar({\tikz@trim@coordinate{right}}{\tikz@trim@simple{right}}#1\@nil}%) +\def\tikz@trim@simple#1#2\@nil{\csname pgfsettrim#1\endcsname{#2}} +\def\tikz@trim@coordinate#1#2\@nil{\csname pgfsettrim#1pointlater\endcsname{\tikz@scan@one@point\pgfutil@firstofone#2}} % Draw options \tikzoption{line width}{\tikz@semiaddlinewidth{#1}}% @@ -96,6 +119,7 @@ \expandafter\tikz@addoption\expandafter{\expandafter\pgfsetdash\tikz@temp}% }% \def\tikz@dashphase{0pt} +\def\tikz@dashpattern{} \def\tikz@scandashon n#1o{% \expandafter\def\expandafter\tikz@dashpattern\expandafter{\tikz@dashpattern{#1}}% @@ -114,17 +138,44 @@ \else% \ifx\tikz@temp\pgfutil@empty% \else% - \def\tikz@double@color{#1}% + \pgfsetinnerstrokecolor{#1}% \fi% \tikz@addmode{\tikz@mode@doubletrue}% + \tikzset{every double/.try}% \fi} \tikzoption{double distance}{% \pgfmathsetlength{\pgf@x}{#1}% - \edef\tikz@double@width@distance{\the\pgf@x}% - \tikz@addmode{\tikz@mode@doubletrue}} + \edef\tikz@double@setup{% + \pgf@x=\the\pgf@x% + \advance\pgf@x by2\pgflinewidth% + \pgflinewidth=\pgf@x% + \noexpand\pgfsetlinewidth{\pgflinewidth}% + \noexpand\pgfsetinnerlinewidth{\the\pgf@x}% + }% + \tikzset{double}} +\def\tikz@double@setup{% + \pgf@x=2\pgflinewidth% + \advance\pgf@x by0.6pt% + \pgflinewidth=\pgf@x% + \pgfsetlinewidth{\pgflinewidth}% + \pgfsetinnerlinewidth{0.6pt}% +}% +\tikzset{double distance between line centers/.code={ + \pgfmathsetlength{\pgf@x}{#1}% + \edef\tikz@double@setup{% + \pgf@x=\pgflinewidth% + \pgf@xa=\the\pgf@x% + \advance\pgf@x by\pgf@xa% + \advance\pgf@xa by-\pgflinewidth% + \pgflinewidth=\pgf@x% + \noexpand\pgfsetlinewidth{\pgflinewidth}% + \noexpand\pgfsetinnerlinewidth{\pgf@xa}% + }% + \tikzset{double}}} +\tikzset{double equal sign distance/.style={double distance between line centers=0.45ex}} + + -\def\tikz@double@width@distance{0.6pt} -\def\tikz@double@color{white} % Fill options @@ -167,6 +218,13 @@ \tikzoption{rounded corners}[4pt]{\pgfsetcornersarced{\pgfpoint{#1}{#1}}} \tikzoption{sharp corners}[]{\pgfsetcornersarced{\pgfpointorigin}} +% Radii and arc options +\tikzset{x radius/.initial=0pt} +\tikzset{y radius/.initial=0pt} +\tikzset{radius/.style={/tikz/x radius=#1,/tikz/y radius=#1}} +\tikzset{start angle/.initial=} +\tikzset{end angle/.initial=} +\tikzset{delta angle/.initial=} % Coordinate options @@ -302,13 +360,17 @@ \let\tikz@fillcolor=\pgfutil@empty \let\tikz@strokecolor=\pgfutil@empty +% Insert a path using an option +\tikzset{insert path/.code=\tikz@scan@next@command#1\pgf@stop} % Pattern options \tikzset{pattern/.code=\PackageError{tikz}{You need to say \string\usetikzlibrary{patterns}}{}, pattern color/.style=pattern} +% Path pictures +\tikzset{path picture/.code=\tikz@addmode{\def\tikz@path@picture{#1}}} -% Shading options +% Fading options \tikzset{path fading/.code={ \def\tikz@temp{#1}% \ifx\tikz@temp\tikz@nonetext% @@ -412,59 +474,139 @@ % Pin options -\tikzoption{pin}{\pgfutil@ifnextchar[{\tikz@parse@pin}{\tikz@parse@pin[]}#1\pgf@nil} -\tikzoption{pin distance}{\def\tikz@pin@distance{#1}} -\tikzoption{pin edge}{\def\tikz@pin@edge@style{#1}} - -\tikzoption{tikz@pin@post}[]{% - \tikz@compute@direction{\tikz@label@angle}{\tikz@pin@distance}% - \global\let\tikz@pin@edge@style@smuggle=\tikz@pin@edge@style% -} -\tikzoption{tikz@pre@pin@edge}[]{\def\pgf@marshal{\tikzstyle{tikz@pin@options}=} - \expandafter\pgf@marshal\expandafter[\tikz@pin@edge@style@smuggle]% +\tikzset{ + pin/.code={\pgfutil@ifnextchar[{\tikz@parse@pin}{\tikz@parse@pin[]}#1:\pgf@nil},%} + pin distance/.store in=\tikz@pin@distance, + pin distance=3ex, + pin position/.store in=\tikz@pin@default@pos, + pin position=above, + pin edge/.store in=\tikz@pin@edge@style, + pin edge={}, + tikz@pin@post/.code={\global\let\tikz@pin@edge@style@smuggle=\tikz@pin@edge@style}, + tikz@pre@pin@edge/.code={% + \def\pgf@marshal{\tikzstyle{tikz@pin@options}=} + \expandafter\pgf@marshal\expandafter[\tikz@pin@edge@style@smuggle]% + }% } -\def\tikz@pin@distance{3ex} -\def\tikz@pin@edge@style{} +\long\def\tikz@parse@pin[#1]#2:#3\pgf@nil{% + \def\tikz@temp{#3}% + \ifx\tikz@temp\pgfutil@empty% + % no position, use default + \tikz@@parse@pin[#1]\tikz@pin@default@pos:#2:\pgf@nil% + \else% + \tikz@@parse@pin[#1]#2:#3\pgf@nil% + \fi% +} -\def\tikz@parse@pin[#1]#2:#3\pgf@nil{% - \tikz@add@after@node@path{% +\long\def\tikz@@parse@pin[#1]#2:#3:\pgf@nil{% + \tikzset{append after command={% \bgroup [current point is local=true] \pgfextra{\let\tikz@save@last@node=\tikzlastnode}% - node [every pin,tikz@label@angle=#2,#1,at=(\tikzlastnode.\tikz@label@angle),% - after node path={(\tikz@save@last@node) edge[every pin edge,tikz@pre@pin@edge,tikz@pin@options] (\tikzlastnode)}, - tikz@pin@post] + node [every pin,tikz@label@angle=#2,#1,% + append after command={(\tikz@save@last@node) edge[every pin edge,tikz@pre@pin@edge,tikz@pin@options] (\tikzlastnode)}, + tikz@label@post=\tikz@pin@distance,tikz@pin@post] {#3} \egroup% - } + }} } % Label and pin options -\tikzoption{label}{\pgfutil@ifnextchar[{\tikz@parse@label}{\tikz@parse@label[]}#1\pgf@nil} -\tikzoption{label distance}{\def\tikz@label@distance{#1}} - -\tikzoption{tikz@label@angle}{\def\tikz@label@angle{#1}\csname tikz@label@angle@is@#1\endcsname} - -\tikzoption{tikz@label@post}[]{\tikz@compute@direction{\tikz@label@angle}{\tikz@label@distance}} - -\def\tikz@label@distance{0pt} +\tikzset{ + label/.code={\pgfutil@ifnextchar[{\tikz@parse@label}{\tikz@parse@label[]}#1:\pgf@nil},%} + label distance/.store in=\tikz@label@distance, + label distance=0pt, + label position/.store in=\tikz@label@default@pos, + label position=above, + absolute/.is if=tikz@absolute, + tikz@label@angle/.store in=\tikz@label@angle +} + +\newif\iftikz@absolute +\def\tikz@on@text{center} + +\tikzset{tikz@label@post/.code 2 args={ + \edef\tikz@label@angle{\tikz@label@angle}% + \csname tikz@label@angle@is@\tikz@label@angle\endcsname + \ifx\tikz@label@angle\tikz@on@text% + \def\tikz@node@at{\pgfpointanchor{\tikzlastnode}{center}}% + \def\tikz@anchor{center}% + \else% + \iftikz@absolute% + \pgftransformreset% + \pgf@process{% + \pgfpointshapeborder{\tikzlastnode}% + {\pgfpointadd{\pgfpointanchor{\tikzlastnode}{center}}{\pgfpointpolar{\tikz@label@angle}{1pt}}}}% + \edef\tikz@node@at{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \tikz@compute@direction{\tikz@label@angle}% + \tikz@addtransform{\pgftransformshift{\pgfpointpolar{\tikz@label@angle}{#1}}}% + \else% + \pgf@process{\pgfpointanchor{\tikzlastnode}{\tikz@label@angle}}% + \edef\tikz@node@at{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@process{\pgfpointanchor{\tikzlastnode}{center}}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \tikz@label@simplefalse% + \iftikz@fullytransformed% + \tikz@label@simpletrue% + \else + \ifdim\pgf@xc=\pgf@xb\relax% + \ifdim\pgf@yc=\pgf@yb\relax% + \tikz@label@simpletrue% + \fi% + \fi% + \fi% + \iftikz@label@simple% + \tikz@compute@direction{\tikz@label@angle}% + \tikz@addtransform{\pgftransformshift{\pgfpointpolar{\tikz@label@angle}{#1}}}% + \else% + \pgf@process{\pgfpointnormalised{% + \pgfpointdiff{\pgfpointtransformed{\pgfqpoint{\pgf@xc}{\pgf@yc}}}{\pgfpointtransformed{\pgfqpoint{\pgf@xb}{\pgf@yb}}}}}% + \edef\pgf@marshal{% + \noexpand\tikz@addtransform{\noexpand\pgftransformshift{\noexpand\pgfpointscale{#1}{ + \noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}}}% + \pgf@marshal% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgf@x=\pgf@yc% + \pgf@y=-\pgf@xc% + \tikz@auto@anchor% + \fi% + \fi% + \fi} +} + +\newif\iftikz@label@simple% \def\tikz@parse@label[#1]#2:#3\pgf@nil{% - \tikz@add@after@node@path{ + \def\tikz@temp{#3}% + \ifx\tikz@temp\pgfutil@empty% + % no position, use default + \tikz@@parse@label[#1]\tikz@label@default@pos:#2:\pgf@nil% + \else% + \tikz@@parse@label[#1]#2:#3\pgf@nil% + \fi% +} + +\def\tikz@@parse@label[#1]#2:#3:\pgf@nil{% + \tikzset{append after command={ \bgroup + [current point is local=true] \pgfextra{\let\tikz@save@last@fig@name=\tikz@last@fig@name}% node [every label,% tikz@label@angle=#2,% #1,% - at=(\tikzlastnode.\tikz@label@angle),tikz@label@post]% + tikz@label@post=\tikz@label@distance]% {#3}% \pgfextra{\global\let\tikz@last@fig@name=\tikz@save@last@fig@name}% \egroup% - } + }} } \expandafter\def\csname tikz@label@angle@is@right\endcsname{\def\tikz@label@angle{0}} @@ -476,9 +618,9 @@ \expandafter\def\csname tikz@label@angle@is@below\endcsname{\def\tikz@label@angle{270}} \expandafter\def\csname tikz@label@angle@is@below right\endcsname{\def\tikz@label@angle{315}} -\def\tikz@compute@direction#1#2{% +\def\tikz@compute@direction#1{% \let\tikz@do@auto@anchor=\relax - \c@pgf@counta=#1\relax% + \pgfmathsetcount{\c@pgf@counta}{#1}% \ifnum\c@pgf@counta<0\relax \advance\c@pgf@counta by 360\relax% \fi% @@ -504,11 +646,9 @@ \else% \def\tikz@anchor{west}% \fi\fi\fi\fi\fi\fi\fi\fi% - \tikz@addtransform{\pgftransformshift{\pgfpointpolar{#1}{#2}}}% } - % General node options \tikzoption{name}{\edef\tikz@fig@name{#1}} @@ -521,14 +661,9 @@ \tikzset{alias/.code={\tikz@fig@mustbenamed\expandafter\def\expandafter\tikz@alias\expandafter{\tikz@alias\pgfnodealias{#1}{\tikz@fig@name}}}} -\tikzoption{after node path}{\tikz@add@after@node@path{#1}}% -\def\tikz@add@after@node@path#1{\expandafter\def\expandafter\tikz@after@node\expandafter{\tikz@after@node#1}} - -\def\tikzaddafternodepathoption#1{% - #1% - \expandafter\def\expandafter\tikz@afternodepathoptions\expandafter{\tikz@afternodepathoptions#1}} - -\let\tikz@afternodepathoptions=\pgfutil@empty +% deprecated: +\def\tikzaddafternodepathoption#1{#1\tikzset{prefix after command={\pgfextra{#1}}}} +\tikzset{after node path/.style={append after command={#1}}} \tikzoption{anchor}{\def\tikz@anchor{#1}\let\tikz@do@auto@anchor=\relax} @@ -623,8 +758,6 @@ \fi% } -\def\tikz@time{.5} - \def\tikz@install@auto@anchor@{\let\tikz@do@auto@anchor=\tikz@auto@anchor@on} \def\tikz@install@auto@anchor@false{\let\tikz@do@auto@anchor=\relax} \def\tikz@install@auto@anchor@left{\let\tikz@do@auto@anchor=\tikz@auto@anchor@on\def\tikz@auto@anchor@direction{left}} @@ -647,15 +780,15 @@ \tikzoption{text height}{\def\tikz@text@height{#1}} \tikzoption{text depth}{\def\tikz@text@depth{#1}} \tikzoption{text ragged}[]% -{\def\tikz@text@action{\raggedright\rightskip\z@ plus2em \spaceskip.3333em \xspaceskip.5em\relax}} +{\def\tikz@text@action{\raggedright\rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax}} \tikzoption{text badly ragged}[]{\def\tikz@text@action{\raggedright\relax}} \tikzoption{text ragged left}[]% -{\def\tikz@text@action{\raggedleft\leftskip\z@ plus2em \spaceskip.3333em \xspaceskip.5em\relax}} +{\def\tikz@text@action{\raggedleft\leftskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax}} \tikzoption{text badly ragged left}[]{\def\tikz@text@action{\raggedleft\relax}} -\tikzoption{text justified}[]{\def\tikz@text@action{\leftskip\z@\rightskip\z@\relax}} +\tikzoption{text justified}[]{\def\tikz@text@action{\leftskip0pt\rightskip0pt\relax}} \tikzoption{text centered}[]{\def\tikz@text@action{% - \leftskip\z@ plus2em% - \rightskip\z@ plus2em% + \leftskip0pt plus2em% + \rightskip0pt plus2em% \spaceskip.3333em \xspaceskip.5em% \parfillskip=0pt% \let\\=\@centercr% for latex @@ -674,9 +807,25 @@ \let\tikz@textfont=\pgfutil@empty \let\tikz@textopacity=\pgfutil@empty -\def\tikz@text@action{\raggedright\rightskip\z@ plus2em \spaceskip.3333em \xspaceskip.5em\relax} +\def\tikz@text@action{\raggedright\rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax} +% Alignment +\tikzset{ + node halign header/.initial=, + align/.is choice, + align/left/.style ={text ragged,node halign header=\tikz@align@left@header}, + align/flush left/.style ={text badly ragged,node halign header=\tikz@align@left@header}, + align/right/.style ={text ragged left,node halign header=\tikz@align@right@header}, + align/flush right/.style ={text badly ragged left,node halign header=\tikz@align@right@header}, + align/center/.style={text centered,node halign header=\tikz@align@center@header}, + align/flush center/.style={text badly centered,node halign header=\tikz@align@center@header}, + align/justify/.style ={text justified,node halign header=\tikz@align@left@header}, + align/none/.style ={text justified,node halign header=} +} +\def\tikz@align@left@header{##\hfil\cr} +\def\tikz@align@right@header{\hfil##\cr} +\def\tikz@align@center@header{\hfil##\hfil\cr} @@ -708,8 +857,8 @@ \pgfutil@namedef{tikz@special@arrow@end>|}{tikz@>|@#2}% \pgfutil@namedef{tikz@special@arrow@start<<}{tikzs@<<@#2}% \pgfutil@namedef{tikz@special@arrow@end>>}{tikze@>>@#2}%<< - \pgfutil@namedef{tikz@special@arrow@start>>}{tikzs@<<@#2}%<< - \pgfutil@namedef{tikz@special@arrow@end<<}{tikze@>>@#2}%<< + \pgfutil@namedef{tikz@special@arrow@start>>}{tikzs@>>@#2}%<< + \pgfutil@namedef{tikz@special@arrow@end<<}{tikze@<<@#2}%<< } \def\tikz@processarrows#1{% @@ -749,7 +898,7 @@ \def\tikz@set@parabola@bend#1{\def\tikz@parabola@bend{#1}} % Axis options -\tikzoption{domain}{\def\tikz@plot@domain{#1}\expandafter\tikz@plot@samples@recalc\tikz@plot@domain\relax} +\tikzoption{domain}{\edef\tikz@plot@domain{#1}\expandafter\tikz@plot@samples@recalc\tikz@plot@domain\relax} \tikzoption{range}{\def\tikz@plot@range{#1}} % Plot options @@ -762,6 +911,15 @@ \tikzoption{xcomb}[]{\let\tikz@plot@handler=\pgfplothandlerxcomb} \tikzoption{ycomb}[]{\let\tikz@plot@handler=\pgfplothandlerycomb} \tikzoption{polar comb}[]{\let\tikz@plot@handler=\pgfplothandlerpolarcomb} +\tikzoption{ybar}[]{\let\tikz@plot@handler=\pgfplothandlerybar} +\tikzoption{ybar interval}[]{\let\tikz@plot@handler=\pgfplothandlerybarinterval} +\tikzoption{xbar interval}[]{\let\tikz@plot@handler=\pgfplothandlerxbarinterval} +\tikzoption{xbar}[]{\let\tikz@plot@handler=\pgfplothandlerxbar} +\tikzoption{const plot}[]{\let\tikz@plot@handler=\pgfplothandlerconstantlineto} +\tikzoption{const plot mark left}[]{\let\tikz@plot@handler=\pgfplothandlerconstantlineto} +\tikzoption{const plot mark right}[]{\let\tikz@plot@handler=\pgfplothandlerconstantlinetomarkright} +\tikzoption{jump mark right}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkright} +\tikzoption{jump mark left}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkleft} \tikzoption{raw gnuplot}[true]{\csname tikz@plot@raw@gnuplot#1\endcsname} \tikzoption{prefix}{\def\tikz@plot@prefix{#1}} @@ -775,8 +933,20 @@ \tikzoption{only marks}[]{\let\tikz@plot@handler\pgfplothandlerdiscard} -\tikzoption{mark}{\def\tikz@plot@mark{#1}} -\tikzoption{mark options}{\def\tikz@plot@mark@options{#1}} +\tikzoption{mark}{% + \def\tikz@plot@mark{#1}% + \def\tikz@temp{none}% + \ifx\tikz@temp\tikz@plot@mark + \let\tikz@plot@mark=\pgfutil@empty + \fi +} +\tikzset{ + no marks/.style={mark=none},% + no markers/.style={mark=none},% + every mark/.style={}, + mark options/.style={% + every mark/.style={#1}% + }} \tikzoption{mark size}{\pgfsetplotmarksize{#1}} \tikzoption{mark indices}{\def\tikz@mark@list{#1}} @@ -785,21 +955,19 @@ \let\tikz@mark@list=\pgfutil@empty -\let\tikz@plot@mark@options=\pgfutil@empty - \let\tikz@plot@handler=\pgfplothandlerlineto \let\tikz@plot@mark=\pgfutil@empty \def\tikz@plot@samples{25} \def\tikz@plot@domain{-5:5} \def\tikz@plot@var{\x} -\def\tikz@plot@samplesat{-5,-4.6,...,5} +\def\tikz@plot@samplesat{-5,-4.5833333,...,5} \def\tikz@plot@samples@recalc#1:#2\relax{% \pgfmathparse{#1}% \let\tikz@temp@start=\pgfmathresult% \pgfmathparse{#2}% \let\tikz@temp@end=\pgfmathresult% - \pgfmathparse{\tikz@temp@start+(\tikz@temp@end-\tikz@temp@start)/\tikz@plot@samples}% + \pgfmathparse{\tikz@temp@start+(\tikz@temp@end-\tikz@temp@start)/(\tikz@plot@samples-1)}% \edef\tikz@plot@samplesat{\tikz@temp@start,\pgfmathresult,...,\tikz@temp@end}% } @@ -817,6 +985,19 @@ \def\tikz@to@path{-- (\tikztotarget) \tikztonodes} +% After command options +\tikzset{ + append after command/.code=\expandafter\def\expandafter\tikz@after@path\expandafter{\tikz@after@path#1}, + prefix after command/.code={% + \def\tikz@temp{#1}% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\tikz@after@path% + \expandafter\expandafter\expandafter{% + \expandafter\tikz@temp\tikz@after@path}% + } +} +\let\tikz@after@path\pgfutil@empty + % Tree options \newif\iftikz@child@missing @@ -831,6 +1012,9 @@ \tikzoption{sibling distance}{\pgfmathsetlength\tikzsiblingdistance{#1}} \tikzoption{growth function}{\let\tikz@grow=#1} + +\tikzset{grow siblings on line/.style={growth function=\tikz@grow@direction}} + \tikzoption{growth parent anchor}{\def\tikz@growth@anchor{#1}} \tikzoption{grow}{\tikz@set@growth{#1}\edef\tikz@special@level{\the\tikztreelevel}}% \tikzoption{grow'}{\tikz@set@growth{#1}\tikz@swap@growth\edef\tikz@special@level{\the\tikztreelevel}}% @@ -1026,6 +1210,13 @@ \tikzstyle{dashed}= [dash pattern=on 3pt off 3pt] \tikzstyle{densely dashed}= [dash pattern=on 3pt off 2pt] \tikzstyle{loosely dashed}= [dash pattern=on 3pt off 6pt] +\tikzstyle{dashdotted}= [dash pattern=on 3pt off 2pt on \the\pgflinewidth off 2pt] +\tikzstyle{densely dashdotted}= [dash pattern=on 3pt off 1pt on \the\pgflinewidth off 1pt] +\tikzstyle{loosely dashdotted}= [dash pattern=on 3pt off 4pt on \the\pgflinewidth off 4pt] +\tikzstyle{dashdotdotted}= [dash pattern=on 3pt off 2pt on \the\pgflinewidth off 2pt on \the\pgflinewidth off 2pt] +\tikzstyle{densely dashdotdotted}= [dash pattern=on 3pt off 1pt on \the\pgflinewidth off 1pt on \the\pgflinewidth off 1pt] +\tikzstyle{loosely dashdotdotted}= [dash pattern=on 3pt off 4pt on \the\pgflinewidth off 4pt on \the\pgflinewidth off 4pt] + \tikzstyle{transparent}= [opacity=0] \tikzstyle{ultra nearly transparent}=[opacity=0.05] @@ -1105,6 +1296,7 @@ \let\tikz@atbegin@picture=\pgfutil@empty% \let\tikz@atend@picture=\pgfutil@empty% \let\tikz@transform=\relax% + \def\tikz@time{.5}% \tikz@installcommands\scope[every picture,#1]% \expandafter\tikz@atbegin@picture% \tikz@lib@scope@check% @@ -1112,9 +1304,13 @@ \def\endtikzpicture{% \tikz@atend@picture% \global\let\pgf@shift@baseline=\pgf@baseline% + \global\let\pgf@trimleft@final=\pgf@trimleft% + \global\let\pgf@trimright@final=\pgf@trimright% \global\let\pgf@remember@smuggle=\ifpgfrememberpicturepositiononpage% \endscope% \let\pgf@baseline=\pgf@shift@baseline% + \let\pgf@trimleft=\pgf@trimleft@final% + \let\pgf@trimright=\pgf@trimright@final% \let\ifpgfrememberpicturepositiononpage=\pgf@remember@smuggle% \endpgfpicture} @@ -1131,6 +1327,16 @@ % The rectangle \tikz{\draw (0,0) rectangle (1em,1ex)} has width 1em and % height 1ex. +% This code does not work for some inline \tikz. For example +% \tikz\foreach \x in {1,...,10} \draw (\x,0) circle (0.4cm); +% makes tikz crash. +% Begin suspected code +% \def\tikz{\pgfutil@ifnextchar[{\tikz@opt}{\tikz@opt[]}} +% \def\tikz@opt[#1]{\tikzpicture[#1]\pgfutil@ifnextchar\bgroup{\tikz@}{\tikz@@}} +% \def\tikz@{\bgroup\tikz@auto@end@pathtrue\aftergroup\endtikzpicture\let\pgf@temp=} +% \def\tikz@@{\begingroup\def\tikz@path@do@at@end{\endgroup\endtikzpicture}} +% End suspected code +% Begin old code \def\tikz{\pgfutil@ifnextchar[{\tikz@opt}{\tikz@opt[]}} \def\tikz@opt[#1]{\tikzpicture[#1]\pgfutil@ifnextchar\bgroup{\tikz@}{\tikz@@}} \def\tikz@#1{#1\endtikzpicture} @@ -1145,8 +1351,14 @@ \catcode`\;=\active \gdef\tikz@collectactivesemicolon#1;{#1;\endtikzpicture} } +% End old code - +% Invokes '#1' if the command is invoked withing a tikzpicture and +% '#2' if not. +\def\tikzifinpicture#1#2{% + \pgfutil@ifundefined{filldraw}{#2}{#1}% TT: This is a wrong + % test! Who uses this?... +}% % % Environment for scoping graphic state settings @@ -1174,6 +1386,28 @@ \tikz@lib@scope@check% } +% Install a shortcut command which is only valid inside of a +% tikzpicture. +% +% It works in the same way as the '\path' shortcut does: it introduces +% a \let#1=#2 at the beginning of tikzpicture. +% +% #1: shortcut command inside of tikzpicture +% #2: real command name +\def\tikzaddtikzonlycommandshortcutlet#1#2{% + \expandafter\def\expandafter\tikz@installcommands\expandafter{\tikz@installcommands + \let#1=#2 + }% +}% + +% Has the same effect as \tikzaddtikzonlycommandshortcutlet but uses +% \def#1{#2} instead of \let. +\def\tikzaddtikzonlycommandshortcutdef#1#2{% + \expandafter\def\expandafter\tikz@installcommands\expandafter{\tikz@installcommands + \def#1{#2}% + }% +}% + % % Install the abbreviated commands % @@ -1199,6 +1433,8 @@ \let\tikz@origcoordinate=\coordinate% \let\tikz@origmatrix=\matrix% \let\tikz@origcalendar=\calendar% + \let\tikz@origdv=\datavisualization% + \let\tikz@origgraph=\graph% % \tikz@deactivatthings% % @@ -1216,14 +1452,19 @@ \def\shade{\path[shade]} \def\shadedraw{\path[shade,draw]} \def\clip{\path[clip]} + \def\graph{\path graph} \def\useasboundingbox{\path[use as bounding box]} \def\node{\tikz@path@overlay{node}} \def\coordinate{\tikz@path@overlay{coordinate}} \def\matrix{\tikz@path@overlay{node[matrix]}} - \def\calendar{\tikz@lib@cal@calendar}% + \def\calendar{\tikz@lib@cal@calendar}% + \def\datavisualization{\tikz@lib@datavisualization}% } \ifx\tikz@lib@cal@calendar\@undefined -\def\tikz@lib@cal@calendar{\PackageError{tikz}{You need to load the calendar library}{}} +\def\tikz@lib@cal@calendar{\PackageError{tikz}{You need to say \string\usetikzlibrary{calendar} to use the \string\calendar{} command}{}} +\fi +\ifx\tikz@lib@datavisualization\@undefined +\def\tikz@lib@datavisualization{\PackageError{tikz}{You need to say \string\usetikzlibrary{datavisualization} to use the \string\datavisualization{} command}{}} \fi \def\tikz@path@overlay#1{% @@ -1253,6 +1494,8 @@ \let\coordinate=\tikz@origcoordinate% \let\matrix=\tikz@origmatrix% \let\calendar=\tikz@origcalendar% + \let\datavisualization=\tikz@origdv% + \let\graph=\tikz@origgraph% } @@ -1263,18 +1506,23 @@ \gdef\tikz@nonactivecolon{:} \catcode`\|=12 \gdef\tikz@nonactivebar{|} + \catcode`\!=12 + \gdef\tikz@nonactiveexlmark{!} \catcode`\;=\active \catcode`\:=\active \catcode`\|=\active \catcode`\"=\active + \catcode`\!=\active \gdef\tikz@activesemicolon{;}% \gdef\tikz@activecolon{:}% \gdef\tikz@activebar{|}% \gdef\tikz@activequotes{"}% + \gdef\tikz@activeexlmark{!}% \gdef\tikz@deactivatthings{% - \def;{\tikz@nonactivesemicolon} - \def:{\tikz@nonactivecolon} - \def|{\tikz@nonactivebar} + \def;{\tikz@nonactivesemicolon}% + \def:{\tikz@nonactivecolon}% + \def|{\tikz@nonactivebar}% + \def!{\tikz@nonactiveexlmark}% } } @@ -1300,15 +1548,16 @@ \let\tikz@next=\tikz@eargactivesemicolon% \fi% \tikz@next} -\long\def\tikz@eargnormalsemicolon<#1>#2;{\only<#1>{\tikz@@command@path#2;}} +\long\def\tikz@eargnormalsemicolon<#1>#2;{\alt<#1>{\tikz@@command@path#2;}{\tikz@path@do@at@end}} { \catcode`\;=\active - \long\global\def\tikz@eargactivesemicolon<#1>#2;{\only<#1>{\tikz@@command@path#2;}} + \long\global\def\tikz@eargactivesemicolon<#1>#2;{\alt<#1>{\tikz@@command@path#2;}{\tikz@path@do@at@end}} } \def\tikz@@command@path{% \edef\tikzscope@linewidth{\the\pgflinewidth}% \begingroup% + \let\tikz@path@do@at@end=\tikz@lib@scope@check% \let\tikz@options=\pgfutil@empty% \let\tikz@mode=\pgfutil@empty% \let\tikz@moveto@waiting=\relax% @@ -1319,7 +1568,7 @@ \tikz@snakedfalse% \tikz@decoratepathfalse% \tikz@node@is@a@labelfalse% - \tikz@expandcount=1000\relax% + \tikz@expandcount=100\relax% \tikz@lastx=0pt% \tikz@lasty=0pt% \tikz@lastxsaved=0pt% @@ -1396,10 +1645,10 @@ \let\@next=\tikz@e@char% \else% \ifx\@let@token g% - \let\@next=\tikz@grid% + \let\@next=\tikz@g@char% \else% \ifx\@let@token s% - \let\@next=\tikz@sine% + \let\@next=\tikz@schar% \else% \ifx\@let@token |% \let\@next=\tikz@vh@lineto% @@ -1427,7 +1676,7 @@ \let\@next=\tikz@decoration% \else% \ifx\@let@token l% - \let\@next=\tikz@let@command% + \let\@next=\tikz@l@char%\tikz@let@command% \else% \let\@next=\tikz@expand% \fi% @@ -1446,6 +1695,24 @@ \@next% } +\def\tikz@l@char{% + \pgfutil@ifnextchar e{\tikz@let@command}{% + \pgfutil@ifnextchar i{\tikz@lsystem}{% + \pgfutil@ifnextchar-{\tikz@@lsystem}{\tikz@expand}% + }% + }% +} + +\def\tikz@lsystem{% + \PackageError{tikz}{You need to say \string\usetikzlibrary{lindenmayersystems} to + draw Lindenmayer systems}{} +} + +\def\tikz@@lsystem{% + \PackageError{tikz}{You need to say \string\usetikzlibrary{lindenmayersystems} to + draw L-systems}{} +} + \def\tikz@pchar{\pgfutil@ifnextchar l{\tikz@plot}{\tikz@parabola}} \def\tikz@cchar{% \pgfutil@ifnextchar i{\tikz@circle}% @@ -1457,6 +1724,18 @@ \def\tikz@@e@char dge{% \pgfutil@ifnextchar f{\tikz@edgetoparent}{\tikz@edge@plain}}% +\def\tikz@schar{\pgfutil@ifnextchar i{\tikz@sine}{\tikz@svg@path}} + +\def\tikz@g@char r{\pgfutil@ifnextchar i{\tikz@grid}{\tikz@graph}} + +% svg syntax +% svg[options] "..." + +\def\tikz@svg@path{% + \PackageError{tikz}{You need to say \string\usetikzlibrary{svg.path} to + use the svg path command}{} +} + \def\tikz@finish{% % Rendering pipeline @@ -1480,6 +1759,7 @@ % % Reset modes % + \let\tikz@path@picture=\pgfutil@empty% \tikz@mode@fillfalse% \tikz@mode@drawfalse% \tikz@mode@doublefalse% @@ -1525,7 +1805,7 @@ \tikz@options% \fi% % - % Step 4: Do a fill if shade follows. + % Step 4: Do a fill if shade or a path picture follows. % \iftikz@mode@fill% \iftikz@mode@shade% @@ -1535,6 +1815,16 @@ \pgfsyssoftpath@invokecurrentpath% \pgfsys@fill% \tikz@mode@fillfalse% no more filling... + \else% + \ifx\tikz@path@picture\pgfutil@empty% + \else% + \pgfsyssoftpath@getcurrentpath\tikz@temppath + \pgfprocessround{\tikz@temppath}{\tikz@temppath}% change the path + \pgfsyssoftpath@setcurrentpath\tikz@temppath% + \pgfsyssoftpath@invokecurrentpath% + \pgfsys@fill% + \tikz@mode@fillfalse% no more filling... + \fi% \fi% \fi% % @@ -1548,6 +1838,34 @@ \tikz@mode@shadefalse% no more shading... \fi% % + % Step 5a: Do a path picture if necessary. + % + \ifx\tikz@path@picture\pgfutil@empty% + \else% + \begingroup% + \pgfsys@beginscope% + \pgfsyssoftpath@getcurrentpath\tikz@temppath + \pgfprocessround{\tikz@temppath}{\tikz@temppath}% change the path + \pgfsyssoftpath@setcurrentpath\tikz@temppath% + \pgfsyssoftpath@invokecurrentpath% + \pgfsys@clipnext% + \pgfsys@discardpath% + \pgf@relevantforpicturesizefalse% + \expandafter\def\csname pgf@sh@ns@path picture bounding box\endcsname{rectangle} + \expandafter\edef\csname pgf@sh@np@path picture bounding box\endcsname{% + \def\noexpand\southwest{\noexpand\pgfqpoint{\the\pgf@pathminx}{\the\pgf@pathminy}}% + \def\noexpand\northeast{\noexpand\pgfqpoint{\the\pgf@pathmaxx}{\the\pgf@pathmaxy}}% + } + \expandafter\def\csname pgf@sh@nt@path picture bounding box\endcsname{{1}{0}{0}{1}{0pt}{0pt}} + \expandafter\def\csname pgf@sh@pi@path picture bounding box\endcsname{\pgfpictureid} + \pgfinterruptpath% + \tikz@path@picture% + \endpgfinterruptpath% + \pgfsys@endscope% + \endgroup% + \let\tikz@path@picture=\pgfutil@empty% + \fi% + % % Step 6: Double stroke, if necessary % \iftikz@mode@draw% @@ -1555,10 +1873,7 @@ % Change line width \begingroup% \pgfsys@beginscope% - \pgf@x=2\pgflinewidth% - \advance\pgf@x by\tikz@double@width@distance% - \pgflinewidth=\pgf@x% - \pgfsetlinewidth{\the\pgflinewidth}% + \tikz@double@setup% \fi% \fi% % @@ -1576,16 +1891,7 @@ % \iftikz@mode@draw% \iftikz@mode@double% - \pgfsyssoftpath@setcurrentpath\pgf@last@used@path% reinstall - \pgf@x=\tikz@double@width@distance% - \pgfsetlinewidth{\the\pgf@x}% - \pgfsetstrokecolor{\tikz@double@color}% - \pgfsyssoftpath@flushcurrentpath% - \pgfsys@stroke% \pgfsys@endscope% - \ifpgf@drawarrows% set in pgfusepath... - \pgf@add@arrows@as@needed% - \fi% \endgroup% \fi% \fi% @@ -1617,16 +1923,17 @@ \fi% \endgroup% \global\pgflinewidth=\tikzscope@linewidth% - \tikz@lib@scope@check% + \tikz@path@do@at@end% } \let\tikz@lib@scope@check\pgfutil@empty% this is a hook for the scopes library +\def\tikz@path@do@at@end{\tikz@lib@scope@check} % Extra actions \def\tikz@extra@preaction#1{% {% \pgfsys@beginscope% - \setbox\tikz@figbox=\box\voidb@x% + \setbox\tikz@figbox=\box\pgfutil@voidb@x% \path[#1];% do extra path \pgfsyssoftpath@setcurrentpath\tikz@actions@path% restore \tikz@restorepathsize% @@ -1637,7 +1944,7 @@ \def\tikz@extra@postaction#1{% {% \pgfsys@beginscope% - \setbox\tikz@figbox=\box\voidb@x% + \setbox\tikz@figbox=\box\pgfutil@voidb@x% \tikz@restorepathsize% \path[#1]\pgfextra{\pgfsyssoftpath@setcurrentpath\tikz@actions@path};% do extra path \pgf@resetpathsizes% @@ -1666,22 +1973,36 @@ % Syntax for scopes: % {scoped path commands} -\def\tikz@beginscope{\begingroup\tikz@scan@next@command} +\newif\iftikz@auto@end@path + +\def\tikz@beginscope{\begingroup\tikz@auto@end@pathfalse\tikz@scan@next@command} \def\tikz@endscope{% + \iftikz@auto@end@path\expandafter\tikz@finish\expandafter\egroup\else\expandafter\tikz@@endscope\fi% +} +\def\tikz@@endscope{% \global\setbox\tikz@tempbox=\box\tikz@figbox% - \xdef\tikz@scope@save@lastx{\the\tikz@lastx}% - \xdef\tikz@scope@save@lasty{\the\tikz@lasty}% - \iftikz@current@point@local% - \endgroup% - \else% - \xdef\tikz@scope@save@lastxsaved{\the\tikz@lastxsaved}% - \xdef\tikz@scope@save@lastysaved{\the\tikz@lastysaved}% - \endgroup% - \tikz@lastxsaved=\tikz@scope@save@lastxsaved% - \tikz@lastysaved=\tikz@scope@save@lastysaved% - \fi% - \tikz@lastx=\tikz@scope@save@lastx% - \tikz@lasty=\tikz@scope@save@lasty% + \edef\tikz@marshal{% + \tikz@lastx=\the\tikz@lastx% + \tikz@lasty=\the\tikz@lasty% + \iftikz@current@point@local% + \else% + \tikz@lastxsaved=\the\tikz@lastxsaved% + \tikz@lastysaved=\the\tikz@lastysaved% + \ifx\tikz@moveto@waiting\relax% + \let\tikz@moveto@waiting\relax% + \else% + \def\noexpand\tikz@moveto@waiting{\tikz@moveto@waiting}% + \fi% + \iftikz@shapeborder% + \noexpand\tikz@shapebordertrue% + \def\noexpand\tikz@shapeborder@name{\tikz@shapeborder@name}% + \else% + \noexpand\tikz@shapeborderfalse% + \fi% + \fi% + }% + \expandafter% + \endgroup\tikz@marshal% \setbox\tikz@figbox=\box\tikz@tempbox% \tikz@scan@next@command} @@ -1705,7 +2026,12 @@ % \draw (0,0) \foreach \x in {1,2,3} {-- (\x,0) circle (1cm)} -- (5,5); \def\tikz@foreach{% - \def\pgffor@beginhook{\setbox\tikz@figbox=\box\tikz@tempbox\expandafter\tikz@scan@next@command\pgfutil@firstofone}% + \def\pgffor@beginhook{% + \tikz@lastx=\tikz@foreach@save@lastx% + \tikz@lasty=\tikz@foreach@save@lasty% + \tikz@lastxsaved=\tikz@foreach@save@lastxsaved% + \tikz@lastysaved=\tikz@foreach@save@lastysaved% + \setbox\tikz@figbox=\box\tikz@tempbox\expandafter\tikz@scan@next@command\pgfutil@firstofone}% \def\pgffor@endhook{\pgfextra{% \xdef\tikz@foreach@save@lastx{\the\tikz@lastx}% \xdef\tikz@foreach@save@lasty{\the\tikz@lasty}% @@ -1719,6 +2045,10 @@ \tikz@lastysaved=\tikz@foreach@save@lastysaved% \setbox\tikz@figbox=\box\tikz@tempbox\tikz@scan@next@command}% \global\setbox\tikz@tempbox=\copy\tikz@figbox% + \xdef\tikz@foreach@save@lastx{\the\tikz@lastx}% + \xdef\tikz@foreach@save@lasty{\the\tikz@lasty}% + \xdef\tikz@foreach@save@lastxsaved{\the\tikz@lastxsaved}% + \xdef\tikz@foreach@save@lastysaved{\the\tikz@lastysaved}% \foreach} @@ -1987,17 +2317,15 @@ % [options] \def\tikz@parse@options#1]{% \tikzset{#1}% - \tikz@lib@dec@hook% for decorations... \tikz@scan@next@command% } -\let\tikz@lib@dec@hook=\relax % Syntax for edges: % edge [options] (coordinate) % edge [options] node {node text} (coordinate) \def\tikz@edge@plain{% \begingroup% - \tikz@to@use@whom% + \ifx\tikz@to@use@whom\pgfutil@undefined\else\tikz@to@use@whom\fi \let\tikz@to@or@edge@function=\tikz@do@edge% \tikz@to@or@edge} @@ -2016,11 +2344,12 @@ \tikz@@to@collect% } \def\tikz@@to@collect{% - \pgfutil@ifnextchar(\tikz@@to@or@edge@coordinate + \pgfutil@ifnextchar(\tikz@@to@or@edge@coordinate%) {\pgfutil@ifnextchar n{\tikz@collect@label@onpath\tikz@@to@collect}% - {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@@to@collect} - {\PackageError{tikz}{( expected}{}%} - \tikz@@to@or@edge@coordinate()}}}% + {\pgfutil@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@@to@collect}% + {\pgfutil@ifnextchar +{\tikz@scan@one@point\tikz@@to@or@edge@math}% + {\PackageError{tikz}{(, +, coordinate, or node expected}{}%) + \tikz@@to@or@edge@coordinate()}}}}% } \def\tikz@@to@or@edge@coordinate({% @@ -2061,8 +2390,10 @@ \tikz@options% \tikz@transform% % Typeset node: + \let\tikz@after@path\pgfutil@empty% \tikz@atbegin@to% - \path[style=every edge]\tikz@@to@local@options(\tikztostart)\tikz@to@path;% + \path[style=every edge]\tikz@@to@local@options(\tikztostart)\tikz@to@path + \pgfextra{\global\let\tikz@after@path@smuggle=\tikz@after@path};% \tikz@atend@to% \endpgfscope% \endpgfinterruptpath% @@ -2072,7 +2403,7 @@ \global\setbox\tikz@tempbox=\copy\tikz@figbox% \endgroup% \setbox\tikz@figbox=\box\tikz@tempbox% - \tikz@scan@next@command% + \expandafter\tikz@scan@next@command\tikz@after@path% } \def\tikz@do@to{% @@ -2080,9 +2411,14 @@ \def\tikztonodes{{\pgfextra{\tikz@node@is@a@labeltrue}\tikz@tonodes}}% \let\tikz@collected@onpath=\pgfutil@empty% \tikz@scan@next@command% - \pgfextra{\tikz@atbegin@to}% - [style=every to]\tikz@@to@local@options\tikz@to@path% - \pgfextra{\tikz@atend@to}% + {% + \pgfextra{\let\tikz@after@path\pgfutil@empty}% + \pgfextra{\tikz@atbegin@to}% + [style=every to]\tikz@@to@local@options\tikz@to@path% + \pgfextra{\tikz@atend@to}% + \pgf@stop% + \expandafter\tikz@scan@next@command\expandafter% + }\tikz@after@path% } @@ -2099,6 +2435,26 @@ +% Syntax for graph path command: +% graph {...} +% See the graph library for details + +\def\tikz@graph aph{\tikz@lib@graph@parser} + +\def\tikz@lib@graph@parser{\pgfutil@ifnextchar[\tikz@graph@error{\tikz@graph@error[]}}%] +\def\tikz@graph@error[#1]#2{% + \PackageError{tikz}{You need to say \string\usetikzlibrary{graph} in + order to use the graph syntax}{}% + \tikz@lib@graph@parser@done% +} + +\def\tikz@lib@graph@parser@done{% + \tikz@scan@next@command% +} + + + + % Syntax for edge from parent: % edge from parent [options] \def\tikz@edgetoparent from parent{\pgfutil@ifnextchar[\tikz@@edgetoparent{\tikz@@edgetoparent[]}}%} @@ -2236,7 +2592,7 @@ % Syntax for grids: % grid -\def\tikz@grid rid{% +\def\tikz@grid id{% \tikz@flush@moveto% \pgf@xa=\tikz@lastx\relax% \pgf@ya=\tikz@lasty\relax% @@ -2247,6 +2603,7 @@ \def\tikz@gridB#1{% \tikz@make@last@position{#1}% {% + \let\tikz@after@path\pgfutil@empty% \expandafter\tikzset\expandafter{\tikz@grid@options} \tikz@checkunit{\tikz@grid@x}% \iftikz@isdimension% @@ -2266,8 +2623,8 @@ \advance\pgf@yb by\pgf@y% \pgfpathgrid[stepx=\pgf@xb,stepy=\pgf@yb]% {\pgfqpoint{\pgf@xa}{\pgf@ya}}{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}% - } - \tikz@scan@next@command% + \expandafter}% + \expandafter\tikz@scan@next@command\tikz@after@path% } @@ -2280,6 +2637,7 @@ \pgfutil@ifnextchar[{\tikz@@plot}{\tikz@@plot[]}}%} \def\tikz@@plot[#1]{% \begingroup% + \let\tikz@after@path\pgfutil@empty% \let\tikz@options=\pgfutil@empty% \tikzset{every plot/.try}% \tikzset{#1}% @@ -2349,7 +2707,7 @@ \pgfscope% \let\tikz@options=\pgfutil@empty% \let\tikz@transform=\pgfutil@empty% - \expandafter\tikzset\expandafter{\tikz@plot@mark@options}% + \tikzset{every mark}% \tikz@options% \ifx\tikz@mark@list\pgfutil@empty% \pgfplothandlermark{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}}% @@ -2363,17 +2721,18 @@ }% \fi% \global\setbox\tikz@tempbox=\copy\tikz@figbox% + \global\let\tikz@after@path@smuggle=\tikz@after@path \endgroup% \setbox\tikz@figbox=\box\tikz@tempbox% \tikz@make@last@position{\tikz@@@temp}% - \tikz@scan@next@command% + \expandafter\tikz@scan@next@command\tikz@after@path@smuggle% } \pgfdeclareplotmark{ball} {% \def\tikz@shading{ball}% - \shade (0,0) circle (\pgfplotmarksize);% + \shade (0pt,0pt) circle (\pgfplotmarksize);% } @@ -2439,6 +2798,7 @@ \pgf@xc=\tikz@lastx% \pgf@yc=\tikz@lasty% \begingroup% now calculate bend: + \let\tikz@after@path\pgfutil@empty% \expandafter\tikzset\expandafter{\tikz@parabola@option}% \tikz@lastxsaved=\tikz@parabola@bend@factor\tikz@lastx% \tikz@lastysaved=\tikz@parabola@bend@factor\tikz@lasty% @@ -2454,51 +2814,73 @@ \advance\tikz@lastx by-\pgf@xb% \advance\tikz@lasty by-\pgf@yb% \xdef\tikz@parabola@b{{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}}% - \endgroup% - \expandafter\pgfpathparabola\tikz@parabola@b% - \tikz@scan@next@command% + \expandafter\endgroup% + \expandafter\expandafter\expandafter\pgfpathparabola\expandafter\tikz@parabola@b% + \expandafter\tikz@scan@next@command\tikz@after@path% } % Syntax for circles: -% circle (radius) +% circle [options] % where options should set, at least, radius +% circle (radius) % deprecated % % Syntax for ellipses: -% ellipse (x-radius and y-radius) +% ellipse [options] % identical to circle. +% ellipse (x-radius and y-radius) % deprecated % % radii can be dimensionless, then they are in the xy-system \def\tikz@circle ircle{\tikz@flush@moveto\tikz@@circle} \def\tikz@ellipse llipse{\tikz@flush@moveto\tikz@@circle} \def\tikz@@circle{% - \pgfutil@ifnextchar(\tikz@@@circle{%) - \advance\tikz@expandcount by -1% + \pgfutil@ifnextchar(\tikz@@@circle + {\pgfutil@ifnextchar[\tikz@circle@opt{%]) + \advance\tikz@expandcount by -10\relax% go down quickly \ifnum\tikz@expandcount<0\relax% - \let\@next=\tikz@@circle@scangiveup% + \let\@next=\tikz@@circle@normal% \else% \let\@next=\tikz@@circle@scanexpand% \fi% \@next% - }% + }}% } \def\tikz@@circle@scanexpand{\expandafter\tikz@@circle} -\def\tikz@@circle@scangiveup#1{\PackageError{tikz}{Cannot parse this radius}{}#1{\tikz@scan@next@command}} +\def\tikz@@circle@normal{\tikz@circle@opt[]} + +\def\tikz@circle@opt[#1]{% + {% + \def\tikz@node@at{\tikz@last@position}% + \let\tikz@transform=\pgfutil@empty% + \tikzset{every circle/.try,#1}% + \pgftransformshift{\tikz@node@at}% + \tikz@transform% + \tikz@do@circle{\pgfkeysvalueof{/tikz/x radius}}{\pgfkeysvalueof{/tikz/y radius}} + }% + \tikz@scan@next@command% +} + \def\tikz@@@circle(#1){% - \pgfutil@in@{ and }{#1}% - \ifpgfutil@in@% - \tikz@@ellipseB(#1)% - \else% - \tikz@@ellipseB({#1} and {#1})% - \fi% + {% + \pgftransformshift{\tikz@last@position}% + \pgfutil@in@{ and }{#1}% + \ifpgfutil@in@% + \tikz@@ellipseB(#1)% + \else% + \tikz@do@circle{#1}{#1}% + \fi% + }% \tikz@scan@next@command% } \def\tikz@@ellipseB(#1 and #2){% + \tikz@do@circle{#1}{#2} +} +\def\tikz@do@circle#1#2{ \pgfmathparse{#1}% \let\tikz@ellipse@x=\pgfmathresult% \ifpgfmathunitsdeclared% \pgfmathparse{#2}% \let\tikz@ellipse@y=\pgfmathresult% \ifpgfmathunitsdeclared% - \pgfpathellipse{\tikz@last@position}{% + \pgfpathellipse{\pgfpointorigin}{% \pgfqpoint{\tikz@ellipse@x pt}{0pt}}{\pgfpoint{0pt}{\tikz@ellipse@y pt}}% \else% \PackageError{tikz}{You cannot mix dimensions and dimensionless values in an ellipse}{}% @@ -2509,7 +2891,7 @@ \ifpgfmathunitsdeclared% \PackageError{tikz}{You cannot mix dimensions and dimensionless values in an ellipse}{}% \else% - \pgfpathellipse{\tikz@last@position}{% + \pgfpathellipse{\pgfpointorigin}{% \pgfpointxy{\tikz@ellipse@x}{0}}{\pgfpointxy{0}{\tikz@ellipse@y}}% \fi% \fi% @@ -2522,13 +2904,50 @@ % arc (start angle:end angle:x-radius and y-radius) % % radius can be dimensionless, then the arc is in the xy-coordinate system -\def\tikz@arcA rc{% - \tikz@flush@moveto% - \pgfutil@ifnextchar({\tikz@@arcto}{\expandafter\tikz@arcA\expandafter r\expandafter c}} +\def\tikz@arcA rc{\tikz@flush@moveto\tikz@arc@cont}% +\def\tikz@arc@cont{% + \pgfutil@ifnextchar(%) + {\tikz@@arcto}{% + \pgfutil@ifnextchar[%] + {\tikz@arc@opt}% + {% + \advance\tikz@expandcount by -10\relax% go down quickly + \ifnum\tikz@expandcount<0\relax% + \let\@next=\tikz@@arc@normal% + \else% + \let\@next=\tikz@@arc@scanexpand% + \fi% + \@next% + }% + }% +} +\def\tikz@@arc@scanexpand{\expandafter\tikz@arc@cont} +\def\tikz@@arc@normal{\tikz@arc@opt[]} + + +\def\tikz@arc@opt[#1]{% + {% + \tikzset{every arc/.try,#1}% + \pgfkeysgetvalue{/tikz/start angle}\tikz@s + \pgfkeysgetvalue{/tikz/end angle}\tikz@e + \pgfkeysgetvalue{/tikz/delta angle}\tikz@d + \ifx\tikz@s\pgfutil@empty% + \pgfmathsetmacro\tikz@s{\tikz@e-\tikz@d} + \else + \ifx\tikz@e\pgfutil@empty% + \pgfmathsetmacro\tikz@e{\tikz@s+\tikz@d} + \fi% + \fi + \tikz@do@arc{\tikz@s}{\tikz@e} + {\pgfkeysvalueof{/tikz/x radius}} + {\pgfkeysvalueof{/tikz/y radius}} + }% + \tikz@arcfinal% +} \def\tikz@@arcto(#1){% \edef\tikz@temp{(#1)}% - \expandafter\tikz@@@arcto@check@slashand\tikz@temp% + \expandafter\tikz@@@arcto@check@slashand\tikz@temp% } \def\tikz@@@arcto@check@slashand(#1:#2:#3){% @@ -2538,9 +2957,13 @@ \else% \tikz@parse@arc@and(#1:#2:{#3} and {#3})% \fi% + \tikz@arcfinal% } \def\tikz@parse@arc@and(#1:#2:#3 and #4){% + \tikz@do@arc{#1}{#2}{#3}{#4}% +} +\def\tikz@do@arc#1#2#3#4{% \pgfmathparse{#3}% \let\tikz@arc@x=\pgfmathresult% \ifpgfmathunitsdeclared% @@ -2567,10 +2990,17 @@ \def\tikz@@@arcfinal#1#2#3{% #1% - \pgf@process{#2}% + \pgf@process{#2} + \xdef\tikz@arc@save@first{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \pgf@process{#3} + \xdef\tikz@arc@save@second{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% +} + +\def\tikz@arcfinal{% + \pgf@process{\tikz@arc@save@first}% \advance\tikz@lastx by-\pgf@x% \advance\tikz@lasty by-\pgf@y% - \pgf@process{#3}% + \pgf@process{\tikz@arc@save@second}% \advance\tikz@lastx by\pgf@x% \advance\tikz@lasty by\pgf@y% \tikz@lastxsaved=\tikz@lastx% @@ -2590,7 +3020,11 @@ \def\tikz@@coordinate[#1](#2){% \pgfutil@ifnextchar a{\tikz@@coordinate@at[#1](#2)} {\tikz@fig ode[shape=coordinate,#1](#2){}}} -\def\tikz@@coordinate@at[#1](#2)at#3({% +\def\tikz@@coordinate@at[#1](#2)a{% + \pgfutil@ifnextchar t{\tikz@@coordinate@@at[#1](#2)a}% + {\tikz@fig ode[shape=coordinate,#1](#2){}a}% +} +\def\tikz@@coordinate@@at[#1](#2)at#3({% \def\tikz@coordinate@caller{\tikz@fig ode[shape=coordinate,#1](#2)at}% \tikz@scan@one@point\tikz@@coordinate@at@math(% } @@ -2617,9 +3051,9 @@ \begingroup% \tikz@is@matrixfalse% \let\nodepart=\tikz@nodepart% + \let\tikz@do@after@node=\tikz@scan@next@command% \let\tikz@options=\pgfutil@empty% - \let\tikz@after@node=\pgfutil@empty% - \let\tikz@afternodepathoptions=\pgfutil@empty% + \let\tikz@after@path=\pgfutil@empty% \let\tikz@transform=\pgfutil@empty% \let\tikz@mode=\pgfutil@empty% \tikz@decoratepathfalse% @@ -2645,8 +3079,11 @@ \tikz@scan@one@point\tikz@@fig@scan@at} \def\tikz@@fig@scan@at#1{% \def\tikz@node@at{#1}\tikz@@scan@fig}% -\def\tikz@fig@scan@name(#1){\edef\tikz@fig@name{#1}\tikz@@scan@fig}% -\def\tikz@fig@scan@options[#1]{\tikzset{#1}\tikz@@scan@fig}% +\def\tikz@fig@scan@name(#1){% + \pgfkeysvalueof{/tikz/name/.@cmd}#1\pgfeov% CF : this is now ALWAYS consistent with 'name=' option; allows overrides. + \tikz@@scan@fig}% +% make it \long to allow \par in "pin" options etc: +\long\def\tikz@fig@scan@options[#1]{\tikzset{#1}\tikz@@scan@fig}% \let\tikz@node@reset@hook=\pgfutil@empty% \let\tikz@node@begin@hook=\pgfutil@empty% \def\tikz@fig@main{\afterassignment\tikz@@fig@main\let\next=} @@ -2679,7 +3116,8 @@ \ifx\tikz@text@width\pgfutil@empty% \else% \begingroup% - \pgfutil@minipage[t]{\tikz@text@width}% + \pgfmathsetlength{\pgf@x}{\tikz@text@width}% + \pgfutil@minipage[t]{\pgf@x}\leavevmode\hbox{}% \tikz@text@action% \fi% \tikz@atbegin@node% @@ -2690,9 +3128,10 @@ \pgfutil@colorlet{.}{\tikz@textcolor}% \fi% \pgfsetcolor{.}% - \setbox\tikz@figbox=\box\voidb@x% + \setbox\tikz@figbox=\box\pgfutil@voidb@x% \tikz@uninstallcommands% \aftergroup\tikz@fig@collectresetcolor% + \tikz@halign@check% \ignorespaces% } \def\tikz@fig@collectresetcolor{% @@ -2713,7 +3152,7 @@ {\pgfutil@ifnextchar[{\tikz@fig@mustbenamed\tikz@fig@continue}% {\pgfutil@ifnextchar t{\tikz@fig@mustbenamed\tikz@fig@continue} {\pgfutil@ifnextchar e{\tikz@fig@mustbenamed\tikz@fig@continue} - {\ifx\tikz@after@node\pgfutil@empty\expandafter\tikz@fig@continue\else\expandafter\tikz@fig@mustbenamed\expandafter\tikz@fig@continue\fi}}}}}%} + {\ifx\tikz@after@path\pgfutil@empty\expandafter\tikz@fig@continue\else\expandafter\tikz@fig@mustbenamed\expandafter\tikz@fig@continue\fi}}}}}%} \def\tikz@do@matrix{% \tikzset{every matrix/.try}% @@ -2726,7 +3165,7 @@ \pgfinterruptpath% \pgfscope% \tikz@options% - \setbox\tikz@figbox=\box\voidb@x% + \setbox\tikz@figbox=\box\pgfutil@voidb@x% \let\tikzmatrixname=\tikz@fig@name% \edef\tikz@m@anchor{\ifx\tikz@matrix@anchor\pgfutil@empty\tikz@anchor\else\tikz@matrix@anchor\fi}% \expandafter\pgfutil@in@\expandafter{\expandafter.\expandafter}\expandafter{\tikz@m@anchor}% @@ -2840,7 +3279,7 @@ \pgfinterruptpath% \pgfscope% \tikz@options% - \setbox\tikz@figbox=\box\voidb@x% + \setbox\tikz@figbox=\box\pgfutil@voidb@x% \pgfmultipartnode{\tikz@shape}{\tikz@anchor}{\tikz@fig@name}{% \pgfutil@tempdima=\pgflinewidth% {\begingroup\tikz@finish}% @@ -2884,8 +3323,7 @@ \def\tikz@node@finish{% \global\let\tikz@last@fig@name=\tikz@fig@name% - \global\let\tikz@after@node@smuggle=\tikz@after@node% - \global\let\tikz@afternodepathoptions@smuggle=\tikz@afternodepathoptions% + \global\let\tikz@after@path@smuggle=\tikz@after@path% % shift box outside group \global\setbox\tikz@tempbox=\copy\tikz@figbox% \endgroup\endgroup% @@ -2894,23 +3332,83 @@ \let\tikz@to@last@fig@name=\tikz@last@fig@name% \let\tikz@to@use@whom=\tikz@to@use@last@fig@name% \let\tikzlastnode=\tikz@last@fig@name% - \ifx\tikz@after@node@smuggle\pgfutil@empty% + \ifx\tikz@after@path@smuggle\pgfutil@empty% \else% - \tikz@scan@next@command{\pgfextra{\tikz@afternodepathoptions@smuggle}\tikz@after@node@smuggle}\pgf@stop% + \tikz@scan@next@command{\tikz@after@path@smuggle}\pgf@stop% \fi% - \tikz@scan@next@command% + \tikz@do@after@node% } \let\tikz@fig@continue@orig=\tikz@fig@continue +\def\tikz@do@after@node{\tikz@scan@next@command} + +\newif\iftikz@do@align + +% Alignment handling +\def\tikz@halign@check{% + \tikz@do@alignfalse + \ifx\tikz@text@width\pgfutil@empty% + \pgfkeysgetvalue{/tikz/node halign header}\tikz@align@header% + \ifx\tikz@align@header\pgfutil@empty% + \else% + \tikz@do@aligntrue% + \fi% + \fi% + \iftikz@do@align% + % Bingo + \setbox\tikz@align@aligned@box=\box\pgfutil@voidb@x% void + \let\\=\tikz@align@newline% + \expandafter\tikz@start@align% + \fi% +} +\def\tikz@align@newline{\unskip\pgfutil@ifnextchar[\tikz@@align@newline{\tikz@@align@newline[0pt]}}%} +\def\tikz@@align@newline[#1]{\egroup\tikz@align@continue\pgfmathparse{#1}\let\tikz@align@temp=\pgfmathresult\tikz@start@align}% +% Two safe boxes for alignment: +\let\tikz@align@aligned@box=\pgfnodeparttextbox +\let\tikz@align@line@box=\tikz@figbox + +\def\tikz@start@align{% + % Start collecting text: + \setbox\tikz@align@line@box=\hbox\bgroup\bgroup% + \aftergroup\tikz@align@collectresetcolor\ignorespaces% +} +\def\tikz@align@collectresetcolor{% + \pgfutil@ifnextchar\reset@color% + {\reset@color\afterassignment\tikz@align@collectresetcolor\let\tikz@temp=}% + {\tikz@align@end@check}% +} +\def\tikz@align@end@check{% + \egroup% + \ifvoid\tikz@align@aligned@box% + \setbox\tikz@align@aligned@box=\box\tikz@align@line@box% + \else% + \setbox\tikz@align@aligned@box=\vbox{% + \expandafter\expandafter\expandafter\halign\expandafter\expandafter\expandafter{\tikz@align@header% + \box\tikz@align@aligned@box\cr% + \noalign{\vskip\tikz@align@temp pt}% + \unhbox\tikz@align@line@box\unskip\cr}}% + \fi% + \pgfutil@ifnextchar\tikz@align@continue{} + {% + % Main continue + \box\tikz@align@aligned@box% + \egroup% + }% +} +\def\tikz@align@continue{\tikz@@align@continue} +\let\tikz@@align@continue=\pgfutil@empty + % Syntax for parts of nodes: -% node ... {... \nodepart{name} ... \nodepart{name} ...} +% node ... {... \nodepart[options]{name} ... \nodepart{name} ...} -\def\tikz@nodepart#1{% +\def\tikz@nodepart{\pgfutil@ifnextchar[\tikz@@nodepart{\tikz@@nodepart[]}}%} +\def\tikz@@nodepart[#1]#2{% \tikz@atend@node% \unskip% - \gdef\tikz@nodepart@name{#1}% + \gdef\tikz@nodepart@options{#1}% + \gdef\tikz@nodepart@name{#2}% \global\let\tikz@fig@continue=\tikz@nodepart@continue% \pgfutil@ifnextchar x{\egroup\relax}{\egroup\relax}% gobble spaces } @@ -2920,12 +3418,14 @@ \expandafter\setbox\csname pgfnodepart\tikz@nodepart@name box\endcsname=\hbox% \bgroup% \tikzset{every \tikz@nodepart@name\space node part/.try}% + \expandafter\tikzset\expandafter{\tikz@nodepart@options}% \pgfinterruptpicture% \tikz@textfont% \ifx\tikz@text@width\pgfutil@empty% \else% \begingroup% - \pgfutil@minipage[t]{\tikz@text@width}% + \pgfmathsetlength{\pgf@x}{\tikz@text@width}% + \pgfutil@minipage[t]{\pgf@x}\leavevmode\hbox{}% \tikz@text@action% \fi% \bgroup% @@ -2935,10 +3435,11 @@ \pgfutil@colorlet{.}{\tikz@textcolor}% \fi% \pgfsetcolor{.}% - \setbox\tikz@figbox=\box\voidb@x% + \setbox\tikz@figbox=\box\pgfutil@voidb@x% \tikz@uninstallcommands% \tikz@atbegin@node% \aftergroup\tikz@fig@collectresetcolor% + \tikz@halign@check% \ignorespaces% } @@ -2956,7 +3457,7 @@ \fi% \tikz@is@matrixfalse% \let\tikz@options=\pgfutil@empty% - \let\tikz@after@node=\pgfutil@empty% + \let\tikz@after@path=\pgfutil@empty% \let\tikz@afternodepathoptions=\pgfutil@empty% \let\tikz@alias=\pgfutil@empty% \let\tikz@transform=\pgfutil@empty% @@ -2970,15 +3471,14 @@ \tikz@node@begin@hook% \tikz@alias% \global\let\tikz@last@fig@name=\tikz@fig@name% - \global\let\tikz@after@node@smuggle=\tikz@after@node% - \global\let\tikz@afternodepathoptions@smuggle=\tikz@afternodepathoptions% + \global\let\tikz@after@path@smuggle=\tikz@after@path% \endgroup% \let\tikz@to@last@fig@name=\tikz@last@fig@name% \let\tikz@to@use@whom=\tikz@to@use@last@fig@name% \let\tikzlastnode=\tikz@last@fig@name% - \ifx\tikz@after@node@smuggle\pgfutil@empty% + \ifx\tikz@after@path@smuggle\pgfutil@empty% \else% - \tikz@scan@next@command{\pgfextra{\tikz@afternodepathoptions@smuggle}\tikz@after@node@smuggle}\pgf@stop% + \tikz@scan@next@command{\tikz@after@path@smuggle}\pgf@stop% \fi% } @@ -3500,8 +4000,6 @@ - - % % Coordinate management % @@ -3689,6 +4187,10 @@ \expandafter\def\csname tikz@polar@dir@south west\endcsname{-135} +% MW: +% Check to see if the y-coordinate is inside {}. If it is, scan it and +% reinsert it into the stream inside an extra group. +% % MW: % Check to see if the y-coordinate is inside {}. If it is, scan it and % reinsert it into the stream inside an extra group. @@ -3696,9 +4198,11 @@ \def\tikz@parse@regular#1(#2,{% \pgfutil@ifnextchar\bgroup{\tikz@@parse@regular#1{#2}}{\tikz@@@parse@regular#1{#2}}% } -\def\tikz@@parse@regular#1#2#3{\tikz@@@parse@regular#1{#2}{{#3}}}% - - +\def\tikz@@parse@regular#1#2#3{% + \pgfutil@ifnextchar[{% Uh oh! An array index. + \tikz@@@parse@regular#1{#2}{#3}}% + {\tikz@@@parse@regular#1{#2}{{#3}}}} + % Originally \def\tikz@parse@regular#1(#2,#3){% % \def\tikz@@@parse@regular#1#2#3){% @@ -3859,7 +4363,6 @@ } - % Loading further libraries % Include a library file. @@ -3885,16 +4388,20 @@ \def\use@@tikzlibrary#1{% \edef\pgf@list{#1}% \pgfutil@for\pgf@temp:=\pgf@list\do{% - \expandafter\ifx\csname tikz@library@\pgf@temp @loaded\endcsname\relax% - \expandafter\global\expandafter\let\csname tikz@library@\pgf@temp @loaded\endcsname=\pgfutil@empty% - \expandafter\edef\csname tikz@library@#1@atcode\endcsname{\the\catcode`\@} - \expandafter\edef\csname tikz@library@#1@barcode\endcsname{\the\catcode`\|} - \catcode`\@=11 - \catcode`\|=12 - \input tikzlibrary\pgf@temp.code.tex - \catcode`\@=\csname tikz@library@#1@atcode\endcsname - \catcode`\|=\csname tikz@library@#1@barcode\endcsname - \fi% + \expandafter\pgfkeys@spdef\expandafter\pgf@temp\expandafter{\pgf@temp}% + \ifx\pgf@temp\pgfutil@empty + \else + \expandafter\ifx\csname tikz@library@\pgf@temp @loaded\endcsname\relax% + \expandafter\global\expandafter\let\csname tikz@library@\pgf@temp @loaded\endcsname=\pgfutil@empty% + \expandafter\edef\csname tikz@library@#1@atcode\endcsname{\the\catcode`\@} + \expandafter\edef\csname tikz@library@#1@barcode\endcsname{\the\catcode`\|} + \catcode`\@=11 + \catcode`\|=12 + \input tikzlibrary\pgf@temp.code.tex + \catcode`\@=\csname tikz@library@#1@atcode\endcsname + \catcode`\|=\csname tikz@library@#1@barcode\endcsname + \fi% + \fi }% } -- cgit v1.2.3