summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-10-29 00:31:31 +0000
committerKarl Berry <karl@freefriends.org>2010-10-29 00:31:31 +0000
commit6bc1f5497cfb2f56d65c80a4c36ea3bad6dc046c (patch)
treef7751da75030fb1e06653eeb44e579fcee09c65f /Master/texmf-dist/tex/generic/pgf
parented0c7c756e441b2d2ba3633da233fc24361ac0d3 (diff)
pgf 2.10 (28oct10)
git-svn-id: svn://tug.org/texlive/trunk@20236 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf')
-rw-r--r--Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex5
-rw-r--r--Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex88
-rw-r--r--Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex501
-rw-r--r--Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex41
-rw-r--r--Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex197
-rw-r--r--Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex20
-rw-r--r--Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex699
-rw-r--r--Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex10
-rw-r--r--Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex16
-rw-r--r--Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex158
-rw-r--r--Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex42
-rw-r--r--Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex4
-rw-r--r--Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex165
-rw-r--r--Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex20
-rw-r--r--Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex32
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgpgf.cfg2
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgpgf.xmt48
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgtest.cfg3
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgtest.tex15
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgtest.xml30
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.code.tex265
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.ee.IEC.code.tex376
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.ee.code.tex158
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.CDH.code.tex29
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.IEC.code.tex76
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.US.code.tex65
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.code.tex46
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.3d.code.tex80
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.barcharts.code.tex43
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.code.tex2278
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.formats.functions.code.tex16
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.polar.code.tex62
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.sparklines.code.tex38
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.basic.code.tex29
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.code.tex877
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzexternalshared.code.tex1394
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryautomata.code.tex3
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarybackgrounds.code.tex8
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalc.code.tex4
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarychains.code.tex4
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.code.tex4
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.pathreplacing.code.tex23
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfadings.code.tex9
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfit.code.tex56
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfixedpointarithmetic.code.tex10
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfpu.code.tex10
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryintersections.code.tex156
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarylindenmayersystems.code.tex81
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarymatrix.code.tex18
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarymindmap.code.tex139
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypetri.code.tex8
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypositioning.code.tex7
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryscopes.code.tex22
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshadings.code.tex21
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryspy.code.tex122
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarysvg.path.code.tex31
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytopaths.code.tex7
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytrees.code.tex8
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryturtle.code.tex84
-rw-r--r--Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex935
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.barcharts.code.tex135
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.formats.functions.code.tex197
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.polar.code.tex192
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.footprints.code.tex (renamed from Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.footprints.code.tex)0
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.fractals.code.tex (renamed from Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.fractals.code.tex)0
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.markings.code.tex187
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.pathmorphing.code.tex (renamed from Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.pathmorphing.code.tex)0
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.pathreplacing.code.tex (renamed from Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.pathreplacing.code.tex)52
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.shapes.code.tex (renamed from Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.shapes.code.tex)0
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.text.code.tex347
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.code.tex91
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.markings.code.tex114
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.text.code.tex233
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfixedpointarithmetic.code.tex637
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfpu.code.tex1965
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryintersections.code.tex767
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarylindenmayersystems.code.tex223
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarypatterns.code.tex7
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex512
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.code.tex243
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryprofiler.code.tex515
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshadings.code.tex409
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.multipart.code.tex1097
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysvg.path.code.tex681
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.IEC.code.tex680
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.code.tex176
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.IEC.code.tex (renamed from Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.gates.logic.IEC.code.tex)83
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.US.code.tex (renamed from Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.gates.logic.US.code.tex)664
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.code.tex98
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.arrows.code.tex (renamed from Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.arrows.code.tex)2
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.callouts.code.tex (renamed from Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.callouts.code.tex)2
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.code.tex (renamed from Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.code.tex)2
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.geometric.code.tex (renamed from Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.geometric.code.tex)6
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.misc.code.tex (renamed from Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.misc.code.tex)804
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.multipart.code.tex1354
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.symbols.code.tex (renamed from Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.symbols.code.tex)312
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex9
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex343
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex2376
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex (renamed from Master/texmf-dist/tex/generic/pgf/math/pgfmathbase.code.tex)155
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex713
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex240
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex179
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex320
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex (renamed from Master/texmf-dist/tex/generic/pgf/math/pgfmathrnd.code.tex)45
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex112
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex (renamed from Master/texmf-dist/tex/generic/pgf/math/pgfmathtrig.code.tex)131
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathoperations.code.tex1488
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex1532
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex35
-rw-r--r--Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledatavisualization.code.tex3035
-rw-r--r--Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledecorations.code.tex334
-rw-r--r--Master/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.code.tex8
-rw-r--r--Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleoo.code.tex451
-rw-r--r--Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleparser.code.tex111
-rw-r--r--Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex85
-rw-r--r--Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.code.tex236
-rw-r--r--Master/texmf-dist/tex/generic/pgf/modules/pgfmodulesorting.code.tex69
-rw-r--r--Master/texmf-dist/tex/generic/pgf/rendering/pgfrenderpoints.code.tex138
-rw-r--r--Master/texmf-dist/tex/generic/pgf/rendering/pgfrendertransform.code.tex117
-rw-r--r--Master/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg21
-rw-r--r--Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf-via-dvi.def152
-rw-r--r--Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def13
-rw-r--r--Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-postscript.def14
-rw-r--r--Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def6
-rw-r--r--Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def3
-rw-r--r--Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfmx.def396
-rw-r--r--Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def4
-rw-r--r--Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def104
-rw-r--r--Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def309
-rw-r--r--Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-xetex.def14
-rw-r--r--Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex31
-rw-r--r--Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex4
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfexternalwithdepth.tex43
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex583
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex405
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex1016
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex8
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex339
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def131
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def37
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def72
142 files changed, 32353 insertions, 6099 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex
index b76772cc4ac..8a7ab4a2862 100644
--- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcore.code.tex,v 1.6 2008/01/15 10:27:34 tantau Exp $
+\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcore.code.tex,v 1.7 2010/04/11 07:09:19 ludewich Exp $
\newif\ifpgf@draftmode
@@ -29,4 +29,7 @@
\input pgfcoretransparency.code.tex
\input pgfcorepatterns.code.tex
+\pgfutil@ifundefined{pgf@texdist@protect}{%
+ \def\pgf@texdist@protect{}%
+}{}
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex
index bdf4906c1be..19e73e0b44e 100644
--- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorearrows.code.tex,v 1.8 2007/06/07 07:41:10 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorearrows.code.tex,v 1.11 2008/04/23 14:59:01 tantau Exp $
% Sets the end arrow
@@ -89,7 +89,7 @@
% Called when an arrow needs to be rendered
\def\pgf@arrow@call#1{%
- \expandafter\ifx\csname pgf@arrow@prot@#1@\the\pgflinewidth\endcsname\relax%
+ \expandafter\ifx\csname\pgf@arrow@full@name{#1}\endcsname\relax%
\pgfsysprotocol@getcurrentprotocol\pgf@arrow@temp%
{%
\pgfinterruptpath%
@@ -105,13 +105,15 @@
\global\let\pgf@@arrow@temp=\pgf@@arrow@temp%
\endpgfinterruptpath%
\expandafter\def\expandafter\pgf@temp\expandafter{\expandafter\pgfsys@invoke\expandafter{\pgf@@arrow@temp}}%
- \expandafter\global\expandafter\let\csname pgf@arrow@prot@#1@\the\pgflinewidth\endcsname=\pgf@temp%
+ \expandafter\global\expandafter\let\csname\pgf@arrow@full@name{#1}\endcsname=\pgf@temp%
}%
\pgfsysprotocol@setcurrentprotocol\pgf@arrow@temp%
\fi%
- \csname pgf@arrow@prot@#1@\the\pgflinewidth\endcsname%
+ \csname\pgf@arrow@full@name{#1}\endcsname%
}
+\def\pgf@arrow@full@name#1{pgf@arrow@prot@#1@\the\pgflinewidth @\pgfinnerlinewidth @\pgfgetarrowoptions{#1}}
+
\def\pgf@arrow@code@{} % dummy
\def\pgf@nousepath@here#1{%
@@ -119,6 +121,41 @@
}
+% Get options for an arrow
+%
+% #1 = arrow tip name
+%
+% Description:
+%
+% For every arrow tip certain options can be set, which may influence
+% the appearance of the arrow tip. How the options are used is up the
+% arrow tip code. This command will expand to the current value of
+% the options for this tip. The default is 0.
+
+\def\pgfgetarrowoptions#1{%
+ \expandafter\ifx\csname pgf@arrow@opt@#1\endcsname\relax0\else\csname pgf@arrow@opt@#1\endcsname\fi%
+}
+
+
+% Set options for an arrow
+%
+% #1 = arrow tip name
+% #2 = options
+%
+% Description:
+%
+% Sets the arrow tip options for an arrow. The options should be a
+% normal string and will be used to detect whether an arrow should be
+% recached. For instance, when you set the arrow tip options of
+% "myarrow" to "1", the arrow will be rendered in a certain way. Then,
+% when you set the options to "2", the arrow will be rerendered.
+
+\def\pgfsetarrowoptions#1#2{%
+ \expandafter\def\csname pgf@arrow@opt@#1\endcsname{#2}%
+}
+
+
+
% Define an arrow type.
%
@@ -374,13 +411,21 @@
\pgfarrowsdeclare{stealth}{stealth}
{
\pgfutil@tempdima=0.28pt%
- \advance\pgfutil@tempdima by.3\pgflinewidth%
+ \pgfutil@tempdimb=\pgflinewidth%
+ \ifdim\pgfinnerlinewidth>0pt%
+ \pgfmathsetlength\pgfutil@tempdimb{.6\pgflinewidth-.4*\pgfinnerlinewidth}%
+ \fi%
+ \advance\pgfutil@tempdima by.3\pgfutil@tempdimb%
\pgfarrowsleftextend{+-3\pgfutil@tempdima}
\pgfarrowsrightextend{+5\pgfutil@tempdima}
}
{
\pgfutil@tempdima=0.28pt%
- \advance\pgfutil@tempdima by.3\pgflinewidth%
+ \pgfutil@tempdimb=\pgflinewidth%
+ \ifdim\pgfinnerlinewidth>0pt%
+ \pgfmathsetlength\pgfutil@tempdimb{.6\pgflinewidth-.4*\pgfinnerlinewidth}%
+ \fi%
+ \advance\pgfutil@tempdima by.3\pgfutil@tempdimb%
\pgfpathmoveto{\pgfqpoint{5\pgfutil@tempdima}{0pt}}
\pgfpathlineto{\pgfqpoint{-3\pgfutil@tempdima}{4\pgfutil@tempdima}}
\pgfpathlineto{\pgfpointorigin}
@@ -464,13 +509,21 @@
\pgfarrowsdeclare{latex}{latex}
{
\pgfutil@tempdima=0.28pt%
- \advance\pgfutil@tempdima by.3\pgflinewidth%
+ \pgfutil@tempdimb=\pgflinewidth%
+ \ifdim\pgfinnerlinewidth>0pt%
+ \pgfmathsetlength\pgfutil@tempdimb{.6\pgflinewidth-.4*\pgfinnerlinewidth}%
+ \fi%
+ \advance\pgfutil@tempdima by.3\pgfutil@tempdimb%
\pgfarrowsleftextend{+-1\pgfutil@tempdima}
\pgfarrowsrightextend{+9\pgfutil@tempdima}
}
{
\pgfutil@tempdima=0.28pt%
- \advance\pgfutil@tempdima by.3\pgflinewidth%
+ \pgfutil@tempdimb=\pgflinewidth%
+ \ifdim\pgfinnerlinewidth>0pt%
+ \pgfmathsetlength\pgfutil@tempdimb{.6\pgflinewidth-.4*\pgfinnerlinewidth}%
+ \fi%
+ \advance\pgfutil@tempdima by.3\pgfutil@tempdimb%
\pgfpathmoveto{\pgfqpoint{9\pgfutil@tempdima}{0pt}}
\pgfpathcurveto
{\pgfqpoint{6.3333\pgfutil@tempdima}{.5\pgfutil@tempdima}}
@@ -509,5 +562,24 @@
}
+% A space arrow
+%
+% This arrow can be combined with other arrows to add "space" around
+% them.
+%
+% Example:
+%
+% \pgfarrowsdeclarecombine{my<}{my>}{<}{>}{space}{space}
+
+\pgfarrowsdeclare{space}{space}
+{
+ \pgfutil@tempdima=0.88pt%
+ \advance\pgfutil@tempdima by.3\pgflinewidth%
+ \pgfarrowsleftextend{0pt}
+ \pgfarrowsrightextend{\pgfutil@tempdima}
+}
+{}
+
+
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex
new file mode 100644
index 00000000000..d8eaca5aee7
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex
@@ -0,0 +1,501 @@
+% Copyright 2006 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 $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreexternal.code.tex,v 1.17 2010/09/01 08:56:40 ludewich Exp $
+
+
+
+\newif\ifpgfexternal@aux@in@dpth
+\newif\ifpgfexternal@info
+
+\pgfkeys{
+ /pgf/images/include external/.code={\pgfimage{#1}},
+ /pgf/images/aux in dpth/.is if=pgfexternal@aux@in@dpth,
+ /pgf/images/aux in dpth/.default=true,
+ /pgf/images/trim external/.code n args={4}{%
+ \def\pgf@external@kern@left{#1}%
+ \def\pgf@external@kern@bottom{#2}%
+ \def\pgf@external@kern@right{#3}%
+ \def\pgf@external@kern@top{#4}%
+ \ifx\pgf@external@kern@left\pgfutil@empty\def\pgf@external@kern@left{0sp}\fi%
+ \ifx\pgf@external@kern@bottom\pgfutil@empty\def\pgf@external@kern@bottom{0sp}\fi%
+ \ifx\pgf@external@kern@right\pgfutil@empty\def\pgf@external@kern@right{0sp}\fi%
+ \ifx\pgf@external@kern@top\pgfutil@empty\def\pgf@external@kern@top{0sp}\fi%
+ },
+ /pgf/images/trim external={1truein}{1truein}{1truein}{1truein},
+ /pgf/images/external info/.is if=pgfexternal@info,
+ /pgf/images/external info/.default=true,
+}
+
+% The external read/write mechanism is used as follows:
+%
+% In your document, you put a number or all of your pgfpicture (or
+% tikzpicture) environments inside a pair of \beginpgfexternal and
+% \endpgfexternal. The \beginpgfexternal gets one parameter called the
+% graphics name.
+%
+% Once this is done, the next step is to declare the names of your
+% graphics in the document at the beginning using the
+% \pgfdeclaregraphicname command.
+%
+% Now, when you typeset your document, each time a \beginpgfexternal
+% command is encountered, it will be checked whether the corresponding
+% graphics file exists. If this is the case, it will be included and
+% the code between \beginpgfexternal and \endpgfexternal is
+% ignored. Otherwise, the code is executed normally.
+%
+% Things change when you run tex on your file with the \jobname set to
+% the name of a decalred graphics name. In this case, only your
+% graphic will be typeset, the rest of the document will be "thrown away".
+% To be more precise, everything is gobbled up to the beginning
+% of the first \beginpgfexternal with the given graphics name. Then,
+% the content of the "environment" is put in a box (this "environment"
+% need not contain a graphics, it may contain anything that can be put
+% in a box). Then a single page is output whose size is exactly the
+% size of the picture.
+%
+% So, once you have run tex repeatedly, each time with the jobname set
+% to each of the graphics, you can then run tex on the whole document
+% and this will cause all graphics to be included rather than begin
+% typeset.
+%
+% Finally, once all the graphics have been created, you can also say
+% \input pgfexternal.tex instead of including pgf/TikZ.
+
+
+\newif\ifpgfexternalreadmainaux
+\pgfexternalreadmainauxtrue
+
+% Tells pgf which jobname is the name of the real file
+%
+% #1 = name
+%
+% Description:
+%
+% This command is used to tell pgf that the file named #1 should be
+% typeset normally. If \jobname is not equal to #1, only
+% the graphic called \jobname will be typeset.
+%
+% Example:
+%
+% \pgfrealjobname{survey}
+%
+% Note that afterwards, \jobname will be set to the argument. In our
+% example, \jobname will be 'survey'. This is to accomplish
+% compatibility with aux-file generation.
+
+\def\pgfrealjobname#1{%
+ \global\let\pgfactualjobname=\jobname
+ \edef\pgf@tempa{\expandafter\string\csname #1\endcsname}%
+ \edef\pgf@tempb{\expandafter\string\csname\jobname\endcsname}%
+ \ifx\pgf@tempa\pgf@tempb%
+ \else%
+ \pgf@external@grabshipouttrue%
+ \pgfexternal@nofiles% see also \pgf@external@init@aux@in@dpth
+ \ifpgfexternalreadmainaux
+ % and reset the jobname. This should allow to handle any
+ % \label/\ref constructions which are stored in \jobname.aux (and
+ % which won't be found otherwise)
+ \gdef\jobname{#1}%
+ \fi
+ \ifpgfexternal@aux@in@dpth
+ \csname newwrite\endcsname\w@pgfexternal@auxout
+ \fi
+ \fi%
+ \gdef\pgfrealjobname##1{}% avoid multiple calls.
+}
+
+\def\pgfexternal@nofiles{%
+ % replace \relax. The \nofiles macros does
+ % \let\makeglossary=\relax
+ % but the glossary.sty calls \renewcommand\makeglossary (which
+ % will fail if \makeglossary=\relax). Stupid, but it works.
+ \let\pgfexternal@nofiles@=\relax
+ \def\relax{\relax}%
+ %
+ % suppress generation of LaTeX .aux, .toc etc files.
+ % generation of these files is not thread-safe.
+ % the \csname \endcsname yields \relax if \nofiles doesn't exist.
+ \csname nofiles\endcsname
+ %
+ \let\relax=\pgfexternal@nofiles@
+}%
+
+\newif\ifpgf@external@grabshipout
+\newbox\pgfexternal@startupbox
+
+\pgfutil@ifundefined{AtBeginDocument}{}{%
+ \AtBeginDocument{%
+ \ifpgf@external@grabshipout%
+ \global\let\pgfexternal@originalshipout=\shipout%
+ \global\def\shipout{\setbox\pgfpic=}%
+ \maxdeadcycles=10000%
+ % Ok, gather everything we have seen up to now in a box. This box
+ % will contain any specials that have been used.
+ {%
+ \output{\global\setbox\pgfexternal@startupbox=\vbox{\csname @begindvi\endcsname\unvbox255}}%
+ \hbox{}\eject%
+ }%
+ \fi%
+ }
+}%
+
+\pgfutil@ifundefined{AtEndDocument}{}{%
+ \AtEndDocument{%
+ \ifpgf@external@grabshipout
+ \pgfutil@ifundefined{pgfexternal@did@a@shipout}{%
+ \pgfexternal@error@no@shipout
+ }{}%
+ \fi
+ }%
+}
+
+% This will be overwritten by the tikz external lib if it is loaded.
+\def\pgfexternal@error@no@shipout{%
+ \PackageError{pgf}{Sorry, image externalization failed: the resulting image was EMPTY. I tried to externalize '\pgfactualjobname'. Perhaps there was a typo somewhere? Please check that your document contains '\string\beginpgfgraphicnamed{\pgfactualjobname} ... \string\endpgfgraphicnamed'}%
+}%
+
+
+% "Environment" for an external graphic.
+%
+% #1 = graphic name
+%
+% Example:
+%
+% \beginpgfgraphicnamed{main-graphic2}
+% \begin{tikzpicture}
+% ...
+% \end{tikzpicture}
+% \endpgfgraphicnamed
+
+\def\pgf@externalbegin#1{%
+ % First, check whether we wish to grab this graphic:
+ \let\pgf@next=\pgf@external@normal%
+ \ifpgf@external@grabshipout%
+ \edef\pgf@tempa{\expandafter\string\csname #1\endcsname}%
+ \edef\pgf@tempb{\expandafter\string\csname\pgfactualjobname\endcsname}%
+ \ifx\pgf@tempa\pgf@tempb%
+ \let\pgf@next=\pgf@external@grab%
+ \fi%
+ \fi%
+ \pgf@next{#1}%
+}
+
+
+\AtBeginDocument{
+ \let\beginpgfgraphicnamed=\pgf@externalbegin% overwrite definition of pgfexternal.tex if necessary
+ \let\endpgfgraphicnamed=\unskip
+}
+
+
+% Normal operation: Include an external graphic instead of the
+% picture, if such an external picture exists.
+\def\pgf@external@normal#1{%
+ \let\pgf@filename=\pgfutil@empty%
+ \expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#1}%
+ \ifx\pgf@filename\pgfutil@empty%
+ % Ok, no such image... Just typeset the picture normally.
+ \let\pgf@next=\relax%
+ \else%
+ \let\pgf@next=\pgf@replacepicturebygraphic%
+ \fi%
+ \pgf@next%
+}
+
+\long\def\pgf@replacepicturebygraphic#1\endpgfgraphicnamed{%
+ \expandafter\pgfincludeexternalgraphics\expandafter{\pgf@filename}\unskip
+}
+
+% This is almost the same as \includegraphics{#1}, but it checks
+% whether '#1.dpth' exists. In such case, it restores the boxes depth
+% stored in #1.dpth.
+%
+% Furthermore, the .dpth file may contain .aux related information
+% collected for the external graphics (references). They start after
+% the first line (if any).
+\def\pgfincludeexternalgraphics#1{%
+ \begingroup
+ \pgfexternalreaddpth{#1}%
+ \pgfkeysifdefined{/pgf/images/include external/#1/.@cmd}{%
+ \pgfkeysgetvalue{/pgf/images/include external/#1/.@cmd}\pgf@tempa
+ \pgfkeyslet{/pgf/images/include external/.@cmd}\pgf@tempa
+ }{}%
+ \setbox1=\hbox{\pgfkeysvalueof{/pgf/images/include external/.@cmd}{#1}\pgfeov}%
+ \ifdim\pgfexternaltrimleft=0sp \else \kern\pgfexternaltrimleft\relax \fi
+ \ifdim\pgfexternaldepth=0pt
+ \box1
+ \else
+ \dimen0=\pgfexternaldepth\relax
+ \hbox{\lower\dimen0 \box1 }%
+ \fi
+ \ifdim\pgfexternaltrimright=0sp \else \kern\pgfexternaltrimright\relax \fi
+ \endgroup
+}
+
+% Defines \pgfexternaldepth to be the depth of the external picture
+% '#1' and \pgfexternaltrimleft / \pgfexternaltrimright to be the 'hbaseline' shift.
+%
+%
+% Furthermore, it handles any auxiliary information stored in the
+% .dpth file (it appends it to the main aux file).
+%
+\def\pgfexternalreaddpth#1{%
+ % no \begingroup. Handle that manually:
+ \edef\pgfexternalreaddpth@restore{%
+ \noexpand\endlinechar=\the\endlinechar\space
+ \noexpand\catcode`\noexpand\@=\the\catcode`\@\space
+ }%
+ %
+ \def\pgfexternaldepth{0sp}%
+ \def\pgfexternaltrimleft{0sp}%
+ \def\pgfexternaltrimright{0sp}%
+ \endlinechar=-1 % suppress white space at end
+ \catcode`\@=11
+ \openin\r@pgf@reada=#1.dpth
+ \pgfincludeexternalgraphics@read@dpth
+ %
+ \pgfexternalreaddpth@restore
+}%
+%
+% The .dpth consists of 0-N lines, where each is either a single
+% dimension (the box' depth) or something which belongs to the .aux
+% file (such lines will always start with a macro).
+\def\pgfincludeexternalgraphics@read@dpth{%
+ \ifeof\r@pgf@reada
+ \closein\r@pgf@reada
+ \else
+ \read\r@pgf@reada to\pgfincludeexternalgraphics@auxline
+ \ifx\pgfincludeexternalgraphics@auxline\pgfutil@empty
+ \else
+ \expandafter\pgfincludeexternalgraphics@read@dpth@line\pgfincludeexternalgraphics@auxline\pgfincludeexternalgraphics@read@dpth@line@EOI
+ \fi
+ \expandafter\pgfincludeexternalgraphics@read@dpth
+ \fi
+}%
+
+\def\pgfexternal@restore#1{#1}%
+
+\long\def\pgfincludeexternalgraphics@read@dpth@line@getfirst#1#2\pgfincludeexternalgraphics@read@dpth@line@EOI{%
+ \def\pgf@first{#1}%
+}%
+\long\def\pgfincludeexternalgraphics@read@dpth@line#1\pgfincludeexternalgraphics@read@dpth@line@EOI{%
+ \pgfincludeexternalgraphics@read@dpth@line@getfirst#1\pgfincludeexternalgraphics@read@dpth@line@EOI
+ \expandafter\ifcat\expandafter\noexpand\pgf@first\relax
+ % Ah -- the first token is a control sequence. It belongs to
+ % the .aux file.
+ %
+ \expandafter\ifx\pgf@first\pgfexternal@restore
+ #1%
+ \else
+ % do NOT execute #1! many LaTeX commands don't support it (\label for example)
+ \pgfutil@ifundefined{if@filesw}{%
+ % sorry, .aux file support only for latex
+ }{%
+ % append to main .aux file (for forward references)
+ \if@filesw
+ {%
+ \toks0={#1}%
+ % believe it or not, but the
+ % \def\dpthimport{...}\dpthimport *makes* a
+ % difference! In ensures any occuring `##' characters are properly expanded to `#'.
+ \immediate\write\@auxout{%
+ \noexpand\def\noexpand\dpthimport{\the\toks0}\noexpand\dpthimport}%
+ }%
+ \fi
+ }%
+ \fi
+ \else% it is the depth (which is simply a number for backwards compatibility)
+ \def\pgfexternaldepth{#1}%
+ \fi
+}%
+
+% Stores '#1' (expanded!) into the .dpth file of the currently
+% exported image.
+%
+% This command has only an effect if an image is being exported.
+%
+% The stored contents will be read in the context where
+% /pgf/images/include external is active (i.e. by
+% \pgfexternalreaddpth).
+%
+\def\pgfexternalstorecommand#1{%
+}%
+\def\pgfexternalstorecommand@isexporting#1{%
+ \immediate\write\w@pgfexternal@auxout{\noexpand\pgfexternal@restore{#1}}%
+}%
+
+
+
+% Grab operation: If jobname matches the graphic name, typeset this
+% picture normall.
+% REMARK:
+% this method is also invoked from within the tikz external library.
+\def\pgf@external@grab#1{%
+ \def\pgf@filename{#1}%
+ \ifpgfexternal@aux@in@dpth
+ \begingroup
+ \pgf@external@init@aux@in@dpth
+ \let\G@refundefinedtrue=\pgf@external@grab@refundefinedtrue
+ \fi
+ \gdef\pgf@trimleft@final{0sp}%
+ \gdef\pgf@trimright@final{0sp}%
+ \setbox\pgfpic=\hbox\bgroup\bgroup%
+ \let\endpgfgraphicnamed=\pgf@externalend%
+}
+
+{\catcode`\^=12 \gdef\pgfexternal@hat{^}}
+
+\expandafter\let\expandafter\pgf@external@grab@refundefinedtrue@orig\csname G@refundefinedtrue\endcsname
+
+\def\pgf@external@grab@refundefinedtrue{%
+ \pgf@external@grab@refundefinedtrue@orig
+ \begingroup
+ \def\n{\pgfexternal@hat\pgfexternal@hat J}%
+ \pgfexternalstorecommand{%
+ \noexpand\immediate\noexpand\write16{\pgf@external@grab@refundefinedtrue@warning}%
+ \noexpand\G@refundefinedtrue
+ }%
+ \endgroup
+}%
+\def\pgf@external@grab@refundefinedtrue@warning{%
+ LaTeX Warning: External picture `\pgfactualjobname' contains undefined references\noexpand\on@line.\n
+}%
+
+\let\pgf@external@@protected@write@orig=\protected@write
+\long\def\pgf@external@@protected@write@immediate#1#2#3{%
+ \begingroup
+ \let\pgf@write@=\write
+ \def\write{\noexpand\immediate\pgf@write@}%
+ \pgf@external@@protected@write@orig{#1}{#2}{#3}%
+ \endgroup
+}%
+
+\def\pgf@external@init@aux@in@dpth{%
+ \let\pgfexternalstorecommand=\pgfexternalstorecommand@isexporting
+ %
+ % tell LaTeX to write aux files...
+ \csname @fileswtrue\endcsname
+ % ... but redirect output to the .dpth file!
+ \immediate\openout\w@pgfexternal@auxout=\pgf@filename.dpth
+ \let\@auxout=\w@pgfexternal@auxout
+ % ... and disable the correct page numbers. I can't get that
+ % (because the correct page number is only available in the
+ % shipout routine). Use immediate output:
+ \let\protected@write=\pgf@external@@protected@write@immediate
+}%
+
+\def\pgf@externalend@storeshifts#1{%
+ \immediate\write#1{\the\dp\pgfpic}% store the depth simply as number for backw. compat.
+ \ifx\pgf@trimleft@final\pgfutil@empty\else
+ \immediate\write#1{\noexpand\pgfexternal@restore{\noexpand\def\noexpand\pgfexternaltrimleft{\pgf@trimleft@final}}}%
+ \fi
+ \ifx\pgf@trimright@final\pgfutil@empty\else
+ \immediate\write#1{\noexpand\pgfexternal@restore{\noexpand\def\noexpand\pgfexternaltrimright{\pgf@trimright@final}}}%
+ \fi
+ \ifpgfexternal@info
+ \immediate\write#1{\noexpand\pgfexternal@restore{\noexpand\def\noexpand\pgfexternalwidth{\the\wd\pgfpic}}}%
+ \immediate\write#1{\noexpand\pgfexternal@restore{\noexpand\def\noexpand\pgfexternalheight{\the\dimen0}}}%
+ \fi
+}
+% REMARK:
+% this method is also invoked from within the tikz external library.
+\def\pgf@externalend{%
+ \unskip\egroup\egroup%
+ {%
+ \def\pgf@external@trim{0}%
+ \def\pgf@external@store@dpth{0}%
+ %
+ \ifpgf@trim@lowlevel
+ \gdef\pgf@trimleft@final{}%
+ \gdef\pgf@trimright@final{}%
+ \else
+ \ifdim\pgf@trimleft@final=0sp \gdef\pgf@trimleft@final{} \else\def\pgf@external@trim{1}\fi
+ \ifdim\pgf@trimright@final=0sp \gdef\pgf@trimright@final{} \else\def\pgf@external@trim{1}\fi
+ \if1\pgf@external@trim
+ % UNDO the trimming! export to pdf doesn't supported trimmed
+ % bounding boxes (has to do with the mediabox/trimbox etc).
+ % I'll keep the bounding box intact and store the trim information
+ % into the .dpth file.
+ \setbox\pgfpic=\hbox{%
+ \ifx\pgf@trimleft@final\pgfutil@empty\else\kern-\pgf@trimleft@final\fi
+ \box\pgfpic
+ \ifx\pgf@trimright@final\pgfutil@empty\else\kern-\pgf@trimright@final\fi
+ }%
+ \def\pgf@external@store@dpth{1}%
+ \fi
+ \fi
+ %
+ \parindent0pt % leave the space
+% \leftmargin0pt%
+% \rightmargin0pt%
+ \hoffset=0pt % reset to default
+ \voffset=0pt
+ \dimen0\ht\pgfpic%
+ \advance\dimen0\dp\pgfpic%
+ \ifdim\dp\pgfpic=0pt\relax
+ \else% store the picture's depth. Otherwise, it would be lost.
+ \def\pgf@external@store@dpth{1}%
+ \fi
+ \ifpgfexternal@info
+ \def\pgf@external@store@dpth{1}%
+ \fi
+ %
+ \if1\pgf@external@store@dpth
+ \ifpgfexternal@aux@in@dpth
+ \pgf@externalend@storeshifts\@auxout
+ \immediate\closeout\@auxout
+ \else
+ \immediate\openout\pgf@plotwrite=\pgf@filename.dpth
+ \pgf@externalend@storeshifts\pgf@plotwrite
+ \immediate\closeout\pgf@plotwrite
+ \fi
+ \fi
+ \pgfsys@papersize{\the\wd\pgfpic}{\the\dimen0}%
+ %
+ \setbox0=\vbox{%
+ % I admit that I don't know why there is this kerning:
+ \kern -\pgf@external@kern@top\relax%
+ \hbox{%
+ \kern -\pgf@external@kern@left\relax%
+ \hbox to0pt{%
+ \wd\pgfexternal@startupbox=0pt %
+ \ht\pgfexternal@startupbox=0pt %
+ \dp\pgfexternal@startupbox=0pt %
+ \box\pgfexternal@startupbox%
+ \pgfsys@atbegindocument\hss}%
+ \box\pgfpic%
+ \kern\pgf@external@kern@right\relax%
+ }%
+ \kern\pgf@external@kern@bottom\relax%
+ }%
+ %
+ % compatibility with eso-pic package: \nointerlineskip is not
+ % allowed here, but the eso-pic package uses \nointerlineskip in
+ % its shipout routine.
+ \let\pgfexternal@nointerlineskip@orig=\nointerlineskip
+ \let\nointerlineskip=\pgfexternal@nointerlineskip
+ %
+ \pgfexternal@originalshipout\box0 %
+ \gdef\pgfexternal@did@a@shipout{1}%
+ }%
+ \ifpgfexternal@aux@in@dpth
+ \endgroup
+ \fi
+}
+
+\def\pgfexternal@nointerlineskip{%
+ \ifvmode
+ \pgfexternal@nointerlineskip@orig
+ \else
+ \relax% \nointerlineskip in horizontal mode not allowed. Silently ignore the error message.
+ \fi
+}%
+
+\endinput
+% vi: tabstop=4 shiftwidth=2 expandtab
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex
index b3a04e6cad0..eeb6c3e8635 100644
--- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex,v 1.8 2007/12/12 16:57:17 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex,v 1.9 2008/04/22 17:03:26 tantau Exp $
% Globals
@@ -29,6 +29,45 @@
\ignorespaces}
+% Set the inner line width to #1.
+%
+% #1 = new inner line width.
+%
+% Description:
+%
+% The inner line width is the width of a second line that is drawn on
+% top of the main stroked line. If the inner line width is 0pt, no
+% inner line is drawn. The main use of inner lines is for creating
+% "double" lines.
+%
+% Inner lines are not drawn when a path is used for clipping.
+%
+% The inner line width is local to the current TeX group, it is not
+% part of the graphic state.
+%
+% Example:
+%
+% \pgfsetinnerlinewidth{1pt}
+
+\def\pgfsetinnerlinewidth#1{%
+ \pgfmathsetlength\pgf@x{#1}%
+ \edef\pgfinnerlinewidth{\the\pgf@x}%
+}
+\def\pgfinnerlinewidth{0pt}
+
+
+% Set the inner line color to #1.
+%
+% #1 = color for the inner line
+%
+% Example:
+%
+% \pgfsetinnerlinecolor{green} % yikes!
+
+\def\pgfsetinnerstrokecolor#1{\def\pgfinnerstrokecolor{#1}}
+\def\pgfinnerstrokecolor{white}
+
+
% Set the miter limit to #1.
%
% #1 = new miter limit factor.
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex
index d74d3d1f84f..59a3699f70d 100644
--- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreimage.code.tex,v 1.1 2008/01/15 10:27:34 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreimage.code.tex,v 1.16 2010/03/25 20:57:13 ludewich Exp $
@@ -47,10 +47,10 @@
\PackageWarning{pgf}%
{File "#3" not found when defining image "#2".\MessageBreak
Tried all extensions in "\pgfsys@imagesuffixlist"}%
- \pgf@declaredraftimage{#2}%
+ \pgf@declaredraftimage{#2}{#3}%
\else%
\ifpgf@draftmode%
- \pgf@declaredraftimage{#2}%
+ \pgf@declaredraftimage{#2}{#3}%
\else%
\pgfsys@defineimage%
\fi%
@@ -58,10 +58,14 @@
\expandafter\global\expandafter\let\csname pgf@image@#2!\endcsname=\pgf@image%
}
+
+\pgfkeys{
+ /pgf/images/draft/.is if=pgf@draftmode,
+ /pgf/images/draft/.default=true}
\pgfkeys{/pgf/images/width/.estore in=\pgf@imagewidth}
\pgfkeys{/pgf/images/height/.estore in=\pgf@imageheight}
\pgfkeys{/pgf/images/page/.estore in=\pgf@imagepage}
-\pgfkeys{/pgf/images/interpolate/.cd,.code=\edef\pgf@imageinterpolate{/Interpolate #1},.default=true}
+\pgfkeys{/pgf/images/interpolate/.cd,.code=\edef\pgf@imageinterpolate{#1},.default=true}
\pgfkeys{/pgf/images/mask/.code=%
{%
\edef\pgf@imagemask{#1}%
@@ -71,10 +75,6 @@
{\PackageError{pgf}{Undefined mask "#1".}{}%
\edef\pgf@imagemask{}}%
{\edef\pgf@imagemask{\csname pgf@mask@#1\endcsname}%
- \ifx\pgf@imagemask\pgfutil@empty%
- \else
- \edef\pgf@imagemask{/SMask \pgf@imagemask\space 0 R}%
- \fi%
}%
\fi%
}}
@@ -88,13 +88,15 @@
\pgf@findfile#2+{#3}%
\fi}}
-\def\pgf@declaredraftimage#1{%
+% #1: image name
+% #2: file name
+\def\pgf@declaredraftimage#1#2{%
\ifx\pgf@imagewidth\pgfutil@empty%
- \PackageWarning{pgf}{Missing width for image "#1" in draft mode.\MessageBreak Using 1cm instead}%
+ \PackageWarning{pgf}{Missing width for image "#1" ("#2") in draft mode.\MessageBreak Using 1cm instead}%
\edef\pgf@imagewidth{1cm}%
\fi%
\ifx\pgf@imageheight\pgfutil@empty%
- \PackageWarning{pgf}{Missing height for image "#1" in draft mode.\MessageBreak Using 1cm instead}%
+ \PackageWarning{pgf}{Missing height for image "#1" ("#2") in draft mode.\MessageBreak Using 1cm instead}%
\edef\pgf@imageheight{1cm}%
\fi%
\ifx\pgf@imagepage\pgfutil@empty\else\edef\pgf@imagepagetext{ page \pgf@imagepage}\fi%
@@ -103,7 +105,7 @@
\vrule\kern-0.4pt%
\vbox to \pgf@imageheight{%
\hrule\vfil%
- \hbox to \pgf@imagewidth{\hskip-10cm\hfil\noexpand\tiny#1\pgf@imagepage\hfil\hskip-10cm}%
+ \hbox to \pgf@imagewidth{\hskip-10cm\hfil\noexpand\tiny#2\pgf@imagepage\hfil\hskip-10cm}%
\vfil\hrule}%
\kern-0.4pt\vrule}%
}%
@@ -143,7 +145,7 @@
{File "#3" not found when defining mask "#2".\MessageBreak
Tried all extensions in "\pgfsys@imagesuffixlist"}%
\else%
- \pgfsys@definemask%
+ \pgfsys@definemask{#2}%
\fi%
\expandafter\global\expandafter\let\csname pgf@mask@#2\endcsname=\pgf@mask%
}
@@ -236,173 +238,6 @@
\pgfuseimage{pgflastimage}}
-
-
-
-
-
-
-% The external read/write mechanism is used as follows:
-%
-% In your document, you put a number or all of your pgfpicture (or
-% tikzpicture) environments inside a pair of \beginpgfexternal and
-% \endpgfexternal. The \beginpgfexternal gets one parameter called the
-% graphics name.
-%
-% Once this is done, the next step is to declare the names of your
-% graphics in the document at the beginning using the
-% \pgfdeclaregraphicname command.
-%
-% Now, when you typeset your document, each time a \beginpgfexternal
-% command is encountered, it will be checked whether the corresponding
-% graphics file exists. If this is the case, it will be included and
-% the code between \beginpgfexternal and \endpgfexternal is
-% ignored. Otherwise, the code is executed normally.
-%
-% Things change when you run tex on your file with the \jobname set to
-% the name of a decalred graphics name. In this case, only your
-% graphic will be typeset, the rest of the document will be "thrown away".
-% To be more precise, everything is gobbled up to the beginning
-% of the first \beginpgfexternal with the given graphics name. Then,
-% the content of the "environment" is put in a box (this "environment"
-% need not contain a graphics, it may contain anything that can be put
-% in a box). Then a single page is output whose size is exactly the
-% size of the picture.
-%
-% So, once you have run tex repeatedly, each time with the jobname set
-% to each of the graphics, you can then run tex on the whole document
-% and this will cause all graphics to be included rather than begin
-% typeset.
-%
-% Finally, once all the graphics have been created, you can also say
-% \input pgfexternal.tex instead of including pgf/TikZ.
-
-
-
-% Tells pgf which jobname is the name of the real file
-%
-% #1 = name
-%
-% Description:
-%
-% This command is used to tell pgf that the file named #1 should be
-% typeset normally. If \jobname is not equal to #1, only
-% the graphic called \jobname will be typeset.
-%
-% Example:
-%
-% \pgfrealjobname{survey}
-
-\def\pgfrealjobname#1{%
- \edef\pgf@tempa{\expandafter\string\csname #1\endcsname}%
- \edef\pgf@tempb{\expandafter\string\csname\jobname\endcsname}%
- \ifx\pgf@tempa\pgf@tempb%
- \else%
- \pgf@external@grabshipouttrue%
- \fi%
-}
-
-
-\newif\ifpgf@external@grabshipout
-\newbox\pgfexternal@startupbox
-
-\AtBeginDocument{%
- \ifpgf@external@grabshipout%
- \global\let\pgfexternal@originalshipout=\shipout%
- \global\def\shipout{\setbox\pgfpic=}%
- \maxdeadcycles=10000%
- % Ok, gather everything we have seen up to now in a box. This box
- % will contain any specials that have been used.
- {%
- \output{\global\setbox\pgfexternal@startupbox=\vbox{\csname @begindvi\endcsname\unvbox255}}%
- \hbox{}\eject%
- }%
- \fi%
-}
-
-
-% "Environment" for an external graphic.
-%
-% #1 = graphic name
-%
-% Example:
-%
-% \beginpgfgraphicnamed{main-graphic2}
-% \begin{tikzpicture}
-% ...
-% \end{tikzpicture}
-% \endpgfgraphicnamed
-
-\def\pgf@externalbegin#1{%
- % First, check whether we wish to grab this graphic:
- \let\pgf@next=\pgf@external@normal%
- \ifpgf@external@grabshipout%
- \edef\pgf@tempa{\expandafter\string\csname #1\endcsname}%
- \edef\pgf@tempb{\expandafter\string\csname\jobname\endcsname}%
- \ifx\pgf@tempa\pgf@tempb%
- \let\pgf@next=\pgf@external@grab%
- \fi%
- \fi%
- \pgf@next{#1}%
-}
-
-
-\AtBeginDocument{
- \let\beginpgfgraphicnamed=\pgf@externalbegin% overwrite definition of pgfexternal.tex if necessary
- \let\endpgfgraphicnamed=\unskip
-}
-
-
-% Normal operation: Include an external graphic instead of the
-% picture, if such an external picture exists.
-\def\pgf@external@normal#1{%
- \let\pgf@filename=\pgfutil@empty%
- \expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#1}%
- \ifx\pgf@filename\pgfutil@empty%
- % Ok, no such image... Just typeset the picture normally.
- \let\pgf@next=\relax%
- \else%
- \let\pgf@next=\pgf@replacepicturebygraphic%
- \fi%
- \pgf@next%
-}
-
-\long\def\pgf@replacepicturebygraphic#1\endpgfgraphicnamed{\includegraphics{\pgf@filename}\unskip}
-
-
-% Grab operation: If jobname matches the graphic name, typeset this
-% picture normall.
-
-\def\pgf@external@grab#1{%
- \setbox\pgfpic=\hbox\bgroup\bgroup%
- \let\endpgfgraphicnamed=\pgf@externalend%
-}
-
-\def\pgf@externalend{%
- \unskip\egroup\egroup%
- {%
- \parindent0pt%
- \leftmargin0pt%
- \rightmargin0pt%
- \dimen0\ht\pgfpic%
- \advance\dimen0\dp\pgfpic%
- \pgfsys@papersize{\the\wd\pgfpic}{\the\dimen0}%
- \setbox0=\vbox{%
- \kern -1truein%
- \hbox{%
- \kern -1truein%
- \hbox to0pt{%
- \wd\pgfexternal@startupbox=0pt%
- \ht\pgfexternal@startupbox=0pt%
- \dp\pgfexternal@startupbox=0pt%
- \box\pgfexternal@startupbox%
- \pgfsys@atbegindocument\hss}%
- \box\pgfpic%
- \kern 1truein}%
- \kern1truein}%
- \pgfexternal@originalshipout\box0%
- }%
-}
-
+\input pgfcoreexternal.code.tex
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex
index d1e464fb7b7..e18aea0cde9 100644
--- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorelayers.code.tex,v 1.1 2008/01/15 10:27:34 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorelayers.code.tex,v 1.2 2010/08/27 12:51:47 ludewich Exp $
% Creates a new pgf layer
@@ -50,7 +50,7 @@
%
% Note:
%
-% You cannot anything to the ``main'' layer using this command.
+% You cannot add anything to the ``main'' layer using this command.
%
% Example:
%
@@ -59,11 +59,17 @@
% \end{pgfonlayer}
\def\pgfonlayer#1{%
- \expandafter\global\expandafter%
- \setbox\csname pgf@layerbox@#1\endcsname=\hbox to 0pt%
- \bgroup%
- \expandafter\box\csname pgf@layerbox@#1\endcsname%
- \begingroup%
+ \pgfutil@ifundefined{pgf@layerbox@#1}{%
+ \PackageError{pgf}{Sorry, the requested layer '#1' could not be found. Maybe you misspelled it?}{}%
+ \bgroup
+ \begingroup
+ }{%
+ \expandafter\global\expandafter%
+ \setbox\csname pgf@layerbox@#1\endcsname=\hbox to 0pt%
+ \bgroup%
+ \expandafter\box\csname pgf@layerbox@#1\endcsname%
+ \begingroup%
+ }%
}
\def\endpgfonlayer{%
\endgroup%
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex
index b96d766b081..db62f73b6bf 100644
--- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex
@@ -7,13 +7,14 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex,v 1.14 2008/02/13 15:10:06 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex,v 1.24 2010/08/03 12:27:36 ludewich Exp $
\newdimen\pgf@path@lastx
\newdimen\pgf@path@lasty
-
+\let\pgfgetpath=\pgfsyssoftpath@getcurrentpath
+\let\pgfsetpath=\pgfsyssoftpath@setcurrentpath
% Replace corners by arcs.
%
@@ -98,14 +99,14 @@
\ifdim#1>\pgf@picmaxx\global\pgf@picmaxx#1\fi%
\ifdim#2<\pgf@picminy\global\pgf@picminy#2\fi%
\ifdim#2>\pgf@picmaxy\global\pgf@picmaxy#2\fi%
+ \ifpgf@size@hooked%
+ \let\pgf@size@hook@x#1\let\pgf@size@hook@y#2\pgf@path@size@hook%
+ \fi%
\fi%
\ifdim#1<\pgf@pathminx\global\pgf@pathminx#1\fi%
\ifdim#1>\pgf@pathmaxx\global\pgf@pathmaxx#1\fi%
\ifdim#2<\pgf@pathminy\global\pgf@pathminy#2\fi%
\ifdim#2>\pgf@pathmaxy\global\pgf@pathmaxy#2\fi%
- \ifpgf@size@hooked%
- \let\pgf@size@hook@x#1\let\pgf@size@hook@y#2\pgf@path@size@hook%
- \fi%
}
\newif\ifpgf@size@hooked
\let\pgf@path@size@hook=\pgfutil@empty%
@@ -176,7 +177,7 @@
}
-% Append a bezier spline from the current point to #3 with control
+% Append a cubic bezier spline from the current point to #3 with control
% points #1 and #2 to the current path.
%
% #1 = first control point
@@ -185,8 +186,8 @@
%
% Example:
%
-% \pgfpathmoveto{\pgfxy(0,0)}
-% \pgfpathcurveto{\pgfxy(0,1)}{\pgfxy(1,1)}{\pgfxy(1,2)}
+% \pgfpathmoveto{\pgfpointxy{0}{0}}
+% \pgfpathcurveto{\pgfpointxy{0}{1}}{\pgfpointxy{1}{1}}{\pgfpointxy{1}{2}}
% \pgfstroke
\def\pgfpathcurveto#1#2#3{%
@@ -207,6 +208,46 @@
}
+
+% Append a quadratic bezier spline from the current point to #2 with
+% control point #1 to the current path.
+%
+% #1 = control point
+% #2 = end point
+%
+% Example:
+%
+% \pgfpathmoveto{\pgfpointxy{0}{0}}
+% \pgfpathquadraticcurveto{\pgfpointxy{1}{1}}{\pgfpointxy{2}{0}}
+% \pgfstroke
+
+\def\pgfpathquadraticcurveto#1#2{%
+ \pgfpointtransformed{#2}%
+ \pgf@protocolsizes{\pgf@x}{\pgf@y}%
+ \pgf@xb=\pgf@x%
+ \pgf@yb=\pgf@y%
+ \pgfpointtransformed{#1}%
+ \pgf@xc=.6666666\pgf@x%
+ \pgf@yc=.6666666\pgf@y%
+ % compute second control point:
+ \pgf@xa=.33333333\pgf@xb%
+ \pgf@ya=.33333333\pgf@yb%
+ \advance\pgf@xa by\pgf@xc%
+ \advance\pgf@ya by\pgf@yc%
+ \pgf@protocolsizes{\pgf@xa}{\pgf@ya}%
+ % compute first control point
+ \advance\pgf@xc by.3333333\pgf@path@lastx%
+ \advance\pgf@yc by.3333333\pgf@path@lasty%
+ \pgf@protocolsizes{\pgf@xc}{\pgf@yc}%
+ \pgf@roundcornerifneeded%
+ \pgfsyssoftpath@curveto{\the\pgf@xc}{\the\pgf@yc}{\the\pgf@xa}{\the\pgf@ya}{\the\pgf@xb}{\the\pgf@yb}%
+ \global\pgf@path@lastx=\pgf@xb%
+ \global\pgf@path@lasty=\pgf@yb%
+}
+
+
+
+
% Append an arc to the current point, where the current point is at
% angle #1 and the end is at angle #2. If #2 > #1, the arc is drawn
% counter-clockwise, otherwise it is clockwise.
@@ -233,19 +274,6 @@
\fi%
\pgf@arc@local@angle@a=\pgf@temp@a pt%
\pgf@arc@local@angle@b=\pgf@temp@b pt%
- \relax%
- \ifdim\pgf@arc@local@angle@a>360pt\relax%
- \advance\pgf@arc@local@angle@a by-360pt\relax%
- \fi%
- \ifdim\pgf@arc@local@angle@a<-360pt\relax%
- \advance\pgf@arc@local@angle@a by360pt\relax%
- \fi%
- \ifdim\pgf@arc@local@angle@b>360pt\relax%
- \advance\pgf@arc@local@angle@b by-360pt\relax%
- \fi%
- \ifdim\pgf@arc@local@angle@b<-360pt\relax%
- \advance\pgf@arc@local@angle@b by360pt\relax%
- \fi%
\loop%
\pgfutil@tempdima=\pgf@arc@local@angle@a%
\advance\pgfutil@tempdima by-\pgf@arc@local@angle@b\relax%
@@ -292,40 +320,22 @@
\def\pgf@arc{%
{%
- % \pgfmathsetlength{\pgfutil@tempdima}{#3}%
- % \pgfmathsetlength{\pgfutil@tempdimb}{#4}%
\pgfutil@tempdima=\pgf@arc@radius@a pt%
\pgfutil@tempdimb=\pgf@arc@radius@b pt%
%
\pgf@xa=\pgf@arc@local@angle@a\relax%
\pgf@xb=\pgf@arc@local@angle@b\relax%
- % \pgfutil@tempcnta=#1\relax%
- % \pgfutil@tempcntb=#2\relax%
\advance\pgf@xb by-\pgf@xa\relax%
\ifdim\pgf@xb<0pt\relax%
\pgf@xb=-\pgf@xb\relax%
\fi%
- \ifdim\pgf@xb>85pt\relax% hackery to correct the control points
- \pgfutil@tempdima=0.0555\pgfutil@tempdima\relax%
- \pgfutil@tempdimb=0.0555\pgfutil@tempdimb\relax%
+ \ifdim\pgf@xb=90.0pt%
+ \def\pgfmathresult{0.55228475}%
\else%
- \ifdim\pgf@xb>75pt\relax%
- \pgfutil@tempdima=0.055\pgfutil@tempdima\relax%
- \pgfutil@tempdimb=0.055\pgfutil@tempdimb\relax%
- \else%
- \ifdim\pgf@xb>60pt\relax%
- \pgfutil@tempdima=0.0545\pgfutil@tempdima\relax%
- \pgfutil@tempdimb=0.0545\pgfutil@tempdimb\relax%
- \else%
- \pgfutil@tempdima=0.054\pgfutil@tempdima\relax%
- \pgfutil@tempdimb=0.054\pgfutil@tempdimb\relax%
- \fi%
- \fi%
- \fi
- \pgfutil@tempdima=\pgf@sys@tonumber{\pgf@xb}\pgfutil@tempdima\relax%
- \divide\pgfutil@tempdima by 9\relax%
- \pgfutil@tempdimb=\pgf@sys@tonumber{\pgf@xb}\pgfutil@tempdimb\relax%
- \divide\pgfutil@tempdimb by 9\relax%
+ \pgfmathparse{1.333333333*tan(.25*\pgf@sys@tonumber{\pgf@xb})}% many thanks to Ken Starks
+ \fi%
+ \pgfutil@tempdima=\pgfmathresult\pgfutil@tempdima%
+ \pgfutil@tempdimb=\pgfmathresult\pgfutil@tempdimb%
%.. controls +(\pgf@xa+90:\pgfutil@tempdima) and +(\pgf@xb-90:\pgfutil@tempdima) .. +(-(#1:#3)+(#2:#3))%
% store first support vector in xa/ya:
\pgf@xa=\pgf@arc@local@angle@a\relax%
@@ -373,6 +383,7 @@
}%
}
+
% Append an arc to the current point, where the arc is on an ellipse
% given by two axis vectors.
%
@@ -396,6 +407,466 @@
+% Append an arc to the current point that ends at a given position.
+%
+% #1 = x-radius
+% #2 = y-radius
+% #3 = x-axis-rotation (in degrees)
+% #4 = large-arc-sweep-flag (0 or 1)
+% #5 = sweep-flag (0 or 1)
+% #6 = target point
+%
+% Description:
+%
+% This command implements an arc drawing where a given target
+% coordinate (#6) is given and the task is to draw an arc of an
+% ellipse with the given radii. The center point of the ellipse is not
+% give, but computed automatically.
+%
+% This kind of "endpoint parameterization" of an arc is exactly the
+% same as the one specified by the SVG-specification for the "A" and
+% "a" path commands. Please see the SVG-specification for details.
+%
+% Note that the problem is internally converted to drawing an arc
+% using \pgfpatharc. This means that there may be a heavy loss of
+% accuracy.
+%
+% Example:
+%
+% \pgfpathmoveto{\pgfpoint{1cm}{1cm}}
+% \pgfpatharcto{1cm}{1cm}{0}{0}{0}{\pgfpoint{0cm}{2cm}}
+
+\def\pgfpatharcto#1#2#3#4#5#6{%
+ {%
+ % The following code is based on the transformation described in svg
+ % 1.1 specification Section F.6.5
+ %
+ % Step 1: store the simple parameters (xa=x1 since TeX does not
+ % allow numbers in names)
+ %
+ \pgfmathsetmacro\pgf@arcto@rx{abs(#1)}%
+ \pgfmathsetmacro\pgf@arcto@ry{abs(#2)}%
+ \ifdim\pgf@arcto@rx pt=0pt% special rule: zero radius=straight line
+ \gdef\pgf@marshal{\pgfpathlineto{#6}}%
+ \else
+ \ifdim\pgf@arcto@ry pt=0pt% special rule: zero radius=straight line
+ \gdef\pgf@marshal{\pgfpathlineto{#6}}%
+ \else
+ \pgfmathsetmacro\pgf@arcto@phi{#3}%
+ \pgfmathsetmacro\pgf@arcto@fA{#4}%
+ \ifdim\pgf@arcto@fA pt=0pt
+ \else
+ \pgfmathsetmacro\pgf@arcto@fA{1.0} % Special rule: every non-zero value is 1.
+ \fi
+ \pgfmathsetmacro\pgf@arcto@fS{#5}%
+ \ifdim\pgf@arcto@fS pt=0pt
+ \else
+ \pgfmathsetmacro\pgf@arcto@fS{1.0} % Special rule: every non-zero value is 1.
+ \fi
+ \pgf@process{#6}
+ \edef\pgf@arcto@xb{\the\pgf@x}%
+ \edef\pgf@arcto@yb{\the\pgf@y}%
+ %
+ % Step 2: x1,y1 is more complicated to compute: It is given by lastx
+ % and lasty, but these are transformed coordinates, we need the
+ % untransformed ones. So, we inverse the transformation (arghh...)
+ %
+ \pgftransforminvert%
+ \pgf@process{\pgfpointtransformed{\pgfqpoint{\pgf@path@lastx}{\pgf@path@lasty}}}
+ \edef\pgf@arcto@xa{\the\pgf@x}
+ \edef\pgf@arcto@ya{\the\pgf@y}
+ \edef\pgf@temp@a{\pgf@arcto@xa,\pgf@arcto@ya}
+ \edef\pgf@temp@b{\pgf@arcto@xb,\pgf@arcto@yb}
+ \ifx\pgf@temp@a\pgf@temp@b% special rule: skip!
+ \global\let\pgf@marshal\pgfutil@empty
+ \else
+ %
+ % Ok, now we got all the parameters setup. Now comes the
+ % computation...
+ %
+ %
+ % Step 3: Start with a new coordinate system and rotate everything
+ % by the negated phi.
+ %
+ \pgftransformreset
+ \pgftransformrotate{-\pgf@arcto@phi}
+ % Ok, using \pgfpointtransformed we now get transformed points...
+ %
+ % Step 4: Compute x1' and y1' (xaprime and yaprime)
+ %
+ \pgf@process{
+ \pgfpointtransformed{\pgfpointscale{.5}{\pgfpointdiff
+ {\pgfqpoint{\pgf@arcto@xb}{\pgf@arcto@yb}}
+ {\pgfqpoint{\pgf@arcto@xa}{\pgf@arcto@ya}}
+ }
+ }
+ }
+ \edef\pgf@arcto@xaprime{\pgf@sys@tonumber\pgf@x}
+ \edef\pgf@arcto@yaprime{\pgf@sys@tonumber\pgf@y}
+ %
+ % Compute Lambda
+ %
+ \pgfmathsetmacro\pgf@arcto@frac@x{\pgf@arcto@xaprime/\pgf@arcto@rx}
+ \pgfmathsetmacro\pgf@arcto@frac@y{\pgf@arcto@yaprime/\pgf@arcto@ry}
+ \pgfmathsetmacro\pgf@arcto@lambda{
+ \pgf@arcto@frac@x*\pgf@arcto@frac@x+\pgf@arcto@frac@y*\pgf@arcto@frac@y
+ }
+ \ifdim\pgf@arcto@lambda pt>1pt%
+ \pgfmathsetmacro\pgf@arcto@sqrt@lambda{sqrt(\pgf@arcto@lambda)}
+ \pgfmathsetmacro\pgf@arcto@rx{\pgf@arcto@sqrt@lambda*\pgf@arcto@rx}
+ \pgfmathsetmacro\pgf@arcto@ry{\pgf@arcto@sqrt@lambda*\pgf@arcto@ry}
+ \fi
+ %
+ % Do some scaling
+ %
+ \pgfmathsetmacro\pgf@arcto@xaprime@abs{abs(\pgf@arcto@xaprime)}
+ \pgfmathsetmacro\pgf@arcto@yaprime@abs{abs(\pgf@arcto@yaprime)}
+ \pgfmathmax@{\pgf@arcto@rx,\pgf@arcto@ry,\pgf@arcto@xaprime@abs,\pgf@arcto@yaprime@abs}
+ \pgfmathsetmacro\pgf@arcto@scaling{20/\pgfmathresult}
+ \pgfmathsetmacro\pgf@arcto@rx@scaled{\pgf@arcto@scaling*\pgf@arcto@rx}
+ \pgfmathsetmacro\pgf@arcto@ry@scaled{\pgf@arcto@scaling*\pgf@arcto@ry}
+ \pgfmathsetmacro\pgf@arcto@xaprime@scaled{\pgf@arcto@scaling*\pgf@arcto@xaprime}
+ \pgfmathsetmacro\pgf@arcto@yaprime@scaled{\pgf@arcto@scaling*\pgf@arcto@yaprime}
+ %
+ % Step 5: Now comes the messy computation of c1' and c2'.
+ %
+ \ifdim\pgf@arcto@rx pt>\pgf@arcto@ry pt%
+ \pgfmathsetmacro\pgf@arcto@rx@over@ry{\pgf@arcto@rx/\pgf@arcto@ry}
+ \pgfmathsetmacro\pgf@arcto@ry@over@rx{\pgf@arcto@ry/\pgf@arcto@rx}
+ \pgfmathsetmacro\pgf@arcto@temp{\pgf@arcto@ry@over@rx*\pgf@arcto@xaprime@scaled}
+ \pgfmathsetmacro\pgf@arcto@numerator{
+ \pgf@arcto@ry@scaled*\pgf@arcto@ry@scaled-
+ \pgf@arcto@yaprime@scaled*\pgf@arcto@yaprime@scaled-
+ \pgf@arcto@temp*\pgf@arcto@temp
+ }
+ \pgfmathsetmacro\pgf@arcto@denominator{
+ \pgf@arcto@yaprime@scaled*\pgf@arcto@yaprime@scaled+
+ \pgf@arcto@temp*\pgf@arcto@temp
+ }
+ \else
+ \pgfmathsetmacro\pgf@arcto@rx@over@ry{\pgf@arcto@rx/\pgf@arcto@ry}
+ \pgfmathsetmacro\pgf@arcto@ry@over@rx{\pgf@arcto@ry/\pgf@arcto@rx}
+ \pgfmathsetmacro\pgf@arcto@temp{\pgf@arcto@rx@over@ry*\pgf@arcto@yaprime@scaled}
+ \pgfmathsetmacro\pgf@arcto@numerator{
+ \pgf@arcto@rx@scaled*\pgf@arcto@rx@scaled-
+ \pgf@arcto@xaprime@scaled*\pgf@arcto@xaprime@scaled-
+ \pgf@arcto@temp*\pgf@arcto@temp
+ }
+ \pgfmathsetmacro\pgf@arcto@denominator{
+ \pgf@arcto@xaprime@scaled*\pgf@arcto@xaprime@scaled+
+ \pgf@arcto@temp*\pgf@arcto@temp
+ }
+ \fi
+ \pgfmathsetmacro\pgf@arcto@frac{
+ \pgf@arcto@numerator/\pgf@arcto@denominator
+ }
+ \ifdim\pgf@arcto@frac pt<0pt
+ \pgfmathsetmacro\pgf@arcto@factor{0}
+ \else
+ \pgfmathsetmacro\pgf@arcto@factor{sqrt(\pgf@arcto@frac)}
+ \fi
+ \ifx\pgf@arcto@fA\pgf@arcto@fS
+ \pgfmathsetmacro\pgf@arcto@factor{-\pgf@arcto@factor}
+ \fi
+ \pgfmathsetmacro\pgf@arcto@cxprime{
+ \pgf@arcto@factor*\pgf@arcto@rx@over@ry*\pgf@arcto@yaprime
+ }
+ \pgfmathsetmacro\pgf@arcto@cyprime{
+ -\pgf@arcto@factor*\pgf@arcto@ry@over@rx*\pgf@arcto@xaprime
+ }
+ %
+ % Step 6: Ok, now compute cx,cy
+ %
+ \pgftransformreset
+ \pgftransformrotate{\pgf@arcto@phi}
+ \pgf@process{
+ \pgfpointtransformed{\pgfqpoint{\pgf@arcto@cxprime pt}{\pgf@arcto@cyprime pt}}
+ }
+ \edef\pgf@arcto@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}
+ \pgf@process{\pgfpointadd{\pgf@arcto@temp}{
+ \pgfpointscale{.5}{
+ \pgfpointadd
+ {\pgfqpoint{\pgf@arcto@xa}{\pgf@arcto@ya}}
+ {\pgfqpoint{\pgf@arcto@xb}{\pgf@arcto@yb}} }
+ }
+ }
+ \edef\pgf@arcto@cx{\the\pgf@x}
+ \edef\pgf@arcto@cy{\the\pgf@y}
+ %
+ % Step 7: Compute start angle:
+ %
+ \pgfmathsetmacro\pgf@arcto@vec@x{(\pgf@arcto@xaprime-\pgf@arcto@cxprime)/\pgf@arcto@rx}
+ \pgfmathsetmacro\pgf@arcto@vec@y{(\pgf@arcto@yaprime-\pgf@arcto@cyprime)/\pgf@arcto@ry}
+ \pgfmathsetmacro\pgf@arcto@denominator{veclen(\pgf@arcto@vec@x,\pgf@arcto@vec@y)}
+ \pgfmathsetmacro\pgf@arcto@frac{\pgf@arcto@vec@x/\pgf@arcto@denominator}
+ \pgfmathsetmacro\pgf@arcto@theta@start{acos(\pgf@arcto@frac)}
+ \ifdim\pgf@arcto@vec@y pt<0pt
+ \pgfmathsetmacro\pgf@arcto@theta@start{-\pgf@arcto@theta@start}
+ \fi
+ %
+ % Step 8: Compute end angle:
+ %
+ \pgfmathsetmacro\pgf@arcto@vec@x{(-\pgf@arcto@xaprime-\pgf@arcto@cxprime)/\pgf@arcto@rx}
+ \pgfmathsetmacro\pgf@arcto@vec@y{(-\pgf@arcto@yaprime-\pgf@arcto@cyprime)/\pgf@arcto@ry}
+ \pgfmathsetmacro\pgf@arcto@denominator{veclen(\pgf@arcto@vec@x,\pgf@arcto@vec@y)}
+ \pgfmathsetmacro\pgf@arcto@frac{\pgf@arcto@vec@x/\pgf@arcto@denominator}
+ \pgfmathsetmacro\pgf@arcto@theta@end{acos(\pgf@arcto@frac)}
+ \ifdim\pgf@arcto@vec@y pt<0pt
+ \pgfmathsetmacro\pgf@arcto@theta@end{-\pgf@arcto@theta@end}
+ \fi
+ \pgfmathsetmacro\pgf@arcto@delta@theta{abs(\pgf@arcto@theta@start-\pgf@arcto@theta@end)}
+ \ifdim\pgf@arcto@fA pt=0pt%
+ \ifdim\pgf@arcto@delta@theta pt>180pt%
+ % Ok, we need to adjust the angle!
+ \ifdim\pgf@arcto@theta@end pt>\pgf@arcto@theta@start pt
+ \pgfmathsetmacro\pgf@arcto@theta@end{\pgf@arcto@theta@end-360}
+ \else
+ \pgfmathsetmacro\pgf@arcto@theta@end{\pgf@arcto@theta@end+360}
+ \fi
+ \fi
+ \else
+ \ifdim\pgf@arcto@delta@theta pt<180pt%
+ % Ok, we need to adjust the angle!
+ \ifdim\pgf@arcto@theta@end pt>\pgf@arcto@theta@start pt
+ \pgfmathsetmacro\pgf@arcto@theta@end{\pgf@arcto@theta@end-360}
+ \else
+ \pgfmathsetmacro\pgf@arcto@theta@end{\pgf@arcto@theta@end+360}
+ \fi
+ \fi
+ \fi
+ \xdef\pgf@marshal{\noexpand
+ \pgfpatharcaxes{\pgf@arcto@theta@start}{\pgf@arcto@theta@end}
+ {\noexpand\pgfpointpolar{\pgf@arcto@phi}{\pgf@arcto@rx}}
+ {\noexpand\pgfpointpolar{\pgf@arcto@phi+90}{\pgf@arcto@ry}}
+ }
+ \fi\fi\fi
+ }
+ \pgf@marshal
+}
+
+
+
+% the quality of arc approximation by means of Bezier splines is
+% controlled by a mesh width.
+%
+% The mesh width is provided in (full!) degrees. The smaller the mesh
+% width, the more precise the arc approximation.
+%
+% Use an empty value to disable spline approximation (uses a single
+% cubic polynomial for the complete arc).
+%
+% The value must be an integer!
+\def\pgfpatharctomaxstepsize{45}
+
+% A specialized arc operation for an arc on an (axis--parallel) ellipse.
+%
+% In contrast to \pgfpatharc, it explicitly interpolates start- and end points.
+%
+% In contrast to \pgfpatharcto, this routine is numerically stable and
+% quite fast since it relies on a lot of precomputed information.
+%
+% #1 center of ellipse
+% #2 angle of last path position inside of the ellipse
+% #3 end angle
+% #4 end point (a \pgfpoint)
+% #5 xradius
+% #6 yradius
+% #7 the ratio xradius/yradius of the ellipse
+% #8 the ratio yradius/xradius of the ellipse
+% Example:
+% \def\cx{1cm}% center x
+% \def\cy{1cm}% center y
+% \def\startangle{0}%
+% \def\endangle{45}%
+% \def\a{5cm}% xradius
+% \def\b{10cm}% yradius
+% \pgfmathparse{\a/\b}\let\abratio=\pgfmathresult
+% \pgfmathparse{\b/\a}\let\baratio=\pgfmathresult
+%
+% \pgfpathmoveto{\pgfpoint{\cx+\a*cos(\startangle)}{\cy+\b*sin(\startangle)}}%
+% \pgfpatharctoprecomputed
+% {\pgfpoint{\cx}{\cy}}
+% {\startangle}
+% {\endangle}
+% {\pgfpoint{\cx+\a*cos(\endangle)}{\cy+\b*sin(\endangle)}}%
+% {\a}
+% {\b}
+% {\abratio}
+% {\baratio}
+%
+\def\pgfpatharctoprecomputed#1#2#3#4#5#6#7#8{%
+ \begingroup
+ % Implementation idea:
+ %
+ % let
+ % m = center (#1)
+ % \gamma_0 = start angle
+ % \gamma_1 = end angle
+ % a = x radius
+ % b = y radius
+ %
+ % an axis parallel ellipse is parameterized by
+ % C(\gamma) = m + ( a cos(\gamma), b sin(\gamma) ), \gamma in [0,360].
+ %
+ % Now, consider the segment \gamma(t),
+ % \gamma:[0,1] -> [\gamma_0,\gamma_1],
+ % t -> \gamma_0 + t(\gamma_1 - \gamma_0)
+ % and
+ % C(\gamma(t)) which is defined on [0,1].
+ %
+ % I'd like to approximate the arc by one or more cubic bezier
+ % splines which interpolate through the last and first provided
+ % points.
+ %
+ % In general, a Bezier spline C:[0,1] -> \R of order n fulfills
+ % C'(0) = n ( P_1 - P_0 ),
+ % C'(1) = n ( P_n - P_{n-1} ).
+ % For n=3 and given P_0 and P_3, I can directly compute P_1 and P_2 once I know
+ % the derivatives at t=0 and t=1.
+ %
+ % The derivatives in our case are
+ % ( C \circ \gamma )'(t) = C'[\gamma(t)] * \gamma'(t)
+ % = ( -a pi/180 sin(\gamma(t)), b pi/180 cos(\gamma(t)) ) * (\gamma_1 - \gamma_0).
+ % The pi/180 comes into play since we are working with degrees.
+ %
+ % Expression (C\circ\gamma)'(0) using P_0 and (C \circ \gamma)'(1)
+ % using P_3 yields the expressions
+ % (C \circ \gamma)'(0) =
+ % pi/180 * (\gamma_1 - \gamma_0)* [ - a/b(P_0^y - my), b/a (P_0^x - mx) ]
+ % (C \circ \gamma)'(1) =
+ % pi/180 * (\gamma_1 - \gamma_0)* [ - a/b(P_3^y - my), b/a (P_3^x - mx) ]
+ %
+ % defining
+ % scaleA = a/b * pi / (3*180) * (\gamma_1 - \gamma_0)
+ % and
+ % scaleB = b/a * pi / (3*180) * (\gamma_1 - \gamma_0)
+ % yields the direct expressions for the intermediate bezier
+ % control points
+ %
+ % P_1 = [
+ % P_0^x - scaleA* ( P_0^y -my),
+ % P_0^y + scaleB* ( P_0^x -mx) ]
+ % and
+ % P_2 = [
+ % P_3^x + scaleA* ( P_3^y -my),
+ % P_3^y - scaleB* ( P_3^x -mx) ].
+ %
+ % This works fast, with few operations, if
+ % - a/b and b/a are known in advance
+ % - P_0 and P_3 are known in advance
+ % - \gamma_0 and \gamma_1 are known.
+ %
+ % It is also reliable if (\gamma_1 - \gamma_0) is small
+ %
+ \pgf@process{#1}%
+ \edef\pgfpath@center@x{\the\pgf@x}%
+ \edef\pgfpath@center@y{\the\pgf@y}%
+ \def\pgfpath@completearcend{#4}%
+ % compute scale (#3-#2) * pi/(3*180) = (#3 - #2) * pi/27 * 1/20
+ % splitting pi/(3*180) into two scales has higher TeX accuracy
+ \pgf@xa=#2pt
+ \pgf@xb=#3pt
+ \edef\pgfpath@startangle{#2pt}%
+ \edef\pgfpath@endangle{\pgf@sys@tonumber\pgf@xb}%
+ %
+ \pgf@ya=\pgf@xb
+ \advance\pgf@ya by-\pgf@xa
+ %
+ \ifx\pgfpatharctomaxstepsize\pgfutil@empty
+ \def\pgfpath@N{1}%
+ \pgf@xc=\pgf@ya
+ \else
+ \pgf@xc=\pgf@ya% compute N = floor((gamma_1 - gamma_0) / max) +1
+ \ifdim\pgf@xc<0pt
+ \multiply\pgf@xc by-1
+ \fi
+ \divide\pgf@xc by\pgfpatharctomaxstepsize\relax
+ \afterassignment\pgfutil@gobble@until@relax
+ \c@pgf@counta=\the\pgf@xc\relax
+ \advance\c@pgf@counta by1
+ \edef\pgfpath@N{\the\c@pgf@counta}%
+ %
+ \pgf@xc=\pgf@ya
+ \divide\pgf@xc by\c@pgf@counta
+ \fi
+ %
+ \edef\pgfpath@h{\pgf@sys@tonumber\pgf@xc}%
+ %
+%\message{pgfpathellipse: using N =\pgfpath@N\space spline points y0 = \pgfpath@startangle, y0+i*h, yN=\pgfpath@endangle, i=1,...,(\pgfpath@N-1), with h=\pgfpath@h\space mesh width (total arc angle \pgf@sys@tonumber\pgf@ya).}%
+ %
+ %
+ \pgf@xc=0.116355283466289\pgf@xc % pi/27
+ \divide\pgf@xc by20
+ \pgf@xa=#7\pgf@xc
+ \edef\pgfpath@scale@A{\pgf@sys@tonumber\pgf@xa}%
+ \pgf@xa=#8\pgf@xc
+ \edef\pgfpath@scale@B{\pgf@sys@tonumber\pgf@xa}%
+ %
+ % compute intermediate spline segments for
+ % i = 1,...,N-1
+ % this is a no-op for N=1.
+ \c@pgf@countd=1
+ \pgfutil@loop
+ \ifnum\c@pgf@countd<\pgfpath@N\relax
+ %
+ \pgf@xa=\pgfpath@startangle % compute \pgf@xa = y_0 + i*h
+ \pgf@xb=\pgfpath@h pt
+ \multiply\pgf@xb by\c@pgf@countd
+ \advance\pgf@xa by\pgf@xb
+ \edef\pgfpath@angle@i{\pgf@sys@tonumber\pgf@xa}%
+%\message{angle \the\c@pgf@countd: \pgfpath@angle@i...}%
+ %
+ \pgfpatharcofellipse@{%
+ \pgfpoint
+ {\pgfpath@center@x + #5*cos(\pgfpath@angle@i)}
+ {\pgfpath@center@y + #6*sin(\pgfpath@angle@i)}
+ }%
+ %
+ \advance\c@pgf@countd by1
+ \pgfutil@repeat
+ %
+ % compute final spline segment. It only differs insofar as the
+ % final point is already known explicitly and should be
+ % interpolated without additional math error.
+%\message{angle \pgfpath@N: \pgfpath@endangle...}%
+ \pgfpatharcofellipse@{\pgfpath@completearcend}%
+ \endgroup
+}%
+\def\pgfpatharcofellipse@#1{%
+ \begingroup
+ \pgf@process{#1}%
+ \edef\pgfpath@endpt{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}%
+ %
+ \pgfpathcurveto{
+ \begingroup
+ \global\pgf@x=\pgf@path@lastx
+ \global\pgf@y=\pgf@path@lasty
+ \pgf@xa=\pgf@x \advance\pgf@xa by-\pgfpath@center@x
+ \pgf@ya=\pgf@y \advance\pgf@ya by-\pgfpath@center@y
+ \global\advance\pgf@x by-\pgfpath@scale@A\pgf@ya
+ \global\advance\pgf@y by \pgfpath@scale@B\pgf@xa
+ \endgroup
+ }{%
+ \begingroup
+ \pgfpath@endpt
+ \pgf@xa=\pgf@x \advance\pgf@xa by-\pgfpath@center@x
+ \pgf@ya=\pgf@y \advance\pgf@ya by-\pgfpath@center@y
+ \global\advance\pgf@x by \pgfpath@scale@A\pgf@ya
+ \global\advance\pgf@y by-\pgfpath@scale@B\pgf@xa
+ \endgroup
+ }{%
+ \pgfpath@endpt
+ }%
+ \endgroup
+}
+
+
+
+
+
+
+
+
% Append an ellipse to the current path.
%
@@ -432,16 +903,16 @@
\pgfsyssoftpath@moveto{\the\pgf@xa}{\the\pgf@ya}%
\pgf@protocolsizes{\pgf@xa}{\pgf@ya}%
}%
- \pgf@x=0.555\pgf@xb% first arc
- \pgf@y=0.555\pgf@yb%
+ \pgf@x=0.55228475\pgf@xb% first arc
+ \pgf@y=0.55228475\pgf@yb%
\advance\pgf@x by\pgf@xa%
\advance\pgf@y by\pgf@ya%
\advance\pgf@x by\pgf@xc%
\advance\pgf@y by\pgf@yc%
\edef\pgf@temp{{\the\pgf@x}{\the\pgf@y}}%
\pgf@protocolsizes{\pgf@x}{\pgf@y}%
- \pgf@x=0.555\pgf@xa%
- \pgf@y=0.555\pgf@ya%
+ \pgf@x=0.55228475\pgf@xa%
+ \pgf@y=0.55228475\pgf@ya%
\advance\pgf@x by\pgf@xb%
\advance\pgf@y by\pgf@yb%
{%
@@ -455,16 +926,16 @@
}%
\pgf@xa=-\pgf@xa% flip first axis
\pgf@ya=-\pgf@ya%
- \pgf@x=0.555\pgf@xa% second arc
- \pgf@y=0.555\pgf@ya%
+ \pgf@x=0.55228475\pgf@xa% second arc
+ \pgf@y=0.55228475\pgf@ya%
\advance\pgf@x by\pgf@xb%
\advance\pgf@y by\pgf@yb%
\advance\pgf@x by\pgf@xc%
\advance\pgf@y by\pgf@yc%
\edef\pgf@temp{{\the\pgf@x}{\the\pgf@y}}%
\pgf@protocolsizes{\pgf@x}{\pgf@y}%
- \pgf@x=0.555\pgf@xb%
- \pgf@y=0.555\pgf@yb%
+ \pgf@x=0.55228475\pgf@xb%
+ \pgf@y=0.55228475\pgf@yb%
\advance\pgf@x by\pgf@xa%
\advance\pgf@y by\pgf@ya%
{%
@@ -478,16 +949,16 @@
}%
\pgf@xb=-\pgf@xb% flip second axis
\pgf@yb=-\pgf@yb%
- \pgf@x=0.555\pgf@xb% third arc
- \pgf@y=0.555\pgf@yb%
+ \pgf@x=0.55228475\pgf@xb% third arc
+ \pgf@y=0.55228475\pgf@yb%
\advance\pgf@x by\pgf@xa%
\advance\pgf@y by\pgf@ya%
\advance\pgf@x by\pgf@xc%
\advance\pgf@y by\pgf@yc%
\edef\pgf@temp{{\the\pgf@x}{\the\pgf@y}}%
\pgf@protocolsizes{\pgf@x}{\pgf@y}%
- \pgf@x=0.555\pgf@xa%
- \pgf@y=0.555\pgf@ya%
+ \pgf@x=0.55228475\pgf@xa%
+ \pgf@y=0.55228475\pgf@ya%
\advance\pgf@x by\pgf@xb%
\advance\pgf@y by\pgf@yb%
{%
@@ -501,16 +972,16 @@
}%
\pgf@xa=-\pgf@xa% flip first axis once more
\pgf@ya=-\pgf@ya%
- \pgf@x=0.555\pgf@xa% fourth arc
- \pgf@y=0.555\pgf@ya%
+ \pgf@x=0.55228475\pgf@xa% fourth arc
+ \pgf@y=0.55228475\pgf@ya%
\advance\pgf@x by\pgf@xb%
\advance\pgf@y by\pgf@yb%
\advance\pgf@x by\pgf@xc%
\advance\pgf@y by\pgf@yc%
\edef\pgf@temp{{\the\pgf@x}{\the\pgf@y}}%
\pgf@protocolsizes{\pgf@x}{\pgf@y}%
- \pgf@x=0.555\pgf@xb%
- \pgf@y=0.555\pgf@yb%
+ \pgf@x=0.55228475\pgf@xb%
+ \pgf@y=0.55228475\pgf@yb%
\advance\pgf@x by\pgf@xa%
\advance\pgf@y by\pgf@ya%
{%
@@ -887,4 +1358,110 @@
}
+
+% Draw part of a curve between two specified times s and t.
+%
+% #1 - a start time s.
+% #2 - an end time t.
+% #3 - start point of the curve
+% #4 - first control
+% #5 - second control
+% #6 - end point of the curve
+%
+% There are two versions, \pgfpathcurvebetweentime and
+% \pgfpathcurvebetweentimecontinue. The latter does not insert a
+% moveto to the first point.
+%
+\def\pgfpathcurvebetweentime{\pgf@ignoremovetofalse\pgf@@pathcurvebetweentime}
+\def\pgfpathcurvebetweentimecontinue{\pgf@ignoremovetotrue\pgf@@pathcurvebetweentime}
+\newif\ifpgf@ignoremoveto
+
+\def\pgf@@pathcurvebetweentime#1#2#3#4#5#6{%
+ \pgfmathparse{#1}%
+ \let\pgf@time@s=\pgfmathresult%
+ \pgfmathparse{#2}%
+ \let\pgf@time@t=\pgfmathresult%
+ \ifdim\pgf@time@s pt>\pgf@time@t pt\relax%
+ \pgfmathsetmacro\pgf@time@s{1-#1}%
+ \pgfmathsetmacro\pgf@time@t{1-#2}%
+ \pgf@@@pathcurvebetweentime{\pgf@time@t}{#6}{#5}{#4}{#3}%
+ \else%
+ \pgf@@@pathcurvebetweentime{\pgf@time@t}{#3}{#4}{#5}{#6}%
+ \fi%
+}
+
+\def\pgf@@@pathcurvebetweentime#1#2#3#4#5{%
+ % Q1 = P1.
+ \pgf@process{#2}%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ % Q2 = P1 + t*(P2-P1).
+ \pgf@process{%
+ \pgf@process{#3}%
+ \pgf@xa=#1\pgf@x%
+ \pgf@ya=#1\pgf@y%
+ \pgf@process{#2}%
+ \pgf@xb=\pgf@x%
+ \pgf@yb=\pgf@y%
+ \advance\pgf@x by-#1\pgf@xb%
+ \advance\pgf@y by-#1\pgf@yb%
+ \advance\pgf@x by\pgf@xa%
+ \advance\pgf@y by\pgf@ya%
+ }%
+ \pgf@xb=\pgf@x%
+ \pgf@yb=\pgf@y%
+ % Q3 = Q2 + t*((P2 + t*(P3-P2)) - Q2).
+ \pgf@process{%
+ \pgf@process{#4}%
+ \pgf@xa=#1\pgf@x%
+ \pgf@ya=#1\pgf@y%
+ %
+ \pgf@process{#3}%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \advance\pgf@xc by-#1\pgf@x%
+ \advance\pgf@yc by-#1\pgf@y%
+ %
+ \pgf@x=\pgf@xb%
+ \pgf@y=\pgf@yb%
+ \advance\pgf@x by#1\pgf@xa%
+ \advance\pgf@y by#1\pgf@ya%
+ \advance\pgf@x by-#1\pgf@xb%
+ \advance\pgf@y by-#1\pgf@yb%
+ \advance\pgf@x by#1\pgf@xc%
+ \advance\pgf@y by#1\pgf@yc%
+ }%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ % Q4 = (1-t)^3*P1 + 3*t(1-t)^2*P2 + 3*t^2(1-t)*P3 + t^3*P4.
+ \pgf@process{\pgfpointcurveattime{#1}{#2}{#3}{#4}{#5}}%
+ \ifx#1\pgf@time@t%
+ % First time round...
+ \pgfmathdivide@{\pgf@time@s}{\pgf@time@t}%
+ \pgfmathadd@{-\pgfmathresult}{1}%
+ \let\pgf@time@s=\pgfmathresult%
+ \edef\pgf@marshal{%
+ \noexpand\pgf@@@pathcurvebetweentime{\noexpand\pgf@time@s}%
+ {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}%
+ {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}%
+ }%
+ \else%
+ % ...second time round.
+ \ifpgf@ignoremoveto%
+ \edef\pgf@marshal{%
+ \noexpand\pgfpathcurveto{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}%
+ {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}%
+ }%
+ \else%
+ \edef\pgf@marshal{%
+ \noexpand\pgfpathmoveto{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ \noexpand\pgfpathcurveto{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}%
+ {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}%
+ }%
+ \fi%
+ \fi%
+ \pgf@marshal%
+}
+
+
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex
index a8da0ca9410..9bcfc739f56 100644
--- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex,v 1.7 2008/01/23 15:22:29 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex,v 1.8 2008/10/09 16:46:56 tantau Exp $
@@ -301,8 +301,8 @@
\pgf@y=\pgf@yb%
\advance\pgf@x by-\pgf@xa%
\advance\pgf@y by-\pgf@ya%
- \advance\pgf@xa by 0.555\pgf@x%
- \advance\pgf@ya by 0.555\pgf@y%
+ \advance\pgf@xa by 0.5522847\pgf@x%
+ \advance\pgf@ya by 0.5522847\pgf@y%
\edef\pgfprocess@addition{\noexpand\pgfsyssoftpath@curvetosupportatoken{\the\pgf@xa}{\the\pgf@ya}}%
\expandafter\pgfutil@g@addto@macro\expandafter\pgfprocess@segment\expandafter{\pgfprocess@addition}%
}%
@@ -312,8 +312,8 @@
\pgf@y=\pgf@yb%
\advance\pgf@x by-\pgf@xc%
\advance\pgf@y by-\pgf@yc%
- \advance\pgf@xc by 0.555\pgf@x%
- \advance\pgf@yc by 0.555\pgf@y%
+ \advance\pgf@xc by 0.5522847\pgf@x%
+ \advance\pgf@yc by 0.5522847\pgf@y%
\edef\pgfprocess@addition{\noexpand\pgfsyssoftpath@curvetosupportbtoken{\the\pgf@xc}{\the\pgf@yc}}%
\expandafter\pgfutil@g@addto@macro\expandafter\pgfprocess@segment\expandafter{\pgfprocess@addition}%
}%
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex
index e14a4e44447..b803cce9caf 100644
--- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepathusage.code.tex,v 1.11 2008/01/23 13:15:28 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepathusage.code.tex,v 1.12 2008/04/22 17:03:26 tantau Exp $
% Stroke/fill/clip/etc. the current path. Depending on the options,
@@ -96,12 +96,14 @@
\pgfsyssoftpath@invokecurrentpath%
\pgfsyssoftpath@getcurrentpath\pgf@last@used@path%
\pgf@up@action%
+ \pgf@stroke@inner@line@if@needed%
\pgfsyssoftpath@setcurrentpath\pgfutil@empty%
\pgf@add@arrows@as@needed%
\else%
\pgfsyssoftpath@invokecurrentpath%
\pgfsyssoftpath@getcurrentpath\pgf@last@used@path%
\pgf@up@action%
+ \pgf@stroke@inner@line@if@needed%
\fi%
\fi%
\else%
@@ -117,6 +119,18 @@
\ignorespaces%
}
+\def\pgf@stroke@inner@line@if@needed{%
+ \ifdim\pgfinnerlinewidth>0pt\relax%
+ \pgfsys@beginscope%
+ {%
+ \pgfsys@setlinewidth{\pgfinnerlinewidth}%
+ \pgfsetstrokecolor{\pgfinnerstrokecolor}%
+ \pgfsyssoftpath@invokecurrentpath%
+ \pgfsys@stroke%
+ }%
+ \pgfsys@endscope%
+ \fi%
+}
% Shorten start/end of paths by a certain amount.
%
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex
index a3f6eb12502..b308c5aef8f 100644
--- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex
@@ -7,16 +7,16 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepatterns.code.tex,v 1.1 2008/01/15 10:27:34 tantau Exp $
-
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepatterns.code.tex,v 1.3 2009/07/02 11:43:15 tantau Exp $
% Creates a new uncolored pattern
%
-% #1 = pattern name
-% #2 = lower left of bounding box
-% #3 = upper right of bounding box
-% #4 = step vector
-% #5 = pattern code
+% [#1] = optional list of variables.
+% #2 = pattern name
+% #3 = lower left of bounding box
+% #4 = upper right of bounding box
+% #5 = step vector
+% #6 = pattern code
%
% Description:
%
@@ -26,6 +26,8 @@
%
% See the pdf-manual for more details on uncolored patterns.
%
+% Specifying a variable list makes the pattern ``mutable''.
+%
% The bounding box must be a bounding box of the pattern cell.
%
% The step vector must provide the x- and y-step by which the cells
@@ -49,16 +51,21 @@
% \pgfpathclose%
% \pgfusepath{stroke}
% }
+%
+\def\pgfdeclarepatternformonly{%
+ \def\pgf@pattern@type{formonly}%
+ \pgfutil@ifnextchar[{\pgf@declarepattern@checkarg}{\pgf@declarepattern@checkarg[]}%
+}
-\def\pgfdeclarepatternformonly#1#2#3#4#5{\pgf@declarepattern{#1}{#2}{#3}{#4}{#5}{0}}
% Creates a new colored pattern
%
-% #1 = pattern name
-% #2 = lower left of bounding box
-% #3 = upper right of bounding box
-% #4 = step vector
-% #5 = pattern code
+% [#1] = optional list of variables.
+% #2 = pattern name
+% #3 = lower left of bounding box
+% #4 = upper right of bounding box
+% #5 = step vector
+% #6 = pattern code
%
% Description:
%
@@ -83,8 +90,38 @@
% \pgfpathclose%
% \pgfusepath{stroke,fill}
% }
+%
+\def\pgfdeclarepatterninherentlycolored{%
+ \def\pgf@pattern@type{inherentlycolored}%
+ \pgfutil@ifnextchar[{\pgf@declarepattern@checkarg}{\pgf@declarepattern@checkarg[]}%
+}
+
+
-\def\pgfdeclarepatterninherentlycolored#1#2#3#4#5{\pgf@declarepattern{#1}{#2}{#3}{#4}{#5}{1}}
+
+
+\def\pgf@declarepattern@checkarg[#1]{%
+ \def\pgf@pattern@tempvars{#1}%
+ \ifx\pgf@pattern@tempvars\pgfutil@empty%
+ \expandafter\let\expandafter\pgf@next\csname pgf@declarepattern\pgf@pattern@type\endcsname%
+ \else%
+ \expandafter\let\expandafter\pgf@next\csname pgf@declarepattern\pgf@pattern@type @mutable\endcsname%
+ \fi%
+ \pgf@next}
+
+\long\def\pgf@declarepatternformonly#1#2#3#4#5{\pgf@declarepattern{#1}{#2}{#3}{#4}{#5}{0}}
+
+\long\def\pgf@declarepatterninherentlycolored#1#2#3#4#5{\pgf@declarepattern{#1}{#2}{#3}{#4}{#5}{1}}
+
+\long\def\pgf@declarepatternformonly@mutable#1#2#3#4#5{%
+ \def\pgf@marshal{\pgf@declarepatternmutable{#1}}%
+ \expandafter\pgf@marshal\expandafter{\pgf@pattern@tempvars}{#2}{#3}{#4}{#5}{2}%
+}
+
+\long\def\pgf@declarepatterninherentlycolored@mutable#1#2#3#4#5#6{%
+ \def\pgf@marshal{\pgf@declarepatternmutable{#1}}%
+ \expandafter\pgf@marshal\expandafter{\pgf@pattern@tempvars}{#2}{#3}{#4}{#5}{3}%
+}
\def\pgf@declarepattern#1#2#3#4#5#6{%
\pgfutil@ifundefined{pgf@pattern@name@#1}{%
@@ -125,16 +162,37 @@
\expandafter\global\expandafter\let\csname pgf@pattern@instantiate@#1\endcsname=\pgf@marshal%
}
{%
- \PackageError{pgfbasepatterns}{Pattern `#1' already defined}{}%
+ \PackageError{pgfcorepatterns}{Pattern `#1' already defined}{}%
}%
}
\def\pgf@pattern@number{0}%
+\def\pgf@declarepatternmutable#1#2#3#4#5#6#7{%
+ \pgfutil@ifundefined{pgf@pattern@name@#1}{%
+ \expandafter\gdef\csname pgf@pattern@name@#1\endcsname{#1}%
+ \expandafter\gdef\csname pgf@pattern@variables@#1\endcsname{#2}%
+ \expandafter\gdef\csname pgf@pattern@lowerleft@#1\endcsname{#3}%
+ \expandafter\gdef\csname pgf@pattern@upperright@#1\endcsname{#4}%
+ \expandafter\gdef\csname pgf@pattern@tilesize@#1\endcsname{#5}%
+ \expandafter\long\expandafter\gdef\csname pgf@pattern@code@#1\endcsname{#6}%
+ \expandafter\gdef\csname pgf@pattern@type@#1\endcsname{7}%
+ }{\PackageError{pgfcorepatterns}{The pattern `#1' is already defined}{}}%
+}
+
\def\pgf@ifpatternisinherentlycolored#1#2#3{%
- \expandafter\ifnum\csname pgf@pattern@type@#1\endcsname=1\relax#2\else#3\fi%
+ \expandafter\ifodd\csname pgf@pattern@type@#1\endcsname\relax#2\else#3\fi%
}
+\def\pgf@ifpatternismutable#1#2#3{%
+ \expandafter\ifnum\csname pgf@pattern@type@#1\endcsname>1\relax#2\else#3\fi%
+}
+
+\def\pgfpatternreleasename#1{\expandafter\let\csname pgf@pattern@name@#1\endcsname\relax}
+
+
+
+
% Set an pattern as fill color
@@ -150,10 +208,51 @@
% Example:
%
% \pgfsetfillpattern{stars}{red}
-
+%
\def\pgfsetfillpattern#1#2{%
+ \pgfutil@ifundefined{pgf@pattern@name@#1}%
+ {%
+ \PackageError{pgfcorepatterns}{Undefined pattern `#1'}{}%
+ }%
+ {%
+ \pgf@ifpatternismutable{#1}%
+ {%
+ % So, a mutable pattern. Check to see if the pattern
+ % has been used with the current variable values...
+ \let\pgf@pattern@tempvars\pgfutil@empty%
+ \expandafter\expandafter\expandafter\pgf@pattern@check@vars%
+ \csname pgf@pattern@variables@#1\endcsname,\pgf@stop,%
+ \edef\pgf@pattern@nametemp{pgf@pattern@#1@\pgf@pattern@tempvars}%
+ \expandafter\pgfutil@ifundefined\expandafter{\pgf@pattern@nametemp}%
+ {%
+ % ...Nope. So declare a new instance of the mutable pattern.
+ \pgf@ifpatternisinherentlycolored{#1}%
+ {\let\pgf@set@fillpattern@declare\pgfdeclarepatterninherentlycolored}%
+ {\let\pgf@set@fillpattern@declare\pgfdeclarepatternformonly}%
+ \pgf@set@fillpattern@declare%
+ {\pgf@pattern@nametemp}%
+ {\csname pgf@pattern@lowerleft@#1\endcsname}%
+ {\csname pgf@pattern@upperright@#1\endcsname}%
+ {\csname pgf@pattern@tilesize@#1\endcsname}%
+ {\csname pgf@pattern@code@#1\endcsname}%
+ }%
+ {%
+ % ...Yep. So do nothing.
+ }%
+ \expandafter\pgf@set@fillpattern\expandafter{\pgf@pattern@nametemp}{#2}%
+ \expandafter\gdef\csname\pgf@pattern@nametemp\endcsname{#1}%
+ }%
+ {%
+ % A non-mutable pattern.
+ \pgf@set@fillpattern{#1}{#2}%
+ }%
+ }%
+}
+
+
+\def\pgf@set@fillpattern#1#2{%
\pgfutil@ifundefined{pgf@pattern@name@#1}{%
- \PackageError{pgfbasepatterns}{Undefined pattern `#1'}{}}
+ \PackageError{pgfcorepatterns}{Undefined pattern `#1'}{}}
{%
\csname pgf@pattern@instantiate@#1\endcsname%
\expandafter\global\expandafter\let\csname pgf@pattern@instantiate@#1\endcsname=\relax%
@@ -168,11 +267,30 @@
}%
}%
}
+
\def\pgf@set@fill@patternuncolored#1,#2,#3\relax#4{%
\pgfsys@setpatternuncolored{\csname pgf@pattern@name@#4\endcsname}{#1}{#2}{#3}%
}
-
-
+\def\pgf@pattern@check@vars#1,{%
+ \ifx#1\pgf@stop%
+ \let\pgf@next\relax%
+ \else%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \expandafter\let\expandafter\pgf@pattern@char#1#1\pgfmath@%
+ \ifx\pgf@pattern@char/%
+ \edef\pgf@pattern@tempvar{(\pgfkeysvalueof{#1})}%
+ \else%
+ \expandafter\ifcat\pgf@pattern@char\relax%
+ \edef\pgf@pattern@tempvar{(\the#1)}%
+ \else%
+ \edef\pgf@pattern@tempvar{(#1)}%
+ \fi%
+ \fi%
+ \edef\pgf@pattern@tempvars{\pgf@pattern@tempvars\pgf@pattern@tempvar}%
+ \let\pgf@next\pgf@pattern@check@vars%
+ \fi%
+ \pgf@next%
+}
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex
index 3ab2b4e009b..79cb3a06f77 100644
--- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepoints.code.tex,v 1.13 2008/02/03 19:37:26 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepoints.code.tex,v 1.20 2010/04/09 08:53:45 ludewich Exp $
\newdimen\pgf@picminx
\newdimen\pgf@picmaxx
@@ -35,7 +35,7 @@
\def\pgfextract@process#1#2{%
\pgf@process{#2}%
- \edef#1{\noexpand\pgf@x\the\pgf@x\noexpand\pgf@y\the\pgf@y}%
+ \edef#1{\noexpand\pgf@x=\the\pgf@x\noexpand\relax\noexpand\pgf@y=\the\pgf@y\noexpand\relax}%
}
% This needed until old shapes code changed.
\let\pgfsavepgf@process\pgfextract@process%
@@ -172,6 +172,14 @@
\def\pgfpointscale#1#2{%
\pgf@process{#2}%
+ \pgfmathparse{#1}%
+ \pgf@x=\pgfmathresult\pgf@x%
+ \pgf@y=\pgfmathresult\pgf@y%
+}
+% A "quick" variant of \pgfpointscale which doesn't invoke the math parser for '#1'.
+% #1 must be a number without units, no registers are accepted.
+\def\pgfqpointscale#1#2{%
+ \pgf@process{#2}%
\pgf@x=#1\pgf@x%
\pgf@y=#1\pgf@y%
}
@@ -736,6 +744,15 @@
\advance\pgf@y by \pgftemp@y\pgf@yy}
+% "Quick" variant for \pgfpointxy.
+%
+% Only numbers without unit are allowed here.
+\def\pgfqpointxy#1#2{%
+ \pgf@x=#1\pgf@xx%
+ \advance\pgf@x by #2\pgf@yx%
+ \pgf@y=#1\pgf@xy%
+ \advance\pgf@y by #2\pgf@yy}
+
% Store the vector #1 * x-vec + #2 * y-vec + #3 * z-vec
%
% #1 = a factor for the x-vector
@@ -782,6 +799,16 @@
\advance\pgf@y by \pgftemp@y\pgf@yy%
\advance\pgf@y by \pgftemp@z\pgf@zy}
+% "Quick" variant for \pgfpointxyz.
+%
+% Only numbers without unit are allowed.
+\def\pgfqpointxyz#1#2#3{%
+ \pgf@x=#1\pgf@xx%
+ \advance\pgf@x by #2\pgf@yx%
+ \advance\pgf@x by #3\pgf@zx%
+ \pgf@y=#1\pgf@xy%
+ \advance\pgf@y by #2\pgf@yy%
+ \advance\pgf@y by #3\pgf@zy}
@@ -913,7 +940,7 @@
\pgf@x=0pt\relax%
\else%
\divide\c@pgf@countb by \c@pgf@counta%
- \pgf@y=\csname pgf@cosfrac\the\c@pgf@countb\endcsname pt%
+ \pgf@y=\csname pgfmath@cosfrac@\the\c@pgf@countb\endcsname pt%
\pgf@xc=8192pt%
\divide\pgf@xc by\c@pgf@counta%
\pgf@x=\pgf@sys@tonumber{\pgf@xc}\pgf@xa%
@@ -1114,6 +1141,13 @@
#1=\pgf@y\relax}
+% Stores the most recently used (x,y) coordinates into two macros, #1
+% and #2.
+\def\pgfgetlastxy#1#2{%
+ \edef#1{\the\pgf@x}%
+ \edef#2{\the\pgf@y}%
+}%
+
\def\pgf@def#1#2#3{\expandafter\def\csname pgf@#1#2\endcsname{#3}}
\pgf@def{cosfrac}{0}{1}
@@ -1168,6 +1202,4 @@
\pgf@def{cosfrac}{97}{0.717792} \pgf@def{cosfrac}{98}{0.714213}
\pgf@def{cosfrac}{99}{0.710651} \pgf@def{cosfrac}{100}{0.707107}
-
-
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex
index 84a432ceadb..d5817ce4282 100644
--- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorequick.code.tex,v 1.2 2006/10/11 15:22:25 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorequick.code.tex,v 1.3 2008/10/09 16:46:56 tantau Exp $
% Quick version of basic drawing commands. Most high-level commands
% are not available if these commands are used.
@@ -76,7 +76,7 @@
\def\pgfpathqcircle#1{%
{%
\pgf@x=#1%
- \pgf@y=0.555\pgf@x%
+ \pgf@y=0.5522847\pgf@x%
\pgfsyssoftpath@moveto{\the\pgf@x}{0pt}%
\pgfsyssoftpath@curveto{\the\pgf@x}{\the\pgf@y}{\the\pgf@y}{\the\pgf@x}{0pt}{\the\pgf@x}%
\pgfsyssoftpath@curveto{-\the\pgf@y}{\the\pgf@x}{-\the\pgf@x}{\the\pgf@y}{-\the\pgf@x}{0pt}%
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex
index b637ff10ded..558f715788c 100644
--- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorescopes.code.tex,v 1.26 2008/01/15 10:27:34 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorescopes.code.tex,v 1.34 2010/09/08 15:07:18 tantau Exp $
% Globals
@@ -31,82 +31,6 @@
-% Library files inclusion
-
-
-% Include a library file.
-%
-% #1 = List of names of library file.
-%
-% Description:
-%
-% This command includes a list of library files. For each file X in the
-% list, the file pgflibraryX.code.tex is included, provided this has
-% not been done earlier.
-%
-% For the convenience of Context users, both round and square brackets
-% are possible for the argument.
-%
-% Example:
-%
-% \usepgflibrary{arrows}
-% \usepgflibrary[patterns,snakes]
-
-\def\usepgflibrary{\pgfutil@ifnextchar[{\use@pgflibrary}{\use@@pgflibrary}}%}
-\def\use@pgflibrary[#1]{\use@@pgflibrary{#1}}
-\def\use@@pgflibrary#1{%
- \edef\pgf@list{#1}%
- \pgfutil@for\pgf@temp:=\pgf@list\do{%
- \expandafter\ifx\csname pgf@library@\pgf@temp @loaded\endcsname\relax%
- \expandafter\let\csname pgf@library@\pgf@temp @loaded\endcsname=\pgfutil@empty%
- \expandafter\edef\csname pgf@library@#1@atcode\endcsname{\the\catcode`\@}
- \expandafter\edef\csname pgf@library@#1@barcode\endcsname{\the\catcode`\|}
- \catcode`\@=11
- \catcode`\|=12
- \input pgflibrary\pgf@temp.code.tex
- \catcode`\@=\csname pgf@library@#1@atcode\endcsname
- \catcode`\|=\csname pgf@library@#1@barcode\endcsname
- \fi%
- }%
-}
-
-
-% Include a module file.
-%
-% #1 = List of names of module files.
-%
-% Description:
-%
-% This command includes a list of module files. For each file X in the
-% list, the file pgfmoduleX.code.tex is included, provided this has
-% not been done earlier.
-%
-% For the convenience of Context users, both round and square brackets
-% are possible for the argument.
-%
-% Example:
-%
-% \usepgfmodule{matrix}
-
-\def\usepgfmodule{\pgfutil@ifnextchar[{\use@pgfmodule}{\use@@pgfmodule}}%}
-\def\use@pgfmodule[#1]{\use@@pgfmodule{#1}}
-\def\use@@pgfmodule#1{%
- \edef\pgf@list{#1}%
- \pgfutil@for\pgf@temp:=\pgf@list\do{%
- \expandafter\ifx\csname pgf@module@\pgf@temp @loaded\endcsname\relax%
- \expandafter\let\csname pgf@module@\pgf@temp @loaded\endcsname=\pgfutil@empty%
- \expandafter\edef\csname pgf@module@#1@atcode\endcsname{\the\catcode`\@}
- \expandafter\edef\csname pgf@module@#1@barcode\endcsname{\the\catcode`\|}
- \catcode`\@=11
- \catcode`\|=12
- \input pgfmodule\pgf@temp.code.tex
- \catcode`\@=\csname pgf@module@#1@atcode\endcsname
- \catcode`\|=\csname pgf@module@#1@barcode\endcsname
- \fi%
- }%
-}
-
-
% Scopes
@@ -268,6 +192,13 @@
\newif\ifpgfpicture
+\def\pgfresetboundingbox{%
+ \global\pgf@picmaxx=-16000pt\relax%
+ \global\pgf@picminx=16000pt\relax%
+ \global\pgf@picmaxy=-16000pt\relax%
+ \global\pgf@picminy=16000pt\relax%
+}%
+
\def\pgfpicture{%
\begingroup%
\pgfpicturetrue%
@@ -306,7 +237,7 @@
\let\setlength=\pgf@setlength%
\let\addtolength=\pgf@addtolength%
\let\selectfont=\pgf@selectfont%
- \nullfont\spaceskip\z@\xspaceskip\z@%
+ \nullfont\spaceskip0pt\xspaceskip0pt%
\setbox\pgf@layerbox@main\hbox to0pt\bgroup%
\begingroup%
}
@@ -325,7 +256,21 @@
% Shift baseline outside:
\pgf@relevantforpicturesizefalse%
\pgf@process{\pgf@baseline}%
- \gdef\pgf@shift@baseline{\the\pgf@y}%
+ \xdef\pgf@shift@baseline{\the\pgf@y}%
+ %
+ \pgf@process{\pgf@trimleft}%
+ \global\advance\pgf@x by-\pgf@picminx
+ % prepare \hskip\pgf@trimleft@final.
+ % note that \pgf@trimleft@final is also queried
+ % by the pgf image externalization.
+ \xdef\pgf@trimleft@final{-\the\pgf@x}%
+ %
+ \pgf@process{\pgf@trimright}%
+ \global\advance\pgf@x by-\pgf@picmaxx
+ % prepare \hskip\pgf@trimright@final.
+ % note that \pgf@trimright@final is also queried
+ % by the pgf image externalization.
+ \xdef\pgf@trimright@final{\the\pgf@x}%
\endgroup%
\hss%
\egroup%
@@ -396,6 +341,7 @@
\pgfsetbaselinepointlater{\pgf@setter@baseline}%
}
+\def\pgf@default@text{default}%
% Sets the baseline
%
@@ -407,11 +353,65 @@
% Example:
%
% \pgfsetbaseline{1cm+2pt}
-
-\def\pgfsetbaseline#1{\pgfsetbaselinepointlater{\pgfpoint{0pt}{#1}}}
+% \pgfsetbaseline{default}% resets to default value
+
+\def\pgfsetbaseline#1{%
+ \def\pgf@temp{#1}%
+ \ifx\pgf@temp\pgf@default@text
+ \pgfsetbaseline{\pgf@picminy}%
+ \else
+ \pgfsetbaselinepointlater{\pgfpoint{0pt}{#1}}%
+ \fi
+}
\pgfsetbaseline{\pgf@picminy}
+% controls how the image externalization implements trim:
+\newif\ifpgf@trim@lowlevel
+\pgfkeys{
+ /pgf/trim lowlevel/.is if=pgf@trim@lowlevel,
+ /pgf/trim lowlevel/.default=true,
+}
+% Same as the y-baseline for horizontal alignment.
+% The effect is different, though: it is some kind of trimming which
+% leaves the bounding box intact.
+\def\pgfsettrimleftpointlater#1{\def\pgf@trimleft{#1}}
+\def\pgfsettrimleftpointnow#1{%
+ \pgf@process{#1}%
+ \edef\pgf@setter@baseline{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}%
+ \pgfsettrimleftpointlater{\pgf@setter@baseline}%
+}
+% \pgfsettrimleft{<x coord>}
+% or
+% \pgfsettrimleft{default}
+\def\pgfsettrimleft#1{%
+ \def\pgf@temp{#1}%
+ \ifx\pgf@temp\pgf@default@text
+ \pgfsettrimleft{\pgf@picminx}
+ \else
+ \pgfsettrimleftpointlater{\pgfpoint{#1}{0pt}}%
+ \fi
+}
+\pgfsettrimleft{\pgf@picminx}
+
+\def\pgfsettrimrightpointlater#1{\def\pgf@trimright{#1}}
+\def\pgfsettrimrightpointnow#1{%
+ \pgf@process{#1}%
+ \edef\pgf@setter@baseline{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}%
+ \pgfsettrimrightpointlater{\pgf@setter@baseline}%
+}
+% \pgfsettrimright{<x coord>}
+% or
+% \pgfsettrimright{default}
+\def\pgfsettrimright#1{%
+ \def\pgf@temp{#1}%
+ \ifx\pgf@temp\pgf@default@text
+ \pgfsettrimright{\pgf@picmaxx}%
+ \else
+ \pgfsettrimrightpointlater{\pgfpoint{#1}{0pt}}%
+ \fi
+}
+\pgfsettrimright{\pgf@picmaxx}
% Interrupt path
@@ -489,6 +489,8 @@
\pgf@picminx=16000pt\relax%
\pgf@picmaxy=-16000pt\relax%
\pgf@picminy=16000pt\relax%
+ \pgf@size@hookedfalse%
+ \let\pgf@path@size@hook=\pgfutil@empty%
}
\def\endpgfinterruptboundingbox
{%
@@ -554,6 +556,7 @@
\fi%
\pgfutil@selectfont%
\pgfpicturefalse%
+ \let\pgf@positionnodelater@macro\relax%
\pgf@savelayers%
}
\def\endpgfinterruptpicture
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex
index e8225bb0225..d4b0e8bee74 100644
--- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreshade.code.tex,v 1.9 2007/12/10 13:19:32 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreshade.code.tex,v 1.13 2008/11/23 16:07:47 ludewich Exp $
%
% Parsing functions
@@ -111,6 +111,14 @@
}
+% Normalized a <color specification> argument for shadings into a
+% series of rgb color specifications and writes the result into
+% \pgf@rgbconv.
+%
+% Example:
+% \pgf@convertrgbstring{rgb(0cm)=(1,0,0); rgb(2cm)=(0,1,0); rgb(4cm)=(0,0,1); gray(1cm)=(3); color(2cm)=(green); }
+% ->
+% \pgf@rgbconv = macro:->'rgb(0cm)=(1,0,0); rgb(2cm)=(0,1,0); rgb(4cm)=(0,0,1); rgb(1cm)=(3,3,3); rgb(2cm)=(0,1,0); '
\def\pgf@convertrgbstring#1{%
\def\pgf@rgbconv{}%
\pgf@converttorgb#1]%
@@ -387,6 +395,12 @@
\expandafter\pgfutil@convertcolorspec\pgf@tempcolor{rgb}{\pgf@rgbcolor}%
\expandafter\pgfshading@rgb\pgf@rgbcolor\relax%
\edef#2{\pgf@sys@tonumber{\pgf@xa}\space\pgf@sys@tonumber{\pgf@xb}\space\pgf@sys@tonumber{\pgf@xc}\space}%
+ \c@pgf@counta\escapechar%
+ \escapechar-1\relax%
+ \expandafter\edef\csname\string#2red\endcsname{\pgf@sys@tonumber{\pgf@xa}\space}%
+ \expandafter\edef\csname\string#2green\endcsname{\pgf@sys@tonumber{\pgf@xb}\space}%
+ \expandafter\edef\csname\string#2blue\endcsname{\pgf@sys@tonumber{\pgf@xc}\space}%
+ \escapechar\c@pgf@counta%
}
\def\pgfshading@rgb#1,#2,#3\relax{%
\pgf@xa=#1pt%
@@ -531,8 +545,8 @@
\advance\pgf@xc by-\pgf@pathminx%
\pgf@yc=\pgf@pathmaxy%
\advance\pgf@yc by-\pgf@pathminy%
- \pgf@xc=.02\pgf@xc%
- \pgf@yc=.02\pgf@yc%
+ \pgf@xc=.01992528\pgf@xc%
+ \pgf@yc=.01992528\pgf@yc%
\pgfsyssoftpath@invokecurrentpath%
\pgfsys@clipnext%
\pgfsys@discardpath%
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex
index caf5432b4d8..442531ffa6f 100644
--- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoretransformations.code.tex,v 1.10 2008/02/04 17:19:54 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoretransformations.code.tex,v 1.11 2009/06/10 09:22:57 ludewich Exp $
% Position transformations
@@ -37,6 +37,36 @@
\edef#1{{\pgf@pt@aa}{\pgf@pt@ab}{\pgf@pt@ba}{\pgf@pt@bb}{\the\pgf@pt@x}{\the\pgf@pt@y}}
}
+% Store the current transformation matrix in a set of macros, one for
+% each single entry.
+%
+% #1-#4 are macro which store the matrix entries (0,0), (0,1), (1,0),
+% (1,1) (in this order). It is the same order as for \pgftransformcm.
+%
+% #5 is a macro which will be filled with the x shift and
+% #6 is a macro which will be filled with the y shift.
+%
+% Example:
+% \pgfgettransform\aa\ab\ba\bb\shiftx\shifty
+%
+% ->
+%
+% \pgftransformcm\aa\ab\ba\bb{\pgfqpoint{\shiftx}{\shifty}}
+%
+% or
+%
+% \pgfsettransformentries\aa\ab\ba\bb\shiftx\shifty
+\def\pgfgettransformentries#1#2#3#4#5#6{%
+ \edef#1{\pgf@pt@aa}%
+ \edef#2{\pgf@pt@ab}%
+ \edef#3{\pgf@pt@ba}%
+ \edef#4{\pgf@pt@bb}%
+ \edef#5{\the\pgf@pt@x}%
+ \edef#6{\the\pgf@pt@y}%
+}%
+\def\pgfsettransformentries#1#2#3#4#5#6{%
+ \pgfsettransform{{#1}{#2}{#3}{#4}{#5}{#6}}%
+}%
% Restore the current transformation matrix from a macro.
%
diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgpgf.cfg b/Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgpgf.cfg
new file mode 100644
index 00000000000..f1e0f36ce16
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgpgf.cfg
@@ -0,0 +1,2 @@
+\SYSTEM {http://www.tcs.uni-luebeck.de/dtds/svgpgf.dtd} {svgpgf.xmt}
+\NAME{svgpgf} {svgpgf.xmt}
diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgpgf.xmt b/Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgpgf.xmt
new file mode 100644
index 00000000000..7a3e688e6ee
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgpgf.xmt
@@ -0,0 +1,48 @@
+\DeclareNamespace{svg}{http://www.w3.org/2000/svg}
+
+\XMLelement{svg:svg}{
+}
+{\begin{pgfpicture}
+ \pgfsetyvec{\pgfpoint{0cm}{-1cm}}}
+{\end{pgfpicture}}
+
+\XMLelement{svg:rect}{
+ \XMLattribute{width}{\svgwidth}{0}
+ \XMLattribute{height}{\svgheight}{0}
+ \XMLattribute{x}{\svgx}{0}
+ \XMLattribute{y}{\svgy}{0}
+ \XMLattribute{fill}{\svgfill}{x000}
+}
+{
+ \expandafter\svgparsefill\svgfill
+ \pgfsetfillcolor{mycol}
+ \pgfpathrectangle{\pgfpointxy{\svgx}{\svgy}}{\pgfpointxy{\svgwidth}{\svgheight}}
+ \pgfusepath{fill}}
+{}
+
+\gdef\svgparsefill#1#2#3#4{%
+ \pgfmathparse{\csname tonum#2\endcsname/16}
+ \let\myred=\pgfmathresult
+ \pgfmathparse{\csname tonum#3\endcsname/16}
+ \let\mygreen=\pgfmathresult
+ \pgfmathparse{\csname tonum#4\endcsname/16}
+ \let\myblue=\pgfmathresult
+ \definecolor{mycol}{rgb}{\myred,\mygreen,\myblue}
+}
+
+\expandafter\gdef\csname tonum0\endcsname{0}
+\expandafter\gdef\csname tonum1\endcsname{1}
+\expandafter\gdef\csname tonum2\endcsname{2}
+\expandafter\gdef\csname tonum3\endcsname{3}
+\expandafter\gdef\csname tonum4\endcsname{4}
+\expandafter\gdef\csname tonum5\endcsname{5}
+\expandafter\gdef\csname tonum6\endcsname{6}
+\expandafter\gdef\csname tonum7\endcsname{7}
+\expandafter\gdef\csname tonum8\endcsname{8}
+\expandafter\gdef\csname tonum9\endcsname{9}
+\expandafter\gdef\csname tonuma\endcsname{10}
+\expandafter\gdef\csname tonumb\endcsname{11}
+\expandafter\gdef\csname tonumc\endcsname{12}
+\expandafter\gdef\csname tonumd\endcsname{13}
+\expandafter\gdef\csname tonume\endcsname{14}
+\expandafter\gdef\csname tonumf\endcsname{15}
diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgtest.cfg b/Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgtest.cfg
new file mode 100644
index 00000000000..f658cf84240
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgtest.cfg
@@ -0,0 +1,3 @@
+%\PUBLIC {-//W3C//DTD SVG 1.1//EN} {svgpgf.xmt}
+%\NAME{svg} {svgpgf.xmt}
+
diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgtest.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgtest.tex
new file mode 100644
index 00000000000..4e919ca1371
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgtest.tex
@@ -0,0 +1,15 @@
+\documentclass{article}
+
+\usepackage{pgfsvg}
+
+\begin{document}
+
+Huhu...
+
+\xmlinclude{svgtest.xml}
+foo...
+\xmlinclude{rect01.xml}
+
+%\xmlinclude{svgtest.xml}
+
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgtest.xml b/Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgtest.xml
new file mode 100644
index 00000000000..109ee812629
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/svg/svgtest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+
+<svg xmlns="http://www.w3.org/2000/svg"
+ width="200"
+ height="200"
+ viewBox="0 0.5 5 5" preserveAspectRatio="none">
+ <rect id="black_stripe"
+ fill="#000"
+ width="5"
+ height="1"/>
+ <rect id="gray_i"
+ fill="#484"
+ width="6"
+ height="1" y="2"/>
+ <rect id="gray_ii"
+ fill="#888"
+ width="3"
+ height="1" y="3"/>
+ <rect id="gray_iii"
+ fill="#ccc"
+ width="2"
+ height="1" y="4"/>
+ <rect id="white"
+ fill="#fff"
+ width="5"
+ height="1" y="5"/>
+</svg>
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 <name> be the name of the <i>-th vertex that has color #1. Then, a
+% macro called \#3<i> will store <name>. 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[<options>]
+%
+% 2. \tikzexternalize{<real job's name>}
+%
+% 3. \tikzexternalize[<options>]{<real job's name>}
+%
+% The <real job's name> is the job's file name, without the suffix
+% .tex .
+% If the <real job's name> 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 <my name>
+ % 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<number>' 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}{<no argument in curly braces>}% 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{<name>} in latex because \begin{<name>}
+ % starts a local group - that must be closed properly. Make sure then \end<name> 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 <corner point>
-\def\tikz@grid rid{%
+\def\tikz@grid id{%
\tikz@flush@moveto%
\pgf@xa=\tikz@lastx\relax%
\pgf@ya=\tikz@lasty\relax%
@@ -2247,6 +2603,7 @@
\def\tikz@gridB#1{%
\tikz@make@last@position{#1}%
{%
+ \let\tikz@after@path\pgfutil@empty%
\expandafter\tikzset\expandafter{\tikz@grid@options}
\tikz@checkunit{\tikz@grid@x}%
\iftikz@isdimension%
@@ -2266,8 +2623,8 @@
\advance\pgf@yb by\pgf@y%
\pgfpathgrid[stepx=\pgf@xb,stepy=\pgf@yb]%
{\pgfqpoint{\pgf@xa}{\pgf@ya}}{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}%
- }
- \tikz@scan@next@command%
+ \expandafter}%
+ \expandafter\tikz@scan@next@command\tikz@after@path%
}
@@ -2280,6 +2637,7 @@
\pgfutil@ifnextchar[{\tikz@@plot}{\tikz@@plot[]}}%}
\def\tikz@@plot[#1]{%
\begingroup%
+ \let\tikz@after@path\pgfutil@empty%
\let\tikz@options=\pgfutil@empty%
\tikzset{every plot/.try}%
\tikzset{#1}%
@@ -2349,7 +2707,7 @@
\pgfscope%
\let\tikz@options=\pgfutil@empty%
\let\tikz@transform=\pgfutil@empty%
- \expandafter\tikzset\expandafter{\tikz@plot@mark@options}%
+ \tikzset{every mark}%
\tikz@options%
\ifx\tikz@mark@list\pgfutil@empty%
\pgfplothandlermark{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}}%
@@ -2363,17 +2721,18 @@
}%
\fi%
\global\setbox\tikz@tempbox=\copy\tikz@figbox%
+ \global\let\tikz@after@path@smuggle=\tikz@after@path
\endgroup%
\setbox\tikz@figbox=\box\tikz@tempbox%
\tikz@make@last@position{\tikz@@@temp}%
- \tikz@scan@next@command%
+ \expandafter\tikz@scan@next@command\tikz@after@path@smuggle%
}
\pgfdeclareplotmark{ball}
{%
\def\tikz@shading{ball}%
- \shade (0,0) circle (\pgfplotmarksize);%
+ \shade (0pt,0pt) circle (\pgfplotmarksize);%
}
@@ -2439,6 +2798,7 @@
\pgf@xc=\tikz@lastx%
\pgf@yc=\tikz@lasty%
\begingroup% now calculate bend:
+ \let\tikz@after@path\pgfutil@empty%
\expandafter\tikzset\expandafter{\tikz@parabola@option}%
\tikz@lastxsaved=\tikz@parabola@bend@factor\tikz@lastx%
\tikz@lastysaved=\tikz@parabola@bend@factor\tikz@lasty%
@@ -2454,51 +2814,73 @@
\advance\tikz@lastx by-\pgf@xb%
\advance\tikz@lasty by-\pgf@yb%
\xdef\tikz@parabola@b{{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}}%
- \endgroup%
- \expandafter\pgfpathparabola\tikz@parabola@b%
- \tikz@scan@next@command%
+ \expandafter\endgroup%
+ \expandafter\expandafter\expandafter\pgfpathparabola\expandafter\tikz@parabola@b%
+ \expandafter\tikz@scan@next@command\tikz@after@path%
}
% Syntax for circles:
-% circle (radius)
+% circle [options] % where options should set, at least, radius
+% circle (radius) % deprecated
%
% Syntax for ellipses:
-% ellipse (x-radius and y-radius)
+% ellipse [options] % identical to circle.
+% ellipse (x-radius and y-radius) % deprecated
%
% radii can be dimensionless, then they are in the xy-system
\def\tikz@circle ircle{\tikz@flush@moveto\tikz@@circle}
\def\tikz@ellipse llipse{\tikz@flush@moveto\tikz@@circle}
\def\tikz@@circle{%
- \pgfutil@ifnextchar(\tikz@@@circle{%)
- \advance\tikz@expandcount by -1%
+ \pgfutil@ifnextchar(\tikz@@@circle
+ {\pgfutil@ifnextchar[\tikz@circle@opt{%])
+ \advance\tikz@expandcount by -10\relax% go down quickly
\ifnum\tikz@expandcount<0\relax%
- \let\@next=\tikz@@circle@scangiveup%
+ \let\@next=\tikz@@circle@normal%
\else%
\let\@next=\tikz@@circle@scanexpand%
\fi%
\@next%
- }%
+ }}%
}
\def\tikz@@circle@scanexpand{\expandafter\tikz@@circle}
-\def\tikz@@circle@scangiveup#1{\PackageError{tikz}{Cannot parse this radius}{}#1{\tikz@scan@next@command}}
+\def\tikz@@circle@normal{\tikz@circle@opt[]}
+
+\def\tikz@circle@opt[#1]{%
+ {%
+ \def\tikz@node@at{\tikz@last@position}%
+ \let\tikz@transform=\pgfutil@empty%
+ \tikzset{every circle/.try,#1}%
+ \pgftransformshift{\tikz@node@at}%
+ \tikz@transform%
+ \tikz@do@circle{\pgfkeysvalueof{/tikz/x radius}}{\pgfkeysvalueof{/tikz/y radius}}
+ }%
+ \tikz@scan@next@command%
+}
+
\def\tikz@@@circle(#1){%
- \pgfutil@in@{ and }{#1}%
- \ifpgfutil@in@%
- \tikz@@ellipseB(#1)%
- \else%
- \tikz@@ellipseB({#1} and {#1})%
- \fi%
+ {%
+ \pgftransformshift{\tikz@last@position}%
+ \pgfutil@in@{ and }{#1}%
+ \ifpgfutil@in@%
+ \tikz@@ellipseB(#1)%
+ \else%
+ \tikz@do@circle{#1}{#1}%
+ \fi%
+ }%
\tikz@scan@next@command%
}
\def\tikz@@ellipseB(#1 and #2){%
+ \tikz@do@circle{#1}{#2}
+}
+\def\tikz@do@circle#1#2{
\pgfmathparse{#1}%
\let\tikz@ellipse@x=\pgfmathresult%
\ifpgfmathunitsdeclared%
\pgfmathparse{#2}%
\let\tikz@ellipse@y=\pgfmathresult%
\ifpgfmathunitsdeclared%
- \pgfpathellipse{\tikz@last@position}{%
+ \pgfpathellipse{\pgfpointorigin}{%
\pgfqpoint{\tikz@ellipse@x pt}{0pt}}{\pgfpoint{0pt}{\tikz@ellipse@y pt}}%
\else%
\PackageError{tikz}{You cannot mix dimensions and dimensionless values in an ellipse}{}%
@@ -2509,7 +2891,7 @@
\ifpgfmathunitsdeclared%
\PackageError{tikz}{You cannot mix dimensions and dimensionless values in an ellipse}{}%
\else%
- \pgfpathellipse{\tikz@last@position}{%
+ \pgfpathellipse{\pgfpointorigin}{%
\pgfpointxy{\tikz@ellipse@x}{0}}{\pgfpointxy{0}{\tikz@ellipse@y}}%
\fi%
\fi%
@@ -2522,13 +2904,50 @@
% arc (start angle:end angle:x-radius and y-radius)
%
% radius can be dimensionless, then the arc is in the xy-coordinate system
-\def\tikz@arcA rc{%
- \tikz@flush@moveto%
- \pgfutil@ifnextchar({\tikz@@arcto}{\expandafter\tikz@arcA\expandafter r\expandafter c}}
+\def\tikz@arcA rc{\tikz@flush@moveto\tikz@arc@cont}%
+\def\tikz@arc@cont{%
+ \pgfutil@ifnextchar(%)
+ {\tikz@@arcto}{%
+ \pgfutil@ifnextchar[%]
+ {\tikz@arc@opt}%
+ {%
+ \advance\tikz@expandcount by -10\relax% go down quickly
+ \ifnum\tikz@expandcount<0\relax%
+ \let\@next=\tikz@@arc@normal%
+ \else%
+ \let\@next=\tikz@@arc@scanexpand%
+ \fi%
+ \@next%
+ }%
+ }%
+}
+\def\tikz@@arc@scanexpand{\expandafter\tikz@arc@cont}
+\def\tikz@@arc@normal{\tikz@arc@opt[]}
+
+
+\def\tikz@arc@opt[#1]{%
+ {%
+ \tikzset{every arc/.try,#1}%
+ \pgfkeysgetvalue{/tikz/start angle}\tikz@s
+ \pgfkeysgetvalue{/tikz/end angle}\tikz@e
+ \pgfkeysgetvalue{/tikz/delta angle}\tikz@d
+ \ifx\tikz@s\pgfutil@empty%
+ \pgfmathsetmacro\tikz@s{\tikz@e-\tikz@d}
+ \else
+ \ifx\tikz@e\pgfutil@empty%
+ \pgfmathsetmacro\tikz@e{\tikz@s+\tikz@d}
+ \fi%
+ \fi
+ \tikz@do@arc{\tikz@s}{\tikz@e}
+ {\pgfkeysvalueof{/tikz/x radius}}
+ {\pgfkeysvalueof{/tikz/y radius}}
+ }%
+ \tikz@arcfinal%
+}
\def\tikz@@arcto(#1){%
\edef\tikz@temp{(#1)}%
- \expandafter\tikz@@@arcto@check@slashand\tikz@temp%
+ \expandafter\tikz@@@arcto@check@slashand\tikz@temp%
}
\def\tikz@@@arcto@check@slashand(#1:#2:#3){%
@@ -2538,9 +2957,13 @@
\else%
\tikz@parse@arc@and(#1:#2:{#3} and {#3})%
\fi%
+ \tikz@arcfinal%
}
\def\tikz@parse@arc@and(#1:#2:#3 and #4){%
+ \tikz@do@arc{#1}{#2}{#3}{#4}%
+}
+\def\tikz@do@arc#1#2#3#4{%
\pgfmathparse{#3}%
\let\tikz@arc@x=\pgfmathresult%
\ifpgfmathunitsdeclared%
@@ -2567,10 +2990,17 @@
\def\tikz@@@arcfinal#1#2#3{%
#1%
- \pgf@process{#2}%
+ \pgf@process{#2}
+ \xdef\tikz@arc@save@first{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ \pgf@process{#3}
+ \xdef\tikz@arc@save@second{\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+}
+
+\def\tikz@arcfinal{%
+ \pgf@process{\tikz@arc@save@first}%
\advance\tikz@lastx by-\pgf@x%
\advance\tikz@lasty by-\pgf@y%
- \pgf@process{#3}%
+ \pgf@process{\tikz@arc@save@second}%
\advance\tikz@lastx by\pgf@x%
\advance\tikz@lasty by\pgf@y%
\tikz@lastxsaved=\tikz@lastx%
@@ -2590,7 +3020,11 @@
\def\tikz@@coordinate[#1](#2){%
\pgfutil@ifnextchar a{\tikz@@coordinate@at[#1](#2)}
{\tikz@fig ode[shape=coordinate,#1](#2){}}}
-\def\tikz@@coordinate@at[#1](#2)at#3({%
+\def\tikz@@coordinate@at[#1](#2)a{%
+ \pgfutil@ifnextchar t{\tikz@@coordinate@@at[#1](#2)a}%
+ {\tikz@fig ode[shape=coordinate,#1](#2){}a}%
+}
+\def\tikz@@coordinate@@at[#1](#2)at#3({%
\def\tikz@coordinate@caller{\tikz@fig ode[shape=coordinate,#1](#2)at}%
\tikz@scan@one@point\tikz@@coordinate@at@math(%
}
@@ -2617,9 +3051,9 @@
\begingroup%
\tikz@is@matrixfalse%
\let\nodepart=\tikz@nodepart%
+ \let\tikz@do@after@node=\tikz@scan@next@command%
\let\tikz@options=\pgfutil@empty%
- \let\tikz@after@node=\pgfutil@empty%
- \let\tikz@afternodepathoptions=\pgfutil@empty%
+ \let\tikz@after@path=\pgfutil@empty%
\let\tikz@transform=\pgfutil@empty%
\let\tikz@mode=\pgfutil@empty%
\tikz@decoratepathfalse%
@@ -2645,8 +3079,11 @@
\tikz@scan@one@point\tikz@@fig@scan@at}
\def\tikz@@fig@scan@at#1{%
\def\tikz@node@at{#1}\tikz@@scan@fig}%
-\def\tikz@fig@scan@name(#1){\edef\tikz@fig@name{#1}\tikz@@scan@fig}%
-\def\tikz@fig@scan@options[#1]{\tikzset{#1}\tikz@@scan@fig}%
+\def\tikz@fig@scan@name(#1){%
+ \pgfkeysvalueof{/tikz/name/.@cmd}#1\pgfeov% CF : this is now ALWAYS consistent with 'name=' option; allows overrides.
+ \tikz@@scan@fig}%
+% make it \long to allow \par in "pin" options etc:
+\long\def\tikz@fig@scan@options[#1]{\tikzset{#1}\tikz@@scan@fig}%
\let\tikz@node@reset@hook=\pgfutil@empty%
\let\tikz@node@begin@hook=\pgfutil@empty%
\def\tikz@fig@main{\afterassignment\tikz@@fig@main\let\next=}
@@ -2679,7 +3116,8 @@
\ifx\tikz@text@width\pgfutil@empty%
\else%
\begingroup%
- \pgfutil@minipage[t]{\tikz@text@width}%
+ \pgfmathsetlength{\pgf@x}{\tikz@text@width}%
+ \pgfutil@minipage[t]{\pgf@x}\leavevmode\hbox{}%
\tikz@text@action%
\fi%
\tikz@atbegin@node%
@@ -2690,9 +3128,10 @@
\pgfutil@colorlet{.}{\tikz@textcolor}%
\fi%
\pgfsetcolor{.}%
- \setbox\tikz@figbox=\box\voidb@x%
+ \setbox\tikz@figbox=\box\pgfutil@voidb@x%
\tikz@uninstallcommands%
\aftergroup\tikz@fig@collectresetcolor%
+ \tikz@halign@check%
\ignorespaces%
}
\def\tikz@fig@collectresetcolor{%
@@ -2713,7 +3152,7 @@
{\pgfutil@ifnextchar[{\tikz@fig@mustbenamed\tikz@fig@continue}%
{\pgfutil@ifnextchar t{\tikz@fig@mustbenamed\tikz@fig@continue}
{\pgfutil@ifnextchar e{\tikz@fig@mustbenamed\tikz@fig@continue}
- {\ifx\tikz@after@node\pgfutil@empty\expandafter\tikz@fig@continue\else\expandafter\tikz@fig@mustbenamed\expandafter\tikz@fig@continue\fi}}}}}%}
+ {\ifx\tikz@after@path\pgfutil@empty\expandafter\tikz@fig@continue\else\expandafter\tikz@fig@mustbenamed\expandafter\tikz@fig@continue\fi}}}}}%}
\def\tikz@do@matrix{%
\tikzset{every matrix/.try}%
@@ -2726,7 +3165,7 @@
\pgfinterruptpath%
\pgfscope%
\tikz@options%
- \setbox\tikz@figbox=\box\voidb@x%
+ \setbox\tikz@figbox=\box\pgfutil@voidb@x%
\let\tikzmatrixname=\tikz@fig@name%
\edef\tikz@m@anchor{\ifx\tikz@matrix@anchor\pgfutil@empty\tikz@anchor\else\tikz@matrix@anchor\fi}%
\expandafter\pgfutil@in@\expandafter{\expandafter.\expandafter}\expandafter{\tikz@m@anchor}%
@@ -2840,7 +3279,7 @@
\pgfinterruptpath%
\pgfscope%
\tikz@options%
- \setbox\tikz@figbox=\box\voidb@x%
+ \setbox\tikz@figbox=\box\pgfutil@voidb@x%
\pgfmultipartnode{\tikz@shape}{\tikz@anchor}{\tikz@fig@name}{%
\pgfutil@tempdima=\pgflinewidth%
{\begingroup\tikz@finish}%
@@ -2884,8 +3323,7 @@
\def\tikz@node@finish{%
\global\let\tikz@last@fig@name=\tikz@fig@name%
- \global\let\tikz@after@node@smuggle=\tikz@after@node%
- \global\let\tikz@afternodepathoptions@smuggle=\tikz@afternodepathoptions%
+ \global\let\tikz@after@path@smuggle=\tikz@after@path%
% shift box outside group
\global\setbox\tikz@tempbox=\copy\tikz@figbox%
\endgroup\endgroup%
@@ -2894,23 +3332,83 @@
\let\tikz@to@last@fig@name=\tikz@last@fig@name%
\let\tikz@to@use@whom=\tikz@to@use@last@fig@name%
\let\tikzlastnode=\tikz@last@fig@name%
- \ifx\tikz@after@node@smuggle\pgfutil@empty%
+ \ifx\tikz@after@path@smuggle\pgfutil@empty%
\else%
- \tikz@scan@next@command{\pgfextra{\tikz@afternodepathoptions@smuggle}\tikz@after@node@smuggle}\pgf@stop%
+ \tikz@scan@next@command{\tikz@after@path@smuggle}\pgf@stop%
\fi%
- \tikz@scan@next@command%
+ \tikz@do@after@node%
}
\let\tikz@fig@continue@orig=\tikz@fig@continue
+\def\tikz@do@after@node{\tikz@scan@next@command}
+
+\newif\iftikz@do@align
+
+% Alignment handling
+\def\tikz@halign@check{%
+ \tikz@do@alignfalse
+ \ifx\tikz@text@width\pgfutil@empty%
+ \pgfkeysgetvalue{/tikz/node halign header}\tikz@align@header%
+ \ifx\tikz@align@header\pgfutil@empty%
+ \else%
+ \tikz@do@aligntrue%
+ \fi%
+ \fi%
+ \iftikz@do@align%
+ % Bingo
+ \setbox\tikz@align@aligned@box=\box\pgfutil@voidb@x% void
+ \let\\=\tikz@align@newline%
+ \expandafter\tikz@start@align%
+ \fi%
+}
+\def\tikz@align@newline{\unskip\pgfutil@ifnextchar[\tikz@@align@newline{\tikz@@align@newline[0pt]}}%}
+\def\tikz@@align@newline[#1]{\egroup\tikz@align@continue\pgfmathparse{#1}\let\tikz@align@temp=\pgfmathresult\tikz@start@align}%
+% Two safe boxes for alignment:
+\let\tikz@align@aligned@box=\pgfnodeparttextbox
+\let\tikz@align@line@box=\tikz@figbox
+
+\def\tikz@start@align{%
+ % Start collecting text:
+ \setbox\tikz@align@line@box=\hbox\bgroup\bgroup%
+ \aftergroup\tikz@align@collectresetcolor\ignorespaces%
+}
+\def\tikz@align@collectresetcolor{%
+ \pgfutil@ifnextchar\reset@color%
+ {\reset@color\afterassignment\tikz@align@collectresetcolor\let\tikz@temp=}%
+ {\tikz@align@end@check}%
+}
+\def\tikz@align@end@check{%
+ \egroup%
+ \ifvoid\tikz@align@aligned@box%
+ \setbox\tikz@align@aligned@box=\box\tikz@align@line@box%
+ \else%
+ \setbox\tikz@align@aligned@box=\vbox{%
+ \expandafter\expandafter\expandafter\halign\expandafter\expandafter\expandafter{\tikz@align@header%
+ \box\tikz@align@aligned@box\cr%
+ \noalign{\vskip\tikz@align@temp pt}%
+ \unhbox\tikz@align@line@box\unskip\cr}}%
+ \fi%
+ \pgfutil@ifnextchar\tikz@align@continue{}
+ {%
+ % Main continue
+ \box\tikz@align@aligned@box%
+ \egroup%
+ }%
+}
+\def\tikz@align@continue{\tikz@@align@continue}
+\let\tikz@@align@continue=\pgfutil@empty
+
% Syntax for parts of nodes:
-% node ... {... \nodepart{name} ... \nodepart{name} ...}
+% node ... {... \nodepart[options]{name} ... \nodepart{name} ...}
-\def\tikz@nodepart#1{%
+\def\tikz@nodepart{\pgfutil@ifnextchar[\tikz@@nodepart{\tikz@@nodepart[]}}%}
+\def\tikz@@nodepart[#1]#2{%
\tikz@atend@node%
\unskip%
- \gdef\tikz@nodepart@name{#1}%
+ \gdef\tikz@nodepart@options{#1}%
+ \gdef\tikz@nodepart@name{#2}%
\global\let\tikz@fig@continue=\tikz@nodepart@continue%
\pgfutil@ifnextchar x{\egroup\relax}{\egroup\relax}% gobble spaces
}
@@ -2920,12 +3418,14 @@
\expandafter\setbox\csname pgfnodepart\tikz@nodepart@name box\endcsname=\hbox%
\bgroup%
\tikzset{every \tikz@nodepart@name\space node part/.try}%
+ \expandafter\tikzset\expandafter{\tikz@nodepart@options}%
\pgfinterruptpicture%
\tikz@textfont%
\ifx\tikz@text@width\pgfutil@empty%
\else%
\begingroup%
- \pgfutil@minipage[t]{\tikz@text@width}%
+ \pgfmathsetlength{\pgf@x}{\tikz@text@width}%
+ \pgfutil@minipage[t]{\pgf@x}\leavevmode\hbox{}%
\tikz@text@action%
\fi%
\bgroup%
@@ -2935,10 +3435,11 @@
\pgfutil@colorlet{.}{\tikz@textcolor}%
\fi%
\pgfsetcolor{.}%
- \setbox\tikz@figbox=\box\voidb@x%
+ \setbox\tikz@figbox=\box\pgfutil@voidb@x%
\tikz@uninstallcommands%
\tikz@atbegin@node%
\aftergroup\tikz@fig@collectresetcolor%
+ \tikz@halign@check%
\ignorespaces%
}
@@ -2956,7 +3457,7 @@
\fi%
\tikz@is@matrixfalse%
\let\tikz@options=\pgfutil@empty%
- \let\tikz@after@node=\pgfutil@empty%
+ \let\tikz@after@path=\pgfutil@empty%
\let\tikz@afternodepathoptions=\pgfutil@empty%
\let\tikz@alias=\pgfutil@empty%
\let\tikz@transform=\pgfutil@empty%
@@ -2970,15 +3471,14 @@
\tikz@node@begin@hook%
\tikz@alias%
\global\let\tikz@last@fig@name=\tikz@fig@name%
- \global\let\tikz@after@node@smuggle=\tikz@after@node%
- \global\let\tikz@afternodepathoptions@smuggle=\tikz@afternodepathoptions%
+ \global\let\tikz@after@path@smuggle=\tikz@after@path%
\endgroup%
\let\tikz@to@last@fig@name=\tikz@last@fig@name%
\let\tikz@to@use@whom=\tikz@to@use@last@fig@name%
\let\tikzlastnode=\tikz@last@fig@name%
- \ifx\tikz@after@node@smuggle\pgfutil@empty%
+ \ifx\tikz@after@path@smuggle\pgfutil@empty%
\else%
- \tikz@scan@next@command{\pgfextra{\tikz@afternodepathoptions@smuggle}\tikz@after@node@smuggle}\pgf@stop%
+ \tikz@scan@next@command{\tikz@after@path@smuggle}\pgf@stop%
\fi%
}
@@ -3500,8 +4000,6 @@
-
-
%
% Coordinate management
%
@@ -3693,12 +4191,18 @@
% Check to see if the y-coordinate is inside {}. If it is, scan it and
% reinsert it into the stream inside an extra group.
%
+% MW:
+% Check to see if the y-coordinate is inside {}. If it is, scan it and
+% reinsert it into the stream inside an extra group.
+%
\def\tikz@parse@regular#1(#2,{%
\pgfutil@ifnextchar\bgroup{\tikz@@parse@regular#1{#2}}{\tikz@@@parse@regular#1{#2}}%
}
-\def\tikz@@parse@regular#1#2#3{\tikz@@@parse@regular#1{#2}{{#3}}}%
-
-
+\def\tikz@@parse@regular#1#2#3{%
+ \pgfutil@ifnextchar[{% Uh oh! An array index.
+ \tikz@@@parse@regular#1{#2}{#3}}%
+ {\tikz@@@parse@regular#1{#2}{{#3}}}}
+
% Originally \def\tikz@parse@regular#1(#2,#3){%
%
\def\tikz@@@parse@regular#1#2#3){%
@@ -3859,7 +4363,6 @@
}
-
% Loading further libraries
% Include a library file.
@@ -3885,16 +4388,20 @@
\def\use@@tikzlibrary#1{%
\edef\pgf@list{#1}%
\pgfutil@for\pgf@temp:=\pgf@list\do{%
- \expandafter\ifx\csname tikz@library@\pgf@temp @loaded\endcsname\relax%
- \expandafter\global\expandafter\let\csname tikz@library@\pgf@temp @loaded\endcsname=\pgfutil@empty%
- \expandafter\edef\csname tikz@library@#1@atcode\endcsname{\the\catcode`\@}
- \expandafter\edef\csname tikz@library@#1@barcode\endcsname{\the\catcode`\|}
- \catcode`\@=11
- \catcode`\|=12
- \input tikzlibrary\pgf@temp.code.tex
- \catcode`\@=\csname tikz@library@#1@atcode\endcsname
- \catcode`\|=\csname tikz@library@#1@barcode\endcsname
- \fi%
+ \expandafter\pgfkeys@spdef\expandafter\pgf@temp\expandafter{\pgf@temp}%
+ \ifx\pgf@temp\pgfutil@empty
+ \else
+ \expandafter\ifx\csname tikz@library@\pgf@temp @loaded\endcsname\relax%
+ \expandafter\global\expandafter\let\csname tikz@library@\pgf@temp @loaded\endcsname=\pgfutil@empty%
+ \expandafter\edef\csname tikz@library@#1@atcode\endcsname{\the\catcode`\@}
+ \expandafter\edef\csname tikz@library@#1@barcode\endcsname{\the\catcode`\|}
+ \catcode`\@=11
+ \catcode`\|=12
+ \input tikzlibrary\pgf@temp.code.tex
+ \catcode`\@=\csname tikz@library@#1@atcode\endcsname
+ \catcode`\|=\csname tikz@library@#1@barcode\endcsname
+ \fi%
+ \fi
}%
}
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.barcharts.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.barcharts.code.tex
new file mode 100644
index 00000000000..7eb1b719329
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.barcharts.code.tex
@@ -0,0 +1,135 @@
+% 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/libraries/datavisualization/pgflibrarydatavisualization.barcharts.code.tex,v 1.3 2008/11/12 23:39:37 tantau Exp $
+
+\usepgfmodule{datavisualization}
+
+
+%
+% This file defines additional data visualization classes.
+%
+
+
+\pgfooclass{candle stick visualizer}
+{
+ \attribute attribute;
+ \attribute offset;
+ \attribute use path rise=\pgfsetfillcolor{white}\pgfusepath{fill,stroke};
+ \attribute use path fall=\pgfsetfillcolor{black}\pgfusepath{fill,stroke};
+ \attribute use path wick=\pgfusepath{stroke};
+
+ \method candle stick visualizer(#1) {
+ \pgfooeset{attribute}{#1}
+ \pgfoothis.set stick width(4pt)
+ }
+
+ \method default connects() {
+ \pgfoothis.get handle(\pgf@dv@me)
+ \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,visualize,visualize datapoint signal)
+ }
+
+ \method set stick width(#1) {
+ \pgfmathparse{#1}
+ \pgfmathdivide{\pgfmathresult}{2}
+ \let\pgf@dv@lib@w=\pgfmathresult
+ % Compute the normalized vector:
+ \pgfkeyssetvalue{/data point/\pgfoovalueof{attribute}}{1}
+ \pgfcanvaspositionofdatapoint%
+ \pgfsettocanvasposition\pgf@dv@lib@lower%
+ \pgfkeyssetvalue{/data point/\pgfoovalueof{attribute}}{10}
+ \pgfcanvaspositionofdatapoint%
+ \pgfsettocanvasposition\pgf@dv@lib@upper%
+ \pgf@process{\pgfpointnormalised{\pgfpointdiff{\pgf@dv@lib@upper}{\pgf@dv@lib@lower}}}%
+ % Rotate by 90 degrees
+ \pgf@xa=\pgf@x%
+ \pgf@x=-\pgf@dv@lib@w\pgf@y%
+ \pgf@y=\pgf@dv@lib@w\pgf@xa%
+ \edef\pgf@dv@lib@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ \pgfoolet{offset}\pgf@dv@lib@temp
+ }
+
+ \method set use path rise(#1) {
+ \pgfooset{use path rise}{#1}
+ }
+
+ \method set use path fall(#1) {
+ \pgfooset{use path fall}{#1}
+ }
+
+ \method visualize() {
+ {
+ \pgfooget{attribute}\pgf@lib@attribute%
+ \pgfkeysgetvalue{/data point/\pgf@lib@attribute/low}\pgf@lib@low
+ \pgfkeysgetvalue{/data point/\pgf@lib@attribute/high}\pgf@lib@high
+ \pgfkeysgetvalue{/data point/\pgf@lib@attribute/entry}\pgf@lib@entry
+ \pgfkeysgetvalue{/data point/\pgf@lib@attribute/exit}\pgf@lib@exit
+ \ifx\pgf@lib@low\pgfutil@empty\pgf@dv@lib@cs@skiptrue\fi
+ \ifx\pgf@lib@low\relax\pgf@dv@lib@cs@skiptrue\fi
+ \ifx\pgf@lib@high\pgfutil@empty\pgf@dv@lib@cs@skiptrue\fi
+ \ifx\pgf@lib@high\relax\pgf@dv@lib@cs@skiptrue\fi
+ \ifx\pgf@lib@entry\pgfutil@empty\pgf@dv@lib@cs@skiptrue\fi
+ \ifx\pgf@lib@entry\relax\pgf@dv@lib@cs@skiptrue\fi
+ \ifx\pgf@lib@exit\pgfutil@empty\pgf@dv@lib@cs@skiptrue\fi
+ \ifx\pgf@lib@exit\relax\pgf@dv@lib@cs@skiptrue\fi
+ \ifpgf@dv@lib@cs@skip%
+ \else%
+ \begin{pgfscope}
+ % Ok, compute low point
+ \pgfkeyssetvalue{/data point/\pgf@lib@attribute}\pgf@lib@low
+ \pgfcanvaspositionofdatapoint%
+ \pgfsettocanvasposition\pgf@dv@lib@lowpoint%
+ % Ok, compute hight point
+ \pgfkeyssetvalue{/data point/\pgf@lib@attribute}\pgf@lib@high
+ \pgfcanvaspositionofdatapoint%
+ \pgfsettocanvasposition\pgf@dv@lib@highpoint%
+ % Compute entry and exit
+ \pgfkeyssetvalue{/data point/\pgf@lib@attribute}\pgf@lib@entry
+ \pgfcanvaspositionofdatapoint%
+ \pgfsettocanvasposition\pgf@dv@lib@entrypoint%
+ \pgfkeyssetvalue{/data point/\pgf@lib@attribute}\pgf@lib@exit
+ \pgfcanvaspositionofdatapoint%
+ \pgfsettocanvasposition\pgf@dv@lib@exitpoint%
+ \ifdim\pgf@lib@entry pt<\pgf@lib@exit pt\relax%
+ \pgf@dv@lib@risetrue%
+ \fi%
+ \ifpgf@dv@lib@rise
+ \let\pgf@dv@lib@a=\pgf@dv@lib@entrypoint
+ \let\pgf@dv@lib@b=\pgf@dv@lib@exitpoint
+ \else
+ \let\pgf@dv@lib@a=\pgf@dv@lib@exitpoint
+ \let\pgf@dv@lib@b=\pgf@dv@lib@entrypoint
+ \fi
+ % Start drawing...
+ \pgfpathmoveto{\pgf@dv@lib@lowpoint}
+ \pgfpathlineto{\pgf@dv@lib@a}
+ \pgfpathmoveto{\pgf@dv@lib@highpoint}
+ \pgfpathlineto{\pgf@dv@lib@b}
+ \pgfoovalueof{use path wick}
+ \pgfpathmoveto{\pgfpointadd{\pgf@dv@lib@a}{\pgfoovalueof{offset}}}
+ \pgfpathlineto{\pgfpointadd{\pgf@dv@lib@b}{\pgfoovalueof{offset}}}
+ \pgfpathlineto{\pgfpointadd{\pgf@dv@lib@b}{\pgfpointscale{-1}{\pgfoovalueof{offset}}}}
+ \pgfpathlineto{\pgfpointadd{\pgf@dv@lib@a}{\pgfpointscale{-1}{\pgfoovalueof{offset}}}}
+ \pgfpathclose
+ \ifpgf@dv@lib@rise
+ \pgfoovalueof{use path rise}
+ \else
+ \pgfoovalueof{use path fall}
+ \fi
+ \end{pgfscope}
+ \fi
+ }
+ }
+
+ \newif\ifpgf@dv@lib@cs@skip
+ \newif\ifpgf@dv@lib@rise
+}
+
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.formats.functions.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.formats.functions.code.tex
new file mode 100644
index 00000000000..a5af1c95e17
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.formats.functions.code.tex
@@ -0,0 +1,197 @@
+% 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/libraries/datavisualization/pgflibrarydatavisualization.formats.functions.code.tex,v 1.3 2008/12/09 00:12:10 tantau Exp $
+
+\usepgfmodule{datavisualization}
+
+
+
+
+% Function evaluator
+%
+% (This uses TeX evaluation and is slow. *You have been warned*.)
+%
+% Description:
+%
+% The data contains the description of variables and functions.
+%
+% The format for the variables is
+%
+% var <name> : interval "["<start>:<end>"]" [ step <steps> | samples <samples>];
+%
+% (The first two [ and ] are "real", the second pair means "optional",
+% see the examples.)
+%
+%
+% The format for the functions is
+%
+% func <name> = <body>;
+%
+% Additionally, the variables and functions stored in the keys
+% /pgf/data/vars and /pgf/data/funcs will also be used, the format for
+% them is the same as above.
+%
+% The <name> is always the name of a (data point) attribute. Inside
+% the <body> it can be accessed using the \value macro, which is
+% defined locally, here.
+%
+% Newlines are not importants, everything is gathered into a single
+% line, the semicolons are used to detect the beginnings and ends of
+% declarations.
+%
+% With everything setup in this way, for each variable, the variable
+% ranges throught the values between start and end, either with the
+% given step or the given number of samples. If neither is given, the
+% current value of /pgf/data visualization/samples is used. If there
+% are multiple variables, they all range over their respective
+% intervals independently. Thus, "var x = [0,1]; var y = [0:1];",
+% assuming samples=25, gives you 625 data points.
+%
+% As the variables range over their respective values, the functions
+% are evaluated using the function stored in /pgf/data/evaluator. By
+% default this is set to \pgfmathparse, but
+% you can use a different parser, if you like.
+%
+% Example:
+%
+% data [format=function] {
+%
+% % This is a parametric plot with the parameter called t.
+% var t : interval [0:360] samples 60;
+%
+% % Let's draw a circle:
+% func x = sin(\value t);
+% func y = cos(\value t);
+% }
+%
+% data [format=function] {
+%
+% % This a surface plot data...
+% var x : interval [0:1];
+% var y : interval [0:1];
+%
+% % Let's draw a circle:
+% func height = \value x*\value x + \value y*\value y;
+% }
+
+\pgfdeclaredataformat{function}
+{ % no catcode code
+}
+{ % Startup
+ % Init collectors
+ \let\value=\relax% avoid expansion
+ \pgfkeysgetvalue{/pgf/data/vars}\pgf@lib@dv@collector
+}
+{% Line arguments
+ #1%
+}
+{ % Line action
+ \edef\pgf@lib@dv@collector{\pgf@lib@dv@collector\space #1}%
+}
+{% Ignore empty lines
+}
+{%
+ \edef\pgf@lib@dv@collector{\pgf@lib@dv@collector\space \pgfkeysvalueof{/pgf/data/funcs}}%
+ \let\pgf@lib@dv@parsed\pgfutil@empty%
+ % launch parser on the result
+ \expandafter\pgf@lib@dv@func@parse \pgf@lib@dv@collector\pgf@stop%
+ \let\value\pgf@lib@dv@getval
+ \pgf@lib@dv@parsed\pgfdatapoint\pgfutil@gobble\pgf@stop%
+}
+
+\pgfkeys{
+ /pgf/data/vars/.initial=,
+ /pgf/data/funcs/.initial=,
+ /pgf/data/evaluator/.initial=\pgfmathparse,
+ /pgf/data/samples/.initial=25}
+
+\def\pgf@lib@dv@getval#1{\pgfkeysvalueof{/data point/#1}}
+
+\def\pgf@lib@dv@func@parse{%
+ \pgfutil@ifnextchar\pgf@stop{% done
+ \pgfutil@gobble%
+ }
+ {%
+ \pgfutil@ifnextchar v{% variable
+ \pgf@lib@dv@var%
+ }{%
+ \pgf@lib@dv@func%
+ }%
+ }%
+}
+
+\def\pgf@lib@dv@func func #1 =#2;{%
+ \expandafter\def\expandafter\pgf@lib@dv@parsed\expandafter{\pgf@lib@dv@parsed\pgf@lib@dv@eval@func{#1}{#2}}
+ \pgf@lib@dv@func@parse%
+}
+\def\pgf@lib@dv@var var #1 :#2interval#3[#4:#5]{%
+ \pgfutil@ifnextchar s{%
+ \pgf@lib@dv@samplesorsteps{#1}{#4}{#5}%
+ }{%
+ \expandafter\def\expandafter\pgf@lib@dv@parsed\expandafter{%
+ \pgf@lib@dv@parsed\pgf@lib@dv@samples@var{#1}{#4}{#5}{\pgfkeysvalueof{/pgf/data/samples}}}%
+ \expandafter\pgf@lib@dv@func@parse\pgfutil@gobble%
+ }
+}
+\def\pgf@lib@dv@samplesorsteps#1#2#3s{%
+ \pgfutil@ifnextchar t{% step
+ \pgf@lib@dv@step{#1}{#2}{#3}%
+ }{% sample
+ \pgf@lib@dv@samples{#1}{#2}{#3}%
+ }%
+}
+\def\pgf@lib@dv@step#1#2#3tep#4;{%
+ \expandafter\def\expandafter\pgf@lib@dv@parsed\expandafter{\pgf@lib@dv@parsed\pgf@lib@dv@step@var{#1}{#2}{#3}{#4}}%
+ \pgf@lib@dv@func@parse%
+}
+\def\pgf@lib@dv@samples#1#2#3amples#4;{%
+ \expandafter\def\expandafter\pgf@lib@dv@parsed\expandafter{\pgf@lib@dv@parsed\pgf@lib@dv@samples@var{#1}{#2}{#3}{#4}}%
+ \pgf@lib@dv@func@parse%
+}
+
+%
+% Executer...
+%
+\def\pgf@lib@dv@samples@var#1#2#3#4{%
+ \pgfmathparse{#3}%
+ \let\pgf@lib@dv@temp=\pgfmathresult%
+ \pgfmathparse{#2}%
+ \pgfmathparse{\pgf@lib@dv@temp-\pgfmathresult}%
+ \pgfmathparse{\pgfmathresult/(#4-1)}%
+ \let\pgf@lib@dv@temp=\pgfmathresult%
+ \pgf@lib@dv@step@var{#1}{#2}{#3}{\pgf@lib@dv@temp}%
+}
+
+\def\pgf@lib@dv@step@var#1#2#3#4#5\pgf@stop{%
+ {%
+ \def\pgf@loop@body{#5}%
+ \pgfmathparse{#2}%
+ \pgfkeyslet{/data point/#1}{\pgfmathresult}%
+ \pgfmathparse{#3}%
+ \let\pgf@loop@end\pgfmathresult%
+ \pgfmathparse{#4}%
+ \let\pgf@loop@step\pgfmathresult%
+ \pgfmathloop%
+ \pgfmathlessthan{\pgf@loop@end}{\pgfkeysvalueof{/data point/#1}}
+ \ifdim\pgfmathresult pt<1pt\relax%
+ \pgf@loop@body\pgf@stop%
+ \pgfmathparse{\pgfkeysvalueof{/data point/#1}+\pgf@loop@step}%
+ \pgfkeyslet{/data point/#1}{\pgfmathresult}%
+ \repeatpgfmathloop%%
+ }%
+}
+
+\def\pgf@lib@dv@eval@func#1#2{%
+ \pgfkeysvalueof{/pgf/data/evaluator}{#2}%
+ \pgfkeyslet{/data point/#1}{\pgfmathresult}%
+}
+
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.polar.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.polar.code.tex
new file mode 100644
index 00000000000..f39adbbedaa
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/datavisualization/pgflibrarydatavisualization.polar.code.tex
@@ -0,0 +1,192 @@
+% 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/libraries/datavisualization/pgflibrarydatavisualization.polar.code.tex,v 1.2 2008/11/24 18:31:22 tantau Exp $
+
+\usepgfmodule{datavisualization}
+
+% This file defines code for doing plots involving polar
+% coordinates. This includes not only standard polar plots, but also
+% pie charts.
+
+
+
+\pgfooclass{polar transformer}
+{
+ % Class plor mapper
+ %
+ % A polar mapper is used to transform attributes given as (2d) polar
+ % coordinates to canvas coordinates. Note that no special ranges
+ % can be specified and that the angle must be given in degrees. You
+ % can, however, use a standard mapper to change these things.
+
+ \attribute angle;
+ % The attribute from which the angle is read.
+
+ \attribute radius;
+ % The attribute from which the radius is read.
+
+ \attribute unit vector 0 degrees;
+ % The unit vector 0 degrees
+
+ \attribute unit vector 90 degrees;
+ % The unit vector 90 degrees
+
+
+
+ % Constructor
+ %
+ % #1 = angle attribute. Example: rotation.
+ % #2 = radius attribute. Example: height.
+ % #3 = unit vector 0 degrees
+ % #4 = unit vector 90 degrees
+ %
+ \method polar transformer(#1,#2,#3,#4) {
+ \pgfooset{angle}{#1}
+ \pgfooset{radius}{#2}
+ \pgfooset{unit vector 0 degrees}{#3}
+ \pgfooset{unit vector 90 degrees}{#4}
+ }
+
+ % Method
+ \method default connects() {
+ \pgfoothis.get handle(\pgf@dv@me)
+ \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,transform,transform datapoint signal)
+ \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,path,path signal)
+ \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,direction,direction signal)
+ }
+
+ % Getters
+ \method get angle attribute(#1) {
+ \pgfooget{angle}{#1}
+ }
+
+ \method get radius attribute(#1) {
+ \pgfooget{radius}{#1}
+ }
+
+
+ % Slot
+ %
+ % This slot should be connected to the transform datapoint
+ % signal. When this signal is emitted, the coordinate system will be
+ % shifted according to the current value of the attribute.
+ \method transform() {
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{angle}/const}\pgf@dv@angle%
+ \ifx\pgf@dv@angle\relax
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{angle}}\pgf@dv@angle%
+ \fi
+ \ifx\pgf@dv@angle\relax\else%
+ \ifx\pgf@dv@angle\pgfutil@empty\else%
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{radius}/const}\pgf@dv@radius%
+ \ifx\pgf@dv@radius\relax
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{radius}}\pgf@dv@radius%
+ \fi
+ \ifx\pgf@dv@radius\pgfutil@empty\else%
+ \ifx\pgf@dv@radius\relax\else%
+ \pgfmathsincos{\pgf@dv@angle}%
+ \pgfmathmultiply{\pgfmathresultx}{\pgf@dv@radius}%
+ \let\pgf@dv@polar@temp=\pgfmathresult
+ \pgftransformshift{\pgfpointscale{\pgf@dv@polar@temp}{\pgfoovalueof{unit vector 0 degrees}}}%
+ \pgfmathmultiply{\pgfmathresulty}{\pgf@dv@radius}%
+ \let\pgf@dv@polar@temp=\pgfmathresult
+ \pgftransformshift{\pgfpointscale{\pgf@dv@polar@temp}{\pgfoovalueof{unit vector 90 degrees}}}%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ }
+
+
+
+ % Reaction to the path signal
+ %
+ % Here is what we do: When a pgfdvpathmoveto is done, the radius and
+ % the angle are recorded. When a pgfdvpathlineto is done, the saved
+ % radius and angle are compared with the new angle and radius. If,
+ % and only if, the radius is the same, but the angle is different,
+ % the lineto is caught and replaced by an arc from the previous
+ % position to the new position.
+
+ \attribute prev angle;
+ \attribute prev radius;
+
+ \method path(#1) {%
+ \ifpgfdvhandled%
+ \else%
+ \ifx#1\pgfdvpathlinetotoken
+ % Ok, let us have a look...
+ \pgfooget{prev radius}\pgf@dv@prev@rad
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{radius}}\pgf@dv@current@rad
+ \ifx\pgf@dv@current@rad\relax
+ \else
+ \ifdim\pgf@dv@current@rad pt=\pgf@dv@prev@rad pt%
+ \pgfooget{prev angle}\pgf@dv@prev@angle
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{angle}}\pgf@dv@current@angle
+ \ifx\pgf@dv@current@angle\relax
+ \else
+ \ifdim\pgf@dv@current@angle pt=\pgf@dv@prev@angle pt%
+ % do nothing
+ \else%
+ % Do arc:
+ \pgfpatharcaxes{\pgf@dv@prev@angle}{\pgf@dv@current@angle}
+ {\pgfpointscale{\pgf@dv@current@rad}{\pgfoovalueof{unit vector 0 degrees}}}
+ {\pgfpointscale{\pgf@dv@current@rad}{\pgfoovalueof{unit vector 90 degrees}}}%
+ \pgfdvhandledtrue%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ % No matter what, record the current position
+ \pgfooeset{prev angle}{\pgfkeysvalueof{/data point/\pgfoovalueof{angle}}}
+ \pgfooeset{prev radius}{\pgfkeysvalueof{/data point/\pgfoovalueof{radius}}}
+ }
+
+ % Method
+ %
+ % React to direction signals. See pgfpointdvdirection for an
+ % explanation
+ %
+ \method direction(#1) {%
+ \ifx#1\pgfdvdirectionfromtoken
+ % Record angle and radius
+ \xdef\pgf@dv@polar@from@angle{\pgfkeysvalueof{/data point/\pgfoovalueof{angle}}}
+ \xdef\pgf@dv@polar@from@radius{\pgfkeysvalueof{/data point/\pgfoovalueof{radius}}}
+ \else%
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{radius}}\pgf@dv@polar@to@radius
+ \ifx\pgf@dv@polar@to@radius\relax
+ \else
+ \ifdim\pgf@dv@polar@to@radius pt=\pgf@dv@polar@from@radius pt%
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{angle}}\pgf@dv@polar@to@angle
+ \ifx\pgf@dv@polar@to@angle\relax
+ \else
+ \ifdim\pgf@dv@polar@to@angle pt=\pgf@dv@polar@from@angle pt%
+ % do nothing
+ \else%
+ % Output vector that it orthogonal to start angle:
+ \ifdim\pgf@dv@polar@to@angle pt>\pgf@dv@polar@from@angle pt%
+ \pgf@process{\pgfpointpolar{\pgf@dv@polar@from@angle+90}{1pt}}
+ \else
+ \pgf@process{\pgfpointpolar{\pgf@dv@polar@from@angle-90}{1pt}}
+ \fi
+ \pgfdvhandledtrue
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ }
+}
+
+
+\endinput
+
+
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.footprints.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.footprints.code.tex
index 5cf633d0c59..5cf633d0c59 100644
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.footprints.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.footprints.code.tex
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.fractals.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.fractals.code.tex
index 22c9d8d1b27..22c9d8d1b27 100644
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.fractals.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.fractals.code.tex
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.markings.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.markings.code.tex
new file mode 100644
index 00000000000..dcb98da9119
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.markings.code.tex
@@ -0,0 +1,187 @@
+% 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.
+
+\usepgfmodule{decorations}
+
+
+% A marking decoration is used to add markings (which are just pgf
+% scopes, essentially) at certain positions of a path.
+
+\pgfkeys{
+ /pgf/decoration/reset marks/.code=\let\pgf@lib@dec@mark@marks=\pgfutil@empty,
+ /pgf/decoration/mark/.code=\pgf@lib@dec@parsemark#1\pgf@lib@dec@stop,
+}
+
+\let\pgf@lib@dec@mark@marks=\pgfutil@empty
+
+\def\pgf@lib@dec@parsemark{\pgfutil@ifnextchar b{\pgf@lib@dec@parsebetween}{\pgf@lib@dec@parseat}}
+\def\pgf@lib@dec@parseat at position#1with#2\pgf@lib@dec@stop{%
+ \expandafter\def\expandafter\pgf@lib@dec@mark@marks\expandafter{\pgf@lib@dec@mark@marks%
+ \pgf@lib@dec@domark{#1}{#2}%
+ }%
+}
+\def\pgf@lib@dec@parsebetween between positions#1and#2step#3with#4\pgf@lib@dec@stop{%
+ \expandafter\def\expandafter\pgf@lib@dec@mark@marks\expandafter{\pgf@lib@dec@mark@marks%
+ \pgf@lib@dec@dobetweenmark{#1}{#2}{#3}{#4}%
+ }%
+}
+
+\def\pgf@lib@dec@arrowhead#1#2{%
+ \expandafter\ifx\csname tikz@special@arrow@end#2\endcsname\relax% be nice to TikZ
+ \pgfsetarrowsend{#2}
+ \else%
+ \pgfsetarrowsend{\csname tikz@special@arrow@end#2\endcsname}%
+ \fi%
+ \pgf@x=0pt%
+ \pgf@shorten@end%
+ \pgftransformxshift{-\pgf@x}
+ \pgftransformxscale{#1}
+ \pgflowlevelsynccm%
+ \pgflowlevelobj{}{\pgf@endarrow}%
+}
+
+\def\pgf@lib@dec@doarrowhead#1{%
+ \pgf@lib@dec@arrowhead{1}{#1}%
+}
+\def\pgf@lib@dec@doarrowheadrev#1{%
+ \pgf@lib@dec@arrowhead{-1}{#1}%
+}
+
+
+\pgfdeclaredecoration{markings}{init}
+{
+ \state{init}
+ [
+ width=0pt,
+ persistent precomputation={%
+ \pgfkeys{/pgf/decoration/mark info/sequence number/.initial=0}%
+ \pgfkeys{/pgf/decoration/mark info/distance from start/.initial=}%
+ },
+ next state=pre
+ ]
+ {}
+
+ \state{pre}
+ [
+ width=0pt,
+ persistent precomputation={%
+ \def\pgf@lib@dec@computed@width{0pt}%
+ \pgf@lib@dec@mark@marks\pgf@lib@dec@mark@last%
+ \let\arrow=\pgf@lib@dec@doarrowhead%
+ \let\arrowreversed=\pgf@lib@dec@doarrowheadrev%
+ },
+ next state=skipper
+ ]
+ {}
+
+ \state{skipper}[width=\pgf@lib@dec@computed@width-\pgfdecoratedcompleteddistance-1sp,
+ next state=\pgf@lib@dec@next@state]{}
+
+ \state{main}
+ [
+ width=1sp,
+ next state=pre,
+ persistent precomputation={%
+ \pgfutil@tempcnta=\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}\relax%
+ \advance\pgfutil@tempcnta by1\relax%
+ \pgfkeys{/pgf/decoration/mark info/sequence number/.expanded=\the\pgfutil@tempcnta}%
+ \pgfkeys{/pgf/decoration/mark info/distance from start/.expanded=\pgf@lib@dec@computed@width}%
+ }%
+ ]
+ {%
+ \pgfinterruptpath%
+ \pgfscope%
+ \let\pgf@lib@dec@mark@marks=\pgfutil@empty%
+ \pgf@lib@dec@computed@action%
+ \endpgfscope%
+ \endpgfinterruptpath%
+ \ifx\pgf@lib@mark@node\pgfutil@empty%
+ \else%
+ \pgf@lib@mark@connect@node%
+ \fi%
+ }%
+
+ \state{final}[width=\pgfdecoratedremainingdistance]{
+ \ifx\pgf@lib@mark@node\pgfutil@empty%
+ \pgfpathmoveto{\pgfpointdecoratedpathlast}
+ \else%
+ \pgfpathlineto{\pgfpointdecoratedpathlast}
+ \fi%
+ }
+}
+
+\def\pgf@lib@dec@domark#1#2#3\pgf@lib@dec@mark@last{%
+ \def\pgf@lib@dec@mark@marks{#3}%
+ \pgf@lib@dec@parsenum{#1}%
+ \def\pgf@lib@dec@computed@action{#2}%
+ \def\pgf@lib@dec@next@state{main}%
+}
+
+
+\def\pgf@lib@dec@dobetweenmark#1#2#3#4#5\pgf@lib@dec@mark@last{%
+ \pgf@lib@dec@parsenum{#1}%
+ \let\pgf@lib@dec@mark@start=\pgf@lib@dec@computed@width%
+ \pgf@lib@dec@parsenum{#2}%
+ \let\pgf@lib@dec@mark@end=\pgf@lib@dec@computed@width%
+ \ifdim\pgf@lib@dec@mark@end<\pgf@lib@dec@mark@start\relax%
+ % Skip!
+ #5\pgf@lib@dec@mark@last%
+ \else%
+ %
+ \pgf@lib@dec@parsenum{#3}%
+ \pgfmathparse{\pgf@lib@dec@mark@start+\pgf@lib@dec@computed@width}%
+ % Update entry in mark list
+ \edef\pgf@temp{\noexpand\pgf@lib@dec@dobetweenmark{\pgfmathresult pt}{\pgf@lib@dec@mark@end}{\pgf@lib@dec@computed@width}}%
+ \expandafter\def\expandafter\pgf@lib@dec@mark@marks\expandafter{\pgf@temp{#4}#5}%
+ \let\pgf@lib@dec@computed@width\pgf@lib@dec@mark@start%
+ \def\pgf@lib@dec@computed@action{#4}%
+ \def\pgf@lib@dec@next@state{main}%
+ \fi%
+}
+
+
+\def\pgf@lib@dec@parsenum#1{%
+ \pgfmathparse{#1}%
+ \ifpgfmathunitsdeclared%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathparse{\pgfdecoratedpathlength\pgfmathresult pt}%
+ \else%
+ \pgfmathparse{\pgfmathresult pt}%
+ \fi%
+ \else%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathparse{\pgfdecoratedpathlength\pgfmathresult*\pgfdecoratedpathlength}%
+ \else%
+ \pgfmathparse{\pgfmathresult*\pgfdecoratedpathlength}%
+ \fi%
+ \fi%
+ \edef\pgf@lib@dec@computed@width{\pgfmathresult pt}%
+}
+
+\def\pgf@lib@dec@mark@last{%
+ \def\pgf@lib@dec@next@state{final}%
+}
+
+
+%
+% If you set the mark connection node inside a mark picture, the
+% output path will contain a line to this node
+%
+
+\pgfkeys{/pgf/decoration/mark connection node/.store in=\pgf@lib@mark@node,
+ /pgf/decoration/mark connection node=}
+\def\pgf@lib@mark@connect@node{%
+ % Line to "left" end of the node
+ \pgfpathlineto{\pgfpointshapeborder{\pgf@lib@mark@node}{\pgfqpoint{-1pt}{0pt}}}
+ % Move to "right" end of the node
+ \pgfpathmoveto{\pgfpointshapeborder{\pgf@lib@mark@node}{\pgfqpoint{1pt}{0pt}}}
+}%
+
+
+\endinput \ No newline at end of file
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.pathmorphing.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.pathmorphing.code.tex
index a6052489796..a6052489796 100644
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.pathmorphing.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.pathmorphing.code.tex
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.pathreplacing.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.pathreplacing.code.tex
index d07ae8ab6e5..e618ac996cf 100644
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.pathreplacing.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.pathreplacing.code.tex
@@ -1,4 +1,4 @@
-% Copyright 2008 by Mark Wibrow
+% Copyright 2008 by Mark Wibrow and Till Tantau
%
% This file may be distributed and/or modified
%
@@ -174,4 +174,54 @@
+% show path construction decoration
+%
+\pgfdeclaredecoration{show path construction}{check for moveto}{
+ \state{check for moveto}[width=0pt, next state=segment,
+ persistent precomputation={%
+ \begingroup%
+ \pgf@lib@decoraions@installinputsegmentpoints%
+ \ifx\pgfdecorationpreviousinputsegment\pgfdecorationinputsegmentmoveto%
+ \pgfdecoratedinputsegmentmovetocode%
+ \fi%
+ \endgroup%
+ }]{}
+ \state{segment}[width=\pgfdecoratedinputsegmentremainingdistance, next state=check for moveto,
+ persistent precomputation={%
+ \begingroup%
+ \pgf@lib@decoraions@installinputsegmentpoints%
+ \csname pgfdecoratedinputsegment\pgfdecorationcurrentinputsegment code\endcsname%
+ \endgroup%
+ }]{}
+ \state{final}{%
+ \egroup%
+ \begingroup%
+ \pgf@lib@decoraions@installinputsegmentpoints%
+ \csname pgfdecoratedinputsegment\pgfdecorationcurrentinputsegment code\endcsname%
+ \endgroup%
+ \bgroup%
+ }
+}
+
+\pgfkeys{
+ /pgf/decoration/.cd,
+ moveto code/.code=\def\pgfdecoratedinputsegmentmovetocode{#1},
+ lineto code/.code=\def\pgfdecoratedinputsegmentlinetocode{#1},
+ curveto code/.code=\def\pgfdecoratedinputsegmentcurvetocode{#1},
+ closepath code/.code=\def\pgfdecoratedinputsegmentclosepathcode{#1}
+}
+
+\let\pgfdecoratedinputsegmentmovetocode\pgfutil@empty%
+\let\pgfdecoratedinputsegmentlinetocode\pgfutil@empty%
+\let\pgfdecoratedinputsegmentcurvetocode\pgfutil@empty%
+\let\pgfdecoratedinputsegmentclosepathcode\pgfutil@empty%
+
+\def\pgf@lib@decoraions@installinputsegmentpoints{%
+ \let\pgfpointdecoratedinputsegmentfirst\pgf@decorate@inputsegment@first%
+ \let\pgfpointdecoratedinputsegmentlast\pgf@decorate@inputsegment@last%
+ \let\pgfpointdecoratedinputsegmentsupporta\pgf@decorate@inputsegment@supporta%
+ \let\pgfpointdecoratedinputsegmentsupportb\pgf@decorate@inputsegment@supportb%
+}
+
+
\endinput \ No newline at end of file
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.shapes.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.shapes.code.tex
index 6e1b25101bd..6e1b25101bd 100644
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.shapes.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.shapes.code.tex
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.text.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.text.code.tex
new file mode 100644
index 00000000000..b13f3ce0199
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.text.code.tex
@@ -0,0 +1,347 @@
+% 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.
+
+\usepgfmodule{decorations}
+
+
+% Options for text decorations
+
+\pgfkeys{
+ /pgf/decoration/.cd,
+ text/.store in=\pgfdecorationtext,%
+ text color/.store in=\pgf@lib@decorationtextcolor,%
+ text format delimiters/.code={\expandafter\pgfsetdecoratetextformatdelimiters#1},
+ text align/.code={\pgfkeys{/pgf/decoration/text align/.cd,#1}},
+ text align/.cd,
+ align/.initial=left,
+ left/.style={/pgf/decoration/text align/align=left},
+ right/.style={/pgf/decoration/text align/align=right},
+ center/.style={/pgf/decoration/text align/align=center},
+ left indent/.initial=0pt,
+ right indent/.initial=0pt,
+ fit to path/.is if=pgf@lib@dec@text@fit,
+ fit to path stretching spaces/.default=true,
+ fit to path stretching spaces/.code={%
+ \csname pgf@lib@dec@text@fit#1\endcsname%
+ \csname pgf@lib@dec@text@stretch@spaces#1\endcsname%
+ }%
+}
+
+\newif\ifpgf@lib@dec@text@scan@space
+\newif\ifpgf@lib@dec@text@stretch@spaces
+\newif\ifpgf@lib@dec@text@fit
+
+\def\pgf@lib@decorationtextcolor{black}
+
+\def\pgf@lib@dec@text@left@text{left}
+\def\pgf@lib@dec@text@right@text{right}
+\def\pgf@lib@dec@text@right@center{center}
+
+% Decorates a path with a text. The path is removed during this
+% process
+
+\pgfdeclaredecoration{text along path}{initial}{
+\state{initial}[width=+0pt, next state=left indent,
+ persistent precomputation={%
+ \edef\pgf@lib@dec@text@indent@left{\pgfkeysvalueof{/pgf/decoration/text align/left indent}}%
+ \edef\pgf@lib@dec@text@indent@right{\pgfkeysvalueof{/pgf/decoration/text align/right indent}}%
+ \edef\pgf@lib@dec@text@align{\pgfkeysvalueof{/pgf/decoration/text align/align}}%
+ \pgfdecoratedremainingdistance=\pgfdecoratedpathlength%
+ \advance\pgfdecoratedremainingdistance by-\pgf@lib@dec@text@indent@right\relax%
+ \edef\pgfdecoratedpathlength{\the\pgfdecoratedremainingdistance}%
+ \pgf@lib@dec@text@getwidth%
+ \pgf@x=\pgf@lib@dec@text@width\relax%
+ \pgf@y=\pgfdecoratedremainingdistance%
+ \ifpgf@lib@dec@text@fit%
+ \advance\pgf@y by-\pgf@lib@dec@text@indent@left\relax%
+ \advance\pgf@y by-\pgf@x%
+ \ifpgf@lib@dec@text@stretch@spaces%
+ \def\pgf@lib@dec@text@character@shift{0pt}%
+ \divide\pgf@y by\pgf@lib@dec@space@count\relax%
+ \edef\pgf@lib@dec@text@space@shift{\the\pgf@y}%
+ \else%
+ \c@pgf@counta=\pgf@lib@dec@character@count\relax%
+ \advance\c@pgf@counta by-1\relax%
+ \divide\pgf@y by\c@pgf@counta\relax%
+ \edef\pgf@lib@dec@text@character@shift{\the\pgf@y}%
+ \def\pgf@lib@dec@text@space@shift{0pt}%
+ \fi%
+ \ifdim\pgf@y<0pt\relax%
+ \pgf@lib@dec@text@fitfalse%
+ \pgf@lib@dec@text@stretch@spacesfalse%
+ \def\pgf@lib@dec@text@character@shift{0pt}%
+ \def\pgf@lib@dec@text@space@shift{0pt}%
+ \fi%
+ \else%
+ \def\pgf@lib@dec@text@character@shift{0pt}%
+ \def\pgf@lib@dec@text@space@shift{0pt}%
+ \ifx\pgf@lib@dec@text@align\pgf@lib@dec@text@left@text%
+ \else%
+ \ifx\pgf@lib@dec@text@align\pgf@lib@dec@text@right@text%
+ \advance\pgf@y by-\pgf@x%
+ \edef\pgf@lib@dec@text@indent@left{\the\pgf@y}%
+ \else%
+ \advance\pgf@y by-\pgf@x%
+ \advance\pgf@y by-\pgf@lib@dec@text@indent@left\relax%
+ \pgf@y=0.5\pgf@y%
+ \advance\pgf@y by\pgf@lib@dec@text@indent@left\relax%
+ \edef\pgf@lib@dec@text@indent@left{\the\pgf@y}%
+ \fi%
+ \fi%
+ \fi%
+ \let\pgfdecorationrestoftext=\pgfdecorationtext%
+ }]{}
+\state{left indent}[width=+\pgf@lib@dec@text@indent@left, next state=scan]{}
+%
+\state{scan}[width=+0pt, next state=before typeset,
+ persistent precomputation={
+ \pgf@lib@dec@text@scanchar%
+ \ifvoid\pgf@lib@dec@text@box%
+ \setbox\pgf@lib@dec@text@box\hbox{}%
+ \wd\pgf@lib@dec@text@box16383pt\relax%
+ \fi%
+ }]{}
+%
+\state{before typeset}[width=+.5\wd\pgf@lib@dec@text@box, next state=typeset]{}
+%
+\state{typeset}[width=+0pt, next state=after typeset]
+{%
+ \pgftransformxshift{+-.5\wd\pgf@lib@dec@text@box}%
+ \setbox\pgf@hbox\hbox{\copy\pgf@lib@dec@text@box}%
+ \pgfqboxsynced\pgf@hbox%
+}
+\state{after typeset}[width=+.5\wd\pgf@lib@dec@text@box, next state=shift,
+ persistent precomputation={%
+ \ifpgf@lib@dec@text@fit%
+ \ifpgf@lib@dec@text@stretch@spaces%
+ \ifpgf@lib@dec@text@scan@space%
+ \let\pgf@lib@dec@text@shift=\pgf@lib@dec@text@space@shift%
+ \else%
+ \def\pgf@lib@dec@text@shift{0pt}%
+ \fi%
+ \else%
+ \let\pgf@lib@dec@text@shift=\pgf@lib@dec@text@character@shift%
+ \fi%
+ \else%
+ \def\pgf@lib@dec@text@shift{0pt}%
+ \fi%
+ }]{}
+\state{shift}[width=+\pgf@lib@dec@text@shift, next state=scan]{}
+\state{final}{}
+}
+
+
+% \pgfsetdecoratetextformatdelimiters
+%
+% Set the delimiters for formatting in the text decoration.
+% NB: Catcodes for delimiters should be 11 or 12.
+%
+% Examples:
+%
+% \pgfsetdecoratetextformatdelimiters{|}{}% 2nd argument can be empty.
+%
+% \def\pgfdecoratetext{A big |\color{red}|red|| apple.}
+%
+% \pgfsetdecoratetextformatdelimiters{[}{]}
+%
+% \def\pgfdecoratetext{The [\it]very[+\color{green}]green[] sprouts.}
+%
+\def\pgfsetdecoratetextformatdelimiters#1#2{%
+ \def\pgf@lib@dec@text@formatchar{#1}%
+ \def\pgf@test{#2}%
+ \ifx\pgf@test\pgfutil@empty%
+ \def\pgf@lib@dec@text@collectformat##1#1{%
+ \pgf@lib@dec@text@@collectformat##1\pgf@stop}%
+ \else%
+ \def\pgf@lib@dec@text@collectformat##1#2{%
+ \pgf@lib@dec@text@@collectformat##1\pgf@stop}%
+ \fi%
+}
+
+\pgfsetdecoratetextformatdelimiters{|}{}
+
+\newbox\pgf@lib@dec@text@box
+\newif\ifpgf@lib@decorate@textmathmode
+
+\let\pgfdecorationtext=\pgfutil@empty
+\let\pgfdecorationrestoftext=\pgfutil@empty%
+\let\pgf@lib@dec@text@format=\pgfutil@empty
+
+\def\pgf@lib@dec@text@scanchar{%
+ \pgf@lib@dec@text@scan@spacefalse%
+ \ifx\pgfdecorationrestoftext\pgfutil@empty%
+ \let\pgf@lib@dec@text@char\pgfutil@empty%
+ \setbox\pgf@lib@dec@text@box\box\pgfutil@voidb@x%
+ \let\pgf@next\relax%
+ \else%
+ \let\pgf@next\pgf@lib@dec@text@@scanchar%
+ \fi%
+ \pgf@next}
+
+\def\pgf@lib@dec@text@@scanchar{%
+ \expandafter\pgf@lib@dec@text@@@scanchar\pgfdecorationrestoftext\pgf@stop}
+
+\def\pgf@lib@dec@text@@@scanchar{%
+ \futurelet\pgf@lib@dec@lettoken%
+ \pgf@lib@dec@text@@@@scanchar}
+
+\def\pgf@lib@dec@text@@@@scanchar{%
+ \ifx\pgf@lib@dec@lettoken\pgfutil@sptoken%
+ \let\pgf@next\pgf@lib@dec@text@insertspace%
+ \else%
+ \let\pgf@next\pgf@lib@dec@text@@@@@scanchar%
+ \fi%
+ \pgf@next}
+
+\def\pgf@lib@dec@text@@@@@scanchar{%
+ \pgfutil@ifnextchar\bgroup{\pgf@lib@dec@text@collectgroup}%
+ {\pgf@lib@dec@text@@@@@@scanchar}}
+
+\def\pgf@lib@dec@text@collectgroup#1{%
+ \def\pgf@lib@dec@text@char{#1}%
+ \pgf@lib@dec@text@collectrestoftext}
+
+\def\pgf@lib@dec@text@@@@@@scanchar#1{%
+ \ifx#1\pgf@stop%
+ \pgf@lib@dec@text@box\box\pgfutil@voidb@x%
+ \let\pgf@next\pgf@lib@dec@text@endoftext%
+ \else%
+ \def\pgf@lib@dec@text@char{#1}%
+ \ifx#1\space%
+ \let\pgf@next\pgf@lib@dec@text@collectrestoftext%
+ \else%
+ \ifx#1\ %
+ \let\pgf@next\pgf@lib@dec@text@collectrestoftext%
+ \else%
+ \ifx\pgf@lib@dec@text@char\pgf@lib@dec@text@formatchar%
+ \let\pgf@next\pgf@lib@dec@text@collectformat%
+ \else%
+ \expandafter\ifcat\noexpand#1\relax%
+ \let\pgf@next\pgf@lib@dec@text@expandcs%
+ \else%
+ \ifnum\catcode`#1=3\relax%
+ \ifpgf@lib@decorate@textmathmode%
+ \pgf@lib@decorate@textmathmodefalse%
+ \else%
+ \pgf@lib@decorate@textmathmodetrue%
+ \fi%
+ \let\pgf@next\pgf@lib@dec@text@@@scanchar%
+ \else%
+ \let\pgf@next\pgf@lib@dec@text@collectrestoftext%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \pgf@next%
+}
+
+\def\pgf@lib@dec@text@@collectformat{%
+ \pgfutil@ifnextchar+{\pgf@lib@dec@text@addtoformat}{\pgf@lib@dec@text@setformat}}
+
+\def\pgf@lib@dec@text@setformat#1\pgf@stop{%
+ \def\pgf@lib@dec@text@format{#1}%
+ \pgf@lib@dec@text@@@scanchar%
+}
+
+\def\pgf@lib@dec@text@addtoformat+#1\pgf@stop{%
+ \expandafter\def\expandafter\pgf@lib@dec@text@format\expandafter{\pgf@lib@dec@text@format#1}%
+ \pgf@lib@dec@text@@@scanchar%
+}
+
+\def\pgf@lib@dec@text@insertspace{%
+ \pgf@lib@dec@text@scan@spacetrue%
+ \pgfutil@ifnextchar\bgroup{\pgf@lib@dec@text@@insertspacegrp}%
+ {\pgf@lib@dec@text@@insertspace}}
+
+\def\pgf@lib@dec@text@@insertspacegrp#1{%
+ \pgf@lib@dec@text@@@@@@scanchar\space{#1}}
+
+\def\pgf@lib@dec@text@@insertspace#1{%
+ \pgf@lib@dec@text@@@@@@scanchar\space#1}
+
+\def\pgf@lib@dec@text@expandcs{%
+ \expandafter\expandafter\expandafter\pgf@lib@dec@text@@@@@scanchar%
+ \pgf@lib@dec@text@char}
+
+\def\pgf@lib@dec@text@endoftext{%
+ \let\pgfdecoraterestoftext\pgfutil@empty%
+ \let\pgf@lib@dec@text@char\pgfutil@empty%
+}
+\def\pgf@lib@dec@text@collectrestoftext{%
+ \pgf@lib@dec@text@dobox%
+ \futurelet\pgf@lib@dec@text@lettoken%
+ \pgf@lib@dec@text@@collectrestoftext}
+
+\def\pgf@lib@dec@text@@collectrestoftext{%
+ \ifx\bgroup\pgf@lib@dec@text@lettoken%
+ \let\pgf@next\pgf@lib@dec@text@@@collectrestoftextgrp%
+ \else%
+ \let\pgf@next\pgf@lib@dec@text@@@collectrestoftext%
+ \fi%
+ \pgf@next}
+
+\def\pgf@lib@dec@text@@@collectrestoftextgrp#1#2\pgf@stop{\def\pgfdecorationrestoftext{{#1}#2}%
+}
+
+\def\pgf@lib@dec@text@@@collectrestoftext#1\pgf@stop{\def\pgfdecorationrestoftext{#1}}
+
+{%
+ \catcode`\$3 %
+ \gdef\pgf@lib@dec@mathshift{$}%
+ \catcode`\$9 $% For editors with annoying syntax highlighting.
+}%
+
+\def\pgf@lib@dec@text@dobox{%
+ \setbox\pgf@lib@dec@text@box\hbox{%
+ \pgfinterruptpicture%
+ \begingroup%
+ \pgfsetcolor{\pgf@lib@decorationtextcolor}%
+ \ifpgf@lib@decorate@textmathmode\pgf@lib@dec@mathshift\fi%
+ \pgf@lib@dec@text@format\relax%
+ \pgf@lib@dec@text@char%
+ \ifpgf@lib@decorate@textmathmode\pgf@lib@dec@mathshift\fi%
+ \endgroup%
+ \endpgfinterruptpicture%
+ }%
+}
+
+\def\pgf@lib@dec@text@getwidth{%
+ \begingroup%
+ \let\c@pgf@lib@dec@characters=\c@pgf@counta%
+ \let\c@pgf@lib@dec@spaces=\c@pgf@countb%
+ \let\pgfdecorationrestoftext=\pgfdecorationtext%
+ \c@pgf@lib@dec@spaces=0\relax%
+ \c@pgf@lib@dec@characters=0\relax%
+ \pgfmathloop%
+ \pgf@lib@dec@text@scanchar%
+ \ifvoid\pgf@lib@dec@text@box%
+ \else%
+ \setbox\pgf@hbox=\hbox{{%
+ \unhbox\pgf@hbox%
+ \unhbox\pgf@lib@dec@text@box%
+ }}%
+ \advance\c@pgf@lib@dec@characters by1\relax%
+ \ifpgf@lib@dec@text@scan@space%
+ \advance\c@pgf@lib@dec@spaces by1\relax%
+ \fi%
+ \repeatpgfmathloop%
+ \global\pgf@x=\the\wd\pgf@hbox%
+ \xdef\pgf@lib@dec@temp{\the\c@pgf@lib@dec@characters}%
+ \xdef\pgf@lib@dec@@temp{\the\c@pgf@lib@dec@spaces}%
+ \endgroup%
+ \edef\pgf@lib@dec@text@width{\the\pgf@x}%
+ \let\pgf@lib@dec@character@count=\pgf@lib@dec@temp%
+ \let\pgf@lib@dec@space@count=\pgf@lib@dec@@temp%
+}
+
+
+
+\endinput \ No newline at end of file
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.code.tex
index 9de07884dd5..d91a83b111f 100644
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.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/libraries/pgflibraryarrows.code.tex,v 1.7 2007/06/07 07:41:11 tantau Exp $
+\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryarrows.code.tex,v 1.9 2008/10/27 21:00:46 tantau Exp $
% A square bracket shaped arrow
@@ -228,6 +228,53 @@
}
+% A square shaped arrow
+\newdimen\arrowsize
+\pgfarrowsdeclare{square}{square}
+{
+ \arrowsize=0.4pt
+ \advance\arrowsize by.275\pgflinewidth%
+ \pgfarrowsleftextend{+-\arrowsize}
+ \advance\arrowsize by.5\pgflinewidth
+ \pgfarrowsrightextend{+\arrowsize}
+}
+{
+ \arrowsize=0.4pt
+ \advance\arrowsize by.275\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetroundjoin
+ \pgfpathmoveto{\pgfqpoint{1\arrowsize}{4\arrowsize}}
+ \pgfpathlineto{\pgfqpoint{-7\arrowsize}{4\arrowsize}}
+ \pgfpathlineto{\pgfqpoint{-7\arrowsize}{-4\arrowsize}}
+ \pgfpathlineto{\pgfqpoint{1\arrowsize}{-4\arrowsize}}
+ \pgfpathclose
+ \pgfusepathqfillstroke
+}
+% A open square shaped arrow
+
+\pgfarrowsdeclare{open square}{open square}%{{-.5bp}{8.5bp}}
+{
+ \arrowsize=0.4pt
+ \advance\arrowsize by.275\pgflinewidth%
+ \pgfarrowsleftextend{+-.5\pgflinewidth}
+ \advance\arrowsize by7\arrowsize
+ \advance\arrowsize by.5\pgflinewidth
+ \pgfarrowsrightextend{+\arrowsize}
+}
+{
+ \arrowsize=0.4pt
+ \advance\arrowsize by.275\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfsetroundjoin
+ \pgfpathmoveto{\pgfqpoint{8\arrowsize}{4\arrowsize}}
+ \pgfpathlineto{\pgfqpoint{0\arrowsize}{4\arrowsize}}
+ \pgfpathlineto{\pgfqpoint{0\arrowsize}{-4\arrowsize}}
+ \pgfpathlineto{\pgfqpoint{8\arrowsize}{-4\arrowsize}}
+ \pgfpathclose
+ \pgfusepathqstroke
+}
+
+
% A triangle shaped arrow
@@ -839,4 +886,46 @@
}
+
+
+
+% Mathematical arrows
+
+
+% The arrow tip of an \implies arrow, to be used with an inner line.
+%
+% Example:
+%
+% \pgfsetarrow{-implies}
+% \pgfsetlinewidth{1.8pt}
+% \pgfsetinnerlinewidth{1pt}
+
+\pgfarrowsdeclare{implies}{implies}
+{
+ \pgfmathsetlength{\pgfutil@tempdima}{.25\pgflinewidth+.25*\pgfinnerlinewidth}%
+ \pgfmathsetlength{\pgfutil@tempdimb}{.5\pgflinewidth-.5*\pgfinnerlinewidth}%
+ \pgfarrowsrightextend{2\pgfutil@tempdima+.5\pgfutil@tempdimb}
+ \pgfarrowsleftextend{1.3\pgfutil@tempdima+.5\pgfutil@tempdimb}
+}
+{
+ \pgfmathsetlength{\pgfutil@tempdima}{.25\pgflinewidth+.25*\pgfinnerlinewidth}%
+ \pgfmathsetlength{\pgfutil@tempdimb}{.5\pgflinewidth-.5*\pgfinnerlinewidth}%
+ \pgfsetlinewidth{\pgfutil@tempdimb}
+ \pgfsetdash{}{+0pt}
+ \pgfsetroundcap
+ \pgfsetroundjoin
+ \pgfpathmoveto{\pgfpoint{-1.4\pgfutil@tempdima}{2.65\pgfutil@tempdima}}
+ \pgfpathcurveto
+ {\pgfpoint{-0.75\pgfutil@tempdima}{1.25\pgfutil@tempdima}}
+ {\pgfpoint{1\pgfutil@tempdima}{0.05\pgfutil@tempdima}}
+ {\pgfpoint{2\pgfutil@tempdima}{0pt}}
+ \pgfpathcurveto
+ {\pgfpoint{1\pgfutil@tempdima}{-0.05\pgfutil@tempdima}}
+ {\pgfpoint{-.75\pgfutil@tempdima}{-1.25\pgfutil@tempdima}}
+ {\pgfpoint{-1.4\pgfutil@tempdima}{-2.65\pgfutil@tempdima}}
+ \pgfusepathqstroke
+}
+
+
+
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.markings.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.markings.code.tex
deleted file mode 100644
index b09975a9aef..00000000000
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.markings.code.tex
+++ /dev/null
@@ -1,114 +0,0 @@
-% 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.
-
-\usepgfmodule{decorations}
-
-
-% A marking decoration is used to add markings (which are just pgf
-% scopes, essentially) at certain positions of a path.
-
-\pgfkeys{
- /pgf/decoration/reset marks/.code=\let\pgf@lib@dec@mark@marks=\pgfutil@empty,
- /pgf/decoration/mark/.code=\pgf@lib@dec@parsemark#1\pgf@lib@dec@stop,
-}
-
-\let\pgf@lib@dec@mark@marks=\pgfutil@empty
-
-\def\pgf@lib@dec@parsemark at position#1with#2\pgf@lib@dec@stop{%
- \expandafter\def\expandafter\pgf@lib@dec@mark@marks\expandafter{\pgf@lib@dec@mark@marks%
- \pgf@lib@dec@domark{#1}{#2}%
- }%
-}
-
-\def\pgf@lib@dec@arrowhead#1#2{%
- \expandafter\ifx\csname tikz@special@arrow@end#2\endcsname\relax% be nice to TikZ
- \pgfsetarrowsend{#2}
- \else%
- \pgfsetarrowsend{\csname tikz@special@arrow@end#2\endcsname}%
- \fi%
- \pgf@x=0pt%
- \pgf@shorten@end%
- \pgftransformxshift{-\pgf@x}
- \pgftransformxscale{#1}
- \pgflowlevelsynccm%
- \pgflowlevelobj{}{\pgf@endarrow}%
-}
-
-\def\pgf@lib@dec@doarrowhead#1{%
- \pgf@lib@dec@arrowhead{1}{#1}%
-}
-\def\pgf@lib@dec@doarrowheadrev#1{%
- \pgf@lib@dec@arrowhead{-1}{#1}%
-}
-
-
-\pgfdeclaredecoration{markings}{pre}
-{
- \state{pre}
- [
- width=0pt,
- persistent precomputation={%
- \pgf@lib@dec@mark@marks\pgf@lib@dec@mark@last%
- \let\arrow=\pgf@lib@dec@doarrowhead%
- \let\arrowreversed=\pgf@lib@dec@doarrowheadrev%
- },
- next state=skipper
- ]
- {}
-
- \state{skipper}[width=\pgf@lib@dec@computed@width-\pgfdecoratedcompleteddistance-1sp,
- next state=\pgf@lib@dec@next@state]{}
-
- \state{main}
- [
- width=1sp,
- next state=pre
- ]
- {%
- \pgfinterruptpath%
- \pgfscope%
- \let\pgf@lib@dec@mark@marks=\pgfutil@empty%
- \pgf@lib@dec@computed@action%
- \endpgfscope%
- \endpgfinterruptpath%
- }%
-
- \state{final}[width=\pgfdecoratedremainingdistance]{}
-}
-
-\def\pgf@lib@dec@domark#1#2#3\pgf@lib@dec@mark@last{%
- \def\pgf@lib@dec@mark@marks{#3}%
- \pgf@lib@dec@parsenum{#1}%
- \def\pgf@lib@dec@computed@action{#2}%
- \def\pgf@lib@dec@next@state{main}%
-}
-
-\def\pgf@lib@dec@parsenum#1{%
- \pgfmathparse{#1}%
- \ifpgfmathunitsdeclared%
- \ifdim\pgfmathresult pt<0pt\relax%
- \edef\pgf@lib@dec@computed@width{\pgfdecoratedpathlength\pgfmathresult pt}%
- \else%
- \edef\pgf@lib@dec@computed@width{\pgfmathresult pt}%
- \fi%
- \else%
- \ifdim\pgfmathresult pt<0pt\relax%
- \edef\pgf@lib@dec@computed@width{\pgfdecoratedpathlength\pgfmathresult*\pgfdecoratedpathlength}%
- \else%
- \edef\pgf@lib@dec@computed@width{\pgfmathresult*\pgfdecoratedpathlength}%
- \fi%
- \fi%
-}
-
-\def\pgf@lib@dec@mark@last{%
- \def\pgf@lib@dec@next@state{final}%
-}
-
-
-\endinput \ No newline at end of file
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.text.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.text.code.tex
deleted file mode 100644
index b773e36563c..00000000000
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarydecorations.text.code.tex
+++ /dev/null
@@ -1,233 +0,0 @@
-% 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.
-
-\usepgfmodule{decorations}
-
-
-% Options for text decorations
-
-\pgfkeys{
- /pgf/decoration/.cd,
- text/.store in=\pgfdecorationtext,%
- text color/.store in=\pgf@lib@decorationtextcolor,%
- text format delimiters/.code={\expandafter\pgfsetdecoratetextformatdelimiters#1}
-}
-\def\pgf@lib@decorationtextcolor{black}
-
-% Decorates a path with a text. The path is removed during this
-% process
-
-\pgfdeclaredecoration{text along path}{initial}{
- \state{initial}[width=+0pt,
- next state=scan,
- persistent precomputation=\let\pgfdecorationrestoftext\pgfdecorationtext]
- {}
- \state{scan}[width=+0pt,
- next state=before typeset,
- persistent precomputation=
- {
- \pgf@lib@decorations@text@scanchar%
- \ifvoid\pgf@lib@decorations@text@box%
- \setbox\pgf@lib@decorations@text@box\hbox{}%
- \wd\pgf@lib@decorations@text@box16383pt\relax%
- \fi%
- }]
- {}
- \state{before typeset}[width=+.5\wd\pgf@lib@decorations@text@box, next state=typeset]{}
- \state{typeset}[width=+0pt, next state=after typeset]
- {
- \pgftransformxshift{+-.5\wd\pgf@lib@decorations@text@box}%
- \setbox\pgf@hbox\hbox{\copy\pgf@lib@decorations@text@box}%
- \pgfqboxsynced\pgf@hbox%
- }
- \state{after typeset}[width=+.5\wd\pgf@lib@decorations@text@box, next state=scan]{}
- \state{final}{}
-}
-
-
-% \pgfsetdecoratetextformatdelimiters
-%
-% Set the delimiters for formatting in the text decoration.
-% NB: Catcodes for delimiters should be 11 or 12.
-%
-% Examples:
-%
-% \pgfsetdecoratetextformatdelimiters{|}{}% 2nd argument can be empty.
-%
-% \def\pgfdecoratetext{A big |\color{red}|red|| apple.}
-%
-% \pgfsetdecoratetextformatdelimiters{[}{]}
-%
-% \def\pgfdecoratetext{The [\it]very[+\color{green}]green[] sprouts.}
-%
-\def\pgfsetdecoratetextformatdelimiters#1#2{%
- \def\pgf@lib@decorations@text@formatchar{#1}%
- \def\pgf@test{#2}%
- \ifx\pgf@test\pgfutil@empty%
- \def\pgf@lib@decorations@text@collectformat##1#1{%
- \pgf@lib@decorations@text@@collectformat##1\pgf@stop}%
- \else%
- \def\pgf@lib@decorations@text@collectformat##1#2{%
- \pgf@lib@decorations@text@@collectformat##1\pgf@stop}%
- \fi%
-}
-
-\pgfsetdecoratetextformatdelimiters{|}{}
-
-\newbox\pgf@lib@decorations@text@box
-\newif\ifpgf@lib@decorate@textmathmode
-
-\let\pgfdecorationtext\pgfutil@empty
-\let\pgfdecorationrestoftext\pgfutil@empty%
-\let\pgf@lib@decorations@text@format\pgfutil@empty
-
-\def\pgf@lib@decorations@text@scanchar{%
- \ifx\pgfdecorationrestoftext\pgfutil@empty%
- \let\pgf@lib@decorations@text@char\pgfutil@empty%
- \setbox\pgf@lib@decorations@text@box\box\voidb@x%
- \let\pgf@next\relax%
- \else%
- \let\pgf@next\pgf@lib@decorations@text@@scanchar%
- \fi%
- \pgf@next}
-
-\def\pgf@lib@decorations@text@@scanchar{%
- \expandafter\pgf@lib@decorations@text@@@scanchar\pgfdecorationrestoftext\pgf@stop}
-
-\def\pgf@lib@decorations@text@@@scanchar{%
- \futurelet\pgf@lib@decorations@lettoken%
- \pgf@lib@decorations@text@@@@scanchar}
-
-\def\pgf@lib@decorations@text@@@@scanchar{%
- \ifx\pgf@lib@decorations@lettoken\pgfutil@sptoken%
- \let\pgf@next\pgf@lib@decorations@text@insertspace%
- \else%
- \let\pgf@next\pgf@lib@decorations@text@@@@@scanchar%
- \fi%
- \pgf@next}
-
-\def\pgf@lib@decorations@text@@@@@scanchar{%
- \pgfutil@ifnextchar\bgroup{\pgf@lib@decorations@text@collectgroup}%
- {\pgf@lib@decorations@text@@@@@@scanchar}}
-
-\def\pgf@lib@decorations@text@collectgroup#1{%
- \def\pgf@lib@decorations@text@char{#1}%
- \pgf@lib@decorations@text@collectrestoftext}
-
-\def\pgf@lib@decorations@text@@@@@@scanchar#1{%
- \ifx#1\pgf@stop%
- \pgf@lib@decorations@text@box\box\voidb@x%
- \let\pgf@next\pgf@lib@decorations@text@endoftext%
- \else%
- \def\pgf@lib@decorations@text@char{#1}%
- \ifx#1\space%
- \let\pgf@next\pgf@lib@decorations@text@collectrestoftext%
- \else%
- \ifx#1\ %
- \let\pgf@next\pgf@lib@decorations@text@collectrestoftext%
- \else%
- \ifx\pgf@lib@decorations@text@char\pgf@lib@decorations@text@formatchar%
- \let\pgf@next\pgf@lib@decorations@text@collectformat%
- \else%
- \expandafter\ifcat\noexpand#1\relax%
- \let\pgf@next\pgf@lib@decorations@text@expandcs%
- \else%
- \ifnum\catcode`#1=3\relax%
- \ifpgf@lib@decorate@textmathmode%
- \pgf@lib@decorate@textmathmodefalse%
- \else%
- \pgf@lib@decorate@textmathmodetrue%
- \fi%
- \let\pgf@next\pgf@lib@decorations@text@@@scanchar%
- \else%
- \let\pgf@next\pgf@lib@decorations@text@collectrestoftext%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \pgf@next%
-}
-
-\def\pgf@lib@decorations@text@@collectformat{%
- \pgfutil@ifnextchar+{\pgf@lib@decorations@text@addtoformat}{\pgf@lib@decorations@text@setformat}}
-
-\def\pgf@lib@decorations@text@setformat#1\pgf@stop{%
- \def\pgf@lib@decorations@text@format{#1}%
- \pgf@lib@decorations@text@@@scanchar%
-}
-
-\def\pgf@lib@decorations@text@addtoformat+#1\pgf@stop{%
- \expandafter\def\expandafter\pgf@lib@decorations@text@format\expandafter{\pgf@lib@decorations@text@format#1}%
- \pgf@lib@decorations@text@@@scanchar%
-}
-
-\def\pgf@lib@decorations@text@insertspace{%
- \pgfutil@ifnextchar\bgroup{\pgf@lib@decorations@text@@insertspacegrp}%
- {\pgf@lib@decorations@text@@insertspace}}
-
-\def\pgf@lib@decorations@text@@insertspacegrp#1{%
- \pgf@lib@decorations@text@@@@@@scanchar\space{#1}}
-
-\def\pgf@lib@decorations@text@@insertspace#1{%
- \pgf@lib@decorations@text@@@@@@scanchar\space#1}
-
-\def\pgf@lib@decorations@text@expandcs{%
- \expandafter\expandafter\expandafter\pgf@lib@decorations@text@@@@@scanchar%
- \pgf@lib@decorations@text@char}
-
-\def\pgf@lib@decorations@text@endoftext{%
- \let\pgfdecoraterestoftext\pgfutil@empty%
- \let\pgf@lib@decorations@text@char\pgfutil@empty%
-}
-\def\pgf@lib@decorations@text@collectrestoftext{%
- \pgf@lib@decorations@text@dobox%
- \futurelet\pgf@lib@decorations@text@lettoken%
- \pgf@lib@decorations@text@@collectrestoftext}
-
-\def\pgf@lib@decorations@text@@collectrestoftext{%
- \ifx\bgroup\pgf@lib@decorations@text@lettoken%
- \let\pgf@next\pgf@lib@decorations@text@@@collectrestoftextgrp%
- \else%
- \let\pgf@next\pgf@lib@decorations@text@@@collectrestoftext%
- \fi%
- \pgf@next}
-
-\def\pgf@lib@decorations@text@@@collectrestoftextgrp#1#2\pgf@stop{\def\pgfdecorationrestoftext{{#1}#2}%
-}
-
-\def\pgf@lib@decorations@text@@@collectrestoftext#1\pgf@stop{\def\pgfdecorationrestoftext{#1}}
-
-{%
- \catcode`\$3 %
- \gdef\pgf@lib@decorations@mathshift{$}%
- \catcode`\$9 $% For editors with annoying syntax highlighting.
-}%
-
-\def\pgf@lib@decorations@text@dobox{%
- \setbox\pgf@lib@decorations@text@box\hbox{%
- \pgfinterruptpicture%
- \begingroup%
- \pgfsetcolor{\pgf@lib@decorationtextcolor}%
- \ifpgf@lib@decorate@textmathmode\pgf@lib@decorations@mathshift\fi%
- \pgf@lib@decorations@text@format\relax%
- \pgf@lib@decorations@text@char%
- \ifpgf@lib@decorate@textmathmode\pgf@lib@decorations@mathshift\fi%
- \endgroup%
- \endpgfinterruptpicture%
- }%
-}
-
-
-
-
-
-
-\endinput \ No newline at end of file
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfixedpointarithmetic.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfixedpointarithmetic.code.tex
new file mode 100644
index 00000000000..240eddf4435
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfixedpointarithmetic.code.tex
@@ -0,0 +1,637 @@
+% Copyright 2006 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.
+
+
+\pgfkeys{/pgf/.cd,
+ fixed point arithmetic/.code={%
+ \pgfmathfp@plots@install%
+ \pgfmathfp@parser@install%
+ \let\pgfmathparse=\pgfmathfpparse%
+ \pgfkeys{/pgf/fixed point/.cd, #1}%
+ },%
+ fixed point/.cd,
+ scale results/.code={%
+ \pgfmathfpparse{#1}%
+ \let\pgfmathfpscale=\pgfmathresult%
+ }%
+}
+
+\def\pgfmathfpscale{1}
+
+\def\pgfmathfpparse{%
+ \begingroup%
+ \let\pgfmathpostparse=\relax%
+ \pgfmath@catcodes%
+ \pgfmath@quickparsefalse%
+ \pgfmathfpparse@}
+
+\def\pgfmathfpparse@#1{%
+ \edef\pgfmathfp@expression{#1}%
+ \expandafter\pgfmathfpparse@@\pgfmathfp@expression\pgfmathfp@}
+
+\def\pgfmathfp@char@asterisk{*}
+\def\pgfmathfpparse@@#1#2\pgfmathfp@{%
+ \def\pgfmathfp@test{#1}%
+ \ifx\pgfmathfp@test\pgfmathfp@char@asterisk%
+ \edef\pgfmathfp@expression{\pgfmathfpscale#1#2}%
+ \else%
+ \edef\pgfmathfp@expression{#1#2}%
+ \fi%
+ \expandafter\pgfmathparse@\expandafter{\pgfmathfp@expression}%
+ % \endgroup provided by \pgfpathmarse@end
+}
+
+% Crude handling of file plots
+%
+\pgfkeys{/pgf/fixed point/.cd,
+ scale file plot x/.code=\pgfmathfpparse{#1}\edef\pgfmathfpplotscalex{\pgfmathresult*},
+ scale file plot y/.code=\pgfmathfpparse{#1}\edef\pgfmathfpplotscaley{\pgfmathresult*},
+ scale file plot z/.code=\pgfmathfpparse{#1}\edef\pgfmathfpplotscalez{\pgfmathresult*}
+}
+
+\def\pgfmathfp@plots@install{%
+ \let\pgfmathfpplotscalex=\pgfutil@empty
+ \let\pgfmathfpplotscaley=\pgfutil@empty
+ \let\pgfmathfpplotscalez=\pgfutil@empty
+ \let\pgf@parsexyline=\pgfmathfp@parsexyline%
+ \let\pgf@parsexyzline=\pgfmathfp@parsexyzline%
+}
+
+\def\pgfmathfp@parsexyline#1 #2 #3\pgf@stop{%
+ \edef\pgfmathfp@marshal{%
+ \noexpand\pgfplotstreampoint{\noexpand\pgfpointxy{\pgfmathfpplotscalex#1}{\pgfmathfpplotscaley#2}}%
+ }%
+ \pgfmathfp@marshal%
+}
+
+\def\pgfmathfp@parsexyzline#1 #2 #3 #4\pgf@stop{%
+ \edef\pgfmathfp@marshal{%
+ \noexpand\pgfplotstreampoint{%
+ \noexpand\pgfpointxyz{\pgfmathfpplotscalex#1}{\pgfmathfpplotscaley#2}{\pgfmathfpplotscalez#3}%
+ }%
+ }%
+ \pgfmathfp@marshal%
+}
+
+%
+\def\pgfmathfp@parser@install{%
+ %
+ \expandafter\ifx\csname FP@version\endcsname\relax%
+ \PackageError{pgf}{You need to say `\string\usepackage{fp}' to use %
+ fixed point arithmetic}{}%
+ \else%
+ %
+ % Don't want messages.
+ %
+ \FPmessagesfalse%
+ \FPdebugfalse%
+ %
+ % Install float commands...
+ %
+ \let\pgfmathadd@=\pgfmathfpadd@%
+ \let\pgfmathsubtract@=\pgfmathfpsubtract@%
+ \let\pgfmathmultiply@=\pgfmathfpmultiply@%
+ \let\pgfmathdivide@=\pgfmathfpdivide@%
+ \let\pgfmathabs@=\pgfmathfpabs@%
+ \let\pgfmathround@=\pgfmathfpround@%
+ \let\pgfmathfloor@=\pgfmathfpfloor@%
+ \let\pgfmathceil@=\pgfmathfpceil@%
+ \let\pgfmathmod@=\pgfmathfpmod@%
+ \let\pgfmathmax@=\pgfmathfpmax@%
+ \let\pgfmathmin@=\pgfmathfpmin@%
+ \let\pgfmathsin@=\pgfmathfpsin@%
+ \let\pgfmathcos@=\pgfmathfpcos@%
+ \let\pgfmathtan@=\pgfmathfptan@%
+ \let\pgfmathdeg@=\pgfmathfpdeg@%
+ \let\pgfmathrad@=\pgfmathfprad@%
+ \let\pgfmathatan@=\pgfmathfpatan@%
+ \let\pgfmathasin@=\pgfmathfpasin@%
+ \let\pgfmathacos@=\pgfmathfpacos@%
+ \let\pgfmathcot@=\pgfmathfpcot@%
+ \let\pgfmathsec@=\pgfmathfpsec@%
+ \let\pgfmathcosec@=\pgfmathfpcosec@%
+ \let\pgfmathpow@=\pgfmathfppow@%
+ \let\pgfmathexp@=\pgfmathfpexp@%
+ \let\pgfmathln@=\pgfmathfpln@%
+ \let\pgfmathsqrt@=\pgfmathfpsqrt@%
+ \let\pgfmath@pi=\pgfmathfppi@%
+ \let\pgfmathveclen@=\pgfmathfpveclen@%
+ \let\pgfmathe@=\pgfmathfpe@%
+ %
+ \let\pgfmathlessthan@=\pgfmathfplessthan@%
+ \let\pgfmathgreaterthan@=\pgfmathfpgreaterthan@%
+ \let\pgfmathequalto@=\pgfmathfpequalto@%
+ %
+ \let\pgfmathrnd=\pgfmathfprnd%
+ \let\pgfmathrand=\pgfmathfprand%
+ \let\pgfmathsetseed=\pgfmathfpsetseed%
+ %
+ \let\pgfmathscientific=\pgfmathfpscientific%
+ \fi%
+}%
+
+\def\pgfmathfpe@{let\pgfmathresult=\FPe}%
+\def\pgfmathfppi@{let\pgfmathresult=\FPpi}%
+
+
+% Scientific notation.
+
+\def\pgfmathfpscientific#1#2{%
+ \begingroup%
+ \FPpow\pgfmathresult{10}{#2}\unskip% Needed.
+ \FPmul\pgfmathresult{#1}{\pgfmathresult}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% Comparison stuff...
+
+% lessthan
+%
+\def\pgfmathfplessthan#1#2{%
+ \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult%
+ \pgfmathfpparse{#1}%
+ \pgfmathfplessthan@{\pgfmathresult}{\pgfmath@result}%
+}
+\def\pgfmathfplessthan@#1#2{%
+ \begingroup%
+ \FPiflt{#1}{#2}%
+ \def\pgfmathresult{1.0}%
+ \else%
+ \def\pgfmathresult{0.0}%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% greaterthan
+%
+\def\pgfmathfpgreaterthan#1#2{%
+ \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpgreaterthan@{\pgfmathresult}{\pgfmath@result}%
+}
+\def\pgfmathfpgreaterthan@#1#2{%
+ \begingroup%
+ \FPifgt{#1}{#2}%
+ \def\pgfmathresult{1.0}%
+ \else%
+ \def\pgfmathresult{0.0}%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% equalto
+%
+\def\pgfmathfpequalto#1#2{%
+ \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpequalto@{\pgfmathresult}{\pgfmath@result}%
+}
+\def\pgfmathfpequalto@#1#2{%
+ \begingroup%
+ \FPifeq{#1}{#2}%
+ \def\pgfmathresult{1.0}%
+ \else%
+ \def\pgfmathresult{0.0}%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+
+% Basic arithmetic stuff...
+
+% add
+%
+\def\pgfmathfpadd#1#2{%
+ \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpadd@{\pgfmathresult}{\pgfmath@result}%
+}
+\def\pgfmathfpadd@#1#2{%
+ \begingroup%
+ \FPadd\pgfmathresult{#1}{#2}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% subtract
+%
+\def\pgfmathfpsubtract#1#2{%
+ \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpsubtract@{\pgfmathresult}{\pgfmath@result}%
+}
+\def\pgfmathfpsubtract@#1#2{%
+ \begingroup%
+ \FPsub\pgfmathresult{#1}{#2}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% multiply
+%
+\def\pgfmathfpmultiply#1#2{%
+ \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpmultiply@{\pgfmathresult}{\pgfmath@result}%
+}
+\def\pgfmathfpmultiply@#1#2{%
+ \begingroup%
+ \FPmul\pgfmathresult{#1}{#2}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% divide
+%
+\def\pgfmathfpdivide#1#2{%
+ \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpdivide@{\pgfmathresult}{\pgfmath@result}%
+}
+\def\pgfmathfpdivide@#1#2{%
+ \begingroup%
+ \FPdiv\pgfmathresult{#1}{#2}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% abs
+%
+\def\pgfmathfpabs#1{%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpabs@{\pgfmathresult}%
+}
+\def\pgfmathfpabs@#1{%
+ \begingroup%
+ \FPabs\pgfmathresult{#1}
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% round
+%
+\def\pgfmathfpround#1{%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpround@{\pgfmathresult}%
+}
+\def\pgfmathfpround@#1{%
+ \begingroup%
+ \FPround\pgfmathresult{#1}{0}%
+ \edef\pgfmathresult{\pgfmathresult.0}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% floor
+%
+\def\pgfmathfpfloor#1{%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpfloor@{\pgfmathresult}%
+}
+\def\pgfmathfpfloor@#1{%
+ \begingroup%
+ \FPtrunc\pgfmathresult{#1}{0}%
+ \FPifneg{#1}%
+ \FPsub\pgfmathresult{\pgfmathresult}{1}%
+ \fi%
+ \edef\pgfmathresult{\pgfmathresult.0}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% ceil
+%
+\def\pgfmathfpceil#1{%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpceil@{\pgfmathresult}%
+}
+\def\pgfmathfpceil@#1{%
+ \begingroup%
+ \FPtrunc\pgfmathresult{#1}{0}%
+ \FPifpos{#1}%
+ \FPadd\pgfmathresult{\pgfmathresult}{1}%
+ \fi%
+ \edef\pgfmathresult{\pgfmathresult.0}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% mod
+%
+\def\pgfmathfpmod#1#2{%
+ \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpmod@{\pgfmathresult}{\pgfmath@result}%
+}
+\def\pgfmathfpmod@#1#2{%
+ \begingroup%
+ \FPdiv\pgfmathresult{#1}{#2}%
+ \FPtrunc\pgfmathresult{\pgfmathresult}{0}%
+ \FPmul\pgfmathresult{\pgfmathresult}{#2}%
+ \FPsub\pgfmathresult{#1}{\pgfmathresult}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% max
+%
+\def\pgfmathfpmax#1#2{%
+ \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpmax@{\pgfmathresult}{\pgfmath@result}%
+}
+\def\pgfmathfpmax@#1#2{%
+ \begingroup%
+ \FPifgt{#1}{#2}%
+ \def\pgfmathresult{#1}%
+ \else%
+ \def\pgfmathresult{#2}%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% min
+%
+\def\pgfmathfpmin#1#2{%
+ \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpmin@{\pgfmathresult}{\pgfmath@result}%
+}
+\def\pgfmathfpmin@#1#2{%
+ \begingroup%
+ \FPiflt{#1}{#2}%
+ \def\pgfmathresult{#1}%
+ \else%
+ \def\pgfmathresult{#2}%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% Functions...
+
+% pow
+%
+\def\pgfmathfppow#1#2{%
+ \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult%
+ \pgfmathfpparse{#1}%
+ \pgfmathfppow@{\pgfmathresult}{\pgfmath@result}%
+}
+\def\pgfmathfppow@#1#2{%
+ \begingroup%
+ \FPpow\pgfmathresult{#1}{#2}\unskip%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% exp
+%
+\def\pgfmathfpexp#1{%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpexp@{\pgfmathresult}%
+}
+\def\pgfmathfpexp@#1{%
+ \begingroup%
+ \FPexp\pgfmathresult{#1}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% ln
+%
+\def\pgfmathfpln#1{%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpln@{\pgfmathresult}%
+}
+\def\pgfmathfpln@#1{%
+ \begingroup%
+ \FPln\pgfmathresult{#1}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% sqrt
+%
+\def\pgfmathfpsqrt#1{%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpsqrt@{\pgfmathresult}%
+}
+\def\pgfmathfpsqrt@#1{%
+ \begingroup%
+ \FProot\pgfmathresult{#1}{2}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% veclen
+%
+\def\pgfmathfpveclen#1#2{%
+ \pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpveclen@{\pgfmathresult}{\pgfmath@result}%
+}
+\def\pgfmathfpveclen@#1#2{%
+ \begingroup%
+ \FPmul\pgfmath@result{#1}{#1}%
+ \FPmul\pgfmath@@result{#2}{#2}%
+ \FPadd\pgfmathresult{\pgfmath@result}{\pgfmath@@result}%
+ \FProot\pgfmathresult{\pgfmathresult}{2}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% Trigonometric stuff...
+
+% sin
+%
+\def\pgfmathfpsin#1{%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpsin@{\pgfmathresult}%
+}
+\def\pgfmathfpsin@#1{%
+ \begingroup%
+ \FPmul\pgfmathresult{#1}{0.017453292519943295}%
+ \FPsin\pgfmathresult{\pgfmathresult}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% cos
+%
+\def\pgfmathfpcos#1{%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpcos@{\pgfmathresult}%
+}
+\def\pgfmathfpcos@#1{%
+ \begingroup%
+ \FPmul\pgfmathresult{#1}{0.017453292519943295}%
+ \FPcos\pgfmathresult{\pgfmathresult}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% tan
+%
+\def\pgfmathfptan#1{%
+ \pgfmathfpparse{#1}%
+ \pgfmathfptan@{\pgfmathresult}%
+}
+\def\pgfmathfptan@#1{%
+ \begingroup%
+ \FPmul\pgfmathresult{#1}{0.017453292519943295}%
+ \FPtan\pgfmathresult{\pgfmathresult}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% acos
+%
+\def\pgfmathfpacos#1{%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpacos@{\pgfmathresult}%
+}
+\def\pgfmathfpacos@#1{%
+ \begingroup%
+ \FParccos\pgfmathresult{#1}%
+ \FPmul\pgfmathresult{\pgfmathresult}{57.295779513082320885}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% asin
+%
+\def\pgfmathfpasin#1{%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpasin@{\pgfmathresult}%
+}
+\def\pgfmathfpasin@#1{%
+ \begingroup%
+ \FParcsin\pgfmathresult{#1}%
+ \FPmul\pgfmathresult{\pgfmathresult}{57.295779513082320885}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% atan
+%
+\def\pgfmathfpatan#1{%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpatan@{\pgfmathresult}%
+}
+\def\pgfmathfpatan@#1{%
+ \begingroup%
+ \FParctan\pgfmathresult{#1}%
+ \FPmul\pgfmathresult{\pgfmathresult}{57.295779513082320885}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% cot
+%
+\def\pgfmathfpcot#1{%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpcot@{\pgfmathresult}%
+}
+\def\pgfmathfpcot@#1{%
+ \begingroup%
+ \FPmul\pgfmathresult{#1}{0.017453292519943295}%
+ \FPcot\pgfmathresult{\pgfmathresult}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% sec
+%
+\def\pgfmathfpsec#1{%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpsec@{\pgfmathresult}%
+}
+\def\pgfmathfpsec@#1{%
+ \begingroup%
+ \FPmul\pgfmathresult{#1}{0.017453292519943295}%
+ \FPcos\pgfmathresult{\pgfmathresult}%
+ \FPdiv\pgfmathresult{1}{\pgfmathresult}
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% cosec
+%
+\def\pgfmathfpcosec#1{%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpcosec@{\pgfmathresult}%
+}
+\def\pgfmathfpcosec@#1{%
+ \begingroup%
+ \FPmul\pgfmathresult{#1}{0.017453292519943295}%
+ \FPsin\pgfmathresult{\pgfmathresult}%
+ \FPdiv\pgfmathresult{1}{\pgfmathresult}
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% deg
+%
+\def\pgfmathfpdeg#1{%
+ \pgfmathfpparse{#1}%
+ \pgfmathfpdeg@{\pgfmathresult}%
+}
+\def\pgfmathfpdeg@#1{%
+ \begingroup%
+ \FPmul\pgfmathresult{#1}{57.295779513082320885}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% rad
+%
+\def\pgfmathfprad#1{%
+ \pgfmathfpparse{#1}%
+ \pgfmathfprad@{\pgfmathresult}%
+}
+\def\pgfmathfprad@#1{%
+ \begingroup%
+ \FPmul\pgfmathresult{#1}{0.01745329251994325}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% Random stuff...
+
+\def\pgfmathfpsetseed#1{%
+ \pgfmathfpparse{#1}%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \FPseed\pgfmathresult\relax\pgfmath@%
+}
+
+% rnd
+%
+\def\pgfmathfprnd{%
+ \begingroup%
+ \FPrandom\pgfmathresult%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% rand
+%
+\def\pgfmathfprand{%
+ \begingroup%
+ \FPrandom\pgfmathresult%
+ \FPmul\pgfmathresult{2}{\pgfmathresult}%
+ \FPsub\pgfmathresult{\pgfmathresult}{1}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfpu.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfpu.code.tex
new file mode 100644
index 00000000000..cecc76d593e
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryfpu.code.tex
@@ -0,0 +1,1965 @@
+% 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.
+
+\newif\ifpgfmathfloatparseactive
+\newif\ifpgfmathfloat@scaleactive
+
+% public macro which invokes '#1' if the fpu is installed and ready and '#2'
+% otherwise.
+\def\pgflibraryfpuifactive#1#2{%
+ \ifpgfmathfloatparseactive
+ #1%
+ \else
+ #2%
+ \fi
+}%
+
+\pgfqkeys{/pgf}{
+ % enable the FPU parser if it is not yet active
+ %
+ % It will be deactivated after the current TeX group
+ fpu/.is choice,
+ fpu/true/.code={%
+ \ifpgfmathfloatparseactive
+ \else
+ \pgfutil@ifundefined{pgfmathdeclarefunction}{%
+ % Ohoh - we are running on a TeX distribution with
+ % PGF 2.00 which doesn't have the new math engine.
+ % I can provide special treatment here, provided that
+ % all float commands are still able to run (that means
+ % more information needs to be copied from the pgf cvs
+ % to pgf 2.00 - for example pgfmathfloat.code.tex).
+ %
+ % I employ this to work with pgfplots and pgf 2.00
+ % using all new features.
+ \pgfmathfloat@parser@install@pgf@two@null@null%
+ }{%
+ \pgfmathfloat@parser@install%
+ }%
+ \pgfmathfloatparseactivetrue
+ % improve compatibility with Marks FP library:
+ \pgfkeysalso{/pgf/fixed point arithmetic/.prefix style={/pgf/fpu=false}}%
+ \fi
+ },%
+ fpu/false/.code={%
+ \ifpgfmathfloatparseactive
+ \pgfmathfloat@uninstall%
+ \pgfmathfloatparseactivefalse
+ \fi
+ },%
+ fpu/.default=true,
+ % Use this to introduce a result scaling.
+ % Every expression in which the prefix '*' occurs
+ % will be multiplied with the result and converted to fixed point
+ % representation.
+ fpu/scale results/.code={%
+ \ifpgfmathfloatparseactive
+ \pgfmathparse{#1}%
+ \else
+ \pgfmathfloatparsenumber{#1}%
+ \fi
+ \let\pgfmathfloatscale=\pgfmathresult%
+ },%
+ % determines the output format of each complete expression parsing
+ % process. If 'scale results' is active, 'fixed' is assumed
+ % automatically.
+ fpu/output format/.is choice,
+ fpu/output format/float/.code= {\let\pgfmathfloatparse@output=\relax},
+ fpu/output format/sci/.code= {\def\pgfmathfloatparse@output{\pgfmathfloattosci@{\pgfmathresult}}},
+ fpu/output format/fixed/.code= {\def\pgfmathfloatparse@output{\pgfmathfloattofixed@{\pgfmathresult}}},
+ fpu/output format/float,
+ fpu/rel thresh/.code={%
+ \pgfmathfloatparsenumber{#1}%
+ \let\pgfmathfloat@relthresh=\pgfmathresult
+ },
+ fpu/rel thresh=1e-4,
+}
+
+\pgfmathfloatcreate{1}{1.0}{0}\let\pgfmathfloatscale=\pgfmathresult
+
+% This is the replacement parser invocation.
+% It does two things which are different to \pgfmathparse:
+% 1. it disables any dimension dependand scalings,
+% 2. it implements the 'scale results' feature.
+\def\pgfmathfloatparse{%
+ \begingroup%
+ % disable any dimension-dependant scalings:
+ \let\pgfmathpostparse=\relax%
+ \pgfmath@catcodes%
+ \pgfmath@quickparsefalse%
+ \pgfmathfloatparse@}
+
+% for pgf 2.00 :
+\def\pgfmathfloatparse@pgf@two@null@null{%
+ \pgfmath@quickparsefalse%
+ \pgfmathfloatparse@}
+
+\def\pgfmathfloatparse@#1{%
+ \edef\pgfmathfloat@expression{#1}%
+ \expandafter\pgfmathfloatparse@@\pgfmathfloat@expression\pgfmathfloat@
+ \ifpgfmathfloat@scaleactive
+ \expandafter\pgfmathfloatmultiply@\expandafter{\pgfmathresult}{\pgfmathfloatscale}
+ \pgfmathfloattofixed{\pgfmathresult}%
+ \else
+ \pgfmathfloatparse@output
+ \fi
+}
+
+\def\pgfmathfloat@char@asterisk{*}
+\def\pgfmathfloatparse@@#1#2\pgfmathfloat@{%
+ \def\pgfmathfloat@test{#1}%
+ \ifx\pgfmathfloat@test\pgfmathfloat@char@asterisk%
+ \def\pgfmathfloat@expression{#2}%
+ \pgfmathfloat@scaleactivetrue
+ \fi%
+ \expandafter\pgfmathparse@\expandafter{\pgfmathfloat@expression}%
+ % \endgroup provided by \pgfpathmarse@end
+}
+
+% Crude handling of file plots
+%
+\pgfkeys{/pgf/fpu/.cd,
+ scale file plot x/.code=\pgfmathfloatparse{#1}\edef\pgfmathfloatplotscalex{\pgfmathresult*},
+ scale file plot y/.code=\pgfmathfloatparse{#1}\edef\pgfmathfloatplotscaley{\pgfmathresult*},
+ scale file plot z/.code=\pgfmathfloatparse{#1}\edef\pgfmathfloatplotscalez{\pgfmathresult*}
+}
+
+\def\pgfmathfloat@uninstall@appendcmd#1{%
+ \expandafter\gdef\expandafter\pgfmathfloat@uninstall\expandafter{\pgfmathfloat@uninstall #1}%
+}%
+
+% If the uninstall command is already assembled, it will skip the
+% uninstall assemblation.
+\def\pgfmathfloat@plots@checkuninstallcmd{%
+ \pgfutil@ifundefined{pgfmathfloat@uninstall}{%
+ \global\let\pgfmathfloat@uninstall=\pgfutil@empty
+ }{%
+ % We already HAVE an uninstall command (prepared globally).
+ % So: don't waste time assembling one!
+ \def\pgfmathfloat@uninstall@appendcmd##1{}%
+ \def\pgfmathfloat@prepareuninstallcmd##1{}%
+ }%
+}%
+
+% This assembles an uninstall command globally ON FIRST USAGE.
+% See \pgfmathfloat@plots@checkuninstallcmd
+\def\pgfmathfloat@prepareuninstallcmd#1{%
+ % and store backup information (globally - I don't want to do that
+ % all the time when the FPU is used!):
+ \expandafter\global\expandafter\let\csname pgfmathfloat@backup@\string#1\endcsname=#1%
+ \expandafter\gdef\expandafter\pgfmathfloat@uninstall\expandafter{\pgfmathfloat@uninstall
+ \expandafter\let\expandafter#1\csname pgfmathfloat@backup@\string#1\endcsname%
+ }%
+}
+
+\def\pgfmathfloat@install#1=#2{%
+ \pgfmathfloat@prepareuninstallcmd{#1}%
+ \let#1=#2%
+}
+\def\pgfmathfloat@install@unimplemented#1{%
+ \expandafter\pgfmathfloat@prepareuninstallcmd\csname pgfmath@#1@\endcsname%
+ \expandafter\def\csname pgfmath#1@\endcsname##1{\pgfmathfloat@notimplemented{#1}}%
+}
+\def\pgfmathfloat@plots@install{%
+ \let\pgfmathfloatplotscalex=\pgfutil@empty
+ \let\pgfmathfloatplotscaley=\pgfutil@empty
+ \let\pgfmathfloatplotscalez=\pgfutil@empty
+ \pgfmathfloat@install\pgf@parsexyline=\pgfmathfloat@parsexyline%
+ \pgfmathfloat@install\pgf@parsexyzline=\pgfmathfloat@parsexyzline%
+}
+\def\pgfmathfloat@parsexyline#1 #2 #3\pgf@stop{%
+ \edef\pgfmathfloat@marshal{%
+ \noexpand\pgfplotstreampoint{\noexpand\pgfpointxy{\pgfmathfloatplotscalex#1}{\pgfmathfloatplotscaley#2}}%
+ }%
+ \pgfmathfloat@marshal%
+}
+\def\pgfmathfloat@parsexyzline#1 #2 #3 #4\pgf@stop{%
+ \edef\pgfmathfloat@marshal{%
+ \noexpand\pgfplotstreampoint{%
+ \noexpand\pgfpointxyz{\pgfmathfloatplotscalex#1}{\pgfmathfloatplotscaley#2}{\pgfmathfloatplotscalez#3}%
+ }%
+ }%
+ \pgfmathfloat@marshal%
+}
+
+%
+\def\pgfmathfloat@parser@install@functions{%
+ % Install float commands...
+ %
+ \pgfmathfloat@install\pgfmathadd@=\pgfmathfloatadd@%
+ \pgfmathfloat@install\pgfmathsubtract@=\pgfmathfloatsubtract@%
+ \pgfmathfloat@install\pgfmathneg@=\pgfmathfloatneg@%
+ \pgfmathfloat@install\pgfmathmultiply@=\pgfmathfloatmultiply@%
+ \pgfmathfloat@install\pgfmathdivide@=\pgfmathfloatdivide@%
+ \pgfmathfloat@install\pgfmathabs@=\pgfmathfloatabs@%
+ \pgfmathfloat@install\pgfmathround@=\pgfmathfloatround@%
+ \pgfmathfloat@install\pgfmathfloor@=\pgfmathfloatfloor@%
+ \pgfmathfloat@install\pgfmathmod@=\pgfmathfloatmod@%
+ \pgfmathfloat@install\pgfmathmax@=\pgfmathfloatmax@%
+ \pgfmathfloat@install\pgfmathmin@=\pgfmathfloatmin@%
+ \pgfmathfloat@install\pgfmathsin@=\pgfmathfloatsin@%
+ \pgfmathfloat@install\pgfmathcos@=\pgfmathfloatcos@%
+ \pgfmathfloat@install\pgfmathtan@=\pgfmathfloattan@%
+ \pgfmathfloat@install\pgfmathdeg@=\pgfmathfloatdeg@%
+ \pgfmathfloat@install\pgfmathrad@=\pgfmathfloatrad@%
+ \pgfmathfloat@install\pgfmathatan@=\pgfmathfloatatan@%
+ \pgfmathfloat@install\pgfmathasin@=\pgfmathfloatasin@%
+ \pgfmathfloat@install\pgfmathacos@=\pgfmathfloatacos@%
+ \pgfmathfloat@install\pgfmathcot@=\pgfmathfloatcot@%
+ \pgfmathfloat@install\pgfmathsec@=\pgfmathfloatsec@%
+ \pgfmathfloat@install\pgfmathcosec@=\pgfmathfloatcosec@%
+ \pgfmathfloat@install\pgfmathexp@=\pgfmathfloatexp@%
+ \pgfmathfloat@install\pgfmathln@=\pgfmathfloatln@%
+ \pgfmathfloat@install\pgfmathsqrt@=\pgfmathfloatsqrt@%
+ \pgfmathfloat@install\pgfmath@pi=\pgfmathfloatpi@%
+ \pgfmathfloat@install\pgfmathpi=\pgfmathfloatpi@%
+ \pgfmathfloat@install\pgfmathe@=\pgfmathfloate@%
+ \pgfmathfloat@install\pgfmathe=\pgfmathfloate@%
+ \pgfmathfloat@install\pgfmathlessthan@=\pgfmathfloatlessthan@%
+ \pgfmathfloat@install\pgfmathless@=\pgfmathfloatlessthan@%
+ \pgfmathfloat@install\pgfmathgreaterthan@=\pgfmathfloatgreaterthan@%
+ \pgfmathfloat@install\pgfmathgreater@=\pgfmathfloatgreaterthan@%
+ \pgfmathfloat@install\pgfmathpow@=\pgfmathfloatpow@
+ \pgfmathfloat@install\pgfmathrand@=\pgfmathfloatrand@
+ \pgfmathfloat@install\pgfmathrand=\pgfmathfloatrand@
+ \pgfmathfloat@install\pgfmathrnd@=\pgfmathfloatrnd@
+ \pgfmathfloat@install\pgfmathrnd=\pgfmathfloatrnd@
+ \pgfmathfloat@install\pgfmathtrue@=\pgfmathfloattrue@
+ \pgfmathfloat@install\pgfmathfalse@=\pgfmathfloatfalse@
+ \pgfmathfloat@install\pgfmathnot@=\pgfmathfloatnot@
+ \pgfmathfloat@install\pgfmathhex@=\pgfmathfloathex@
+ \pgfmathfloat@install\pgfmathHex@=\pgfmathfloatHex@
+ \pgfmathfloat@install\pgfmathoct@=\pgfmathfloatoct@
+ \pgfmathfloat@install\pgfmathbin@=\pgfmathfloatbin@
+ \pgfmathfloat@install\pgfmathand@=\pgfmathfloatand@
+ \pgfmathfloat@install\pgfmathor@=\pgfmathfloator@
+ \pgfmathfloat@install\pgfmathfactorial@=\pgfmathfloatfactorial@
+ \pgfmathfloat@install\pgfmathveclen@=\pgfmathfloatveclen@
+ \pgfmathfloat@install\pgfmathcosh@=\pgfmathfloatcosh@
+ \pgfmathfloat@install\pgfmathsinh@=\pgfmathfloatsinh@
+ \pgfmathfloat@install\pgfmathtanh@=\pgfmathfloattanh@
+ \pgfmathfloat@install@unimplemented{ceil}%
+ \pgfmathfloat@install@unimplemented{frac}%
+ \pgfmathfloat@install@unimplemented{log2}%
+ \pgfmathfloat@install@unimplemented{log10}%
+ \pgfmathfloat@install@unimplemented{equalto}%
+ \pgfmathfloat@install@unimplemented{random}%
+ \pgfmathfloat@install@unimplemented{setseed}%
+ \pgfmathfloat@install@unimplemented{Mod}%
+ \pgfmathfloat@install@unimplemented{real}%
+ \pgfmathfloat@install@unimplemented{notequal}%
+% \pgfmathfloat@install@unimplemented{atan2}%
+% \pgfmathfloat@install@unimplemented{height}%
+ %
+ %
+ \pgfmathfloat@install\pgfmathscientific=\pgfmathfloatscientific%
+}
+
+\def\pgfmathfloat@parser@install{%
+ \pgfmathfloat@plots@checkuninstallcmd
+ \pgfmathfloat@plots@install%
+ \pgfmathfloat@parser@install@functions
+ %
+ %
+ %
+ % The following methods actually enable the parser to work with
+ % the internal floating point number representation.
+ %
+ % The idea is as follows:
+ % 1. Every operand must be given in internal float representation.
+ % 2. The internal float repr can be distinguished by a normal
+ % number. This is accomplished by introducing a new "exponent"
+ % token.
+ % 3. The stack-push-operation checks whether the argument is a
+ % float. If not, it is parsed properly before pushing it.
+ \pgfmath@tokens@make{exponent}{\pgfmathfloat@POSTFLAGSCHAR}%
+ \pgfmathfloat@uninstall@appendcmd{%
+ \expandafter\let\csname pgfmath@token@exponent@\pgfmathfloat@POSTFLAGSCHAR\endcsname=\relax
+ }%
+ \let\pgfmath@basic@parse@exponent=\pgfmath@parse@exponent%
+ \let\pgfmath@basic@stack@push@operand=\pgfmath@stack@push@operand
+ \pgfmathfloat@install\pgfmath@stack@push@operand=\pgfmathfloat@stack@push@operand
+ \pgfmathfloat@install\pgfmath@parse@exponent=\pgfmathfloat@parse@float@or@exponent
+ %
+ \pgfmathfloat@install\pgfmathparse=\pgfmathfloatparse%
+}%
+
+\def\pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG#1{%
+ \edef\pgfmathfloat@loc@TMPa{%
+ \noexpand\def\expandafter\noexpand\csname pgfmath@parsefunction@#1\endcsname{%
+ \noexpand\let\noexpand\pgfmath@parsepostgroup\expandafter\noexpand\csname pgfmath@parsefunction@#1@\endcsname%
+ \noexpand\expandafter\noexpand\pgfmath@parse@}%
+ \noexpand\def\expandafter\noexpand\csname pgfmath@parsefunction@#1@\endcsname{%
+ \noexpand\expandafter\expandafter\noexpand\csname pgfmath#1@\endcsname\noexpand\expandafter{\noexpand\pgfmathresult}%
+ \noexpand\pgfmath@postfunction%
+ }%
+ }%
+ \pgfmathfloat@loc@TMPa
+}%
+\def\pgfmathfloat@parser@install@pgf@two@null@null{%
+ \pgfmathfloat@plots@checkuninstallcmd
+ \pgfmathfloat@plots@install%
+ \pgfmathfloat@parser@install@functions
+ \let\pgfmathrand@=\pgfmath@basic@rand@
+ \let\pgfmathrnd@=\pgfmath@basic@rnd@
+ \pgfmathfloat@install\pgfmathmax@=\pgfmathfloatmaxtwo%
+ \pgfmathfloat@install\pgfmathmin@=\pgfmathfloatmintwo%
+ \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{factorial}%
+ \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{hex}%
+ \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{bin}%
+ \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{oct}%
+ \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{tanh}%
+ \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{sinh}%
+ \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{cosh}%
+ %
+ % The following methods actually enable the parser to work with
+ % the internal floating point number representation.
+ %
+ % The idea is as follows:
+ % 1. Every operand must be given in internal float representation.
+ % 2. The internal float repr can be distinguished by a normal
+ % number. This is accomplished by introducing a new "exponent"
+ % token.
+ % 3. The stack-push-operation checks whether the argument is a
+ % float. If not, it is parsed properly before pushing it.
+ \let\pgfmath@basic@parsedecimalpoint=\pgfmath@parsedecimalpoint%
+ \let\pgfmath@basic@stack@push@operand=\pgfmath@stackpushoperand
+ \pgfmathfloat@install\pgfmath@stackpushoperand=\pgfmathfloat@stack@push@operand
+ \pgfmathfloat@install\pgfmath@parsedecimalpoint=\pgfmathfloat@parsedecimalpoint@pgf@two@null@null
+ \pgfmathfloat@install\pgfmath@endparse=\pgfmathfloat@endparse@pgf@two@null@null
+ \pgfmathfloat@install\pgfmath@endparsegroup=\pgfmathfloat@endparsegroup@pgf@two@null@null
+ \pgfmathfloat@install\pgfmath@postfunction=\pgfmathfloat@postfunction@pgf@two@null@null
+ \pgfmathfloat@install\pgfmath@@parseoperandgroup=\pgfmathfloat@@parseoperandgroup
+ %
+ \pgfmathfloat@install\pgfmathparse=\pgfmathfloatparse@pgf@two@null@null%
+}%
+
+\pgfutil@ifundefined{pgfmathdeclarefunction}{%
+ % BACKWARDS COMPATIBILITY: We have PGF 2.00 :
+ \def\pgfmathdeclarepseudoconstant#1#2{%
+ \begingroup
+ \toks0=\expandafter{\csname pgfmath#1@\endcsname}%
+ \toks1={\pgfmath@postfunction}%
+ \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }%
+ \xdef\pgfmathfloat@glob@TMPb{\the\toks0 }%
+ \endgroup
+ \expandafter\let\csname pgfmath@parsefunction@#1\endcsname=\pgfmathfloat@glob@TMP
+ \expandafter\let\csname pgfmath#1\endcsname=\pgfmathfloat@glob@TMPb
+ \expandafter\def\csname pgfmath#1@\endcsname{#2}%
+ }%
+ \let\pgfmathredeclarepseudoconstant=\pgfmathdeclarepseudoconstant
+}{%
+ \pgfutil@ifundefined{pgfmathdeclarepseudoconstant}{%
+ \def\pgfmathdeclarepseudoconstant#1#2{\pgfmathdeclarefunction*{#1}{0}{#2}}
+ }{}%
+}%
+
+\pgfmathdeclarepseudoconstant{inf}{\def\pgfmathresult{inf}}
+\pgfmathdeclarepseudoconstant{infty}{\def\pgfmathresult{inf}}
+\pgfmathdeclarepseudoconstant{nan}{\def\pgfmathresult{nan}}
+\pgfmathdeclarepseudoconstant{NaN}{\def\pgfmathresult{nan}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Hacks to the basic level pgf math engine:
+%
+% WARNING: These methods rely heavily on the internal float representation!
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% for pgf2.00 :
+\def\pgfmathfloat@parsedecimalpoint@pgf@two@null@null#1{%
+ \expandafter\ifx\pgfmathfloat@POSTFLAGSCHAR#1% check whether it is a float
+ \let\pgfmath@next=\pgfmathfloat@return@float@pgf@two@null@null%
+ \else
+ \def\pgfmath@next{\pgfmath@basic@parsedecimalpoint#1}%
+ \fi
+ \pgfmath@next
+}
+% for pgf2.00:
+\def\pgfmathfloat@return@float@pgf@two@null@null#1]{%
+ \edef\pgfmathresult{\the\c@pgfmath@parsecounta\pgfmathfloat@POSTFLAGSCHAR#1]}%
+ \let\pgfmath@resulttemp=\pgfmathresult
+ \pgfmath@parseoperator%
+}%
+% for pgf2.00:
+\def\pgfmathfloat@endparse@pgf@two@null@null#1\pgfmath@empty{%
+ \pgfmath@processalloperations%
+ \pgfmath@stackpop{\pgfmathresult}%
+ % delete the final unit scalings
+ \pgfmath@smuggleone{\pgfmathresult}%
+ \endgroup%
+ \ignorespaces%
+}
+% for pgf2.00:
+\def\pgfmathfloat@endparsegroup@pgf@two@null@null{%
+ \pgfmath@processalloperations%
+ \pgfmath@stackpop{\pgfmathresult}%
+ % eliminated register usage here...
+ \pgfmath@smuggleone{\pgfmathresult}%
+ \endgroup%
+ \pgfmath@parsepostgroup%
+}
+% for pgf2.00:
+\def\pgfmathfloat@postfunction@pgf@two@null@null{%
+ \let\pgfmath@parsepostgroup\pgfmath@parseoperator%
+ \ifnum\pgfmath@sign1<0
+ \pgfmathfloatneg@{\pgfmathresult}%
+ \let\pgfmath@sign\pgfutil@empty
+ \fi
+ \pgfmath@parseoperator}
+% for pgf2.00:
+\def\pgfmathfloat@@parseoperandgroup{%
+ \let\pgfmath@postparsegroup\pgfmath@parseoperator%
+ \ifnum\pgfmath@sign1<0
+ \pgfmathfloatneg@{\pgfmathresult}%
+ \let\pgfmath@sign\pgfutil@empty
+ \fi
+ \pgfmath@parseoperator%
+}
+
+
+
+
+
+
+% PRECONDITION:
+% either
+% <number>e
+% ^
+% -> read the exponent.
+% or
+% <sign>\pgfmathfloat@POSTFLAGSCHAR
+% ^
+% -> we have a parsed floating point number -> read it.
+\def\pgfmathfloat@parse@float@or@exponent{%
+ \if\pgfmath@token \pgfmathfloat@POSTFLAGSCHAR%
+ % Ok, we actually HAVE a pre-parsed floating point number!
+ % Return it.
+ \expandafter\pgfmathfloat@return@float\expandafter\pgfmath@token@next
+ \else
+ % We have a standard number in scientific format. Parse it.
+ \expandafter\pgfmath@basic@parse@exponent
+ \fi
+}%
+\def\pgfmathfloat@return@float#1]{%
+ \edef\pgfmathresult{\pgfmath@number \pgfmathfloat@POSTFLAGSCHAR#1]}%
+ \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathresult}%
+ \pgfmath@parse@@operator%
+}%
+
+% This extends the functionality of the basic level operand stack: it
+% assures every element on the stack is a float.
+\def\pgfmathfloat@stack@push@operand#1{%
+ \pgfutil@ifnextchar\bgroup{%
+ \let\pgfmathfloat@stack@push@operand@list@=\pgfutil@empty
+ \pgfmathfloat@stack@push@operand@list
+ }{%
+ \pgfmathfloat@stack@push@operand@single
+ }%
+ #1\relax
+}%
+\def\pgfmathfloat@stack@push@operand@single#1\relax{%
+ \expandafter\pgfutil@in@\pgfmathfloat@POSTFLAGSCHAR{#1}%
+ \ifpgfutil@in@
+ \pgfmath@basic@stack@push@operand{#1}%
+ \else
+ \pgfmathfloatparsenumber{#1}%
+ \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathresult}%
+ \fi
+}%
+\def\pgfmathfloat@stack@push@operand@GOBBLE#1\relax{}%
+\def\pgfmathfloat@stack@push@operand@list#1{%
+ \expandafter\pgfutil@in@ \pgfmathfloat@POSTFLAGSCHAR{#1}%
+ \ifpgfutil@in@
+ \expandafter\def\expandafter\pgfmathfloat@stack@push@operand@list@\expandafter{%
+ \pgfmathfloat@stack@push@operand@list@{#1}%
+ }%
+ \else
+ \pgfmathfloatparsenumber{#1}%
+ \begingroup
+ \toks0=\expandafter{\pgfmathfloat@stack@push@operand@list@}%
+ \toks1=\expandafter{\pgfmathresult}%
+ \xdef\pgfmathfloat@glob@TMP{\the\toks0 {\the\toks1}}%
+ \endgroup
+ \let\pgfmathfloat@stack@push@operand@list@=\pgfmathfloat@glob@TMP
+ \fi
+ \pgfutil@ifnextchar\relax{%
+ \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathfloat@stack@push@operand@list@}%
+ \pgfmathfloat@stack@push@operand@GOBBLE
+ }{%
+ \pgfmathfloat@stack@push@operand@list
+ }%
+}%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% --- END --- Hacks to the basic level pgf math engine
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Here starts the implementation of the floating point
+% routines.
+%
+% They can be used even if the FPU parser is not active.
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% Remember the basic math commands. They will be invoked as subroutines in floating point routines.
+\let\pgfmath@basic@add@=\pgfmathadd@
+\let\pgfmath@basic@subtract@=\pgfmathsubtract@
+\let\pgfmath@basic@multiply@=\pgfmathmultiply@
+\let\pgfmath@basic@divide@=\pgfmathdivide@
+\let\pgfmath@basic@reciprocal@=\pgfmathreciprocal@
+\let\pgfmath@basic@abs@=\pgfmathabs@
+\let\pgfmath@basic@round@=\pgfmathround@
+\let\pgfmath@basic@rand@=\pgfmathrand@
+\let\pgfmath@basic@rnd@=\pgfmathrnd@
+\let\pgfmath@basic@setseed@=\pgfmathsetseed@
+\let\pgfmath@basic@random@=\pgfmathrandom@
+\let\pgfmath@basic@floor@=\pgfmathfloor@
+\let\pgfmath@basic@ceil@=\pgfmathceil@
+\let\pgfmath@basic@mod@=\pgfmathmod@
+\let\pgfmath@basic@max@=\pgfmathmax@
+\let\pgfmath@basic@min@=\pgfmathmin@
+\let\pgfmath@basic@sin@=\pgfmathsin@
+\let\pgfmath@basic@cos@=\pgfmathcos@
+\let\pgfmath@basic@tan@=\pgfmathtan@
+\let\pgfmath@basic@deg@=\pgfmathdeg@
+\let\pgfmath@basic@rad@=\pgfmathrad@
+\let\pgfmath@basic@atan@=\pgfmathatan@
+\let\pgfmath@basic@asin@=\pgfmathasin@
+\let\pgfmath@basic@acos@=\pgfmathacos@
+\let\pgfmath@basic@cot@=\pgfmathcot@
+\let\pgfmath@basic@sec@=\pgfmathsec@
+\let\pgfmath@basic@cosec@=\pgfmathcosec@
+\let\pgfmath@basic@pow@=\pgfmathpow@
+\let\pgfmath@basic@exp@=\pgfmathexp@
+\let\pgfmath@basic@ln@=\pgfmathln@
+\let\pgfmath@basic@sqrt@=\pgfmathsqrt@
+\let\pgfmath@basic@@pi=\pgfmath@pi
+\let\pgfmath@basic@veclen@=\pgfmathveclen@
+\let\pgfmath@basic@e@=\pgfmathe@
+\let\pgfmath@basic@lessthan@=\pgfmathlessthan@
+\let\pgfmath@basic@greaterthan@=\pgfmathgreaterthan@
+\let\pgfmath@basic@equalto@=\pgfmathequalto@
+\let\pgfmath@basic@true@=\pgfmathtrue@
+\let\pgfmath@basic@false@=\pgfmathfalse@
+
+\def\pgfmathfloatscientific#1#2{%
+ \edef\pgfmathresult{#1e#2}%
+ \expandafter\pgfmathfloatparsenumber\expandafter{\pgfmathresult}%
+}
+% Compares #1 with #2 and sets \pgfmathresult either to 1.0 or 0.0.
+%
+% It also sets the boolean \ifpgfmathfloatcomparison (globally).
+\def\pgfmathfloatlessthan@#1#2{%
+%\def\pgfmathfloatlessthan#1#2#3\and#4#5#6{%
+ \global\pgfmathfloatcomparisonfalse
+ \begingroup
+ \edef\pgfmathfloat@loc@TMPa{#1}%
+ \edef\pgfmathfloat@loc@TMPb{#2}%
+ \expandafter\pgfmathfloat@decompose\pgfmathfloat@loc@TMPa\relax\pgfmathfloat@a@S\pgfmathfloat@a@M\pgfmathfloat@a@E
+ \expandafter\pgfmathfloat@decompose\pgfmathfloat@loc@TMPb\relax\pgfmathfloat@b@S\pgfmathfloat@b@M\pgfmathfloat@b@E
+ \ifcase\pgfmathfloat@a@S
+ % x = 0 -> (x<y <=> y >0)
+ \ifcase\pgfmathfloat@b@S
+ % y = 0
+ \or% y > 0
+ \global\pgfmathfloatcomparisontrue
+ \or% y < 0
+ \or% y = nan
+ \or% y = + infty
+ \global\pgfmathfloatcomparisontrue
+ \or% y = -infty
+ \fi
+ \or
+ % x > 0 -> (x<y <=> ( y > 0 && |x| < |y|) )
+ \ifcase\pgfmathfloat@b@S
+ % y = 0
+ \or% y>0:
+ \pgfmathfloatlessthan@positive
+ \or% y < 0
+ \or% y = nan
+ \or% y = + infty
+ \global\pgfmathfloatcomparisontrue
+ \or% y = -infty
+ \fi
+ \or
+ % x < 0 -> (x<y <=> (y >= 0 || |x| > |y|) )
+ \ifcase\pgfmathfloat@b@S
+ % y = 0
+ \global\pgfmathfloatcomparisontrue
+ \or%y > 0
+ \global\pgfmathfloatcomparisontrue
+ \or% 'y<0':
+ \pgfmathfloatgreaterthan@positive
+ \or% y = nan
+ \or% y = + infty
+ \global\pgfmathfloatcomparisontrue
+ \or% y = -infty
+ \fi
+ \or
+ % x = nan.
+ \or
+ % x = +infty
+ \or
+ % x = -infty
+ \ifnum\pgfmathfloat@b@S=3
+ \else
+ \global\pgfmathfloatcomparisontrue
+ \fi
+ \fi
+ \endgroup
+ \ifpgfmathfloatcomparison
+ \def\pgfmathresult{1.0}%
+ \else
+ \def\pgfmathresult{0.0}%
+ \fi
+}
+\let\pgfmathfloatlessthan=\pgfmathfloatlessthan@
+\let\pgfmathfloatless@=\pgfmathfloatlessthan@
+
+% compares \pgfmathfloat@a@[SME] < \pgfmathfloat@b@[SME]
+\def\pgfmathfloatlessthan@positive{%
+ \ifnum\pgfmathfloat@a@E<\pgfmathfloat@b@E
+ \global\pgfmathfloatcomparisontrue
+ \else
+ \ifnum\pgfmathfloat@a@E=\pgfmathfloat@b@E
+ \ifdim\pgfmathfloat@a@M<\pgfmathfloat@b@M
+ \global\pgfmathfloatcomparisontrue
+ \fi
+ \fi
+ \fi
+}
+
+% compares \pgfmathfloat@a@[SME] > \pgfmathfloat@b@[SME]
+\def\pgfmathfloatgreaterthan@positive{%
+ \ifnum\pgfmathfloat@a@E>\pgfmathfloat@b@E
+ \global\pgfmathfloatcomparisontrue
+ \else
+ \ifnum\pgfmathfloat@a@E=\pgfmathfloat@b@E
+ \ifdim\pgfmathfloat@a@M>\pgfmathfloat@b@M
+ \global\pgfmathfloatcomparisontrue
+ \fi
+ \fi
+ \fi
+}
+
+
+\def\pgfmathfloatgreaterthan@#1#2{\pgfmathfloatlessthan@{#2}{#1}}
+\let\pgfmathfloatgreaterthan=\pgfmathfloatgreaterthan@
+\let\pgfmathfloatgreater@=\pgfmathfloatgreaterthan@
+
+\def\pgfmathfloatmax@#1{%
+ \begingroup
+ \pgfmathfloatcreate{2}{1.0}{2147483644}%
+ \let\pgfmathmaxsofar=\pgfmathresult
+ \pgfmathfloatmax@@#1{}%
+}%
+\def\pgfmathfloatmax@@#1{%
+ \def\pgfmath@temp{#1}%
+ \ifx\pgfmath@temp\pgfmath@empty%
+ \expandafter\pgfmathfloatmax@@@%
+ \else%
+ \pgfmathfloatlessthan{\pgfmathmaxsofar}{#1}%
+ \ifpgfmathfloatcomparison
+ \edef\pgfmathmaxsofar{#1}%
+ \fi
+ \expandafter\pgfmathfloatmax@@%
+ \fi%
+}%
+\def\pgfmathfloatmax@@@{%
+ \let\pgfmathresult=\pgfmathmaxsofar
+ \pgfmath@smuggleone{\pgfmathresult}%
+ \endgroup
+}%
+\def\pgfmathfloatmin@#1{%
+ \begingroup
+ \pgfmathfloatcreate{1}{1.0}{2147483644}%
+ \let\pgfmathminsofar=\pgfmathresult
+ \pgfmathfloatmin@@#1{}%
+}%
+\def\pgfmathfloatmin@@#1{%
+ \def\pgfmath@temp{#1}%
+ \ifx\pgfmath@temp\pgfmath@empty%
+ \expandafter\pgfmathfloatmin@@@%
+ \else%
+ \pgfmathfloatlessthan{#1}{\pgfmathminsofar}%
+ \ifpgfmathfloatcomparison
+ \edef\pgfmathminsofar{#1}%
+ \fi
+ \expandafter\pgfmathfloatmin@@%
+ \fi%
+}%
+\def\pgfmathfloatmin@@@{%
+ \let\pgfmathresult=\pgfmathminsofar
+ \pgfmath@smuggleone{\pgfmathresult}%
+ \endgroup
+}%
+
+\def\pgfmathfloatmaxtwo#1#2{%
+ \pgfmathfloatlessthan{#1}{#2}%
+ \ifpgfmathfloatcomparison
+ \edef\pgfmathresult{#2}%
+ \else
+ \edef\pgfmathresult{#1}%
+ \fi
+}
+\let\pgfmathfloatmax=\pgfmathfloatmaxtwo
+
+\def\pgfmathfloatmintwo#1#2{%
+ \pgfmathfloatlessthan{#1}{#2}%
+ \ifpgfmathfloatcomparison
+ \edef\pgfmathresult{#1}%
+ \else
+ \edef\pgfmathresult{#2}%
+ \fi
+}
+\let\pgfmathfloatmin=\pgfmathfloatmintwo
+
+% Renormalizes #1 to extended precision mantisse, meaning
+% 100 <= m < 1000
+% instead of 1 <= m < 10.
+%
+% The 'extended precision' means we have higher accuracy when we apply pgfmath operations to mantisses.
+%
+% The input argument is expected to be a normalized floating point number; the output argument is a non-normalized floating point number (well, normalized to extended precision).
+%
+% The operation is supposed to be very fast.
+%
+% @see \pgfmathfloatsetextprecision
+%
+% There is a routine for internal usage,
+% \pgfmathfloattoextentedprecision@a. It also provides exponent and
+% sign of #1 in output arguments and may be used to increase speed.
+\def\pgfmathfloattoextentedprecision#1{%
+ \begingroup
+ \pgfmathfloattoextentedprecision@a{#1}%
+ \pgfmathfloatcreate{\pgfmathfloat@a@S}{\pgfmathresult}{\pgfmathfloat@a@E}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+\def\pgfmathfloattoextentedprecision@@zero#1\pgfmathfloat@EOI{%
+ \edef\pgfmathresult{#1}%
+}%
+\def\pgfmathfloattoextentedprecision@@one#1.#2#3\pgfmathfloat@EOI{%
+ \edef\pgfmathresult{#1#2.#3}%
+}%
+\def\pgfmathfloattoextentedprecision@@two#1.#2#3#4\pgfmathfloat@EOI{%
+ \edef\pgfmathresult{#1#2#3.#4}%
+}%
+\def\pgfmathfloattoextentedprecision@@three#1.#2#3#4#5\pgfmathfloat@EOI{%
+ \edef\pgfmathresult{#1#2#3#4.#5}%
+}%
+
+% Sets extended precision to 10^#1.
+%
+% The different choices are
+%
+% - 0: normalization 0 <= m < 1 (disable extended precision)
+% - 1: normalization 10 <= m < 100
+% - 2: normalization 100 <= m < 1000 (default)
+% - 3: normalization 1000 <= m < 10000
+%
+% #1 is the exponent, #1 = 0,1,2 or 3.
+%
+% This setting applies to \pgfmathfloattoextentedprecision and friends.
+\def\pgfmathfloatsetextprecision#1{%
+ \ifcase#1\relax
+ \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@zero
+ \def\pgfmathfloatextprec@shift{0}%
+ \or
+ \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@one
+ \def\pgfmathfloatextprec@shift{1}%
+ \or
+ \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@two
+ \def\pgfmathfloatextprec@shift{2}%
+ \else
+ \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@three
+ \def\pgfmathfloatextprec@shift{3}%
+ \fi
+}%
+\pgfmathfloatsetextprecision{2}%
+
+% Does the "hard" work for \pgfmathfloattoextentedprecision. It
+% provides additional outputs.
+%
+% INPUT:
+% #1 normalized floating point number. Maybe a macro (it will be expanded ONCE)
+%
+% OUTPUT:
+% - \pgfmathresult : the mantisse in extended precision
+% - \pgfmathfloat@a@S : the sign of #1
+% - \pgfmathfloat@a@E : the exponent of #1, adjusted for extended precision
+% - \pgfmathfloat@a@Mtok : undefined (its contents will be destroyed.
+%
+\def\pgfmathfloattoextentedprecision@a#1{%
+ \edef\pgfmathresult{#1}%
+ \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \ifnum\pgfmathfloat@a@S<3
+ \advance\pgfmathfloat@a@E by-\pgfmathfloatextprec@shift\relax% compensate for shift
+ \expandafter\pgfmathfloattoextentedprecision@@\the\pgfmathfloat@a@Mtok 000\pgfmathfloat@EOI
+ \fi
+}%
+
+
+% Similar to \pgfmathfloattoextentedprecision@a, this one here fills the '@b' registers.
+\def\pgfmathfloattoextentedprecision@b#1{%
+ \edef\pgfmathresult{#1}%
+ \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E
+ \ifnum\pgfmathfloat@b@S<3
+ \advance\pgfmathfloat@b@E by-\pgfmathfloatextprec@shift\relax
+ \expandafter\pgfmathfloattoextentedprecision@@\the\pgfmathfloat@a@Mtok 00\pgfmathfloat@EOI
+ \fi
+}%
+
+% Addition of two floating point numbers using 8 significant digits.
+\def\pgfmathfloatadd@#1#2{%
+ \begingroup
+ %
+ % renormalize argument to 100 <= m < 1000 for extended accuracy:
+ \pgfmathfloattoextentedprecision@a{#1}%
+ \let\pgfmathfloat@arga=\pgfmathresult
+ %
+ \pgfmathfloattoextentedprecision@b{#2}%
+ \let\pgfmathfloat@argb=\pgfmathresult
+ %
+ \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases.
+ \ifcase\pgfmathfloat@a@S
+ \edef\pgfmathresult{#2}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \or
+ \edef\pgfmathfloat@arga{-\pgfmathfloat@arga}%
+ \else
+ \pgfmathfloatcomparisonfalse
+ \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{0.0}{0}%
+ \fi
+ \ifcase\pgfmathfloat@b@S
+ \edef\pgfmathresult{#1}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \or
+ \edef\pgfmathfloat@argb{-\pgfmathfloat@argb}%
+ \else
+ \pgfmathfloatcomparisonfalse
+ \pgfmathfloatcreate{\the\pgfmathfloat@b@S}{0.0}{0}%
+ \fi
+ \ifpgfmathfloatcomparison
+ % Shift lesser mantisse to fit the larger one:
+ \ifnum\pgfmathfloat@a@E<\pgfmathfloat@b@E
+ \pgfmathfloatadd@shift{\pgfmathfloat@arga}{\pgfmathfloat@a@E}{\pgfmathfloat@b@E}%
+ \else
+ \pgfmathfloatadd@shift{\pgfmathfloat@argb}{\pgfmathfloat@b@E}{\pgfmathfloat@a@E}%
+ \fi
+ % add them!
+ \pgfmath@basic@add@{\pgfmathfloat@arga}{\pgfmathfloat@argb}%
+ % renormalize sum. This is the only part were an expensive routine comes into play:
+ \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}%
+ \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+% #1= floating point number
+% #2= TeX code to execute if #1 == 0
+% #3= TeX code to execute if #1 != 0
+\def\pgfmathfloatifzero#1#2#3{%
+ \pgfmathfloatgetflagstomacro{#1}\pgfmathfloat@loc@TMPa
+ \if\pgfmathfloat@loc@TMPa0 #2\else#3\fi
+}%
+
+\def\pgfmathfloatiffinite#1#2#3{%
+ \pgfmathfloatgetflagstomacro{#1}\pgfmathfloatiffinite@
+ \ifnum\pgfmathfloatiffinite@>2 #3\else #2\fi
+}%
+
+
+% Computes the relative error between #1 and #2 (assuming #2 != 0) and
+% invokes #3 if the relative error is below `/pgf/fpu/rel thresh' and
+% #4 if that is not the case.
+\long\def\pgfmathfloatifapproxequalrel#1#2#3#4{%
+ \begingroup
+ \pgfmathfloatparsenumber{#1}%
+ \let\pgfmathfloatarga=\pgfmathresult
+ \pgfmathfloatparsenumber{#2}%
+ \let\pgfmathfloatargb=\pgfmathresult
+ \pgfmathfloatrelerror@\pgfmathfloatarga\pgfmathfloatargb
+ \let\pgfmathfloatarga=\pgfmathresult
+ \pgfmathfloatlessthan@\pgfmathfloatarga\pgfmathfloat@relthresh
+ \ifpgfmathfloatcomparison
+ \def\pgfmathfloat@loc@TMPa{#3}%
+ \else
+ \def\pgfmathfloat@loc@TMPa{#4}%
+ \fi
+ \expandafter\endgroup
+ \pgfmathfloat@loc@TMPa
+}%
+
+% Invokes code '#3' if the flags of the floating point number '#1'
+% match the flag provided in '#2'.
+%
+% \pgfmathfloatcreate{1}{1.0}{2}
+% \pgfmathfloatifflags{\pgfmathresult}{0}{It's zero!}{It's not zero!}%
+% \pgfmathfloatifflags{\pgfmathresult}{1}{It's positive!}{It's not positive!}%
+% \pgfmathfloatifflags{\pgfmathresult}{2}{It's negative!}{It's not negative!}%
+% or, equivalently
+% \pgfmathfloatifflags{\pgfmathresult}{+}{It's positive!}{It's not positive!}%
+% \pgfmathfloatifflags{\pgfmathresult}{-}{It's negative!}{It's not negative!}%
+% it also supports #2=u which means 'unbounded'
+\def\pgfmathfloatifflags#1#2#3#4{%
+ \if#2-%
+ \pgfmathfloatifflags{#1}{2}{#3}{#4}%
+ \else
+ \if#2+%
+ \pgfmathfloatifflags{#1}{1}{#3}{#4}%
+ \else
+ \pgfmathfloatgetflagstomacro#1\pgfmathfloat@loc@TMPa
+ \if#2u%
+ \ifnum\pgfmathfloat@loc@TMPa>2
+ #3\relax
+ \else
+ #4\relax
+ \fi
+ \else
+ \if\pgfmathfloat@loc@TMPa#2
+ #3\relax
+ \else
+ #4\relax
+ \fi
+ \fi
+ \fi
+ \fi
+}%
+
+% #1=mantisse which needs to be shifted (with smaller exponent)
+% #2=smaller exponent
+% #3=larger exponent
+%
+% ATTENTION: this helper method DESTROYS contents of \pgfmathfloat@a@S.
+\def\pgfmathfloatadd@shift#1#2#3{%
+ \pgf@xa=#1 pt%
+ \pgfmathfloat@a@S=#3\relax
+ \advance\pgfmathfloat@a@S by-#2\relax
+ \ifcase\pgfmathfloat@a@S
+ \or
+ \divide\pgf@xa by10\relax
+ \or
+ \divide\pgf@xa by100\relax
+ \or
+ \divide\pgf@xa by1000\relax
+ \or
+ \divide\pgf@xa by10000\relax
+ \or
+ \divide\pgf@xa by10000\relax
+ \divide\pgf@xa by10\relax
+ \or
+ \divide\pgf@xa by10000\relax
+ \divide\pgf@xa by100\relax
+ \or
+ \divide\pgf@xa by10000\relax
+ \divide\pgf@xa by1000\relax
+ \or
+ \divide\pgf@xa by10000\relax
+ \divide\pgf@xa by10000\relax
+ \else
+ \pgf@xa=0pt%
+ \fi
+ #2=#3\relax
+ \edef#1{\pgf@sys@tonumber\pgf@xa}%
+}
+
+\let\pgfmathfloatadd=\pgfmathfloatadd@
+
+
+% Subtracts two floating point numbers.
+\def\pgfmathfloatsubtract@#1#2{%
+ \begingroup
+ \edef\pgfmathresult{#2}%
+ \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E
+ \ifcase\pgfmathfloat@b@S
+ \edef\pgfmathresult{#1}%
+ \or
+ \pgfmathfloatcreate{2}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@b@E}%
+ \let\pgfmathfloatsub@arg=\pgfmathresult
+ \pgfmathfloatadd@{#1}{\pgfmathfloatsub@arg}%
+ \or
+ \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@b@E}%
+ \let\pgfmathfloatsub@arg=\pgfmathresult
+ \pgfmathfloatadd@{#1}{\pgfmathfloatsub@arg}%
+ \else
+ \pgfmathfloatcreate{\the\pgfmathfloat@b@S}{0.0}{0}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+\let\pgfmathfloatsubtract=\pgfmathfloatsubtract@
+
+% Scales a floating point number #1 with a fixed point number #2 using pgfmathmultiply.
+%
+% Use this method if #2 is small number.
+\def\pgfmathfloatmultiplyfixed@#1#2{%
+ \begingroup
+ %
+ % renormalize argument to 100 <= m < 1000 for extended accuracy:
+ \pgfmathfloattoextentedprecision@a{#1}%
+ \let\pgfmathfloat@arga=\pgfmathresult
+ %
+ \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases.
+ \ifcase\pgfmathfloat@a@S
+ \edef\pgfmathresult{#1}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \or
+ \edef\pgfmathfloat@arga{-\pgfmathfloat@arga}%
+ \else
+ \pgfmathfloatcomparisonfalse
+ \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{0.0}{0}%
+ \fi
+ \ifpgfmathfloatcomparison
+ \pgfmath@basic@multiply@{\pgfmathfloat@arga}{#2}%
+ % renormalize product. This is the only part were an expensive routine comes into play:
+ \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}%
+ \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+\let\pgfmathfloatmultiplyfixed=\pgfmathfloatmultiplyfixed@
+
+
+\def\pgfmathfloatmultiply@#1#2{%
+ \begingroup
+ \pgfmathfloatsetextprecision{1}%
+ \pgfmathfloattoextentedprecision@a{#1}%
+ \let\pgfmathfloat@arga=\pgfmathresult
+ %
+ \pgfmathfloattoextentedprecision@b{#2}%
+ \let\pgfmathfloat@argb=\pgfmathresult
+ %
+ \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases.
+ \ifcase\pgfmathfloat@a@S
+ % 0
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or% +
+ \ifcase\pgfmathfloat@b@S
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \def\pgfmathresult@S{1}%
+ \or
+ \def\pgfmathresult@S{2}%
+ \else
+ \expandafter\pgfmathfloatcreate\the\pgfmathfloat@b@S{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \fi
+ \or% -
+ \ifcase\pgfmathfloat@b@S
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \def\pgfmathresult@S{2}%
+ \or
+ \def\pgfmathresult@S{1}%
+ \or
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{5}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \fi
+ \or% nan
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or% +infty
+ \ifcase\pgfmathfloat@b@S
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{5}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{5}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \fi
+ \or% -infty
+ \ifcase\pgfmathfloat@b@S
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{5}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{5}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \fi
+ \fi
+ \ifpgfmathfloatcomparison
+ \pgfmath@basic@multiply@{\pgfmathfloat@arga}{\pgfmathfloat@argb}%
+ \advance\pgfmathfloat@a@E by\pgfmathfloat@b@E
+ % renormalize sum. This is the only part were an expensive routine comes into play:
+ \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}%
+ \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}%
+ \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \pgfmathfloatcreate{\pgfmathresult@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\let\pgfmathfloatmultiply=\pgfmathfloatmultiply@
+
+% Defines \pgfmathresult to be #1 / #2 for two floating point numbers.
+%
+% It employs the basic math engine internally to divide mantissas.
+\def\pgfmathfloatdivide@#1#2{%
+ \begingroup
+ \pgfmathfloatsetextprecision{1}% is not too important, I think. After all, 0.1 <= #1/#2 < 10 or so due to normalization (no matter, which)
+ \edef\pgfmathfloat@arga{#1}%
+ \pgfmathfloattoextentedprecision@a{\pgfmathfloat@arga}%
+ \let\pgfmathfloat@arga=\pgfmathresult
+ %
+ \edef\pgfmathfloat@argb{#2}%
+ \pgfmathfloattoextentedprecision@b{\pgfmathfloat@argb}%
+ \let\pgfmathfloat@argb=\pgfmathresult
+ %
+ \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases.
+ \ifcase\pgfmathfloat@a@S
+ % 0
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or% +
+ \ifcase\pgfmathfloat@b@S
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \def\pgfmathresult@S{1}%
+ \or
+ \def\pgfmathresult@S{2}%
+ \or
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \else
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \fi
+ \or% -
+ \ifcase\pgfmathfloat@b@S
+ \pgfmathfloatcreate{5}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \def\pgfmathresult@S{2}%
+ \or
+ \def\pgfmathresult@S{1}%
+ \or
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \else
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \fi
+ \or% nan
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or% +infty
+ \ifcase\pgfmathfloat@b@S
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{5}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{4}{0.0}{0}% what is inf/inf ?
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{5}{0.0}{0}% or inf/-inf ?
+ \pgfmathfloatcomparisonfalse
+ \fi
+ \or% -infty
+ \ifcase\pgfmathfloat@b@S
+ \pgfmathfloatcreate{5}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{5}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{5}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \or
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \pgfmathfloatcomparisonfalse
+ \fi
+ \fi
+ \ifpgfmathfloatcomparison
+ \pgfmath@basic@divide@{\pgfmathfloat@arga}{\pgfmathfloat@argb}%
+ \advance\pgfmathfloat@a@E by-\pgfmathfloat@b@E
+ % renormalize. This is the only part were an expensive float routine comes into play:
+ \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}%
+ \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}%
+ % And re-insert the proper sign:
+ \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \pgfmathfloatcreate{\pgfmathresult@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\let\pgfmathfloatdivide=\pgfmathfloatdivide@
+
+\def\pgfmathfloatreciprocal@#1{%
+ \begingroup
+ % FIXME optimize
+ \edef\pgfmathfloat@loc@TMPa{#1}%
+ \pgfmathfloatcreate{1}{1.0}{0}%
+ \pgfmathfloatdivide@{\pgfmathresult}{\pgfmathfloat@loc@TMPa}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+% Computes sqrt(#1) in floating point arithmetics.
+%
+% It employs sqrt( m * 10^e ) = sqrt(m) * sqrt(10^e).
+\def\pgfmathfloatsqrt@#1{%
+ \begingroup
+ \pgfmathfloatsetextprecision{3}%
+ \edef\pgfmathfloat@arga{#1}%
+ \pgfmathfloattoextentedprecision@a{\pgfmathfloat@arga}%
+ \let\pgfmathfloat@arga=\pgfmathresult
+ %
+ \ifcase\pgfmathfloat@a@S
+ % 0
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ \or% +
+ \pgfmath@basic@sqrt@{\pgfmathfloat@arga}%
+ \ifodd\pgfmathfloat@a@E
+ \ifnum\pgfmathfloat@a@E>0
+ \expandafter\pgfmath@basic@multiply@\expandafter{\pgfmathresult}{3.16227766}% * sqrt(10)
+ \else
+ \expandafter\pgfmath@basic@multiply@\expandafter{\pgfmathresult}{0.316227766}% * sqrt(0.1)
+ \fi
+ \fi
+ \divide\pgfmathfloat@a@E by2 % sqrt(10^e) = 10^{e/2} (see above for odd e)
+ % renormalize sum. This is the only part were an expensive routine comes into play:
+ \edef\pgfmathfloat@arga{\pgfmathresult e\the\pgfmathfloat@a@E}%
+ \pgfmathfloatqparsenumber{\pgfmathfloat@arga}%
+ \or% -
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \or% nan
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \or% +infty
+ \pgfmathfloatcreate{4}{0.0}{0}%
+ \or% -infty
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\let\pgfmathfloatsqrt=\pgfmathfloatsqrt@
+
+% Returns the integer part of the floating point number #1.
+%
+% The result is returned as floating point as well.
+%
+% This operation is not limited to TeX's range of count registers (it
+% works symbolly)
+%
+% @see \pgfmathfloattoint
+\def\pgfmathfloatint@#1{%
+ \begingroup
+ \edef\pgfmathresult{#1}%
+ \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \ifcase\pgfmathfloat@a@S
+ % 0: nothing to do.
+ \or% +
+ \expandafter\pgfmathfloatint@@\the\pgfmathfloat@a@Mtok\pgfmathfloat@EOI
+ \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \or% -
+ \expandafter\pgfmathfloatint@@\the\pgfmathfloat@a@Mtok\pgfmathfloat@EOI
+ \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \else
+ % nothing to do
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\def\pgfmathfloatint@@#1.{%
+ \ifnum\pgfmathfloat@a@E<0
+ \pgfmathfloat@a@S=0
+ \pgfmathfloat@a@Mtok={0.0}%
+ \pgfmathfloat@a@E=0
+ \expandafter\pgfmathfloatint@@loop@gobble
+ \else
+ \pgfmathfloat@a@Mtok={#1.}%
+ \pgfmathfloat@b@E=\pgfmathfloat@a@E
+ \expandafter\pgfmathfloatint@@loop
+ \fi
+}%
+\def\pgfmathfloatint@@loop#1{%
+ \def\pgfmathfloatint@@loop@{#1}%
+ \ifx\pgfmathfloatint@@loop@\pgfmathfloat@EOI
+ \let\pgfmathfloatint@@loop@next=\relax
+ \else
+ \ifnum\pgfmathfloat@b@E=0
+ \let\pgfmathfloatint@@loop@next=\pgfmathfloatint@@loop@gobble
+ \else
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}%
+ \advance\pgfmathfloat@b@E by-1
+ \let\pgfmathfloatint@@loop@next=\pgfmathfloatint@@loop
+ \fi
+ \fi
+ \pgfmathfloatint@@loop@next
+}%
+\def\pgfmathfloatint@@loop@gobble#1\pgfmathfloat@EOI{}%
+\let\pgfmathfloatint=\pgfmathfloatint@
+\let\pgfmathfloatfloor=\pgfmathfloatint
+\let\pgfmathfloatfloor@=\pgfmathfloatint@
+
+\def\pgfmathfloat@notimplemented#1{%
+ \pgfmath@error{Sorry, the operation '#1' has not yet been implemented in the floating point unit :-(}{}%
+ \pgfmathfloatcreate{0}{0.0}{0}%
+}%
+
+% Divides or multiplies the input number by 10^#4 using an arithmetic
+% left/right shift.
+%
+% Input:
+% #1 a normalised floating point number.
+% #2 a positive or negative integer number denoting the shift.
+%
+% Example:
+% \pgfmathfloatshift{11e3}{4}%
+% -> pgfmathresult = 11e7
+\def\pgfmathfloatshift@#1#2{%
+ \begingroup
+ \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \advance\pgfmathfloat@a@E by#2\relax
+ \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}
+\let\pgfmathfloatshift=\pgfmathfloatshift@
+
+% Defines \pgfmathresult to be |#1|, the absolute value of the
+% normalized floating point number #1.
+\def\pgfmathfloatabs@#1{%
+ \begingroup
+ \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \ifcase\pgfmathfloat@a@S
+ % 0: do nothing.
+ \or
+ % +: ok, is positive.
+ \or
+ % -: multiply with -1:
+ \pgfmathfloat@a@S=1
+ \or
+ % nan: do nothing.
+ \or
+ % +infty: ok.
+ \or
+ % -infty: multiply with -1:
+ \pgfmathfloat@a@S=4
+ \fi
+ \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\let\pgfmathfloatabs=\pgfmathfloatabs@
+
+% Computes the absolute error |#1 - #2| into \pgfmathresult.
+\def\pgfmathfloatabserror@#1#2{%
+ \pgfmathfloatsubtract@{#1}{#2}%
+ \pgfmathfloatabs@{\pgfmathresult}%
+}%
+\let\pgfmathfloatabserror=\pgfmathfloatabserror@
+
+% Computes the relative error |#1 - #2|/|#2| into \pgfmathresult,
+% assuming #2 != 0.
+\def\pgfmathfloatrelerror@#1#2{%
+ \pgfmathfloatsubtract@{#1}{#2}%
+ \pgfmathfloatdivide@{\pgfmathresult}{#2}%
+ \pgfmathfloatabs@{\pgfmathresult}%
+}%
+\let\pgfmathfloatrelerror=\pgfmathfloatrelerror@
+
+% Computes \pgfmathresult = #1 mod #2 using truncated division.
+%
+\def\pgfmathfloatmod@#1#2{%
+ \begingroup
+ \pgfmathfloatdivide@{#1}{#2}%
+ \pgfmathfloatint@{\pgfmathresult}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{#2}%
+ \let\pgfmathfloat@loc@TMPb=\pgfmathresult
+ \pgfmathfloatsubtract@{#1}{\pgfmathfloat@loc@TMPb}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}
+\let\pgfmathfloatmod=\pgfmathfloatmod@
+
+
+% A modification of \pgfmathfloatmod@ where #3 = 1/#2 is already
+% known. This may be faster.
+\def\pgfmathfloatmodknowsinverse@#1#2#3{%
+ \begingroup
+ \pgfmathfloatmultiply@{#1}{#3}%
+ \pgfmathfloatint@{\pgfmathresult}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{#2}%
+ \let\pgfmathfloat@loc@TMPb=\pgfmathresult
+ \pgfmathfloatsubtract@{#1}{\pgfmathfloat@loc@TMPb}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}
+\let\pgfmathfloatmodknowsinverse=\pgfmathfloatmodknowsinverse@
+
+\def\pgfmathfloatpi@{%
+ \pgfmathfloatcreate{1}{3.14159265358979}{0}%
+}%
+\let\pgfmathfloatpi=\pgfmathfloatpi@
+
+\def\pgfmathfloate@{%
+ \pgfmathfloatcreate{1}{2.71828182845905}{0}%
+}
+\let\pgfmathfloate=\pgfmathfloate@
+
+% Converts #1 from radians to degrees.
+\def\pgfmathfloatdeg@#1{%
+ \expandafter\ifx\csname pgfmfltdeg@factor\endcsname\relax
+ % Lazy evaluation:
+ \pgfmathfloatcreate{1}{5.72957795130823}{1}%
+ \global\let\pgfmfltdeg@factor=\pgfmathresult
+ \fi
+ \pgfmathfloatmultiply@{#1}\pgfmfltdeg@factor%
+}
+\let\pgfmathfloatdeg=\pgfmathfloatdeg@
+
+% Converts #1 from degree to radians.
+\def\pgfmathfloatrad@#1{%
+ \expandafter\ifx\csname pgfmfltrad@factor\endcsname\relax
+ % Lazy evaluation:
+ \pgfmathfloatcreate{1}{1.74532925199433}{-2}%
+ \global\let\pgfmfltrad@factor=\pgfmathresult
+ \fi
+ \pgfmathfloatmultiply@{#1}\pgfmfltrad@factor%
+}
+\let\pgfmathfloatrad=\pgfmathfloatrad@
+
+% Computes #1(#2) where #1 is a trigonometric function, i.e.
+% #1(#2) = #1( #2 + r*360 )
+%
+% #1 is a one-argument macro which assigns \pgfmathresult.
+\def\pgfmathfloatTRIG@#1#2{%
+ \expandafter\ifx\csname pgfmathfloatTRIG@NUM\endcsname\relax%
+ % Lazy evaluation:
+ \pgfmathfloatcreate{1}{3.6}{2}%
+ \global\let\pgfmathfloatTRIG@NUM=\pgfmathresult
+ \pgfmathfloatcreate{1}{2.77777777777778}{-3}%
+ \global\let\pgfmathfloatTRIG@NUM@INV=\pgfmathresult
+ \fi
+ \pgfmathfloatmodknowsinverse@{#2}{\pgfmathfloatTRIG@NUM}{\pgfmathfloatTRIG@NUM@INV}%
+ \pgfmathfloattofixed@{\pgfmathresult}%
+ \expandafter#1\expandafter{\pgfmathresult}%
+ \pgfmathfloatparsenumber{\pgfmathresult}%
+}%
+
+\def\pgfmathfloatsin@#1{\pgfmathfloatTRIG@\pgfmath@basic@sin@{#1}}
+\let\pgfmathfloatsin=\pgfmathfloatsin@
+\def\pgfmathfloatcos@#1{\pgfmathfloatTRIG@\pgfmath@basic@cos@{#1}}
+\let\pgfmathfloatcos=\pgfmathfloatcos@
+\def\pgfmathfloattan@#1{%
+ % compute sin(#1) / cos(#1)
+ \begingroup
+ \pgfmathfloatcos@{#1}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \pgfmathfloatsin@{#1}%
+ \expandafter\pgfmathfloatdivide@\expandafter{\pgfmathresult}{\pgfmathfloat@loc@TMPa}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}
+\let\pgfmathfloattan=\pgfmathfloattan@
+
+\def\pgfmathfloatcot@#1{%
+ % compute cos(#1) / sin(#1)
+ \begingroup
+ \pgfmathfloatsin@{#1}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \pgfmathfloatcos@{#1}%
+ \expandafter\pgfmathfloatdivide@\expandafter{\pgfmathresult}{\pgfmathfloat@loc@TMPa}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\let\pgfmathfloatcot=\pgfmathfloatcot@
+
+\def\pgfmathfloatatan@#1{%
+ \begingroup
+ \expandafter\ifx\csname pgfmathfloatatan@TMP\endcsname\relax%
+ \pgfmathfloatcreate{1}{1.6}{4}%
+ \global\let\pgfmathfloatatan@TMP=\pgfmathresult
+ \pgfmathfloatcreate{2}{1.6}{4}%
+ \global\let\pgfmathfloatatan@TMPB=\pgfmathresult
+ \fi
+ \pgfmathfloatgreaterthan@{#1}{\pgfmathfloatatan@TMP}%
+ \ifpgfmathfloatcomparison
+ \pgfmathfloatcreate{1}{9.0}{1}%
+ \else
+ \pgfmathfloatlessthan{#1}{\pgfmathfloatatan@TMPB}%
+ \ifpgfmathfloatcomparison
+ \pgfmathfloatcreate{2}{9.0}{1}%
+ \else
+ \pgfmathfloattofixed@{#1}%
+ \expandafter\pgfmath@basic@atan@\expandafter{\pgfmathresult}%
+ \pgfmathfloatparsenumber{\pgfmathresult}%
+ \fi
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\let\pgfmathfloatatan=\pgfmathfloatatan@
+
+\def\pgfmathfloatsec@#1{\pgfmathfloatTRIG@\pgfmath@basic@cos@{#1}\pgfmathfloatreciprocal@{\pgfmathresult}}
+\let\pgfmathfloatsec=\pgfmathfloatsec@
+\def\pgfmathfloatcosec@#1{\pgfmathfloatTRIG@\pgfmath@basic@sin@{#1}\pgfmathfloatreciprocal@{\pgfmathresult}}
+\let\pgfmathfloatcosec=\pgfmathfloatcosec@
+
+% Expands #2 using \edef and invokes #1 with the resulting string.
+%
+% DEPRECATED
+% Example:
+% \pgfmath@y=7.9pt
+% \pgfmathlog@invoke@expanded\pgfmathexp@{{\pgf@sys@tonumber{\pgfmath@y}}}%
+% will invoke
+% \pgfmathexp@{7.9}
+\def\pgfmathlog@invoke@expanded#1#2{%
+ \edef\pgfmath@resulttemp{#2}%
+ \expandafter#1\pgfmath@resulttemp
+}
+
+\def\pgfmathfloatln@#1{%
+ \pgfmathlog@float{#1}%
+ \ifx\pgfmathresult\pgfutil@empty
+ \pgfmathfloatcreate{3}{0.0}{0}%
+ \else
+ \pgfmathfloatparsenumber{\pgfmathresult}%
+ \fi
+}
+\let\pgfmathfloatln=\pgfmathfloatln@
+
+% Computes log(x) into \pgfmathresult.
+%
+% This allows numbers such at 10000000 or 5.23e-10 to be represented
+% properly, although TeX-registers would produce overflow/underflow
+% errors in these cases.
+%
+% The natural logarithm is computed using log(X*10^Y) = log(X) + log(10)*Y
+%
+% FIXME This routine is only kept for backwards compatibility!
+% It does not work as expected because
+% 1. it calls \pgfmathfloatparsenumber
+% 2. it returns the result as fixed point number
+% Use \pgfmathln@ instead!
+\def\pgfmathlog@#1{%
+ \pgfmathfloatparsenumber{#1}%
+ \pgfmathlog@float{\pgfmathresult}%
+}
+\let\pgfmathlog=\pgfmathlog@
+\def\pgfmathlog@float#1{%
+ \begingroup%
+ % compute #1 = M*10^E with normalised mantisse M = [+-]*[1-9].XXXXX
+ \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \ifnum\pgfmathfloat@a@S=1
+ % Now, compute log(#1) = log(M) + E*log(10)
+ \expandafter\pgfmath@basic@ln@\expandafter{\the\pgfmathfloat@a@Mtok}%
+ \pgfmathfloat@b@M=\pgfmathresult pt%
+ \pgfmathfloat@a@M=2.302585pt% = log(10)
+ \multiply\pgfmathfloat@a@M by\pgfmathfloat@a@E\relax
+ \advance\pgfmathfloat@b@M by\pgfmathfloat@a@M
+ \edef\pgfmathresult{\pgf@sys@tonumber{\pgfmathfloat@b@M}}%
+ \else
+ \let\pgfmathresult=\pgfutil@empty%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup%
+}
+
+
+% Computes exp(#1) in floating point.
+%
+% The algorithm employs the identity
+% exp(x) = exp(x - log(10^k) + log(10^k)
+% = 10^k exp( x - k*log 10 )
+% with k choosen such that exp( x - k*log10) can be computed with the
+% basic level math engine.
+%
+% The precision (relative error) is between 10^{-4} and 10^{-6}. For
+% #1 = 700, it is even 10^{-3}. I will need to improve that someday.
+\def\pgfmathfloatexp@#1{%
+ \begingroup
+ \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \ifcase\pgfmathfloat@a@S
+ % #1 = 0:
+ \pgfmathfloatcreate{1}{1.0}{0}%
+ \or% #1 > 0
+ \pgfmathfloatexp@@{#1}%
+ \or% #1 < 0
+ \pgfmathfloatexp@@{#1}%
+ \else
+ \edef\pgfmathresult{#1}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\def\pgfmathfloatexp@@#1{%
+ % Employ the identity
+ % exp(x) = exp(x - log(10^k) + log(10^k)) = 10^k exp( x - k *log(10))
+ %
+ % I'd like to have x - k*log(10) <= 1
+ % => compute k := int( (x - 1) * 1/log(10) )
+ % that should suffice since \pgfmathexp@ should be
+ % accurate enough for those numbers.
+ %
+ % please note that we can do all this in TeX registers.
+ % exp(700) is almost the maximum of double precision
+ % anyway, and exp(16000) is certainly the largest we will
+ % ever need.
+ \pgfmathfloattofixed@{#1}%
+ \pgf@xa=\pgfmathresult pt
+ \pgf@xa=0.434294481\pgf@xa\relax
+ \edef\pgfmathfloat@loc@TMPa{\pgf@sys@tonumber{\pgf@xa}}%
+ \expandafter\pgfmathfloatexp@@toint\pgfmathfloat@loc@TMPa\relax
+ \pgf@xa=2.302585092pt
+ \multiply\pgf@xa by-\pgfmathfloat@k\relax
+ \advance\pgf@xa by\pgfmathresult pt
+ \edef\pgfmathfloat@loc@TMPa{\pgf@sys@tonumber{\pgf@xa}}%
+%\message{computing exp(\pgfmathresult) = 10^\pgfmathfloat@k * exp(\pgfmathfloat@loc@TMPa)...}%
+ \pgfmath@basic@exp@{\pgfmathfloat@loc@TMPa}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \pgfmathfloatparsenumber{\pgfmathfloat@loc@TMPa}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \pgfmathfloatshift@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@k}%
+}
+% determine 'k'. This is a heuristics. The exponential series
+% converges best for |x| <= 1. However, the fixed point arithmetics
+% for tex results in best results for large |x|. Well, I'll need to
+% tune this here.
+\def\pgfmathfloatexp@@toint#1.#2\relax{%
+ \c@pgf@counta=#1\relax
+ \ifnum\c@pgf@counta<0
+\advance\c@pgf@counta by-1 % FIXME . this is a test for optimizations.
+ \c@pgf@countb=#2\relax
+ \ifnum\c@pgf@countb>0
+ \advance\c@pgf@counta by-1
+ \fi
+ \fi
+ \edef\pgfmathfloat@k{\the\c@pgf@counta}%
+}%
+\let\pgfmathfloatexp=\pgfmathfloatexp@
+
+\def\pgfmathfloatround@#1{%
+ \begingroup
+ \pgfkeysvalueof{/pgf/number format/precision/.@cmd}0\pgfeov
+ \pgfmathfloattofixed{#1}%
+ \pgfmathroundto{\pgfmathresult}%
+ \pgfmathfloatparsenumber{\pgfmathresult}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+
+\def\pgfmathfloatneg@#1{%
+ \begingroup
+ \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \ifcase\pgfmathfloat@a@S\relax
+ % 0:
+ \edef\pgfmathresult{#1}%
+ \or
+ % +:
+ \pgfmathfloatcreate{2}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \or
+ % -:
+ \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \or
+ % nan:
+ \edef\pgfmathresult{#1}%
+ \or
+ % +infty:
+ \pgfmathfloatcreate{5}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \or
+ % -infty:
+ \pgfmathfloatcreate{4}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+
+\def\pgfmathfloatpow@#1#2{%
+ \begingroup%
+ \expandafter\pgfmathfloat@decompose@tok#2\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \ifcase\pgfmathfloat@a@S\relax
+ % #1 ^ 0 = 1
+ \pgfmathfloatcreate{1}{1.0}{0}%
+ \or
+ % #2 > 0
+ \pgfmathfloatpow@@{#1}{#2}%
+ \or
+ % #2 < 0
+ \pgfmathfloatpow@@{#1}{#2}%
+ \or
+ % #2 = nan
+ \edef\pgfmathresult{#2}%
+ \or
+ % #2 = inf
+ \edef\pgfmathresult{#2}%
+ \or
+ % #2 = -inf
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+% computes #1^#2
+% PRECONDITIONS
+% - #2 is positive.
+\def\pgfmathfloatpow@@#1#2{%
+ \pgfmathfloattofixed@{#2}%
+ \afterassignment\pgfmath@x%
+ \expandafter\c@pgfmath@counta\pgfmathresult pt\relax%
+ \ifdim\pgfmath@x=0pt %
+ % loop "manually"; we have an integer exponent!
+ \ifnum\c@pgfmath@counta<0
+ \pgfmathfloatreciprocal@{#1}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \c@pgfmath@counta=-\c@pgfmath@counta
+ \else
+ \edef\pgfmathfloat@loc@TMPa{#1}%
+ \fi
+ \pgfmathfloatcreate{1}{1.0}{0}%
+ \let\pgfmathfloat@loc@TMPb=\pgfmathresult
+ \pgfmathloop
+ \ifnum\c@pgfmath@counta>0\relax%
+ \ifodd\c@pgfmath@counta%
+ \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPb}{\pgfmathfloat@loc@TMPa}%
+ \let\pgfmathfloat@loc@TMPb=\pgfmathresult
+ \fi
+ \ifnum\c@pgfmath@counta>1\relax%
+ \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@loc@TMPa}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \fi%
+ \divide\c@pgfmath@counta by2\relax%
+ \repeatpgfmathloop%
+ \else
+ % employ #1^#2 = exp( #2 * ln(#1) )
+ \pgfmathfloatln@{#1}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \edef\pgfmathfloat@loc@TMPb{#2}%
+ \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@loc@TMPb}%
+ \pgfmathfloatexp@{\pgfmathresult}%
+ \fi
+}
+
+\def\pgfmathfloat@definemethodfrombasic@NOARG#1{%
+ \pgfutil@ifundefined{pgfmath@basic@#1@}{%
+ \pgfutil@namelet{pgfmath@basic@#1@}{pgfmath#1@}%
+ }{}%
+ \edef\pgfmathfloat@glob@TMP{%
+ \expandafter\noexpand\csname pgfmath@basic@#1@\endcsname
+ \noexpand\pgfmathfloatparsenumber{\noexpand\pgfmathresult}%
+ }%
+ \expandafter\let\csname pgfmathfloat#1@\endcsname=\pgfmathfloat@glob@TMP%
+ \expandafter\let\csname pgfmathfloat#1\endcsname=\pgfmathfloat@glob@TMP%
+}%
+\def\pgfmathfloat@definemethodfrombasic@ONEARG#1{%
+ \pgfutil@ifundefined{pgfmath@basic@#1@}{%
+ \pgfutil@namelet{pgfmath@basic@#1@}{pgfmath#1@}%
+ }{}%
+ \edef\pgfmathfloat@glob@TMP##1{%
+ \noexpand\pgfmathfloattofixed{##1}%
+ \noexpand\expandafter
+ \expandafter\noexpand\csname pgfmath@basic@#1@\endcsname\noexpand\expandafter%
+ {\noexpand\pgfmathresult}%
+ \noexpand\pgfmathfloatparsenumber{\noexpand\pgfmathresult}%
+ }%
+ \expandafter\let\csname pgfmathfloat#1@\endcsname=\pgfmathfloat@glob@TMP%
+ \expandafter\let\csname pgfmathfloat#1\endcsname=\pgfmathfloat@glob@TMP%
+}%
+\def\pgfmathfloat@definemethodfrombasic@TWOARGS#1{%
+ \pgfutil@ifundefined{pgfmath@basic@#1@}{%
+ \pgfutil@namelet{pgfmath@basic@#1@}{pgfmath#1@}%
+ }{}%
+ \edef\pgfmathfloat@glob@TMP##1##2{%
+ \noexpand\pgfmathfloattofixed{##2}%
+ \noexpand\let\noexpand\pgfmathfloat@loc@TMPa=\noexpand\pgfmathresult
+ \noexpand\pgfmathfloattofixed{##1}%
+ \noexpand\expandafter
+ \expandafter\noexpand\csname pgfmath@basic@#1@\endcsname\noexpand\expandafter%
+ {\noexpand\pgfmathresult}{\noexpand\pgfmathfloat@loc@TMPa}%
+ \noexpand\pgfmathfloatparsenumber{\noexpand\pgfmathresult}%
+ }%
+ \expandafter\let\csname pgfmathfloat#1@\endcsname=\pgfmathfloat@glob@TMP%
+ \expandafter\let\csname pgfmathfloat#1\endcsname=\pgfmathfloat@glob@TMP%
+}%
+\pgfmathfloat@definemethodfrombasic@NOARG{rand}
+\pgfmathfloat@definemethodfrombasic@NOARG{rnd}
+\pgfmathfloat@definemethodfrombasic@NOARG{false}
+\pgfmathfloat@definemethodfrombasic@NOARG{true}
+% arcsin, arccos
+\pgfmathfloat@definemethodfrombasic@ONEARG{asin}
+\pgfmathfloat@definemethodfrombasic@ONEARG{acos}
+\pgfmathfloat@definemethodfrombasic@ONEARG{not}
+\pgfmathfloat@definemethodfrombasic@ONEARG{hex}
+\pgfmathfloat@definemethodfrombasic@ONEARG{Hex}
+\pgfmathfloat@definemethodfrombasic@ONEARG{oct}
+\pgfmathfloat@definemethodfrombasic@ONEARG{bin}
+\pgfmathfloat@definemethodfrombasic@TWOARGS{and}
+\pgfmathfloat@definemethodfrombasic@TWOARGS{or}
+
+\pgfutil@ifundefined{pgfmathdeclarefunction}{%
+ % special treatment: \pgfmathrand@ was not properly defined for pgf 2.00:
+ \let\pgfmath@basic@rand=\pgfmathrand
+ \let\pgfmath@basic@rand@=\pgfmathrand@
+ \def\pgfmathfloatrand@{%
+ \pgfmath@basic@rand
+ \pgfmathfloatparsenumber{\pgfmathresult}%
+ }%
+ \let\pgfmathfloatrand=\pgfmathfloatrand@%
+ %
+ % special treatment: \pgfmathrnd@ was not properly defined for pgf 2.00:
+ \let\pgfmath@basic@rnd=\pgfmathrnd
+ \let\pgfmath@basic@rnd@=\pgfmathrnd@
+ \def\pgfmathfloatrnd@{%
+ \pgfmath@basic@rnd
+ \pgfmathfloatparsenumber{\pgfmathresult}%
+ }%
+ \let\pgfmathfloatrnd=\pgfmathfloatrnd@%
+}{}
+
+% Implements the factorial of '#1'.
+% This does only work if '#1 < 2^32'.
+\def\pgfmathfloatfactorial@#1{%
+ \begingroup
+ \pgfmathfloattofixed{#1}%
+ % collect integer part into a 32 bit register:
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \expandafter\c@pgfmath@counta\pgfmathresult\relax\pgfmath@%
+ \pgfmathfloatcreate{1}{1.0}{0}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \pgfmathloop
+ \ifnum\c@pgfmath@counta<2 %
+ \else
+ \expandafter\pgfmathfloatparsenumber\expandafter{\the\c@pgfmath@counta}%
+ \expandafter\pgfmathfloatmultiply@\expandafter{\pgfmathresult}{\pgfmathfloat@loc@TMPa}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \advance\c@pgfmath@counta by-1\relax%
+ \repeatpgfmathloop
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+% Implements the vector length of a 2D vector.
+%
+% ATTENTION: this does NOT use the improved code of the basic layer!
+% It simply computed sqrt( #1^2 + #2^2 )!
+\def\pgfmathfloatveclen@#1#2{%
+ \begingroup
+ \edef\pgfmathfloat@@a{#1}%
+ \pgfmathfloatmultiply@{\pgfmathfloat@@a}{\pgfmathfloat@@a}%
+ \let\pgfmathfloat@@a=\pgfmathresult
+ %
+ \edef\pgfmathfloat@@b{#2}%
+ \pgfmathfloatmultiply@{\pgfmathfloat@@b}{\pgfmathfloat@@b}%
+ \let\pgfmathfloat@@b=\pgfmathresult
+ %
+ \pgfmathfloatadd@{\pgfmathfloat@@a}{\pgfmathfloat@@b}%
+ \pgfmathfloatsqrt@{\pgfmathresult}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+\def\pgfmathfloatcosh@#1{%
+ \begingroup
+ \pgfmathfloatexp@{#1}%
+ \let\pgfmathfloat@@a=\pgfmathresult
+ %
+ \pgfmathfloatneg@{#1}%
+ \pgfmathfloatexp@{\pgfmathresult}%
+ %
+ \pgfmathfloatadd@{\pgfmathresult}{\pgfmathfloat@@a}%
+ \expandafter\pgfmathfloatmultiplyfixed@\expandafter{\pgfmathresult}{0.5}%
+ %
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\def\pgfmathfloatsinh@#1{%
+ \begingroup
+ \pgfmathfloatexp@{#1}%
+ \let\pgfmathfloat@@a=\pgfmathresult
+ %
+ \pgfmathfloatneg@{#1}%
+ \pgfmathfloatexp@{\pgfmathresult}%
+ %
+ \pgfmathfloatsubtract@{\pgfmathfloat@@a}{\pgfmathresult}%
+ \expandafter\pgfmathfloatmultiplyfixed@\expandafter{\pgfmathresult}{0.5}%
+ %
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\def\pgfmathfloattanh@#1{%
+ \begingroup
+ \pgfmathfloatsinh@{#1}%
+ \let\pgfmathfloat@@a=\pgfmathresult
+ %
+ \pgfmathfloatcosh@{#1}%
+ \let\pgfmathfloat@@b=\pgfmathresult
+ %
+ \pgfmathfloatdivide@{\pgfmathfloat@@a}{\pgfmathfloat@@b}%
+ %
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryintersections.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryintersections.code.tex
new file mode 100644
index 00000000000..698ec524ba8
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryintersections.code.tex
@@ -0,0 +1,767 @@
+% 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.
+
+
+\newcount\pgf@intersect@solutions
+
+\newif\ifpgf@intersect@sort
+\newif\ifpgf@intersect@sort@by@second@path
+
+\def\pgfintersectionsortbyfirstpath{%
+ \pgf@intersect@sorttrue%
+ \pgf@intersect@sort@by@second@pathfalse%
+}
+
+\def\pgfintersectionsortbysecondpath{%
+ \pgf@intersect@sorttrue%
+ \pgf@intersect@sort@by@second@pathtrue%
+}
+
+\def\pgfpointintersectionsolution#1{%
+ \ifnum#1<1\relax%
+ \pgfpoint@intersect@solution@orgin%
+ \else%
+ \ifnum#1>\pgfintersectionsolutions\relax%
+ \pgfpoint@intersect@solution@orgin%
+ \else%
+ \csname pgfpoint@intersect@solution@#1\endcsname%
+ \fi%
+ \fi%
+}
+
+\def\pgfpoint@intersect@solution@orgin{%
+ \begingroup%
+ \pgftransforminvert%
+ \pgfpointorigin%
+ \pgf@pos@transform{\pgf@x}{\pgf@y}%
+ \global\pgf@x=\pgf@x%
+ \global\pgf@y=\pgf@y%
+ \endgroup%
+}
+
+\long\def\pgfintersectionofpaths#1#2{%
+ \begingroup%
+ \pgfinterruptpath%
+ #1%
+ \pgfgetpath\pgf@intersect@path@a%
+ \global\let\pgf@intersect@path@temp=\pgf@intersect@path@a%
+ \endpgfinterruptpath%
+ \endgroup%
+ \let\pgf@intersect@path@a=\pgf@intersect@path@temp%
+ %
+ \begingroup%
+ \pgfinterruptpath%
+ #2%
+ \pgfgetpath\pgf@intersect@path@b%
+ \global\let\pgf@intersect@path@temp=\pgf@intersect@path@b%
+ \endpgfinterruptpath%
+ \endgroup%
+ \let\pgf@intersect@path@b=\pgf@intersect@path@temp%
+ %
+ \pgf@intersect@solutions=0\relax%
+ \def\pgf@intersect@time@offset{0}%
+ %
+ \ifpgf@intersect@sort@by@second@path%
+ \let\pgf@intersect@temp=\pgf@intersect@path@a%
+ \let\pgf@intersect@path@a=\pgf@intersect@path@b%
+ \let\pgf@intersect@path@b=\pgf@intersect@temp%
+ \fi%
+ \let\pgf@intersect@token@after=\pgf@intersect@path@process@a%
+ \expandafter\pgf@intersectionofpaths\pgf@intersect@path@a\pgf@stop%
+ \edef\pgfintersectionsolutions{\the\pgf@intersect@solutions}%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\pgfintersectionsolutions\relax%
+ \else%
+ \pgfutil@namelet{pgfpoint@intersect@solution@\pgfmathcounter}%
+ {pgfpoint@g@intersect@solution@\pgfmathcounter}%
+ \ifpgf@intersect@sort%
+ \pgfutil@namelet{pgf@intersect@solution@\pgfmathcounter @time@a}%
+ {pgf@g@intersect@solution@\pgfmathcounter @time@a}%
+ \fi%
+ \repeatpgfmathloop%
+ \ifpgf@intersect@sort%
+ \pgfintersectionsolutionsortbytime%
+ \fi%
+}
+
+\def\pgf@intersectionofpaths#1{%
+ \ifx#1\pgf@stop%
+ \let\pgf@intersect@next=\relax%
+ \else%
+ \ifx#1\pgfsyssoftpath@movetotoken%
+ \let\pgf@intersect@next=\pgf@intersect@token@moveto%
+ \else%
+ \ifx#1\pgfsyssoftpath@linetotoken%
+ \let\pgf@intersect@next=\pgf@intersect@token@lineto%
+ \else%
+ \ifx#1\pgfsyssoftpath@closepathtoken%
+ \let\pgf@intersect@next=\pgf@intersect@token@lineto%
+ \else%
+ \ifx#1\pgfsyssoftpath@curvetosupportatoken%
+ \let\pgf@intersect@next=\pgf@intersect@token@curveto%
+ \else%
+ \ifx#1\pgfsyssoftpath@rectcornertoken%
+ \let\pgf@intersect@next=\pgf@intersect@token@rect%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \pgf@intersect@next}
+
+\def\pgf@intersect@token@moveto#1#2{%
+ \def\pgfpoint@intersect@start{\pgfqpoint{#1}{#2}}%
+ \pgf@intersectionofpaths%
+}
+
+\def\pgf@intersect@token@lineto#1#2{%
+ \def\pgfpoint@intersect@end{\pgfqpoint{#1}{#2}}%
+ \def\pgf@intersect@type{line}%
+ \pgf@intersect@token@after%
+}
+\def\pgf@intersect@token@curveto#1#2\pgfsyssoftpath@curvetosupportbtoken#3#4\pgfsyssoftpath@curvetotoken#5#6{%
+ \def\pgfpoint@intersect@firstsupport{\pgfqpoint{#1}{#2}}%
+ \def\pgfpoint@intersect@secondsupport{\pgfqpoint{#3}{#4}}%
+ \def\pgfpoint@intersect@end{\pgfqpoint{#5}{#6}}%
+ \def\pgf@intersect@type{curve}%
+ \pgf@intersect@token@after%
+}
+
+\def\pgf@intersect@token@rect#1#2\pgfsyssoftpath@rectsizetoken#3#4{%
+ \pgf@xa=#1\relax%
+ \advance\pgf@xa by#3\relax%
+ \pgf@ya=#2\relax%
+ \advance\pgf@ya by#4\relax%
+ \edef\pgf@marshal{%
+ \noexpand\pgfsyssoftpath@movetotoken{#1}{#2}%
+ \noexpand\pgfsyssoftpath@linetotoken{#1}{\the\pgf@ya}%
+ \noexpand\pgfsyssoftpath@linetotoken{\the\pgf@xa}{\the\pgf@ya}%
+ \noexpand\pgfsyssoftpath@linetotoken{\the\pgf@xa}{#2}%
+ \noexpand\pgfsyssoftpath@closepathtoken{#1}{#2}%
+ }%
+ \expandafter\pgf@intersectionofpaths\pgf@marshal%
+}
+
+\def\pgf@intersect@path@process@a{%
+ \pgf@intersect@path@getpoints@a%
+ \let\pgf@intersect@token@after=\pgf@intersect@path@process@b%
+ \expandafter\pgf@intersectionofpaths\pgf@intersect@path@b\pgf@stop%
+ \let\pgfpoint@intersect@start=\pgfpoint@intersect@end@a%
+ \let\pgf@intersect@token@after=\pgf@intersect@path@process@a%
+ \c@pgf@counta=\pgf@intersect@time@offset\relax%
+ \advance\c@pgf@counta by1\relax%
+ \edef\pgf@intersect@time@offset{\the\c@pgf@counta}%
+ \pgf@intersectionofpaths%
+}
+
+\def\pgf@intersect@path@getpoints@a{%
+ \let\pgfpoint@intersect@start@a=\pgfpoint@intersect@start%
+ \let\pgfpoint@intersect@end@a=\pgfpoint@intersect@end%
+ \let\pgfpoint@intersect@firstsupport@a=\pgfpoint@intersect@firstsupport%
+ \let\pgfpoint@intersect@secondsupport@a=\pgfpoint@intersect@secondsupport%
+ \let\pgf@intersect@type@a=\pgf@intersect@type%
+}
+
+\def\pgf@intersect@path@process@b{%
+ \pgf@intersect@path@getpoints@b%
+ \csname pgf@intersect@\pgf@intersect@type@a @and@\pgf@intersect@type@b\endcsname%
+ \let\pgfpoint@intersect@start=\pgfpoint@intersect@end@b%
+ \pgf@intersectionofpaths}
+
+\def\pgf@intersect@path@getpoints@b{%
+ \let\pgfpoint@intersect@start@b=\pgfpoint@intersect@start%
+ \let\pgfpoint@intersect@end@b=\pgfpoint@intersect@end%
+ \let\pgfpoint@intersect@firstsupport@b=\pgfpoint@intersect@firstsupport%
+ \let\pgfpoint@intersect@secondsupport@b=\pgfpoint@intersect@secondsupport%
+ \let\pgf@intersect@type@b=\pgf@intersect@type%
+}
+
+\def\pgf@intersect@line@and@line{%
+ \pgf@intersectionoflines{\pgfpoint@intersect@start@a}{\pgfpoint@intersect@end@a}%
+ {\pgfpoint@intersect@start@b}{\pgfpoint@intersect@end@b}%
+}%
+
+\def\pgf@intersect@line@and@curve{%
+ \pgf@intersectionoflineandcurve%
+ {\pgf@process{\pgfpoint@intersect@start@a}}{\pgf@process{\pgfpoint@intersect@end@a}}%
+ {\pgf@process{\pgfpoint@intersect@start@b}}{\pgf@process{\pgfpoint@intersect@firstsupport@b}}%
+ {\pgf@process{\pgfpoint@intersect@secondsupport@b}}{\pgf@process{\pgfpoint@intersect@end@b}}%
+}
+
+\def\pgf@intersect@curve@and@line{%
+ \pgf@intersectionofcurveandline%
+ {\pgf@process{\pgfpoint@intersect@start@a}}{\pgf@process{\pgfpoint@intersect@firstsupport@a}}%
+ {\pgf@process{\pgfpoint@intersect@secondsupport@a}}{\pgf@process{\pgfpoint@intersect@end@a}}%
+ {\pgf@process{\pgfpoint@intersect@start@b}}{\pgf@process{\pgfpoint@intersect@end@b}}%
+}
+
+\def\pgf@intersect@curve@and@curve{%
+ \pgf@intersectionofcurves%
+ {\pgf@process{\pgfpoint@intersect@start@a}}{\pgf@process{\pgfpoint@intersect@firstsupport@a}}%
+ {\pgf@process{\pgfpoint@intersect@secondsupport@a}}{\pgf@process{\pgfpoint@intersect@end@a}}%
+ {\pgf@process{\pgfpoint@intersect@start@b}}{\pgf@process{\pgfpoint@intersect@firstsupport@b}}%
+ {\pgf@process{\pgfpoint@intersect@secondsupport@b}}{\pgf@process{\pgfpoint@intersect@end@b}}%
+}
+
+
+\def\pgfintersectionoflines#1#2#3#4{%
+ \pgf@intersect@solutions=0\relax%
+ \pgf@intersectionoflines{#1}{#2}{#3}{#4}%
+}
+
+\def\pgf@intersectionoflines#1#2#3#4{%
+ \pgf@iflinesintersect{#1}{#2}{#3}{#4}%
+ {%
+ \global\advance\pgf@intersect@solutions by1\relax%
+ \expandafter\pgfextract@process\csname pgfpoint@g@intersect@solution@\the\pgf@intersect@solutions\endcsname{%
+ \pgfpointintersectionoflines{\pgfpoint@intersect@start@a}{\pgfpoint@intersect@end@a}%
+ {\pgfpoint@intersect@start@b}{\pgfpoint@intersect@end@b}%
+ }%
+ \ifpgf@intersect@sort%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgf@process{\pgfpointdiff{\pgfpoint@intersect@start@a}{\pgfpoint@intersect@end@a}}%
+ \edef\pgf@marshal{%
+ \noexpand\pgfmathveclen@{\pgfmath@tonumber{\pgf@xa}}{\pgfmath@tonumber{\pgf@ya}}%
+ }%
+ \pgf@marshal%
+ \let\pgf@intersect@length@a=\pgfmathresult%
+ \pgf@process{\pgfpointdiff{\pgfpoint@intersect@start@a}{\pgfqpoint{\pgf@xc}{\pgf@yc}}}%
+ \edef\pgf@marshal{%
+ \noexpand\pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}%
+ }%
+ \pgf@marshal%
+ \pgfmathdivide@{\pgfmathresult}{\pgf@intersect@length@a}%
+ \pgf@x=\pgfmathresult pt\relax%
+ \advance\pgf@x by\pgf@intersect@time@offset pt\relax%
+ \expandafter\xdef\csname pgf@g@intersect@solution@\the\pgf@intersect@solutions @time@a\endcsname%
+ {\pgfmath@tonumber{\pgf@x}}%
+ \fi%
+ }{}%
+}
+
+% Test if two lines L1 and L2 intersect.
+%
+% #1 - first point P1 on L1.
+% #2 - second point P2 on L1.
+% #3 - first point P3 on L2.
+% #2 - second point P4 on L2.
+% #5 - code executed if intersection occurs.
+% #6 - code executed if intersection does no occur.
+%
+% Let L1 be represented by P1+(P2-P1)s where 0<=s<=1
+% Let L2 be represented by P3+(P4-P3)t where 0<=t<=1
+%
+% Then L1 and L2 intersect at
+%
+% s = |x2-x1 x3-x1| / |x4-x3 x2-x1|
+% |y2-y1 y3-y1| |y4-y3 y2-y1|
+%
+% t = |x4-x3 x3-x1| / |x4-x3 x2-x1|
+% |y4-y3 y3-y1| |y4-y3 y2-y1|
+%
+% with 0<=s,t<=1
+%
+% s and t do not need to be calculated:
+%
+% Let s = A / C and t = B / C
+%
+% Then 0<=s<=1 if !(C=0) && ((A=0) || ((A>0) && !(C<A)) || ((A<0) && !(C>A)))
+% 0<=t<=1 if !(C=0) && ((B=0) || ((B>0) && !(C<B)) || ((B<0) && !(C>B)))
+%
+\newif\ifpgf@s
+\newif\ifpgf@t
+\def\pgfiflinesintersect#1#2#3#4{%
+ \begingroup%
+ \pgf@iflinesintersect{\pgf@process{#1}}{\pgf@process{#2}}{\pgf@process{#3}}{\pgf@process{#4}}%
+ {\aftergroup\pgfutil@firstoftwo}{\aftergroup\pgfutil@secondoftwo}%
+ \endgroup%
+}
+
+\def\pgf@iflinesintersect#1#2#3#4{%
+ #4\relax%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ #3\relax%
+ \advance\pgf@xc by-\pgf@x%
+ \advance\pgf@yc by-\pgf@y%
+ \pgf@xb=\pgf@x%
+ \pgf@yb=\pgf@y%
+ #2\relax%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ #1\relax%
+ \advance\pgf@xa by-\pgf@x%
+ \advance\pgf@ya by-\pgf@y%
+ \advance\pgf@xb by-\pgf@x%
+ \advance\pgf@yb by-\pgf@y%
+ %
+ % xc = x4-x3; yc=y4-y3;
+ % xb = x3-x1; yb=y3-y1;
+ % xa = x2-x1; ya=y2-y1;
+ %
+ %
+ % Normalise a little. 16384 may not be a robust choice.
+ %
+ \c@pgf@counta=\pgf@xa\divide\c@pgf@counta by16384\relax%
+ \c@pgf@countb=\pgf@xb\divide\c@pgf@countb by16384\relax%
+ \c@pgf@countc=\pgf@ya\divide\c@pgf@countc by16384\relax%
+ \c@pgf@countd=\pgf@yb\divide\c@pgf@countd by16384\relax%
+ \multiply\c@pgf@counta by\c@pgf@countd%
+ \multiply\c@pgf@countc by\c@pgf@countb%
+ \advance\c@pgf@counta by-\c@pgf@countc%
+ \pgfutil@tempcnta=\c@pgf@counta%
+ %
+ \c@pgf@counta=\pgf@xc\divide\c@pgf@counta by16384\relax%
+ \c@pgf@countc=\pgf@yc\divide\c@pgf@countc by16384\relax%
+ \multiply\c@pgf@countd by\c@pgf@counta%
+ \multiply\c@pgf@countb by\c@pgf@countc%
+ \advance\c@pgf@countd by-\c@pgf@countb%
+ \pgfutil@tempcntb=\c@pgf@countd%
+ %
+ \c@pgf@countb=\pgf@xa\divide\c@pgf@countb by16384\relax%
+ \c@pgf@countd=\pgf@ya\divide\c@pgf@countd by16384\relax%
+ \multiply\c@pgf@counta by\c@pgf@countd%
+ \multiply\c@pgf@countc by\c@pgf@countb%
+ \advance\c@pgf@counta by-\c@pgf@countc%
+ %
+ \pgf@sfalse%
+ \pgf@tfalse%
+ \ifnum\c@pgf@counta=0\relax%
+ \else%
+ \ifnum\pgfutil@tempcnta=0\relax%
+ \pgf@strue%
+ \else%
+ \ifnum\pgfutil@tempcnta>0\relax%
+ \ifnum\c@pgf@counta<\pgfutil@tempcnta%
+ \else%
+ \pgf@strue%
+ \fi%
+ \else%
+ \ifnum\c@pgf@counta>\pgfutil@tempcnta%
+ \else%
+ \pgf@strue%
+ \fi%
+ \fi%
+ \fi%
+ \ifnum\pgfutil@tempcntb=0\relax%
+ \pgf@ttrue%
+ \else%
+ \ifnum\pgfutil@tempcntb>0\relax%
+ \ifnum\c@pgf@counta<\pgfutil@tempcntb%
+ \else%
+ \pgf@ttrue%
+ \fi%
+ \else%
+ \ifnum\c@pgf@counta>\pgfutil@tempcntb%
+ \else%
+ \pgf@ttrue%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \let\pgf@intersect@next=\pgfutil@secondoftwo%
+ \ifpgf@s%
+ \ifpgf@t%
+ \let\pgf@intersect@next=\pgfutil@firstoftwo%
+ \fi%
+ \fi%
+ \pgf@intersect@next%
+}
+
+
+
+
+\def\pgfintersectionoflineandcurve#1#2#3#4#5#6{%
+ \pgf@intersect@solutions=0\relax%
+ \pgf@intersectionoflineandcurve{#1}{#2}{#3}{#4}{#5}{#6}%
+}
+
+\def\pgf@intersectionoflineandcurve#1#2#3#4#5#6{%
+ \pgf@intersectionofcurves%
+ {\pgf@process{#1}}%
+ {%
+ \pgf@process{%
+ \pgfpointadd{#1\relax\pgf@x=0.666666\pgf@x\pgf@y=0.666666\pgf@y}%
+ {#2\relax\pgf@x=0.333333\pgf@x\pgf@y=0.333333\pgf@y}%
+ }%
+ }%
+ {%
+ \pgf@process{%
+ \pgfpointadd{#1\relax\pgf@x=0.333333\pgf@x\pgf@y=0.333333\pgf@y}%
+ {#2\relax\pgf@x=0.666666\pgf@x\pgf@y=0.666666\pgf@y}%
+ }%
+ }%
+ {\pgf@process{#2}}%
+ {\pgf@process{#3}}%
+ {\pgf@process{#4}}%
+ {\pgf@process{#5}}%
+ {\pgf@process{#6}}%
+}%
+
+\def\pgf@intersectionofcurveandline#1#2#3#4#5#6{%
+ \pgf@intersectionofcurves%
+ {\pgf@process{#1}}%
+ {\pgf@process{#2}}%
+ {\pgf@process{#3}}%
+ {\pgf@process{#4}}%
+ {\pgf@process{#5}}%
+ {%
+ \pgf@process{%
+ \pgfpointadd{#5\relax\pgf@x=0.666666\pgf@x\pgf@y=0.666666\pgf@y}%
+ {#6\relax\pgf@x=0.333333\pgf@x\pgf@y=0.333333\pgf@y}%
+ }%
+ }%
+ {%
+ \pgf@process{%
+ \pgfpointadd{#5\relax\pgf@x=0.333333\pgf@x\pgf@y=0.333333\pgf@y}%
+ {#6\relax\pgf@x=0.666666\pgf@x\pgf@y=0.666666\pgf@y}%
+ }%
+ }%
+ {\pgf@process{#6}}%
+}%
+
+
+
+
+\def\pgfintersectiontolerance{0.1pt}
+\def\pgfintersectiontolerancefactor{0.1}
+
+
+
+% Find the intersections of two bezier curves.
+%
+% #1 - #4 = curve 1.
+% #5 - #8 = curve 2.
+% #9 = the solution number.
+%
+% There is no guarantee of ordering of solutions. If there are
+% no solutions, the origin is returned.
+%
+\def\pgfpointintersectionofcurves#1#2#3#4#5#6#7#8#9{%
+ \pgf@intersect@solutions=0\relax%
+ \pgf@intersectionofcurves%
+ {\pgf@process{#1}}{\pgf@process{#2}}{\pgf@process{#3}}{\pgf@process{#4}}%
+ {\pgf@process{#5}}{\pgf@process{#6}}{\pgf@process{#7}}{\pgf@process{#8}}%
+ \pgfpointintersectionsolution{#9}%
+}
+
+% Return any intersection points of two curves C1 and C2.
+% No order can be guaranteed for the solutions.
+%
+% #1, #2, #3, #4 - the points on C1
+% #5, #6, #7, #8 - the points on C2
+%
+% Returns:
+%
+% \pgf@intersect@solutions - the number of solutions.
+% \pgfpointintersectionsolution{<S>} - the point for soultion S.
+%
+% (Sort of) use:
+%
+% intersection(C1,C2)
+% S = {};
+% intersection'(C1,C2);
+% return S;
+%
+% intersection'(C1,C2)
+% B1 = boundingbox(C1);
+% B2 = boundingbox(C2);
+% if intersect(B1,B2)
+% if (B1.width < q) and (B1.height < q) and
+% (B2.width < q) and (B2.height < q)
+% S = S + {average_of_all_points(B1,B2)}; \\ is there a better choice?
+% else
+% Q = subdivideLeft(C1);
+% R = subdivideRight(C1);
+% intersection'(C2,Q);
+% intersection'(C2,R);
+%
+% where q is a small value (tolerance).
+%
+\def\pgfintersectionofcurves#1#2#3#4#5#6#7#8{%
+ \pgf@intersect@solutions=0\relax%
+ \pgf@intersectionofcurves%
+ {\pgf@process{#1}}{\pgf@process{#2}}{\pgf@process{#3}}{\pgf@process{#4}}%
+ {\pgf@process{#5}}{\pgf@process{#6}}{\pgf@process{#7}}{\pgf@process{#8}}%
+}%
+\def\pgf@intersectionofcurves#1#2#3#4#5#6#7#8{%
+ \begingroup%
+ \dimendef\pgf@time@a=2\relax%
+ \dimendef\pgf@time@aa=4\relax%
+ \dimendef\pgf@time@b=6\relax%
+ \dimendef\pgf@time@bb=8\relax%
+ \pgf@time@a=0pt\relax%
+ \pgf@time@aa=1pt\relax%
+ \pgf@time@b=0pt\relax%
+ \pgf@time@bb=1pt\relax%
+ \let\pgf@intersect@subdivide@curve=\pgf@intersect@subdivide@curve@b%
+ \let\pgf@curve@subdivde@after=\pgf@@intersectionofcurves%
+ \pgf@@intersectionofcurves{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}%
+ \endgroup%
+}
+
+\def\pgf@@intersectionofcurves#1#2#3#4#5#6#7#8{%
+ \pgf@intersect@boundingbox@reset%
+ \pgf@intersect@boundingbox@update{#1}%
+ \pgf@intersect@boundingbox@update{#2}%
+ \pgf@intersect@boundingbox@update{#3}%
+ \pgf@intersect@boundingbox@update{#4}%
+ \edef\pgf@intersect@boundingbox@b{%
+ \noexpand\pgf@x=\the\pgf@xa%
+ \noexpand\pgf@y=\the\pgf@ya%
+ \noexpand\pgf@xa=\the\pgf@xb%
+ \noexpand\pgf@ya=\the\pgf@yb%
+ }%
+ \pgf@intersect@boundingbox@reset%
+ \pgf@intersect@boundingbox@update{#5}%
+ \pgf@intersect@boundingbox@update{#6}%
+ \pgf@intersect@boundingbox@update{#7}%
+ \pgf@intersect@boundingbox@update{#8}%
+ \edef\pgf@intersect@boundingbox@a{%
+ \noexpand\pgf@xb=\the\pgf@xa%
+ \noexpand\pgf@yb=\the\pgf@ya%
+ \noexpand\pgf@xc=\the\pgf@xb%
+ \noexpand\pgf@yc=\the\pgf@yb%
+ }%
+ \pgf@intersect@boundingbox@a%
+ \pgf@intersect@boundingbox@b%
+ \ifdim\pgf@xa<\pgf@xb%
+ \else%
+ \ifdim\pgf@x>\pgf@xc%
+ \else%
+ \ifdim\pgf@ya<\pgf@yb%
+ \else%
+ \ifdim\pgf@y>\pgf@yc%
+ \else%
+ \advance\pgf@xc by-\pgf@xb%
+ \advance\pgf@yc by-\pgf@yb%
+ \advance\pgf@xa by-\pgf@x%
+ \advance\pgf@ya by-\pgf@y%
+ \let\pgf@intersect@subdivde=\relax%
+ \ifdim\pgf@xc<\pgfintersectiontolerance\relax%
+ \ifdim\pgf@xa<\pgfintersectiontolerance\relax%
+ \ifdim\pgf@yc<\pgfintersectiontolerance\relax%
+ \ifdim\pgf@ya<\pgfintersectiontolerance\relax%
+ \pgfextract@process\pgf@intersect@solution@candidate{%
+ \pgf@intersect@boundingbox@a%
+ \pgf@intersect@boundingbox@b%
+ \pgf@x=0.25\pgf@x%
+ \advance\pgf@x by0.25\pgf@xa%
+ \advance\pgf@x by0.25\pgf@xb%
+ \advance\pgf@x by0.25\pgf@xc%
+ \pgf@y=0.25\pgf@y%
+ \advance\pgf@y by0.25\pgf@ya%
+ \advance\pgf@y by0.25\pgf@yb%
+ \advance\pgf@y by0.25\pgf@yc%
+ }%
+ % We must avoid duplicate solutions.
+ \let\pgf@intersect@subdivde=\pgf@stop%
+ \pgf@ifsolution@duplicate\pgf@intersect@solution@candidate{}%
+ {%
+ \global\advance\pgf@intersect@solutions by1\relax%
+ \expandafter\global\expandafter\let%
+ \csname pgfpoint@g@intersect@solution@\the\pgf@intersect@solutions\endcsname=%
+ \pgf@intersect@solution@candidate%
+ {%
+ \ifpgf@intersect@sort%
+ \advance\pgf@time@a by\pgf@time@aa%
+ \divide\pgf@time@a by2\relax%
+ \advance\pgf@time@a by\pgf@intersect@time@offset pt\relax%
+ \expandafter\xdef%
+ \csname pgf@g@intersect@solution@\the\pgf@intersect@solutions @time@a\endcsname%
+ {\pgfmath@tonumber{\pgf@time@a}}%
+ \fi%
+ }%
+ }%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \ifx\pgf@intersect@subdivde\pgf@stop%
+ \else%
+ \pgf@intersect@subdivide@curve{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+}
+
+\def\pgf@intersect@subdivide@curve@b#1#2#3#4#5#6#7#8{%
+ \begingroup%
+ \advance\pgf@time@bb by\pgf@time@b\relax%
+ \divide\pgf@time@bb by2\relax%
+ \let\pgf@intersect@subdivide@curve=\pgf@intersect@subdivide@curve@a%
+ \pgf@curve@subdivide@left{#5}{#6}{#7}{#8}{#1}{#2}{#3}{#4}%
+ \endgroup%
+ \begingroup%
+ \advance\pgf@time@b by\pgf@time@bb\relax%
+ \divide\pgf@time@b by2\relax%
+ \let\pgf@intersect@subdivide@curve=\pgf@intersect@subdivide@curve@a%
+ \pgf@curve@subdivide@right{#5}{#6}{#7}{#8}{#1}{#2}{#3}{#4}%
+ \endgroup%
+}
+
+\def\pgf@intersect@subdivide@curve@a#1#2#3#4#5#6#7#8{%
+ \begingroup%
+ \advance\pgf@time@aa by\pgf@time@a\relax%
+ \divide\pgf@time@aa by2\relax%
+ \let\pgf@intersect@subdivide@curve=\pgf@intersect@subdivide@curve@b%
+ \pgf@curve@subdivide@left{#5}{#6}{#7}{#8}{#1}{#2}{#3}{#4}%
+ \endgroup%
+ \begingroup%
+ \advance\pgf@time@a by\pgf@time@aa\relax%
+ \divide\pgf@time@a by2\relax%
+ \let\pgf@intersect@subdivide@curve=\pgf@intersect@subdivide@curve@b%
+ \pgf@curve@subdivide@right{#5}{#6}{#7}{#8}{#1}{#2}{#3}{#4}%
+ \endgroup%
+}
+
+\def\pgf@intersect@boundingbox@reset{%
+ \pgf@xa=16000pt\relax%
+ \pgf@ya=16000pt\relax%
+ \pgf@xb=-16000pt\relax%
+ \pgf@yb=-16000pt\relax%
+}
+
+\def\pgf@intersect@boundingbox@update#1{%
+ #1\relax%
+ \ifdim\pgf@x<\pgf@xa\pgf@xa=\pgf@x\fi%
+ \ifdim\pgf@y<\pgf@ya\pgf@ya=\pgf@y\fi%
+ \ifdim\pgf@x>\pgf@xb\pgf@xb=\pgf@x\fi%
+ \ifdim\pgf@y>\pgf@yb\pgf@yb=\pgf@y\fi%
+}
+
+
+\def\pgf@curve@subdivide@left#1#2#3#4{%
+ %
+ % The left curve (from t=0 to t=.5)
+ %
+ #1\relax%
+ \pgfutil@tempdima=\pgf@x%
+ \pgfutil@tempdimb=\pgf@y%
+ \pgf@xa=.5\pgf@x\pgf@ya=.5\pgf@y%
+ \pgf@xb=.25\pgf@x\pgf@yb=.25\pgf@y%
+ \pgf@xc=.125\pgf@x\pgf@yc=.125\pgf@y%
+ #2\relax%
+ \advance\pgf@xa by.5\pgf@x\advance\pgf@ya by.5\pgf@y%
+ \advance\pgf@xb by.5\pgf@x\advance\pgf@yb by.5\pgf@y%
+ \advance\pgf@xc by.375\pgf@x\advance\pgf@yc by.375\pgf@y%
+ #3\relax%
+ \advance\pgf@xb by.25\pgf@x\advance\pgf@yb by.25\pgf@y%
+ \advance\pgf@xc by.375\pgf@x\advance\pgf@yc by.375\pgf@y%
+ #4\relax%
+ \advance\pgf@xc by.125\pgf@x\advance\pgf@yc by.125\pgf@y%
+ \edef\pgf@marshal{%
+ \noexpand\pgf@curve@subdivde@after%
+ {\noexpand\pgf@x=\the\pgfutil@tempdima\noexpand\pgf@y=\the\pgfutil@tempdimb}%
+ {\noexpand\pgf@x=\the\pgf@xa\noexpand\pgf@y\the\pgf@ya}%
+ {\noexpand\pgf@x=\the\pgf@xb\noexpand\pgf@y=\the\pgf@yb}
+ {\noexpand\pgf@x=\the\pgf@xc\noexpand\pgf@y=\the\pgf@yc}%
+ }%
+ \pgf@marshal%
+}
+
+\def\pgf@curve@subdivide@right#1#2#3#4{%
+ %
+ % The right curve (from t=0.5 to t=1)
+ %
+ #1\relax%
+ \pgfutil@tempdima=.125\pgf@x\pgfutil@tempdimb=.125\pgf@y%
+ #2\relax%
+ \advance\pgfutil@tempdima by.375\pgf@x\advance\pgfutil@tempdimb by.375\pgf@y%
+ \pgf@xa=.25\pgf@x\pgf@ya=.25\pgf@y%
+ #3\relax%
+ \advance\pgfutil@tempdima by.375\pgf@x\advance\pgfutil@tempdimb by.375\pgf@y%
+ \advance\pgf@xa by.5\pgf@x\advance\pgf@ya by.5\pgf@y%
+ \pgf@xb=.5\pgf@x\pgf@yb=.5\pgf@y%
+ #4\relax%
+ \advance\pgfutil@tempdima by.125\pgf@x\advance\pgfutil@tempdimb by.125\pgf@y%
+ \advance\pgf@xa by.25\pgf@x\advance\pgf@ya by.25\pgf@y%
+ \advance\pgf@xb by.5\pgf@x\advance\pgf@yb by.5\pgf@y%
+ \pgf@xc=\pgf@x\pgf@yc=\pgf@y%
+ \edef\pgf@marshal{%
+ \noexpand\pgf@curve@subdivde@after%
+ {\pgf@x\the\pgfutil@tempdima\pgf@y\the\pgfutil@tempdimb}%
+ {\pgf@x\the\pgf@xa\pgf@y\the\pgf@ya}{\pgf@x\the\pgf@xb\pgf@y\the\pgf@yb}
+ {\pgf@x\the\pgf@xc\pgf@y\the\pgf@yc}%
+ }%
+ \pgf@marshal%
+}
+
+
+% A solution S1 is considered a duplicate of S2, if
+%
+% |x1 - x2|f < q and |y1 - y2|f < q
+%
+% where q is a small value (tolerance).
+%
+% #1 - the solution.
+%
+\def\pgf@ifsolution@duplicate#1{%
+ #1%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \let\pgf@intersect@next=\pgfutil@secondoftwo%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\pgf@intersect@solutions\relax%
+ \else%
+ \pgf@process{\csname pgfpoint@g@intersect@solution@\pgfmathcounter\endcsname}%
+ \advance\pgf@x by-\pgf@xa%
+ \advance\pgf@y by-\pgf@ya%
+ \ifdim\pgf@x<0pt\relax\pgf@x=-\pgf@x\fi%
+ \ifdim\pgf@y<0pt\relax\pgf@y=-\pgf@y\fi%
+ %
+ \pgf@x=\pgfintersectiontolerancefactor\pgf@x%
+ \pgf@y=\pgfintersectiontolerancefactor\pgf@y%
+ \ifdim\pgf@x<\pgfintersectiontolerance\relax%
+ \ifdim\pgf@y<\pgfintersectiontolerance\relax%
+ \let\pgf@intersect@next=\pgfutil@firstoftwo%
+ \fi%
+ \fi%
+ \repeatpgfmathloop%
+ \pgf@intersect@next%
+}
+
+
+\newif\ifpgf@intersect@solutions@sortfinish
+
+% Sort solutions according to their time index.
+%
+\def\pgfintersectionsolutionsortbytime{%
+ \pgf@intersect@solutions@sortfinishtrue%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter=\pgfintersectionsolutions\relax%
+ \else%
+ \pgfutil@tempcnta=\pgfmathcounter%
+ \advance\pgfutil@tempcnta by1\relax%
+ \ifdim\csname pgf@intersect@solution@\pgfmathcounter @time@a\endcsname pt>%
+ \csname pgf@intersect@solution@\the\pgfutil@tempcnta @time@a\endcsname pt\relax%
+ \pgf@intersect@solutions@sortfinishfalse%
+ %
+ \pgfutil@namelet{pgf@intersect@temp}{pgfpoint@intersect@solution@\pgfmathcounter}%
+ \pgfutil@namelet{pgfpoint@intersect@solution@\pgfmathcounter}%
+ {pgfpoint@intersect@solution@\the\pgfutil@tempcnta}%
+ \pgfutil@namelet{pgfpoint@intersect@solution@\the\pgfutil@tempcnta}{pgf@intersect@temp}%
+ %
+ \pgfutil@namelet{pgf@intersect@temp}{pgf@intersect@solution@\pgfmathcounter @time@a}%
+ \pgfutil@namelet{pgf@intersect@solution@\pgfmathcounter @time@a}%
+ {pgf@intersect@solution@\the\pgfutil@tempcnta @time@a}%
+ \pgfutil@namelet{pgf@intersect@solution@\the\pgfutil@tempcnta @time@a}{pgf@intersect@temp}%
+ \fi%
+ \repeatpgfmathloop%
+ \ifpgf@intersect@solutions@sortfinish%
+ \else%
+ \expandafter\pgfintersectionsolutionsortbytime%
+ \fi%
+}
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarylindenmayersystems.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarylindenmayersystems.code.tex
new file mode 100644
index 00000000000..d7bb3d9dd57
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarylindenmayersystems.code.tex
@@ -0,0 +1,223 @@
+% 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.
+
+\newdimen\pgflsystemstep
+\newcount\c@pgf@lsystem@iteration
+
+\newif\ifpgf@lsystem@randomize@step
+\newif\ifpgf@lsystem@randomize@angle
+
+\pgfkeys{/pgf/lindenmayer system/.cd,%
+ step/.code={\pgfmathsetlength\pgflsystemstep{#1}},%
+ randomize step percent/.code={%
+ \pgfmathparse{#1}%
+ \let\pgflsystemrandomizesteppercent=\pgfmathresult%
+ \ifdim\pgfmathresult pt=0pt\relax%
+ \pgf@lsystem@randomize@stepfalse%
+ \else%
+ \pgf@lsystem@randomize@steptrue%
+ \fi%
+ },%
+ left angle/.code={\pgfmathparse{#1}\let\pgflsystemleftangle=\pgfmathresult},%
+ right angle/.code={\pgfmathparse{#1}\let\pgflsystemrightangle=\pgfmathresult},%
+ angle/.style={/pgf/lindenmayer system/left angle=#1, /pgf/lindenmayer system/right angle=#1},%
+ randomize angle percent/.code={%
+ \pgfmathparse{#1}%
+ \let\pgflsystemrandomizeanglepercent=\pgfmathresult%
+ \ifdim\pgfmathresult pt=0pt\relax%
+ \pgf@lsystem@randomize@anglefalse%
+ \else%
+ \pgf@lsystem@randomize@angletrue%
+ \fi%
+ }%
+}
+
+\pgfkeys{/pgf/lindenmayer system/.cd,
+ step=5pt,%
+ randomize step percent=0,%
+ angle=90,%
+ randomize angle percent=0%
+}
+
+\long\def\pgfdeclarelindenmayersystem#1#2{%
+ \pgfutil@ifundefined{pgf@lsystem@#1}%
+ {%
+ \begingroup%
+ \edef\pgf@lsystem@name{#1}%
+ \expandafter\global\expandafter\let\csname pgf@lsystem@#1\endcsname=\pgf@lsystem@name%
+ \let\symbol=\pgf@lsystem@symbol%
+ \let\rule=\pgf@lsystem@rule%
+ #2%
+ \endgroup%
+ }%
+ {\PackageError{pgf}{Lindenmayer system `#1' is already defined}{}}%
+}
+
+\def\pgf@lsystem@symbol#1#2{%
+ \expandafter\gdef\csname pgf@lsystem@\pgf@lsystem@name @symbol@#1\endcsname{#2}%
+}
+
+\def\pgf@lsystem@rule#1{\expandafter\pgf@lsystem@rule@#1\pgf@stop}
+\def\pgf@lsystem@rule@#1{\def\pgf@lsystem@rule@head{#1}\pgf@lsystem@rule@@}
+\def\pgf@lsystem@rule@@#1->{% Now some `fooling around' to deal with unwanted spaces.
+ \let\pgf@lsystem@rule@body=\pgfutil@empty%
+ \pgfutil@ifnextchar x{\pgf@lsystem@rule@@@}{\pgf@lsystem@rule@@@}}
+\def\pgf@lsystem@rule@@@#1{%
+ \ifx#1\pgf@stop%
+ \expandafter\global\expandafter\let%
+ \csname pgf@lsystem@\pgf@lsystem@name @rule@\pgf@lsystem@rule@head\endcsname=\pgf@lsystem@rule@body%
+ \else%
+ \edef\pgf@lsystem@rule@body{\pgf@lsystem@rule@body#1}%
+ \expandafter\pgf@lsystem@rule@@@%
+ \fi%
+}
+
+\def\pgflindenmayersystem#1#2#3{%
+ \begingroup%
+ \edef\pgf@lsystem@name{#1}%
+ \edef\pgf@lsystem@axiom{#2}%
+ \pgfmathtruncatemacro\pgf@lsystem@order{#3}%
+ %
+ \let\pgf@lsystem@current@symbol=\relax%
+ %
+ \c@pgf@lsystem@iteration=0\relax%
+ %
+ \ifnum\pgf@lsystem@order=0\relax%
+ \expandafter\pgf@lsystem@draw\pgf@lsystem@axiom\pgf@stop
+ \let\pgf@lsystem@next=\pgf@lsystem@end%
+ \else%
+ \let\pgf@lsystem@next=\pgf@lsystem@run%
+ \fi%
+ \expandafter\pgf@lsystem@next\pgf@lsystem@axiom\pgf@lsystem@stop%
+}
+
+\def\pgf@lsystem@run#1{%
+ \ifx#1\pgf@lsystem@stop%
+ \def\pgf@lsystem@token{\pgf@lsystem@stop}%
+ \let\pgf@lsystem@next=\pgf@lsystem@end%
+ \else%
+ \ifx#1\pgf@stop%
+ \advance\c@pgf@lsystem@iteration by-1\relax%
+ \let\pgf@system@token=\pgfutil@empty%
+ \let\pgf@lsystem@next=\pgf@lsystem@run%
+ \else%
+ % Does #1 appear on the RHS of a rule...?
+ \expandafter\let\expandafter\pgf@lsystem@token\expandafter=%
+ \csname pgf@lsystem@\pgf@lsystem@name @rule@#1\endcsname%
+ \ifx\pgf@lsystem@token\relax%
+ % ...nope. So draw it straight away.
+ \pgf@lsystem@draw#1\pgf@stop%
+ \let\pgf@lsystem@token=\pgfutil@empty%
+ \else%
+ % ...yep. So, if the order has been reached draw the LHS
+ % immediately. Otherwise add the LHS to the token stream
+ % and continue.
+ \advance\c@pgf@lsystem@iteration by1\relax%
+ \ifnum\c@pgf@lsystem@iteration=\pgf@lsystem@order%
+ \expandafter\pgf@lsystem@draw\pgf@lsystem@token \pgf@stop%
+ \advance\c@pgf@lsystem@iteration by-1\relax%
+ \let\pgf@lsystem@token=\pgfutil@empty%
+ \else%
+ \expandafter\def\expandafter\pgf@lsystem@token\expandafter{\pgf@lsystem@token \pgf@stop}%
+ \fi%
+ \fi%
+ \let\pgf@lsystem@next=\pgf@lsystem@run%
+ \fi%
+ \fi%
+ \expandafter\pgf@lsystem@next\pgf@lsystem@token}
+
+\def\pgf@lsystem@end#1\pgf@lsystem@stop{\endgroup}
+
+\def\pgf@lsystem@draw#1{%
+ \ifx#1\pgf@stop%
+ \let\pgf@lsystem@next=\relax%
+ \else%
+ \expandafter\let\expandafter\pgf@lsystem@current@symbol\expandafter=%
+ \csname pgf@lsystem@\pgf@lsystem@name @symbol@#1\endcsname%
+ \ifx\pgf@lsystem@current@symbol\relax% Try a default symbol.
+ \expandafter\let\expandafter\pgf@lsystem@current@symbol\expandafter=%
+ \csname pgf@lsystem@symbol@default@#1\endcsname%
+ \fi%
+ \let\pgf@lsystem@next=\pgf@lsystem@@draw%
+ \fi%
+ \pgf@lsystem@next}
+
+\def\pgf@lsystem@@draw{%
+ \edef\pgflsystemcurrentstep{\the\pgflsystemstep}%
+ \let\pgflsystemcurrentrightangle=\pgflsystemrightangle%
+ \let\pgflsystemcurrentrightangle=\pgflsystemleftangle%
+ \pgf@lsystem@current@symbol%
+ \pgf@lsystem@draw}
+
+\expandafter\def\csname pgf@lsystem@symbol@default@F\endcsname{\pgflsystemdrawforward}
+\expandafter\def\csname pgf@lsystem@symbol@default@f\endcsname{\pgflsystemmoveforward}
+\expandafter\def\csname pgf@lsystem@symbol@default@+\endcsname{\pgflsystemturnleft}
+\expandafter\def\csname pgf@lsystem@symbol@default@-\endcsname{\pgflsystemturnright}
+\expandafter\def\csname pgf@lsystem@symbol@default@[\endcsname{\pgflsystemsavestate}
+\expandafter\def\csname pgf@lsystem@symbol@default@]\endcsname{\pgflsystemrestorestate}
+
+\def\pgflsystemradonmizestep{%
+ \ifpgf@lsystem@randomize@step%
+ \pgfmathrand%
+ \pgf@x=\pgflsystemrandomizesteppercent pt\relax%
+ \pgf@x=\pgfmathresult\pgf@x%
+ \divide\pgf@x by20\relax%
+ \advance\pgf@x by\pgflsystemstep\relax%
+ \edef\pgflsystemcurrentstep{\the\pgf@x}%
+ \else%
+ \edef\pgflsystemcurrentstep{\the\pgflsystemstep}%
+ \fi%
+}
+
+\def\pgflsystemdrawforward{%
+ \pgflsystemradonmizestep
+ \pgftransformxshift{+\pgflsystemcurrentstep}%
+ \pgfpathlineto{\pgfpointorigin}}
+
+\def\pgflsystemmoveforward{%
+ \pgflsystemradonmizestep
+ \pgftransformxshift{+\pgflsystemcurrentstep}%
+ \pgfpathmoveto{\pgfpointorigin}}
+
+\def\pgflsystemranomizerightangle{%
+ \ifpgf@lsystem@randomize@angle%
+ \pgf@x=\pgflsystemrandomizeanglepercent pt\relax%
+ \divide\pgf@x by20\relax%
+ \pgfmathrand%
+ \pgf@x=\pgfmathresult\pgf@x%
+ \advance\pgf@x by\pgflsystemrightangle pt\relax%
+ \edef\pgflsystemcurrentrightangle{\pgfmath@tonumber{\pgf@x}}%
+ \else%
+ \let\pgflsystemcurrentrightangle=\pgflsystemrightangle%
+ \fi%
+}
+
+\def\pgflsystemranomizeleftangle{%
+ \ifpgf@lsystem@randomize@angle%
+ \pgf@x=\pgflsystemrandomizeanglepercent pt\relax%
+ \divide\pgf@x by20\relax%
+ \pgfmathrand%
+ \pgf@x=\pgfmathresult\pgf@x%
+ \advance\pgf@x by\pgflsystemleftangle pt\relax%
+ \edef\pgflsystemcurrentleftangle{\pgfmath@tonumber{\pgf@x}}%
+ \else%
+ \let\pgflsystemcurrentleftangle=\pgflsystemleftangle%
+ \fi%
+}
+
+\def\pgflsystemturnright{%
+ \pgflsystemranomizerightangle
+ \pgftransformrotate{-\pgflsystemcurrentrightangle}}
+
+\def\pgflsystemturnleft{%
+ \pgflsystemranomizeleftangle
+ \pgftransformrotate{\pgflsystemcurrentleftangle}}
+
+\def\pgflsystemsavestate{\begingroup}
+\def\pgflsystemrestorestate{\endgroup\pgfpathmoveto{\pgfpointorigin}}
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarypatterns.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarypatterns.code.tex
index c9c29958585..acfc3fa7b2e 100644
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarypatterns.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarypatterns.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/libraries/pgflibrarypatterns.code.tex,v 1.12 2008/01/15 10:27:34 tantau Exp $
+\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibrarypatterns.code.tex,v 1.13 2008/03/03 13:52:35 tantau Exp $
% Lines in different directions
@@ -241,6 +241,7 @@
}
\pgfutil@definecolor{pgf@lightsteelblue}{rgb}{0.6875,0.765625,0.8671875}
+\pgfutil@colorlet{pgf@darklightsteelblue}{black!50!pgf@lightsteelblue}
\pgfdeclarepatterninherentlycolored{crosshatch dots light steel blue}
{\pgfpointorigin}{\pgfpoint{8pt}{8pt}}
@@ -249,11 +250,11 @@
\pgfsetfillcolor{pgf@lightsteelblue}
\pgfpathrectangle{\pgfpointorigin}{\pgfpoint{8pt}{8pt}}
\pgfusepath{fill}
- \pgfsetfillcolor{black!80!pgf@lightsteelblue!10}
+ \pgfsetfillcolor{pgf@darklightsteelblue!10}
\pgfpathcircle{\pgfpoint{2pt}{1.75pt}}{1pt}
\pgfpathcircle{\pgfpoint{6pt}{5.75pt}}{1pt}
\pgfusepath{fill}
- \pgfsetfillcolor{black!80!pgf@lightsteelblue!70}
+ \pgfsetfillcolor{pgf@darklightsteelblue!70}
\pgfpathcircle{\pgfpoint{2pt}{2.25pt}}{1pt}
\pgfpathcircle{\pgfpoint{6pt}{6.25pt}}{1pt}
\pgfusepath{fill}
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex
index a0f504431eb..5ab9e84a796 100644
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.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/libraries/pgflibraryplothandlers.code.tex,v 1.9 2007/03/09 17:49:32 tantau Exp $
+\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryplothandlers.code.tex,v 1.15 2010/05/31 10:11:22 tantau Exp $
\newif\ifpgf@plot@started
@@ -280,7 +280,8 @@
\def\pgf@plotstreamstart{%
\global\let\pgf@plotstreampoint=\pgf@plot@xcomb@handler%
\global\let\pgf@plotstreamspecial=\pgfutil@gobble%
- \global\let\pgf@plotstreamend=\relax%
+ \global\let\pgf@plotstreamend=\pgfplotxzerolevelstreamend%
+ \pgfplotxzerolevelstreamstart
}%
}
@@ -288,7 +289,11 @@
\pgf@process{#1}%
\pgf@xa=\pgf@x%
\pgf@ya=\pgf@y%
- \pgfpathmoveto{\pgfqpoint{0pt}{\pgf@ya}}%
+ \begingroup
+ \pgfplotxzerolevelstreamnext
+ \endgroup
+ \pgf@yb=\pgf@x
+ \pgfpathmoveto{\pgfqpoint{\pgf@yb}{\pgf@ya}}%
\pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}%
}
@@ -306,7 +311,8 @@
\def\pgf@plotstreamstart{%
\global\let\pgf@plotstreampoint=\pgf@plot@ycomb@handler%
\global\let\pgf@plotstreamspecial=\pgfutil@gobble%
- \global\let\pgf@plotstreamend=\relax%
+ \global\let\pgf@plotstreamend=\pgfplotyzerolevelstreamend%
+ \pgfplotyzerolevelstreamstart
}%
}
@@ -314,12 +320,412 @@
\pgf@process{#1}%
\pgf@xa=\pgf@x%
\pgf@ya=\pgf@y%
- \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}}%
+ \begingroup
+ \pgfplotyzerolevelstreamnext
+ \endgroup
+ \pgf@yb=\pgf@x
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@yb}}%
\pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}%
}
+% PGF Bar or comb plots usually draw something from zero to the current plot's coordinate.
+%
+% The 'zero' offset can be changed using an input stream.
+%
+% There are two such streams which can be configured independently.
+% The first one returns "zeros" for coordinate x, the second one
+% returns "zeros" for coordinate y.
+%
+% \pgfplotxzerolevelstreamstart
+% \pgfplotxzerolevelstreamnext % assigns \pgf@x globally
+% \pgfplotxzerolevelstreamnext
+% \pgfplotxzerolevelstreamnext
+% \pgfplotxzerolevelstreamend
+%
+% and
+% \pgfplotyzerolevelstreamstart
+% \pgfplotyzerolevelstreamnext % assigns \pgf@x globally
+% \pgfplotyzerolevelstreamend
+%
+\def\pgfplotxzerolevelstreamstart{\pgf@plotxzerolevelstreamstart}%
+\def\pgfplotxzerolevelstreamend{\pgf@plotxzerolevelstreamend}%
+\def\pgfplotxzerolevelstreamnext{\pgf@plotxzerolevelstreamnext}
+\def\pgfplotyzerolevelstreamstart{\pgf@plotyzerolevelstreamstart}%
+\def\pgfplotyzerolevelstreamend{\pgf@plotyzerolevelstreamend}%
+\def\pgfplotyzerolevelstreamnext{\pgf@plotyzerolevelstreamnext}
+
+% This zero level stream always returns '#1' (a dimension).
+\def\pgfplotxzerolevelstreamconstant#1{%
+ \edef\pgfplotxzerolevelstreamconstant@val{#1}%
+ \def\pgf@plotxzerolevelstreamstart{%
+ \global\let\pgf@plotxzerolevelstreamend=\relax
+ \gdef\pgf@plotxzerolevelstreamnext{\global\pgf@x=\pgfplotxzerolevelstreamconstant@val\relax}%
+ }%
+}%
+\pgfplotxzerolevelstreamconstant{0pt}%
+
+% This zero level stream always returns '#1'.
+\def\pgfplotyzerolevelstreamconstant#1{%
+ \edef\pgfplotyzerolevelstreamconstant@val{#1}%
+ \def\pgf@plotyzerolevelstreamstart{%
+ \global\let\pgf@plotyzerolevelstreamend=\relax
+ \gdef\pgf@plotyzerolevelstreamnext{\global\pgf@x=\pgfplotyzerolevelstreamconstant@val\relax}%
+ }%
+}%
+\pgfplotyzerolevelstreamconstant{0pt}%
+
+\def\pgfplotbarwidth{\pgfkeysvalueof{/pgf/bar width}}
+
+\pgfqkeys{/pgf}{%
+ bar width/.initial=10pt,
+ bar shift/.initial=0pt,
+ bar interval width/.initial=1,
+ bar interval shift/.initial=0.5,
+}
+
+% This handler places a rectangle at each point in the plot stream, a
+% rectangle which touches the x-axis at one end and the current point
+% at the other end:
+% --(X)--
+% | |
+% | |
+% | |
+% --(0)--
+% Example:
+%
+% \pgfplothandlerybar
+% \pgfplotxyfile{mytable}
+\def\pgfplothandlerybar{%
+ \def\pgf@plotstreamstart{%
+ \global\let\pgf@plotstreampoint=\pgf@plot@ybar@handler%
+ \global\let\pgf@plotstreamspecial=\pgfutil@gobble%
+ \global\let\pgf@plotstreamend=\pgfplotyzerolevelstreamend%
+ \pgfmathparse{\pgfplotbarwidth}%
+ \xdef\pgfplotbarwidth@{\pgfmathresult pt}%
+ \pgfmathparse{\pgfkeysvalueof{/pgf/bar shift}}%
+ \xdef\pgfplotbarshift@{\pgfmathresult pt}%
+ \pgfplotyzerolevelstreamstart
+ }%
+}
+\def\pgf@plot@ybar@handler#1{%
+ \pgf@process{#1}%
+ \pgf@ya=\pgf@y
+ \expandafter\pgf@xb\pgfplotbarwidth@\relax
+ \pgf@xc=\pgf@x
+ \advance\pgf@xc by-.5\pgf@xb
+ \advance\pgf@xc by\pgfplotbarshift@\relax
+ \begingroup
+ \pgfplotyzerolevelstreamnext
+ \endgroup
+ \pgf@yb=\pgf@x
+ \advance\pgf@ya by-\pgf@yb
+ \pgfpathrectangle
+ {\pgfqpoint{\pgf@xc}{\pgf@yb}}%
+ {\pgfqpoint{\pgf@xb}{\pgf@ya}}%
+}
+% This handler places a rectangle at each point in the plot stream, a
+% rectangle which touches the y-axis at one end and the current point
+% at the other end:
+% ---------
+% | |
+% (0) (X)
+% | |
+% ---------
+% Example:
+%
+% \pgfplothandlerxbar
+% \pgfplotxyfile{mytable}
+\def\pgfplothandlerxbar{%
+ \def\pgf@plotstreamstart{%
+ \global\let\pgf@plotstreampoint=\pgf@plot@xbar@handler%
+ \global\let\pgf@plotstreamspecial=\pgfutil@gobble%
+ \global\let\pgf@plotstreamend=\pgfplotxzerolevelstreamend%
+ \pgfmathparse{\pgfplotbarwidth}%
+ \xdef\pgfplotbarwidth@{\pgfmathresult pt}%
+ \pgfmathparse{\pgfkeysvalueof{/pgf/bar shift}}%
+ \xdef\pgfplotbarshift@{\pgfmathresult pt}%
+ \pgfplotxzerolevelstreamstart
+ }%
+}
+
+\def\pgf@plot@xbar@handler#1{%
+ \pgf@process{#1}%
+ \pgf@ya=\pgf@x
+ \expandafter\pgf@xb\pgfplotbarwidth@\relax
+ \pgf@xc=\pgf@y
+ \advance\pgf@xc by-.5\pgf@xb
+ \advance\pgf@xc by\pgfplotbarshift@\relax
+ \begingroup
+ \pgfplotxzerolevelstreamnext
+ \endgroup
+ \pgf@yb=\pgf@x
+ \advance\pgf@ya by-\pgf@yb
+ \pgfpathrectangle
+ {\pgfqpoint{\pgf@yb}{\pgf@xc}}%
+ {\pgfqpoint{\pgf@ya}{\pgf@xb}}%
+}
+
+% This handler is a variant of \pgfplothandlerybar which works with
+% intervals instead of points.
+%
+% Bars are drawn between successive input coordinates and the width is
+% determined relatively to the interval length.
+%
+% It looks like this:
+%
+% |---| |-----|
+% | | | |
+% | | | |
+% | | | |
+% (X)------(X)-----------(X)
+%
+% where (X) denotes the x-axis offsets of input coordinates.
+%
+% In more detail, if (x_i,y_i) and (x_{i+1},y_{i+1}) denote successive
+% input coordinates, the bar will be placed above the
+% interval [x_i,x_{i+1}], centered at
+%
+% x_i + \pgfkeysvalueof{/pgf/bar interval shift} * (x_{i+1} - x_i)
+%
+% with width
+%
+% \pgfkeysvalueof{/pgf/bar interval width} * (x_{i+1} - x_i).
+%
+% If you have N+1 input points, you will get N bars (one for each
+% interval). The y_i value of the last bar will be ignored.
+%
+% Example:
+%
+% \pgfplothandlerybarinterval
+% \pgfplotxyfile{mytable}
+\def\pgfplothandlerybarinterval{%
+ \def\pgf@plotstreamstart{%
+ \global\let\pgf@plotstreampoint=\pgf@plot@ybarinterval@handler@first%
+ \global\let\pgf@plotstreamspecial=\pgfutil@gobble%
+ \global\let\pgf@plotstreamend=\pgfplotyzerolevelstreamend%
+ \pgfmathparse{\pgfkeysvalueof{/pgf/bar interval width}}%
+ \xdef\pgfplotbarintervalwidth@{\pgfmathresult}%
+ \pgfmathparse{\pgfkeysvalueof{/pgf/bar interval shift}}%
+ \xdef\pgfplotbarintervalshift@{\pgfmathresult}%
+ \pgfplotyzerolevelstreamstart
+ }%
+}
+
+\def\pgf@plot@ybarinterval@handler@first#1{%
+ \pgf@process{#1}%
+ \xdef\pgf@plot@barinterval@intervalstart{\the\pgf@x}%
+ \xdef\pgf@plot@barinterval@bar{\the\pgf@y}%
+ \global\let\pgf@plotstreampoint=\pgf@plot@ybarinterval@handler%
+}
+\def\pgf@plot@ybarinterval@handler#1{%
+ \pgf@process{#1}%
+ \pgf@ya=\pgf@plot@barinterval@bar
+ \xdef\pgf@plot@barinterval@bar{\the\pgf@y}%
+ \pgf@xc=\pgf@plot@barinterval@intervalstart\relax
+ \xdef\pgf@plot@barinterval@intervalstart{\the\pgf@x}%
+ \pgf@xb=\pgf@x
+ \advance\pgf@xb by-\pgf@xc
+ \advance\pgf@xc by\pgfplotbarintervalshift@\pgf@xb
+ \pgf@xb=\pgfplotbarintervalwidth@\pgf@xb
+ \advance\pgf@xc by-.5\pgf@xb% center
+ \begingroup
+ \pgfplotyzerolevelstreamnext
+ \endgroup
+ \pgf@yb=\pgf@x
+ \advance\pgf@ya by-\pgf@yb
+ \pgfpathrectangle
+ {\pgfqpoint{\pgf@xc}{\pgf@yb}}%
+ {\pgfqpoint{\pgf@xb}{\pgf@ya}}%
+}
+
+% Like \pgfplothandlerybarinterval but for xbar.
+\def\pgfplothandlerxbarinterval{%
+ \def\pgf@plotstreamstart{%
+ \global\let\pgf@plotstreampoint=\pgf@plot@xbarinterval@handler@first%
+ \global\let\pgf@plotstreamspecial=\pgfutil@gobble%
+ \global\let\pgf@plotstreamend=\pgfplotxzerolevelstreamend%
+ \pgfmathparse{\pgfkeysvalueof{/pgf/bar interval width}}%
+ \xdef\pgfplotbarintervalwidth@{\pgfmathresult}%
+ \pgfmathparse{\pgfkeysvalueof{/pgf/bar interval shift}}%
+ \xdef\pgfplotbarintervalshift@{\pgfmathresult}%
+ \pgfplotxzerolevelstreamstart
+ }%
+}
+
+\def\pgf@plot@xbarinterval@handler@first#1{%
+ \pgf@process{#1}%
+ \xdef\pgf@plot@barinterval@intervalstart{\the\pgf@y}%
+ \xdef\pgf@plot@barinterval@bar{\the\pgf@x}%
+ \global\let\pgf@plotstreampoint=\pgf@plot@xbarinterval@handler%
+}
+\def\pgf@plot@xbarinterval@handler#1{%
+ \pgf@process{#1}%
+ \pgf@ya=\pgf@plot@barinterval@bar
+ \xdef\pgf@plot@barinterval@bar{\the\pgf@x}%
+ \pgf@xc=\pgf@plot@barinterval@intervalstart\relax
+ \xdef\pgf@plot@barinterval@intervalstart{\the\pgf@y}%
+ \pgf@xb=\pgf@y
+ \advance\pgf@xb by-\pgf@xc
+ \advance\pgf@xc by\pgfplotbarintervalshift@\pgf@xb
+ \pgf@xb=\pgfplotbarintervalwidth@\pgf@xb
+ \advance\pgf@xc by-.5\pgf@xb% center
+ \begingroup
+ \pgfplotxzerolevelstreamnext
+ \endgroup
+ \pgf@yb=\pgf@x
+ \advance\pgf@ya by-\pgf@yb
+ \pgfpathrectangle
+ {\pgfqpoint{\pgf@yb}{\pgf@xc}}%
+ {\pgfqpoint{\pgf@ya}{\pgf@xb}}%
+}
+
+
+% This handler is very similar to \pgfplothandlerlineto, but it
+% produces CONSTANT connected pieces of the form
+%
+% x
+% |
+% x--- |
+% | x----
+% x-|
+%
+% Example:
+%
+% \pgfplothandlerconstantlineto
+% \pgfplotxyfile{mytable}
+\def\pgfplothandlerconstantlineto{%
+ \def\pgf@plotstreamstart{%
+ \global\let\pgf@plotstreampoint=\pgf@plot@const@line@handler%
+ \global\let\pgf@plotstreamspecial=\pgfutil@gobble%
+ \global\let\pgf@plotstreamend=\relax%
+ }%
+}
+\def\pgf@plot@const@line@handler#1{%
+ \pgf@process{#1}%
+ \xdef\pgf@plot@const@line@handler@last{\the\pgf@y}%
+ \pgf@plot@first@action{}%
+ \global\let\pgf@plotstreampoint=\pgf@plot@const@line@handler@@%
+}
+\def\pgf@plot@const@line@handler@@#1{%
+ \pgf@process{#1}%
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ \pgf@yb\pgf@plot@const@line@handler@last\relax
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}%
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}%
+ \xdef\pgf@plot@const@line@handler@last{\the\pgf@ya}%
+}
+
+% A variant of \pgfplothandlerconstantlineto which places its mark on
+% the right line ends.
+%
+% |---x
+% ---x |
+% |--x
+% x
+%
+% Example:
+%
+% \pgfplothandlerconstantlinetomarkright
+% \pgfplotxyfile{mytable}
+\def\pgfplothandlerconstantlinetomarkright{%
+ \def\pgf@plotstreamstart{%
+ \global\let\pgf@plotstreampoint=\pgf@plot@const@line@mark@right@handler%
+ \global\let\pgf@plotstreamspecial=\pgfutil@gobble%
+ \global\let\pgf@plotstreamend=\relax%
+ }%
+}
+\def\pgf@plot@const@line@mark@right@handler#1{%
+ \pgf@process{#1}%
+ \xdef\pgf@plot@const@line@handler@last{\the\pgf@x}%
+ \pgf@plot@first@action{}%
+ \global\let\pgf@plotstreampoint=\pgf@plot@const@line@mark@right@handler@@%
+}
+\def\pgf@plot@const@line@mark@right@handler@@#1{%
+ \pgf@process{#1}%
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ \pgf@yb\pgf@plot@const@line@handler@last\relax
+ \pgfpathlineto{\pgfqpoint{\pgf@yb}{\pgf@ya}}%
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}%
+ \xdef\pgf@plot@const@line@handler@last{\the\pgf@xa}%
+}
+
+% This handler is in fact a variant of \pgfplothandlerconstantlineto,
+% but it does not draw vertical lines. It produces a sequence of
+% line-to and move-to operations such that plot marks are placed at
+% each right end:
+%
+% ---x
+% ---x
+% ---x
+% --x
+%
+% Example:
+%
+% \pgfplothandlerjumpmarkright
+% \pgfplotxyfile{mytable}
+\def\pgfplothandlerjumpmarkright{%
+ \def\pgf@plotstreamstart{%
+ \global\let\pgf@plotstreampoint=\pgf@plot@jumpmarkright@handler%
+ \global\let\pgf@plotstreamspecial=\pgfutil@gobble%
+ \global\let\pgf@plotstreamend=\relax%
+ }%
+}
+\def\pgf@plot@jumpmarkright@handler#1{%
+ \pgf@process{#1}%
+ \xdef\pgf@plot@const@line@handler@last{\the\pgf@x}%
+ \pgf@plot@first@action{}%
+ \global\let\pgf@plotstreampoint=\pgf@plot@jumpmarkright@handler@@%
+}
+\def\pgf@plot@jumpmarkright@handler@@#1{%
+ \pgf@process{#1}%
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ \pgf@yb\pgf@plot@const@line@handler@last\relax
+ \pgfpathmoveto{\pgfqpoint{\pgf@yb}{\pgf@ya}}%
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}%
+ \xdef\pgf@plot@const@line@handler@last{\the\pgf@xa}%
+}
+
+% This handler is in fact a variant of \pgfplothandlerconstantlineto,
+% but it does not draw vertical lines. It produces a sequence of
+% line-to and move-to operations such that plot marks are placed at
+% each left end:
+%
+% x---
+% x---
+% x---
+% x--
+%
+% Example:
+%
+% \pgfplothandlerjumpmarkleft
+% \pgfplotxyfile{mytable}
+\def\pgfplothandlerjumpmarkleft{%
+ \def\pgf@plotstreamstart{%
+ \global\let\pgf@plotstreampoint=\pgf@plot@jumpmarkleft@handler%
+ \global\let\pgf@plotstreamspecial=\pgfutil@gobble%
+ \global\let\pgf@plotstreamend=\relax%
+ }%
+}
+\def\pgf@plot@jumpmarkleft@handler#1{%
+ \pgf@process{#1}%
+ \xdef\pgf@plot@const@line@handler@last{\the\pgf@y}%
+ \pgf@plot@first@action{}%
+ \global\let\pgf@plotstreampoint=\pgf@plot@jumpmarkleft@handler@@%
+}
+\def\pgf@plot@jumpmarkleft@handler@@#1{%
+ \pgf@process{#1}%
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ \pgf@yb\pgf@plot@const@line@handler@last\relax
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}%
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}%
+ \xdef\pgf@plot@const@line@handler@last{\the\pgf@ya}%
+}
@@ -515,6 +921,102 @@
+% This handler turns creates a series of straight line segements
+% between consecutive points, but leaving /pgf/gap around stream point
+% space.
+%
+% Example:
+%
+% \pgfplothandlergaplineto
+% \pgfplotxyfile{mytable}
+
+\pgfkeys{/pgf/gap around stream point/.initial=1.5pt}
+
+\def\pgfplothandlergaplineto{%
+ \def\pgf@plotstreamstart{%
+ \global\let\pgf@plotstreampoint=\pgf@plot@gap@lineto@handler@initial%
+ \global\let\pgf@plotstreamspecial=\pgfutil@gobble%
+ \global\let\pgf@plotstreamend=\relax%
+ }%
+}
+
+\def\pgf@plot@gap@lineto@handler@initial#1{%
+ \pgf@process{#1}%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \xdef\pgf@plot@gap@lineto@last{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}%
+ \global\let\pgf@plotstreampoint=\pgf@plot@gap@lineto@handler%
+}
+
+\def\pgf@plot@gap@lineto@handler#1{%
+ % Ok, compute normalized line vector
+ \pgf@process{#1}%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \xdef\pgf@plot@gap@lineto@next{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}%
+ \pgf@process{\pgfpointnormalised{\pgfpointdiff{\pgf@plot@gap@lineto@last}{\pgf@plot@gap@lineto@next}}}%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgfpathmoveto{\pgfpointadd{\pgfpointscale{\pgfkeysvalueof{/pgf/gap
+ around stream point}}{\pgfqpoint{\pgf@xc}{\pgf@yc}}}{\pgf@plot@gap@lineto@last}}%
+ \pgfpathlineto{\pgfpointadd{\pgfpointscale{\pgfkeysvalueof{/pgf/gap
+ around stream point}}{\pgfqpoint{-\pgf@xc}{-\pgf@yc}}}{\pgf@plot@gap@lineto@next}}%
+ \global\let\pgf@plot@gap@lineto@last=\pgf@plot@gap@lineto@next%
+}
+
+
+
+
+% This handler works like \pgfplothandlergaplineto, only the last
+% point is connected to the first point, creating a closed curve
+% space.
+%
+% Example:
+%
+% \pgfplothandlergapcycle
+% \pgfplotxyfile{mytable}
+
+\def\pgfplothandlergapcycle{%
+ \def\pgf@plotstreamstart{%
+ \global\let\pgf@plotstreampoint=\pgf@plot@gap@cycle@handler@initial%
+ \global\let\pgf@plotstreamspecial=\pgfutil@gobble%
+ \global\let\pgf@plotstreamend=\pgf@plot@gap@cycle@handler@finish%
+ \global\let\pgf@plot@gap@cycle@first=\relax%
+ }%
+}
+
+\def\pgf@plot@gap@cycle@handler@initial#1{%
+ \pgf@process{#1}%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \xdef\pgf@plot@gap@cycle@last{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}%
+ \global\let\pgf@plot@gap@cycle@first=\pgf@plot@gap@cycle@last%
+ \global\let\pgf@plotstreampoint=\pgf@plot@gap@cycle@handler%
+}
+
+\def\pgf@plot@gap@cycle@handler#1{%
+ % Ok, compute normalized line vector
+ \pgf@process{#1}%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \xdef\pgf@plot@gap@cycle@next{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}%
+ \pgf@process{\pgfpointnormalised{\pgfpointdiff{\pgf@plot@gap@cycle@last}{\pgf@plot@gap@cycle@next}}}%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgfpathmoveto{\pgfpointadd{\pgfpointscale{\pgfkeysvalueof{/pgf/gap
+ around stream point}}{\pgfqpoint{\pgf@xc}{\pgf@yc}}}{\pgf@plot@gap@cycle@last}}%
+ \pgfpathlineto{\pgfpointadd{\pgfpointscale{\pgfkeysvalueof{/pgf/gap
+ around stream point}}{\pgfqpoint{-\pgf@xc}{-\pgf@yc}}}{\pgf@plot@gap@cycle@next}}%
+ \global\let\pgf@plot@gap@cycle@last=\pgf@plot@gap@cycle@next%
+}
+
+\def\pgf@plot@gap@cycle@handler@finish{%
+ \ifx\pgf@plot@gap@cycle@first\relax%
+ \else
+ \pgf@plot@gap@cycle@handler{\pgf@plot@gap@cycle@first}%
+ \fi
+}
+
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.code.tex
index e20805d50a1..57df579e3f3 100644
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.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/libraries/pgflibraryplotmarks.code.tex,v 1.5 2007/03/09 17:49:32 tantau Exp $
+\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryplotmarks.code.tex,v 1.12 2010/10/15 07:34:06 ludewich Exp $
% A stroked circle mark
@@ -19,6 +19,32 @@
}
+% A Mercedes-line star
+
+\pgfdeclareplotmark{Mercedes star}
+{%
+ \pgfpathmoveto{\pgfqpointpolar{90}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfpointorigin}
+ \pgfpathmoveto{\pgfqpointpolar{-30}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfpointorigin}
+ \pgfpathmoveto{\pgfqpointpolar{-150}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfpointorigin}
+ \pgfusepathqstroke
+}
+
+\pgfdeclareplotmark{Mercedes star flipped}
+{%
+ \pgfpathmoveto{\pgfqpointpolar{-90}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfpointorigin}
+ \pgfpathmoveto{\pgfqpointpolar{30}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfpointorigin}
+ \pgfpathmoveto{\pgfqpointpolar{150}{\pgfplotmarksize}}
+ \pgfpathlineto{\pgfpointorigin}
+ \pgfusepathqstroke
+}
+
+
+
% A six-pointed star mark
@@ -47,6 +73,19 @@
}
+% An 10-pointed star mark
+
+\pgfdeclareplotmark{10-pointed star}
+{%
+ \pgfpathmoveto{\pgfqpoint{0pt}{-\pgfplotmarksize}}\pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}
+ \pgfpathmoveto{\pgfqpointpolar{18}{-\pgfplotmarksize}}\pgfpathlineto{\pgfqpointpolar{18}{\pgfplotmarksize}}
+ \pgfpathmoveto{\pgfqpointpolar{-54}{-\pgfplotmarksize}}\pgfpathlineto{\pgfqpointpolar{-54}{\pgfplotmarksize}}
+ \pgfpathmoveto{\pgfqpointpolar{234}{-\pgfplotmarksize}}\pgfpathlineto{\pgfqpointpolar{234}{\pgfplotmarksize}}
+ \pgfpathmoveto{\pgfqpointpolar{162}{-\pgfplotmarksize}}\pgfpathlineto{\pgfqpointpolar{162}{\pgfplotmarksize}}
+ \pgfusepathqstroke
+}
+
+
% An \oplus mark
\pgfdeclareplotmark{oplus}
@@ -209,4 +248,206 @@
\pgfusepathqfillstroke
}
+\newif\ifpgfmarktext@usetikznode
+\pgfkeys{
+ /pgf/text mark/.initial=p,
+ /pgf/text mark style/.initial=,
+ /pgf/text mark as node/.is if=pgfmarktext@usetikznode,
+ /pgf/text mark as node/.default=true,
+ %
+ % backw. compat: the extra search path confuses the '.unknown'
+ % handlers, so this here is deprecated:
+ /pgf/text mark/style/.style={/pgf/text mark style={#1}},%
+ /pgf/text mark/as node/.style={/pgf/text mark as node=#1},%
+}%
+
+\pgfdeclareplotmark{text}
+{
+ \pgfkeysgetvalue{/pgf/text mark style}\pgfmarktext@style
+ \pgfkeysgetvalue{/pgf/text mark}\pgfmarktext@
+ \ifpgfmarktext@usetikznode
+ \expandafter\node\expandafter[\pgfmarktext@style]{\pgfmarktext@};
+ \else
+ \expandafter\pgftext\expandafter[\pgfmarktext@style]{\pgfmarktext@}%
+ \fi
+}
+
+\pgfkeysdef{/pgf/mark color}{\def\pgf@mark@color{#1}}
+\let\pgf@mark@color\pgfutil@empty
+
+\def\pgf@set@mark@color{%
+ \ifx\pgf@mark@color\pgfutil@empty
+ \pgfsys@color@rgb@fill{1}{1}{1}%
+ \else
+ \pgfsetfillcolor{\pgf@mark@color}%
+ \fi
+}%
+\def\pgf@mark@color@none{none}%
+
+% A half-down-filled and half-up-filled-white diamond-shaped mark
+% (the shape can be rotated by "mark options = {rotate = 90}")
+% created by Tomek
+
+\pgfdeclareplotmark{halfcircle}{%
+ \ifx\pgf@mark@color@none\pgf@mark@color
+ \else
+ \pgfscope
+ \pgf@set@mark@color
+ \pgfpathmoveto
+ {\pgfqpoint{-\pgfplotmarksize}{0pt}}%
+ \pgfpatharc{180}{360}{\pgfplotmarksize}%
+ \pgfusepathqfill
+ \endpgfscope%
+ \fi
+ \pgfpathmoveto
+ {\pgfqpoint{-\pgfplotmarksize}{0pt}}%
+ \pgfpathlineto
+ {\pgfqpoint{\pgfplotmarksize}{0pt}}%
+ \pgfpathcircle{\pgfpointorigin}%
+ {\pgfplotmarksize}%
+ \pgfusepathqstroke
+}
+\pgfdeclareplotmark{halfcircle*}{%
+ \pgfpathmoveto
+ {\pgfqpoint{\pgfplotmarksize}{0pt}}%
+ \pgfpatharc{0}{180}{\pgfplotmarksize}%
+ \pgfpathclose
+ \pgfusepathqfill
+ \ifx\pgf@mark@color@none\pgf@mark@color
+ \else
+ \pgfscope
+ \pgf@set@mark@color
+ \pgfpathmoveto
+ {\pgfqpoint{-\pgfplotmarksize}{0pt}}%
+ \pgfpatharc{180}{360}{\pgfplotmarksize}%
+ \pgfusepathqfill
+ \endpgfscope%
+ \fi
+ \pgfpathcircle{\pgfpointorigin}%
+ {\pgfplotmarksize}%
+ \pgfusepathqstroke
+}
+
+% A half-down-filled and half-up-filled-white diamond-shaped mark
+% created by Magnus Tewes
+
+\pgfdeclareplotmark{halfdiamond*}{%
+ \pgfpathmoveto{\pgfqpoint{-.75\pgfplotmarksize}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}}%
+ \pgfpathlineto{\pgfqpoint{.75\pgfplotmarksize}{0pt}}%
+ \pgfusepathqfill
+ \ifx\pgf@mark@color@none\pgf@mark@color
+ \else
+ \pgfscope
+ \pgf@set@mark@color
+ \pgfpathmoveto{\pgfqpoint{.75\pgfplotmarksize}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}%
+ \pgfpathlineto{\pgfqpoint{-.75\pgfplotmarksize}{0pt}}%
+ \pgfusepathqfill
+ \endpgfscope
+ \fi
+ \pgfpathmoveto{\pgfqpoint{.75\pgfplotmarksize}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}%
+ \pgfpathlineto{\pgfqpoint{-.75\pgfplotmarksize}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}}%
+ \pgfpathclose
+ \pgfusepathqstroke
+}
+
+% A half-down-filled and half-up-filled-white tilted-squared-shaped mark
+% created by Magnus Tewes
+
+\pgfdeclareplotmark{halfsquare*}{%
+ \pgfpathmoveto{\pgfqpoint{-\pgfplotmarksize}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}}%
+ \pgfpathlineto{\pgfqpoint{\pgfplotmarksize}{0pt}}%
+ \pgfusepathqfill
+ \ifx\pgf@mark@color@none\pgf@mark@color
+ \else
+ \pgfscope
+ \pgf@set@mark@color
+ \pgfpathmoveto{\pgfqpoint{\pgfplotmarksize}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}%
+ \pgfpathlineto{\pgfqpoint{-\pgfplotmarksize}{0pt}}%
+ \pgfusepathqfill
+ \endpgfscope
+ \fi
+ \pgfpathmoveto{\pgfqpoint{\pgfplotmarksize}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}%
+ \pgfpathlineto{\pgfqpoint{-\pgfplotmarksize}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}}%
+ \pgfpathclose
+ \pgfusepathqstroke
+}
+
+% A half-right-filled and half-up-filled-white tilted-squared-shaped mark
+% created by Magnus Tewes
+
+\pgfdeclareplotmark{halfsquare right*}{%
+ \pgfpathmoveto{\pgfqpoint{0pt}{-\pgfplotmarksize}}%
+ \pgfpathlineto{\pgfqpoint{\pgfplotmarksize}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}%
+ \pgfusepathqfill
+ \ifx\pgf@mark@color@none\pgf@mark@color
+ \else
+ \pgfscope
+ \pgf@set@mark@color
+ \pgfpathmoveto{\pgfqpoint{0pt}{-\pgfplotmarksize}}%
+ \pgfpathlineto{\pgfqpoint{-\pgfplotmarksize}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}%
+ \pgfusepathqfill
+ \endpgfscope
+ \fi
+ \pgfpathmoveto{\pgfqpoint{\pgfplotmarksize}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}%
+ \pgfpathlineto{\pgfqpoint{-\pgfplotmarksize}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}}%
+ \pgfpathclose
+ \pgfusepathqstroke
+}
+
+% A half-left-filled and half-up-filled-white tilted-squared-shaped mark
+% created by Magnus Tewes
+
+\pgfdeclareplotmark{halfsquare left*}{%
+ \pgfpathmoveto{\pgfqpoint{0pt}{-\pgfplotmarksize}}%
+ \pgfpathlineto{\pgfqpoint{-\pgfplotmarksize}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}%
+ \pgfusepathqfill
+ \ifx\pgf@mark@color@none\pgf@mark@color
+ \else
+ \pgfscope
+ \pgf@set@mark@color
+ \pgfpathmoveto{\pgfqpoint{0pt}{-\pgfplotmarksize}}%
+ \pgfpathlineto{\pgfqpoint{\pgfplotmarksize}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}%
+ \pgfusepathqfill
+ \endpgfscope
+ \fi
+ \pgfpathmoveto{\pgfqpoint{\pgfplotmarksize}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{0pt}{\pgfplotmarksize}}%
+ \pgfpathlineto{\pgfqpoint{-\pgfplotmarksize}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}}%
+ \pgfpathclose
+ \pgfusepathqstroke
+}
+
+
+% A stroke-filled heart-shaped mark
+% created by Magnus Tewes
+\pgfdeclareplotmark{heart}{%
+ \pgfpathmoveto{\pgfqpoint{0pt}{-1.75\pgfplotmarksize}}
+ \pgfpathcurveto{\pgfqpoint{0pt}{-1.75\pgfplotmarksize}}{\pgfqpoint{0pt}{-1.66\pgfplotmarksize}}{\pgfqpoint{-.5\pgfplotmarksize}{-1.165\pgfplotmarksize}}
+ \pgfpathcurveto{\pgfqpoint{-.5\pgfplotmarksize}{-1.165\pgfplotmarksize}}{\pgfqpoint{-\pgfplotmarksize}{-.75\pgfplotmarksize}}{\pgfqpoint{-\pgfplotmarksize}{0pt}}
+ \pgfpathcurveto{\pgfqpoint{-\pgfplotmarksize}{0pt}}{\pgfqpoint{-\pgfplotmarksize}{.5825\pgfplotmarksize}}{\pgfqpoint{-.5825\pgfplotmarksize}{.5825\pgfplotmarksize}}
+ \pgfpathcurveto{\pgfqpoint{-.5825\pgfplotmarksize}{.5825\pgfplotmarksize}}{\pgfqpoint{0pt}{.5825\pgfplotmarksize}}{\pgfqpoint{0pt}{0pt}}
+ \pgfpathcurveto{\pgfqpoint{0pt}{0pt}}{\pgfqpoint{0pt}{.5825\pgfplotmarksize}}{\pgfqpoint{.5825\pgfplotmarksize}{.5825\pgfplotmarksize}}
+ \pgfpathcurveto{\pgfqpoint{.5825\pgfplotmarksize}{.5825\pgfplotmarksize}}{\pgfqpoint{\pgfplotmarksize}{.5825\pgfplotmarksize}}{\pgfqpoint{\pgfplotmarksize}{0pt}}
+ \pgfpathcurveto{\pgfqpoint{\pgfplotmarksize}{0pt}}{\pgfqpoint{\pgfplotmarksize}{-.75\pgfplotmarksize}}{\pgfqpoint{.5\pgfplotmarksize}{-1.165\pgfplotmarksize}}
+ \pgfpathcurveto{\pgfqpoint{.5\pgfplotmarksize}{-1.165\pgfplotmarksize}}{\pgfqpoint{0pt}{-1.66\pgfplotmarksize}}{\pgfqpoint{0pt}{-1.75\pgfplotmarksize}}
+ \pgfpathclose
+ \pgfusepathqfillstroke
+}
+
+
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryprofiler.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryprofiler.code.tex
new file mode 100644
index 00000000000..1043825d60f
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryprofiler.code.tex
@@ -0,0 +1,515 @@
+%--------------------------------------------
+%
+% TeX profiling library
+%
+% Copyright 2010 by Christian Feuersänger.
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%--------------------------------------------
+
+\pgfutil@ifundefined{pdfelapsedtime}{%
+ \PackageError{pgf}{library 'profiler' can only be used with pdftex Rev. >= 1.671 because it needs the \string\pdfelapsedtime\space command}{}%
+ \global\let\pdfelapsedtime=\c@pgf@counta
+}{}
+
+
+% Defines a new profiler entry named `#1'.
+%
+% This allocates a set of counters.
+\def\pgfprofilenew#1{%
+ \pgfutil@ifundefined{c@pgfprofile@elapsedtotal@#1}{%
+ \expandafter\gdef\csname c@pgfprofile@elapsedtotal@#1\endcsname{0}%
+ \expandafter\gdef\csname c@pgfprofile@elapsedself@#1\endcsname{0}%
+ \expandafter\gdef\csname c@pgfprofile@numinvocations@#1\endcsname{0}%
+ \expandafter\gdef\csname c@pgfprofile@subtractforself@#1\endcsname{0}%
+ \expandafter\gdef\csname c@pgfprofile@semaphor@#1\endcsname{0}%
+ \expandafter\gdef\csname c@pgfprofile@elapsed@at@start@#1\endcsname{0}%
+ \pgfprofile@all@registered@list@add{#1}%
+ }{%
+ % it is already defined and registered. Shouldn't hurt, might
+ % even be a good feature.
+ }%
+}%
+
+\def\pgfprofile@TeX@DIALECT@toenvironment@begin#1{\csname #1\endcsname}%
+\def\pgfprofile@TeX@DIALECT@toenvironment@end#1{\csname end#1\endcsname}%
+
+\def\pgfprofile@@to@pgfretval#1{%
+ \expandafter\let\expandafter\pgfretval#1%
+}%
+
+% Defines a new profiler entry for the environment `#1'.
+%
+% This calls \pgfprofilenew and handles the begin/end of the
+% environment automatically.
+%
+% #1 the environment name (a string)
+%
+% Optionally in square brackets: the profiler entry name
+% \pgfprofilenewforenvironment{<environment name>}
+% \pgfprofilenewforenvironment[<profiler entry name>]{<environment name>}
+\def\pgfprofilenewforenvironment{\pgfutil@ifnextchar[{\pgfprofilenewforenvironment@}{\pgfprofilenewforenvironment@[]}}%
+\def\pgfprofilenewforenvironment@[#1]#2{%
+ \expandafter\pgfprofile@@to@pgfretval\pgfprofile@TeX@DIALECT@toenvironment@begin{#2}%
+ \ifx\pgfretval\relax
+ \PackageError{pgf}{\string\pgfprofilenewforenvironment{#2} doesn't work: the environment `#2' is (not yet?) known or not known in this context}{}%
+ \else
+ \expandafter\global\expandafter\let\csname pgfprofile@orig@begin@#2\endcsname=\pgfretval
+ \expandafter\pgfprofile@@to@pgfretval\pgfprofile@TeX@DIALECT@toenvironment@end{#2}%
+ \expandafter\global\expandafter\let\csname pgfprofile@orig@end@#2\endcsname=\pgfretval
+ %
+ \def\pgfprofile@temp{#1}%
+ \ifx\pgfprofile@temp\pgfutil@empty
+ \pgfprofilenewforenvironment@@{\pgfprofileenv #2}{#2}%
+ \else
+ \pgfprofilenewforenvironment@@{#1}{#2}%
+ \fi
+ \fi
+}%
+\def\pgfprofilenewforenvironment@@#1#2{%
+ \pgfprofilenew{#1}%
+ \expandafter\expandafter\expandafter\gdef\pgfprofile@TeX@DIALECT@toenvironment@begin{#2}{%
+ \pgfprofilestart{#1}%
+ \csname pgfprofile@orig@begin@#2\endcsname
+ }%
+ \expandafter\expandafter\expandafter\gdef\pgfprofile@TeX@DIALECT@toenvironment@end{#2}{%
+ \csname pgfprofile@orig@end@#2\endcsname
+ \pgfprofileend{#1}%
+ }%
+}
+
+
+\def\pgfprofilecs{<CS>}%
+\def\pgfprofileenv{<ENV>}%
+
+% Defines a new profiler entry for the control sequence '#1'.
+%
+% This calls \pgfprofilenew and enhances the control sequence with
+% support for timings.
+%
+% #1: the control sequence (with backslash!)
+% #2: the number of arguments (see below).
+%
+% The following commands are supported:
+% - commands which take one (optional) argument in square brackets,
+% - commands which take one (optional) argument in square brackets
+% followed by one optional argument which has to be delimited with
+% curly braces (use an empty argument for '#2' in this case),
+% - commands which take one (optional) argument in square brackets
+% and *exactly* #2 arguments afterwards.
+\def\pgfprofilenewforcommand{\pgfutil@ifnextchar[{\pgfprofilenewforcommand@}{\pgfprofilenewforcommand@[]}}
+\def\pgfprofilenewforcommand@[#1]#2#3{%
+ \def\pgfprofile@temp{#3}%
+ \ifx\pgfprofile@temp\pgfutil@empty
+ \pgfprofilenewforcommandpattern[#1]{#2}{<autocheck>}{}%
+ \else
+ \ifcase#3\relax
+ \pgfprofilenewforcommandpattern[#1]{#2}{}{}%
+ \or
+ \pgfprofilenewforcommandpattern[#1]{#2}{##1}{{##1}}%
+ \or
+ \pgfprofilenewforcommandpattern[#1]{#2}{##1##2}{{##1}{##2}}%
+ \or
+ \pgfprofilenewforcommandpattern[#1]{#2}{##1##2##3}{{##1}{##2}{##3}}%
+ \or
+ \pgfprofilenewforcommandpattern[#1]{#2}{##1##2##3##4}{{##1}{##2}{##3}{##4}}%
+ \or
+ \pgfprofilenewforcommandpattern[#1]{#2}{##1##2##3##4##5}{{##1}{##2}{##3}{##4}{##5}}%
+ \or
+ \pgfprofilenewforcommandpattern[#1]{#2}{##1##2##3##4##5##6}{{##1}{##2}{##3}{##4}{##5}{##6}}%
+ \or
+ \pgfprofilenewforcommandpattern[#1]{#2}{##1##2##3##4##5##6##7}{{##1}{##2}{##3}{##4}{##5}{##6}{##7}}%
+ \else
+ \PackageError{pgf}{library 'profiler' can't replace control sequences with '#3' arguments automatically, sorry.}%
+ \fi
+ \fi
+}%
+
+% \pgfprofilenewforcommandpattern[<profile entry name>]{<\CS>}{<definition pattern>}{<invocation pattern>}
+%
+% example:
+% \pgfprofilenewforcommandpattern{\pgfqkeys}{##1##2}{{##1}{##2}}
+%
+% \def\mymacro##1\to##2\in##3{ .... }
+% \pgfprofilenewforcommandpattern{\mymacro}{##1\to##2\in##3}{{##1}\to{##2}\in{##3}}
+\def\pgfprofilenewforcommandpattern{\pgfutil@ifnextchar[{\pgfprofilenewforcommandpattern@}{\pgfprofilenewforcommandpattern@[]}}
+\def\pgfprofilenewforcommandpattern@[#1]#2#3#4{%
+ \def\pgfprofile@known{1}%
+ \ifx#2\undefined
+ \def\pgfprofile@known{0}%
+ \else
+ \ifx#2\relax
+ \def\pgfprofile@known{0}%
+ \fi
+ \fi
+ \if\pgfprofile@known0%
+ \PackageError{pgf}{\string\pgfprofilenewforcommandpattern{\string#2} doesn't work: the command `\string#2' is (not yet?) known or not known in this context}{}%
+ \else
+ \begingroup
+ \pgfprofile@cs@to@name{#2}%
+ \let\pgfprofilenew@cmdname=\pgfretval
+ %
+ \def\pgfprofile@temp{#1}%
+ \ifx\pgfprofile@temp\pgfutil@empty
+ \edef\pgfprofilenew@profilerentryname{\pgfprofilecs\pgfprofilenew@cmdname}%
+ \else
+ \edef\pgfprofilenew@profilerentryname{#1}%
+ \fi
+ \expandafter\global\expandafter\let\csname pgfprofile@name@for@\pgfprofilenew@cmdname\endcsname=\pgfprofilenew@profilerentryname
+ \pgfprofilenew{\pgfprofilenew@profilerentryname}%
+ \expandafter\gdef\csname b@pgfprofile@show@\pgfprofilenew@profilerentryname\endcsname{0}%
+ %
+ \expandafter\global\expandafter\let\csname pgfprofile@orig@\pgfprofilenew@cmdname\endcsname=#2%
+ \toks0={#3}%
+ \edef\pgfprofile@temp{\the\toks0}%%
+ \def\pgfprofile@tempb{<autocheck>}%
+ \ifx\pgfprofile@temp\pgfprofile@tempb
+ \expandafter\global\expandafter\let\csname pgfprofile@repl@\pgfprofilenew@cmdname\endcsname=\pgfprofileinvokecommand@uptoonearg
+ \else
+ \expandafter\gdef\csname pgfprofile@repl@\pgfprofilenew@cmdname\endcsname#3{%
+ \pgfprofile@invokeorig{#4}%
+ }%
+ \fi
+ \xdef#2{\noexpand\pgfprofileinvokecommand{\pgfprofilenew@cmdname}}%
+ \endgroup
+ \fi
+}%
+
+\def\pgfprofileshowinvocationsfor#1{%
+ \pgfutil@ifundefined{b@pgfprofile@show@#1}{%
+ \PackageError{pgf}{\string\pgfprofileshowinvocationsfor{#1} doesn't work: the argument is no profiler entry}{}%
+ }{%
+ \expandafter\gdef\csname b@pgfprofile@show@#1\endcsname{1}%
+ \expandafter\gdef\csname b@pgfprofile@show@edef@#1\endcsname{0}%
+ }%
+}%
+\def\pgfprofileshowinvocationsexpandedfor#1{%
+ \pgfutil@ifundefined{b@pgfprofile@show@#1}{%
+ \PackageError{pgf}{\string\pgfprofileshowinvocationsfor{#1} doesn't work: the argument is no profiler entry}{}%
+ }{%
+ \expandafter\gdef\csname b@pgfprofile@show@#1\endcsname{1}%
+ \expandafter\gdef\csname b@pgfprofile@show@edef@#1\endcsname{1}%
+ }%
+}%
+
+\def\pgfprofile@no@optional@arg@text{<noarg>}
+\def\pgfprofileinvokecommand#1{%
+ \pgfutil@ifnextchar[{\pgfprofileinvokecommand@{#1}}{\pgfprofileinvokecommand@{#1}[<noarg>]}%
+}%
+\def\pgfprofileinvokecommand@#1[#2]{%
+ \def\pgfprofileinvokecommand@cs{#1}%
+ \def\pgfprofileinvokecommand@optarg{#2}%
+ \edef\pgfprofileinvokecommand@profilerentryname{\csname pgfprofile@name@for@#1\endcsname}%
+ \csname pgfprofile@repl@#1\endcsname%
+}%
+
+% #1 contains ALL arguments, including any braces.
+\def\pgfprofile@invokeorig#1{%
+ % re-insert the control sequence name and the optional argument:
+ % this wasn't possible directly.
+ \begingroup
+ \toks1=\expandafter{\pgfprofileinvokecommand@optarg}%
+ \toks2={#1}%
+ \toks3=\expandafter{\csname pgfprofile@orig@\pgfprofileinvokecommand@cs\endcsname}%
+ %
+ \ifx\pgfprofileinvokecommand@optarg\pgfprofile@no@optional@arg@text
+ % no [] argument after original command:
+ \xdef\pgfprofile@invokeorig@doitfinally{\the\toks3 \the\toks2 }%%
+ \else
+ \xdef\pgfprofile@invokeorig@doitfinally{\the\toks3[\the\toks1]\the\toks2 }%
+ \fi
+ \if1\csname b@pgfprofile@show@\pgfprofileinvokecommand@profilerentryname\endcsname
+ \pgfprofile@orig@show
+ \fi
+ \endgroup
+ \edef\pgfprofile@temp{{\pgfprofileinvokecommand@cs}{\pgfprofileinvokecommand@profilerentryname}}%
+ \expandafter\pgfprofile@invokeorig@\pgfprofile@temp%
+}%
+\def\pgfprofile@orig@show{%
+ \toks4=\expandafter{\csname\pgfprofileinvokecommand@cs\endcsname}%
+ \ifx\pgfprofileinvokecommand@optarg\pgfprofile@no@optional@arg@text
+ \def\pgfprofile@orig@show@args{\the\toks2 }%
+ \else
+ \def\pgfprofile@orig@show@args{[\the\toks1] \the\toks2 }%
+ \fi
+ \if1\csname b@pgfprofile@show@edef@\pgfprofileinvokecommand@profilerentryname\endcsname
+ \edef\pgfprofile@orig@show@args{\pgfprofile@orig@show@args}%
+ \edef\pgfprofile@orig@show@args{\pgfprofile@orig@show@args}%
+ \fi
+ \immediate\write16{pgflibraryprofiler: calling
+ \#\csname c@pgfprofile@numinvocations@\pgfprofileinvokecommand@profilerentryname\endcsname\space
+ (\the\toks4 \pgfprofile@orig@show@args)}%
+}%
+
+% #1: control sequence name (without backslash)
+% #2: profiler entry name
+\def\pgfprofile@invokeorig@#1#2{%
+ % this check should avoid save stack impact
+ \pgfprofileifisrunning{#2}{%
+ \pgfprofile@invokeorig@doitfinally%
+ }{%
+ \pgfprofilestart{#2}%
+ \pgfprofile@invokeorig@doitfinally%
+ \pgfprofileend{#2}%
+ }%
+}%
+
+
+\def\pgfprofileinvokecommand@uptoonearg{%
+ \pgfutil@ifnextchar\bgroup{\pgfprofileinvokecommand@onearg}{\pgfprofileinvokecommand@noarg}%
+}%
+\def\pgfprofileinvokecommand@onearg#1{%
+ \pgfprofile@invokeorig{{#1}}%
+}%
+\def\pgfprofileinvokecommand@noarg{%
+ \pgfprofile@invokeorig{}%
+}%
+
+
+
+% Starts / Resumes timing of the profiler entry named `#1'.
+%
+% The timing will continue until \pgfprofileend{#1} is called.
+%
+% Nested calls of \pgfprofilestart{#1} (with the same argument) will
+% result in the same result as if just one \pgfprofilestart command
+% has been issued.
+\def\pgfprofilestart#1{%
+ \pgfprofileifisrunning{#1}{%
+ \relax
+ }{%
+ \expandafter\xdef\csname c@pgfprofile@elapsed@at@start@#1\endcsname{\the\pdfelapsedtime}%
+ \expandafter\gdef\csname c@pgfprofile@subtractforself@#1\endcsname{0}%
+ \pgfprofile@advance{c@pgfprofile@numinvocations@#1}{1}%
+ \pgfprofilestackpush{#1}%
+ }%
+ \pgfprofile@advance{c@pgfprofile@semaphor@#1}{1}%
+}%
+
+% Stops / Interrupts timing of the profiler entry named `#1'.
+\def\pgfprofileend#1{%
+ \pgfprofile@advance{c@pgfprofile@semaphor@#1}{-1}%
+ \pgfprofileifisrunning{#1}{%
+ \relax
+ }{%
+ \begingroup
+ \c@pgf@countb=\pdfelapsedtime\relax
+ \advance\c@pgf@countb by-\csname c@pgfprofile@elapsed@at@start@#1\endcsname\relax
+ %
+ \pgfprofilestackpop\pgfretval
+ \edef\pgfprofile@temp{#1}%
+ \ifx\pgfprofile@temp\pgfretval
+ \else
+ \immediate\write16{pgflibraryprofiler WARNING: possible error in self time computation...}%
+ \fi
+ \pgfprofilestackifempty{%
+ \relax
+ }{%
+ \pgfprofilestacktop\pgfretval
+ \pgfprofile@advance{c@pgfprofile@subtractforself@\pgfretval}{\c@pgf@countb}%
+ }%
+ %
+ \pgfprofile@advance{c@pgfprofile@elapsedtotal@#1}{\c@pgf@countb}%
+ \advance\c@pgf@countb by-\csname c@pgfprofile@subtractforself@#1\endcsname\relax
+ \pgfprofile@advance{c@pgfprofile@elapsedself@#1}{\c@pgf@countb}%
+ \endgroup
+ }%
+}%
+
+% invokes '#2' if '#1' is currently running and '#3' if not.
+\def\pgfprofileifisrunning#1#2#3{%
+ \ifnum\csname c@pgfprofile@semaphor@#1\endcsname=0 \def\pgfprofileifisrunning@next{#3}\else \def\pgfprofileifisrunning@next{#2}\fi
+ \pgfprofileifisrunning@next
+}%
+
+% Sets the profiler entry whose total time is used to compute all
+% other relative times.
+\def\pgfprofilesetrel#1{\edef\pgfprofile@rel{#1}}%
+
+% Stops all running timings and postprocesses them.
+\def\pgfprofilepostprocess{%
+ \begingroup
+ %
+ % prepare files.
+ \c@pgf@countb=\time
+ \divide\c@pgf@countb by60
+ \c@pgf@countd=\c@pgf@countb
+ \multiply\c@pgf@countd by60
+ \c@pgf@countc=\time
+ \advance\c@pgf@countc by-\c@pgf@countd
+ \immediate\openout\w@pgf@writea=\jobname.profiler.\the\year-\pgfprofiletotwodigitstr\month-\pgfprofiletotwodigitstr\day_\pgfprofiletotwodigitstr\c@pgf@countb h_\pgfprofiletotwodigitstr\c@pgf@countc m.dat
+ \immediate\write\w@pgf@writea{%
+ \pgfprofile@percent relative values are measured against the totaltime of `\pgfprofile@rel'.%
+ }%
+ \immediate\write16{pgflibraryprofiler: relative values are measured against the totaltime of `\pgfprofile@rel'.}%
+ \immediate\write\w@pgf@writea{%
+ profilerentry\pgfprofile@TAB
+ totaltime[s]\pgfprofile@TAB
+ totaltime[percent]\pgfprofile@TAB
+ selftime[s]\pgfprofile@TAB
+ selftime[percent]\pgfprofile@TAB
+ numinvocations\pgfprofile@TAB}%
+ %
+ %
+ % compute main time and prepare computation of relative times:
+ \pgfprofileifisrunning{\pgfprofile@rel}{%
+ \pgfprofileend{\pgfprofile@rel}%
+ }{}%
+ \pgf@xa=\csname c@pgfprofile@elapsedtotal@\pgfprofile@rel\endcsname sp
+ \edef\pgfprofiletotaltime{\pgf@sys@tonumber\pgf@xa}%
+ \pgfmathreciprocal@{\pgfprofiletotaltime}%
+ \let\pgfprofiletotaltime@inv=\pgfmathresult
+ %
+ % postprocess each of them:
+ \pgfprofile@all@registered@list@foreach{%
+ \pgfprofileifisrunning{##1}{%
+ \pgfprofileend{##1}%
+ }{}%
+ \pgfprofilepostprocess@single{##1}%
+ }%
+ \immediate\write\w@pgf@writea{%
+ \pgfprofile@percent\space vim: ts=40 nowrap nostartofline
+ }%
+ \immediate\closeout\w@pgf@writea
+ \endgroup
+}%
+
+{%
+\catcode`\[=1 %
+\catcode`\]=2 %
+\catcode`\{=12 %
+\catcode`\}=12 %
+\catcode`\^^I=12
+\gdef\pgfprofile@lbrace[{]%
+\gdef\pgfprofile@rbrace[}]%
+\gdef\pgfprofile@TAB[^^I]%
+]
+{
+\catcode`\%=12 \gdef\pgfprofile@percent{%}}
+
+\def\pgfprofilepostprocess@single#1{%
+ \begingroup
+ \pgf@xa=\csname c@pgfprofile@elapsedtotal@#1\endcsname sp
+ \pgf@xb=\csname c@pgfprofile@elapsedself@#1\endcsname sp
+ \pgf@ya=\pgfprofiletotaltime@inv\pgf@xa
+ \pgf@yb=\pgfprofiletotaltime@inv\pgf@xb
+ \multiply\pgf@ya by100
+ \multiply\pgf@yb by100
+ \edef\pgfprofilecur@total{\pgf@sys@tonumber\pgf@xa}%
+ \edef\pgfprofilecur@self{\pgf@sys@tonumber\pgf@xb}%
+ \edef\pgfprofilecur@total@rel{\pgf@sys@tonumber\pgf@ya}%
+ \edef\pgfprofilecur@self@rel{\pgf@sys@tonumber\pgf@yb}%
+ \immediate\write16{
+ pgflibraryprofiler(#1)
+ \pgfprofile@lbrace
+ total time=\pgfprofilecur@total sec; (\pgfprofilecur@total@rel\pgfprofile@percent)
+ self time=\pgfprofilecur@self sec; (\pgfprofilecur@self@rel\pgfprofile@percent)
+ invocations=\csname c@pgfprofile@numinvocations@#1\endcsname;
+ \pgfprofile@rbrace
+ }%
+ \immediate\write\w@pgf@writea{%
+ #1\pgfprofile@TAB
+ \pgfprofilecur@total\pgfprofile@TAB
+ \pgfprofilecur@total@rel\pgfprofile@TAB
+ \pgfprofilecur@self\pgfprofile@TAB
+ \pgfprofilecur@self@rel\pgfprofile@TAB
+ \csname c@pgfprofile@numinvocations@#1\endcsname\pgfprofile@TAB
+ }%
+ \endgroup
+}%
+% Invokes '#2' for each element of the command separated list '#1'.
+% the current list element is available as '#1' inside of '#2'.
+\long\def\pgfprofileforeachentryinCSV#1#2{%
+ \long\def\pgfprofileinvokeforeach@@##1{#2}%
+ \pgfprofileforeachentryinCSVisterminated@loop#1,\pgfeov
+}%
+\long\def\pgfprofileforeachentryinCSVisterminated@loop{%
+ \pgfutil@ifnextchar\pgfeov{\pgfutil@gobble}{\pgfprofileforeachentryinCSV@next}%
+}%
+\long\def\pgfprofileforeachentryinCSV@next#1,{%
+ \pgfprofileinvokeforeach@@{#1}%
+ \pgfprofileforeachentryinCSVisterminated@loop%
+}%
+
+\xdef\pgfprofile@all@registered@list{}
+\xdef\pgfprofile@currently@running@list{}
+
+\def\pgfprofile@all@registered@list@add#1{%
+ \ifx\pgfprofile@all@registered@list\pgfutil@empty
+ \xdef\pgfprofile@all@registered@list{#1}%
+ \else
+ \xdef\pgfprofile@all@registered@list{\pgfprofile@all@registered@list,#1}%
+ \fi
+}%
+
+\def\pgfprofile@all@registered@list@foreach#1{%
+ \expandafter\pgfprofileforeachentryinCSV\expandafter{\pgfprofile@all@registered@list}{#1}%
+}%
+
+\def\pgfprofile@advance#1#2{%
+ \begingroup
+ \c@pgf@counta=\csname #1\endcsname\relax
+ \advance\c@pgf@counta by#2\relax
+ \expandafter\xdef\csname #1\endcsname{\the\c@pgf@counta}%
+ \endgroup
+}%
+
+\def\pgfprofile@cs@to@name@#1#2\relax{\def\pgfretval{#2}}
+
+% defines '\pgfretval' to be the control sequences name of '#1' *without* the backslash.
+\def\pgfprofile@cs@to@name#1{%
+ \expandafter\pgfprofile@cs@to@name@\string#1\relax
+}%
+
+\newcount\c@pgfprofile@stacktop
+
+\c@pgfprofile@stacktop=-1
+\def\pgfprofilestackpush#1{%
+ \global\advance\c@pgfprofile@stacktop by1
+ \expandafter\xdef\csname pgfprofile@stack@\the\c@pgfprofile@stacktop\endcsname{#1}%
+}%
+% pops the current stack top to macro #1
+\def\pgfprofilestackpop#1{%
+ \pgfprofilestacktop#1%
+ \global\advance\c@pgfprofile@stacktop by-1
+}%
+% returns the stack's top to macro #1
+\def\pgfprofilestacktop#1{%
+ \expandafter\let\expandafter#1\csname pgfprofile@stack@\the\c@pgfprofile@stacktop\endcsname
+}%
+\def\pgfprofilestackifempty#1#2{%
+ \ifnum\c@pgfprofile@stacktop<0 #1\else #2\fi
+}%
+
+
+\def\pgfprofiletotwodigitstr#1{\ifnum#1<10 0\the#1\else\the#1\fi}
+
+\pgfprofilenew{main job}
+\pgfprofilestart{main job}
+\expandafter\xdef\csname c@pgfprofile@elapsed@at@start@main job\endcsname{0}%
+\pgfprofilesetrel{main job}
+
+\pgfutil@ifundefined{AtEndDocument}{%
+ % no latex. ok.
+}{%
+ % do latex specific stuff:
+ \pgfprofilenew{preamble}
+ \pgfprofilestart{preamble}
+ \expandafter\xdef\csname c@pgfprofile@elapsed@at@start@preamble\endcsname{0}%
+ \AtBeginDocument{\pgfprofileend{preamble}}%
+ %
+ \AtEndDocument{\pgfprofilepostprocess}%
+}%
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshadings.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshadings.code.tex
new file mode 100644
index 00000000000..285f6d21772
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshadings.code.tex
@@ -0,0 +1,409 @@
+% Copyright 2008 by Till Tantau and others
+%
+% 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/libraries/pgflibraryshadings.code.tex,v 1.2 2008/10/29 23:06:34 tantau Exp $
+
+
+%
+% An hsv color wheel. Initial code graciously donated by Ken Starks.
+%
+
+\pgfdeclarefunctionalshading{color wheel white center}
+{\pgfpoint{-50bp}{-50bp}}
+{\pgfpoint{50bp}{50bp}}
+{}
+{ % x y
+ 2 copy % ... x y x y
+ 2 copy abs exch abs add 0.0001 ge
+ {atan 360.0 div} % ... x y heading; heading being in
+ %the interval [0, 1.0]
+ { pop } % silently deal with error: return
+ % arbitrary heading of zero for origin
+ ifelse % because we will use it for 'Hue'
+ 3 1 roll % ... heading x y
+ dup mul % ... heading x y*y
+ exch dup mul % ... heading y*y x*x
+ add sqrt % ... heading ra_pt (distance from origin in points)
+ 25.0 div % scale it means a ra of 25bp
+ dup 1.0 ge % BOOLEAN. ready to clamp to interval [0, 1.0]
+ { pop 1.0 }{} ifelse % We shall use the scaled ra as 'Saturation'
+ %2.5 mul 0.25 sub % now, Ra in [0.1, 0.5] --> Saturation
+ % in [0.0, 1.0]. Saturation varies between the two radii
+ 1.0 % ... H S V ( with 'Value' set to literal constant of 1.0 )
+ % C version to use as model:
+ % H' = H * 6
+ % i = floor(H')
+ % f = H' - i
+ % P = V * (1.0 - S)
+ % Q = V * (1.0 - (S*f))
+ % T = V * (1.0 - (S * (1.0 - f)))
+ 3 2 roll 6.0 mul dup 4 1 roll % H' S V H'
+ floor cvr % H' S V i
+ dup 5 1 roll % i H' S V i
+ 3 index sub neg % i H' S V f
+ 1.0 3 index sub % i H' S V f (1.0 - S )
+ 2 index mul % i H' S V f P
+ 6 1 roll % P i H' S V f
+ dup 3 index mul neg 1.0 add % P i H' S V f ( 1.0 - (f*S))
+ 2 index mul % P i H' S V f Q
+ 7 1 roll % Q P i H' S V f
+ neg 1.0 add % Q P i H' S V (1.0 - f)
+ 2 index mul neg 1.0 add % Q P i H' S V (1.0 - S * (1.0 - f))
+ 1 index mul % Q P i H' S V T
+ 7 2 roll % V T Q P i H' S
+ pop pop % V T Q P i
+ %%%
+ % end of BLOCK B. The rest is just stack manipulation
+ dup 0.5 le % TEST II [ i == 0 ]
+ { % BLOCK C [ take stack to V T P ]
+ pop exch pop
+ }
+ { dup 1.5 le % TEST III [ i == 1 ]
+ { % BLOCK D [ take stack to Q V P ]
+ pop exch 4 1 roll exch pop
+ }
+ { dup 2.5 le % TEST IV [ i == 2 ]
+ { % BLOCK E [ take stack to P V T ]
+ pop 4 1 roll pop
+ }
+ { dup 3.5 le % TEST V [ i == 3 ]
+ { % BLOCK F [ take stack to P Q V ]
+ pop exch 4 2 roll pop
+ }
+ { dup 4.5 le % TEST VI [ i == 4 ]
+ { % BLOCK G [ take stack to T P V ]
+ pop exch pop 3 -1 roll
+ }
+ { % BLOCK H [ take stack to V P Q ]
+ pop 3 1 roll exch pop
+ }
+ ifelse
+ }
+ ifelse % for V
+ }
+ ifelse % for IV
+ }
+ ifelse % for III
+ }
+ ifelse % for II
+}
+
+\pgfdeclarefunctionalshading{color wheel black center}
+{\pgfpoint{-50bp}{-50bp}}
+{\pgfpoint{50bp}{50bp}}
+{}
+{ % x y
+ 2 copy % ... x y x y
+ 2 copy abs exch abs add 0.0001 ge
+ {atan 360.0 div} % ... x y heading; heading being in
+ %the interval [0, 1.0]
+ { pop } % silently deal with error: return
+ % arbitrary heading of zero for origin
+ ifelse % because we will use it for 'Hue'
+ 3 1 roll % ... heading x y
+ dup mul % ... heading x y*y
+ exch dup mul % ... heading y*y x*x
+ add sqrt % ... heading ra_pt (distance from origin in points)
+ 25.0 div % scale it means a ra of 25bp
+ dup 1.0 ge % BOOLEAN. ready to clamp to interval [0, 1.0]
+ { pop 1.0 }{} ifelse % We shall use the scaled ra as 'Saturation'
+ %2.5 mul 0.25 sub % now, Ra in [0.1, 0.5] --> Saturation
+ % in [0.0, 1.0]. Saturation varies between the two radii
+ 1.0 exch % ... H S V ( with 'Value' set to literal constant of 1.0 )
+ % C version to use as model:
+ % H' = H * 6
+ % i = floor(H')
+ % f = H' - i
+ % P = V * (1.0 - S)
+ % Q = V * (1.0 - (S*f))
+ % T = V * (1.0 - (S * (1.0 - f)))
+ 3 2 roll 6.0 mul dup 4 1 roll % H' S V H'
+ floor cvr % H' S V i
+ dup 5 1 roll % i H' S V i
+ 3 index sub neg % i H' S V f
+ 1.0 3 index sub % i H' S V f (1.0 - S )
+ 2 index mul % i H' S V f P
+ 6 1 roll % P i H' S V f
+ dup 3 index mul neg 1.0 add % P i H' S V f ( 1.0 - (f*S))
+ 2 index mul % P i H' S V f Q
+ 7 1 roll % Q P i H' S V f
+ neg 1.0 add % Q P i H' S V (1.0 - f)
+ 2 index mul neg 1.0 add % Q P i H' S V (1.0 - S * (1.0 - f))
+ 1 index mul % Q P i H' S V T
+ 7 2 roll % V T Q P i H' S
+ pop pop % V T Q P i
+ %%%
+ % end of BLOCK B. The rest is just stack manipulation
+ dup 0.5 le % TEST II [ i == 0 ]
+ { % BLOCK C [ take stack to V T P ]
+ pop exch pop
+ }
+ { dup 1.5 le % TEST III [ i == 1 ]
+ { % BLOCK D [ take stack to Q V P ]
+ pop exch 4 1 roll exch pop
+ }
+ { dup 2.5 le % TEST IV [ i == 2 ]
+ { % BLOCK E [ take stack to P V T ]
+ pop 4 1 roll pop
+ }
+ { dup 3.5 le % TEST V [ i == 3 ]
+ { % BLOCK F [ take stack to P Q V ]
+ pop exch 4 2 roll pop
+ }
+ { dup 4.5 le % TEST VI [ i == 4 ]
+ { % BLOCK G [ take stack to T P V ]
+ pop exch pop 3 -1 roll
+ }
+ { % BLOCK H [ take stack to V P Q ]
+ pop 3 1 roll exch pop
+ }
+ ifelse
+ }
+ ifelse % for V
+ }
+ ifelse % for IV
+ }
+ ifelse % for III
+ }
+ ifelse % for II
+}
+
+\pgfdeclarefunctionalshading{color wheel}
+{\pgfpoint{-50bp}{-50bp}}
+{\pgfpoint{50bp}{50bp}}
+{}
+{ % x y
+ 2 copy abs exch abs add 0.0001 ge
+ {atan 360.0 div} % ... x y heading; heading being in
+ %the interval [0, 1.0]
+ { pop } % silently deal with error: return
+ % arbitrary heading of zero for origin
+ ifelse % because we will use it for 'Hue'
+ 1.0 1.0 % ... H S V
+ % C version to use as model:
+ % H' = H * 6
+ % i = floor(H')
+ % f = H' - i
+ % P = V * (1.0 - S)
+ % Q = V * (1.0 - (S*f))
+ % T = V * (1.0 - (S * (1.0 - f)))
+ 3 2 roll 6.0 mul dup 4 1 roll % H' S V H'
+ floor cvr % H' S V i
+ dup 5 1 roll % i H' S V i
+ 3 index sub neg % i H' S V f
+ 1.0 3 index sub % i H' S V f (1.0 - S )
+ 2 index mul % i H' S V f P
+ 6 1 roll % P i H' S V f
+ dup 3 index mul neg 1.0 add % P i H' S V f ( 1.0 - (f*S))
+ 2 index mul % P i H' S V f Q
+ 7 1 roll % Q P i H' S V f
+ neg 1.0 add % Q P i H' S V (1.0 - f)
+ 2 index mul neg 1.0 add % Q P i H' S V (1.0 - S * (1.0 - f))
+ 1 index mul % Q P i H' S V T
+ 7 2 roll % V T Q P i H' S
+ pop pop % V T Q P i
+ %%%
+ % end of BLOCK B. The rest is just stack manipulation
+ dup 0.5 le % TEST II [ i == 0 ]
+ { % BLOCK C [ take stack to V T P ]
+ pop exch pop
+ }
+ { dup 1.5 le % TEST III [ i == 1 ]
+ { % BLOCK D [ take stack to Q V P ]
+ pop exch 4 1 roll exch pop
+ }
+ { dup 2.5 le % TEST IV [ i == 2 ]
+ { % BLOCK E [ take stack to P V T ]
+ pop 4 1 roll pop
+ }
+ { dup 3.5 le % TEST V [ i == 3 ]
+ { % BLOCK F [ take stack to P Q V ]
+ pop exch 4 2 roll pop
+ }
+ { dup 4.5 le % TEST VI [ i == 4 ]
+ { % BLOCK G [ take stack to T P V ]
+ pop exch pop 3 -1 roll
+ }
+ { % BLOCK H [ take stack to V P Q ]
+ pop 3 1 roll exch pop
+ }
+ ifelse
+ }
+ ifelse % for V
+ }
+ ifelse % for IV
+ }
+ ifelse % for III
+ }
+ ifelse % for II
+}
+
+
+%
+% A bilinear interpolation.
+%
+
+\colorlet{lower left}{white}
+\colorlet{lower right}{white}
+\colorlet{upper left}{white}
+\colorlet{upper right}{white}
+
+\pgfdeclarefunctionalshading[lower left,lower right,upper left,upper right]{bilinear interpolation}
+{\pgfpointorigin}
+{\pgfpoint{100bp}{100bp}}
+{
+ \pgfshadecolortorgb{lower left}{\pgf@lib@shadings@ll}\pgfshadecolortorgb{lower right}{\pgf@lib@shadings@lr}
+ \pgfshadecolortorgb{upper right}{\pgf@lib@shadings@ur}\pgfshadecolortorgb{upper left}{\pgf@lib@shadings@ul}
+}{
+ 25 sub 50 div exch 25 sub 50 div 2 copy % Calculate y/100 x/100.
+% 100 div exch 100 div 2 copy % Calculate y/100 x/100.
+ neg 1 add exch neg 1 add % Calculate 1-y/100 1-x/100.
+ 3 1 roll 2 copy exch 5 2 roll 6 copy 6 copy % Set up stack.
+ \pgf@lib@shadings@llred mul exch \pgf@lib@shadings@lrred mul add mul % Process red component.
+ 4 1 roll
+ \pgf@lib@shadings@urred mul exch \pgf@lib@shadings@ulred mul add mul
+ add
+ 13 1 roll
+ \pgf@lib@shadings@llgreen mul exch \pgf@lib@shadings@lrgreen mul add mul % Process green component.
+ 4 1 roll
+ \pgf@lib@shadings@urgreen mul exch \pgf@lib@shadings@ulgreen mul add mul
+ add
+ 7 1 roll
+ \pgf@lib@shadings@llblue mul exch \pgf@lib@shadings@lrblue mul add mul % Process blue component.
+ 4 1 roll
+ \pgf@lib@shadings@urblue mul exch \pgf@lib@shadings@ulblue mul add mul
+ add
+}
+
+
+%
+% A Mandelbrot set shading. Just for fun...
+%
+
+\pgfdeclarefunctionalshading{Mandelbrot set}
+{\pgfpoint{-50bp}{-50bp}}
+{\pgfpoint{50bp}{50bp}}{}
+{
+ 12.5 div exch 12.5 div exch
+ 1 index 1 index
+ % Stack: c_r c_i z_r z_i
+ % Formula: z' = z^2 + c = (z_r + i z_i)^2 + c_r + i c_i
+ % = (z_r^2 - z_i^2 + c_r) + i (2 z_r z_i + c_i)
+ %
+ % First iteration
+ % 1. Compute z_r^2 -z_i^2 + c_r
+ 1 index dup mul % z_r^2
+ 1 index dup mul % z_i^2
+ sub % z_r^2 - z_i^2
+ 4 index add % z_r^2 -z_i^2 + c_r
+ % 2. Compute 2 z_r z_i + c_i
+ 3 1 roll
+ mul 2 mul % 2 z_r z_i
+ 2 index add % 2 z_r z_i + c_i
+ % Second iteration
+ % 1. Compute z_r^2 -z_i^2 + c_r
+ 1 index dup mul % z_r^2
+ 1 index dup mul % z_i^2
+ sub % z_r^2 - z_i^2
+ 4 index add % z_r^2 -z_i^2 + c_r
+ % 2. Compute 2 z_r z_i + c_i
+ 3 1 roll
+ mul 2 mul % 2 z_r z_i
+ 2 index add % 2 z_r z_i + c_i
+ % Third iteration
+ % 1. Compute z_r^2 -z_i^2 + c_r
+ 1 index dup mul % z_r^2
+ 1 index dup mul % z_i^2
+ sub % z_r^2 - z_i^2
+ 4 index add % z_r^2 -z_i^2 + c_r
+ % 2. Compute 2 z_r z_i + c_i
+ 3 1 roll
+ mul 2 mul % 2 z_r z_i
+ 2 index add % 2 z_r z_i + c_i
+ % Fourth iteration
+ % 1. Compute z_r^2 -z_i^2 + c_r
+ 1 index dup mul % z_r^2
+ 1 index dup mul % z_i^2
+ sub % z_r^2 - z_i^2
+ 4 index add % z_r^2 -z_i^2 + c_r
+ % 2. Compute 2 z_r z_i + c_i
+ 3 1 roll
+ mul 2 mul % 2 z_r z_i
+ 2 index add % 2 z_r z_i + c_i
+ % Check for break (to avoid too large numbers)
+ 1 index dup mul 1 index dup mul add
+ 4 lt {
+ % Fifth iteration
+ % 1. Compute z_r^2 -z_i^2 + c_r
+ 1 index dup mul % z_r^2
+ 1 index dup mul % z_i^2
+ sub % z_r^2 - z_i^2
+ 4 index add % z_r^2 -z_i^2 + c_r
+ % 2. Compute 2 z_r z_i + c_i
+ 3 1 roll
+ mul 2 mul % 2 z_r z_i
+ 2 index add % 2 z_r z_i + c_i
+ % Sixth iteration
+ % 1. Compute z_r^2 -z_i^2 + c_r
+ 1 index dup mul % z_r^2
+ 1 index dup mul % z_i^2
+ sub % z_r^2 - z_i^2
+ 4 index add % z_r^2 -z_i^2 + c_r
+ % 2. Compute 2 z_r z_i + c_i
+ 3 1 roll
+ mul 2 mul % 2 z_r z_i
+ 2 index add % 2 z_r z_i + c_i
+ % Seventh iteration
+ % 1. Compute z_r^2 -z_i^2 + c_r
+ 1 index dup mul % z_r^2
+ 1 index dup mul % z_i^2
+ sub % z_r^2 - z_i^2
+ 4 index add % z_r^2 -z_i^2 + c_r
+ % 2. Compute 2 z_r z_i + c_i
+ 3 1 roll
+ mul 2 mul % 2 z_r z_i
+ 2 index add % 2 z_r z_i + c_i
+ % Eighth iteration
+ % 1. Compute z_r^2 -z_i^2 + c_r
+ 1 index dup mul % z_r^2
+ 1 index dup mul % z_i^2
+ sub % z_r^2 - z_i^2
+ 4 index add % z_r^2 -z_i^2 + c_r
+ % 2. Compute 2 z_r z_i + c_i
+ 3 1 roll
+ mul 2 mul % 2 z_r z_i
+ 2 index add % 2 z_r z_i + c_i
+ % Ninth iteration
+ % 1. Compute z_r^2 -z_i^2 + c_r
+ 1 index dup mul % z_r^2
+ 1 index dup mul % z_i^2
+ sub % z_r^2 - z_i^2
+ 4 index add % z_r^2 -z_i^2 + c_r
+ % 2. Compute 2 z_r z_i + c_i
+ 3 1 roll
+ mul 2 mul % 2 z_r z_i
+ 2 index add % 2 z_r z_i + c_i
+ % Tenth iteration
+ % 1. Compute z_r^2 -z_i^2 + c_r
+ 1 index dup mul % z_r^2
+ 1 index dup mul % z_i^2
+ sub % z_r^2 - z_i^2
+ 4 index add % z_r^2 -z_i^2 + c_r
+ % 2. Compute 2 z_r z_i + c_i
+ 3 1 roll
+ mul 2 mul % 2 z_r z_i
+ 2 index add % 2 z_r z_i + c_i
+ } { pop pop 1000.0 1000.0 } ifelse
+ % Compute distance
+ dup mul exch
+ dup mul
+ add sqrt
+ dup 4 1 roll
+ 2 gt { pop pop 2.0 exch div 1.0 exch sub dup dup} {pop pop 0.0 0.0 0.0} ifelse
+}
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.multipart.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.multipart.code.tex
deleted file mode 100644
index 41f0fcfb243..00000000000
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.multipart.code.tex
+++ /dev/null
@@ -1,1097 +0,0 @@
-% Copyright 2007 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.
-
-\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryshapes.multipart.code.tex,v 1.7 2008/01/15 15:41:18 vibrovski Exp $
-
-\newbox\pgfnodepartlowerbox
-
-%
-% A circle that is split in the middle into an upper and a lower part.
-%
-% This node consists of two parts: The upper (main) part is shown in
-% the upper half of the circle. The second part is the (optional)
-% lower part.
-%
-% Parts: text, lower
-
-\pgfdeclareshape{circle split}
-{
- %
- % Node parts
- %
- \nodeparts{text,lower}
-
- %
- % Anchors
- %
- \savedanchor\centerpoint{%
- \pgf@x=.5\wd\pgfnodeparttextbox%
- \pgfmathsetlength{\pgf@y}{\pgfkeysvalueof{/pgf/inner ysep}}%
- \pgf@y=-\pgf@y%
- \advance\pgf@y by-\dp\pgfnodeparttextbox%
- \advance\pgf@y by-.5\pgflinewidth%
- }%
- \savedanchor\loweranchor{%
- \pgf@x=-.5\wd\pgfnodepartlowerbox%
- \advance\pgf@x by.5\wd\pgfnodeparttextbox%
- \pgfmathsetlength{\pgf@y}{\pgfkeysvalueof{/pgf/inner ysep}}%
- \pgf@y=-2\pgf@y%
- \advance\pgf@y by-\ht\pgfnodepartlowerbox%
- \advance\pgf@y by-.5\pgflinewidth%
- \advance\pgf@y by-\dp\pgfnodeparttextbox%
- \advance\pgf@y by-.5\pgflinewidth%
- }
-
- \saveddimen\radius{%
- %
- % Caculate ``height radius''
- %
- %\pgf@ya=.5\ht\pgfnodeparttextbox%
-% \advance\pgf@ya by.5\dp\pgfnodeparttextbox%
-% \advance\pgf@ya by.5\ht\pgfnodepartlowerbox%
-% \advance\pgf@ya by.5\dp\pgfnodepartlowerbox%
-% \advance\pgf@ya by.5\pgflinewidth%
- %
- % MW: Suggested correction for above calculation: Use the tallest box * 2.
- %
- \pgf@ya=.5\ht\pgfnodeparttextbox%
- \advance\pgf@ya by.5\dp\pgfnodeparttextbox%
- \pgf@yb=.5\ht\pgfnodepartlowerbox%
- \advance\pgf@yb by.5\dp\pgfnodepartlowerbox%
- \ifdim\pgf@ya>\pgf@yb\relax%
- \pgf@ya2.0\pgf@ya\relax%
- \else%
- \pgf@ya2.0\pgf@yb\relax%
- \fi%
- \advance\pgf@ya by.5\pgflinewidth%
- \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/inner ysep}}%
- \advance\pgf@ya by2\pgf@yb%
- %
- % Caculate ``width radius''
- %
- \pgf@xa=.5\wd\pgfnodeparttextbox%
- \ifdim\pgf@xa<.5\wd\pgfnodepartlowerbox%
- \pgf@xa=.5\wd\pgfnodepartlowerbox%
- \fi%
- \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/inner xsep}}%
- \advance\pgf@xa by\pgf@xb%
- %
- % Calculate length of radius vector:
- %
- \pgf@process{\pgfpointnormalised{\pgfqpoint{\pgf@xa}{\pgf@ya}}}%
- \ifdim\pgf@x>\pgf@y%
- \c@pgf@counta=\pgf@x%
- \ifnum\c@pgf@counta=0\relax%
- \else%
- \divide\c@pgf@counta by 255\relax%
- \pgf@xa=16\pgf@xa\relax%
- \divide\pgf@xa by\c@pgf@counta%
- \pgf@xa=16\pgf@xa\relax%
- \fi%
- \else%
- \c@pgf@counta=\pgf@y%
- \ifnum\c@pgf@counta=0\relax%
- \else%
- \divide\c@pgf@counta by 255\relax%
- \pgf@ya=16\pgf@ya\relax%
- \divide\pgf@ya by\c@pgf@counta%
- \pgf@xa=16\pgf@ya\relax%
- \fi%
- \fi%
- \pgf@x=\pgf@xa%
- %
- % If necessary, adjust radius so that the size requirements are
- % met:
- %
- \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/minimum width}}%
- \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/minimum height}}%
- \ifdim\pgf@x<.5\pgf@xb%
- \pgf@x=.5\pgf@xb%
- \fi%
- \ifdim\pgf@x<.5\pgf@yb%
- \pgf@x=.5\pgf@yb%
- \fi%
- %
- % Now, add larger of outer sepearations.
- %
- \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
- \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
- \ifdim\pgf@xb<\pgf@yb%
- \advance\pgf@x by\pgf@yb%
- \else%
- \advance\pgf@x by\pgf@xb%
- \fi%
- }
-
- %
- % Anchors
- %
- \inheritanchorborder[from=circle]
- \inheritanchor[from=circle]{north}
- \inheritanchor[from=circle]{north west}
- \inheritanchor[from=circle]{north east}
- \inheritanchor[from=circle]{center}
- \inheritanchor[from=circle]{west}
- \inheritanchor[from=circle]{east}
- \inheritanchor[from=circle]{mid}
- \inheritanchor[from=circle]{mid west}
- \inheritanchor[from=circle]{mid east}
- \inheritanchor[from=circle]{base}
- \inheritanchor[from=circle]{base west}
- \inheritanchor[from=circle]{base east}
- \inheritanchor[from=circle]{south}
- \inheritanchor[from=circle]{south west}
- \inheritanchor[from=circle]{south east}
- \anchor{lower}{\loweranchor}
-
- %
- % Background path
- %
- \inheritbackgroundpath[from=circle]
- \beforebackgroundpath{
- \pgfutil@tempdima=\radius%
- \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
- \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
- \ifdim\pgf@xb<\pgf@yb%
- \advance\pgfutil@tempdima by-\pgf@yb%
- \else%
- \advance\pgfutil@tempdima by-\pgf@xb%
- \fi%
- \advance\pgfutil@tempdima by-.5\pgflinewidth%
- \pgfsetshortenstart{0pt}%
- \pgfsetshortenend{0pt}%
- \pgfsetarrows{-}%
- \pgfpathmoveto{\pgfpointadd{\centerpoint}{\pgfqpoint{-1\pgfutil@tempdima}{0pt}}}%
- \pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfqpoint{\pgfutil@tempdima}{0pt}}}%
- \pgfusepath{stroke}%
- }
-}
-
-
-
-
-
-% (Most) keys for shape rectangle split.
-%
-% /pgf/rectangle split parts : Set the number of rectangles to split into.
-% /pgf/rectangle split part align : Align the for the boxes in each part
-% (also keys for each part)
-% /pgf/rectangle split use custom fill : Use a custom (behindbackground path) fill.
-% /pgf/rectangle split part fill : Custom fill for ech part.
-% (also keys for each part)
-% /pgf/rectangle split draw splits : Draw the line between node parts.
-% /pgf/rectangle split empty part height : Set the default height for empty boxes.
-
-
-\newif\ifpgfrectanglesplitdrawsplits
-\pgfrectanglesplitdrawsplitstrue
-
-\newif\ifpgfrectanglesplitusecustomfill
-\pgfrectanglesplitusecustomfillfalse
-
-\pgfkeys{/pgf/.cd,
- rectangle split parts/.initial=4,
- rectangle split empty part height/.initial=1ex,
- rectangle split draw splits/.is if=pgfrectanglesplitdrawsplits,
- %
- rectangle split part align/.code=\pgf@lib@shapes@rectanglesplit@assigntoparts{#1}{align},
- rectangle split text part align/.initial=center,
- rectangle split second part align/.initial=center,
- rectangle split third part align/.initial=center,
- rectangle split fourth part align/.initial=center,
- %
- rectangle split use custom fill/.is if=pgfrectanglesplitusecustomfill,
- rectangle split part fill/.code={%
- \pgfrectanglesplitusecustomfilltrue%
- \pgf@lib@shapes@rectanglesplit@assigntoparts{#1}{fill}%
- },
- rectangle split text part fill/.initial=white,
- rectangle split second part fill/.initial=white,
- rectangle split third part fill/.initial=white,
- rectangle split fourth part fill/.initial=white
-}
-
-% Internal macros for the rectangle split shape.
-%
-\def\pgf@lib@shapes@rectanglesplit@left{left}
-\def\pgf@lib@shapes@rectanglesplit@right{right}
-
-\def\pgf@lib@shapes@rectanglesplit@assigntoparts#1#2{%
- \expandafter\pgf@lib@shapes@rectanglesplit@@assigntoparts#1,\@@,\@@,\@@,\@@,\pgf@lib#2\pgf@lib}
-\def\pgf@lib@shapes@rectanglesplit@@assigntoparts#1,#2,#3,#4,#5\pgf@lib#6\pgf@lib{%
- \pgfkeys{/pgf/.cd,%
- rectangle split text part #6=#1,
- rectangle split second part #6=#1,
- rectangle split third part #6=#1,
- rectangle split fourth part #6=#1
- }%
- \ifx#2\@@\else%
- \pgfkeys{/pgf/.cd,%
- rectangle split second part #6=#2,
- rectangle split third part #6=#2,
- rectangle split fourth part #6=#2
- }%
- \fi%
- \ifx#3\@@\else%
- \pgfkeys{/pgf/.cd,%
- rectangle split third part #6=#3,
- rectangle split fourth part #6=#3
- }%
- \fi%
- \ifx#4\@@\else%
- \pgfkeys{/pgf/rectangle split fourth part #6=#4}%
- \fi%
-}%
-
-\newbox\pgfnodepartsecondbox
-\newbox\pgfnodepartthirdbox
-\newbox\pgfnodepartfourthbox
-
-\pgfdeclareshape{rectangle split}{%
- \nodeparts{text,second,third,fourth}
- \savedmacro\getrectanglesplitparameters{%
- %
- % If the height+depth of any box is 0pt use the default empty height.
- %
- \pgfmathsetlength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/rectangle split empty part height}}
- \pgf@y\ht\pgfnodeparttextbox%
- \advance\pgf@y\dp\pgfnodeparttextbox%
- \ifdim\pgf@y=0pt\relax%
- \setbox\pgfnodeparttextbox=\hbox{%
- \vrule width0pt height\the\pgfutil@tempdima depth0pt%
- }%
- \fi%
- \pgf@y\ht\pgfnodepartsecondbox%
- \advance\pgf@y\dp\pgfnodepartsecondbox%
- \ifdim\pgf@y=0pt\relax%
- \setbox\pgfnodepartsecondbox=\hbox{%
- \vrule width0pt height\the\pgfutil@tempdima depth0pt%
- }%
- \fi%
- \pgf@y\ht\pgfnodepartthirdbox%
- \advance\pgf@y\dp\pgfnodepartthirdbox%
- \ifdim\pgf@y=0pt\relax%
- \setbox\pgfnodepartthirdbox=\hbox{%
- \vrule width0pt height\the\pgfutil@tempdima depth0pt%
- }%
- \fi%
- \pgf@y\ht\pgfnodepartfourthbox%
- \advance\pgf@y\dp\pgfnodepartfourthbox%
- \ifdim\pgf@y=0pt\relax%
- \setbox\pgfnodepartfourthbox=\hbox{%
- \vrule width0pt height\the\pgfutil@tempdima depth0pt%
- }%
- \fi%
- %
- % Empty boxes (without voiding them) if they are not used.
- %
- \pgfmathtruncatemacro\parts{\pgfkeysvalueof{/pgf/rectangle split parts}}%
- \addtosavedmacro{\parts}%
- \ifnum\parts<2\relax%
- \setbox\pgfnodepartsecondbox=\hbox{}%
- \fi%
- \ifnum\parts<3\relax%
- \setbox\pgfnodepartthirdbox=\hbox{}%
- \fi%
- \ifnum\parts<4\relax%
- \setbox\pgfnodepartfourthbox=\hbox{}%
- \fi%
- %
- % Save the line width.
- %
- \pgfmathsetlength\pgf@x{\pgflinewidth}
- \edef\linewidth{\the\pgf@x}%
- \addtosavedmacro{\linewidth}%
- %
- \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
- \edef\innerysep{\the\pgf@y}%
- %
- \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
- \edef\innerxsep{\the\pgf@x}%
- %
- % Get the widths.
- %
- \pgf@x.5\wd\pgfnodeparttextbox%
- \pgf@xa.5\wd\pgfnodepartsecondbox%
- \pgf@xb.5\wd\pgfnodepartthirdbox%
- \pgf@xc.5\wd\pgfnodepartfourthbox%
- %
- % Find the maximum width%
- %
- \pgfutil@tempdima\pgf@x%
- \ifdim\pgfutil@tempdima<\pgf@xa%
- \pgfutil@tempdima\pgf@xa%
- \fi%
- \ifdim\pgfutil@tempdima<\pgf@xb%
- \pgfutil@tempdima\pgf@xb%
- \fi%
- \ifdim\pgfutil@tempdima<\pgf@xc%
- \pgfutil@tempdima\pgf@xc%
- \fi%
- %
- % Adjust for alignment.
- %
- \edef\pgf@lib@temp{\pgfkeysvalueof{/pgf/rectangle split text part align}}%
- \ifx\pgf@lib@temp\pgf@lib@shapes@rectanglesplit@left%
- \pgf@x-\pgfutil@tempdima%
- \else%
- \ifx\pgf@lib@temp\pgf@lib@shapes@rectanglesplit@right%
- \pgf@x-2.0\pgf@x%
- \advance\pgf@x\pgfutil@tempdima%
- \else%
- \pgf@x-\pgf@x%
- \fi%
- \fi%
- %
- \edef\pgf@lib@temp{\pgfkeysvalueof{/pgf/rectangle split second part align}}%
- \ifx\pgf@lib@temp\pgf@lib@shapes@rectanglesplit@left%
- \pgf@xa-\pgfutil@tempdima%
- \else%
- \ifx\pgf@lib@temp\pgf@lib@shapes@rectanglesplit@right%
- \pgf@xa-2.0\pgf@xa%
- \advance\pgf@xa\pgfutil@tempdima%
- \else%
- \pgf@xa-\pgf@xa%
- \fi%
- \fi%
- %
- \edef\pgf@lib@temp{\pgfkeysvalueof{/pgf/rectangle split third part align}}%
- \ifx\pgf@lib@temp\pgf@lib@shapes@rectanglesplit@left%
- \pgf@xb-\pgfutil@tempdima%
- \else%
- \ifx\pgf@lib@temp\pgf@lib@shapes@rectanglesplit@right%
- \pgf@xb-2.0\pgf@xb%
- \advance\pgf@xb\pgfutil@tempdima%
- \else%
- \pgf@xb-\pgf@xb%
- \fi%
- \fi%
- %
- \edef\pgf@lib@temp{\pgfkeysvalueof{/pgf/rectangle split fourth part align}}%
- \ifx\pgf@lib@temp\pgf@lib@shapes@rectanglesplit@left%
- \pgf@xc-\pgfutil@tempdima%
- \else%
- \ifx\pgf@lib@temp\pgf@lib@shapes@rectanglesplit@right%
- \pgf@xc-2.0\pgf@xc%
- \advance\pgf@xc\pgfutil@tempdima%
- \else%
- \pgf@xc-\pgf@xc%
- \fi%
- \fi%
- %
- % Make relative to x.
- %
- \advance\pgf@xa-\pgf@x%
- \advance\pgf@xb-\pgf@x%
- \advance\pgf@xc-\pgf@x%
- \pgf@x0pt%
- %
- % Find the minimum.
- %
- \pgfutil@tempdimb\pgf@x%
- \ifdim\pgfutil@tempdimb>\pgf@xa%
- \pgfutil@tempdimb\pgf@xa%
- \fi%
- \ifdim\pgfutil@tempdimb>\pgf@xb%
- \pgfutil@tempdimb\pgf@xb%
- \fi%
- \ifdim\pgfutil@tempdimb>\pgf@xc%
- \pgfutil@tempdimb\pgf@xc%
- \fi%
- %
- % Anchor for the text box is (0pt, 0pt)
- %
- \pgfsavepgf@process\textanchor{\pgfqpoint{0pt}{0pt}}%
- %
- % Anchor for second box.
- %
- \pgfsavepgf@process\lowestanchor{\pgfqpoint{0pt}{0pt}}%
- \let\lowestbox\pgfnodeparttextbox%
- \ifnum\parts>1\relax%
- \pgfsavepgf@process\secondanchor{%
- \pgf@x\pgf@xa%
- \pgf@y-\dp\pgfnodeparttextbox%
- \advance\pgf@y-\innerysep\relax%
- \advance\pgf@y-\pgflinewidth%
- \advance\pgf@y-\innerysep\relax%
- \advance\pgf@y-\ht\pgfnodepartsecondbox%
- }%
- \let\lowestanchor\secondanchor%
- \let\lowestbox\pgfnodepartsecondbox%
- \else%
- \let\secondanchor\textanchor%
- \fi%
- %
- % Anchor for third box.
- %
- \ifnum\parts>2\relax%
- \pgfsavepgf@process\thirdanchor{%
- \lowestanchor%
- \pgf@x\pgf@xb%
- \advance\pgf@y-\dp\pgfnodepartsecondbox%
- \advance\pgf@y-\innerysep\relax%
- \advance\pgf@y-\pgflinewidth%
- \advance\pgf@y-\innerysep\relax%
- \advance\pgf@y-\ht\pgfnodepartthirdbox%
- }%
- \let\lowestanchor\thirdanchor%
- \let\lowestbox\pgfnodepartthirdbox%
- \else%
- \let\thirdanchor\secondanchor%
- \fi%
- %
- % Anchor for fourth box.
- %
- \ifnum\parts>3\relax%
- \pgfsavepgf@process\fourthanchor{%
- \lowestanchor%
- \pgf@x\pgf@xc%
- \advance\pgf@y-\dp\lowestbox%
- \advance\pgf@y-\innerysep\relax%
- \advance\pgf@y-\pgflinewidth%
- \advance\pgf@y-\innerysep\relax%
- \advance\pgf@y-\ht\pgfnodepartfourthbox%
- }%
- \let\lowestanchor\fourthanchor%
- \let\lowestbox\pgfnodepartfourthbox%
- \else%
- \let\fourthanchor\thirdanchor%
- \fi%
- %
- \addtosavedmacro{\textanchor}%
- \addtosavedmacro{\secondanchor}%
- \addtosavedmacro{\thirdanchor}%
- \addtosavedmacro{\fourthanchor}%
- %
- % Adjust the boxwidth for minimum width
- %
- \pgfmathaddtolength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/inner xsep}}%
- \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/minimum width}}%
- \ifdim\pgfutil@tempdima<.5\pgf@x%
- \pgfutil@tempdima.5\pgf@x%
- \fi%
- \pgfmathaddtolength\pgfutil@tempdima{-\pgfkeysvalueof{/pgf/inner xsep}}%
- %
- % Get some important points.
- %
- \pgfsavepgf@process\southwest{%
- \lowestanchor%
- \pgf@x\pgfutil@tempdimb%
- \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/inner xsep}}%
- \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
- \pgf@ya\linewidth\relax%
- \advance\pgf@x-.5\pgf@ya%
- \advance\pgf@y-\dp\lowestbox%
- \advance\pgf@y-.5\pgf@ya%
- \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/inner ysep}}%
- \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}%
- }%
- \pgfsavepgf@process\northeast{%
- \pgf@x\pgfutil@tempdimb%
- \advance\pgf@x2.0\pgfutil@tempdima%
- \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
- \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
- \pgf@ya\linewidth\relax%
- \advance\pgf@x.5\pgf@ya%
- \pgf@y\ht\pgfnodeparttextbox%
- \advance\pgf@y.5\pgf@ya%
- \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
- \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
- }%
- \addtosavedmacro{\northeast}%
- \addtosavedmacro{\southwest}%
- \pgfsavepgf@process\centerpoint{%
- \pgfpointadd{\southwest}{%
- \pgfpointdiff{\southwest}{\northeast}%
- \pgf@x.5\pgf@x%
- \pgf@y.5\pgf@y%
- }%
- }%
- \addtosavedmacro{\centerpoint}%
- \pgfsavepgf@process\south{%
- \centerpoint%
- \pgf@xa\pgf@x%
- \southwest%
- \pgf@x\pgf@xa%
- }%
- %
- % Get the split points.
- %
- \let\lastsplit\south%
- \ifnum\parts>1\relax%
- \pgfsavepgf@process\textsplit{%
- \pgf@x\pgfutil@tempdimb%
- \advance\pgf@x\pgfutil@tempdima%
- \pgf@y-\dp\pgfnodeparttextbox%
- \advance\pgf@y-\innerysep%
- \advance\pgf@y-.5\pgflinewidth%
- }%
- \else%
- \let\textsplit\south%
- \fi%
- \addtosavedmacro{\textsplit}%
- \pgfsavepgf@process\textspliteast{%
- \textsplit%
- \pgf@ya\pgf@y%
- \northeast%
- \pgf@y\pgf@ya%
- }%
- \addtosavedmacro{\textspliteast}%
- \pgfsavepgf@process\textsplitwest{%
- \textsplit%
- \pgf@ya\pgf@y%
- \southwest%
- \pgf@y\pgf@ya%
- }%
- \addtosavedmacro{\textsplitwest}%
- \ifnum\parts>2\relax%
- \pgfsavepgf@process\secondsplit{%
- \secondanchor%
- \pgf@x\pgfutil@tempdimb%
- \advance\pgf@x\pgfutil@tempdima%
- \advance\pgf@y-\dp\pgfnodepartsecondbox%
- \advance\pgf@y-\innerysep%
- \advance\pgf@y-.5\pgflinewidth%
- }%
- \else%
- \let\secondsplit\south%
- \fi%
- \addtosavedmacro{\secondsplit}%
- \pgfsavepgf@process\secondspliteast{%
- \secondsplit%
- \pgf@ya\pgf@y%
- \northeast%
- \pgf@y\pgf@ya%
- }%
- \addtosavedmacro{\secondspliteast}%
- \pgfsavepgf@process\secondsplitwest{%
- \secondsplit%
- \pgf@ya\pgf@y%
- \southwest%
- \pgf@y\pgf@ya%
- }%
- \addtosavedmacro{\secondsplitwest}%
- \ifnum\parts>3\relax%
- \pgfsavepgf@process\thirdsplit{%
- \thirdanchor%
- \pgf@x\pgfutil@tempdimb%
- \advance\pgf@x\pgfutil@tempdima%
- \advance\pgf@y-\dp\pgfnodepartthirdbox%
- \advance\pgf@y-\innerysep%
- \advance\pgf@y-.5\pgflinewidth%
- }%
- \let\lastsplit\thirdsplit%
- \else%
- \let\thirdsplit\south%
- \fi%
- \addtosavedmacro{\thirdsplit}%
- \pgfsavepgf@process\thirdspliteast{%
- \thirdsplit%
- \pgf@ya\pgf@y%
- \northeast%
- \pgf@y\pgf@ya%
- }%
- \addtosavedmacro{\thirdspliteast}%
- \pgfsavepgf@process\thirdsplitwest{%
- \thirdsplit%
- \pgf@ya\pgf@y%
- \southwest%
- \pgf@y\pgf@ya%
- }%
- \addtosavedmacro{\thirdsplitwest}%
- }%
- \savedanchor\basepoint{%
- \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}%
- \pgfmathsetlength\pgf@y{+.5\ht\pgfnodeparttextbox}%
- \pgf@y0pt\relax%
- }%
- \savedanchor\midpoint{%
- \pgfmathsetlength\pgf@x{+.5\wd\pgfnodeparttextbox}%
- \pgfmathsetlength\pgf@y{+.5ex}%
- }%
- \anchor{center}{\getrectanglesplitparameters\centerpoint}%
- \anchor{base}{\basepoint}%
- \anchor{mid}{\midpoint}%
- \anchor{second}{\getrectanglesplitparameters\secondanchor}%
- \anchor{third}{\getrectanglesplitparameters\thirdanchor}%
- \anchor{fourth}{\getrectanglesplitparameters\fourthanchor}%
- \anchor{north east}{\getrectanglesplitparameters\northeast}
- \anchor{south west}{\getrectanglesplitparameters\southwest}
- \anchor{south east}{%
- \getrectanglesplitparameters%
- \northeast%
- \pgf@xa\pgf@x%
- \southwest%
- \pgf@x\pgf@xa}
- \anchor{north west}{%
- \getrectanglesplitparameters%
- \northeast%
- \pgf@ya\pgf@y%
- \southwest%
- \pgf@y\pgf@ya}
- \anchor{south}{%
- \getrectanglesplitparameters%
- \centerpoint%
- \pgf@xa\pgf@x%
- \southwest%
- \pgf@x\pgf@xa}
- \anchor{north}{%
- \getrectanglesplitparameters%
- \centerpoint%
- \pgf@xa\pgf@x%
- \northeast%
- \pgf@x\pgf@xa}
- \anchor{west}{%
- \getrectanglesplitparameters%
- \centerpoint%
- \pgf@ya\pgf@y%
- \southwest%
- \pgf@y\pgf@ya}
- \anchor{east}{%
- \getrectanglesplitparameters%
- \centerpoint%
- \pgf@ya\pgf@y%
- \northeast%
- \pgf@y\pgf@ya}
- \anchor{text split}{\getrectanglesplitparameters\textsplit}
- \anchor{text split east}{\getrectanglesplitparameters\textspliteast}
- \anchor{text split west}{\getrectanglesplitparameters\textsplitwest}
- \anchor{second split}{\getrectanglesplitparameters\secondsplit}
- \anchor{second split east}{\getrectanglesplitparameters\secondspliteast}
- \anchor{second split west}{\getrectanglesplitparameters\secondsplitwest}
- \anchor{third split}{\getrectanglesplitparameters\thirdsplit}
- \anchor{third split east}{\getrectanglesplitparameters\thirdspliteast}
- \anchor{third split west}{\getrectanglesplitparameters\thirdsplitwest}
- \anchor{text east}{%
- \getrectanglesplitparameters%
- \ifnum\parts>1\relax%
- \textsplit%
- \pgf@ya\pgf@y
- \northeast%
- \advance\pgf@y\pgf@ya%
- \pgf@y.5\pgf@y%
- \pgf@ya\linewidth\relax%
- \advance\pgf@y-.25\pgf@ya%
- \else%
- \centerpoint%
- \pgf@ya\pgf@y%
- \northeast%
- \pgf@y\pgf@ya%
- \fi%
- }
- \anchor{text west}{%
- \getrectanglesplitparameters%
- \ifnum\parts>1\relax%
- \textsplit%
- \pgf@ya\pgf@y
- \southwest%
- \pgf@xa\pgf@x%
- \northeast%
- \pgf@x\pgf@xa%
- \advance\pgf@y\pgf@ya%
- \pgf@y.5\pgf@y%
- \pgf@ya\linewidth\relax%
- \advance\pgf@y-.25\pgf@ya%
- \else%
- \centerpoint%
- \pgf@ya\pgf@y%
- \southwest%
- \pgf@y\pgf@ya%
- \fi%
- }
- \anchor{second east}{%
- \getrectanglesplitparameters%
- \ifnum\parts>1\relax%
- \northeast%
- \pgf@xa\pgf@x%
- \secondsplit%
- \pgf@ya\pgf@y
- \textsplit%
- \advance\pgf@y\pgf@ya%
- \pgf@y.5\pgf@y%
- \pgf@x\pgf@xa%
- \else%
- \southwest%
- \pgf@ya\pgf@y%
- \northeast%
- \pgf@y\pgf@ya%
- \fi%
- }
- \anchor{second west}{%
- \getrectanglesplitparameters%
- \ifnum\parts>1\relax%
- \southwest%
- \pgf@xa\pgf@x%
- \secondsplit%
- \pgf@ya\pgf@y
- \textsplit%
- \advance\pgf@y\pgf@ya%
- \pgf@y.5\pgf@y%
- \pgf@x\pgf@xa%
- \else%
- \southwest%
- \fi%
- }
- \anchor{third east}{%
- \getrectanglesplitparameters%
- \ifnum\parts>2\relax%
- \northeast%
- \pgf@xa\pgf@x%
- \thirdsplit%
- \pgf@ya\pgf@y
- \secondsplit%
- \advance\pgf@y\pgf@ya%
- \pgf@y.5\pgf@y%
- \pgf@x\pgf@xa%
- \else%
- \southwest%
- \pgf@ya\pgf@y%
- \northeast%
- \pgf@y\pgf@ya%
- \fi%
- }
- \anchor{third west}{%
- \getrectanglesplitparameters%
- \ifnum\parts>2\relax%
- \southwest%
- \pgf@xa\pgf@x%
- \thirdsplit%
- \pgf@ya\pgf@y
- \secondsplit%
- \advance\pgf@y\pgf@ya%
- \pgf@y.5\pgf@y%
- \pgf@x\pgf@xa%
- \else%
- \southwest
- \fi%
- }
- \anchor{fourth east}{%
- \getrectanglesplitparameters%
- \ifnum\parts>3\relax%
- \northeast%
- \pgf@xa\pgf@x%
- \southwest%
- \pgf@ya\linewidth\relax%
- \pgf@ya.5\pgf@ya%
- \advance\pgf@ya\pgf@y%
- \thirdsplit%
- \advance\pgf@y\pgf@ya%
- \pgf@y.5\pgf@y%
- \pgf@x\pgf@xa%
- \else%
- \northeast%
- \pgf@xa\pgf@x%
- \southwest%
- \pgf@x\pgf@xa%
- \fi%
- }
- \anchor{fourth west}{%
- \getrectanglesplitparameters%
- \ifnum\parts>3\relax%
- \southwest%
- \pgf@xa\pgf@x%
- \pgf@ya\linewidth\relax%
- \pgf@ya.5\pgf@ya%
- \advance\pgf@ya\pgf@y%
- \thirdsplit%
- \advance\pgf@y\pgf@ya%
- \pgf@y.5\pgf@y%
- \pgf@x\pgf@xa%
- \else%
- \southwest%
- \fi%
- }
- \backgroundpath{%
- \getrectanglesplitparameters%
- %
- % Remove outer sep.
- %
- \pgfsavepgf@process\southwest{%
- \southwest%
- \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
- \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
- }%
- \pgfsavepgf@process\northeast{%
- \northeast%
- \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
- \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}%
- }%
- \pgfsavepgf@process\textsplit{%
- \textsplit%
- \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
- }%
- \pgfsavepgf@process\secondsplit{%
- \secondsplit%
- \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
- }%
- \pgfsavepgf@process\thirdsplit{%
- \thirdsplit%
- \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
- }%
- \pgfpathrectangle{\southwest}{\pgfpointdiff{\southwest}{\northeast}}%
- {%
- \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}%
- \ifnum\parts>1\relax%
- \pgfpathmoveto{\textsplit\pgf@ya\pgf@y\southwest\pgf@y\pgf@ya}%
- \pgfpathlineto{\textsplit\pgf@ya\pgf@y\northeast\pgf@y\pgf@ya}%
- \fi%
- \ifnum\parts>2\relax%
- \pgfpathmoveto{\secondsplit\pgf@ya\pgf@y\southwest\pgf@y\pgf@ya}%
- \pgfpathlineto{\secondsplit\pgf@ya\pgf@y\northeast\pgf@y\pgf@ya}%
- \fi%
- \ifnum\parts>3\relax%
- \pgfpathmoveto{\thirdsplit\pgf@ya\pgf@y\southwest\pgf@y\pgf@ya}%
- \pgfpathlineto{\thirdsplit\pgf@ya\pgf@y\northeast\pgf@y\pgf@ya}%
- \fi%
- }%
- }
- \behindbackgroundpath{%
- \ifpgfrectanglesplitusecustomfill%
- %
- % Remove outer sep.
- %
- \getrectanglesplitparameters%
- \pgfsavepgf@process\southwest{%
- \southwest%
- \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
- \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
- }%
- \pgfsavepgf@process\northeast{%
- \northeast%
- \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
- \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}%
- }%
- \pgfsavepgf@process\textspliteast{%
- \textspliteast%
- \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
- }%
- \pgfsavepgf@process\textsplitwest{%
- \textsplitwest%
- \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
- }%
- \pgfsavepgf@process\secondspliteast{%
- \secondspliteast%
- \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
- }%
- \pgfsavepgf@process\secondsplitwest{%
- \secondsplitwest%
- \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
- }%
- \pgfsavepgf@process\thirdspliteast{%
- \thirdspliteast%
- \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
- }%
- \pgfsavepgf@process\thirdsplitwest{%
- \thirdsplitwest%
- \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
- }%
- %
- % Always fill the text box.
- %
- \pgfpathmoveto{\textsplitwest}%
- \pgfpathlineto{\northeast\pgf@ya\pgf@y\southwest\pgf@y\pgf@ya}%
- \pgfpathlineto{\northeast}%
- \ifnum\parts>1\relax%
- \bgroup%
- \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}%
- \fi%
- \pgfpathlineto{\textspliteast}%
- \pgfpathclose%
- \ifnum\parts>1\relax%
- \egroup%
- \fi%
- \pgfsetfillcolor{\pgfkeysvalueof{/pgf/rectangle split text part fill}}%
- \pgfusepath{fill}%
- %
- % Second box.
- %
- \ifnum\parts>1\relax%
- \bgroup%
- \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}%
- \pgfpathmoveto{\textsplitwest}%
- \pgfpathlineto{\textspliteast}%
- \ifnum\parts=2\relax%
- \egroup%
- \fi%
- \pgfpathlineto{\secondspliteast}%
- \pgfpathlineto{\secondsplitwest}%
- \ifnum\parts=2\relax%
- \bgroup%
- \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}%
- \fi%
- \pgfpathclose%
- \pgfsetfillcolor{\pgfkeysvalueof{/pgf/rectangle split second part fill}}%
- \pgfusepath{fill}%
- \egroup%
- \fi%
- %
- % Third box.
- %
- \ifnum\parts>2\relax%
- \bgroup%
- \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}%
- \pgfpathmoveto{\secondsplitwest}%
- \pgfpathlineto{\secondspliteast}%
- \ifnum\parts=3\relax%
- \egroup%
- \fi%
- \pgfpathlineto{\thirdspliteast}%
- \pgfpathlineto{\thirdsplitwest}%
- \ifnum\parts=3\relax%
- \bgroup%
- \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}%
- \fi%
- \pgfpathclose%
- \pgfsetfillcolor{\pgfkeysvalueof{/pgf/rectangle split third part fill}}%
- \pgfusepath{fill}%
- \egroup%
- \fi%
- %
- % And the fourth box.
- %
- \ifnum\parts>3\relax%
- \pgfpathmoveto{\thirdsplitwest}%
- \pgfpathlineto{\southwest}%
- \pgfpathlineto{\southwest\pgf@ya\pgf@y\northeast\pgf@y\pgf@ya}%
- \bgroup%
- \pgfsetcornersarced{\pgfqpoint{0pt}{0pt}}%
- \pgfpathlineto{\thirdspliteast}%
- \pgfpathclose%
- \egroup%
- \pgfsetfillcolor{\pgfkeysvalueof{/pgf/rectangle split fourth part fill}}%
- \pgfusepath{fill}%
- \fi%
- \fi%
- }
- \anchorborder{%
- \pgfutil@tempdima\pgf@x%
- \pgfutil@tempdimb\pgf@y%
- \getrectanglesplitparameters%
- \pgfpointdiff{\southwest}{\northeast}%
- \pgf@x.5\pgf@x%
- \pgf@y.5\pgf@y%
- \edef\pgf@marshall{%
- \noexpand\pgfpointborderrectangle{%
- \noexpand\pgfqpoint{\the\pgfutil@tempdima}{\the\pgfutil@tempdimb}%
- }%
- {%
- \noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}%
- }%
- }%
- \pgf@marshall%
- \pgf@xa\pgf@x%
- \pgf@ya\pgf@y%
- \centerpoint%
- \advance\pgf@x\pgf@xa%
- \advance\pgf@y\pgf@ya%
- }%
-}
-
-
-% Shape: ellipse split.
-%
-\pgfdeclareshape{ellipse split}{%
- \nodeparts{text,lower}
- \savedanchor\radii{%
- \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
- \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
- \pgf@y2.0\pgf@y%
- \advance\pgf@y.5\pgflinewidth%
- \pgf@xa.5\wd\pgfnodeparttextbox%
- \pgf@xb.5\wd\pgfnodepartlowerbox%
- \advance\pgf@xa\pgf@x%
- \advance\pgf@xb\pgf@x%
- \pgf@ya\ht\pgfnodeparttextbox%
- \advance\pgf@ya\dp\pgfnodeparttextbox%
- \pgf@yb\ht\pgfnodepartlowerbox%
- \advance\pgf@yb\dp\pgfnodepartlowerbox%
- \advance\pgf@ya\pgf@y%
- \advance\pgf@yb\pgf@y%
- \ifdim\pgf@xa>\pgf@xb%
- \pgf@x1.414213\pgf@xa%
- \else%
- \pgf@x1.414213\pgf@xb%
- \fi%
- \ifdim\pgf@ya>\pgf@yb%
- \pgf@y1.414213\pgf@ya%
- \else%
- \pgf@y1.414213\pgf@yb%
- \fi%
- \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
- \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
- \ifdim\pgf@x<.5\pgf@xa%
- \pgf@x.5\pgf@xa%
- \fi%
- \ifdim\pgf@y<.5\pgf@ya%
- \pgf@y.5\pgf@ya%
- \fi%
- \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
- \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
- }
- \savedanchor\lower{%
- \pgf@x-.5\wd\pgfnodepartlowerbox%
- \advance\pgf@x.5\wd\pgfnodeparttextbox%
- \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
- \pgf@y-2.0\pgf@y%
- \advance\pgf@y-\pgflinewidth%
- \advance\pgf@y-\dp\pgfnodeparttextbox%
- \advance\pgf@y-\ht\pgfnodepartlowerbox%
- }
- \savedanchor\centerpoint{%
- \pgf@x.5\wd\pgfnodeparttextbox%
- \pgfmathsetlength\pgf@y{-\pgfkeysvalueof{/pgf/inner ysep}}%
- \advance\pgf@y-\dp\pgfnodeparttextbox%
- \advance\pgf@y-.5\pgflinewidth%
- }%
- \savedanchor\basepoint{%
- \pgf@x.5\wd\pgfnodeparttextbox%
- \pgf@y0pt\relax%
- }%
- \savedanchor\midpoint{%
- \pgf@x.5\wd\pgfnodeparttextbox%
- \pgfmathsetlength\pgf@y{.5ex}%
- }%
- \anchor{center}{\centerpoint}
- \anchor{lower}{\lower}
- \anchor{mid}{\midpoint}
- \anchor{mid east}{\radii\pgf@xa\pgf@x\midpoint\advance\pgf@x\pgf@xa}
- \anchor{mid west}{\radii\pgf@xa\pgf@x\midpoint\advance\pgf@x-\pgf@xa}
- \anchor{base}{\basepoint}
- \anchor{base east}{\radii\pgf@xa\pgf@x\basepoint\advance\pgf@x\pgf@xa}
- \anchor{base west}{\radii\pgf@xa\pgf@x\basepoint\advance\pgf@x-\pgf@xa}
- \anchor{north}{\pgfpointadd{\centerpoint}{\radii\pgf@x0pt}}%
- \anchor{south}{\pgfpointadd{\centerpoint}{\radii\pgf@x0pt\pgf@y-\pgf@y}}%
- \anchor{east}{\pgfpointadd{\centerpoint}{\radii\pgf@y0pt}}%
- \anchor{west}{\pgfpointadd{\centerpoint}{\radii\pgf@x-\pgf@x\pgf@y0pt}}%
- \anchor{north west}{\pgfpointadd{\centerpoint}{\radii\pgf@x-0.707106\pgf@x\pgf@y0.707106\pgf@y}}%
- \anchor{south west}{\pgfpointadd{\centerpoint}{\radii\pgf@x-0.707106\pgf@x\pgf@y-0.707106\pgf@y}}%
- \anchor{north east}{\pgfpointadd{\centerpoint}{\radii\pgf@x0.707106\pgf@x\pgf@y0.707106\pgf@y}}%
- \anchor{south east}{\pgfpointadd{\centerpoint}{\radii\pgf@x0.707106\pgf@x\pgf@y-0.707106\pgf@y}}%
- \backgroundpath{%
- \radii%
- \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
- \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}%
- \pgfutil@tempdima\pgf@x%
- \pgfutil@tempdimb\pgf@y%
- \pgfpathellipse{\centerpoint}{\pgfqpoint{\the\pgfutil@tempdima}{0pt}}{\pgfqpoint{0pt}{\the\pgfutil@tempdimb}}%
- \pgfpathmoveto{\centerpoint\advance\pgf@x-\pgfutil@tempdima}%
- \pgfpathlineto{\centerpoint\advance\pgf@x\pgfutil@tempdima}%
- }
- \anchorborder{%
- \pgfextract@process\externalpoint{}%
- \radii%
- \edef\pgf@marshal{%
- \noexpand\pgfpointadd{\noexpand\pgfpointborderellipse{\noexpand\externalpoint}%
- {\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}}{\noexpand\centerpoint}%
- }%
- \pgf@marshal%
- }%
-}
-
-\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysvg.path.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysvg.path.code.tex
new file mode 100644
index 00000000000..16d1b2eab0e
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysvg.path.code.tex
@@ -0,0 +1,681 @@
+% 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/libraries/pgflibrarysvg.path.code.tex,v 1.6 2009/01/24 17:07:14 tantau Exp $
+
+
+\usepgfmodule{parser}
+
+
+
+
+% Scan an SVG-Path
+%
+% #1 = the path
+%
+% Description:
+%
+% This command takes a path in the compressed SVG-syntax. It then
+% issues a sequences of appropriate \pgfpath commands for this
+% path. For a description of the compressed svg path syntax, see a
+% book on svg.
+%
+% The notion of a pixel used by svg makes no sense in pgf (actually
+% it does not really make sense in svg either, but never mind), and
+% instead of pixels "pt" is used as the basic unit. Use coordinate
+% transformation to change this.
+%
+% Example:
+%
+% \pgfpathsvg{M10 20 L 30-20 0 1}
+%
+% % this has the same effect as
+%
+% \pgfpathmoveto{\pgfpoint{10pt}{20pt}}
+% \pgfpathlineto{\pgfpint{30pt}{-20pt}}
+% \pgfpathlineto{\pgfpint{0pt}{1pt}}
+%
+
+\def\pgfpathsvg#1{%
+ \let\pgf@lib@svg@finish@prev\relax%
+ {%
+ \pgftransforminvert%
+ \pgf@process{\pgfpointtransformed{\pgfqpoint{\pgf@path@lastx}{\pgf@path@lasty}}}
+ }
+ \pgf@lib@svg@last@x\pgf@x%
+ \pgf@lib@svg@last@y\pgf@y%
+ \let\pgf@lib@svg@num=\pgfutil@empty%
+ \pgfparserparse{svgpath}#1"%
+}
+
+
+
+\newdimen\pgf@lib@svg@last@x
+\newdimen\pgf@lib@svg@last@y
+\newdimen\pgf@lib@svg@last@c@x
+\newdimen\pgf@lib@svg@last@c@y
+
+\newcount\pgf@lib@svg@count
+\newcount\pgf@lib@svg@max@num
+
+\newif\pgf@lib@svg@relative
+
+
+
+% For the smooth commands (S, s, T, t) we need to keep track of the
+% previous control points. This is done in the following two
+% variables. If they are empty, there was no previous control point of
+% the desired kind, in which case the specification prescribes that
+% the start point is used.
+
+\def\pgf@lib@svg@clear@bezier@quad{
+ \let\pgf@lib@svg@bezier@last=\pgfutil@empty
+ \let\pgf@lib@svg@quad@last=\pgfutil@empty
+}
+\pgf@lib@svg@clear@bezier@quad
+
+%
+% Here comes the DFA:
+%
+
+% Handle a moveto:
+
+\pgfparserdef{svgpath}{all}{the letter M}
+{
+ \pgf@lib@svg@finish@prev
+ \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@moveto}
+}
+
+\def\pgf@lib@svg@moveto{%
+ \pgf@lib@svg@clear@bezier@quad%
+ \pgf@lib@svg@last@x=\pgf@lib@svg@get@num{0}pt%
+ \pgf@lib@svg@last@y=\pgf@lib@svg@get@num{1}pt%
+ \pgfpathmoveto{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}%
+ \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@lineto}
+}
+
+
+% Handle a relative moveto:
+
+\pgfparserdef{svgpath}{all}{the letter m}
+{
+ \pgf@lib@svg@finish@prev
+ \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@moveto@rel}
+}
+
+\def\pgf@lib@svg@moveto@rel{%
+ \pgf@lib@svg@clear@bezier@quad%
+ \advance\pgf@lib@svg@last@x by\pgf@lib@svg@get@num{0}pt%
+ \advance\pgf@lib@svg@last@y by\pgf@lib@svg@get@num{1}pt%
+ \pgfpathmoveto{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}%
+ \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@lineto@rel}
+}
+
+
+% Handle a lineto:
+
+\pgfparserdef{svgpath}{all}{the letter L}
+{
+ \pgf@lib@svg@finish@prev%
+ \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@lineto}
+}
+
+\def\pgf@lib@svg@lineto{%
+ \ifnum\pgf@lib@svg@count=0\relax% nothing read
+ \else%
+ \pgf@lib@svg@clear@bezier@quad%
+ \pgf@lib@svg@last@x=\pgf@lib@svg@get@num{0}pt%
+ \pgf@lib@svg@last@y=\pgf@lib@svg@get@num{1}pt%
+ \pgfpathlineto{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}%
+ \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@lineto}%
+ \fi
+}
+
+
+% Handle a relative lineto:
+
+\pgfparserdef{svgpath}{all}{the letter l}
+{
+ \pgf@lib@svg@finish@prev
+ \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@lineto@rel}
+}
+
+\def\pgf@lib@svg@lineto@rel{%
+ \ifnum\pgf@lib@svg@count=0\relax% nothing read
+ \else%
+ \pgf@lib@svg@clear@bezier@quad%
+ \advance\pgf@lib@svg@last@x by\pgf@lib@svg@get@num{0}pt%
+ \advance\pgf@lib@svg@last@y by\pgf@lib@svg@get@num{1}pt%
+ \pgfpathlineto{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}%
+ \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@lineto@rel}%
+ \fi
+}
+
+
+% Handle a closepath:
+
+\pgfparserdef{svgpath}{all}{the letter Z}
+{
+ \pgf@lib@svg@closepath
+}
+
+\pgfparserdef{svgpath}{all}{the letter z}
+{
+ \pgf@lib@svg@closepath
+}
+
+\def\pgf@lib@svg@closepath{
+ \pgf@lib@svg@finish@prev
+ \pgfpathclose
+ \let\pgf@lib@svg@finish@prev=\relax
+ \pgf@lib@svg@clear@bezier@quad%
+ \pgfparserswitch{initial}%
+}
+
+
+
+
+
+% Handle a horizontal lineto:
+
+\pgfparserdef{svgpath}{all}{the letter H}
+{
+ \pgf@lib@svg@finish@prev
+ \pgf@lib@svg@read@nums{1}{\pgf@lib@svg@hlineto}
+}
+
+\def\pgf@lib@svg@hlineto{%
+ \ifnum\pgf@lib@svg@count=0\relax% nothing read
+ \else%
+ \pgf@lib@svg@clear@bezier@quad%
+ \pgf@lib@svg@last@x=\pgf@lib@svg@get@num{0}pt%
+ \pgfpathlineto{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}%
+ \pgf@lib@svg@read@nums{1}{\pgf@lib@svg@hlineto}
+ \fi
+}
+
+\pgfparserdef{svgpath}{all}{the letter h}
+{
+ \pgf@lib@svg@finish@prev
+ \pgf@lib@svg@read@nums{1}{\pgf@lib@svg@hlineto@rel}
+}
+
+\def\pgf@lib@svg@hlineto@rel{%
+ \ifnum\pgf@lib@svg@count=0\relax% nothing read
+ \else%
+ \pgf@lib@svg@clear@bezier@quad%
+ \advance\pgf@lib@svg@last@x by\pgf@lib@svg@get@num{0}pt%
+ \pgfpathlineto{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}%
+ \pgf@lib@svg@read@nums{1}{\pgf@lib@svg@hlineto@rel}
+ \fi
+}
+
+
+% Handle a horizontal lineto:
+
+\pgfparserdef{svgpath}{all}{the letter V}
+{
+ \pgf@lib@svg@finish@prev
+ \pgf@lib@svg@read@nums{1}{\pgf@lib@svg@vlineto}
+}
+
+\def\pgf@lib@svg@vlineto{%
+ \ifnum\pgf@lib@svg@count=0\relax% nothing read
+ \else%
+ \pgf@lib@svg@clear@bezier@quad%
+ \pgf@lib@svg@last@y=\pgf@lib@svg@get@num{0}pt%
+ \pgfpathlineto{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}%
+ \pgf@lib@svg@read@nums{1}{\pgf@lib@svg@vlineto}
+ \fi
+}
+
+\pgfparserdef{svgpath}{all}{the letter v}
+{
+ \pgf@lib@svg@finish@prev
+ \pgf@lib@svg@read@nums{1}{\pgf@lib@svg@vlineto@rel}
+}
+
+\def\pgf@lib@svg@vlineto@rel{%
+ \ifnum\pgf@lib@svg@count=0\relax% nothing read
+ \else%
+ \pgf@lib@svg@clear@bezier@quad%
+ \advance\pgf@lib@svg@last@y by\pgf@lib@svg@get@num{0}pt%
+ \pgfpathlineto{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}%
+ \pgf@lib@svg@read@nums{1}{\pgf@lib@svg@vlineto@rel}
+ \fi
+}
+
+
+
+
+% Handle a Bezier curve:
+
+\pgfparserdef{svgpath}{all}{the letter C}
+{
+ \pgf@lib@svg@finish@prev
+ \pgf@lib@svg@read@nums{6}{\pgf@lib@svg@curveto}
+}
+
+\def\pgf@lib@svg@curveto{%
+ \ifnum\pgf@lib@svg@count=0\relax% nothing read
+ \else%
+ % Clear quadratic last point and save new last control point:
+ \let\pgf@lib@svg@quad@last=\pgfutil@empty%
+ \edef\pgf@lib@svg@bezier@last{%
+ \noexpand\pgfqpoint{\pgf@lib@svg@get@num{2}pt}{\pgf@lib@svg@get@num{3}pt}}%
+ % Draw curve
+ \pgf@lib@svg@last@x=\pgf@lib@svg@get@num{4}pt%
+ \pgf@lib@svg@last@y=\pgf@lib@svg@get@num{5}pt%
+ \pgfpathcurveto
+ {\pgfqpoint{\pgf@lib@svg@get@num{0}pt}{\pgf@lib@svg@get@num{1}pt}}%
+ {\pgfqpoint{\pgf@lib@svg@get@num{2}pt}{\pgf@lib@svg@get@num{3}pt}}%
+ {\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}%
+ % Go on
+ \pgf@lib@svg@read@nums{6}{\pgf@lib@svg@curveto}
+ \fi
+}
+
+
+\pgfparserdef{svgpath}{all}{the letter c}
+{
+ \pgf@lib@svg@finish@prev
+ \pgf@lib@svg@read@nums{6}{\pgf@lib@svg@curveto@rel}
+}
+
+\def\pgf@lib@svg@curveto@rel{%
+ \ifnum\pgf@lib@svg@count=0\relax% nothing read
+ \else%
+ % Clear quadratic last point and save new last control point:
+ \let\pgf@lib@svg@quad@last=\pgfutil@empty%
+ \pgf@process{\pgfpointadd{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}{\pgfqpoint{\pgf@lib@svg@get@num{2}pt}{\pgf@lib@svg@get@num{3}pt}}}
+ \edef\pgf@lib@svg@bezier@last{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ % Draw curve
+ \pgfpathcurveto
+ {\pgfpointadd{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}{\pgfqpoint{\pgf@lib@svg@get@num{0}pt}{\pgf@lib@svg@get@num{1}pt}}}%
+ {\pgfpointadd{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}{\pgfqpoint{\pgf@lib@svg@get@num{2}pt}{\pgf@lib@svg@get@num{3}pt}}}%
+ {\pgfpointadd{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}{\pgfqpoint{\pgf@lib@svg@get@num{4}pt}{\pgf@lib@svg@get@num{5}pt}}}%
+ \advance\pgf@lib@svg@last@x by\pgf@lib@svg@get@num{4}pt%
+ \advance\pgf@lib@svg@last@y by\pgf@lib@svg@get@num{5}pt%
+ \pgf@lib@svg@read@nums{6}{\pgf@lib@svg@curveto@rel}
+ \fi
+}
+
+
+
+
+
+\pgfparserdef{svgpath}{all}{the letter S}
+{
+ \pgf@lib@svg@finish@prev
+ \pgf@lib@svg@read@nums{4}{\pgf@lib@svg@curveto@smooth}
+}
+
+\def\pgf@lib@svg@curveto@smooth{%
+ \ifnum\pgf@lib@svg@count=0\relax% nothing read
+ \else%
+ % Draw curve
+ % Compute first control point
+ \ifx\pgf@lib@svg@bezier@last\pgfutil@empty%
+ \def\pgf@lib@svg@first@cp{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}
+ \else
+ \def\pgf@lib@svg@first@cp{
+ \pgfpointadd
+ {\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}
+ {\pgfpointdiff
+ {\pgf@lib@svg@bezier@last}
+ {\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}
+ }
+ }
+ \fi
+ \pgfpathcurveto
+ {\pgf@lib@svg@first@cp}
+ {\pgfqpoint{\pgf@lib@svg@get@num{0}pt}{\pgf@lib@svg@get@num{1}pt}}%
+ {\pgfqpoint{\pgf@lib@svg@get@num{2}pt}{\pgf@lib@svg@get@num{3}pt}}%
+ % Clear quadratic last point and save new last control point:
+ \let\pgf@lib@svg@quad@last=\pgfutil@empty%
+ \edef\pgf@lib@svg@bezier@last{%
+ \noexpand\pgfqpoint{\pgf@lib@svg@get@num{0}pt}{\pgf@lib@svg@get@num{1}pt}}%
+ % Update
+ \pgf@lib@svg@last@x=\pgf@lib@svg@get@num{2}pt%
+ \pgf@lib@svg@last@y=\pgf@lib@svg@get@num{3}pt%
+ % Go on
+ \pgf@lib@svg@read@nums{4}{\pgf@lib@svg@curveto@smooth}
+ \fi
+}
+
+
+\pgfparserdef{svgpath}{all}{the letter s}
+{
+ \pgf@lib@svg@finish@prev
+ \pgf@lib@svg@read@nums{4}{\pgf@lib@svg@curveto@rel@smooth}
+}
+
+\def\pgf@lib@svg@curveto@rel@smooth{%
+ \ifnum\pgf@lib@svg@count=0\relax% nothing read
+ \else%
+ % Draw curve
+ % Compute first control point
+ \ifx\pgf@lib@svg@bezier@last\pgfutil@empty%
+ \def\pgf@lib@svg@first@cp{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}
+ \else
+ \def\pgf@lib@svg@first@cp{
+ \pgfpointadd
+ {\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}
+ {\pgfpointdiff
+ {\pgf@lib@svg@bezier@last}
+ {\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}
+ }
+ }
+ \fi
+ \pgfpathcurveto
+ {\pgf@lib@svg@first@cp}
+ {\pgfpointadd{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}{\pgfqpoint{\pgf@lib@svg@get@num{0}pt}{\pgf@lib@svg@get@num{1}pt}}}%
+ {\pgfpointadd{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}{\pgfqpoint{\pgf@lib@svg@get@num{2}pt}{\pgf@lib@svg@get@num{3}pt}}}%
+ % Clear quadratic last point and save new last control point:
+ \let\pgf@lib@svg@quad@last=\pgfutil@empty%
+ \pgf@process{\pgfpointadd{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}{\pgfqpoint{\pgf@lib@svg@get@num{2}pt}{\pgf@lib@svg@get@num{3}pt}}}
+ \edef\pgf@lib@svg@bezier@last{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ % update
+ \advance\pgf@lib@svg@last@x by\pgf@lib@svg@get@num{2}pt%
+ \advance\pgf@lib@svg@last@y by\pgf@lib@svg@get@num{3}pt%
+ % Go on
+ \pgf@lib@svg@read@nums{4}{\pgf@lib@svg@curveto@rel@smooth}
+ \fi
+}
+
+
+
+
+% Handle a quadratic curve:
+
+\pgfparserdef{svgpath}{all}{the letter Q}
+{
+ \pgf@lib@svg@finish@prev
+ \pgf@lib@svg@read@nums{4}{\pgf@lib@svg@quad@curveto}
+}
+
+\def\pgf@lib@svg@quad@curveto{%
+ \ifnum\pgf@lib@svg@count=0\relax% nothing read
+ \else%
+ % Clear bezier last point and save new last control point:
+ \let\pgf@lib@svg@bezier@last=\pgfutil@empty%
+ \edef\pgf@lib@svg@quad@last{%
+ \noexpand\pgfqpoint{\pgf@lib@svg@get@num{0}pt}{\pgf@lib@svg@get@num{1}pt}}%
+ % Draw curve
+ \pgf@lib@svg@last@x=\pgf@lib@svg@get@num{2}pt%
+ \pgf@lib@svg@last@y=\pgf@lib@svg@get@num{3}pt%
+ \pgfpathquadraticcurveto
+ {\pgfqpoint{\pgf@lib@svg@get@num{0}pt}{\pgf@lib@svg@get@num{1}pt}}%
+ {\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}%
+ % Go on
+ \pgf@lib@svg@read@nums{4}{\pgf@lib@svg@quad@curveto}
+ \fi
+}
+
+
+\pgfparserdef{svgpath}{all}{the letter q}
+{
+ \pgf@lib@svg@finish@prev
+ \pgf@lib@svg@read@nums{4}{\pgf@lib@svg@quad@curveto@rel}
+}
+
+\def\pgf@lib@svg@quad@curveto@rel{%
+ \ifnum\pgf@lib@svg@count=0\relax% nothing read
+ \else%
+ % Clear quadratic last point and save new last control point:
+ \let\pgf@lib@svg@bezier@last=\pgfutil@empty%
+ \pgf@process{\pgfpointadd{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}{\pgfqpoint{\pgf@lib@svg@get@num{0}pt}{\pgf@lib@svg@get@num{1}pt}}}
+ \edef\pgf@lib@svg@quad@last{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ % Draw curve
+ \pgfpathquadraticcurveto
+ {\pgfpointadd{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}{\pgfqpoint{\pgf@lib@svg@get@num{0}pt}{\pgf@lib@svg@get@num{1}pt}}}%
+ {\pgfpointadd{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}{\pgfqpoint{\pgf@lib@svg@get@num{2}pt}{\pgf@lib@svg@get@num{3}pt}}}%
+ \advance\pgf@lib@svg@last@x by\pgf@lib@svg@get@num{2}pt%
+ \advance\pgf@lib@svg@last@y by\pgf@lib@svg@get@num{3}pt%
+ \pgf@lib@svg@read@nums{4}{\pgf@lib@svg@quad@curveto@rel}
+ \fi
+}
+
+
+
+
+\pgfparserdef{svgpath}{all}{the letter T}
+{
+ \pgf@lib@svg@finish@prev
+ \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@quad@curveto@smooth}
+}
+
+\def\pgf@lib@svg@quad@curveto@smooth{%
+ \ifnum\pgf@lib@svg@count=0\relax% nothing read
+ \else%
+ % Draw curve
+ % Compute first control point
+ \pgf@process{
+ \ifx\pgf@lib@svg@quad@last\pgfutil@empty%
+ \pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}
+ \else
+ \pgfpointadd
+ {\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}
+ {\pgfpointdiff
+ {\pgf@lib@svg@quad@last}
+ {\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}
+ }
+ \fi
+ }
+ \edef\pgf@lib@svg@first@cp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ \pgfpathquadraticcurveto
+ {\pgf@lib@svg@first@cp}
+ {\pgfqpoint{\pgf@lib@svg@get@num{0}pt}{\pgf@lib@svg@get@num{1}pt}}%
+ % Clear quadratic last point and save new last control point:
+ \let\pgf@lib@svg@bezier@last=\pgfutil@empty%
+ \let\pgf@lib@svg@quad@last=\pgf@lib@svg@first@cp%
+ % Update
+ \pgf@lib@svg@last@x=\pgf@lib@svg@get@num{0}pt%
+ \pgf@lib@svg@last@y=\pgf@lib@svg@get@num{1}pt%
+ % Go on
+ \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@quad@curveto@smooth}
+ \fi
+}
+
+
+\pgfparserdef{svgpath}{all}{the letter t}
+{
+ \pgf@lib@svg@finish@prev
+ \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@quad@curveto@rel@smooth}
+}
+
+\def\pgf@lib@svg@quad@curveto@rel@smooth{%
+ \ifnum\pgf@lib@svg@count=0\relax% nothing read
+ \else%
+ % Draw curve
+ % Compute first control point
+ \pgf@process{
+ \ifx\pgf@lib@svg@quad@last\pgfutil@empty%
+ \pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}
+ \else
+ \pgfpointadd
+ {\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}
+ {\pgfpointdiff
+ {\pgf@lib@svg@quad@last}
+ {\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}
+ }
+ \fi
+ }
+ \edef\pgf@lib@svg@first@cp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ \pgfpathquadraticcurveto
+ {\pgf@lib@svg@first@cp}
+ {\pgfpointadd{\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}{\pgfqpoint{\pgf@lib@svg@get@num{0}pt}{\pgf@lib@svg@get@num{1}pt}}}%
+ % Clear quadratic last point and save new last control point:
+ \let\pgf@lib@svg@bezier@last=\pgfutil@empty%
+ \let\pgf@lib@svg@quad@last=\pgf@lib@svg@first@cp%
+ % update
+ \advance\pgf@lib@svg@last@x by\pgf@lib@svg@get@num{0}pt%
+ \advance\pgf@lib@svg@last@y by\pgf@lib@svg@get@num{1}pt%
+ % Go on
+ \pgf@lib@svg@read@nums{2}{\pgf@lib@svg@quad@curveto@rel@smooth}
+ \fi
+}
+
+
+
+% Handle an arcto:
+
+\pgfparserdef{svgpath}{all}{the letter A}
+{
+ \pgf@lib@svg@finish@prev
+ \pgf@lib@svg@read@nums{7}{\pgf@lib@svg@arcto}
+}
+
+\def\pgf@lib@svg@arcto{%
+ \ifnum\pgf@lib@svg@count=0\relax% nothing read
+ \else%
+ % Clear bezier last point and save new last control point:
+ \pgf@lib@svg@clear@bezier@quad%
+ % Draw curve
+ \pgf@lib@svg@last@x=\pgf@lib@svg@get@num{5}pt%
+ \pgf@lib@svg@last@y=\pgf@lib@svg@get@num{6}pt%
+ \pgfpatharcto
+ {\pgf@lib@svg@get@num{0}pt}{\pgf@lib@svg@get@num{1}pt}
+ {\pgf@lib@svg@get@num{2}}
+ {\pgf@lib@svg@get@num{3}}
+ {\pgf@lib@svg@get@num{4}}
+ {\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}%
+ % Go on
+ \pgf@lib@svg@read@nums{7}{\pgf@lib@svg@arcto}
+ \fi
+}
+
+\pgfparserdef{svgpath}{all}{the letter a}
+{
+ \pgf@lib@svg@finish@prev
+ \pgf@lib@svg@read@nums{7}{\pgf@lib@svg@arcto@rel}
+}
+
+\def\pgf@lib@svg@arcto@rel{%
+ \ifnum\pgf@lib@svg@count=0\relax% nothing read
+ \else%
+ % Clear bezier last point and save new last control point:
+ \pgf@lib@svg@clear@bezier@quad%
+ % Draw curve
+ \advance\pgf@lib@svg@last@x by\pgf@lib@svg@get@num{5}pt%
+ \advance\pgf@lib@svg@last@y by\pgf@lib@svg@get@num{6}pt%
+ \pgfpatharcto
+ {\pgf@lib@svg@get@num{0}pt}{\pgf@lib@svg@get@num{1}pt}
+ {\pgf@lib@svg@get@num{2}}
+ {\pgf@lib@svg@get@num{3}}
+ {\pgf@lib@svg@get@num{4}}
+ {\pgfqpoint{\pgf@lib@svg@last@x}{\pgf@lib@svg@last@y}}%
+ % Go on
+ \pgf@lib@svg@read@nums{7}{\pgf@lib@svg@arcto@rel}
+ \fi
+}
+
+
+
+
+
+% Handle to end of the world
+
+\pgfparserdef{svgpath}{all}{the character "}
+{
+ \pgf@lib@svg@finish@prev
+ \pgfparserswitch{final}
+}
+
+
+
+
+% Handle spacers for numbers
+
+\def\pgf@lib@svg@read@nums#1#2{% get #1 number symbols, then do #2
+ \pgf@lib@svg@count=0\relax
+ \pgf@lib@svg@max@num=#1\relax
+ \pgfparserswitch{num}
+ \def\pgf@lib@svg@finish@prev{
+ \ifx\pgf@lib@svg@num\pgfutil@empty%
+ \else%
+ \expandafter\let\csname pgf@lib@svg@num@\the\pgf@lib@svg@count\endcsname=\pgf@lib@svg@num
+ \advance\pgf@lib@svg@count by1\relax%
+ \let\pgf@lib@svg@num=\pgfutil@empty%
+ \fi
+ #2
+ }
+}
+
+\def\pgf@lib@svg@get@num#1{\csname pgf@lib@svg@num@#1\endcsname}
+
+
+\pgfparserdef{svgpath}{num}{the character ,}
+{
+ \pgf@lib@svg@handle@spacer
+}
+
+\pgfparserdef{svgpath}{num}{\meaning\pgfutil@sptoken}
+{
+ \pgf@lib@svg@handle@spacer
+}
+
+\pgfparserdef{svgpath}{num}{the character -}
+{
+ \pgf@lib@svg@handle@spacer
+ \def\pgf@lib@svg@num{-}%
+}
+
+\def\pgf@lib@svg@handle@spacer{
+ \ifx\pgf@lib@svg@num\pgfutil@empty%
+ % ignore
+ \else
+ \expandafter\let\csname pgf@lib@svg@num@\the\pgf@lib@svg@count\endcsname=\pgf@lib@svg@num
+ \advance\pgf@lib@svg@count by1\relax%
+ \ifnum\pgf@lib@svg@count=\pgf@lib@svg@max@num\relax%
+ \pgf@lib@svg@finish@prev%
+ \fi
+ \let\pgf@lib@svg@num=\pgfutil@empty%
+ \fi
+}
+
+
+% Handle digits
+
+\pgfparserdef{svgpath}{all}{the character .}
+{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num.}}
+
+\pgfparserdef{svgpath}{all}{the character 0}
+{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num0}}
+
+\pgfparserdef{svgpath}{all}{the character 1}
+{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num1}}
+
+\pgfparserdef{svgpath}{all}{the character 2}
+{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num2}}
+
+\pgfparserdef{svgpath}{all}{the character 3}
+{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num3}}
+
+\pgfparserdef{svgpath}{all}{the character 4}
+{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num4}}
+
+\pgfparserdef{svgpath}{all}{the character 5}
+{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num5}}
+
+\pgfparserdef{svgpath}{all}{the character 6}
+{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num6}}
+
+\pgfparserdef{svgpath}{all}{the character 7}
+{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num7}}
+
+\pgfparserdef{svgpath}{all}{the character 8}
+{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num8}}
+
+\pgfparserdef{svgpath}{all}{the character 9}
+{\expandafter\def\expandafter\pgf@lib@svg@num\expandafter{\pgf@lib@svg@num9}}
+
+
+
+
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.IEC.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.IEC.code.tex
new file mode 100644
index 00000000000..e79634a06ea
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.IEC.code.tex
@@ -0,0 +1,680 @@
+% 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.
+
+
+%
+% Resistor shape based on a zig-zag-line
+%
+
+\pgfdeclareshape{var resistor IEC}
+{
+ \inheritsavedanchors[from=rectangle ee]
+ \inheritanchor[from=rectangle ee]{center}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+ \inheritanchorborder[from=rectangle ee]
+
+ \backgroundpath{
+ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
+ \pgf@xa=\pgf@x \pgf@ya=\pgf@y
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ % Middle line
+ \pgf@yc=.5\pgf@ya
+ \advance\pgf@yc by.5\pgf@yb
+ % Height
+ \pgf@xc=-.5\pgf@ya
+ \advance\pgf@xc by.5\pgf@yb
+ % Start point
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@yc}}
+ % Lines
+ \advance\pgf@xb by.1pt%
+ \pgfutil@loop%
+ \advance\pgf@xa by4\pgf@xc\relax%
+ \ifdim\pgf@xa<\pgf@xb%
+ \advance\pgf@xa by-3\pgf@xc%
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}%
+ \advance\pgf@xa by2\pgf@xc%
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}%
+ \advance\pgf@xa by\pgf@xc%
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yc}}%
+ \pgfutil@repeat%
+ \advance\pgf@xb by-.1pt%
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yc}}%
+ }
+}
+
+
+
+%
+% Inductor shape based on a bumpy line
+%
+
+\pgfdeclareshape{inductor IEC}
+{
+ \savedanchor\northeast{%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgf@x=\pgf@xa%
+ \advance\pgf@x by .5\pgf@xb%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
+ \pgf@y=\pgf@ya%
+ \advance\pgf@y by\pgf@yb%
+ }
+ \savedanchor\southwest{%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgf@x=-\pgf@xa%
+ \advance\pgf@x by -.5\pgf@xb%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \pgf@y=-\pgf@ya%
+ }
+
+ \anchor{center}{\pgfpointorigin}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+
+ \anchorborder{%
+ \ifdim\pgf@y<0pt%
+ % tricky... simpilfy to the origin...
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgf@process{\southwest}%
+ \advance\pgf@y by-0.5pt%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\pgfqpoint{-\pgf@xa}{-\pgf@ya}}}%
+ \else%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\northeast}}%
+ \fi%
+ }
+
+ \backgroundpath{
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xa=-\pgf@x \pgf@ya=0pt
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ % Height
+ \pgf@xc=\pgf@yb%
+ % Start point
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}}
+ % Lines
+ \advance\pgf@xb by.1pt%
+ \pgfutil@loop%
+ \advance\pgf@xa by2\pgf@xc\relax%
+ \ifdim\pgf@xa<\pgf@xb%
+ \pgfpatharc{180}{0}{\pgf@xc}%
+ \pgfutil@repeat%
+ \advance\pgf@xb by-.1pt%
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{0pt}}%
+ }
+}
+
+
+
+
+%
+% Simple capacitor, consisting of two parallel lines
+%
+
+\pgfdeclareshape{capacitor IEC}
+{
+ \inheritsavedanchors[from=rectangle ee]
+ \inheritanchor[from=rectangle ee]{center}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+ \inheritanchorborder[from=rectangle ee]
+
+ \backgroundpath{
+ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
+ \pgf@xa=\pgf@x \pgf@ya=\pgf@y
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
+ \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
+ }
+}
+
+
+
+
+%
+% Simple ground, consisting of three lines, getting smaller
+%
+
+\pgfdeclareshape{ground IEC}
+{
+ \inheritsavedanchors[from=rectangle ee]
+ \inheritanchor[from=rectangle ee]{center}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+ \inheritanchorborder[from=rectangle ee]
+
+ \backgroundpath{
+ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
+ \pgf@xa=\pgf@x \pgf@ya=\pgf@y
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ % First line, simple
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
+ % Advance to middle
+ \pgfmathsetlength\pgf@xa{.5\pgf@xa+.5\pgf@xb}
+ % Make smaller
+ \pgfmathsetlength\pgf@yc{.16666\pgf@yb-.16666\pgf@ya}
+ \advance\pgf@ya by\pgf@yc
+ \advance\pgf@yb by-\pgf@yc
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
+ % Make even smaller
+ \advance\pgf@ya by\pgf@yc
+ \advance\pgf@yb by-\pgf@yc
+ \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
+ }
+}
+
+
+
+%
+% Battery, consisting of two parallel lines, one smaller than
+% the other
+%
+
+\pgfdeclareshape{battery IEC}
+{
+ \inheritsavedanchors[from=rectangle ee]
+ \inheritanchor[from=rectangle ee]{center}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+ \inheritanchorborder[from=rectangle ee]
+
+ \backgroundpath{
+ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
+ \pgf@xa=\pgf@x \pgf@ya=\pgf@y
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ % First line, simple
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
+ % Make smaller
+ \pgfmathsetlength\pgf@yc{.25\pgf@yb-.25\pgf@ya}
+ \advance\pgf@ya by\pgf@yc
+ \advance\pgf@yb by-\pgf@yc
+ \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
+ }
+}
+
+
+%
+% Special diodes
+%
+
+
+\pgfdeclareshape{breakdown diode IEC}
+{
+ \inheritsavedanchors[from=rectangle ee]
+ \inheritanchor[from=rectangle ee]{center}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+ \inheritanchorborder[from=rectangle ee]
+
+ \backgroundpath{
+ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
+ \pgf@xa=\pgf@x \pgf@ya=\pgf@y
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ \pgf@xc=.5\pgf@xa \advance\pgf@xc by.5\pgf@xb
+ \pgf@yc=.5\pgf@ya
+ \advance\pgf@yc by .5\pgf@yb
+ % Triangles:
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xc}{\pgf@yc}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
+ \pgfpathclose
+ \pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xc}{\pgf@yc}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
+ \pgfpathclose
+ }
+
+
+ \beforebackgroundpath{
+ {
+ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
+ \pgf@xa=\pgf@x \pgf@ya=\pgf@y
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ \pgf@yc=.5\pgf@ya
+ \advance\pgf@yc by.5\pgf@yb
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@yc}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yc}}
+ \pgfusepathqstroke
+ \pgf@xc=.5\pgf@xa
+ \advance\pgf@xc by.5\pgf@xb
+ \pgftransformshift{\pgfqpoint{\pgf@xc}{\pgf@yc}}
+ \pgf@yc=.5\pgf@yb
+ \advance\pgf@yc by-.5\pgf@ya
+ \pgftransformscale{\pgf@sys@tonumber{\pgf@yc}}
+ \pgfpathmoveto{\pgfqpoint{-.5pt}{-1pt}}
+ \pgfpathlineto{\pgfqpoint{0pt}{-1pt}}
+ \pgfpathlineto{\pgfqpoint{0pt}{1pt}}
+ \pgfpathlineto{\pgfqpoint{.5pt}{1pt}}
+ \pgfusepathqstroke
+ }
+ }
+}
+
+
+
+
+
+
+% Generic shapes
+%
+% When these shapes are used, you can set a key derived form the
+% shapes name to some code that will be executed as the before
+% background path. This means that the basic shape is fixed, but
+% things like a special line inside the shape or at the border can be
+% added without having to define a whole new shape.
+
+
+\pgfdeclareshape{generic circle IEC}
+{
+ % This shape is a generic circle, to which you can add something to
+ % the before background path using the key
+ % /pgf/generic circle IEC/before background
+ % When this key is invoked, the transformation matrix will have been
+ % setup such that the circle's center is at the origin and that the
+ % position \pgfpoint{1pt}{0pt} lies exactly on the top of the circle
+ % (and, there, on the middle of the line).
+
+ \inheritsavedanchors[from=circle ee]
+ \inheritanchorborder[from=circle ee]
+ \inheritanchor[from=circle ee]{north}
+ \inheritanchor[from=circle ee]{north west}
+ \inheritanchor[from=circle ee]{north east}
+ \inheritanchor[from=circle ee]{center}
+ \inheritanchor[from=circle ee]{west}
+ \inheritanchor[from=circle ee]{east}
+ \inheritanchor[from=circle ee]{south}
+ \inheritanchor[from=circle ee]{south west}
+ \inheritanchor[from=circle ee]{south east}
+ \inheritanchor[from=circle ee]{input}
+ \inheritanchor[from=circle ee]{output}
+ \inheritbackgroundpath[from=circle ee]
+
+ \beforebackgroundpath{
+ {
+ \centerpoint%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgftransformshift{}
+ \pgfutil@tempdima=\radius%
+ \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@xb<\pgf@yb%
+ \advance\pgfutil@tempdima by-\pgf@yb%
+ \else%
+ \advance\pgfutil@tempdima by-\pgf@xb%
+ \fi%
+ \pgftransformscale{\pgf@sys@tonumber{\pgfutil@tempdima}}
+ \pgfkeysvalueof{/pgf/generic circle IEC/before background}
+ }
+ }
+}
+
+
+
+%
+% Generic diode, based on a rectangle
+%
+
+\pgfdeclareshape{generic diode IEC}
+{
+ % This shape is a generic diode, to which you can add something to
+ % the before background path using the key
+ % /pgf/generic diode IEC/before background
+ % When this key is invoked, the transformation matrix will have been
+ % setup such that the center is at the tip of the diode. The
+ % position \pgfpoint{1pt}{0pt} lies exactly on the top of the
+ % (suggested) line before the diode.
+
+ \inheritsavedanchors[from=rectangle ee]
+ \inheritanchor[from=rectangle ee]{center}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+ \inheritanchorborder[from=rectangle ee]
+
+ \backgroundpath{
+ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
+ \pgf@xa=\pgf@x \pgf@ya=\pgf@y
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ % Move tip back a little bit
+ \advance\pgf@xb by-.5\pgflinewidth
+ % Triangle triangle:
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
+ \pgf@yc=.5\pgf@ya
+ \advance\pgf@yc by .5\pgf@yb
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yc}}
+ \pgfpathclose
+ }
+
+
+ \beforebackgroundpath{
+ {
+ \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
+ \pgf@xa=\pgf@x \pgf@ya=\pgf@y
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ \pgf@yc=.5\pgf@ya
+ \advance\pgf@yc by.5\pgf@yb
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@yc}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yc}}
+ \pgfusepathqstroke
+ \pgftransformshift{\pgfqpoint{\pgf@xb}{\pgf@yc}}
+ \pgf@yc=.5\pgf@yb
+ \advance\pgf@yc by-.5\pgf@ya
+ \pgftransformscale{\pgf@sys@tonumber{\pgf@yc}}
+ \pgfkeysvalueof{/pgf/generic diode IEC/before background}
+ }
+ }
+}
+
+
+\pgfkeys{
+ /pgf/generic circle IEC/before background/.initial=,
+ /pgf/generic diode IEC/before background/.initial=,
+}
+
+
+
+
+
+%
+% Concacts
+%
+
+\pgfdeclareshape{make contact IEC}
+{
+ \savedanchor\northeast{%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgf@x=\pgf@xa%
+ \advance\pgf@x by .5\pgf@xb%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
+ \pgf@y=\pgf@ya%
+ \advance\pgf@y by\pgf@yb%
+ }
+ \savedanchor\southwest{%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgf@x=-.5\pgf@xa%
+ \advance\pgf@x by -.5\pgf@xb%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \pgf@y=-\pgf@ya%
+ }
+
+ \anchor{center}{\pgfpointorigin}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+
+ \anchorborder{%
+ \ifdim\pgf@y<0pt%
+ % tricky... simpilfy to the origin...
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgf@process{\southwest}%
+ \advance\pgf@y by-0.5pt%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\pgfqpoint{-\pgf@xa}{-\pgf@ya}}}%
+ \else%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\northeast}}%
+ \fi%
+ }
+
+ \backgroundpath{
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xa=-\pgf@x \pgf@ya=0pt
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ % Start point
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
+ }
+}
+
+
+
+%
+% Concacts
+%
+
+\pgfdeclareshape{var make contact IEC}
+{
+ \savedanchor\northeast{%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgf@x=\pgf@xa%
+ \advance\pgf@x by .5\pgf@xb%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
+ \pgf@y=\pgf@ya%
+ \advance\pgf@y by\pgf@yb%
+ }
+ \savedanchor\southwest{%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgf@x=-.5\pgf@xa%
+ \advance\pgf@x by -.5\pgf@xb%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \pgf@y=-\pgf@ya%
+ \pgf@xc=0.083333\pgf@x%
+ \advance\pgf@y by\pgf@xc%
+ }
+
+ \anchor{center}{\pgfpointorigin}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+
+ \anchorborder{%
+ \ifdim\pgf@y<0pt%
+ % tricky... simpilfy to the origin...
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgf@process{\southwest}%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\pgfqpoint{-\pgf@xa}{-\pgf@ya}}}%
+ \else%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\northeast}}%
+ \fi%
+ }
+
+ \backgroundpath{
+ \pgf@process{\pgfpointadd{\northeast}{
+ \pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xa=-\pgf@x \pgf@ya=0pt
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ \pgf@xc=\pgf@xa
+ \pgfutil@tempdima=2\pgf@xb%
+ \pgfutil@tempdima=0.083333\pgfutil@tempdima%
+ \advance\pgf@xa by \pgfutil@tempdima
+ % Circle
+ {\pgfpathcircle{\pgfqpoint{\pgf@xa}{0pt}}{\pgfutil@tempdima}}
+ % Height
+ % Start point
+ \pgf@process{\pgfpointnormalised{\pgfpointdiff{\pgfqpoint{\pgf@xa}{0pt}}{\pgfqpoint{\pgf@xb}{\pgf@yb}}}}
+ \pgf@xc=\pgf@x
+ \pgf@yc=\pgf@y
+ \pgfpathmoveto{\pgfpointadd{\pgfqpoint{\pgf@xa}{0pt}}{%
+ \pgfpointscale{\pgfutil@tempdima}{\pgfqpoint{\pgf@xc}{\pgf@yc}}}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
+ }
+}
+
+
+
+\pgfdeclareshape{break contact IEC}
+{
+ \savedanchor\northeast{%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgf@x=\pgf@xa%
+ \advance\pgf@x by .5\pgf@xb%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
+ \pgf@y=\pgf@ya%
+ \advance\pgf@y by\pgf@yb%
+ }
+ \savedanchor\southwest{%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgf@x=-.5\pgf@xa%
+ \advance\pgf@x by -.5\pgf@xb%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \pgf@y=-\pgf@ya%
+ }
+
+ \anchor{center}{\pgfpointorigin}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+
+ \anchorborder{%
+ \ifdim\pgf@y<0pt%
+ % tricky... simpilfy to the origin...
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgf@process{\southwest}%
+ \advance\pgf@y by-0.5pt%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\pgfqpoint{-\pgf@xa}{-\pgf@ya}}}%
+ \else%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\northeast}}%
+ \fi%
+ }
+
+ \backgroundpath{
+ \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
+ \pgf@xa=-\pgf@x \pgf@ya=0pt
+ \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ % Start point
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
+ % Break point
+ \pgf@xc=.2\pgf@xb
+ \advance\pgf@xc by-.2\pgf@xa
+ \pgfpathmoveto{\pgfqpoint{\pgf@xb}{0pt}}
+ \advance\pgf@xb by-\pgf@xc
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{0pt}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
+ }
+}
+
+
+
+
+
+\endinput
+
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.code.tex
new file mode 100644
index 00000000000..ddf8a29f629
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.ee.code.tex
@@ -0,0 +1,176 @@
+% 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.
+
+
+
+%
+% Base shapes
+%
+% These shapes are identical to the shapes without "ee", only an "input"
+% and an "output" anchor have been added at the left and right end.
+
+\pgfdeclareshape{rectangle ee}
+{
+ \inheritsavedanchors[from=rectangle]
+ \inheritanchorborder[from=rectangle]
+ \inheritanchor[from=rectangle]{north}
+ \inheritanchor[from=rectangle]{north west}
+ \inheritanchor[from=rectangle]{north east}
+ \inheritanchor[from=rectangle]{center}
+ \inheritanchor[from=rectangle]{west}
+ \inheritanchor[from=rectangle]{east}
+ \inheritanchor[from=rectangle]{mid}
+ \inheritanchor[from=rectangle]{mid west}
+ \inheritanchor[from=rectangle]{mid east}
+ \inheritanchor[from=rectangle]{base}
+ \inheritanchor[from=rectangle]{base west}
+ \inheritanchor[from=rectangle]{base east}
+ \inheritanchor[from=rectangle]{south}
+ \inheritanchor[from=rectangle]{south west}
+ \inheritanchor[from=rectangle]{south east}
+ \inheritbackgroundpath[from=rectangle]
+ % New:
+ \anchor{input}{
+ \pgf@process{\northeast}%
+ \pgf@ya=.5\pgf@y%
+ \pgf@process{\southwest}%
+ \pgf@y=.5\pgf@y%
+ \advance\pgf@y by \pgf@ya%
+ }
+ \anchor{output}{%
+ \pgf@process{\southwest}%
+ \pgf@ya=.5\pgf@y%
+ \pgf@process{\northeast}%
+ \pgf@y=.5\pgf@y%
+ \advance\pgf@y by \pgf@ya%
+ }
+}
+
+\pgfdeclareshape{circle ee}
+{
+ \inheritsavedanchors[from=circle]
+ \inheritanchorborder[from=circle]
+ \inheritanchor[from=circle]{north}
+ \inheritanchor[from=circle]{north west}
+ \inheritanchor[from=circle]{north east}
+ \inheritanchor[from=circle]{center}
+ \inheritanchor[from=circle]{west}
+ \inheritanchor[from=circle]{east}
+ \inheritanchor[from=circle]{mid}
+ \inheritanchor[from=circle]{mid west}
+ \inheritanchor[from=circle]{mid east}
+ \inheritanchor[from=circle]{base}
+ \inheritanchor[from=circle]{base west}
+ \inheritanchor[from=circle]{base east}
+ \inheritanchor[from=circle]{south}
+ \inheritanchor[from=circle]{south west}
+ \inheritanchor[from=circle]{south east}
+ \inheritbackgroundpath[from=circle]
+ % New:
+ \anchor{input}{\centerpoint\advance\pgf@x by-\radius}
+ \anchor{output}{\centerpoint\advance\pgf@x by\radius}
+}
+
+
+
+%
+% Current direction indicator. This shape uses the current setting of
+% the current direction arrow tip for the arrow. The shape is a
+% rectangle around the arrow tip.
+%
+
+\pgfdeclareshape{direction ee}
+{
+ \savedanchor\northeast{
+ % Right border is given by right extend
+ \pgf@x=0pt%
+ \csname pgf@arrow@right@\pgfkeysvalueof{/pgf/direction ee arrow}\endcsname
+ % Height is given by minimum height/2
+ \pgfmathsetlength{\pgf@y}{\pgfkeysvalueof{/pgf/minimum height}}%
+ \pgf@y=.5\pgf@y
+ }
+ \savedanchor\southwest{
+ % Left border is given by left extend
+ \pgf@x=0pt%
+ \csname pgf@arrow@left@\pgfkeysvalueof{/pgf/direction ee arrow}\endcsname
+ \pgf@x=-\pgf@x%
+ % Height is given by minimum height/2
+ \pgfmathsetlength{\pgf@y}{\pgfkeysvalueof{/pgf/minimum height}}%
+ \pgf@y=-.5\pgf@y
+ }
+
+ \inheritanchor[from=rectangle ee]{center}
+ \inheritanchor[from=rectangle ee]{north}
+ \inheritanchor[from=rectangle ee]{south}
+ \inheritanchor[from=rectangle ee]{east}
+ \inheritanchor[from=rectangle ee]{west}
+ \inheritanchor[from=rectangle ee]{north east}
+ \inheritanchor[from=rectangle ee]{north west}
+ \inheritanchor[from=rectangle ee]{south east}
+ \inheritanchor[from=rectangle ee]{south west}
+ \inheritanchor[from=rectangle ee]{input}
+ \inheritanchor[from=rectangle ee]{output}
+ \inheritanchorborder[from=rectangle ee]
+ \nodeparts{}% no text
+
+ \behindbackgroundpath{
+ \pgf@process{\southwest}
+ \pgf@xa=\pgf@x
+ \pgf@process{\northeast}
+ \pgf@xb=\pgf@x
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}}
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{0pt}}
+ \pgfusepathqstroke
+ }
+
+ \beforebackgroundpath{
+ {
+ \pgfsetarrowsend{\pgfkeysvalueof{/pgf/direction ee arrow}}
+ \pgfsys@beginscope
+ \pgflowlevelsynccm%
+ \pgflowlevelobj{}{\pgf@endarrow}%
+ \pgfsys@endscope
+ }
+ }
+}
+
+\pgfkeys{
+ /pgf/direction ee arrow/.initial=direction ee,
+}
+
+
+
+% Special arrow for ee directions:
+
+\pgfarrowsdeclare{direction ee}{direction ee}
+{
+ \pgfmathsetlength\pgfutil@tempdima{\pgfgetarrowoptions{direction ee}}%
+ \pgfutil@tempdima=.5\pgfutil@tempdima
+ \pgfarrowsleftextend{+-\pgfutil@tempdima}
+ \pgfarrowsrightextend{+\pgfutil@tempdima}
+}
+{
+ \pgfmathsetlength\pgfutil@tempdima{\pgfgetarrowoptions{direction ee}}%
+ \pgfsetdash{}{+0pt}
+ \pgfsetroundjoin
+ \pgfpathmoveto{\pgfqpoint{-0.5\pgfutil@tempdima}{0.38268343237\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{0.5\pgfutil@tempdima}{0\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfqpoint{-0.5\pgfutil@tempdima}{-0.38268343237\pgfutil@tempdima}}
+ \pgfpathclose
+ \pgfusepathqfillstroke
+}
+
+\pgfsetarrowoptions{direction ee}{4pt}
+
+
+
+
+
+\endinput
+
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.gates.logic.IEC.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.IEC.code.tex
index 881cda69d98..5b2beb2b0fb 100644
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.gates.logic.IEC.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.IEC.code.tex
@@ -7,12 +7,9 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
+\usepgflibrary{shapes.gates.logic}
\pgfkeys{/pgf/.cd,
- logic gate input sep/.initial=0.125cm,
- logic gate inputs/.initial={normal,normal},%
- logic gate inverted radius/.initial=2pt,%
- logic gate anchors use bounding box/.is if=pgfgateanchorsuseboundingrectangle,%
and gate IEC symbol/.initial=$\char`\&$,
nand gate IEC symbol/.initial=$\char`\&$,
or gate IEC symbol/.initial=$\geq1$,
@@ -32,84 +29,6 @@
right/.code=\pgftransformxshift{\innerhalfwidth}
}
-% Internal macro for parsing inputs.
-%
-\expandafter\ifx\csname pgf@lib@sh@logicgate@parseinputs\endcsname\relax%
-\def\pgf@lib@sh@logicgate@parseinputs#1{%
- \edef\pgf@lib@sh@temp{\pgfkeysvalueof{/pgf/logic gate inputs}}%
- \c@pgf@counta#1\relax%
- \c@pgf@countb0\relax%
- \expandafter\pgfutil@in@\expandafter,\expandafter{\pgf@lib@sh@temp}%
- \ifpgfutil@in@%
- \let\pgf@lib@sh@next\pgf@lib@sh@logicgate@parseinputs@long%
- \else%
- \let\pgf@lib@sh@next\pgf@lib@sh@logicgate@parseinputs@short%
- \fi%
- \pgf@lib@sh@next%
-}
-\def\pgf@lib@sh@itext{i}
-\def\pgf@lib@sh@invertedtext{inverted}
-%
-% The `short' version for input specifcation is an extension of
-% ideas due to Juergen Werber and Christoph Bartoschek.
-%
-\def\pgf@lib@sh@logicgate@parseinputs@short{%
- \expandafter\pgf@lib@sh@logicgate@parseinputs@@short\pgf@lib@sh@temp\pgf@stop%
-}
-\def\pgf@lib@sh@logicgate@parseinputs@@short#1{%
- \ifx#1\pgf@stop%
- \edef\pgf@lib@sh@logicgate@numinputs{\the\c@pgf@countb}%
- \let\pgf@lib@sh@next\relax%
- \else%
- \ifnum\c@pgf@countb=\c@pgf@counta%
- \edef\pgf@lib@sh@logicgate@numinputs{\the\c@pgf@countb}%
- \let\pgf@lib@sh@next\relax%
- \else%
- \advance\c@pgf@countb1\relax%
- \expandafter\ifx\pgf@lib@sh@itext#1%
- \expandafter\pgf@sh@resavedmacro\expandafter{\csname input-\the\c@pgf@countb\endcsname}{%
- \expandafter\def\csname input-\the\c@pgf@countb\endcsname{i}}%
- \else%
- \expandafter\pgf@sh@resavedmacro\expandafter{\csname input-\the\c@pgf@countb\endcsname}{%
- \expandafter\def\csname input-\the\c@pgf@countb\endcsname{n}}%
- \fi%
- \let\pgf@lib@sh@next\pgf@lib@sh@logicgate@parseinputs@@short%
- \fi%
- \fi%
- \pgf@lib@sh@next%
-}
-\def\pgf@lib@sh@logicgate@parseinputs@long{%
- \expandafter\pgf@lib@sh@logicgate@parseinputs@@long\pgf@lib@sh@temp,\pgf@stop,%
-}
-\def\pgf@lib@sh@logicgate@parseinputs@@long#1,{%
- \ifx#1\pgf@stop%
- \edef\pgf@lib@sh@logicgate@numinputs{\the\c@pgf@countb}%
- \let\pgf@lib@sh@next\relax%
- \else%
- \ifnum\c@pgf@countb=\c@pgf@counta%
- \edef\pgf@lib@sh@logicgate@numinputs{\the\c@pgf@countb}%
- \let\pgf@lib@sh@next\relax%
- \else%
- \advance\c@pgf@countb1\relax%
- \def\pgf@lib@sh@temp{#1}%
- \ifx\pgf@lib@sh@invertedtext\pgf@lib@sh@temp%
- \expandafter\pgf@sh@resavedmacro\expandafter{\csname input-\the\c@pgf@countb\endcsname}{%
- \expandafter\def\csname input-\the\c@pgf@countb\endcsname{i}}%
- \else%
- \expandafter\pgf@sh@resavedmacro\expandafter{\csname input-\the\c@pgf@countb\endcsname}{%
- \expandafter\def\csname input-\the\c@pgf@countb\endcsname{n}}%
- \fi%
- \let\pgf@lib@sh@next\pgf@lib@sh@logicgate@parseinputs@@@long%
- \fi%
- \fi%
- \pgf@lib@sh@next%
-}
-\def\pgf@lib@sh@logicgate@parseinputs@@@long{%
- \pgfutil@ifnextchar x{\pgf@lib@sh@logicgate@parseinputs@@long}%
- {\pgf@lib@sh@logicgate@parseinputs@@long}%
-}
-\fi%
-
\def\pgf@lib@sh@logicgates@IEC@foregroundpath#1{%
\dimensions%
{%
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.gates.logic.US.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.US.code.tex
index 76d6916bcd5..ae857c6fd42 100644
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.gates.logic.US.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.US.code.tex
@@ -7,17 +7,16 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
+\usepgflibrary{shapes.gates.logic}
+
\newif\ifpgfgateanchorsuseboundingrectangle%
% Keys for US/CDH logic gates.
%
-\pgfkeys{/pgf/.cd,%
- logic gate input sep/.initial=0.125cm,
- logic gate inputs/.initial={normal,normal},%
- logic gate inverted radius/.initial=2pt,%
- logic gate anchors use bounding box/.is if=pgfgateanchorsuseboundingrectangle,%
+\pgfkeys{
+ /pgf/logic gate anchors use bounding box/.is if=pgfgateanchorsuseboundingrectangle,%
}
% An internal macro for calculating internal dimensions of
@@ -175,84 +174,6 @@
}%
-% Internal macro for parsing inputs.
-%
-\expandafter\ifx\csname pgf@lib@sh@logicgate@parseinputs\endcsname\relax%
-\def\pgf@lib@sh@logicgate@parseinputs#1{%
- \edef\pgf@lib@sh@temp{\pgfkeysvalueof{/pgf/logic gate inputs}}%
- \c@pgf@counta#1\relax%
- \c@pgf@countb0\relax%
- \expandafter\pgfutil@in@\expandafter,\expandafter{\pgf@lib@sh@temp}%
- \ifpgfutil@in@%
- \let\pgf@lib@sh@next\pgf@lib@sh@logicgate@parseinputs@long%
- \else%
- \let\pgf@lib@sh@next\pgf@lib@sh@logicgate@parseinputs@short%
- \fi%
- \pgf@lib@sh@next%
-}
-\def\pgf@lib@sh@itext{i}
-\def\pgf@lib@sh@invertedtext{inverted}
-%
-% The `short' version for input specifcation is an extension of
-% ideas due to Juergen Werber and Christoph Bartoschek.
-%
-\def\pgf@lib@sh@logicgate@parseinputs@short{%
- \expandafter\pgf@lib@sh@logicgate@parseinputs@@short\pgf@lib@sh@temp\pgf@stop%
-}
-\def\pgf@lib@sh@logicgate@parseinputs@@short#1{%
- \ifx#1\pgf@stop%
- \edef\pgf@lib@sh@logicgate@numinputs{\the\c@pgf@countb}%
- \let\pgf@lib@sh@next\relax%
- \else%
- \ifnum\c@pgf@countb=\c@pgf@counta%
- \edef\pgf@lib@sh@logicgate@numinputs{\the\c@pgf@countb}%
- \let\pgf@lib@sh@next\relax%
- \else%
- \advance\c@pgf@countb1\relax%
- \expandafter\ifx\pgf@lib@sh@itext#1%
- \expandafter\pgf@sh@resavedmacro\expandafter{\csname input-\the\c@pgf@countb\endcsname}{%
- \expandafter\def\csname input-\the\c@pgf@countb\endcsname{i}}%
- \else%
- \expandafter\pgf@sh@resavedmacro\expandafter{\csname input-\the\c@pgf@countb\endcsname}{%
- \expandafter\def\csname input-\the\c@pgf@countb\endcsname{n}}%
- \fi%
- \let\pgf@lib@sh@next\pgf@lib@sh@logicgate@parseinputs@@short%
- \fi%
- \fi%
- \pgf@lib@sh@next%
-}
-\def\pgf@lib@sh@logicgate@parseinputs@long{%
- \expandafter\pgf@lib@sh@logicgate@parseinputs@@long\pgf@lib@sh@temp,\pgf@stop,%
-}
-\def\pgf@lib@sh@logicgate@parseinputs@@long#1,{%
- \ifx#1\pgf@stop%
- \edef\pgf@lib@sh@logicgate@numinputs{\the\c@pgf@countb}%
- \let\pgf@lib@sh@next\relax%
- \else%
- \ifnum\c@pgf@countb=\c@pgf@counta%
- \edef\pgf@lib@sh@logicgate@numinputs{\the\c@pgf@countb}%
- \let\pgf@lib@sh@next\relax%
- \else%
- \advance\c@pgf@countb1\relax%
- \def\pgf@lib@sh@temp{#1}%
- \ifx\pgf@lib@sh@invertedtext\pgf@lib@sh@temp%
- \expandafter\pgf@sh@resavedmacro\expandafter{\csname input-\the\c@pgf@countb\endcsname}{%
- \expandafter\def\csname input-\the\c@pgf@countb\endcsname{i}}%
- \else%
- \expandafter\pgf@sh@resavedmacro\expandafter{\csname input-\the\c@pgf@countb\endcsname}{%
- \expandafter\def\csname input-\the\c@pgf@countb\endcsname{n}}%
- \fi%
- \let\pgf@lib@sh@next\pgf@lib@sh@logicgate@parseinputs@@@long%
- \fi%
- \fi%
- \pgf@lib@sh@next%
-}
-\def\pgf@lib@sh@logicgate@parseinputs@@@long{%
- \pgfutil@ifnextchar x{\pgf@lib@sh@logicgate@parseinputs@@long}%
- {\pgf@lib@sh@logicgate@parseinputs@@long}%
-}
-\fi%
-
% Internal macro for calculation input anchors. Used by
% both and gates and nand gates, and also the not gate and buffer.
%
@@ -1733,287 +1654,302 @@
% Shape not gate US
%
\pgfdeclareshape{not gate US}{%
- \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@not gate US\endcsname{%
- \pgf@lib@sh@logicgate@parseinputs{1}%
- \ifnum\pgf@lib@sh@logicgate@numinputs=0\relax%
- \PackageError{PGF}{A not gate must have one input}{}%
- \fi%
- }%
- \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}%
- \saveddimen\invertedradius{%
- \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
- }%
- \saveddimen\halflinewidth{%
- \pgf@x.5\pgflinewidth%
- }%
- \saveddimen\outerinvertedradius{%
- \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
- \advance\pgf@x.5\pgflinewidth%
- }
- \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS}
- \savedanchor\centerpoint{%
- \pgf@x.5\wd\pgfnodeparttextbox%
- \pgf@y.5\ht\pgfnodeparttextbox%
- \advance\pgf@y-.5\dp\pgfnodeparttextbox%
- }
- \savedanchor\midpoint{%
- \pgf@x.5\wd\pgfnodeparttextbox%
- \pgfmathsetlength\pgf@y{+0.5ex}%
- }
- \savedanchor\basepoint{%
- \pgf@x.5\wd\pgfnodeparttextbox%
- \pgf@y0pt%
- }
- \anchor{center}{\centerpoint}%
- \anchor{mid}{\midpoint}%
- \anchor{mid east}{%
- \midpoint%
- \pgfutil@tempdima\pgf@y%
- \csname pgf@anchor@not gate US@east\endcsname%
- \pgf@y\pgfutil@tempdima%
- }
- \anchor{mid west}{%
- \dimensions%
- \pgf@xc\halfside%
- \pgf@xc-.833333\pgf@xc%
- \advance\pgf@xc-\outerxsep%
- \midpoint%
- \advance\pgf@x\pgf@xc%
- }%
- \anchor{base}{\basepoint}%
- \anchor{base east}{%
- \basepoint%
- \pgfutil@tempdima\pgf@y%
- \csname pgf@anchor@not gate US@east\endcsname%
- \pgf@y\pgfutil@tempdima%
- }
- \anchor{base west}{%
- \dimensions%
- \pgf@xc\halfside%
- \pgf@xc-.833333\pgf@xc%
- \advance\pgf@xc-\outerxsep%
- \basepoint%
- \advance\pgf@x\pgf@xc%
- }%
- \inheritanchor[from=and gate US]{base}
- \anchor{output}{%
- \dimensions%
- \pgf@xc\halfside%
- \centerpoint%
- \advance\pgf@x-.166666\pgf@xc%
- \pgf@xc2.0\pgf@xc%
- \advance\pgf@x.866025\pgf@xc%
- \advance\pgf@x\invertedradius%
- \advance\pgf@x\outerinvertedradius%
- \advance\pgf@x\outerxsep%
- }
- \anchor{east}{%
- \dimensions%
- \tipanchor%
- \pgf@xa\pgf@x%
- \centerpoint%
- \advance\pgf@x\pgf@xa%
- }%
- \anchor{north}{%
- \dimensions%
- \ifpgfgateanchorsuseboundingrectangle%
- \csname pgf@anchor@not gate US@north west\endcsname%
- \pgf@ya\pgf@y%
- \centerpoint%
- \pgf@y\pgf@ya%
- \else%
- \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@y1pt}%
- {\csname pgf@anchor@not gate US@north west\endcsname}%
- {%
- \pgfpointadd{\centerpoint}{%
- \tipanchor%
- \pgf@xa\outerxsep%
- \advance\pgf@x2.350943\pgf@xa%
- }%
- }%
- \fi%
- }
- \anchor{south}{%
- \dimensions%
- \ifpgfgateanchorsuseboundingrectangle%
- \csname pgf@anchor@not gate US@south west\endcsname%
- \pgf@ya\pgf@y%
- \centerpoint%
- \pgf@y\pgf@ya%
- \else%
- \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@y-1pt}%
- {\csname pgf@anchor@not gate US@south west\endcsname}%
- {%
- \pgfpointadd{\centerpoint}{%
- \tipanchor%
- \pgf@xa\outerxsep%
- \advance\pgf@x2.350943\pgf@xa%
- }%
- }%
- \fi%
- }
- \anchor{south east}{%
- \dimensions%
- \ifpgfgateanchorsuseboundingrectangle%
- \csname pgf@anchor@not gate US@south west\endcsname%
- \pgf@ya\pgf@y%
- \pgf@process{%
- \dimensions%
- \tipanchor%
- \pgf@xa\pgf@x%
- \centerpoint%
- \advance\pgf@x\pgf@xa%
- }%
- \pgf@y\pgf@ya%
- \else%
- \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@x1pt\advance\pgf@y-1pt}%
- {\csname pgf@anchor@not gate US@south west\endcsname}%
- {%
- \pgfpointadd{\centerpoint}{%
- \tipanchor%
- \pgf@xa\outerxsep%
- \advance\pgf@x2.350943\pgf@xa%
- }%
- }%
- \fi%
- }
- \anchor{north east}{%
- \dimensions%
- \ifpgfgateanchorsuseboundingrectangle%
- \csname pgf@anchor@not gate US@north west\endcsname%
- \pgf@ya\pgf@y%
- \pgf@process{%
- \dimensions%
- \tipanchor%
- \pgf@xa\pgf@x%
- \centerpoint%
- \advance\pgf@x\pgf@xa%
- }%
- \pgf@y\pgf@ya%
- \else%
- \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@x1pt\advance\pgf@y1pt}%
- {\csname pgf@anchor@not gate US@north west\endcsname}%
- {%
- \pgfpointadd{\centerpoint}{%
- \tipanchor%
- \pgf@xa\outerxsep%
- \advance\pgf@x2.350943\pgf@xa%
- }%
- }%
- \fi%
- }
- \anchor{south west}{%
- \dimensions%
- \pgf@xa\halfside%
- \centerpoint%
- \advance\pgf@x-.833333\pgf@xa
- \advance\pgf@x-\outerxsep%
- \advance\pgf@y-1.166666\pgf@xa%
- \pgf@ya\outerysep%
- \advance\pgf@y-1.565\pgf@ya% Selected by trial and error.
- }%
- \anchor{north west}{%
- \dimensions%
- \pgf@xa\halfside%
- \centerpoint%
- \advance\pgf@x-.833333\pgf@xa
- \advance\pgf@x-\outerxsep%
- \advance\pgf@y1.166666\pgf@xa%
- \pgf@ya\outerysep%
- \advance\pgf@y1.565\pgf@ya% Selected by trial and error.
- }%
- \anchor{input}{%
- \dimensions%
- \pgf@lib@sh@logicgate@AND@inputanchor{1}%
- \pgf@xc\halfside%
- \advance\pgf@x.333333\pgf@xc%
- }%
- \anchor{west}{%
- \dimensions%
- \pgf@xc\halfside%
- \pgf@xc-.833333\pgf@xc%
- \advance\pgf@xc-\outerxsep%
- \centerpoint%
- \advance\pgf@x\pgf@xc%
- }
- \backgroundpath{%
- \dimensions%
- \pgf@xc\halfwidth%
- \pgf@yc\halfheight%
- \advance\pgf@xc-\outerxsep%
- \advance\pgf@yc-\outerysep%
- {%
- \pgftransformshift{\centerpoint}%
- \pgfpathmoveto{\tipanchor}%
- \pgfpathlineto{\pgfqpoint{-.833333\pgf@xc}{1.166666\pgf@yc}}%
- \pgfpathlineto{\pgfqpoint{-.833333\pgf@xc}{-1.166666\pgf@yc}}%
- \pgfpathlineto{\tipanchor}%
- %
- % Draw the output inverter.
- %
- {%
- \pgfpathcircle{%
- \pgf@x-.166666\pgf@xc%
- \pgf@yc2.0\pgf@yc%
- \advance\pgf@x.866025\pgf@yc%
- \advance\pgf@x\outerinvertedradius%
- \pgf@y0pt%
- }{+\invertedradius}%
- }%
- %
- % Draw the input.
- %
- \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-1\endcsname%
- {%
- \pgfpathcircle{%
- \pgf@xa\halfside%
- \pgf@x-.833333\pgf@xa%
- \advance\pgf@x-.5\pgflinewidth%
- \advance\pgf@x-\invertedradius%
- \pgf@y0pt%
- }{+\invertedradius}%
- }%
- \fi%
- }%
- }%
- \anchorborder{%
- \pgfextract@process\externalpoint{}%
- \pgfextract@process\externalpoint{\pgfpointadd{\centerpoint}{\externalpoint}}%
- \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}%
- \let\externalangle\pgfmathresult%
- \dimensions%
- \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@not gate US@north west\endcsname}%
- \ifdim\externalangle pt<\pgfmathresult pt%
- \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
- {\csname pgf@anchor@not gate US@north west\endcsname}%
- {%
- \pgfpointadd{\centerpoint}{%
- \tipanchor%
- \pgf@xa\outerxsep%
- \advance\pgf@x2.350943\pgf@xa%
- }%
- }%
- \else%
- \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@not gate US@south west\endcsname}%
- \ifdim\externalangle pt<\pgfmathresult pt%
- \pgfpointintersectionoflines{\externalpoint}{\centerpoint}%
- {\csname pgf@anchor@not gate US@north west\endcsname}%
- {\csname pgf@anchor@not gate US@south west\endcsname}%
- \else%
- \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
- {\csname pgf@anchor@not gate US@south west\endcsname}%
- {%
- \pgfpointadd{\centerpoint}{%
- \tipanchor%
- \pgf@xa\outerxsep%
- \advance\pgf@x2.350943\pgf@xa%
- }%
- }%
- \fi%
- \fi%
- }%
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@not gate US\endcsname{%
+ \pgf@lib@sh@logicgate@parseinputs{1}%
+ \ifnum\pgf@lib@sh@logicgate@numinputs=0\relax%
+ \PackageError{PGF}{A not gate must have one input}{}%
+ \fi%
+ }%
+ \savedmacro\numinputs{\let\numinputs\pgf@lib@sh@logicgate@numinputs}%
+ \saveddimen\invertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ }%
+ \saveddimen\halflinewidth{%
+ \pgf@x.5\pgflinewidth%
+ }%
+ \saveddimen\outerinvertedradius{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/logic gate inverted radius}}%
+ \advance\pgf@x.5\pgflinewidth%
+ }
+ \savedmacro\dimensions{\pgf@lib@sh@logicgates@dimensions@orUS}
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt%
+ }
+ \anchor{center}{\centerpoint}%
+ \anchor{mid}{\midpoint}%
+ \anchor{mid east}{%
+ \midpoint%
+ \pgfutil@tempdima\pgf@y%
+ \csname pgf@anchor@not gate US@east\endcsname%
+ \pgf@y\pgfutil@tempdima%
+ }
+ \anchor{mid west}{%
+ \dimensions%
+ \pgf@xc\halfside%
+ \pgf@xc-.833333\pgf@xc%
+ \advance\pgf@xc-\outerxsep%
+ \midpoint%
+ \advance\pgf@x\pgf@xc%
+ }%
+ \anchor{base}{\basepoint}%
+ \anchor{base east}{%
+ \basepoint%
+ \pgfutil@tempdima\pgf@y%
+ \csname pgf@anchor@not gate US@east\endcsname%
+ \pgf@y\pgfutil@tempdima%
+ }
+ \anchor{base west}{%
+ \dimensions%
+ \pgf@xc\halfside%
+ \pgf@xc-.833333\pgf@xc%
+ \advance\pgf@xc-\outerxsep%
+ \basepoint%
+ \advance\pgf@x\pgf@xc%
+ }%
+ \inheritanchor[from=and gate US]{base}
+ \anchor{output}{%
+ \dimensions%
+ \pgf@xc\halfside%
+ \centerpoint%
+ \advance\pgf@x-.166666\pgf@xc%
+ \pgf@xc2.0\pgf@xc%
+ \advance\pgf@x.866025\pgf@xc%
+ \advance\pgf@x\invertedradius%
+ \advance\pgf@x\outerinvertedradius%
+ \advance\pgf@x\outerxsep%
+ }
+ \anchor{east}{%
+ \dimensions%
+ \tipanchor%
+ \pgf@xa\pgf@x%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ }%
+ \anchor{north}{%
+ \dimensions%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \csname pgf@anchor@not gate US@north west\endcsname%
+ \pgf@ya\pgf@y%
+ \centerpoint%
+ \pgf@y\pgf@ya%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@y1pt}%
+ {\csname pgf@anchor@not gate US@north west\endcsname}%
+ {%
+ \pgfpointadd{\centerpoint}{%
+ \tipanchor%
+ \pgf@xa\outerxsep%
+ \advance\pgf@x2.350943\pgf@xa%
+ }%
+ }%
+ \fi%
+ }
+ \anchor{south}{%
+ \dimensions%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \csname pgf@anchor@not gate US@south west\endcsname%
+ \pgf@ya\pgf@y%
+ \centerpoint%
+ \pgf@y\pgf@ya%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@y-1pt}%
+ {\csname pgf@anchor@not gate US@south west\endcsname}%
+ {%
+ \pgfpointadd{\centerpoint}{%
+ \tipanchor%
+ \pgf@xa\outerxsep%
+ \advance\pgf@x2.350943\pgf@xa%
+ }%
+ }%
+ \fi%
+ }
+ \anchor{south east}{%
+ \dimensions%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \csname pgf@anchor@not gate US@south west\endcsname%
+ \pgf@ya\pgf@y%
+ \pgf@process{%
+ \dimensions%
+ \tipanchor%
+ \pgf@xa\pgf@x%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ }%
+ \pgf@y\pgf@ya%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@x1pt\advance\pgf@y-1pt}%
+ {\csname pgf@anchor@not gate US@south west\endcsname}%
+ {%
+ \pgfpointadd{\centerpoint}{%
+ \tipanchor%
+ \pgf@xa\outerxsep%
+ \advance\pgf@x2.350943\pgf@xa%
+ }%
+ }%
+ \fi%
+ }
+ \anchor{north east}{%
+ \dimensions%
+ \ifpgfgateanchorsuseboundingrectangle%
+ \csname pgf@anchor@not gate US@north west\endcsname%
+ \pgf@ya\pgf@y%
+ \pgf@process{%
+ \dimensions%
+ \tipanchor%
+ \pgf@xa\pgf@x%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ }%
+ \pgf@y\pgf@ya%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\centerpoint\advance\pgf@x1pt\advance\pgf@y1pt}%
+ {\csname pgf@anchor@not gate US@north west\endcsname}%
+ {%
+ \pgfpointadd{\centerpoint}{%
+ \tipanchor%
+ \pgf@xa\outerxsep%
+ \advance\pgf@x2.350943\pgf@xa%
+ }%
+ }%
+ \fi%
+ }
+ \anchor{south west}{%
+ \dimensions%
+ \pgf@xa\halfside%
+ \centerpoint%
+ \advance\pgf@x-.833333\pgf@xa
+ \advance\pgf@x-\outerxsep%
+ \advance\pgf@y-1.166666\pgf@xa%
+ \pgf@ya\outerysep%
+ \advance\pgf@y-1.565\pgf@ya% Selected by trial and error.
+ }%
+ \anchor{north west}{%
+ \dimensions%
+ \pgf@xa\halfside%
+ \centerpoint%
+ \advance\pgf@x-.833333\pgf@xa
+ \advance\pgf@x-\outerxsep%
+ \advance\pgf@y1.166666\pgf@xa%
+ \pgf@ya\outerysep%
+ \advance\pgf@y1.565\pgf@ya% Selected by trial and error.
+ }%
+ \anchor{input}{%
+ \dimensions%
+ \pgf@lib@sh@logicgate@AND@inputanchor{1}%
+ \pgf@xc\halfside%
+ \advance\pgf@x.333333\pgf@xc%
+ }%
+ \anchor{west}{%
+ \dimensions%
+ \pgf@xc\halfside%
+ \pgf@xc-.833333\pgf@xc%
+ \advance\pgf@xc-\outerxsep%
+ \centerpoint%
+ \advance\pgf@x\pgf@xc%
+ }
+ \backgroundpath{%
+ \dimensions%
+ \pgf@xc\halfwidth%
+ \pgf@yc\halfheight%
+ \advance\pgf@xc-\outerxsep%
+ \advance\pgf@yc-\outerysep%
+ {%
+ \pgftransformshift{\centerpoint}%
+ \pgfpathmoveto{\tipanchor}%
+ \pgfpathlineto{\pgfqpoint{-.833333\pgf@xc}{1.166666\pgf@yc}}%
+ \pgfpathlineto{\pgfqpoint{-.833333\pgf@xc}{-1.166666\pgf@yc}}%
+ \pgfpathlineto{\tipanchor}%
+ %
+ % Draw the output inverter.
+ %
+ {%
+ \pgfpathcircle{%
+ \pgf@x-.166666\pgf@xc%
+ \pgf@yc2.0\pgf@yc%
+ \advance\pgf@x.866025\pgf@yc%
+ \advance\pgf@x\outerinvertedradius%
+ \pgf@y0pt%
+ }{+\invertedradius}%
+ }%
+ %
+ % Draw the input.
+ %
+ \expandafter\ifx\expandafter\pgf@lib@sh@itext\csname input-1\endcsname%
+ {%
+ \pgfpathcircle{%
+ \pgf@xa\halfside%
+ \pgf@x-.833333\pgf@xa%
+ \advance\pgf@x-.5\pgflinewidth%
+ \advance\pgf@x-\invertedradius%
+ \pgf@y0pt%
+ }{+\invertedradius}%
+ }%
+ \fi%
+ }%
+ }%
+ \anchorborder{%
+ \pgf@lib@gates@not@buffer@border{not gate US}
+ }
}
+\def\pgf@lib@gates@not@buffer@border#1{
+ \pgfextract@process\externalpoint{}%
+ \pgfextract@process\externalpoint{\pgfpointadd{\centerpoint}{\externalpoint}}%
+ \pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}%
+ \ifx\pgfmathresult\pgf@lib@zero@text%
+ \csname pgf@anchor@#1@output\endcsname%
+ \else%
+ \ifx\pgfmathresult\pgf@lib@onehundredeighty@text%
+ \csname pgf@anchor@#1@input\endcsname%
+ \else%
+ \let\externalangle\pgfmathresult%
+ \dimensions%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@not gate US@north west\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt%
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\csname pgf@anchor@not gate US@north west\endcsname}%
+ {%
+ \pgfpointadd{\centerpoint}{%
+ \tipanchor%
+ \pgf@xa\outerxsep%
+ \advance\pgf@x2.350943\pgf@xa%
+ }%
+ }%
+ \else%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@not gate US@south west\endcsname}%
+ \ifdim\externalangle pt<\pgfmathresult pt%
+ \pgfpointintersectionoflines{\externalpoint}{\centerpoint}%
+ {\csname pgf@anchor@not gate US@north west\endcsname}%
+ {\csname pgf@anchor@not gate US@south west\endcsname}%
+ \else%
+ \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ {\csname pgf@anchor@not gate US@south west\endcsname}%
+ {%
+ \pgfpointadd{\centerpoint}{%
+ \tipanchor%
+ \pgf@xa\outerxsep%
+ \advance\pgf@x2.350943\pgf@xa%
+ }%
+ }%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+}%
+
+
+\def\pgf@lib@zero@text{0.0}
+\def\pgf@lib@onehundredeighty@text{180.0}
@@ -2194,7 +2130,9 @@
\fi%
}%
}%
- \inheritanchorborder[from=not gate US]
+ \anchorborder{%
+ \pgf@lib@gates@not@buffer@border{buffer gate US}
+ }
}
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.code.tex
new file mode 100644
index 00000000000..8b047f04ab1
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/circuits/pgflibraryshapes.gates.logic.code.tex
@@ -0,0 +1,98 @@
+% 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.
+
+
+% Common keys for all logic gates.
+%
+\pgfkeys{/pgf/.cd,%
+ logic gate input sep/.initial=0.125cm,
+ logic gate inputs/.initial={normal,normal},%
+ logic gate inverted radius/.initial=2pt
+}
+
+
+% Internal macro for parsing inputs.
+%
+\expandafter\ifx\csname pgf@lib@sh@logicgate@parseinputs\endcsname\relax%
+\def\pgf@lib@sh@logicgate@parseinputs#1{%
+ \edef\pgf@lib@sh@temp{\pgfkeysvalueof{/pgf/logic gate inputs}}%
+ \c@pgf@counta#1\relax%
+ \c@pgf@countb0\relax%
+ \expandafter\pgfutil@in@\expandafter,\expandafter{\pgf@lib@sh@temp}%
+ \ifpgfutil@in@%
+ \let\pgf@lib@sh@next\pgf@lib@sh@logicgate@parseinputs@long%
+ \else%
+ \let\pgf@lib@sh@next\pgf@lib@sh@logicgate@parseinputs@short%
+ \fi%
+ \pgf@lib@sh@next%
+}
+\def\pgf@lib@sh@itext{i}
+\def\pgf@lib@sh@invertedtext{inverted}
+%
+% The `short' version for input specifcation is an extension of
+% ideas due to Juergen Werber and Christoph Bartoschek.
+%
+\def\pgf@lib@sh@logicgate@parseinputs@short{%
+ \expandafter\pgf@lib@sh@logicgate@parseinputs@@short\pgf@lib@sh@temp\pgf@stop%
+}
+\def\pgf@lib@sh@logicgate@parseinputs@@short#1{%
+ \ifx#1\pgf@stop%
+ \edef\pgf@lib@sh@logicgate@numinputs{\the\c@pgf@countb}%
+ \let\pgf@lib@sh@next\relax%
+ \else%
+ \ifnum\c@pgf@countb=\c@pgf@counta%
+ \edef\pgf@lib@sh@logicgate@numinputs{\the\c@pgf@countb}%
+ \let\pgf@lib@sh@next\relax%
+ \else%
+ \advance\c@pgf@countb1\relax%
+ \expandafter\ifx\pgf@lib@sh@itext#1%
+ \expandafter\pgf@sh@resavedmacro\expandafter{\csname input-\the\c@pgf@countb\endcsname}{%
+ \expandafter\def\csname input-\the\c@pgf@countb\endcsname{i}}%
+ \else%
+ \expandafter\pgf@sh@resavedmacro\expandafter{\csname input-\the\c@pgf@countb\endcsname}{%
+ \expandafter\def\csname input-\the\c@pgf@countb\endcsname{n}}%
+ \fi%
+ \let\pgf@lib@sh@next\pgf@lib@sh@logicgate@parseinputs@@short%
+ \fi%
+ \fi%
+ \pgf@lib@sh@next%
+}
+\def\pgf@lib@sh@logicgate@parseinputs@long{%
+ \expandafter\pgf@lib@sh@logicgate@parseinputs@@long\pgf@lib@sh@temp,\pgf@stop,%
+}
+\def\pgf@lib@sh@logicgate@parseinputs@@long#1,{%
+ \ifx#1\pgf@stop%
+ \edef\pgf@lib@sh@logicgate@numinputs{\the\c@pgf@countb}%
+ \let\pgf@lib@sh@next\relax%
+ \else%
+ \ifnum\c@pgf@countb=\c@pgf@counta%
+ \edef\pgf@lib@sh@logicgate@numinputs{\the\c@pgf@countb}%
+ \let\pgf@lib@sh@next\relax%
+ \else%
+ \advance\c@pgf@countb1\relax%
+ \def\pgf@lib@sh@temp{#1}%
+ \ifx\pgf@lib@sh@invertedtext\pgf@lib@sh@temp%
+ \expandafter\pgf@sh@resavedmacro\expandafter{\csname input-\the\c@pgf@countb\endcsname}{%
+ \expandafter\def\csname input-\the\c@pgf@countb\endcsname{i}}%
+ \else%
+ \expandafter\pgf@sh@resavedmacro\expandafter{\csname input-\the\c@pgf@countb\endcsname}{%
+ \expandafter\def\csname input-\the\c@pgf@countb\endcsname{n}}%
+ \fi%
+ \let\pgf@lib@sh@next\pgf@lib@sh@logicgate@parseinputs@@@long%
+ \fi%
+ \fi%
+ \pgf@lib@sh@next%
+}
+\def\pgf@lib@sh@logicgate@parseinputs@@@long{%
+ \pgfutil@ifnextchar x{\pgf@lib@sh@logicgate@parseinputs@@long}%
+ {\pgf@lib@sh@logicgate@parseinputs@@long}%
+}
+\fi%
+
+
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.arrows.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.arrows.code.tex
index a188ad2871e..39f90d6f2e6 100644
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.arrows.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.arrows.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/libraries/pgflibraryshapes.arrows.code.tex,v 1.3 2007/11/10 09:16:33 vibrovski Exp $
+\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/shapes/pgflibraryshapes.arrows.code.tex,v 1.1 2008/06/26 16:55:55 tantau Exp $
% keys for shape single arrow
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.callouts.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.callouts.code.tex
index 5a39a629e07..440681b7b87 100644
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.callouts.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.callouts.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-
+\usepgflibrary{shapes.symbols}
% Keys for callouts
%
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.code.tex
index 02d4956235c..fc0b1d20aa5 100644
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.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/libraries/pgflibraryshapes.code.tex,v 1.14 2007/12/17 16:20:50 tantau Exp $
+\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/shapes/pgflibraryshapes.code.tex,v 1.1 2008/06/26 16:55:55 tantau Exp $
% Only the following are loaded by default and only for historical
% reasons.
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.geometric.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.geometric.code.tex
index 2f11e6a4fd2..ae7ec0f3c4e 100644
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.geometric.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.geometric.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/libraries/pgflibraryshapes.geometric.code.tex,v 1.22 2008/02/01 17:09:04 vibrovski Exp $
+\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/shapes/pgflibraryshapes.geometric.code.tex,v 1.1 2008/06/26 16:55:55 tantau Exp $
\pgfdeclareshape{ellipse}
%
@@ -368,7 +368,7 @@
\def\pgf@lib@temp{#1}%
\pgfkeyslet{/pgf/star point ratio}{\pgf@lib@temp}%
\pgf@lib@shapes@starouterradiususesratiotrue%
- }%
+ },%
star rotate/.style={/pgf/shape border rotate=#1}% For compatability with 1.18
}
@@ -3672,7 +3672,7 @@
\advance\pgf@xa\pgf@x%
\pgf@xb\pgf@xa%
\advance\pgf@xa\pgf@x%
- \pgfmathveclen@{\the\pgf@xa}{\the\pgf@y}%
+ \pgfmathveclen@{\pgfmath@tonumber{\pgf@xa}}{\pgfmath@tonumber{\pgf@y}}%
\pgf@xa\pgfmathresult pt\relax%
\fi%
%
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.misc.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.misc.code.tex
index 62e488dc79a..a57b0cd4511 100644
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.misc.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.misc.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/libraries/pgflibraryshapes.misc.code.tex,v 1.10 2008/02/12 18:02:25 tantau Exp $
+\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/shapes/pgflibraryshapes.misc.code.tex,v 1.3 2008/10/07 18:23:25 vibrovski Exp $
\pgfdeclareshape{cross out}
@@ -66,622 +66,412 @@
}
}
+
+% Rounded rectangle
+
+
\pgfkeys{/pgf/.cd,
rounded rectangle west arc/.initial=convex,
rounded rectangle east arc/.initial=convex,
rounded rectangle left arc/.style={/pgf/rounded rectangle west arc=#1},%
- rounded rectangle right arc/.code={/pgf/rounded rectangle east arc=#1},%
+ rounded rectangle right arc/.style={/pgf/rounded rectangle east arc=#1},%
rounded rectangle arc length/.initial=180%
}%
-\def\pgf@lib@shapes@roundedrectangle@concave{concave}%
-\def\pgf@lib@shapes@roundedrectangle@convex{convex}%
+\def\pgf@lib@sh@misc@rr@text@concave{concave}%
+\def\pgf@lib@sh@misc@rr@text@convex{convex}%
-\pgfdeclareshape{rounded rectangle}{
- \savedmacro\leftarc{%
- \edef\leftarc{\pgfkeysvalueof{/pgf/rounded rectangle west arc}}%
+\pgfdeclareshape{rounded rectangle}{%
+ \savedmacro\westarc{%
+ \edef\westarc{\pgfkeysvalueof{/pgf/rounded rectangle west arc}}%
}
- \savedmacro\rightarc{%
- \edef\rightarc{\pgfkeysvalueof{/pgf/rounded rectangle east arc}}%
+ \savedmacro\eastarc{%
+ \edef\eastarc{\pgfkeysvalueof{/pgf/rounded rectangle east arc}}%
}
\savedmacro\roundedrectanglepoints{%
%
- % Get half the arc angle.
+ % Get half the arc angle, a.
%
\pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/rounded rectangle arc length}}%
- \pgf@x.5\pgf@x%
+ \pgf@x=.5\pgf@x%
\edef\halfarcangle{\pgfmath@tonumber{\pgf@x}}%
- \addtosavedmacro\halfarcangle%
+ \addtosavedmacro\halfarcangle%
%
% Get the (half) node dimensions x & y.
%
\pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
- \advance\pgf@x.5\wd\pgfnodeparttextbox%
+ \edef\innerxsep{\the\pgf@x}%
+ \pgf@xa=0.5\wd\pgfnodeparttextbox%
+ \edef\halftextwidth{\the\pgf@xa}%
+ \addtosavedmacro\halftextwidth%
+ \advance\pgf@x by\pgf@xa%
+ %
\pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
- \advance\pgf@y.5\ht\pgfnodeparttextbox%
- \advance\pgf@y.5\dp\pgfnodeparttextbox%
- %
- % Adjust for minimum height
- %
+ \edef\innerysep{\the\pgf@y}%
+ \pgf@ya=.5\ht\pgfnodeparttextbox%
+ \advance\pgf@ya by.5\dp\pgfnodeparttextbox%
+ \edef\halftextheight{\the\pgf@ya}%
+ \addtosavedmacro\halftextheight%
+ \advance\pgf@y by\pgf@ya%
+ %
+ % Adjust for minimum height
%
\pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
\ifdim\pgf@y<.5\pgf@yb%
- \pgf@y.5\pgf@yb%
+ \pgf@y=.5\pgf@yb%
\fi%
+ \edef\halfheight{\the\pgf@y}%
+ \addtosavedmacro\halfheight%
+ %
+ % Calculate the radius of the arc ends.
%
- % Calculate the radii xa & ya of the arc ends.
+ \pgfmathcosec@{\halfarcangle}%
+ \pgf@ya=\pgfmathresult\pgf@y%
+ \edef\radius{\the\pgf@ya}%
+ \addtosavedmacro\radius%
%
- \pgfmathsetlength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/rounded rectangle arc length}}%
- \pgfutil@tempdima.5\pgfutil@tempdima%
- \pgfmathcosec@{\pgfmath@tonumber{\pgfutil@tempdima}}%
- \pgf@ya\pgfmathresult\pgf@y%
- \pgf@xa\pgf@ya%
+ % Arc width = r - r*cos(a/2).
%
- % Calculate the width of the arc end.
+ \pgfmathcos@{\halfarcangle}%
+ \pgf@xa=\pgf@ya%
+ \advance\pgf@xa by-\pgfmathresult\pgf@ya%
%
- \pgfmathcos@{\pgfmath@tonumber{\pgfutil@tempdima}}%
- \pgf@xb-\pgfmathresult\pgf@xa%
- \advance\pgf@xb\pgf@xa\relax%
- \edef\arcwidth{\the\pgf@xb}%
- \addtosavedmacro{\arcwidth}%
+ % When the node contents are pushed inside a convex arc,
+ % the resulting chord has a height r - r*cos(asin(0.5*h/r)).
%
- % Adjust for minimum width
+ \pgfmathdivide{\halftextheight}{\radius}%
+ \pgfmathasin@{\pgfmathresult}%
+ \pgfmathcos@{\pgfmathresult}%
+ \pgf@xb=\pgf@ya%
+ \advance\pgf@xb by-\pgfmathresult\pgf@ya%
%
- \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
- \advance\pgf@x\arcwidth\relax%
- \ifdim\pgf@x<.5\pgf@xb%
- \pgf@x.5\pgf@xb%
+ % Adjust for minimum width.
+ %
+ \edef\westarc{\pgfkeysvalueof{/pgf/rounded rectangle west arc}}%
+ \edef\eastarc{\pgfkeysvalueof{/pgf/rounded rectangle east arc}}%
+ %
+ \pgfutil@tempdima=2.0\pgf@x% x still holds the half width.
+ \ifx\westarc\pgf@lib@sh@misc@rr@text@concave%
+ \advance\pgfutil@tempdima by\pgf@xa%
+ \else%
+ \ifx\westarc\pgf@lib@sh@misc@rr@text@convex%
+ \advance\pgfutil@tempdima by\pgf@xb%
+ \fi%
\fi%
- \advance\pgf@x-\arcwidth\relax%
%
- % Get the outer sep.
+ \ifx\eastarc\pgf@lib@sh@misc@rr@text@concave%
+ \advance\pgfutil@tempdima by\pgf@xa%
+ \else%
+ \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
+ \advance\pgfutil@tempdima by\pgf@xb%
+ \fi%
+ \fi%
%
- \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/outer xsep}}%
- \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/outer ysep}}%
- \edef\outerxsep{\the\pgf@xb}%
- \edef\outerysep{\the\pgf@yb}%
- \addtosavedmacro\outerxsep%
- \addtosavedmacro\outerysep%
+ \pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/minimum width}}%
+ \ifdim\pgfutil@tempdima<\pgfutil@tempdimb%
+ \advance\pgfutil@tempdimb by-\pgfutil@tempdima%
+ \divide\pgfutil@tempdimb by2\relax%
+ \edef\xoffset{\the\pgfutil@tempdimb}%
+ \else%
+ \let\xoffset=\innerxsep%
+ \fi%
%
- \edef\xpathradius{\the\pgf@xa}%
- \edef\ypathradius{\the\pgf@ya}%
- \addtosavedmacro\xpathradius%
- \addtosavedmacro\ypathradius%
+ % The node is made wider if convex arcs overlap.
%
- \advance\pgf@xa\pgf@xb%
- \advance\pgf@ya\pgf@yb%
- \edef\xradius{\the\pgf@xa}%
- \edef\yradius{\the\pgf@ya}%
- \addtosavedmacro\xradius%
- \addtosavedmacro\yradius%
+ \pgf@x=\halftextwidth\relax%
+ \advance\pgf@x by\xoffset\relax%
+ \pgf@xc=\pgf@ya%
+ \advance\pgf@xc by-\pgf@xb%
+ \ifdim\pgf@xc>\pgf@x\relax%
+ \advance\pgf@xc by-\pgf@x%
+ \advance\pgf@xc by\xoffset\relax%
+ \edef\xoffset{\the\pgf@xc}%
+ \fi%
+ \addtosavedmacro\xoffset%
%
- \advance\pgf@xa-2.0\pgf@xb%
- \advance\pgf@ya-2.0\pgf@yb%
- \edef\xinnerradius{\the\pgf@xa}%
- \edef\yinnerradius{\the\pgf@ya}%
- \addtosavedmacro\xinnerradius%
- \addtosavedmacro\yinnerradius%
+ \pgf@x=\halftextwidth\relax%
+ \advance\pgf@x by\xoffset\relax%
+ \edef\halfwidth{\the\pgf@x}%
+ \addtosavedmacro\halfwidth%
%
- \pgfextract@process\pathcornernoarc{}%
- \addtosavedmacro\pathcornernoarc%
+ \edef\arcwidth{\the\pgf@xa}%
+ \addtosavedmacro\arcwidth%
%
- \pgfextract@process\pathcornerconvexarc{%
- \pathcornernoarc%
- \pgf@xc\arcwidth\relax%
- \advance\pgf@x-.707106\pgf@xc
- }%
- \addtosavedmacro\pathcornerconvexarc%
+ \edef\chordwidth{\the\pgf@xb}%
+ \addtosavedmacro\chordwidth%
%
- \pgfextract@process\pathcornerconcavearc{%
- \pathcornernoarc%
- \advance\pgf@x\arcwidth\relax%
- }%
- \addtosavedmacro\pathcornerconcavearc%
+ \pgfmathsetlengthmacro\outerxsep{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlengthmacro\outerysep{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \addtosavedmacro\outerxsep%
+ \addtosavedmacro\outerysep%
%
- \pgfextract@process\anchorcornernoarc{%
- \pathcornernoarc%
- \advance\pgf@x\pgf@xb%
- \advance\pgf@y\pgf@yb%
- }%
- \addtosavedmacro\anchorcornernoarc%
+ % calculate some horizontal adjustments made for the default miter
+ % drawn when an arc meets the north or south side of the node path.
%
- \pgfextract@process\anchorcornerconvexarc{%
- \pathcornerconvexarc%
- \ifdim\halfarcangle pt=90pt\relax%
- \else%
- \pgfmathsin@{\halfarcangle}%
- \pgf@xa\xpathradius\relax%
- \pgf@xa\pgfmathresult\pgf@xa%
- \pgfmathcos@{\halfarcangle}%
- \pgf@ya\ypathradius\relax%
- \pgf@ya\pgfmathresult\pgf@ya%
- %
- \pgfmathdivide@{\pgfmath@tonumber{\pgf@ya}}{\pgfmath@tonumber{\pgf@xa}}%
- \pgfmathatan@{\pgfmathresult}%
- \let\angle\pgfmathresult%
- \pgfmathadd@{90}{\angle}%
- \pgfmathcosec@{\pgfmathresult}%
- \pgf@xb\pgfmathresult\pgf@xb%
- \pgfmathadd@{90}{\halfarcangle}%
- \pgfmathdivide@{\pgfmathresult}{2}%
- \pgfmathcos@{\pgfmathresult}%
- \advance\pgf@x\pgfmathresult\pgf@xb%
- \fi%
- \advance\pgf@y\pgf@yb%
- }%
- \addtosavedmacro\anchorcornerconvexarc%
+ \ifdim\halfarcangle pt=90pt\relax% Avoid division by zero.
+ \def\concavexshift{0pt}%
+ \else%
+ % For a concave arc: outer xsep * cosec((90-a/2)/2)*cos((90-a/2)/2).
+ \pgfmathsubtract@{90}{\halfarcangle}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \let\angletemp=\pgfmathresult%
+ \pgf@x=\outerxsep\relax%
+ \pgfmathcosec@{\angletemp}%
+ \pgf@x=\pgfmathresult\pgf@x%
+ \pgfmathcos@{\angletemp}%
+ \pgf@x=\pgfmathresult\pgf@x%
+ \edef\concavexshift{\the\pgf@x}%
+ \fi%
+ \addtosavedmacro\concavexshift%
%
- \pgfextract@process\anchorcornerconcavearc{%
- \pathcornerconcavearc%
- \ifdim\halfarcangle pt=90pt\relax%
- \else%
- \pgfmathsin@{\halfarcangle}%
- \pgf@xa\xpathradius\relax%
- \pgf@xa\pgfmathresult\pgf@xa%
- \pgfmathcos@{\halfarcangle}%
- \pgf@ya\ypathradius\relax%
- \pgf@ya\pgfmathresult\pgf@ya%
- %
- \pgfmathdivide@{\pgfmath@tonumber{\pgf@ya}}{\pgfmath@tonumber{\pgf@xa}}%
- \pgfmathatan@{\pgfmathresult}%
- \pgfmathdivide@{\pgfmathresult}{2}%
- \let\angle\pgfmathresult%
- \pgfmathcosec@{\pgfmathresult}%
- \pgf@xb\pgfmathresult\pgf@xb%
- \pgfmathcos@{\angle}%
- \advance\pgf@x\pgfmathresult\pgf@xb%
- \fi%
- \advance\pgf@y\pgf@yb%
- }%
- \addtosavedmacro\anchorcornerconcavearc%
- %
+ \ifdim\halfarcangle pt=90pt\relax% Avoid division by zero.
+ \def\convexxshift{0pt}%
+ \else%
+ % For a convex arc: outer xsep * cosec((90+a/2)/2)*cos((90+a/2)/2).
+ \pgfmathadd@{90}{\halfarcangle}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \let\angletemp=\pgfmathresult%
+ \pgf@x=\outerxsep\relax%
+ \pgfmathcosec@{\angletemp}%
+ \pgf@x=\pgfmathresult\pgf@x%
+ \pgfmathcos@{\angletemp}%
+ \pgf@x=\pgfmathresult\pgf@x%
+ \edef\convexxshift{\the\pgf@x}%
+ \fi%
+ \addtosavedmacro\convexxshift%
}%
\saveddimen\halflinewidth{\pgf@x.5\pgflinewidth}%
\savedanchor\centerpoint{%
- \pgf@x.5\wd\pgfnodeparttextbox%
- \pgf@y.5\ht\pgfnodeparttextbox%
- \advance\pgf@y-.5\dp\pgfnodeparttextbox%
+ \pgf@x=.5\wd\pgfnodeparttextbox%
+ \pgf@y=.5\ht\pgfnodeparttextbox%
+ \advance\pgf@y by-.5\dp\pgfnodeparttextbox%
}
\savedanchor\midpoint{%
- \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@x=.5\wd\pgfnodeparttextbox%
\pgfmathsetlength\pgf@y{+0.5ex}%
}
\savedanchor\basepoint{%
- \pgf@x.5\wd\pgfnodeparttextbox%
- \pgf@y0pt\relax%
+ \pgf@x=.5\wd\pgfnodeparttextbox%
+ \pgf@y=0pt\relax%
}
\anchor{center}{\centerpoint}%
\anchor{mid}{\midpoint}%
- \anchor{mid east}{%
- \roundedrectanglepoints%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
- \csname pgf@anchor@rounded rectangle@east\endcsname%
- \else%
- \csname pgf@anchor@rounded rectangle@south east\endcsname%
- \fi%
- \pgf@xa\pgf@x%
+ \anchor{mid west}{%
+ \csname pgf@anchor@rounded rectangle@west\endcsname%
+ \pgf@xc=\pgf@x%
\midpoint%
- \pgf@x\pgf@xa%
+ \pgf@x=\pgf@xc%
}%
- \anchor{mid west}{%
- \roundedrectanglepoints%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
- \csname pgf@anchor@rounded rectangle@west\endcsname%
- \else%
- \csname pgf@anchor@rounded rectangle@south west\endcsname%
- \fi%
- \pgf@xa\pgf@x%
+ \anchor{mid east}{%
+ \csname pgf@anchor@rounded rectangle@east\endcsname%
+ \pgf@xc=\pgf@x%
\midpoint%
- \pgf@x\pgf@xa%
+ \pgf@x=\pgf@xc%
}%
\anchor{base}{\basepoint}%
- \anchor{base east}{%
- \roundedrectanglepoints%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
- \csname pgf@anchor@rounded rectangle@east\endcsname%
- \else%
- \csname pgf@anchor@rounded rectangle@south east\endcsname%
- \fi%
- \pgf@y0pt%
- }%
\anchor{base west}{%
- \roundedrectanglepoints%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
- \csname pgf@anchor@rounded rectangle@west\endcsname%
- \else%
- \csname pgf@anchor@rounded rectangle@south west\endcsname%
- \fi%
- \pgf@y0pt%
+ \csname pgf@anchor@rounded rectangle@west\endcsname%
+ \pgf@xc=\pgf@x%
+ \basepoint%
+ \pgf@x=\pgf@xc%
+ }%
+ \anchor{base east}{%
+ \csname pgf@anchor@rounded rectangle@east\endcsname%
+ \pgf@xc=\pgf@x%
+ \basepoint%
+ \pgf@x=\pgf@xc%
}%
\anchor{north}{%
- \pgfpointadd{\centerpoint}{%
- \roundedrectanglepoints%
- \anchorcornernoarc%
- \pgf@x0pt%
- }%
+ \roundedrectanglepoints%
+ \pgfpointadd{\centerpoint}{\pgfpoint{+0pt}{\halfheight+\outerysep}}%
}%
- \anchor{east}{%
- \pgfpointadd{\centerpoint}{%
- \roundedrectanglepoints%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
- \pathcornerconvexarc%
- \advance\pgf@x\arcwidth\relax%
- \advance\pgf@x\outerxsep\relax%
- \else%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@concave%
- \pathcornerconcavearc%
- \advance\pgf@x-\arcwidth\relax%
- \advance\pgf@x\outerxsep\relax%
- \else%
- \anchorcornernoarc%
- \fi%
- \fi%
- \pgf@y0pt\relax%
- }%
+ \anchor{south}{%
+ \roundedrectanglepoints%
+ \pgfpointadd{\centerpoint}{\pgfpoint{+0pt}{-\halfheight-\outerysep}}%
}%
\anchor{west}{%
+ \roundedrectanglepoints%
\pgfpointadd{\centerpoint}{%
- \roundedrectanglepoints%
- \ifx\leftarc\pgf@lib@shapes@roundedrectangle@convex%
- \pathcornerconvexarc%
- \advance\pgf@x\arcwidth\relax%
- \advance\pgf@x\outerxsep\relax%
+ \ifx\westarc\pgf@lib@sh@misc@rr@text@concave%
+ \pgfpoint{-\halfwidth-\arcwidth-\concavexshift}{+0pt}%
\else%
- \ifx\leftarc\pgf@lib@shapes@roundedrectangle@concave%
- \pathcornerconcavearc%
- \advance\pgf@x-\arcwidth\relax%
- \advance\pgf@x\outerxsep\relax%
+ \ifx\westarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfpoint{-\halfwidth-\chordwidth-\outerxsep}{+0pt}%
\else%
- \anchorcornernoarc%
+ \pgfpoint{-\halfwidth-\outerxsep}{+0pt}%
\fi%
- \fi%
- \pgf@x-\pgf@x%
- \pgf@y0pt\relax%
+ \fi%
}%
}%
- \anchor{south}{%
- \pgfpointadd{\centerpoint}{%
- \roundedrectanglepoints%
- \anchorcornernoarc%
- \pgf@x0pt%
- \pgf@y-\pgf@y
- }%
+ \anchor{north west}{%
+ \roundedrectanglepoints%
+ \ifx\westarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfpointadd{\centerpoint}{\pgfpoint{-\halfwidth-\chordwidth+\arcwidth-\convexxshift}{+0pt}}%
+ \else%
+ \csname pgf@anchor@rounded rectangle@west\endcsname%
+ \fi%
+ \pgf@xc=\pgf@x%
+ \csname pgf@anchor@rounded rectangle@north\endcsname%
+ \pgf@x=\pgf@xc%
}%
- \anchor{north east}{%
- \pgfpointadd{\centerpoint}{%
- \roundedrectanglepoints%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
- \anchorcornerconvexarc%
- \else%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@concave%
- \anchorcornerconcavearc%
- \else%
- \anchorcornernoarc%
- \fi%
- \fi%
- }%
+ \anchor{south west}{%
+ \roundedrectanglepoints%
+ \ifx\westarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfpointadd{\centerpoint}{\pgfpoint{-\halfwidth-\chordwidth+\arcwidth-\convexxshift}{+0pt}}%
+ \else%
+ \csname pgf@anchor@rounded rectangle@west\endcsname%
+ \fi%
+ \pgf@xc=\pgf@x%
+ \csname pgf@anchor@rounded rectangle@south\endcsname%
+ \pgf@x=\pgf@xc%
}%
- \anchor{north west}{%
+ \anchor{east}{%
+ \roundedrectanglepoints%
\pgfpointadd{\centerpoint}{%
- \roundedrectanglepoints%
- \ifx\leftarc\pgf@lib@shapes@roundedrectangle@convex%
- \anchorcornerconvexarc%
+ \ifx\eastarc\pgf@lib@sh@misc@rr@text@concave%
+ \pgfpoint{\halfwidth+\arcwidth+\concavexshift}{+0pt}%
\else%
- \ifx\leftarc\pgf@lib@shapes@roundedrectangle@concave%
- \anchorcornerconcavearc%
+ \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfpoint{\halfwidth+\chordwidth+\outerxsep}{+0pt}%
\else%
- \anchorcornernoarc%
+ \pgfpoint{\halfwidth+\outerxsep}{+0pt}%
\fi%
\fi%
- \pgf@x-\pgf@x%
}%
}%
- \anchor{south west}{%
- \pgfpointadd{\centerpoint}{%
- \roundedrectanglepoints%
- \ifx\leftarc\pgf@lib@shapes@roundedrectangle@convex%
- \anchorcornerconvexarc%
- \else%
- \ifx\leftarc\pgf@lib@shapes@roundedrectangle@concave%
- \anchorcornerconcavearc%
- \else%
- \anchorcornernoarc%
- \fi%
- \fi%
- \pgf@x-\pgf@x%
- \pgf@y-\pgf@y%
- }%
+ \anchor{north east}{%
+ \roundedrectanglepoints%
+ \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfpointadd{\centerpoint}{\pgfpoint{\halfwidth+\chordwidth-\arcwidth+\convexxshift}{+0pt}}%
+ \else%
+ \csname pgf@anchor@rounded rectangle@east\endcsname%
+ \fi%
+ \pgf@xc=\pgf@x%
+ \csname pgf@anchor@rounded rectangle@north\endcsname%
+ \pgf@x=\pgf@xc%
}%
\anchor{south east}{%
- \pgfpointadd{\centerpoint}{%
- \roundedrectanglepoints%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
- \anchorcornerconvexarc%
- \else%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@concave%
- \anchorcornerconcavearc%
- \else%
- \anchorcornernoarc%
- \fi%
- \fi%
- \pgf@y-\pgf@y%
- }%
- }%
- \anchor{shape center}{%
- \roundedrectanglepoints%
- \pgfpointadd{\centerpoint}{%
- \pgfpointadd{%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
- \pathcornerconvexarc%
- \else%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@concave%
- \pathcornerconcavearc%
- \else%
- \pathcornernoarc%
- \fi%
- \fi}%
- {%
- \pgfpointadd{%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
- \pathcornerconvexarc%
- \else%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@concave%
- \pathcornerconcavearc%
- \else%
- \pathcornernoarc%
- \fi%
- \fi
- \pgf@x-\pgf@x}%
- {%
- \pgfpointadd{%
- \ifx\leftarc\pgf@lib@shapes@roundedrectangle@convex%
- \pathcornerconvexarc%
- \else%
- \ifx\leftarc\pgf@lib@shapes@roundedrectangle@concave%
- \pathcornerconcavearc%
- \else%
- \pathcornernoarc%
- \fi%
- \fi
- \pgf@x-\pgf@x%
- \pgf@y-\pgf@y}%
- {%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
- \pathcornerconvexarc%
- \else%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@concave%
- \pathcornerconcavearc%
- \else%
- \pathcornernoarc%
- \fi%
- \fi
- \pgf@y-\pgf@y%
- }%
- }%
- }%
- \divide\pgf@x4\relax%
- \divide\pgf@y4\relax%
- }%
+ \roundedrectanglepoints%
+ \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfpointadd{\centerpoint}{\pgfpoint{\halfwidth+\chordwidth-\arcwidth+\convexxshift}{+0pt}}%
+ \else%
+ \csname pgf@anchor@rounded rectangle@east\endcsname%
+ \fi%
+ \pgf@xc=\pgf@x%
+ \csname pgf@anchor@rounded rectangle@south\endcsname%
+ \pgf@x=\pgf@xc%
}%
\backgroundpath{%
{%
- \pgftransformshift{\centerpoint}%
\roundedrectanglepoints%
- %
- \pgf@x\xradius\relax%
- \pgf@y\yradius\relax%
- \advance\pgf@x-\outerxsep\relax%
- \advance\pgf@y-\outerysep\relax%
- \edef\xradius{\the\pgf@x}%
- \edef\yradius{\the\pgf@y}%
- %
- \pgfpathmoveto{%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
- \pathcornerconvexarc%
- \else%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@concave%
- \pathcornerconcavearc%
- \else%
- \pathcornernoarc%
- \fi%
- \fi%
- }%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
- \pgfpatharc{\halfarcangle}{-\halfarcangle}{\xradius and \yradius}%
+ \pgftransformshift{\centerpoint}%
+ \pgfpathmoveto{\pgfpoint{0pt}{\halfheight}}%
+ \ifx\eastarc\pgf@lib@sh@misc@rr@text@concave%
+ \pgfpathlineto{\pgfpoint{\halfwidth+\arcwidth}{+\halfheight}}%
+ \pgfpatharc{180-\halfarcangle}{180+\halfarcangle}{+\radius}%
\else%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@concave%
- \pgfpatharc{180-\halfarcangle}{180+\halfarcangle}{\xradius and \yradius}%
+ \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfpathlineto{\pgfpoint{\halfwidth+\chordwidth-\arcwidth}{+\halfheight}}%
+ \pgfpatharc{+\halfarcangle}{+-\halfarcangle}{+\radius}%
\else%
- \pgfpathlineto{\pathcornernoarc\pgf@y-\pgf@y}%
+ \pgfpathlineto{\pgfqpoint{\halfwidth}{\halfheight}}%
+ \pgfpathlineto{\pgfqpoint{\halfwidth}{-\halfheight}}%
\fi%
\fi%
- \pgfpathlineto{%
- \ifx\leftarc\pgf@lib@shapes@roundedrectangle@convex%
- \pathcornerconvexarc%
- \else%
- \ifx\leftarc\pgf@lib@shapes@roundedrectangle@concave%
- \pathcornerconcavearc%
- \else%
- \pathcornernoarc%
- \fi%
- \fi%
- \pgf@x-\pgf@x%
- \pgf@y-\pgf@y%
- }%
- \ifx\leftarc\pgf@lib@shapes@roundedrectangle@convex%
- \pgfpatharc{180+\halfarcangle}{180-\halfarcangle}{\xradius and \yradius}%
+ \ifx\westarc\pgf@lib@sh@misc@rr@text@concave%
+ \pgfpathlineto{\pgfpoint{-\halfwidth-\arcwidth}{+-\halfheight}}%
+ \pgfpatharc{+-\halfarcangle}{+\halfarcangle}{+\radius}%
\else%
- \ifx\leftarc\pgf@lib@shapes@roundedrectangle@concave%
- \pgfpatharc{-\halfarcangle}{\halfarcangle}{\xradius and \yradius}%
+ \ifx\westarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfpathlineto{\pgfpoint{-\halfwidth-\chordwidth+\arcwidth}{+-\halfheight}}%
+ \pgfpatharc{180+\halfarcangle}{180-\halfarcangle}{+\radius}%
\else%
- \pgfpathlineto{\pathcornernoarc\pgf@x-\pgf@x}%
+ \pgfpathlineto{\pgfqpoint{-\halfwidth}{-\halfheight}}%
+ \pgfpathlineto{\pgfqpoint{-\halfwidth}{\halfheight}}%
\fi%
\fi%
\pgfpathclose%
}%
}
\anchorborder{%
- \pgfextract@process\externalpoint{%
- \pgfextract@process\externalpoint{}%
+ \pgfextract@process\externalpoint{%
+ \pgfextract@process\externalpoint{}%
\pgfpointadd{\centerpoint}{\externalpoint}%
}%
\roundedrectanglepoints%
%
\pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}%
- \let\externalangle\pgfmathresult%
- %
- \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@west\endcsname}%
+ \let\externalangle=\pgfmathresult%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@north west\endcsname}%
\ifdim\externalangle pt<\pgfmathresult pt\relax%
- \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@north\endcsname}%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@north east\endcsname}%
\ifdim\externalangle pt<\pgfmathresult pt\relax%
- \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@north east\endcsname}%
- \ifdim\externalangle pt<\pgfmathresult pt\relax%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
- \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
- {%
- \csname pgf@anchor@rounded rectangle@east\endcsname%
- \advance\pgf@x-\xradius\relax%
- }%
- {0}{\halfarcangle}{\xradius and \yradius}%
- \else%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@concave%
- \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}%
- {%
- \centerpoint%
- \pgf@xa\pgf@x%
- \pgf@ya\pgf@y%
- \pathcornernoarc%
- \advance\pgf@x\pgf@xa%
- \pgf@y\pgf@ya%
- \advance\pgf@x\xpathradius\relax%
- }%
- {180-\halfarcangle}{180}{\xinnerradius and \yinnerradius}%
- \else%
- \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
- {\csname pgf@anchor@rounded rectangle@north east\endcsname}%
- {\csname pgf@anchor@rounded rectangle@south east\endcsname}%
- \fi%
- \fi%
+ % Between north east and east.
+ \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfextract@process\arccenter{%
+ \pgfpointadd{\centerpoint}{\pgfpoint{\halfwidth+\chordwidth-\radius}{+0pt}}%
+ }%
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {\arccenter}{0}{\halfarcangle}{\radius+\outerxsep and \radius+\outerysep}%
\else%
- \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ \pgfpointintersectionoflines%
{\csname pgf@anchor@rounded rectangle@north east\endcsname}%
- {\csname pgf@anchor@rounded rectangle@north west\endcsname}%
+ {\csname pgf@anchor@rounded rectangle@south east\endcsname}%
+ {\externalpoint}{\centerpoint}%
\fi%
\else%
- \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@north west\endcsname}%
- \ifdim\externalangle pt<\pgfmathresult pt\relax%
- \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
- {\csname pgf@anchor@rounded rectangle@north east\endcsname}%
- {\csname pgf@anchor@rounded rectangle@north west\endcsname}%
- \else%
- \ifx\leftarc\pgf@lib@shapes@roundedrectangle@convex%
- \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
- {%
- \csname pgf@anchor@rounded rectangle@west\endcsname%
- \advance\pgf@x\xradius\relax%
- }%
- {180-\halfarcangle}{180}{\xradius and \yradius}%
- \else%
- \ifx\leftarc\pgf@lib@shapes@roundedrectangle@concave%
- \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}%
- {%
- \centerpoint%
- \pgf@xa\pgf@x%
- \pgf@ya\pgf@y%
- \pathcornernoarc%
- \pgf@x-\pgf@x%
- \advance\pgf@x\pgf@xa%
- \pgf@y\pgf@ya%
- \advance\pgf@x-\xpathradius\relax%
- }%
- {0}{\halfarcangle}{\xinnerradius and \yinnerradius}%
- \else%
- \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
- {\csname pgf@anchor@rounded rectangle@north west\endcsname}%
- {\csname pgf@anchor@rounded rectangle@south west\endcsname}%
- \fi%
- \fi%
- \fi%
+ % Between north west and north east.
+ \pgfpointintersectionoflines%
+ {\csname pgf@anchor@rounded rectangle@north east\endcsname}%
+ {\csname pgf@anchor@rounded rectangle@north west\endcsname}%
+ {\externalpoint}{\centerpoint}%
\fi%
\else%
- \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@south\endcsname}%
+ \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@south west\endcsname}%
\ifdim\externalangle pt<\pgfmathresult pt\relax%
- \pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@south west\endcsname}%
- \ifdim\externalangle pt<\pgfmathresult pt\relax%
- \ifx\leftarc\pgf@lib@shapes@roundedrectangle@convex%
- \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
- {%
- \csname pgf@anchor@rounded rectangle@west\endcsname%
- \advance\pgf@x\xradius\relax%
- }%
- {180}{180+\halfarcangle}{\xradius and \yradius}%
- \else%
- \ifx\leftarc\pgf@lib@shapes@roundedrectangle@concave%
- \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}%
- {%
- \centerpoint%
- \pgf@xa\pgf@x%
- \pgf@ya\pgf@y%
- \pathcornernoarc%
- \pgf@x-\pgf@x%
- \advance\pgf@x\pgf@xa%
- \pgf@y\pgf@ya%
- \advance\pgf@x-\xpathradius\relax%
- }%
- {360-\halfarcangle}{360}{\xinnerradius and \yinnerradius}%
- \else%
- \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
- {\csname pgf@anchor@rounded rectangle@north west\endcsname}%
- {\csname pgf@anchor@rounded rectangle@south west\endcsname}%
- \fi%
- \fi%
+ % Between south west and north west.
+ \ifx\westarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfextract@process\arccenter{%
+ \pgfpointadd{\centerpoint}{\pgfpoint{-\halfwidth-\chordwidth+\radius}{+0pt}}%
+ }%
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {\arccenter}{180-\halfarcangle}{180+\halfarcangle}{\radius+\outerxsep and \radius+\outerysep}%
\else%
- \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
+ \pgfpointintersectionoflines%
+ {\csname pgf@anchor@rounded rectangle@north west\endcsname}%
{\csname pgf@anchor@rounded rectangle@south west\endcsname}%
- {\csname pgf@anchor@rounded rectangle@south east\endcsname}%
+ {\externalpoint}{\centerpoint}%
\fi%
\else%
\pgfmathanglebetweenpoints{\centerpoint}{\csname pgf@anchor@rounded rectangle@south east\endcsname}%
\ifdim\externalangle pt<\pgfmathresult pt\relax%
- \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
- {\csname pgf@anchor@rounded rectangle@south west\endcsname}%
+ % Between south east and south west.
+ \pgfpointintersectionoflines%
{\csname pgf@anchor@rounded rectangle@south east\endcsname}%
+ {\csname pgf@anchor@rounded rectangle@south west\endcsname}%
+ {\externalpoint}{\centerpoint}%
\else%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@convex%
- \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
- {%
- \csname pgf@anchor@rounded rectangle@east\endcsname%
- \advance\pgf@x-\xradius\relax%
+ % Between east and south east.
+ \ifx\eastarc\pgf@lib@sh@misc@rr@text@convex%
+ \pgfextract@process\arccenter{%
+ \pgfpointadd{\centerpoint}{\pgfpoint{\halfwidth+\chordwidth-\radius}{+0pt}}%
}%
- {360-\halfarcangle}{360}{\xradius and \yradius}%
+ \pgfmathpointintersectionoflineandarc{\externalpoint}{\centerpoint}%
+ {\arccenter}{360-\halfarcangle}{360}{\radius+\outerxsep and \radius+\outerysep}%
\else%
- \ifx\rightarc\pgf@lib@shapes@roundedrectangle@concave%
- \pgfmathpointintersectionoflineandarc{\centerpoint}{\externalpoint}%
- {%
- \centerpoint%
- \pgf@xa\pgf@x%
- \pgf@ya\pgf@y%
- \pathcornernoarc%
- \advance\pgf@x\pgf@xa%
- \pgf@y\pgf@ya%
- \advance\pgf@x\xpathradius\relax%
- }%
- {180}{180+\halfarcangle}{\xinnerradius and \yinnerradius}%
- \else%
- \pgfpointintersectionoflines{\centerpoint}{\externalpoint}%
- {\csname pgf@anchor@rounded rectangle@south east\endcsname}%
- {\csname pgf@anchor@rounded rectangle@north east\endcsname}%
- \fi%
+ \pgfpointintersectionoflines%
+ {\csname pgf@anchor@rounded rectangle@north east\endcsname}%
+ {\csname pgf@anchor@rounded rectangle@south east\endcsname}%
+ {\externalpoint}{\centerpoint}%
\fi%
\fi%
\fi%
\fi%
- }%
+ }
}
-
% Keys for chamfered rectangle
%
% /pgf/chamfered rectangle corners : specify the corners to chamfer.
@@ -689,33 +479,33 @@
% /pgf/chamfered rectangle xsep : set the extent of the x chamferling.
% /pgf/chamfered rectangle ysep : set the extent of the y chamferling.
-\pgfkeys{/pgf/chamfered rectangle corners/.store in=\pgf@chamferedrectangle@corners}
-\pgfkeys{/tikz/chamfered rectangle corners/.store in=\pgf@chamferedrectangle@corners}
+\pgfkeys{/pgf/chamfered rectangle corners/.store in=\pgf@lib@sh@misc@cr@corners}
+\pgfkeys{/tikz/chamfered rectangle corners/.store in=\pgf@lib@sh@misc@cr@corners}
-\def\pgf@chamferedrectangle@chamferall{chamfer all}%
-\def\pgf@chamferedrectangle@chamfer{chamfer}
-\let\pgf@chamferedrectangle@corners\pgf@chamferedrectangle@chamferall
+\def\pgf@lib@sh@misc@cr@chamferall{chamfer all}%
+\def\pgf@lib@sh@misc@cr@chamfer{chamfer}
+\let\pgf@lib@sh@misc@cr@corners\pgf@lib@sh@misc@cr@chamferall
-\def\pgf@chamferedrectangle@getcorners{%
+\def\pgf@lib@sh@misc@cr@getcorners{%
\let\northeastcorner\pgfutil@empty%
\let\southeastcorner\pgfutil@empty%
\let\southwestcorner\pgfutil@empty%
\let\northwestcorner\pgfutil@empty%
- \expandafter\pgfutil@in@\expandafter{\pgf@chamferedrectangle@corners}{chamfer all}%
+ \expandafter\pgfutil@in@\expandafter{\pgf@lib@sh@misc@cr@corners}{chamfer all}%
\ifpgfutil@in@%
- \let\northeastcorner\pgf@chamferedrectangle@round%
- \let\southeastcorner\pgf@chamferedrectangle@round%
- \let\southwestcorner\pgf@chamferedrectangle@round%
- \let\northwestcorner\pgf@chamferedrectangle@round%
+ \let\northeastcorner\pgf@lib@sh@misc@cr@round%
+ \let\southeastcorner\pgf@lib@sh@misc@cr@round%
+ \let\southwestcorner\pgf@lib@sh@misc@cr@round%
+ \let\northwestcorner\pgf@lib@sh@misc@cr@round%
\let\pgf@next\relax%
\else%
- \let\pgf@next\pgf@chamferedrectangle@parsecorners%
+ \let\pgf@next\pgf@lib@sh@misc@cr@parsecorners%
\fi%
\pgf@next}
-\def\pgf@chamferedrectangle@parsecorners{%
- \expandafter\pgf@@chamferedrectangle@parsecorners\pgf@chamferedrectangle@corners,\pgf@stop,%
+\def\pgf@lib@sh@misc@cr@parsecorners{%
+ \expandafter\pgf@@chamferedrectangle@parsecorners\pgf@lib@sh@misc@cr@corners,\pgf@stop,%
}
\def\pgf@@chamferedrectangle@parsecorners#1,{%
@@ -724,19 +514,19 @@
\else%
\pgfutil@in@{@#1@}{@north east@@top left@}%
\ifpgfutil@in@%
- \let\northeastcorner\pgf@chamferedrectangle@chamfer%
+ \let\northeastcorner\pgf@lib@sh@misc@cr@chamfer%
\else%
\pgfutil@in@{@#1@}{@south east@@bottom right@}%
\ifpgfutil@in@%
- \let\southeastcorner\pgf@chamferedrectangle@chamfer%
+ \let\southeastcorner\pgf@lib@sh@misc@cr@chamfer%
\else%
\pgfutil@in@{@#1@}{@south west@@bottom left@}%
\ifpgfutil@in@%
- \let\southwestcorner\pgf@chamferedrectangle@chamfer%
+ \let\southwestcorner\pgf@lib@sh@misc@cr@chamfer%
\else%
\pgfutil@in@{@#1@}{@north west@@top right@}%
\ifpgfutil@in@%
- \let\southeastcorner\pgf@chamferedrectangle@round%
+ \let\northwestcorner\pgf@lib@sh@misc@cr@round%
\fi%
\fi%
\fi%
@@ -766,7 +556,7 @@
%
\pgfdeclareshape{chamfered rectangle}{%
\savedmacro\getchamferedrectanglepoints{%
- \pgf@chamferedrectangle@getcorners%
+ \pgf@lib@sh@misc@cr@getcorners%
%
% Get the node dimensions.
%
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.multipart.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.multipart.code.tex
new file mode 100644
index 00000000000..15d7baf090c
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.multipart.code.tex
@@ -0,0 +1,1354 @@
+% Copyright 2007 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.
+
+\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/shapes/pgflibraryshapes.multipart.code.tex,v 1.2 2010/01/07 01:12:23 vibrovski Exp $
+
+\newbox\pgfnodepartlowerbox
+
+%
+% A circle that is split in the middle into an upper and a lower part.
+%
+% This node consists of two parts: The upper (main) part is shown in
+% the upper half of the circle. The second part is the (optional)
+% lower part.
+%
+% Parts: text, lower
+
+\pgfdeclareshape{circle split}
+{
+ %
+ % Node parts
+ %
+ \nodeparts{text,lower}
+
+ %
+ % Anchors
+ %
+ \savedanchor\centerpoint{%
+ \pgf@x=.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength{\pgf@y}{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \pgf@y=-\pgf@y%
+ \advance\pgf@y by-\dp\pgfnodeparttextbox%
+ \advance\pgf@y by-.5\pgflinewidth%
+ }%
+ \savedanchor\loweranchor{%
+ \pgf@x=-.5\wd\pgfnodepartlowerbox%
+ \advance\pgf@x by.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength{\pgf@y}{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \pgf@y=-2\pgf@y%
+ \advance\pgf@y by-\ht\pgfnodepartlowerbox%
+ \advance\pgf@y by-.5\pgflinewidth%
+ \advance\pgf@y by-\dp\pgfnodeparttextbox%
+ \advance\pgf@y by-.5\pgflinewidth%
+ }
+
+ \saveddimen\radius{%
+ %
+ % Caculate ``height radius''
+ %
+ %\pgf@ya=.5\ht\pgfnodeparttextbox%
+% \advance\pgf@ya by.5\dp\pgfnodeparttextbox%
+% \advance\pgf@ya by.5\ht\pgfnodepartlowerbox%
+% \advance\pgf@ya by.5\dp\pgfnodepartlowerbox%
+% \advance\pgf@ya by.5\pgflinewidth%
+ %
+ % MW: Suggested correction for above calculation: Use the tallest box * 2.
+ %
+ \pgf@ya=.5\ht\pgfnodeparttextbox%
+ \advance\pgf@ya by.5\dp\pgfnodeparttextbox%
+ \pgf@yb=.5\ht\pgfnodepartlowerbox%
+ \advance\pgf@yb by.5\dp\pgfnodepartlowerbox%
+ \ifdim\pgf@ya>\pgf@yb\relax%
+ \pgf@ya2.0\pgf@ya\relax%
+ \else%
+ \pgf@ya2.0\pgf@yb\relax%
+ \fi%
+ \advance\pgf@ya by.5\pgflinewidth%
+ \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@ya by2\pgf@yb%
+ %
+ % Caculate ``width radius''
+ %
+ \pgf@xa=.5\wd\pgfnodeparttextbox%
+ \ifdim\pgf@xa<.5\wd\pgfnodepartlowerbox%
+ \pgf@xa=.5\wd\pgfnodepartlowerbox%
+ \fi%
+ \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@xa by\pgf@xb%
+ %
+ % Calculate length of radius vector:
+ %
+ \pgf@process{\pgfpointnormalised{\pgfqpoint{\pgf@xa}{\pgf@ya}}}%
+ \ifdim\pgf@x>\pgf@y%
+ \c@pgf@counta=\pgf@x%
+ \ifnum\c@pgf@counta=0\relax%
+ \else%
+ \divide\c@pgf@counta by 255\relax%
+ \pgf@xa=16\pgf@xa\relax%
+ \divide\pgf@xa by\c@pgf@counta%
+ \pgf@xa=16\pgf@xa\relax%
+ \fi%
+ \else%
+ \c@pgf@counta=\pgf@y%
+ \ifnum\c@pgf@counta=0\relax%
+ \else%
+ \divide\c@pgf@counta by 255\relax%
+ \pgf@ya=16\pgf@ya\relax%
+ \divide\pgf@ya by\c@pgf@counta%
+ \pgf@xa=16\pgf@ya\relax%
+ \fi%
+ \fi%
+ \pgf@x=\pgf@xa%
+ %
+ % If necessary, adjust radius so that the size requirements are
+ % met:
+ %
+ \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@x<.5\pgf@xb%
+ \pgf@x=.5\pgf@xb%
+ \fi%
+ \ifdim\pgf@x<.5\pgf@yb%
+ \pgf@x=.5\pgf@yb%
+ \fi%
+ %
+ % Now, add larger of outer sepearations.
+ %
+ \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@xb<\pgf@yb%
+ \advance\pgf@x by\pgf@yb%
+ \else%
+ \advance\pgf@x by\pgf@xb%
+ \fi%
+ }
+
+ %
+ % Anchors
+ %
+ \inheritanchorborder[from=circle]
+ \inheritanchor[from=circle]{north}
+ \inheritanchor[from=circle]{north west}
+ \inheritanchor[from=circle]{north east}
+ \inheritanchor[from=circle]{center}
+ \inheritanchor[from=circle]{west}
+ \inheritanchor[from=circle]{east}
+ \inheritanchor[from=circle]{mid}
+ \inheritanchor[from=circle]{mid west}
+ \inheritanchor[from=circle]{mid east}
+ \inheritanchor[from=circle]{base}
+ \inheritanchor[from=circle]{base west}
+ \inheritanchor[from=circle]{base east}
+ \inheritanchor[from=circle]{south}
+ \inheritanchor[from=circle]{south west}
+ \inheritanchor[from=circle]{south east}
+ \anchor{lower}{\loweranchor}
+
+ %
+ % Background path
+ %
+ \inheritbackgroundpath[from=circle]
+ \beforebackgroundpath{
+ \pgfutil@tempdima=\radius%
+ \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@xb<\pgf@yb%
+ \advance\pgfutil@tempdima by-\pgf@yb%
+ \else%
+ \advance\pgfutil@tempdima by-\pgf@xb%
+ \fi%
+ \advance\pgfutil@tempdima by-.5\pgflinewidth%
+ \pgfsetshortenstart{0pt}%
+ \pgfsetshortenend{0pt}%
+ \pgfsetarrows{-}%
+ \pgfpathmoveto{\pgfpointadd{\centerpoint}{\pgfqpoint{-1\pgfutil@tempdima}{0pt}}}%
+ \pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfqpoint{\pgfutil@tempdima}{0pt}}}%
+ \pgfusepath{stroke}%
+ }
+}
+
+
+%
+% A circle that is split diagonally into an upper and a lower part.
+%
+% Parts: text, lower
+
+\pgfdeclareshape{circle solidus}{%
+ % Node parts
+ \nodeparts{text,lower}%
+ % Anchors
+ % solidus slants at 45 degrees
+ % text placement minimizes the required radius,
+ % this is achieved placing the "outer" corner
+ % of each box in the line orthogonal to the
+ % solidus which passes through circle center
+ \savedanchor\centerpoint{%
+ \pgf@x=0.5\wd\pgfnodeparttextbox%
+ \advance\pgf@x by0.5\dp\pgfnodeparttextbox%
+ \advance\pgf@x by0.5\ht\pgfnodeparttextbox%
+ \pgf@y=-\pgf@x%
+ \advance\pgf@y by\ht\pgfnodeparttextbox%
+ \advance\pgf@x by0.3536\pgflinewidth%
+ \advance\pgf@y by-0.3536\pgflinewidth%
+ \pgfmathsetlength{\pgf@xa}{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@x by\pgf@xa%
+ \pgfmathsetlength{\pgf@ya}{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y by-\pgf@ya%
+ }%
+ \savedanchor\loweranchor{%
+ \pgf@x=0.5\wd\pgfnodeparttextbox%
+ \advance\pgf@x by0.5\dp\pgfnodeparttextbox%
+ \advance\pgf@x by0.5\ht\pgfnodeparttextbox%
+ \pgf@y=-\pgf@x%
+ \advance\pgf@y by\ht\pgfnodeparttextbox%
+ \advance\pgf@x by0.5\ht\pgfnodepartlowerbox%
+ \advance\pgf@x by0.5\dp\pgfnodepartlowerbox%
+ \advance\pgf@x by-0.5\wd\pgfnodepartlowerbox%
+ \advance\pgf@y by-0.5\ht\pgfnodepartlowerbox%
+ \advance\pgf@y by0.5\dp\pgfnodepartlowerbox%
+ \advance\pgf@y by-0.5\wd\pgfnodepartlowerbox%
+ \advance\pgf@x by0.7071\pgflinewidth%
+ \advance\pgf@y by-0.7071\pgflinewidth%
+ \pgfmathsetlength{\pgf@xa}{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \advance\pgf@x by2\pgf@xa%
+ \pgfmathsetlength{\pgf@ya}{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y by-2\pgf@ya%
+ }%
+ \saveddimen\radius{%
+ % "top" radius
+ \pgf@x=\ht\pgfnodeparttextbox%
+ \advance\pgf@x by\dp\pgfnodeparttextbox%
+ \advance\pgf@x by\wd\pgfnodeparttextbox%
+ % "bottom" radius
+ \pgf@y=\ht\pgfnodepartlowerbox%
+ \advance\pgf@y by\dp\pgfnodepartlowerbox%
+ \advance\pgf@y by\wd\pgfnodepartlowerbox%
+ % use the larger
+ \ifdim\pgf@x<\pgf@y%
+ \pgf@x=\pgf@y%
+ \fi%
+ \pgf@x=0.7071\pgf@x%
+ % add spacings
+ \advance\pgf@x by0.5\pgflinewidth%
+ \pgfmathsetlength{\pgf@xa}{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \pgfmathsetlength{\pgf@ya}{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \pgfmathaddtolength{\pgf@x}{veclen(2\pgf@xa,2\pgf@ya)}%
+ % If necessary, adjust radius so that the size requirements are
+ % met:
+ \pgfmathsetlength{\pgf@xa}{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgfmathsetlength{\pgf@ya}{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@x<.5\pgf@xa%
+ \pgf@x=.5\pgf@xa%
+ \fi%
+ \ifdim\pgf@x<.5\pgf@ya%
+ \pgf@x=.5\pgf@ya%
+ \fi%
+ % Now, add larger of outer separations.
+ \pgfmathsetlength{\pgf@xa}{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength{\pgf@ya}{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@xa<\pgf@ya%
+ \advance\pgf@x by\pgf@ya%
+ \else%
+ \advance\pgf@x by\pgf@xa%
+ \fi%
+ }%
+ % Anchors
+ \inheritanchorborder[from=circle]%
+ \inheritanchor[from=circle]{north}%
+ \inheritanchor[from=circle]{north west}%
+ \inheritanchor[from=circle]{north east}%
+ \inheritanchor[from=circle]{center}%
+ \inheritanchor[from=circle]{west}%
+ \inheritanchor[from=circle]{east}%
+ \inheritanchor[from=circle]{mid}%
+ \inheritanchor[from=circle]{mid west}%
+ \inheritanchor[from=circle]{mid east}%
+ \inheritanchor[from=circle]{base}%
+ \inheritanchor[from=circle]{base west}%
+ \inheritanchor[from=circle]{base east}%
+ \inheritanchor[from=circle]{south}%
+ \inheritanchor[from=circle]{south west}%
+ \inheritanchor[from=circle]{south east}%
+ \anchor{lower}{\loweranchor}%
+ % Background path
+ \inheritbackgroundpath[from=circle]%
+ \beforebackgroundpath{%
+ \pgfutil@tempdima=\radius%
+ \pgfmathsetlength{\pgf@xa}{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength{\pgf@ya}{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@xa<\pgf@ya%
+ \advance\pgfutil@tempdima by-\pgf@ya%
+ \else%
+ \advance\pgfutil@tempdima by-\pgf@xa%
+ \fi%
+ \advance\pgfutil@tempdima by-.5\pgflinewidth%
+ \pgfsetshortenstart{0pt}%
+ \pgfsetshortenend{0pt}%
+ \pgfsetarrows{-}%
+ % solidus slants at 45 degrees and its length is
+ % the golden section of the diameter
+ \pgfpathmoveto{\pgfpointadd{\centerpoint}{\pgfqpoint{-0.437\pgfutil@tempdima}{-0.437\pgfutil@tempdima}}}%
+ \pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfqpoint{0.437\pgfutil@tempdima}{0.437\pgfutil@tempdima}}}%
+ \pgfusepath{stroke}%
+ }%
+}
+
+
+\def\pgf@lib@sh@newbox{\csname newbox\endcsname}% Get round outer.
+
+\def\pgf@lib@sh@toalpha#1{%
+ \ifcase#1\relax%
+ \or one\or two\or three\or four\or five\or six\or seven\or eight\or nine\or ten%
+ \or eleven\or twelve\or thirteen\or fourteen\or fifteen%
+ \or sixteen\or seventeen\or eighteen\or nineteen\or twenty%
+ \else%
+ twenty%
+ \fi%
+}
+
+
+\def\pgf@lib@sh@getalpha#1#2{\expandafter\edef\expandafter#1\expandafter{\pgf@lib@sh@toalpha{#2}}}
+
+\newbox\pgfnodeparttwobox
+\newbox\pgfnodepartthreebox
+\newbox\pgfnodepartfourbox
+
+\let\pgfnodepartonebox=\pgfnodeparttextbox
+\let\pgfnodepartsecondbox=\pgfnodeparttwobox
+\let\pgfnodepartthirdbox=\pgfnodepartthreebox
+\let\pgfnodepartfourthbox=\pgfnodepartfourbox
+
+\def\pgf@lib@sh@allocateboxes#1{%
+ \c@pgf@counta=#1\relax%
+ \pgfmathloop%
+ \ifnum\c@pgf@counta>4\relax%
+ \pgfutil@ifundefined{pgfnodepart\pgf@lib@sh@toalpha{\c@pgf@counta}box}%
+ {%
+ \expandafter\pgf@lib@sh@newbox\csname pgfnodepart\pgf@lib@sh@toalpha{\c@pgf@counta}box\endcsname%
+ }%
+ {}%
+ \advance\c@pgf@counta by-1\relax%
+ \repeatpgfmathloop%
+}
+
+\def\pgf@lib@sh@rs@lefttext{left}
+\def\pgf@lib@sh@rs@righttext{right}
+\def\pgf@lib@sh@rs@centertext{center}
+\def\pgf@lib@sh@rs@bottomtext{bottom}
+\def\pgf@lib@sh@rs@toptext{top}
+\def\pgf@lib@sh@rs@basetext{base}
+\def\pgf@lib@sh@rs@nonetext{none}
+
+
+\newif\ifpgfrectanglesplithorizontal
+\newif\ifpgfrectanglesplitdrawsplits\pgfrectanglesplitdrawsplitstrue
+\newif\ifpgfrectanglesplitignoreemptyparts
+\newif\ifpgfrectanglesplitusecustomfill
+
+\let\pgf@lib@sh@rs@every@emptypart=\pgfutil@empty
+\let\pgf@lib@sh@rs@every@part=\pgfutil@empty
+\def\pgf@lib@sh@rs@list@fill{none}
+
+\pgfkeys{/pgf/.cd,
+ rectangle split parts/.initial=4,
+ rectangle split part align/.initial=center,
+ rectangle split horizontal/.is if=pgfrectanglesplithorizontal,
+ rectangle split ignore empty parts/.is if=pgfrectanglesplitignoreemptyparts,
+ rectangle split empty part width/.code={%
+ \pgfmathsetlength\pgf@x{#1}
+ \edef\pgf@lib@sh@rs@temp{\noexpand\vrule width\the\pgf@x height0ptdepth0pt\relax}%
+ \def\pgf@lib@sh@rs@@temp{\def\pgf@lib@sh@rs@every@emptypart}%
+ \expandafter\expandafter\expandafter\pgf@lib@sh@rs@@temp\expandafter\expandafter\expandafter{%
+ \expandafter\pgf@lib@sh@rs@every@emptypart\pgf@lib@sh@rs@temp}%
+ },%
+ rectangle split empty part width=1ex,
+ rectangle split empty part height/.code={%
+ \pgfmathsetlength\pgf@x{#1}
+ \edef\pgf@lib@sh@rs@temp{\noexpand\vrule width0ptheight\the\pgf@x depth0pt\relax}%
+ \def\pgf@lib@sh@rs@@temp{\def\pgf@lib@sh@rs@every@emptypart}%
+ \expandafter\expandafter\expandafter\pgf@lib@sh@rs@@temp\expandafter\expandafter\expandafter{%
+ \expandafter\pgf@lib@sh@rs@every@emptypart\pgf@lib@sh@rs@temp}%
+ },%
+ rectangle split empty part height=1ex,
+ rectangle split empty part depth/.code={%
+ \pgfmathsetlength\pgf@x{#1}
+ \edef\pgf@lib@sh@rs@temp{\noexpand\vrule width0ptheight0ptdepth\the\pgf@x\relax}%
+ \def\pgf@lib@sh@rs@@temp{\def\pgf@lib@sh@rs@every@emptypart}%
+ \expandafter\expandafter\expandafter\pgf@lib@sh@rs@@temp\expandafter\expandafter\expandafter{%
+ \expandafter\pgf@lib@sh@rs@every@emptypart\pgf@lib@sh@rs@temp}%
+ },%
+ rectangle split empty part depth=0ex,
+ rectangle split every empty part/.store in=\pgf@lib@sh@rs@every@emptypart,
+ rectangle split part fill/.code=\def\pgf@lib@sh@rs@list@fill{#1}\pgfrectanglesplitusecustomfilltrue,
+ rectangle split uses custom fill/.is if=pgfrectanglesplitusecustomfill,
+ rectangle split draw splits/.is if=pgfrectanglesplitdrawsplits,
+ rectangle split allocate boxes/.code=\pgf@lib@sh@allocateboxes{#1}
+}
+
+
+\def\pgf@lib@sh@rs@process@list#1#2{%
+ \c@pgf@counta=1\relax%
+ \c@pgf@countb=#2\relax%
+ \edef\pgf@lib@sh@rs@temp{#1}%
+ \expandafter\pgf@lib@sh@rs@@process@list\pgf@lib@sh@rs@temp,\pgf@stop,}
+
+\def\pgf@lib@sh@rs@@process@list{%
+ \pgfutil@ifnextchar x{\pgf@lib@sh@rs@@@process@list}%
+ {\pgf@lib@sh@rs@@@process@list}}
+
+\def\pgf@lib@sh@rs@@@process@list#1,{%
+ \ifx#1\pgf@stop%
+ \let\pgf@next\pgf@lib@sh@rs@@@@process@list%
+ \else%
+ \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\c@pgf@counta}%
+ \def\pgf@lib@sh@rs@lastalign{#1}%
+ \pgfutil@namedef{pgf@lib@sh@rs@\pgf@lib@sh@toalpha{\c@pgf@counta}@item}{#1}%
+ \let\pgf@next\pgf@lib@sh@rs@@process@list%
+ \advance\c@pgf@counta by1\relax%
+ \fi%
+ \pgf@next}
+
+\def\pgf@lib@sh@rs@@@@process@list{%
+ \pgfmathloop%
+ \ifnum\c@pgf@counta>\c@pgf@countb%
+ \else%
+ \expandafter\edef\csname pgf@lib@sh@rs@\pgf@lib@sh@toalpha{\c@pgf@counta}@item\endcsname%
+ {\pgf@lib@sh@rs@lastalign}%
+ \advance\c@pgf@counta by1\relax%
+ \repeatpgfmathloop%
+}
+
+\pgf@lib@sh@allocateboxes{20}
+
+\pgfdeclareshape{rectangle split}{%
+ \savedmacro\rectanglesplitparameters{%
+ \pgfmathsetcount\c@pgf@counta{\pgfkeysvalueof{/pgf/rectangle split parts}}%
+ \edef\parts{\the\c@pgf@counta}%
+ \addtosavedmacro\parts%
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \edef\innerxsep{\the\pgf@x}%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \edef\innerysep{\the\pgf@y}%
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \edef\outerxsep{\the\pgf@x}%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \edef\outerysep{\the\pgf@y}%
+ \addtosavedmacro\outerxsep%
+ \addtosavedmacro\outerysep%
+ %
+ \pgf@x=0pt\relax% Widest box.
+ \pgf@y=0pt\relax% Tallest box.
+ %
+ \pgfutil@tempdima=0pt\relax% Maximum box height.
+ \pgfutil@tempdimb=0pt\relax% Maximum box depth.
+ %
+ % Get the dimensions of the boxes...
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\parts%
+ \else%
+ \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}%
+ %
+ \expandafter\let\expandafter\pgf@lib@sh@box\expandafter=%
+ \csname pgfnodepart\pgf@lib@sh@rs@number box\endcsname%
+ \pgf@xa=\wd\pgf@lib@sh@box%
+ \pgf@ya=\ht\pgf@lib@sh@box%
+ \pgf@yb=\dp\pgf@lib@sh@box%
+ %
+ % Test to see if the box is empty...
+ %
+ \expandafter\def\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname{\relax}%
+ \ifdim\pgf@xa=0pt\relax%
+ \ifdim\pgf@ya=0pt\relax%
+ \ifdim\pgf@yb=0pt\relax%
+ %
+ % ...It is. So...
+ %
+ \ifpgfrectanglesplitignoreemptyparts%
+ %
+ % ...flag this if we are ignoring parts...
+ %
+ \expandafter\let\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname=\pgfutil@empty%
+ \else%
+ %
+ % ...otherwise insert the code for every empty part.
+ %
+ \setbox\pgf@lib@sh@box=\hbox{{\pgf@lib@sh@rs@every@emptypart}}%
+ \pgf@xa=\wd\pgf@lib@sh@box%
+ \pgf@ya=\ht\pgf@lib@sh@box%
+ \pgf@yb=\dp\pgf@lib@sh@box%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \expandafter\edef\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@number\endcsname{\the\pgf@xa}%
+ \expandafter\edef\csname pgf@lib@sh@rs@height@\pgf@lib@sh@rs@number\endcsname{\the\pgf@ya}%
+ \expandafter\edef\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@number\endcsname{\the\pgf@yb}%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname%
+ %
+ % ...saving the widest box...
+ %
+ \ifdim\pgf@xa>\pgf@x%
+ \pgf@x=\pgf@xa%
+ \fi%
+ %
+ % ...the maximum height and depth...
+ %
+ \ifdim\pgf@ya>\pgfutil@tempdima%
+ \pgfutil@tempdima=\pgf@ya%
+ \fi%
+ \ifdim\pgf@yb>\pgfutil@tempdimb%
+ \pgfutil@tempdimb=\pgf@yb%
+ \fi%
+ %
+ % ...and the tallest box.
+ %
+ \pgf@yc=\pgfutil@tempdima%
+ \advance\pgf@yc by\pgfutil@tempdimb%
+ \ifdim\pgf@yc>\pgf@y%
+ \pgf@y=\pgf@yc%
+ \fi%
+ \repeatpgfmathloop%
+ %
+ \edef\pgf@lib@sh@rs@max@width{\the\pgf@x}%
+ \edef\pgf@lib@sh@rs@max@totalheight{\the\pgf@y}%
+ %
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/minimum width}}%
+ \advance\pgf@x by-\innerxsep\relax%
+ \advance\pgf@x by-\innerxsep\relax%
+ \pgf@xa=\pgf@x%
+ \advance\pgf@xa by-\pgf@lib@sh@rs@max@width\relax%
+ \ifdim\pgf@xa>0pt\relax%
+ \edef\pgf@lib@sh@rs@max@width{\the\pgf@x}%
+ \fi%
+ %
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/minimum height}}%
+ \advance\pgf@y by-\innerysep\relax%
+ \advance\pgf@y by-\innerysep\relax%
+ \pgf@ya=\pgf@y%
+ \advance\pgf@ya by-\pgf@lib@sh@rs@max@totalheight\relax%
+ \ifdim\pgf@ya>0pt\relax%
+ \edef\pgf@lib@sh@rs@max@totalheight{\the\pgf@y}%
+ \fi%
+ %
+ % Get the alignment of each node part box.
+ %
+ \pgf@lib@sh@rs@process@list{\pgfkeysvalueof{/pgf/rectangle split part align}}{\parts}%
+ %
+ % Are we splitting horizontally or vertically?
+ %
+ \ifpgfrectanglesplithorizontal%
+ %
+ % Calculate the origins of each node part box.
+ %
+ \pgf@x=0pt\relax%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\parts%
+ \else%
+ \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}%
+ %
+ \expandafter\let\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname=\pgfutil@empty%
+ \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty%
+ \ifpgfrectanglesplitignoreemptyparts%
+ \expandafter\let\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname=%
+ \pgf@lib@sh@rs@lastanchor%
+ \fi%
+ \fi%
+ %
+ % Adjust for alignment.
+ %
+ \expandafter\ifx\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty%
+ \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname%
+ \pgf@lib@sh@rs@bottomtext%
+ \pgf@y=\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@number\endcsname\relax%
+ \else%
+ \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname%
+ \pgf@lib@sh@rs@toptext%
+ \pgf@y=-\csname pgf@lib@sh@rs@height@\pgf@lib@sh@rs@number\endcsname\relax%
+ \advance\pgf@y by\pgf@lib@sh@rs@max@totalheight\relax%
+ \else%
+ \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname%
+ \pgf@lib@sh@rs@basetext%
+ \pgf@y=\pgf@lib@sh@rs@max@totalheight\relax%
+ \advance\pgf@y by-\pgfutil@tempdima%
+ \advance\pgf@y by\pgfutil@tempdimb%
+ \divide\pgf@y by2\relax%
+ \else%
+ \pgf@y=\pgf@lib@sh@rs@max@totalheight\relax%
+ \advance\pgf@y by-\csname pgf@lib@sh@rs@height@\pgf@lib@sh@rs@number\endcsname\relax%
+ \advance\pgf@y by\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@number\endcsname\relax%
+ \divide\pgf@y by2\relax%
+ \fi%
+ \fi%
+ \fi%
+ %
+ % Re-adjust as the first box is at the origin.
+ %
+ \ifnum\pgfmathcounter=1\relax%
+ \edef\pgf@lib@sh@rs@yoffset{\the\pgf@y}%
+ \pgf@y=0pt\relax%
+ \pgfextract@process\pgf@lib@sh@rs@anchor@one{}%
+ \addtosavedmacro\pgf@lib@sh@rs@anchor@one%
+ \let\pgf@lib@sh@rs@lastanchor=\pgf@lib@sh@rs@anchor@one%
+ \let\pgf@lib@sh@rs@lastnumber=\pgf@lib@sh@rs@number%
+ \else
+ \advance\pgf@y by-\pgf@lib@sh@rs@yoffset\relax%
+ \advance\pgf@x by\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@lastnumber\endcsname\relax%
+ \advance\pgf@x by\innerxsep\relax%
+ \advance\pgf@x by\pgflinewidth%
+ \advance\pgf@x by\innerxsep\relax%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname{}%
+ \expandafter\let\expandafter\pgf@lib@sh@rs@lastanchor\expandafter=%
+ \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname%
+ \let\pgf@lib@sh@rs@lastnumber=\pgf@lib@sh@rs@number%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname%
+ \fi%
+ \fi%
+ \repeatpgfmathloop%
+ %
+ % Calculate some anchors.
+ %
+ \pgfextract@process\northeast{%
+ \pgf@lib@sh@rs@lastanchor%
+ \advance\pgf@x by\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@lastnumber\endcsname\relax%
+ \advance\pgf@x by\innerxsep\relax%
+ \advance\pgf@x by\outerxsep\relax%
+ \pgf@y=\pgf@lib@sh@rs@max@totalheight\relax%
+ \advance\pgf@y by-\pgf@lib@sh@rs@yoffset\relax%
+ \advance\pgf@y by\innerysep\relax%
+ \advance\pgf@y by\outerysep\relax%
+ }%
+ \addtosavedmacro\northeast%
+ \pgfextract@process\southwest{%
+ \pgf@lib@sh@rs@anchor@one%
+ \advance\pgf@x by-\innerxsep\relax%
+ \advance\pgf@x by-\outerxsep\relax%
+ \pgf@y=-\pgf@lib@sh@rs@yoffset\relax%
+ \advance\pgf@y by-\innerysep\relax%
+ \advance\pgf@y by-\outerysep\relax%
+ }%
+ \addtosavedmacro\southwest%
+ %
+ \pgfextract@process\centerpoint{%
+ \pgfpointadd{\southwest}{\northeast}%
+ \divide\pgf@x by2\relax%
+ \divide\pgf@y by2\relax%
+ }%
+ \addtosavedmacro\centerpoint%
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\parts%
+ \else%
+ \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}%
+ %
+ \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty%
+ \else%
+ \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname%
+ \pgf@xa=\pgf@x%
+ \pgf@xb=\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@number\endcsname\relax%
+ \advance\pgf@xa by0.5\pgf@xb%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @south\endcsname{%
+ \southwest%
+ \pgf@x=\pgf@xa%
+ }%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @north\endcsname{%
+ \northeast%
+ \pgf@x=\pgf@xa%
+ }%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @north\endcsname%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @south\endcsname%
+ \ifnum\pgfmathcounter=\parts%
+ \else%
+ \advance\pgf@xa by0.5\pgf@xb%
+ \advance\pgf@xa by\innerxsep\relax%
+ \advance\pgf@xa by.5\pgflinewidth%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@south\endcsname{%
+ \southwest%
+ \pgf@x=\pgf@xa%
+ }%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@north\endcsname{%
+ \northeast%
+ \pgf@x=\pgf@xa%
+ }%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split\endcsname{%
+ \centerpoint%
+ \pgf@x=\pgf@xa%
+ }%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@north\endcsname%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@south\endcsname%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split\endcsname%
+ \fi%
+ \fi%
+ \repeatpgfmathloop%
+ \else%
+ %
+ % Calculate the origins of each node part box.
+ %
+ \pgf@y=0pt\relax%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\parts%
+ \else%
+ \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}%
+ %
+ \expandafter\let\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname=\pgfutil@empty%
+ \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty%
+ \ifpgfrectanglesplitignoreemptyparts%
+ \expandafter\let\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname=%
+ \pgf@lib@sh@rs@lastanchor%
+ \fi%
+ \fi%
+ %
+ % Adjust for alignment.
+ %
+ \expandafter\ifx\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty%
+ \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname%
+ \pgf@lib@sh@rs@lefttext%
+ \pgf@x=0pt\relax%
+ \else%
+ \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname%
+ \pgf@lib@sh@rs@righttext%
+ \pgf@x=-\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@number\endcsname\relax%
+ \advance\pgf@x by\pgf@lib@sh@rs@max@width\relax%
+ \else%
+ \pgf@x=-\csname pgf@lib@sh@rs@width@\pgf@lib@sh@rs@number\endcsname\relax%
+ \advance\pgf@x by\pgf@lib@sh@rs@max@width\relax%
+ \divide\pgf@x by2\relax%
+ \fi%
+ \fi%
+ %
+ % Re-adjust as the first box is at the origin.
+ %
+ \ifnum\pgfmathcounter=1\relax%
+ \edef\pgf@lib@sh@rs@xoffset{\the\pgf@x}%
+ \pgf@x=0pt\relax%
+ \pgfextract@process\pgf@lib@sh@rs@anchor@one{}%
+ \addtosavedmacro\pgf@lib@sh@rs@anchor@one%
+ \let\pgf@lib@sh@rs@lastanchor=\pgf@lib@sh@rs@anchor@one%
+ \let\pgf@lib@sh@rs@lastnumber=\pgf@lib@sh@rs@number%
+ \else
+ \advance\pgf@x by-\pgf@lib@sh@rs@xoffset\relax%
+ \advance\pgf@y by-\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@lastnumber\endcsname\relax%
+ \advance\pgf@y by-\innerysep\relax%
+ \advance\pgf@y by-\pgflinewidth%
+ \advance\pgf@y by-\innerysep\relax%
+ \advance\pgf@y by-\csname pgf@lib@sh@rs@height@\pgf@lib@sh@rs@number\endcsname\relax%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname{}%
+ \expandafter\let\expandafter\pgf@lib@sh@rs@lastanchor\expandafter=%
+ \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname%
+ \let\pgf@lib@sh@rs@lastnumber=\pgf@lib@sh@rs@number%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname%
+ \fi%
+ \fi%
+ \repeatpgfmathloop%
+ %
+ % Calculate some anchors.
+ %
+ \pgfextract@process\northeast{%
+ \pgf@x=\pgf@lib@sh@rs@max@width\relax%
+ \advance\pgf@x by-\pgf@lib@sh@rs@xoffset\relax%
+ \advance\pgf@x by\innerxsep\relax%
+ \advance\pgf@x by\outerxsep\relax%
+ \pgf@y=\pgf@lib@sh@rs@height@one\relax%
+ \advance\pgf@y by\innerysep\relax%
+ \advance\pgf@y by\outerysep\relax%
+ \advance\pgf@y by.5\pgflinewidth%
+ }%
+ \addtosavedmacro\northeast%
+ \pgfextract@process\southwest{%
+ \pgf@lib@sh@rs@lastanchor%
+ \pgf@x=-\pgf@lib@sh@rs@xoffset\relax%
+ \advance\pgf@x by-\innerxsep\relax%
+ \advance\pgf@x by-\outerxsep\relax%
+ \advance\pgf@y by-\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@lastnumber\endcsname\relax%
+ \advance\pgf@y by-\innerysep\relax%
+ \advance\pgf@y by-\outerysep\relax%
+ \advance\pgf@y by-.5\pgflinewidth%
+ }%
+ \addtosavedmacro\southwest%
+ %
+ \pgfextract@process\centerpoint{%
+ \pgfpointadd{\southwest}{\northeast}%
+ \divide\pgf@x by2\relax%
+ \divide\pgf@y by2\relax%
+ }%
+ \addtosavedmacro\centerpoint%
+ %
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\parts%
+ \else%
+ \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}%
+ %
+ \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty%
+ \else%
+ \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname%
+ \pgf@ya=\csname pgf@lib@sh@rs@height@\pgf@lib@sh@rs@number\endcsname\relax%
+ \advance\pgf@y by0.5\pgf@ya%
+ \pgf@ya=\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@number\endcsname\relax%
+ \advance\pgf@y by-0.5\pgf@ya%
+ \pgf@ya=\pgf@y%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @west\endcsname{%
+ \southwest%
+ \pgf@y=\pgf@ya%
+ }%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @east\endcsname{%
+ \northeast%
+ \pgf@y=\pgf@ya%
+ }%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @east\endcsname%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @west\endcsname%
+ \ifnum\pgfmathcounter=\parts%
+ \else%
+ \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number\endcsname%
+ \pgf@ya=\pgf@y%
+ \advance\pgf@ya by-\csname pgf@lib@sh@rs@depth@\pgf@lib@sh@rs@number\endcsname\relax%
+ \advance\pgf@ya by-\innerysep\relax%
+ \advance\pgf@ya by-.5\pgflinewidth%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@west\endcsname{%
+ \southwest%
+ \pgf@y=\pgf@ya%
+ }%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@east\endcsname{%
+ \northeast%
+ \pgf@y=\pgf@ya%
+ }%
+ \expandafter\pgfextract@process\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split\endcsname{%
+ \centerpoint%
+ \pgf@y=\pgf@ya%
+ }%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@east\endcsname%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@west\endcsname%
+ \expandafter\addtosavedmacro\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split\endcsname%
+ \fi%
+ \fi%
+ \repeatpgfmathloop%
+ \fi%
+ }%
+ \savedanchor\basepoint{%
+ \pgf@x=0.5\wd\pgfnodeparttextbox%
+ \pgf@y=0pt\relax%
+ }
+ \savedanchor\midpoint{%
+ \pgf@x=0.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{+0.5ex}%
+ }
+ \anchor{center}{%
+ \rectanglesplitparameters%
+ \centerpoint%
+ }%
+ \anchor{base}{\basepoint}
+ \anchor{base east}{%
+ \rectanglesplitparameters%
+ \northeast%
+ \pgf@y=0pt\relax%
+ }%
+ \anchor{base west}{%
+ \rectanglesplitparameters%
+ \southwest%
+ \pgf@y=0pt\relax%
+ }%
+ \anchor{mid}{\midpoint}%
+ \anchor{mid east}{%
+ \rectanglesplitparameters%
+ \northeast%
+ \pgf@xa=\pgf@x%
+ \midpoint%
+ \pgf@x=\pgf@xa%
+ }%
+ \anchor{mid west}{%
+ \rectanglesplitparameters%
+ \southwest%
+ \pgf@xa=\pgf@x%
+ \midpoint%
+ \pgf@x=\pgf@xa%
+ }%
+ \anchor{north}{%
+ \rectanglesplitparameters%
+ \centerpoint%
+ \pgf@xa=\pgf@x%
+ \northeast%
+ \pgf@x=\pgf@xa%
+ }
+ \anchor{south}{%
+ \rectanglesplitparameters%
+ \centerpoint%
+ \pgf@xa=\pgf@x%
+ \southwest%
+ \pgf@x=\pgf@xa%
+ }
+ \anchor{east}{%
+ \rectanglesplitparameters%
+ \centerpoint%
+ \pgf@ya=\pgf@y%
+ \northeast%
+ \pgf@y=\pgf@ya%
+ }
+ \anchor{west}{%
+ \rectanglesplitparameters%
+ \centerpoint%
+ \pgf@ya=\pgf@y%
+ \southwest%
+ \pgf@y=\pgf@ya%
+ }
+ \anchor{north east}{%
+ \rectanglesplitparameters%
+ \northeast%
+ }
+ \anchor{north west}{%
+ \rectanglesplitparameters%
+ \northeast%
+ \pgf@ya=\pgf@y%
+ \southwest%
+ \pgf@y=\pgf@ya%
+ }
+ \anchor{south west}{%
+ \rectanglesplitparameters%
+ \southwest%
+ }
+ \anchor{south east}{%
+ \rectanglesplitparameters%
+ \southwest%
+ \pgf@ya=\pgf@y%
+ \northeast%
+ \pgf@y=\pgf@ya%
+ }
+ \behindbackgroundpath{%
+ \ifpgfrectanglesplitusecustomfill%
+ \pgf@lib@sh@rs@process@list{\pgf@lib@sh@rs@list@fill}{\parts}%
+ {%
+ \ifpgfrectanglesplithorizontal%
+ \expandafter\let\expandafter\pgf@lib@sh@rs@fill@bottomleft\expandafter=%
+ \csname pgf@anchor@rectangle split@south west\endcsname%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\parts%
+ \else%
+ \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}%
+ \ifnum\pgfmathcounter=\parts%
+ \expandafter\let\expandafter\pgf@lib@sh@rs@fill@topright\expandafter=%
+ \csname pgf@anchor@rectangle split@north east\endcsname%
+ \else%
+ \expandafter\let\expandafter\pgf@lib@sh@rs@fill@topright\expandafter=%
+ \csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@number\space split north\endcsname%
+ \fi%
+ \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty%
+ \else%
+ \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname\pgf@lib@sh@rs@nonetext%
+ \else%
+ \pgfextract@process\pgf@lib@sh@rs@fill@bottomleft{%
+ \pgf@lib@sh@rs@fill@bottomleft%
+ \advance\pgf@y by\outerysep\relax%
+ \ifnum\pgfmathcounter=1\relax%
+ \advance\pgf@x by\outerxsep\relax%
+ \fi%
+ }%
+ \pgfextract@process\pgf@lib@sh@rs@fill@topright{%
+ \pgf@lib@sh@rs@fill@topright%
+ \advance\pgf@y by-\outerysep\relax%
+ \ifnum\pgfmathcounter=\parts\relax%
+ \advance\pgf@x by-\outerxsep\relax%
+ \fi%
+ }%
+ \ifnum\pgfmathcounter>1\relax%
+ \begingroup\pgfsetcornersarced{\pgfpointorigin}%
+ \fi%
+ \pgfpathmoveto{%
+ \pgf@lib@sh@rs@fill@topright%
+ \pgf@xa=\pgf@x%
+ \pgf@lib@sh@rs@fill@bottomleft%
+ \pgf@x=\pgf@xa%
+ }%
+ \pgfpathlineto{\pgf@lib@sh@rs@fill@bottomleft}%
+ \pgfpathlineto{%
+ \pgf@lib@sh@rs@fill@bottomleft%
+ \pgf@xa=\pgf@x%
+ \pgf@lib@sh@rs@fill@topright%
+ \pgf@x=\pgf@xa%
+ }%
+ \ifnum\pgfmathcounter>1\relax%
+ \endgroup%
+ \fi%
+ \ifnum\pgfmathcounter<\parts%
+ \begingroup\pgfsetcornersarced{\pgfpointorigin}%
+ \fi%
+ \pgfpathlineto{\pgf@lib@sh@rs@fill@topright}%
+ \pgfpathclose%
+ \ifnum\pgfmathcounter<\parts%
+ \endgroup%
+ \fi%
+ \pgfsetfillcolor{\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname}%
+ \pgfusepath{fill}%
+ \fi%
+ \fi%
+ \pgfextract@process\pgf@lib@sh@rs@fill@bottomleft{%
+ \pgf@lib@sh@rs@fill@bottomleft%
+ \pgf@ya=\pgf@y%
+ \pgf@lib@sh@rs@fill@topright%
+ \pgf@y=\pgf@ya%
+ \advance\pgf@y by-\outerysep%
+ }%
+ \repeatpgfmathloop%
+ \else%
+ \expandafter\let\expandafter\pgf@lib@sh@rs@fill@topright\expandafter=%
+ \csname pgf@anchor@rectangle split@north east\endcsname%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\parts%
+ \else%
+ \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}%
+ \ifnum\pgfmathcounter=\parts%
+ \expandafter\let\expandafter\pgf@lib@sh@rs@fill@bottomleft\expandafter=%
+ \csname pgf@anchor@rectangle split@south west\endcsname%
+ \else%
+ \expandafter\let\expandafter\pgf@lib@sh@rs@fill@bottomleft\expandafter=%
+ \csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@number\space split west\endcsname%
+ \fi%
+ \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty%
+ \else%
+ \expandafter\ifx\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname\pgf@lib@sh@rs@nonetext%
+ \else%
+ \pgfextract@process\pgf@lib@sh@rs@fill@bottomleft{%
+ \pgf@lib@sh@rs@fill@bottomleft%
+ \advance\pgf@x by\outerxsep\relax%
+ \ifnum\parts=1\relax%
+ \advance\pgf@y by\outerysep\relax%
+ \else%
+ \ifnum\pgfmathcounter=\parts
+ \advance\pgf@y by\outerysep\relax%
+ \fi%
+ \fi%
+ }%
+ \pgfextract@process\pgf@lib@sh@rs@fill@topright{%
+ \pgf@lib@sh@rs@fill@topright%
+ \advance\pgf@x by-\outerxsep\relax%
+ \ifnum\parts=1\relax%
+ \advance\pgf@y by-\outerysep\relax%
+ \else%
+ \ifnum\pgfmathcounter=1\relax%
+ \advance\pgf@y by-\outerysep\relax%
+ \fi%
+ \fi%
+ }%
+ \pgfpathmoveto{\pgf@lib@sh@rs@fill@bottomleft}%
+ \ifnum\pgfmathcounter>1\relax%
+ \begingroup\pgfsetcornersarced{\pgfpointorigin}%
+ \fi%
+ \pgfpathlineto{%
+ \pgf@lib@sh@rs@fill@bottomleft%
+ \pgf@xa=\pgf@x%
+ \pgf@lib@sh@rs@fill@topright%
+ \pgf@x=\pgf@xa%
+ }%
+ \pgfpathlineto{\pgf@lib@sh@rs@fill@topright}%
+ \ifnum\pgfmathcounter>1\relax%
+ \endgroup%%
+ \fi%
+ \ifnum\pgfmathcounter<\parts%
+ \begingroup\pgfsetcornersarced{\pgfpointorigin}%
+ \fi%
+ \pgfpathlineto{%
+ \pgf@lib@sh@rs@fill@topright%
+ \pgf@xa=\pgf@x%
+ \pgf@lib@sh@rs@fill@bottomleft%
+ \pgf@x=\pgf@xa%
+ }%
+ \pgfpathclose%
+ \ifnum\pgfmathcounter<\parts%
+ \endgroup%
+ \fi%
+ \pgfsetfillcolor{\csname pgf@lib@sh@rs@\pgf@lib@sh@rs@number @item\endcsname}%
+ \pgfusepath{fill}%
+ \fi%
+ \fi%
+ \pgfextract@process\pgf@lib@sh@rs@fill@topright{%
+ \pgf@lib@sh@rs@fill@topright%
+ \pgf@xa=\pgf@x%
+ \pgf@lib@sh@rs@fill@bottomleft%
+ \pgf@x=\pgf@xa%
+ \advance\pgf@x by\outerxsep\relax%
+ }%
+ \repeatpgfmathloop%
+ \fi%
+ }%
+ \fi%
+ }%
+ \backgroundpath{%
+ \begingroup%
+ \pgfextract@process\southwest{%
+ \southwest%
+ \advance\pgf@x by\outerxsep\relax%
+ \advance\pgf@y by\outerysep\relax%
+ }%
+ \pgfextract@process\northeast{%
+ \northeast%
+ \advance\pgf@x by-\outerxsep\relax%
+ \advance\pgf@y by-\outerysep\relax%
+ }%
+ \pgfpathrectangle{\southwest}{\pgfpointdiff{\southwest}{\northeast}}%
+ \endgroup%
+ \ifpgfrectanglesplitdrawsplits%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter=\parts%
+ \else%
+ \pgf@lib@sh@getalpha\pgf@lib@sh@rs@number{\pgfmathcounter}%
+ %
+ \expandafter\ifx\csname pgf@lib@sh@rs@empty@\pgf@lib@sh@rs@number\endcsname\pgfutil@empty%
+ \else%
+ \pgfpathmoveto{%
+ \ifpgfrectanglesplithorizontal%
+ \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@north\endcsname%
+ \advance\pgf@y by-\outerysep\relax%
+ \else%
+ \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@east\endcsname%
+ \advance\pgf@x by-\outerxsep\relax%
+ \fi%
+ }%
+ \pgfpathlineto{%
+ \ifpgfrectanglesplithorizontal%
+ \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@south\endcsname%
+ \advance\pgf@y by\outerysep\relax%
+ \else%
+ \csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@number @split@west\endcsname%
+ \advance\pgf@x by\outerxsep\relax%
+ \fi%
+ }%
+ \fi%
+ \repeatpgfmathloop%
+ \fi%
+ }%
+ \anchorborder{%
+ \pgfutil@tempdima\pgf@x%
+ \pgfutil@tempdimb\pgf@y%
+ \rectanglesplitparameters%
+ \pgfpointdiff{\southwest}{\northeast}%
+ \pgf@x.5\pgf@x%
+ \pgf@y.5\pgf@y%
+ \edef\pgf@marshall{%
+ \noexpand\pgfpointborderrectangle{%
+ \noexpand\pgfqpoint{\the\pgfutil@tempdima}{\the\pgfutil@tempdimb}%
+ }%
+ {%
+ \noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}%
+ }%
+ }%
+ \pgf@marshall%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \centerpoint%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+ %
+ % Hackery to install the correct number of node parts.
+ %
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@rectangle split\endcsname{%
+ \let\pgf@lib@sh@rs@temp=\pgfutil@empty%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter=\parts%
+ \expandafter\edef\csname pgf@sh@boxes@rectangle split\endcsname%
+ {\pgf@lib@sh@rs@temp\pgf@lib@sh@toalpha{\pgfmathcounter}}%
+ \else%
+ \edef\pgf@lib@sh@rs@temp{\pgf@lib@sh@rs@temp\pgf@lib@sh@toalpha{\pgfmathcounter},}%
+ \repeatpgfmathloop%
+ }%
+}
+
+\pgfutil@for\pgf@lib@sh@rs@temp:={one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve,thirteen,fourteen,fifteen,sixteen,seventeen,eighteen,nineteen,twenty}\do{%
+ \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\endcsname{%
+ \noexpand\rectanglesplitparameters%
+ \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp}{\noexpand\pgf@lib@sh@rs@anchor@one}%
+ {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp\noexpand\endcsname}%
+ }%
+ \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space split\endcsname{%
+ \noexpand\rectanglesplitparameters%
+ \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split}%
+ {\noexpand\centerpoint}%
+ {\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split\noexpand\endcsname}%
+ }%
+ \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space split north\endcsname{%
+ \noexpand\rectanglesplitparameters%
+ \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@north}%
+ {\noexpand\csname pgf@anchor@rectangle split@north\noexpand\endcsname}%
+ {\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@north\noexpand\endcsname}%
+ }%
+ \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space split south\endcsname{%
+ \noexpand\rectanglesplitparameters%
+ \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@south}%
+ {\noexpand\csname pgf@anchor@rectangle split@south\noexpand\endcsname}%
+ {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@south\noexpand\endcsname}%
+ }%
+ \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space north\endcsname{%
+ \noexpand\rectanglesplitparameters%
+ \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @north}%
+ {\noexpand\csname pgf@anchor@rectangle split@north\noexpand\endcsname}%
+ {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @north\noexpand\endcsname}%
+ }%
+ \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space south\endcsname{%
+ \noexpand\rectanglesplitparameters%
+ \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @south}%
+ {\noexpand\csname pgf@anchor@rectangle split@south\noexpand\endcsname}%
+ {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @south\noexpand\endcsname}%
+ }%
+ \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space split east\endcsname{%
+ \noexpand\rectanglesplitparameters%
+ \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@east}%
+ {\noexpand\csname pgf@anchor@rectangle split@east\noexpand\endcsname}%
+ {\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@east\noexpand\endcsname}%
+ }%
+ \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space split west\endcsname{%
+ \noexpand\rectanglesplitparameters%
+ \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@west}%
+ {\noexpand\csname pgf@anchor@rectangle split@west\noexpand\endcsname}%
+ {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @split@west\noexpand\endcsname}%
+ }%
+ \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space east\endcsname{%
+ \noexpand\rectanglesplitparameters%
+ \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @east}%
+ {\noexpand\csname pgf@anchor@rectangle split@east\noexpand\endcsname}%
+ {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @east\noexpand\endcsname}%
+ }%
+ \expandafter\xdef\csname pgf@anchor@rectangle split@\pgf@lib@sh@rs@temp\space west\endcsname{%
+ \noexpand\rectanglesplitparameters%
+ \noexpand\pgfutil@ifundefined{pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @west}%
+ {\noexpand\csname pgf@anchor@rectangle split@west\noexpand\endcsname}%
+ {\noexpand\csname pgf@lib@sh@rs@anchor@\pgf@lib@sh@rs@temp @west\noexpand\endcsname}%
+ }%
+}%
+
+
+\pgfutil@namelet{pgf@anchor@rectangle split@text east}{pgf@anchor@rectangle split@one east}
+\pgfutil@namelet{pgf@anchor@rectangle split@text west}{pgf@anchor@rectangle split@one west}
+\pgfutil@namelet{pgf@anchor@rectangle split@text split}{pgf@anchor@rectangle split@one split}
+\pgfutil@namelet{pgf@anchor@rectangle split@text split east}{pgf@anchor@rectangle split@one split east}
+\pgfutil@namelet{pgf@anchor@rectangle split@text split west}{pgf@anchor@rectangle split@one split west}
+
+\pgfutil@namelet{pgf@anchor@rectangle split@second}{pgf@anchor@rectangle split@two}
+\pgfutil@namelet{pgf@anchor@rectangle split@second east}{pgf@anchor@rectangle split@two east}
+\pgfutil@namelet{pgf@anchor@rectangle split@second west}{pgf@anchor@rectangle split@two west}
+\pgfutil@namelet{pgf@anchor@rectangle split@second split}{pgf@anchor@rectangle split@two split}
+\pgfutil@namelet{pgf@anchor@rectangle split@second split east}{pgf@anchor@rectangle split@two split east}
+\pgfutil@namelet{pgf@anchor@rectangle split@second split west}{pgf@anchor@rectangle split@two split west}
+
+\pgfutil@namelet{pgf@anchor@rectangle split@third}{pgf@anchor@rectangle split@three}
+\pgfutil@namelet{pgf@anchor@rectangle split@third east}{pgf@anchor@rectangle split@three east}
+\pgfutil@namelet{pgf@anchor@rectangle split@third west}{pgf@anchor@rectangle split@three west}
+\pgfutil@namelet{pgf@anchor@rectangle split@third split}{pgf@anchor@rectangle split@three split}
+\pgfutil@namelet{pgf@anchor@rectangle split@third split east}{pgf@anchor@rectangle split@three split east}
+\pgfutil@namelet{pgf@anchor@rectangle split@third split west}{pgf@anchor@rectangle split@three split west}
+
+\pgfutil@namelet{pgf@anchor@rectangle split@fourth}{pgf@anchor@rectangle split@four}
+\pgfutil@namelet{pgf@anchor@rectangle split@fourth east}{pgf@anchor@rectangle split@four east}
+\pgfutil@namelet{pgf@anchor@rectangle split@fourth west}{pgf@anchor@rectangle split@four west}
+\pgfutil@namelet{pgf@anchor@rectangle split@fourth split}{pgf@anchor@rectangle split@four split}
+\pgfutil@namelet{pgf@anchor@rectangle split@fourth split east}{pgf@anchor@rectangle split@four split east}
+\pgfutil@namelet{pgf@anchor@rectangle split@fourth split west}{pgf@anchor@rectangle split@four split west}
+
+
+
+
+% Shape: ellipse split.
+%
+\pgfdeclareshape{ellipse split}{%
+ \nodeparts{text,lower}
+ \savedanchor\radii{%
+ \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/inner xsep}}%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \pgf@y2.0\pgf@y%
+ \advance\pgf@y.5\pgflinewidth%
+ \pgf@xa.5\wd\pgfnodeparttextbox%
+ \pgf@xb.5\wd\pgfnodepartlowerbox%
+ \advance\pgf@xa\pgf@x%
+ \advance\pgf@xb\pgf@x%
+ \pgf@ya\ht\pgfnodeparttextbox%
+ \advance\pgf@ya\dp\pgfnodeparttextbox%
+ \pgf@yb\ht\pgfnodepartlowerbox%
+ \advance\pgf@yb\dp\pgfnodepartlowerbox%
+ \advance\pgf@ya\pgf@y%
+ \advance\pgf@yb\pgf@y%
+ \ifdim\pgf@xa>\pgf@xb%
+ \pgf@x1.414213\pgf@xa%
+ \else%
+ \pgf@x1.414213\pgf@xb%
+ \fi%
+ \ifdim\pgf@ya>\pgf@yb%
+ \pgf@y1.414213\pgf@ya%
+ \else%
+ \pgf@y1.414213\pgf@yb%
+ \fi%
+ \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
+ \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
+ \ifdim\pgf@x<.5\pgf@xa%
+ \pgf@x.5\pgf@xa%
+ \fi%
+ \ifdim\pgf@y<.5\pgf@ya%
+ \pgf@y.5\pgf@ya%
+ \fi%
+ \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/outer ysep}}%
+ }
+ \savedanchor\lower{%
+ \pgf@x-.5\wd\pgfnodepartlowerbox%
+ \advance\pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/inner ysep}}%
+ \pgf@y-2.0\pgf@y%
+ \advance\pgf@y-\pgflinewidth%
+ \advance\pgf@y-\dp\pgfnodeparttextbox%
+ \advance\pgf@y-\ht\pgfnodepartlowerbox%
+ }
+ \savedanchor\centerpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{-\pgfkeysvalueof{/pgf/inner ysep}}%
+ \advance\pgf@y-\dp\pgfnodeparttextbox%
+ \advance\pgf@y-.5\pgflinewidth%
+ }%
+ \savedanchor\basepoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgf@y0pt\relax%
+ }%
+ \savedanchor\midpoint{%
+ \pgf@x.5\wd\pgfnodeparttextbox%
+ \pgfmathsetlength\pgf@y{.5ex}%
+ }%
+ \anchor{center}{\centerpoint}
+ \anchor{lower}{\lower}
+ \anchor{mid}{\midpoint}
+ \anchor{mid east}{\radii\pgf@xa\pgf@x\midpoint\advance\pgf@x\pgf@xa}
+ \anchor{mid west}{\radii\pgf@xa\pgf@x\midpoint\advance\pgf@x-\pgf@xa}
+ \anchor{base}{\basepoint}
+ \anchor{base east}{\radii\pgf@xa\pgf@x\basepoint\advance\pgf@x\pgf@xa}
+ \anchor{base west}{\radii\pgf@xa\pgf@x\basepoint\advance\pgf@x-\pgf@xa}
+ \anchor{north}{\pgfpointadd{\centerpoint}{\radii\pgf@x0pt}}%
+ \anchor{south}{\pgfpointadd{\centerpoint}{\radii\pgf@x0pt\pgf@y-\pgf@y}}%
+ \anchor{east}{\pgfpointadd{\centerpoint}{\radii\pgf@y0pt}}%
+ \anchor{west}{\pgfpointadd{\centerpoint}{\radii\pgf@x-\pgf@x\pgf@y0pt}}%
+ \anchor{north west}{\pgfpointadd{\centerpoint}{\radii\pgf@x-0.707106\pgf@x\pgf@y0.707106\pgf@y}}%
+ \anchor{south west}{\pgfpointadd{\centerpoint}{\radii\pgf@x-0.707106\pgf@x\pgf@y-0.707106\pgf@y}}%
+ \anchor{north east}{\pgfpointadd{\centerpoint}{\radii\pgf@x0.707106\pgf@x\pgf@y0.707106\pgf@y}}%
+ \anchor{south east}{\pgfpointadd{\centerpoint}{\radii\pgf@x0.707106\pgf@x\pgf@y-0.707106\pgf@y}}%
+ \backgroundpath{%
+ \radii%
+ \pgfmathaddtolength\pgf@x{-\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathaddtolength\pgf@y{-\pgfkeysvalueof{/pgf/outer ysep}}%
+ \pgfutil@tempdima\pgf@x%
+ \pgfutil@tempdimb\pgf@y%
+ \pgfpathellipse{\centerpoint}{\pgfqpoint{\the\pgfutil@tempdima}{0pt}}{\pgfqpoint{0pt}{\the\pgfutil@tempdimb}}%
+ \pgfpathmoveto{\centerpoint\advance\pgf@x-\pgfutil@tempdima}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x\pgfutil@tempdima}%
+ }
+ \anchorborder{%
+ \pgfextract@process\externalpoint{}%
+ \radii%
+ \edef\pgf@marshal{%
+ \noexpand\pgfpointadd{\noexpand\pgfpointborderellipse{\noexpand\externalpoint}%
+ {\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}}{\noexpand\centerpoint}%
+ }%
+ \pgf@marshal%
+ }%
+}
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.symbols.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.symbols.code.tex
index 152ee00c4fb..b419a8cb624 100644
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.symbols.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.symbols.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/libraries/pgflibraryshapes.symbols.code.tex,v 1.13 2008/01/30 07:56:38 vibrovski Exp $
+\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/shapes/pgflibraryshapes.symbols.code.tex,v 1.3 2009/10/27 23:03:12 tantau Exp $
\pgfdeclareshape{forbidden sign}
{
@@ -1377,72 +1377,56 @@
% Internal macros for signal shape.
%
-\def\pgf@lib@shapes@signal@nowhere{nowhere}%
-\def\pgf@lib@shapes@signal@from{from}%
-\def\pgf@lib@shapes@signal@to{to}%
+\def\pgf@lib@sh@signal@nowhere{nowhere}%
+\def\pgf@lib@sh@signal@from{from}%
+\def\pgf@lib@sh@signal@to{to}%
-\let\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@nowhere%
-\let\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@nowhere%
-\let\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@nowhere%
-\let\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@nowhere%
+\def\pgf@lib@sh@signal@parsedirection#1#2{%
+ %
+ \let\pgf@lib@sh@signal@direction=#2%
+ \edef\pgf@lib@sh@temp{#1}%
+ \expandafter\pgf@lib@sh@signal@@parsedirection\pgf@lib@sh@temp\pgf@stop}
-\def\pgf@lib@shapes@signal@parsedirection#1#2{%
- \let\pgf@lib@shapes@signal@direction#2%
+\def\pgf@lib@sh@signal@@parsedirection#1\pgf@stop{%
\pgfutil@in@{and}{#1}%
\ifpgfutil@in@%
- \pgf@lib@shapes@signal@@parsedirection#1\pgf@lib%
+ \pgf@lib@sh@signal@@@parsedirection#1\pgf@lib%
\else%
- \pgf@lib@shapes@signal@@parsedirection#1 and #1\pgf@lib%
+ \pgf@lib@sh@signal@@@parsedirection#1 and #1\pgf@lib%
\fi
}
-\def\pgf@lib@shapes@signal@@parsedirection#1 and #2\pgf@lib{%
+\def\pgf@lib@sh@signal@@@parsedirection#1 and #2\pgf@lib{%
\pgfutil@in@{nowhere}{#1}%
\ifpgfutil@in@
- \pgf@lib@shapes@signal@@donowhere%
\else%
- \pgf@lib@shapes@signal@@@parsedirection{#1}%
- \pgf@lib@shapes@signal@@@parsedirection{#2}%
+ \pgf@lib@sh@signal@@@@parsedirection{#1}%
+ \pgf@lib@sh@signal@@@@parsedirection{#2}%
\fi%
}
-\def\pgf@lib@shapes@signal@@@parsedirection#1{%
+\def\pgf@lib@sh@signal@@@@parsedirection#1{%
\pgfutil@in@{ #1 }{ east right }%
\ifpgfutil@in@%
- \let\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@direction%
- \let\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@nowhere%
- \let\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@nowhere%
+ \let\pgf@lib@sh@signal@east=\pgf@lib@sh@signal@direction%
+ \let\pgf@lib@sh@signal@north=\pgf@lib@sh@signal@nowhere%
+ \let\pgf@lib@sh@signal@south=\pgf@lib@sh@signal@nowhere%
\fi%
\pgfutil@in@{ #1 }{ left west }%
\ifpgfutil@in@%
- \let\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@direction%
- \let\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@nowhere%
- \let\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@nowhere%
+ \let\pgf@lib@sh@signal@west=\pgf@lib@sh@signal@direction%
+ \let\pgf@lib@sh@signal@north=\pgf@lib@sh@signal@nowhere%
+ \let\pgf@lib@sh@signal@south=\pgf@lib@sh@signal@nowhere%
\fi%
\pgfutil@in@{ #1 }{ above up north }%
\ifpgfutil@in@%
- \let\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@direction%
- \let\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@nowhere%
- \let\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@nowhere%
+ \let\pgf@lib@sh@signal@north=\pgf@lib@sh@signal@direction%
+ \let\pgf@lib@sh@signal@east=\pgf@lib@sh@signal@nowhere%
+ \let\pgf@lib@sh@signal@west=\pgf@lib@sh@signal@nowhere%
\fi%
\pgfutil@in@{ #1 }{ below down south }%
\ifpgfutil@in@%
- \let\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@direction%
- \let\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@nowhere%
- \let\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@nowhere%
- \fi%
-}
-
-\def\pgf@lib@shapes@signal@@donowhere{%
- \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@direction%
- \pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@nowhere%
- \fi%
- \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@direction%
- \pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@nowhere%
- \fi%
- \ifx\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@direction%
- \pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@nowhere%
- \fi%
- \ifx\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@direction%
- \pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@nowhere%
+ \let\pgf@lib@sh@signal@south=\pgf@lib@sh@signal@direction%
+ \let\pgf@lib@sh@signal@east=\pgf@lib@sh@signal@nowhere%
+ \let\pgf@lib@sh@signal@west=\pgf@lib@sh@signal@nowhere%
\fi%
}
@@ -1451,23 +1435,21 @@
%
\pgfkeys{/pgf/.cd,
signal pointer angle/.initial=90,
- signal from/.code={\pgf@lib@shapes@signal@parsedirection{#1}{\pgf@lib@shapes@signal@from}},
- signal to/.code={\pgf@lib@shapes@signal@parsedirection{#1}{\pgf@lib@shapes@signal@to}}
-}
-
-
-\pgfkeys{/pgf/.cd,
- signal to=east,
- signal from=nowhere
+ signal to/.initial=east,
+ signal from/.initial=nowhere
}
-
-% Shape signal
-%
-%
\pgfdeclareshape{signal}{%
\savedmacro\installsignalparameters{%
%
+ \let\pgf@lib@sh@signal@north=\pgf@lib@sh@signal@nowhere%
+ \let\pgf@lib@sh@signal@south=\pgf@lib@sh@signal@nowhere%
+ \let\pgf@lib@sh@signal@east=\pgf@lib@sh@signal@nowhere%
+ \let\pgf@lib@sh@signal@west=\pgf@lib@sh@signal@nowhere%
+ %
+ \pgf@lib@sh@signal@parsedirection{\pgfkeysvalueof{/pgf/signal from}}{\pgf@lib@sh@signal@from}%
+ \pgf@lib@sh@signal@parsedirection{\pgfkeysvalueof{/pgf/signal to}}{\pgf@lib@sh@signal@to}%
+ %
% Define a centerpoint.
%
\pgfextract@process\centerpoint{%
@@ -1479,16 +1461,22 @@
% Get some useful trig. stuff
%
\pgfmathsetmacro\pointerangle{\pgfkeysvalueof{/pgf/signal pointer angle}}%
+ %
\pgfmathdivide@{\pointerangle}{2}%
- \let\halfpointerangle\pgfmathresult%
+ \let\halfpointerangle=\pgfmathresult%
+ %
\pgfmathcosec@{\halfpointerangle}%
- \let\cosechalfpointerangle\pgfmathresult%
+ \let\cosechalfpointerangle=\pgfmathresult%
+ %
\pgfmathdivide@{\halfpointerangle}{2}%
- \let\quarterpointerangle\pgfmathresult%
+ \let\quarterpointerangle=\pgfmathresult%
+ %
\pgfmathcosec@{\quarterpointerangle}%
- \let\cosecquarterpointerangle\pgfmathresult%
+ \let\cosecquarterpointerangle=\pgfmathresult%
+ %
\pgfmathsec@{\quarterpointerangle}%
- \let\secquarterpointerangle\pgfmathresult%
+ \let\secquarterpointerangle=\pgfmathresult%
+ %
\pgfmathsubtract@{90}{\quarterpointerangle}%
\let\complementquarterpointerangle\pgfmathresult%
%
@@ -1499,21 +1487,21 @@
\ifdim\pgf@x>\pgf@y%
\pgf@y\pgf@x%
\fi%
- \pgf@yc\pgf@y%
+ \pgf@yc=\pgf@y%
%
% Calculate the miter due to the line width, at the pointer apex...
%
- \pgf@x\cosechalfpointerangle\pgf@y%
+ \pgf@x=\cosechalfpointerangle\pgf@y%
\edef\pointerapexmiter{\the\pgf@x}%
%
% ...at a corner by a `to' pointer (i.e. sticks out)...
%
- \pgf@x\secquarterpointerangle\pgf@y%
+ \pgf@x=\secquarterpointerangle\pgf@y%
\edef\tocornermiter{\the\pgf@x}%
%
% ...at a corner by a `from' pointer (i.e. sticks in).
%
- \pgf@x\cosecquarterpointerangle\pgf@y
+ \pgf@x=\cosecquarterpointerangle\pgf@y
\edef\fromcornermiter{\the\pgf@x}%
%
% Get the (half) dimensions of the node.
@@ -1528,52 +1516,67 @@
%
\pgfmathsubtract@{90}{\halfpointerangle}%
\pgfmathtan@{\pgfmathresult}%
- \pgf@xb\pgfmathresult\pgf@ya%
+ \pgf@xb=\pgfmathresult\pgf@ya%
%
% ...and up.
%
- \pgf@yb\pgfmathresult\pgf@xa%
+ \pgf@yb=\pgfmathresult\pgf@xa%
%
% Adjust for minimum height.
%
- \pgfutil@tempdima2.0\pgf@ya%
- \ifx\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@nowhere%
+ \pgfutil@tempdima=2.0\pgf@ya%
+ \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@nowhere%
\else%
- \advance\pgfutil@tempdima\pgf@yb%
+ \advance\pgfutil@tempdima by\pgf@yb%
\fi%
- \ifx\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@nowhere%
+ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@nowhere%
\else%
- \advance\pgfutil@tempdima\pgf@yb%
+ \advance\pgfutil@tempdima by\pgf@yb%
\fi%
\pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/minimum height}}%
\ifdim\pgfutil@tempdima<\pgf@y%
- \pgfmathreciprocal@{\pgfmath@tonumber{\pgfutil@tempdima}}%
- \pgfutil@tempdima\pgfmathresult\pgf@y%
- \pgf@xa\pgfmath@tonumber{\pgfutil@tempdima}\pgf@xa%
- \pgf@ya\pgfmath@tonumber{\pgfutil@tempdima}\pgf@ya%
- \pgf@xb\pgfmath@tonumber{\pgfutil@tempdima}\pgf@xb%
- \pgf@yb\pgfmath@tonumber{\pgfutil@tempdima}\pgf@yb%
+ \pgfutil@tempdima=\pgf@y%
+ %
+ \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@nowhere%
+ \else%
+ \advance\pgfutil@tempdima by-\pgf@yb%
+ \fi%
+ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@nowhere%
+ \else%
+ \advance\pgfutil@tempdima by-\pgf@yb%
+ \fi%
+ \pgf@ya=0.5\pgfutil@tempdima%
+ \pgfmathsubtract@{90}{\halfpointerangle}%
+ \pgfmathtan@{\pgfmathresult}%
+ \pgf@xb=\pgfmathresult\pgf@ya%
\fi%
%
% Adjust for minimum width.
%
- \pgfutil@tempdima2.0\pgf@xa%
- \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@nowhere%
+ \pgfutil@tempdima=2.0\pgf@xa%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere%
\else%
- \advance\pgfutil@tempdima\pgf@xb%
+ \advance\pgfutil@tempdima by\pgf@xb%
\fi%
- \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@nowhere%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere%
\else%
- \advance\pgfutil@tempdima\pgf@xb%
+ \advance\pgfutil@tempdima by\pgf@xb%
\fi%
\pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/minimum width}}%
\ifdim\pgfutil@tempdima<\pgf@x%
- \pgfmathreciprocal@{\pgfmath@tonumber{\pgfutil@tempdima}}%
- \pgfutil@tempdima\pgfmathresult\pgf@x%
- \pgf@xa\pgfmath@tonumber{\pgfutil@tempdima}\pgf@xa%
- \pgf@ya\pgfmath@tonumber{\pgfutil@tempdima}\pgf@ya%
- \pgf@xb\pgfmath@tonumber{\pgfutil@tempdima}\pgf@xb%
- \pgf@yb\pgfmath@tonumber{\pgfutil@tempdima}\pgf@yb%
+ \pgfutil@tempdima=\pgf@x%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere%
+ \else%
+ \advance\pgfutil@tempdima by-\pgf@xb%
+ \fi%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere%
+ \else%
+ \advance\pgfutil@tempdima by-\pgf@xb%
+ \fi%
+ \pgf@xa=0.5\pgfutil@tempdima%
+ \pgfmathsubtract@{90}{\halfpointerangle}%
+ \pgfmathtan@{\pgfmathresult}%
+ \pgf@yb=\pgfmathresult\pgf@xa%
\fi%
%
% So, define the points for the background path.
@@ -1581,28 +1584,28 @@
\pgfextract@process\north{%
\centerpoint%
\advance\pgf@y\pgf@ya%
- \ifx\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@to%
+ \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@to%
\advance\pgf@y\pgf@yb%
\fi%
}%
\pgfextract@process\south{%
\centerpoint%
\advance\pgf@y-\pgf@ya%
- \ifx\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@to%
+ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@to%
\advance\pgf@y-\pgf@yb%
\fi%
}%
\pgfextract@process\east{%
\centerpoint%
\advance\pgf@x\pgf@xa%
- \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@to%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@to%
\advance\pgf@x\pgf@xb%
\fi%
}%
\pgfextract@process\west{%
\centerpoint%
\advance\pgf@x-\pgf@xa%
- \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@to%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@to%
\advance\pgf@x-\pgf@xb%
\fi%
}%
@@ -1610,10 +1613,10 @@
\centerpoint%
\advance\pgf@y\pgf@ya%
\advance\pgf@x\pgf@xa%
- \ifx\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@from%
+ \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@from%
\advance\pgf@y\pgf@yb%
\fi%
- \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@from%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@from%
\advance\pgf@x\pgf@xb%
\fi%
}%
@@ -1621,10 +1624,10 @@
\centerpoint%
\advance\pgf@y-\pgf@ya%
\advance\pgf@x\pgf@xa%
- \ifx\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@from%
+ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@from%
\advance\pgf@y-\pgf@yb%
\fi%
- \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@from%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@from%
\advance\pgf@x\pgf@xb%
\fi%
}%
@@ -1632,10 +1635,10 @@
\centerpoint%
\advance\pgf@y-\pgf@ya%
\advance\pgf@x-\pgf@xa%
- \ifx\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@from%
+ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@from%
\advance\pgf@y-\pgf@yb%
\fi%
- \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@from%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@from%
\advance\pgf@x-\pgf@xb%
\fi%
}%
@@ -1643,10 +1646,10 @@
\centerpoint%
\advance\pgf@y\pgf@ya%
\advance\pgf@x-\pgf@xa%
- \ifx\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@from%
+ \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@from%
\advance\pgf@y\pgf@yb%
\fi%
- \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@from%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@from%
\advance\pgf@x-\pgf@xb%
\fi%
}%
@@ -1663,7 +1666,7 @@
%
\pgfextract@process\northmiter{%
\pgf@x0pt%
- \ifx\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@nowhere%
+ \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@nowhere%
\pgf@y\pgf@yc%
\else%
\pgf@y\pointerapexmiter\relax%
@@ -1671,7 +1674,7 @@
}%
\pgfextract@process\southmiter{%
\pgf@x0pt%
- \ifx\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@nowhere%
+ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@nowhere%
\pgf@y-\pgf@yc%
\else%
\pgf@y-\pointerapexmiter\relax%
@@ -1679,7 +1682,7 @@
}%
\pgfextract@process\eastmiter{%
\pgf@y0pt%
- \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@nowhere%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere%
\pgf@x\pgf@yc%
\else%
\pgf@x\pointerapexmiter\relax%
@@ -1687,99 +1690,99 @@
}%
\pgfextract@process\westmiter{%
\pgf@y0pt%
- \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@nowhere%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere%
\pgf@x-\pgf@yc%
\else%
\pgf@x-\pointerapexmiter\relax%
\fi%
}%
\pgfextract@process\northeastmiter{%
- \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@nowhere%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere%
\pgf@x\pgf@yc
\pgf@y\pgf@yc%
\else
- \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@from%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@from%
\pgfqpointpolar{\quarterpointerangle}{\fromcornermiter}
\else%
- \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@to%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@to%
\pgfqpointpolar{\complementquarterpointerangle}{\tocornermiter}%
\fi%
\fi%
\fi%
- \ifx\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@from%
+ \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@from%
\pgfqpointpolar{\complementquarterpointerangle}{\fromcornermiter}%
\else%
- \ifx\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@to%
+ \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@to%
\pgfqpointpolar{\quarterpointerangle}{\tocornermiter}%
\fi%
\fi%
}%
\pgfextract@process\southeastmiter{%
- \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@nowhere%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@nowhere%
\pgf@x\pgf@yc%
\pgf@y\pgf@yc%
\else
- \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@from%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@from%
\pgfqpointpolar{-\quarterpointerangle}{\fromcornermiter}
\else%
- \ifx\pgf@lib@shapes@signal@east\pgf@lib@shapes@signal@to%
+ \ifx\pgf@lib@sh@signal@east\pgf@lib@sh@signal@to%
\pgfqpointpolar{-\complementquarterpointerangle}{\tocornermiter}%
\fi%
\fi%
\fi%
- \ifx\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@from%
+ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@from%
\pgfqpointpolar{-\complementquarterpointerangle}{\fromcornermiter}
\else%
- \ifx\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@to%
+ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@to%
\pgfqpointpolar{-\quarterpointerangle}{\tocornermiter}%
\fi%
\fi%
}%
\pgfextract@process\southwestmiter{%
- \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@nowhere%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere%
\pgf@x-\pgf@yc
\pgf@y-\pgf@yc%
\else
- \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@from%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@from%
\pgfmathadd@{\quarterpointerangle}{180}%
\expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\fromcornermiter}
\else%
- \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@to%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@to%
\pgfmathadd@{\complementquarterpointerangle}{180}%
\expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}%
\fi%
\fi%
\fi%
- \ifx\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@from%
+ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@from%
\pgfmathadd@{\complementquarterpointerangle}{180}%
\expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\fromcornermiter}%
\else%
- \ifx\pgf@lib@shapes@signal@south\pgf@lib@shapes@signal@to%
+ \ifx\pgf@lib@sh@signal@south\pgf@lib@sh@signal@to%
\pgfmathadd@{\quarterpointerangle}{180}%
\expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}%
\fi%
\fi%
}%
\pgfextract@process\northwestmiter{%
- \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@nowhere%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@nowhere%
\pgf@x-\pgf@yc%
\pgf@y\pgf@yc%
\else
- \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@from%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@from%
\pgfmathsubtract@{180}{\quarterpointerangle}%
\expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\fromcornermiter}
\else%
- \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@to%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@to%
\pgfmathsubtract@{180}{\complementquarterpointerangle}%
\expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}%
\fi%
\fi%
\fi%
- \ifx\pgf@lib@shapes@signal@north\pgf@lib@shapes@signal@from%
+ \ifx\pgf@lib@sh@signal@north\pgf@lib@sh@signal@from%
\pgfmathsubtract@{180}{\complementquarterpointerangle}%
\expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\fromcornermiter}%
\else%
- \ifx\pgf@lib@shapes@signal@west\pgf@lib@shapes@signal@to%
+ \ifx\pgf@lib@sh@signal@west\pgf@lib@sh@signal@to%
\pgfmathsubtract@{180}{\quarterpointerangle}%
\expandafter\pgfqpointpolar\expandafter{\pgfmathresult}{\tocornermiter}%
\fi%
@@ -2051,7 +2054,6 @@
-
% Keys for shape tape
%
% /pgf/tape bend top : Type of bend for north side.
@@ -2510,4 +2512,60 @@
\fi%
\fi%
}%
-} \ No newline at end of file
+}
+
+
+
+
+% Keys for magnifying glass shape
+%
+% /pgf/magnifying glass handle angle : The angle of handle
+% /pgf/magnifying glass handle aspect : The length of the handle as a multiple
+% of the radius of the circle
+%
+
+\pgfkeys{/pgf/.cd,
+ magnifying glass handle angle/.initial=-45,
+ magnifying glass handle aspect/.initial=1.5
+}
+
+\pgfdeclareshape{magnifying glass}
+{
+ \inheritsavedanchors[from=circle] % this is nearly a circle
+ \inheritanchorborder[from=circle]
+ \inheritanchor[from=circle]{north}
+ \inheritanchor[from=circle]{north west}
+ \inheritanchor[from=circle]{north east}
+ \inheritanchor[from=circle]{center}
+ \inheritanchor[from=circle]{west}
+ \inheritanchor[from=circle]{east}
+ \inheritanchor[from=circle]{mid}
+ \inheritanchor[from=circle]{mid west}
+ \inheritanchor[from=circle]{mid east}
+ \inheritanchor[from=circle]{base}
+ \inheritanchor[from=circle]{base west}
+ \inheritanchor[from=circle]{base east}
+ \inheritanchor[from=circle]{south}
+ \inheritanchor[from=circle]{south west}
+ \inheritanchor[from=circle]{south east}
+ \inheritbackgroundpath[from=circle]
+ \foregroundpath{
+ \centerpoint%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgfutil@tempdima=\radius%
+ \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@xb<\pgf@yb%
+ \advance\pgfutil@tempdima by-\pgf@yb%
+ \else%
+ \advance\pgfutil@tempdima by-\pgf@xb%
+ \fi%
+ \pgfpathmoveto{\pgfpointadd{\pgfqpoint{\pgf@xc}{\pgf@yc}}
+ {\pgfpointpolar{\pgfkeysvalueof{/pgf/magnifying glass handle angle}}{\pgfutil@tempdima}}}
+ \pgfpathlineto{\pgfpointadd{\pgfqpoint{\pgf@xc}{\pgf@yc}}
+ {\pgfpointpolar{\pgfkeysvalueof{/pgf/magnifying glass handle angle}}{\pgfutil@tempdima+\pgfutil@tempdima*(\pgfkeysvalueof{/pgf/magnifying glass handle aspect})}}}
+ }
+}
+
+
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
index c901c3972f1..9c51dc46117 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
@@ -7,4 +7,11 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\input pgfmathcalc.code.tex \ No newline at end of file
+\input pgfmathcalc.code.tex
+
+\ifx\pgfkeysloaded\undefined
+ \let\pgfkeysloaded=\relax
+\else
+ \expandafter\input pgfmathfloat.code.tex
+\fi
+
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
index 29a2be58693..c1f099ce160 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
@@ -13,8 +13,8 @@
\input pgfmathutil.code.tex
\input pgfmathparser.code.tex
-\input pgfmathoperations.code.tex
-\input pgfmathbase.code.tex
+\input pgfmathfunctions.code.tex
+%\input pgfmathbase.code.tex
% \pgfmathsetlength, \pgfmathaddtolength
%
@@ -85,7 +85,8 @@
\def\pgfmathsetcount#1#2{%
\expandafter\pgfmath@onquick#2\pgfmath@%
{%
- #1#2\relax%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ #1#2\relax\pgfmath@%
}%
{%
\pgfmathparse{#2}%
@@ -105,7 +106,10 @@
\def\pgfmathaddtocount#1#2{%
\expandafter\pgfmath@onquick#2\pgfmath@%
{%
- \advance#1#2\relax%
+ \edef\pgfmath@addtocounttemp{\the#1}%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ #1#2\relax\pgfmath@%
+ \advance#1\pgfmath@addtocounttemp\relax%
}%
{%
\edef\pgfmath@addtocounttemp{\the#1}%
@@ -240,14 +244,327 @@
% \pgfmath@onquick+0pt\pgfmath@{is quick}{is slow}
\def\pgfmath@onquick{%
- \afterassignment\pgfmath@afterquick%
- \let\pgfmath@next=%
+ \futurelet\pgfmath@next%
+ \pgfmath@@onquick}
+\def\pgfmath@@onquick#1\pgfmath@{%
+ \ifx\pgfmath@next+%
+ \let\pgfmath@next=\pgfmath@firstoftwo%
+ \else%
+ \let\pgfmath@next=\pgfmath@secondoftwo%
+ \fi%
+ \pgfmath@next%
+}
+
+% *** The following commands DO NOT WORK without the rest of PGF ***
+%
+% (a dumping ground for stuff that doesn't really belong anywhere else)
+
+% \pgfmathanglebetweenpoints
+%
+% Define \pgfmathresult as the angle between points #1 and #2
+% Should get the quadrants right as well.
+%
+\def\pgfmathanglebetweenpoints#1#2{%
+ \begingroup%
+ \pgf@process{\pgfpointdiff{#1}{#2}}%
+ %
+ % First approximate the angle of the external point...
+ %
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \pgf@xb\pgf@x%
+ \pgf@yb\pgf@y%
+ \ifdim\pgf@xa<0pt\relax%
+ \pgf@xa-\pgf@xa%
+ \fi%
+ \ifdim\pgf@ya<0pt\relax%
+ \pgf@ya-\pgf@ya%
+ \fi%
+ \ifdim\pgf@ya>\pgf@xa%
+ \pgf@x\pgf@xa%
+ \pgf@y\pgf@ya%
+ \else%
+ \pgf@x\pgf@ya%
+ \pgf@y\pgf@xa%
+ \fi%
+ \ifdim\pgf@y=0pt\relax%
+ \pgf@x0pt%
+ \else%
+ \pgfmathreciprocal@{\pgfmath@tonumber{\pgf@y}}%
+ \pgf@x\pgfmathresult\pgf@x%
+ \fi%
+ \multiply\pgf@x1000\relax%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \expandafter\c@pgf@counta\the\pgf@x\relax\pgfmath@%
+ \expandafter\pgf@x\csname pgfmath@atan@\the\c@pgf@counta\endcsname pt\relax%
+ \ifdim\pgfmath@ya>\pgfmath@xa\relax%
+ \pgf@x-\pgf@x%
+ \advance\pgf@x90pt%
+ \fi%
+ \ifdim\pgf@xb<0pt%
+ \ifdim\pgf@yb>0pt%
+ \pgf@x-\pgf@x%
+ \fi%
+ \advance\pgf@x180pt\relax%
+ \else%
+ \ifdim\pgf@yb<0pt%
+ \pgf@x-\pgf@x%
+ \advance\pgf@x360pt\relax%
+ \fi\fi%
+ \pgfmath@returnone\pgf@x%
+ \endgroup%
}
-\def\pgfmath@afterquick#1\pgfmath@{%
- \ifx\pgfmath@next+%
- \expandafter\pgfmath@firstoftwo%
- \else%
- \expandafter\pgfmath@secondoftwo%
- \fi%
-} \ No newline at end of file
+%
+% \pgfmathrotatepointaround
+%
+% Rotate point #1 about point #2 by #3 degrees.
+%
+\def\pgfmathrotatepointaround#1#2#3{%
+ \pgf@process{%
+ \pgf@process{#1}%
+ \pgf@xc=\pgf@x%
+ \pgf@yc=\pgf@y%
+ \pgf@process{#2}%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \pgf@xb\pgf@x%
+ \pgf@yb\pgf@y%
+ \pgf@x=\pgf@xc%
+ \pgf@y=\pgf@yc%
+ \advance\pgf@x-\pgf@xa%
+ \advance\pgf@y-\pgf@ya%
+ \pgfmathsetmacro\angle{#3}%
+ \pgfmathsin@{\angle}%
+ \let\sineangle\pgfmathresult%
+ \pgfmathcos@{\angle}%
+ \let\cosineangle\pgfmathresult%
+ \pgf@xa\cosineangle\pgf@x%
+ \advance\pgf@xa-\sineangle\pgf@y%
+ \pgf@ya\sineangle\pgf@x%
+ \advance\pgf@ya\cosineangle\pgf@y%
+ \pgf@x\pgf@xb%
+ \pgf@y\pgf@yb%
+ \advance\pgf@x\pgf@xa%
+ \advance\pgf@y\pgf@ya%
+ }%
+}
+
+% \pgfmathanglebetweenlines
+%
+% Calculate the clockwise angle between a line from point #1
+% to point #2 and a line from #3 to point #4.
+%
+\def\pgfmathanglebetweenlines#1#2#3#4{%
+ \begingroup%
+ \pgfmathanglebetweenpoints{#1}{#2}%
+ \let\firstangle\pgfmathresult%
+ \pgfmathanglebetweenpoints{#3}{#4}%
+ \let\secondangle\pgfmathresult%
+ \ifdim\firstangle pt>\secondangle pt\relax%
+ \pgfmathadd@{\secondangle}{360}%
+ \let\secondangle\pgfmathresult%
+ \fi%
+ \pgfmathsubtract@{\secondangle}{\firstangle}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% \pgfmathpointreflectalongaxis
+%
+% Reflects point #2 around an axis centered on #2 at an angle #3.
+%
+\def\pgfmathreflectpointalongaxis#1#2#3{%
+ \pgf@process{%
+ \pgfmathanglebetweenpoints{#2}{#1}%
+ \pgfmath@tempdima\pgfmathresult pt\relax%
+ \pgfmathparse{#3}%
+ \advance\pgfmath@tempdima-\pgfmathresult pt\relax%
+ \pgfmath@tempdima-2.0\pgfmath@tempdima%
+ \pgfmathrotatepointaround{#1}{#2}{\pgfmath@tonumber{\pgfmath@tempdima}}%
+ }%
+}
+
+
+
+% \pgfmathpointintersectionoflineandarc
+%
+% A bit experimental at the moment:
+%
+% Locates the point where a line crosses an eliptical arc. If the line
+% does not cross the arc, a meaningless point will result.
+%
+% #1 the point of the line on the "convex" side of the arc.
+% #2 the point of the line on the "concave" side of the arc.
+% #3 the center of the eliptical arc.
+% #4 start angle of the arc.
+% #5 end angle of the arc.
+% #6 radii of the arc.
+%
+\def\pgfmathpointintersectionoflineandarc#1#2#3#4#5#6{%
+ \pgf@process{%
+ %
+ % Get the required angle.
+ %
+ \pgfmathanglebetweenpoints{#2}{#1}%
+ \let\x\pgfmathresult%
+ %
+ % Get the radii of the arc.
+ %
+ \pgfmath@in@{and }{#6}%
+ \ifpgfmath@in@%
+ \pgf@polar@#6\@@%
+ \else%
+ \pgf@polar@#6 and #6\@@%
+ \fi%
+ \edef\xarcradius{\the\pgf@x}%
+ \edef\yarcradius{\the\pgf@y}%
+ %
+ % Get the start and end angles of the arc...
+ %
+ \pgfmathsetmacro\s{#4}%
+ \pgfmathsetmacro\e{#5}%
+ %
+ % ...and also with rounding.
+ %
+ \pgfmathmod@{\s}{360}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathadd@{\pgfmathresult}{360}%
+ \fi%
+ \let\ss\pgfmathresult%
+ \pgfmathmod@{\e}{360}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathadd@{\pgfmathresult}{360}%
+ \fi%
+ \let\ee\pgfmathresult%
+ %
+ % Hackery for when arc straddles zero.
+ %
+ \ifdim\ee pt<\ss pt\relax%
+ \pgfmathadd@{\x}{180}%
+ \pgfmathmod@{\pgfmathresult}{360}%
+ \let\x\pgfmathresult%
+ \fi%
+ \def\m{360}% Measure of nearness.
+ \pgfmathadd@{\s}{\e}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \let\n\pgfmathresult% The best estimate (default to middle of arc).
+ \pgfmathloop%
+ \pgfmathadd@{\s}{\e}%
+ \pgfmathdivide@{\pgfmathresult}{2}%
+ \let\p\pgfmathresult%
+ \ifdim\p pt=\s pt\relax%
+ \else%
+ \pgfmathanglebetweenpoints{#2}{%
+ \pgfpointadd{#3}{%
+ \pgf@x\xarcradius\relax%
+ \pgfmathcos@{\p}%
+ \pgf@x\pgfmathresult\pgf@x%
+ \pgf@y\yarcradius\relax%
+ \pgfmathsin@{\p}%
+ \pgf@y\pgfmathresult\pgf@y%
+ }%
+ }%
+ %
+ % Hackery for when arc straddles zero.
+ %
+ \ifdim\ee pt<\ss pt\relax%
+ \pgfmathadd@{\pgfmathresult}{180}%
+ \pgfmathmod@{\pgfmathresult}{360}%
+ \fi%
+ \let\q\pgfmathresult%
+ %
+ % More hackery...
+ %
+ \ifdim\x pt>335pt\relax%
+ \ifdim\q pt<45pt\relax%
+ \pgfmathadd@{\q}{360}%
+ \let\q\pgfmathresult%
+ \fi%
+ \fi%
+ \ifdim\x pt=\q pt% Found it!
+ \pgfmathbreakloop% Breaks after current iteration is complete.
+ \else
+ \ifdim\x pt<\q pt\relax%
+ \let\e\p%
+ \else%
+ \let\s\p%
+ \fi%
+ \fi%
+ \pgfmathsubtract@{\x}{\q}%
+ \pgfmathabs@{\pgfmathresult}%
+ %
+ % Save the estimate if it is better than any previous estimate.
+ %
+ \ifdim\pgfmathresult pt<\m pt\relax%
+ \let\m\pgfmathresult%
+ \let\n\p%
+ \fi%
+ \repeatpgfmathloop%
+ \pgfpointadd{#3}{\pgfpointpolar{\n}{\xarcradius and \yarcradius}}%
+ }%
+}
+
+% \pgfmathangleonellipse
+%
+% Find the angle corresponding to a point on the border of an ellispe.
+%
+% #1 - the point on the border.
+% #2 - the radii of the ellipse.
+%
+\def\pgfmathangleonellipse#1#2{%
+ \begingroup%
+ \pgfmath@in@{and }{#2}%
+ \ifpgfmath@in@%
+ \pgf@polar@#2\@@%
+ \else%
+ \pgf@polar@#2 and #2\@@%
+ \fi%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \pgf@process{#1}%
+ \ifdim\pgf@x=0pt\relax%
+ \pgfutil@tempdima1pt\relax%
+ \else%
+ \pgfutil@tempdima\pgf@x%
+ \pgfmathdivide@{\pgfmath@tonumber{\pgf@xa}}{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ \pgfutil@tempdima\pgfmathresult pt\relax%
+ \fi%
+ \ifdim\pgf@y=0pt\relax%
+ \pgfutil@tempdima1pt\relax%
+ \else%
+ \pgfmathdivide@{\pgfmath@tonumber{\pgf@y}}{\pgfmath@tonumber{\pgf@ya}}%
+ \pgfutil@tempdima\pgfmathresult\pgfutil@tempdima%
+ \pgfmathatan@{\pgfmath@tonumber{\pgfutil@tempdima}}%
+ \fi%
+ %
+ \pgfutil@tempdima\pgfmathresult pt\relax%
+ \ifdim\pgfutil@tempdima<0pt\relax%
+ \advance\pgfutil@tempdima360pt\relax%
+ \fi%
+ \ifdim\pgf@x<0pt\relax%
+ \ifdim\pgf@y=0pt\relax%
+ \pgfutil@tempdima180pt\relax%
+ \else%
+ \ifdim\pgf@y<0pt\relax%
+ \advance\pgfutil@tempdima180pt\relax%
+ \else%
+ \advance\pgfutil@tempdima-180pt\relax%
+ \fi%
+ \fi%
+ \else%
+ \ifdim\pgf@x=0pt\relax%
+ \ifdim\pgf@y<0pt\relax%
+ \pgfutil@tempdima270pt\relax%
+ \else%
+ \pgfutil@tempdima90pt\relax%
+ \fi%
+ \else%
+ \ifdim\pgf@y=0pt\relax%
+ \pgfutil@tempdima0pt\relax%
+ \fi%
+ \fi%
+ \fi%
+ \pgfmath@returnone\pgfutil@tempdima%
+ \endgroup%
+}
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex
new file mode 100644
index 00000000000..722856f3628
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex
@@ -0,0 +1,2376 @@
+% Copyright 2008 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 file contains methods for basic floating point arithmetics, rounding
+% to arbitrary precision and number pretty printing.
+%
+% Version 1.0 2008/09/17
+
+\global\newif\ifpgfmathfloatcomparison
+\newif\ifpgfmathfloatroundhasperiod
+\newif\ifpgfmathprintnumberskipzeroperiod
+
+
+% used internally in grouped macros:
+\toksdef\pgfmathfloat@tmptoks=1
+\newif\ifpgfmathfloat@fixed@digits@after@period
+\newif\ifpgfmathfloatroundmayneedrenormalize
+\toksdef\pgfmathfloat@a@Mtok=0
+
+%% WARNING: avoid conflicting register names!
+\let\pgfmathfloat@a@S=\c@pgf@counta
+\let\pgfmathfloat@a@M=\pgf@xa
+\let\pgfmathfloat@a@E=\c@pgf@countb
+\let\pgfmathfloat@b@S=\c@pgf@countc
+\let\pgfmathfloat@b@M=\pgf@xb
+\let\pgfmathfloat@b@E=\c@pgf@countd
+
+% can be changed with options.
+\def\pgfmathfloat@round@precision{2}
+
+\gdef\pgfmathfloat@glob@TMP{}
+
+
+% Computes a normalised floating point representation for #1 of the
+% form
+% [FLAGS] MANTISSE EXPONENT
+% meaning
+% [+-]X.XXXXXXX*10^C
+% where
+% X.XXXXXX is a mantissa with first number != 0, C is an integer and
+% FLAGS contains the sign and some other special cases.
+%
+% This method does NOT use TeX Registers to represent the numbers! The
+% computation is COMPLETELY STRING BASED.
+% This allows numbers such at 10000000 or 5.23e-10 to be represented
+% properly, although TeX-registers would produce overflow/underflow
+% errors in these cases.
+%
+% It is to be used to compute logs, because log(X*10^Y) = log(X) + log(10)*Y
+%
+% Arguments:
+% #1: an arbitrary number which shall be parsed. Maybe a macro.
+% Examples:
+% [+-]XXXXX.XXXXXX
+% [+-]XXXXX.XXXXXXeXXXX
+% [+-]0.0000XXXXXX
+% [+-]0.0000XXXXXXeXXXX
+% [+-]inf
+% nan
+% Maybe a macro containing such a number.
+%
+% Return value:
+% \pgfmathresult will be \def'ed to
+% FLAGS MANTISSE 'e' EXPONENT
+% where
+% FLAGS is a number in [0-5] where
+% 0 == '0' (the number is +- 0.0),
+% 1 == '+',
+% 2 == '-',
+% 3 == 'not a number'
+% 4 == '+ infinity'
+% 5 == '- infinity'
+%
+% MANTISSE is a normalised number 1 <= M < 10. It always contains a
+% period and at least one digit after the period.
+%
+% EXPONENT is an integer value.
+%
+% Example:
+% \pgfmathfloatparsenumber{1}
+% -> \pgfmathresult = 11.0e0
+% \pgfmathfloatparsenumber{141.212}
+% -> \pgfmathresult = 11.41212e2
+\def\pgfmathfloatparsenumber#1{%
+ \begingroup
+ \edef\pgfmathresult{#1}%
+ \expandafter\pgfflt@impl\pgfmathresult\pgfflt@EOI
+ \ifpgfmathfloatparsenumberpendingperiod
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.0}%
+ \fi
+ \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}
+
+% The same as \pgfmathfloatparsenumber, but does not perform sanity checking.
+% FIXME: there is no longer any difference here.
+\let\pgfmathfloatqparsenumber=\pgfmathfloatparsenumber
+
+% Takes a floating point number #1 as input and writes flags to count
+% register #2, mantissa to dimen register #3 and exponent to count
+% register #4.
+\def\pgfmathfloattoregisters#1#2#3#4{%
+ \expandafter\pgfmathfloat@decompose#1\relax{#2}{#3}{#4}%
+}
+
+% the same, but writes the mantissa into a token register.
+\def\pgfmathfloattoregisterstok#1#2#3#4{%
+ \expandafter\pgfmathfloat@decompose@tok#1\relax{#2}{#3}{#4}%
+}
+
+% Extracts the flags of #1 into the count register #2.
+\def\pgfmathfloatgetflags#1#2{%
+ \expandafter\pgfmathfloat@decompose@F#1\relax{#2}%
+}
+% Extracts the flags of #1 into the macro #2.
+\def\pgfmathfloatgetflagstomacro#1#2{%
+ \expandafter\pgfmathfloat@decompose@Fmacro#1\relax{#2}%
+}%
+
+% Extracts the mantissa of #1 into the dimen register #2.
+\def\pgfmathfloatgetmantissa#1#2{%
+ \expandafter\pgfmathfloat@decompose@M#1\relax{#2}%
+}
+\let\pgfmathfloatgetmantisse=\pgfmathfloatgetmantissa
+% Extracts the mantissa of #1 into the token register #2.
+\def\pgfmathfloatgetmantissatok#1#2{%
+ \expandafter\pgfmathfloat@decompose@Mtok#1\relax{#2}%
+}
+\let\pgfmathfloatgetmantissetok=\pgfmathfloatgetmantissatok
+% Extracts the exponent of #1 into the count register #2.
+\def\pgfmathfloatgetexponent#1#2{%
+ \expandafter\pgfmathfloat@decompose@E#1\relax{#2}%
+}
+
+
+% Assigns \pgfmathresult to be a float encoded as
+% <FLAGS><MANTISSE>e<EXPONENT>
+%
+% example:
+% \pgfmathfloatcreate{1}{2.0}{10}
+% \pgfmathfloat@to@FMeE@style\pgfmathresult
+% ->
+% \pgfmathresult is now '12.0e10' regardless of the internal float
+% format.
+\def\pgfmathfloat@to@FMeE@style#1{\expandafter\pgfmathfloat@to@FMeE@style@#1\relax\relax}%
+\def\pgfmathfloat@to@FMeE@style@#1#2{%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@to@FMeE@style@@%
+ \else
+ \expandafter\pgfmathfloat@to@FMeE@style@error%
+ \fi
+ #1#2%
+}%
+\def\pgfmathfloat@to@FMeE@style@@#1Y#2e#3]\relax\relax{\def\pgfmathresult{#1#2e#3}}%
+\def\pgfmathfloat@to@FMeE@style@error#1\relax\relax{%
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{%
+ \noexpand\pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ }%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
+}%
+
+
+% decomposes a lowlevel floating point representation into flags,
+% mantissa and exponent.
+%
+% #4: integer register for the flags.
+% #5: dimen registers for the mantissa.
+% #6: integer register for the exponent.
+%
+% \expandafter\pgfmathfloat@decompose\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@M\pgfmathfloat@a@E
+% -> the three temp registers contain flags, mantissa and exponent
+\def\pgfmathfloat@decompose#1#2{% sanitize!
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@decompose@%
+ \else
+ \expandafter\pgfmathfloat@decompose@error%
+ \fi
+ #1#2%
+}
+\def\pgfmathfloat@decompose@#1Y#2e#3]\relax#4#5#6{%
+ #4=#1\relax
+ #5=#2pt % keep space here.
+ #6=#3\relax%
+}
+
+% overloaded, #5 needs to be a token register for the mantissa.
+% @see also \pgfmathfloatvalueof which does also employ the load
+% level repr.
+% \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+% -> the three temp registers contain flags, mantissa and exponent
+\def\pgfmathfloat@decompose@tok#1#2{%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@decompose@tok@%
+ \else
+ \expandafter\pgfmathfloat@decompose@tok@error%
+ \fi
+ #1#2%
+}%
+\def\pgfmathfloat@decompose@tok@#1Y#2e#3]\relax#4#5#6{%
+ #4=#1\relax
+ #5={#2}%
+ #6=#3\relax%
+}
+% overloaded, returns only ONE of the three components into #4:
+% \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S
+% -> \pgfmathfloat@a@S contains the flags field.
+\def\pgfmathfloat@decompose@F#1#2{%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@decompose@F@%
+ \else
+ \expandafter\pgfmathfloat@decompose@F@error%
+ \fi
+ #1#2%
+}%
+\def\pgfmathfloat@decompose@Fmacro#1#2{%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@decompose@Fmacro@%
+ \else
+ \expandafter\pgfmathfloat@decompose@F@error%
+ \fi
+ #1#2%
+}%
+\def\pgfmathfloat@decompose@M#1#2{%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@decompose@M@%
+ \else
+ \expandafter\pgfmathfloat@decompose@M@error%
+ \fi
+ #1#2%
+}%
+\def\pgfmathfloat@decompose@E#1#2{%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@decompose@E@%
+ \else
+ \expandafter\pgfmathfloat@decompose@E@error%
+ \fi
+ #1#2%
+}%
+\def\pgfmathfloat@decompose@Mtok#1#2{%
+ \ifx#2Y%
+ \expandafter\pgfmathfloat@decompose@Mtok@%
+ \else
+ \expandafter\pgfmathfloat@decompose@Mtok@error%
+ \fi
+ #1#2%
+}%
+\def\pgfmathfloat@decompose@F@#1Y#2e#3]\relax#4{#4=#1\relax}%
+\def\pgfmathfloat@decompose@Fmacro@#1Y#2e#3]\relax#4{\def#4{#1}}%
+\def\pgfmathfloat@decompose@M@#1Y#2e#3]\relax#4{#4=#2pt}%
+\def\pgfmathfloat@decompose@Mtok@#1Y#2e#3]\relax#4{#4={#2}}%
+\def\pgfmathfloat@decompose@E@#1Y#2e#3]\relax#4{#4=#3\relax}%
+
+\def\pgfmathfloat@decompose@error#1\relax#2#3#4{%
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{%
+ \noexpand#2=\the\pgfmathfloat@a@S\space
+ \noexpand#3=\the\pgfmathfloat@a@Mtok pt
+ \noexpand#4=\the\pgfmathfloat@a@E\space
+ }%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
+}%
+\def\pgfmathfloat@decompose@tok@error#1\relax#2#3#4{%
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{%
+ \noexpand#2=\the\pgfmathfloat@a@S\space
+ \noexpand#3={\the\pgfmathfloat@a@Mtok}%
+ \noexpand#4=\the\pgfmathfloat@a@E\space
+ }%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
+}%
+\def\pgfmathfloat@decompose@F@error#1\relax#2{%
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{\noexpand#2=\the\pgfmathfloat@a@S\space}%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
+}%
+\def\pgfmathfloat@decompose@M@error#1\relax#2{%
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{\noexpand#2=\the\pgfmathfloat@a@Mtok pt }%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
+}%
+\def\pgfmathfloat@decompose@Mtok@error#1\relax#2{%
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{\noexpand#2={\the\pgfmathfloat@a@Mtok}}%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
+}%
+\def\pgfmathfloat@decompose@E@error#1\relax#2{%
+ \begingroup
+ \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}%
+ \xdef\pgfmathfloat@decompose@TMP{\noexpand#2=\the\pgfmathfloat@a@E\space}%
+ \endgroup
+ \pgfmathfloat@decompose@TMP
+}%
+% Takes a floating point number #1 as input and writes flags to macro
+% #2, mantissa to macro #3 and exponent to macro #4.
+\def\pgfmathfloattomacro#1#2#3#4{%
+ \begingroup
+ \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \xdef\pgfmathfloat@glob@TMP{%
+ \noexpand\def\noexpand#2{\the\pgfmathfloat@a@S}%
+ \noexpand\def\noexpand#3{\the\pgfmathfloat@a@Mtok}%
+ \noexpand\def\noexpand#4{\the\pgfmathfloat@a@E}%
+ }%
+ \endgroup
+ \pgfmathfloat@glob@TMP
+}
+
+
+% Defines \pgfmathresult as the floating point number encoded by
+% the flags #1, mantissa #2 and exponent #3.
+%
+% All arguments are characters and will be expanded using '\edef'.
+\def\pgfmathfloatcreate#1#2#3{%
+ \edef\pgfmathresult{#1Y#2e#3]}%
+}%
+% This is the character present in any low-level floating point
+% number. It is assumed to be the SECOND character of a float (after
+% the flags integer).
+\def\pgfmathfloat@POSTFLAGSCHAR{Y}
+
+
+
+% Converts a composed floating point representation to fixed point.
+%
+% Example:
+% \pgfmathfloattofixed{142e1}
+% -> \pgfmathresult = 42.0
+\def\pgfmathfloattofixed@#1{%
+ \begingroup
+ \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \ifcase\pgfmathfloat@a@S
+ \def\pgfmathresult{0.0}%
+ \or
+ \expandafter\pgfmathfloattofixed@impl\the\pgfmathfloat@a@Mtok\relax
+ \or
+ \expandafter\pgfmathfloattofixed@impl\the\pgfmathfloat@a@Mtok\relax
+ \pgfmathfloat@a@Mtok=\expandafter{\pgfmathresult}%
+ \edef\pgfmathresult{-\the\pgfmathfloat@a@Mtok}%
+ \or\def\pgfmathresult{nan}%
+ \or\def\pgfmathresult{inf}%
+ \or\def\pgfmathresult{-inf}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}
+\let\pgfmathfloattofixed=\pgfmathfloattofixed@
+
+% Converts a float to an integer (in integer format).
+%
+% @see \pgfmathfloatint
+\def\pgfmathfloattoint#1{%
+ \pgfmathfloattofixed{#1}%
+ \expandafter\pgfmathfloattoint@@\pgfmathresult\relax
+}%
+\def\pgfmathfloattoint@@#1.#2\relax{%
+ \def\pgfmathresult{#1}%
+}%
+
+% Converts a floating point number to scientific format 1.234e5.
+%
+% This operation is very fast.
+\def\pgfmathfloattosci@#1{%
+ \begingroup
+ \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \ifcase\pgfmathfloat@a@S
+ \def\pgfmathresult{0.0e0}%
+ \or
+ \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}%
+ \or
+ \edef\pgfmathresult{-\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}%
+ \or\def\pgfmathresult{nan}%
+ \or\def\pgfmathresult{inf}%
+ \or\def\pgfmathresult{-inf}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\let\pgfmathfloattosci=\pgfmathfloattosci@
+
+% Expands a floating point number to scientific format 1.234e5.
+%
+% This operation is very fast.
+\def\pgfmathfloatvalueof#1{\expandafter\pgfmathfloatvalueof@@#1\relax}%
+\def\pgfmathfloatvalueof@@#1Y#2e#3]\relax{%
+ \ifcase#1 %
+ 0.0e0%
+ \or
+ #2e#3%
+ \or
+ -#2e#3%
+ \or nan%
+ \or inf%
+ \or -inf%
+ \fi
+}%
+
+
+% Rounds a fixed point number #1 to \pgfmathfloat@round@precision digits precision and returns
+% the result into \pgfmathresult.
+%
+% Any trailing zeros after the period are discarded.
+% See \pgfmathroundtozerofill if you want trailing zeros and fixed
+% width.
+%
+% This method is PURELY text based and can work with arbirtrary
+% precision (well, limited to TeX's stack size and integer size).
+%
+% Examples:
+% \pgfmathroundto{1}
+% -> \pgfmathresult = '1'
+%
+% \pgfmathroundto{19999.9996}
+% -> \pgfmathresult = '20000'
+%
+% Arguments:
+% #1 may be either a number or a macro (\pgfmathresult is allowed) expanding to a number.
+%
+% SIDE EFFECT: the global variable \ifpgfmathfloatroundhasperiod will be set.
+\def\pgfmathroundto#1{%
+ \pgfmathfloatroundhasperiodtrue
+ \begingroup
+ \pgfmathfloat@fixed@digits@after@periodfalse
+ \pgfmathroundto@impl{#1}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}
+
+
+% Overloaded method.
+%
+% This variant always uses a FIXED number behind the period and fills
+% in zeros if necessary.
+% Examples:
+% \pgfmathroundtozerofill{1}
+% -> \pgfmathresult = '1.00'
+%
+% \pgfmathroundtozerofill{19999.9996}
+% -> \pgfmathresult = '20000.00'
+%
+% SIDE EFFECT: the global variable \ifpgfmathfloatroundhasperiod will be set.
+\def\pgfmathroundtozerofill#1{%
+ \pgfmathfloatroundhasperiodtrue
+ \begingroup
+ \pgfmathfloat@fixed@digits@after@periodtrue
+ \pgfmathroundto@impl{#1}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}
+
+% see \pgfmathprintnumber@fixed@style for docs
+\def\pgfmathprintnumber@fixed@styleDEFAULT#1#2#3e#4\relax{%
+ \begingroup
+ \pgfkeysgetvalue{/pgf/number format/set decimal separator}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP
+ \pgfkeysgetvalue{/pgf/number format/@dec sep mark}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK
+ \pgfkeysgetvalue{/pgf/number format/set thousands separator}\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP
+ \c@pgf@counta=#4\relax
+ \ifnum#2=0
+ \c@pgf@counta=0
+ \fi
+ \def\pgfmathresult{}%
+ \ifpgfmathfloatroundhasperiod
+ \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@period#1\pgfmathfloat@EOI
+ \else
+ \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI%
+ \begingroup
+ \toks0=\expandafter{\pgfmathresult}%
+ \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK}%
+ \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }%
+ \endgroup
+ \let\pgfmathresult=\pgfmathfloat@glob@TMP
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}
+\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@period#1.#2\pgfmathfloat@EOI{%
+ \ifpgfmathprintnumberskipzeroperiod
+ \def\pgfmathfloat@loc@TMPb{#1}%
+ \ifx\pgfmathfloatparsenumber@tok@ZERO\pgfmathfloat@loc@TMPb
+ \else
+ \def\pgfmathfloat@loc@TMPc{-0}%
+ \ifx\pgfmathfloat@loc@TMPc\pgfmathfloat@loc@TMPb
+ \def\pgfmathresult{-}%
+ \else
+ \def\pgfmathfloat@loc@TMPc{+0}%
+ \ifx\pgfmathfloat@loc@TMPc\pgfmathfloat@loc@TMPb
+ \def\pgfmathresult{+}%
+ \else
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI
+ \fi
+ \fi
+ \fi
+ \else
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI
+ \fi
+ \begingroup
+ \toks0=\expandafter{\pgfmathresult}%
+ \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK}%
+ \toks2=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP #2}%
+ \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 \the\toks2 }%
+ \endgroup
+ \let\pgfmathresult=\pgfmathfloat@glob@TMP
+}%
+\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod{%
+ \ifx\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP\pgfutil@empty
+ \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}%
+ \else
+ \ifnum\c@pgf@counta<0\relax
+ \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}%
+ \else
+ \ifnum\c@pgf@counta<\pgfkeysvalueof{/pgf/number format/min exponent for 1000 sep}\relax
+ \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}%
+ \else
+ \advance\c@pgf@counta by1 % counta:= total number of digits, N.
+ \c@pgf@countb=\c@pgf@counta
+ \divide\c@pgf@countb by3 % countb := N DIV 3
+ \c@pgf@countc=\c@pgf@countb
+ \multiply\c@pgf@countc by3
+ \advance\c@pgf@counta by-\c@pgf@countc% now counta := N MOD 3
+ \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printsign
+ }%
+ \fi
+ \fi
+ \fi
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT
+}
+\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printsign#1{%
+ \def\pgfmathfloat@loc@TMPb{#1}%
+ \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@MINUS
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}%
+ \let\pgfmathfloat@loc@TMPb=\pgfutil@empty
+ \else
+ \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@PLUS
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}%
+ \let\pgfmathfloat@loc@TMPb=\pgfutil@empty
+ \else
+ \ifpgfmathprintnumber@showpositive
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult +}%
+ \fi
+ \fi
+ \fi
+ \ifnum\c@pgf@counta>0
+ \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
+ \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printtrailingdigits\pgfmathfloat@loc@TMPb
+ }%
+ \else
+ \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
+ \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird\pgfmathfloat@loc@TMPb
+ }%
+ \fi
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT
+}
+\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printtrailingdigits#1#2{%
+ \ifcase\c@pgf@counta
+ \or
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}%
+ \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird#2%
+ }%
+ \or
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1#2}%
+ \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird%
+ }%
+ \fi
+ \ifnum\c@pgf@countb>0\relax
+ \begingroup
+ \toks0=\expandafter{\pgfmathresult}%
+ \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP}%
+ \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }%
+ \endgroup
+ \let\pgfmathresult=\pgfmathfloat@glob@TMP
+ \fi
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT
+}
+\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird#1#2#3{%
+ \ifnum\c@pgf@countb>0\relax
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1#2#3}%
+ \advance\c@pgf@countb by-1
+ \ifnum\c@pgf@countb>0\relax
+ \begingroup
+ \toks0=\expandafter{\pgfmathresult}%
+ \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP}%
+ \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }%
+ \endgroup
+ \let\pgfmathresult=\pgfmathfloat@glob@TMP
+ \fi
+ \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{%
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird%
+ }%
+ \else
+ % in thise case, #1#2#3 are expected to be
+ % \pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI
+ %--------------------------------------------------
+ % \def\pgfmathfloat@loc@TMPb{\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI}%
+ % \def\pgfmathfloat@loc@TMPc{#1#2#3}%
+ % \ifx\pgfmathfloat@loc@TMPc\pgfmathfloat@loc@TMPb
+ % \else
+ % \pgfmath@error{INTERNAL ERROR in fixed style - The input sequence did not terminate as expected; which indicates a wrong exponent argument provided to \string\pgfmathprintnumber@fixed@style}{}%
+ % \fi
+ %--------------------------------------------------
+ \let\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT=\relax
+ \fi
+ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT
+}
+\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall#1{%
+ \def\pgfmathfloat@loc@TMPb{#1}%
+ \let\pgfmathfloat@loc@TMPc=\pgfutil@empty
+ \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@MINUS
+ \else
+ \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@PLUS
+ \else
+ \ifpgfmathprintnumber@showpositive
+ \def\pgfmathfloat@loc@TMPc{+}%
+ \fi
+ \fi
+ \fi
+ \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall@\pgfmathfloat@loc@TMPc#1%
+}
+\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall@#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI{%
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}%
+}%
+
+% @deprecated. It has been replaced by \pgfmathprintnumber@fixed@styleDEFAULT
+% #1 maybe a macro
+\def\pgfmathprintnumber@fixed@stylePERIOD#1#2#3e#4\relax{%
+ \def\pgfmathresult{#1}%
+}
+
+% @deprecated. It has been replaced by \pgfmathprintnumber@fixed@styleDEFAULT
+% #1 maybe a macro
+\def\pgfmathprintnumber@fixed@styleCOMMA#1#2#3e#4\relax{%
+ \ifpgfmathfloatroundhasperiod
+ \expandafter\pgfmathprintnumber@fixed@styleCOMMA@impl#1\pgfmathfloat@EOI
+ \else
+ \def\pgfmathresult{#1}%
+ \fi
+}
+\def\pgfmathprintnumber@fixed@styleCOMMA@impl#1.#2\pgfmathfloat@EOI{\def\pgfmathresult{#1{,}#2}}
+
+% The default style to display fixed point numbers.
+%
+% It does not apply numerics, but it is responsable to typeset the
+% rounded number.
+% It can access the \ifpgfmathfloatroundhasperiod boolean.
+%
+% Arguments:
+% #1#2#3e#4\relax
+
+% Input:
+% #1 the fixed point number to be displayed (maybe a macro).
+% #2#3e#4: the (possibly unformatted) floating point representation
+% which belongs to #1. This format is returned (only!) by
+% \pgfmathfloat@to@FMeE@style.
+% It is used to determine sign and exponent.
+\let\pgfmathprintnumber@fixed@style=\pgfmathprintnumber@fixed@styleDEFAULT
+
+
+% Rounds a normalized floating point number to \pgfmathfloat@round@precision
+% digits precision and writes the result to \pgfmathresult.
+%
+% This method uses \pgfmathroundto for the mantissa.
+%
+% @see pgfmathfloatroundzerofill
+%
+% SIDE EFFECT: the global variable \ifpgfmathfloatroundhasperiod will be set to
+% whether the final mantissa #5 has a period or not.
+\def\pgfmathfloatround#1{%
+ \pgfmathfloatroundhasperiodtrue
+ \begingroup
+ \pgfmathfloat@fixed@digits@after@periodfalse
+ \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \pgfmathfloatround@impl
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}
+
+% Overload.
+%
+% This method uses a fixed width for the mantissa and fills in zeros
+% if necessary.
+%
+% This method uses \pgfmathroundtozerofill for the mantissa.
+%
+% SIDE EFFECT: the global variable \ifpgfmathfloatroundhasperiod will be set to
+% whether the final mantissa #5 has a period or not.
+\def\pgfmathfloatroundzerofill#1{%
+ \pgfmathfloatroundhasperiodtrue
+ \begingroup
+ \pgfmathfloat@fixed@digits@after@periodtrue
+ \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \pgfmathfloatround@impl
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}
+
+\newif\ifpgfmathfloatround@allow@empty@mantissa
+\def\pgfmathfloatround@mantissa@ONE{1.0}%
+
+% #1: sign
+% #2: mantissa
+% #3: exponent
+% #4: CODE to display if the mantissa is drawn.
+% This code will be shown just before the exponent.
+% Example: #4=\cdot
+% #5: CODE to display if the mantissa is NOT draw. (unused currently)
+% Might be used to display '10^1' instead of '1*10^1'.
+% #6: CODE to display the exponent.
+\def\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax#4#5#6{%
+ \pgfkeysgetvalue{/pgf/number format/@sci exponent mark}\pgfmathfloatrounddisplaystyle@e@mark
+ \ifcase#1\relax
+ \pgfmathprintnumber@fixed@style{#2}#1#2e0\relax%
+ \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}%
+ \or\pgfmathprintnumber@fixed@style{#2}#1#2e0\relax%
+ \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}%
+ \or\pgfmathprintnumber@fixed@style{-#2}#1#2e0\relax%
+ \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}%
+ \or
+ \pgfmathfloatrounddisplaystyle@shared@impl@@{\hbox{NaN}}{}%
+ \or
+ \ifpgfmathprintnumber@showpositive
+ \pgfmathfloatrounddisplaystyle@shared@impl@@{+\infty}{}%
+ \else
+ \pgfmathfloatrounddisplaystyle@shared@impl@@{\infty}{}%
+ \fi
+ \or
+ \pgfmathfloatrounddisplaystyle@shared@impl@@{-\infty}{}%
+ \fi
+}
+
+% #1: the part before the exponent code
+% #2: the part for the exponent code.
+\def\pgfmathfloatrounddisplaystyle@shared@impl@#1#2{%
+ {\toks0={#1}%
+ \toks1=\expandafter{\pgfmathfloatrounddisplaystyle@e@mark #2}%
+ \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }%
+ }%
+ \let\pgfmathresult=\pgfmathfloat@glob@TMP
+}%
+% Same as \pgfmathfloatrounddisplaystyle@shared@impl@, but it also
+% inserts the '@dec sep mark' at the end.
+\def\pgfmathfloatrounddisplaystyle@shared@impl@@#1#2{%
+ {\toks0={#1}%
+ \toks1=\expandafter{\pgfmathfloatrounddisplaystyle@e@mark #2}%
+ \pgfkeysgetvalue{/pgf/number format/@dec sep mark}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK
+ \toks2=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK}%
+ \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 \the\toks2 }%
+ }%
+ \let\pgfmathresult=\pgfmathfloat@glob@TMP
+}
+
+\def\pgfmathfloatrounddisplaystyle@std#1#2e#3\relax{%
+ \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{\cdot}{}{10^{#3}}%
+}
+\def\pgfmathfloatrounddisplaystyle@subscript#1#2e#3\relax{%
+ \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}{_{#3}}%
+}
+\def\pgfmathfloatrounddisplaystyle@superscript#1#2e#3\relax{%
+ \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}{^{#3}}%
+}
+\def\pgfmathfloatrounddisplaystyle@e#1#2e#3\relax{%
+ \ifnum#3<0\relax
+ {\count0=#3\relax
+ \multiply\count0 by-1
+ \xdef\pgfmathfloat@glob@TMP{e{-}\the\count0}%
+ }%
+ \let\pgfmathresult=\pgfmathfloat@glob@TMP
+ \else
+ \def\pgfmathresult{e{+}#3}%
+ \fi
+ \def\pgfmathfloat@loc@TMPb{\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}}%
+ \expandafter\pgfmathfloat@loc@TMPb\expandafter{\pgfmathresult}%
+}
+\def\pgfmathfloatrounddisplaystyle@E#1#2e#3\relax{%
+ \ifnum#3<0\relax
+ {\count0=#3\relax
+ \multiply\count0 by-1
+ \xdef\pgfmathfloat@glob@TMP{E{-}\the\count0}%
+ }%
+ \let\pgfmathresult=\pgfmathfloat@glob@TMP
+ \else
+ \def\pgfmathresult{E{+}#3}%
+ \fi
+ \def\pgfmathfloat@loc@TMPb{\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}}%
+ \expandafter\pgfmathfloat@loc@TMPb\expandafter{\pgfmathresult}%
+}
+
+\def\pgfmathfloatrounddisplaystyle@generic#1#2e#3\relax{%
+ \begingroup
+ \pgfkeysvalueof {/pgf/number format/sci generic/@/.@cmd}{#3}{#1}{#2}\pgfeov
+ \pgfkeysgetvalue{/pgf/number format/sci generic/mantissa sep}\pgfmathdisplay@aftermantissa
+ \pgfkeysgetvalue{/pgf/number format/sci generic/empty mantissa sep}\pgfmathdisplay@nomantissa
+ \pgfkeysgetvalue{/pgf/number format/sci generic/exponent}\pgfmathdisplay@e
+ \toks0=\expandafter{\pgfmathdisplay@aftermantissa}%
+ \toks1=\expandafter{\pgfmathdisplay@nomantissa}%
+ \toks2=\expandafter{\pgfmathdisplay@e}%
+ \xdef\pgfmathfloat@glob@TMP{\noexpand\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\noexpand\relax{\the\toks0}{\the\toks1}{\the\toks2}}%
+ \endgroup
+ \pgfmathfloat@glob@TMP
+}
+
+% A macro which takes the argument '<SIGN><MANTISSE>e<EXPONENT>' and
+% expands to the final TeX-representation for that floating point
+% number.
+%
+% PRECONDITION:
+% the floating point number has already been rounded properly and
+% the mantissa has been rounded correcty.
+%
+% The argument needs to be in the format returned by
+% \pgfmathfloat@to@FMeE@style and terminated by '\relax'.
+\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@std
+\newif\ifpgfmathfloat@usezerofill@sci
+\newif\ifpgfmathfloat@usezerofill@fixed
+\newif\ifpgfmathprintnumber@assumemathmode
+\newif\ifpgfmathprintnumber@showpositive
+\newif\ifpgfmathprintnumber@frac@warn
+\newif\ifpgfmathprintnumber@frac@whole
+
+\long\def\pgfmathfloatfrac@verbatim#1#2{#1/#2}%
+
+\pgfkeys{%
+ /pgf/number format/.is family,
+ /pgf/number format,
+ fixed/.code= \pgfmath@set@number@printer{pgfmathprintnumber@FIXED},
+ sci/.code= \pgfmath@set@number@printer{pgfmathprintnumber@SCI},
+ std/.code= {\pgfmath@set@number@printer{pgfmathprintnumber@STD}\pgfmathprintnumber@STD@setparam{#1}},
+ std/.default=,%
+ int detect/.code= \pgfmath@set@number@printer{pgfmathprintnumber@INT@DETECT},
+ int trunc/.code= \pgfmath@set@number@printer{pgfmathprintnumber@INT@TRUNC},
+ frac/.code= \pgfmath@set@number@printer{pgfmathprintnumber@frac},%
+ frac TeX/.initial=\frac,
+ frac whole format/.code={\def\pgfmathresult{#1}},
+ frac denom/.initial=,
+ frac whole/.is if=pgfmathprintnumber@frac@whole,
+ frac whole=true,
+ frac shift/.initial=4,
+ frac warning/.is if=pgfmathprintnumber@frac@warn,
+ frac warning=true,
+ assume math mode/.is if=pgfmathprintnumber@assumemathmode,
+ assume math mode/.default=true,
+ fixed zerofill/.is if= pgfmathfloat@usezerofill@fixed,
+ fixed zerofill/.default=true,
+ sci zerofill/.is if= pgfmathfloat@usezerofill@sci,
+ sci zerofill/.default=true,
+ zerofill/.style= {/pgf/number format/fixed zerofill=#1,/pgf/number format/sci zerofill=#1},
+ zerofill/.default= true,
+ precision/.store in= \pgfmathfloat@round@precision,
+ sci precision/.code={%
+ \edef\pgfmathfloat@loc@TMPa{#1}%
+ \ifx\pgfmathfloat@loc@TMPa\pgfutil@empty
+ \def\pgfmathprintnumber@sci@precision{\pgfmathfloat@round@precision}%
+ \else
+ \let\pgfmathprintnumber@sci@precision=\pgfmathfloat@loc@TMPa
+ \fi
+ },%
+ sci precision/.default=,
+ sci precision=,
+ fixed default/.code= {\let\pgfmathprintnumber@fixed@style=\pgfmathprintnumber@fixed@styleDEFAULT},
+ set decimal separator/.initial=,
+ dec sep/.style={/pgf/number format/set decimal separator=#1},
+ @dec sep mark/.initial=,
+ @sci exponent mark/.initial=,
+ set thousands separator/.initial=,
+ 1000 sep/.style={/pgf/number format/set thousands separator=#1},
+ min exponent for 1000 sep/.initial=0,
+ use period/.style= {/pgf/number format/set decimal separator={.},/pgf/number format/set thousands separator={{{,}}}},
+ use comma/.style= {/pgf/number format/set decimal separator={{{,}}},/pgf/number format/set thousands separator={.}},
+ showpos/.is if=pgfmathprintnumber@showpositive,
+ showpos/.default=true,
+ print sign/.is if=pgfmathprintnumber@showpositive,
+ print sign/.default=true,
+ skip 0./.is if=pgfmathprintnumberskipzeroperiod,
+ skip 0./.default=true,
+ skip 0.= false,
+ use period,
+ sci 10^e/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@std},
+ sci 10e/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@std},
+ sci e/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@e},
+ sci E/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@E},
+ sci subscript/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@subscript},
+ sci superscript/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@superscript},
+ sci generic/.code= {%
+ \let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@generic
+ \pgfkeysdefargs{/pgf/number format/sci generic/@}%
+ {##1##2##3}%
+ {\pgfqkeys{/pgf/number format/sci generic}{#1}}%
+ },
+ sci generic/mantissa sep/.initial=,%
+ sci generic/empty mantissa sep/.initial=,%
+ sci generic/mantisse sep/.style={/pgf/number format/sci generic/mantissa sep={#1}},%
+ sci generic/empty mantisse sep/.style={/pgf/number format/sci generic/empty mantissa sep={#1}},%
+ sci generic/exponent/.initial=,%
+ sci generic/.value required,
+ verbatim/.code={%
+ \pgfqkeys{/pgf/number format}{%
+ sci generic={mantissa sep=,exponent={e##1}},
+ 1000 sep=,
+ skip 0.=false,
+ print sign=false,
+ dec sep=.,
+ assume math mode,
+ frac TeX=\pgfmathfloatfrac@verbatim,
+ frac whole format/.code={\def\pgfmathresult{##1 }},
+ @dec sep mark=,
+ @sci exponent mark=,
+ }%
+ },
+% sci may skip mantissa/.is if=pgfmathfloatround@allow@empty@mantissa,
+% sci may skip mantissa/.default=true,
+}
+
+
+
+\def\pgfmathprintnumber@STD#1{%
+ % parse the input:
+ \pgfmathfloatparsenumber{#1}%
+ \pgfmathfloat@to@FMeE@style\pgfmathresult
+ \expandafter\pgfmathprintnumber@STD@issci\pgfmathresult\relax
+}
+
+\def\pgfmathprintnumber@STD@setparam#1{%
+ \edef\pgfmathfloat@loc@TMPb{#1}%
+ \ifx\pgfmathfloat@loc@TMPb\pgfutil@empty
+ % DEFAULT for lower and upper bound.
+ \def\pgfmathprintnumber@STD@getlowerbound{%
+ \c@pgf@counta=\pgfmathfloat@round@precision\relax
+ \divide\c@pgf@counta by-2\relax
+ }%
+ \def\pgfmathprintnumber@STD@upperbound{4}%
+ \else
+ \expandafter\pgfutil@in@\expandafter:\expandafter{\pgfmathfloat@loc@TMPb}%
+ \ifpgfutil@in@
+ % we have -4:5 or something like that.
+ % parse both values:
+ \def\pgfmathfloat@loc@TMPa##1:##2\relax{%
+ \edef\pgfmathprintnumber@STD@getlowerbound{%
+ \noexpand\c@pgf@counta=##1\space
+ }%
+ \edef\pgfmathprintnumber@STD@upperbound{##2}%
+ }%
+ \expandafter\pgfmathfloat@loc@TMPa\pgfmathfloat@loc@TMPb\relax
+ \else
+ % we have just the lower bound:
+ \def\pgfmathprintnumber@STD@upperbound{4}%
+ \edef\pgfmathprintnumber@STD@getlowerbound{%
+ \noexpand\c@pgf@counta=\pgfmathfloat@loc@TMPb\space
+ }%
+ \fi
+ \fi
+}%
+
+\def\pgfmathprintnumber@STD@issci#1#2e#3\relax{%
+ \expandafter\ifnum#1<3
+ \expandafter\ifnum#3>\pgfmathprintnumber@STD@upperbound\relax
+ \pgfmathprintnumber@SCI@issci#1#2e#3\relax%
+ \else
+ \begingroup
+ \pgfmathprintnumber@STD@getlowerbound
+ \ifnum#3<\c@pgf@counta
+ \pgfmathprintnumber@SCI@issci#1#2e#3\relax%
+ \else
+ \pgfmathprintnumber@FIXED@issci#1#2e#3\relax%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+ \fi
+ \else% nan or inf:
+ \pgfmathfloatrounddisplaystyle#1#2e#3\relax%
+ \fi
+}
+
+\def\pgfmathprintnumber@frac#1{%
+ % parse the input:
+ \pgfmathfloatparsenumber{#1}%
+ \pgfmathfloatgetfrac{\pgfmathresult}%
+ \expandafter\pgfmathprintnumber@frac@formatresult\pgfmathresult
+}
+\def\pgfmathprintnumber@frac@issci#1#2e#3\relax{%
+ \pgfmathfloatcreate{#1}{#2}{#3}%
+ \pgfmathfloatgetfrac{\pgfmathresult}%
+ \expandafter\pgfmathprintnumber@frac@formatresult\pgfmathresult
+}
+\def\pgfmathprintnumber@frac@formatresult#1#2#3{%
+ \begingroup
+ \pgfkeysgetvalue{/pgf/number format/frac TeX}\pgfmathresult
+ \toks0=\expandafter{\pgfmathresult}%
+ \def\pgfmathfloat@loc@TMPa{#1}%
+ \ifx\pgfmathfloat@loc@TMPa\pgfutil@empty
+ \ifpgfmathprintnumber@showpositive
+ \def\pgfmathfloat@loc@TMPa{+}%
+ \fi
+ \else
+ \ifx\pgfmathfloat@loc@TMPa-%
+ \else
+ \ifx\pgfmathfloat@loc@TMPa+%
+ \else
+ \ifpgfmathprintnumber@showpositive
+ \edef\pgfmathfloat@loc@TMPa{+\pgfmathfloat@loc@TMPa}%
+ \fi
+ \def\pgfmathfloat@loc@TMPb{\pgfkeysvalueof{/pgf/number format/frac whole format/.@cmd}}%
+ \expandafter\pgfmathfloat@loc@TMPb\pgfmathfloat@loc@TMPa\pgfeov
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \fi
+ \fi
+ \fi
+ \toks1=\expandafter{\pgfmathfloat@loc@TMPa}%
+ \edef\pgfmathresult{%
+ \the\toks1 \ifnum#2=0 \else\the\toks0 {#2}{#3}\fi%
+ }%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+% Defines \pgfmathresult to contain three sets of braces containing
+% the sign (optionally containing any components >1), the numerator and the denominator for #1.
+%
+% \pgfmathfloatgetfrac{0.5} -> \pgfmathresult contains {}{1}{2}
+% \pgfmathfloatgetfrac{-0.5} -> \pgfmathresult contains {-}{1}{2}
+% \pgfmathfloatgetfrac{1.5} -> \pgfmathresult contains {1}{1}{2}
+%
+% special cases:
+% \pgfmathfloatgetfrac{0} -> \pgfmathresult contains {0}{0}{1}
+% \pgfmathfloatgetfrac{1} -> \pgfmathresult contains {1}{0}{1}
+%
+% The numerator and denominator is always a number (not empty)
+\def\pgfmathfloatgetfrac#1{%
+ \pgfutil@ifundefined{pgfmathfloatmultiply@}{%
+ \PackageError{tikz}{Sorry, the number format 'frac' requires '\string\usetikzlibrary{fpu}' (and, optionally, \string\usepackage{fp}) in order to work correctly}{}%
+ \edef\pgfmathresult{{#1}{0}{1}}%
+ }{%
+ \pgfmathfloatgetfrac@{#1}%
+ }%
+}%
+\def\pgfmathfloatgetfrac@#1{%
+ \begingroup
+ \edef\pgfmathfloat@arg{#1}%
+ \expandafter\pgfmathfloat@decompose@tok\pgfmathfloat@arg\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \def\pgfmathfloat@loc@TMPa{0}%
+ \ifcase\pgfmathfloat@a@S
+ % #1 = 0:
+ \def\pgfmathresult{{0}{0}{1}}%
+ \or% #1 > 0
+ \pgfmathfloat@a@S=1
+ \def\pgfmathfloat@loc@TMPa{1}%
+ \or% #1 < 0
+ \pgfmathfloat@a@S=-1
+ \def\pgfmathfloat@loc@TMPa{1}%
+ \or
+ \edef\pgfmathresult{{}{NaN}{1}}%
+ \or
+ \edef\pgfmathresult{{}{\infty}{1}}%
+ \or
+ \edef\pgfmathresult{{-}{\infty}{1}}%
+ \fi
+ \if1\pgfmathfloat@loc@TMPa
+ \ifnum\pgfmathfloat@a@E<0
+ \def\pgfmathfloat@wholenumber{}%
+ \else
+ \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \pgfmathfloattofixed\pgfmathresult%
+ \def\pgfmathfloat@loc@TMPa##1.##2\relax{%
+ \def\pgfmathfloat@wholenumber{##1}%
+ \pgfmathfloatparsenumber{0.##2}%
+ }%
+ \expandafter\pgfmathfloat@loc@TMPa\pgfmathresult\relax
+ \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \fi
+ %
+ \def\pgfmathfloat@loc@TMPa##1.##2\relax{%
+ \def\pgfmathfloat@mantissa@first{##1}%
+ \def\pgfmathfloat@mantissa@ltone{0.##2}%
+ }%
+ \expandafter\pgfmathfloat@loc@TMPa\the\pgfmathfloat@a@Mtok\relax
+ %
+ \def\pgfmathfloat@loc@@to@int##1.##2\relax##3{%
+ ##3=##1
+ \ifdim0.##2pt>0.5pt
+ \advance##3 by1
+ \fi
+ }%
+ %
+ % alias registers names:
+ \let\pgfmathresultnumerator=\pgfmathfloat@b@S
+ \let\pgfmathresultdenom=\pgfmathfloat@b@E
+ %
+ \pgfkeysgetvalue{/pgf/number format/frac denom}\pgfmath@target@denominator
+ \ifx\pgfmath@target@denominator\pgfutil@empty
+ %
+ \pgfmathfloat@a@E=-\pgfmathfloat@a@E
+ \ifdim\pgfmathfloat@mantissa@ltone pt=0pt
+ \def\pgfmathfloat@factor{1}%
+ \edef\pgfmathfloat@scaled@numerator{\the\pgfmathfloat@a@Mtok}%
+ \else
+ % FIXME : this here is numerically instable.
+ %
+ % The errors of 1/r are magnified by 10^k which
+ % doesn't work.
+ \pgfutil@ifundefined{FPdiv}{%
+ \pgfmathfloatparsenumber{\pgfmathfloat@mantissa@ltone}%
+ \pgfmathfloatreciprocal@{\pgfmathresult}%
+ }{%
+ % \usepackage{fp}.
+ % yields higher absolute precision.
+ \FPmessagesfalse%
+ \FPdebugfalse%
+ \FPdiv\pgfmathresult{1}{\pgfmathfloat@mantissa@ltone}%
+ \pgfmathfloatparsenumber{\pgfmathresult}%
+ }%
+ \let\pgfmathfloat@inv=\pgfmathresult
+ \pgfmathfloatcreate{1}{1.0}{\pgfkeysvalueof{/pgf/number format/frac shift}}%
+ \let\pgfmathfloat@scalebaseten=\pgfmathresult
+ \pgfmathfloatmultiply@{\pgfmathfloat@inv}{\pgfmathfloat@scalebaseten}%
+ \let\pgfmathfloat@factor=\pgfmathresult
+ %
+ \expandafter\pgfmathfloatparsenumber\expandafter{\the\pgfmathfloat@a@Mtok}%
+ \let\pgfmathfloat@loc@TMPa=\pgfmathresult
+ \pgfmathfloatmultiply@{\pgfmathfloat@factor}{\pgfmathfloat@loc@TMPa}%
+ \pgfmathfloattofixed\pgfmathresult
+ \let\pgfmathfloat@scaled@numerator=\pgfmathresult
+ %
+ \pgfmathfloattofixed\pgfmathfloat@factor
+ \expandafter\pgfmathfloat@loc@@to@int\pgfmathresult\relax{\pgfmathfloat@b@S}%
+ \edef\pgfmathfloat@factor{\the\pgfmathfloat@b@S}%
+ \fi
+ %
+ %
+ \pgfmathresultdenom=\pgfmathfloat@factor\relax
+ \pgfmathfloat@multiply@ten@to@the@E\pgfmathresultdenom
+ %
+ \expandafter\pgfmathfloat@loc@@to@int\pgfmathfloat@scaled@numerator\relax{\pgfmathresultnumerator}%
+ %\message{scale = \pgfmathfloat@factor; Z = \the\pgfmathresultnumerator\space ( von \pgfmathfloat@scaled@numerator), N = \the\pgfmathresultdenom.}%
+ %
+ \pgfmathgreatestcommondivisor{\pgfmathresultnumerator}{\pgfmathresultdenom}%
+ \divide\pgfmathresultnumerator by\pgfmathresult\relax
+ \divide\pgfmathresultdenom by\pgfmathresult\relax
+ \ifpgfmathprintnumber@frac@warn
+ \ifnum\pgfmathresultdenom>1000
+ \pgfutil@ifundefined{FPdiv}{%
+ \pgfmathfloattosci@\pgfmathfloat@arg
+ \immediate\write16{! Package pgf /pgf/number format/frac warning=true: /pgf/number format/frac of `\pgfmathresult' = \the\pgfmathresultnumerator\space / \the\pgfmathresultdenom\space might be large due to instabilities. Try \string\usepackage{fp} to improve accuracy.}%
+ }{}%
+ \fi
+ \fi
+ \else
+ % use target denominator:
+ \pgfmathresultdenom=\pgfmath@target@denominator\relax
+ \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}%
+ \pgfmathfloattofixed\pgfmathresult
+ \pgf@xa=\pgfmathresult pt
+ \multiply\pgf@xa by\pgfmathresultdenom
+ \edef\pgfmathfloat@scaled@numerator{\pgf@sys@tonumber\pgf@xa}%
+ \expandafter\pgfmathfloat@loc@@to@int\pgfmathfloat@scaled@numerator\relax{\pgfmathresultnumerator}%
+ \fi
+ \ifpgfmathprintnumber@frac@whole
+ \else
+ \ifx\pgfmathfloat@wholenumber\pgfutil@empty
+ \else
+ \count0=\pgfmathfloat@wholenumber\relax
+ \multiply\count0 by\pgfmathresultdenom
+ \advance\pgfmathresultnumerator by\count0
+ \def\pgfmathfloat@wholenumber{}%
+ \fi
+ \fi
+ \ifnum\pgfmathfloat@a@S<0
+ \edef\pgfmathresult{{-\pgfmathfloat@wholenumber}{\the\pgfmathresultnumerator}{\the\pgfmathresultdenom}}%
+ \else
+ \edef\pgfmathresult{{\pgfmathfloat@wholenumber}{\the\pgfmathresultnumerator}{\the\pgfmathresultdenom}}%
+ \fi
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\def\pgfmathfloat@gobble@until@relax#1\relax{}
+
+% computes the greatest common divisor of two integer numbers (in
+% integer arithmetics).
+\def\pgfmathgreatestcommondivisor#1#2{%
+ \begingroup
+ \count0=#1\relax
+ \count1=#2\relax
+ \ifnum\count0=0
+ \edef\pgfmathresult{\the\count1}%
+ \else
+ \pgfmathgreatestcommondivisor@loop
+ \edef\pgfmathresult{\the\count0}%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}
+\def\pgfmathgreatestcommondivisor@loop{%
+ \ifnum\count1=0
+ \else
+ \ifnum\count0>\count1
+ \advance\count0 by-\count1
+ \else
+ \advance\count1 by-\count0
+ \fi
+ \expandafter\pgfmathgreatestcommondivisor@loop
+ \fi
+}%
+
+% multiplies a TeX register by 10^E where E is stored in the register
+% \pgfmathfloat@a@E (and it should be positive!)%
+%
+% #1 a TeX register
+\def\pgfmathfloat@multiply@ten@to@the@E#1{%
+ \ifnum\pgfmathfloat@a@E>0
+ \multiply#1 by10
+ \advance\pgfmathfloat@a@E by-1
+ \def\pgfmathfloat@multiply@ten@to@the@E@next{\pgfmathfloat@multiply@ten@to@the@E{#1}}%
+ \else
+ \let\pgfmathfloat@multiply@ten@to@the@E@next=\relax%
+ \fi
+ \pgfmathfloat@multiply@ten@to@the@E@next
+}%
+
+\def\pgfmathprintnumber@INT@TRUNC#1{%
+ \pgfmathfloatparsenumber{#1}%
+ \pgfmathfloat@to@FMeE@style\pgfmathresult
+ \expandafter\pgfmathprintnumber@INT@TRUNC@issci\pgfmathresult\relax
+}
+
+\def\pgfmathprintnumber@INT@TRUNC@impl#1.#2\relax#3#4e#5\relax{%
+ \pgfmathfloatroundhasperiodfalse
+ \pgfmathprintnumber@fixed@style{#1}#3#4e#5\relax%
+}
+\def\pgfmathprintnumber@INT@TRUNC@issci#1#2e#3\relax{%
+ \ifnum#1<3\relax
+ \pgfmathfloatcreate{#1}{#2}{#3}%
+ \pgfmathfloattofixed{\pgfmathresult}%
+ \expandafter\pgfmathprintnumber@INT@TRUNC@impl\pgfmathresult\relax#1#2e#3\relax
+ \else
+ \pgfmathfloatrounddisplaystyle#1#2e#3\relax%
+ \fi
+}
+
+% Invokes '#2' if '#1' is actually an integer or '#3' if not.
+%
+% As a side--effect, \pgfretval will be set to the integer value if it
+% actually *is* an integer. Otherwise, \pgfretval will contain the
+% parsed floating point number.
+%
+% #1 a number constant (not necessarily a parsed float).
+\def\pgfmathifisint#1#2#3{%
+ \gdef\pgfmathfloatisint@@{0}%
+ \begingroup
+ \pgfmathfloatparsenumber{#1}%
+ \let\pgfretval\pgfmathresult
+ \pgfmathfloat@to@FMeE@style\pgfmathresult
+ \expandafter\pgfmathfloatisint@\pgfmathresult\relax
+ \pgfmath@smuggleone\pgfretval
+ \endgroup
+ \if1\pgfmathfloatisint@@ #2\else #3\fi
+}%
+\def\pgfmathfloatisint@#1#2e#3\relax{%
+ \ifnum#1<3\relax
+ \pgfmathfloatcreate{#1}{#2}{#3}%
+ \pgfmathfloattofixed{\pgfmathresult}%
+ \def\pgfmathfloat@round@precision{6}%
+ \expandafter\pgfmathroundto\expandafter{\pgfmathresult}%
+ \ifpgfmathfloatroundhasperiod
+ \else
+ \let\pgfretval\pgfmathresult%
+ \gdef\pgfmathfloatisint@@{1}%
+ \fi
+ \fi
+}
+
+\def\pgfmathprintnumber@INT@DETECT#1{%
+ \pgfmathfloatparsenumber{#1}%
+ \pgfmathfloat@to@FMeE@style\pgfmathresult
+ \expandafter\pgfmathprintnumber@INT@DETECT@issci\pgfmathresult\relax
+}
+
+\def\pgfmathprintnumber@INT@DETECT@issci#1#2e#3\relax{%
+ \begingroup
+ \ifnum#1<3\relax
+ \pgfmathfloatcreate{#1}{#2}{#3}%
+ \pgfmathfloattofixed{\pgfmathresult}%
+ \let\pgfmathfloat@round@precision@=\pgfmathfloat@round@precision
+ \def\pgfmathfloat@round@precision{6}%
+ \expandafter\pgfmathroundto\expandafter{\pgfmathresult}%
+ \let\pgfmathfloat@round@precision=\pgfmathfloat@round@precision@
+ \ifpgfmathfloatroundhasperiod
+ \pgfmathprintnumber@SCI@issci#1#2e#3\relax
+ \else
+ \expandafter\pgfmathprintnumber@fixed@style\expandafter{\pgfmathresult}#1#2e#3\relax
+ \fi
+ \else
+ \pgfmathfloatrounddisplaystyle#1#2e#3\relax%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}
+
+\def\pgfmathprintnumber@FIXED#1{%
+ \pgfmathfloatparsenumber{#1}%
+ \pgfmathfloat@to@FMeE@style\pgfmathresult
+ \expandafter\pgfmathprintnumber@FIXED@issci\pgfmathresult\relax
+}
+
+\def\pgfmathprintnumber@FIXED@issci#1#2e#3\relax{%
+ \begingroup
+ \ifnum#1<3
+ \pgfmathfloatcreate{#1}{#2}{#3}%
+ \pgfmathfloattofixed{\pgfmathresult}%
+ \ifpgfmathfloat@usezerofill@fixed
+ \expandafter\pgfmathroundtozerofill\expandafter{\pgfmathresult}%
+ \else
+ \expandafter\pgfmathroundto\expandafter{\pgfmathresult}%
+ \fi
+ \ifpgfmathfloatroundmayneedrenormalize
+ \pgfmathfloat@a@E=#3\relax
+ \advance\pgfmathfloat@a@E by1
+ \edef\pgfmathfloat@loc@TMPb{\noexpand\pgfmathprintnumber@fixed@style{\pgfmathresult}#1#2e\the\pgfmathfloat@a@E}%
+ \pgfmathfloat@loc@TMPb\relax%
+ \else
+ \expandafter\pgfmathprintnumber@fixed@style\expandafter{\pgfmathresult}#1#2e#3\relax%
+ \fi
+ \else% nan or inf:
+ \pgfmathfloatrounddisplaystyle#1#2e#3\relax%
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}
+
+
+\def\pgfmathprintnumber@SCI#1{%
+ \pgfmathfloatparsenumber{#1}%
+ \pgfmathfloat@to@FMeE@style\pgfmathresult
+ \expandafter\pgfmathprintnumber@SCI@issci\pgfmathresult\relax
+}
+
+\def\pgfmathprintnumber@SCI@issci#1#2e#3\relax{%
+ \begingroup
+ \pgfmathfloatcreate{#1}{#2}{#3}%
+ \edef\pgfmathfloat@round@precision{\pgfmathprintnumber@sci@precision}%
+ \ifpgfmathfloat@usezerofill@sci
+ \pgfmathfloatroundzerofill{\pgfmathresult}%
+ \else
+ \pgfmathfloatround{\pgfmathresult}%
+ \fi
+ \pgfmathfloat@to@FMeE@style\pgfmathresult
+ \expandafter\pgfmathfloatrounddisplaystyle\pgfmathresult\relax
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}
+
+% Prints argument #1 using the current pretty printer environment (all
+% variables in /pgf/number format).
+%
+% You may specify optional arguments with \pgfmathprintnumber[...].
+\def\pgfmathprintnumber{%
+ % \protect allows to supply \pgfmathprintnumber inside of latex
+ % captions. The \csname yields \relax in case protect is undefined.
+ \pgf@texdist@protect\pgfmathprintnumber@protected
+}%
+\def\pgfmathprintnumber@protected{%
+ \pgfutil@ifnextchar[%
+ {\pgfmathprintnumber@OPT}%
+ {\pgfmathprintnumber@noopt}%
+}
+
+\def\pgfmathprintnumber@noopt#1{%
+ \pgfmathprintnumber@{#1}%
+ \ifpgfmathprintnumber@assumemathmode
+ \pgfmathresult
+ \else
+ \pgfutilensuremath{\pgfmathresult}%
+ \fi
+}%
+\def\pgfmathprintnumber@OPT[#1]#2{%
+ \begingroup
+ \pgfqkeys{/pgf/number format}{#1}%
+ \pgfmathprintnumber@{#2}%
+ \ifpgfmathprintnumber@assumemathmode
+ \pgfmathresult
+ \else
+ \pgfutilensuremath{\pgfmathresult}%
+ \fi
+ \endgroup
+}%
+
+% As \pgfmathprintnumber, but it produces its output into the second
+% argument.
+\def\pgfmathprintnumberto{%
+ \pgfutil@ifnextchar[%
+ {\pgfmathprintnumberto@OPT}%
+ {\pgfmathprintnumberto@noopt}%
+}
+
+\def\pgfmathprintnumberto@noopt#1#2{%
+ \begingroup
+ \pgfmathprintnumber@{#1}%
+ \ifpgfmathprintnumber@assumemathmode
+ \global\let\pgfmathfloat@glob@TMP=\pgfmathresult
+ \else
+ \toks0=\expandafter{\pgfmathresult}%
+ \xdef\pgfmathfloat@glob@TMP{\noexpand\pgfutilensuremath{\the\toks0 }}%
+ \fi
+ \endgroup
+ \let#2=\pgfmathfloat@glob@TMP
+}%
+\def\pgfmathprintnumberto@OPT[#1]#2#3{%
+ \begingroup
+ \pgfqkeys{/pgf/number format}{#1}%
+ \pgfmathprintnumber@{#2}%
+ \ifpgfmathprintnumber@assumemathmode
+ \global\let\pgfmathfloat@glob@TMP=\pgfmathresult
+ \else
+ \toks0=\expandafter{\pgfmathresult}%
+ \xdef\pgfmathfloat@glob@TMP{\noexpand\pgfutilensuremath{\the\toks0 }}%
+ \fi
+ \endgroup
+ \let#3=\pgfmathfloat@glob@TMP
+}%
+
+
+% Changes the current number pretty printer to #1.
+%
+% #1 is the macro base name for the pretty print routine, without the
+% leading '\'.
+\def\pgfmath@set@number@printer#1{%
+ \expandafter\let\expandafter\pgfmathprintnumber@\csname #1\endcsname
+ \expandafter\let\expandafter\pgfmathprintnumber@issci\csname #1@issci\endcsname
+}
+
+\pgfkeys{/pgf/number format/std}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% IMPL
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% equals only itsself when compared with \ifx:
+\def\pgfmathfloat@EOI{\pgfmathfloat@EOI}%
+
+% Re-use counters internally.
+%
+% They are always grouped and only used inside of the rounding
+% routines.
+\let\c@pgfmathroundto@prec=\pgfmathfloat@b@S% ATTENTION: DOUBLE-USED REGISTERS!
+\let\c@pgfmathroundto@offsetbehindperiod=\pgfmathfloat@b@E
+\newcount\c@pgfmathroundto@lastzeros
+
+\newif\ifpgfmathround@impl@PREPERIOD@is@negative@zero
+
+% PRECONDITION:
+% \ifpgfmathfloatroundhasperiod=\iftrue holds outside of the
+% current TeX group.
+%
+% POSTCONDITION:
+% \ifpgfmathfloatroundhasperiod will be set correctly AFTER the
+% current TeX group.
+% \ifpgfmathfloatroundmayneedrenormalize will be set globally
+\def\pgfmathroundto@impl#1{%
+ \edef\pgfmathround@input{#1}%
+ \global\pgfmathfloatroundmayneedrenormalizefalse
+ \pgfmathfloat@tmptoks={}%
+ \let\pgfmathround@next=\pgfutil@empty
+ \let\pgfmathround@cur=\pgfutil@empty
+ \let\pgfmathresult=\pgfutil@empty
+ \expandafter\c@pgfmathroundto@prec\pgfmathfloat@round@precision\relax
+ \c@pgfmathroundto@lastzeros=0
+ \c@pgfmathroundto@offsetbehindperiod=-1 % means: no period found so far
+ \pgfmathround@impl@PREPERIOD@is@negative@zerotrue
+ \expandafter\pgfmathroundto@impl@ITERATE@NODOT@firstcall\pgfmathround@input\pgfmathfloat@EOI
+}
+
+% \pgfmathroundto implementation in WORDS:
+%
+% coarse idea:
+% 1. collect all digits/sign BEFORE the first period in REVERSE order
+% 2. then, collect UP TO \prec digits after the period in REVERSE order
+% Steps 1. and 2. lead to the digit [sign] sequence
+% "x_{-p} x_{-p+1} ... x_{-2} x_{-1} '.' x_0 ... x_r"
+% where 'r' is the total number of digits. The integer 'p' denotes the
+% ACTUALLY collected number of digits behind the period.
+%
+% Let 'k' be the desired precision.
+%
+% Please note that pgfmathroundto rounds the mantissa, that means |abs(x)|.
+%
+% There are exactly TWO cases:
+% 1. The case with p<=k and x_{-p-1} = end of input.
+% 2. The case with p=k and x_{-p-1} is a further, next character.
+%
+% Then, for case 1.):
+% discard any unused zeros at the tail of our number (possibly
+% including the period)
+%
+% and in case 2.)
+% if NEXT DIGIT < 5:
+% do exactly the same as in case 1.) above and discard any
+% following digits.
+% else
+% let q := -p
+% while(x_q = 9 and q<=r )
+% if q>=0
+% set x_q = '0'
+% else
+% discard digit x_q='9'
+% fi
+% ++q
+% if q=0
+% discard the period
+% fi
+% end while
+% if q = r+1
+% insert a '1'
+% else
+% set x_q = x_q + 1
+% fi
+% fi
+%
+% All these loops have been implemented in spaghetti-code below.
+% Sorry, I fear its hard to understand. In principle, everything is
+% realised using more or less finite state machines (with some number
+% counting logic).
+%
+% Some comments:
+% - The token register \pgfmathfloat@tmptoks is used to accumulate the REVERSED input number.
+% - \pgfmathfloat@EOI always denotes 'END OF INPUT'.
+% - in the second stage, we need to reverse \pgfmathfloat@tmptoks.
+% This is -again- done with \pgfmathfloat@tmptoks.
+
+\def\pgfmathroundto@impl@discard@period#1.#2\pgfmathfloat@EOI{%
+ \pgfmathfloatroundhasperiodfalse
+ \aftergroup\pgfmathfloatroundhasperiodfalse
+ \def\pgfmathresult{#1}%
+}
+
+\def\pgfmathroundto@impl@gobble@rest@and@start#1\pgfmathfloat@EOI{%
+ \pgfmathroundto@impl@start
+}
+\def\pgfmathroundto@impl@gobble@and@start\pgfmathfloat@EOI{%
+ \pgfmathroundto@impl@start
+}
+\def\pgfmathroundto@impl@gobble\pgfmathfloat@EOI{}%
+\def\pgfmathroundto@impl@gobble@rest#1\pgfmathfloat@EOI{}%
+
+% This method will be invoked as soon as the first step, the reverse
+% collection of up to PREC digits after the period, has finished.
+\def\pgfmathroundto@impl@start{%
+ \ifx\pgfmathround@next\pgfutil@empty
+ \ifnum\c@pgfmathroundto@offsetbehindperiod<0
+ % no period found.
+ \ifpgfmathfloat@fixed@digits@after@period
+ \ifnum\c@pgfmathroundto@prec=0\relax
+ \pgfmathfloatroundhasperiodfalse
+ \aftergroup\pgfmathfloatroundhasperiodfalse
+ \edef\pgfmathresult{\pgfmathround@input}%
+ \else
+ \pgfmathfloat@tmptoks=\expandafter{\pgfmathround@input.}%
+ \c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec
+ \pgfmathroundto@impl@append@zeros
+ \edef\pgfmathresult{\the\pgfmathfloat@tmptoks}%
+ \fi
+ \else
+ \pgfmathfloatroundhasperiodfalse
+ \aftergroup\pgfmathfloatroundhasperiodfalse
+ \edef\pgfmathresult{\pgfmathround@input}%
+ \fi
+ \else
+ %\ifnum\c@pgfmathroundto@offsetbehindperiod>\c@pgfmathroundto@prec
+ % \pgfmath@error{Internal logic error in pgfmathroundto at [I] - should not have happened!?}{}%
+ %\fi
+ \pgfmathroundto@impl@finish@with@truncation
+ \fi
+ \else
+ %\ifnum\c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec
+ %\else
+ % \pgfmath@error{Internal logic error in pgfmathroundto at [II] - should not have happened!? I have offsetbehindperiod=\the\c@pgfmathroundto@offsetbehindperiod and prec = \the\c@pgfmathroundto@prec}{}%
+ %\fi
+ \expandafter\ifnum\pgfmathround@next<5\relax
+ \pgfmathroundto@impl@finish@with@truncation
+ \else
+ \multiply\c@pgfmathroundto@offsetbehindperiod by-1
+ \expandafter\pgfmathroundto@impl@ADD@ONE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI
+ \fi
+ \fi
+}
+
+% takes the current input and decides whether trailing zeros shall be
+% discarded or more zeros need to be filled in.
+\def\pgfmathroundto@impl@finish@with@truncation{%
+ \ifpgfmathfloat@fixed@digits@after@period
+ \expandafter\pgfmathroundto@impl@REVERSE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI
+ \ifnum\c@pgfmathroundto@lastzeros=\c@pgfmathroundto@offsetbehindperiod
+ \ifpgfmathround@impl@PREPERIOD@is@negative@zero
+ % write '0.0000' instead of '-0.0000':
+ \expandafter\pgfmathroundto@impl@discard@minus\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI
+ \fi
+ \fi
+ \ifnum\c@pgfmathroundto@prec=0\relax
+ \expandafter\pgfmathroundto@impl@discard@period\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI
+ \else
+ \advance\c@pgfmathroundto@prec by-\c@pgfmathroundto@offsetbehindperiod
+ \c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec
+ \pgfmathroundto@impl@append@zeros
+ \edef\pgfmathresult{\the\pgfmathfloat@tmptoks}%
+ \fi
+ \else
+ \pgfmathroundto@impl@discard@suffix@zeros
+ \fi
+}
+
+\def\pgfmathroundto@impl@discard@minus-#1\pgfmathfloat@EOI{\pgfmathfloat@tmptoks={#1}}%
+
+% appends \c@pgfmathroundto@offsetbehindperiod zeros at the end of \pgfmathfloat@tmptoks.
+\def\pgfmathroundto@impl@append@zeros{%
+ \ifnum\c@pgfmathroundto@offsetbehindperiod>0
+ \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}%
+ \advance\c@pgfmathroundto@offsetbehindperiod by-1
+ \pgfmathroundto@impl@append@zeros
+ \fi
+}
+
+\def\pgfmathroundto@impl@ADD@ONE{%
+ \pgfmathfloat@tmptoks={}% no longer needed because its old value will be read from input
+ \pgfmathroundto@impl@ADD@ONE@ITERATE
+}
+\def\pgfmathroundto@impl@ADD@ONE@ITERATE{%
+ \pgfutil@ifnextchar\pgfmathfloat@EOI{%
+ \global\pgfmathfloatroundmayneedrenormalizetrue
+ \edef\pgfmathresult{1\the\pgfmathfloat@tmptoks}%
+ \pgfmathroundto@impl@gobble
+ }{%
+ \pgfutil@ifnextchar.{%
+ \ifnum\c@pgfmathroundto@prec=0
+ % silently discard period in special case precision=0
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE@gobble@dot}%
+ \else
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@NEXT@COLLECT}%
+ \fi
+ \pgfmathround@nextcmd
+ }{%
+ \pgfutil@ifnextchar+{%
+ \global\pgfmathfloatroundmayneedrenormalizetrue
+ \edef\pgfmathresult{1\the\pgfmathfloat@tmptoks}%
+ \pgfmathroundto@impl@gobble@rest
+ }{%
+ \pgfutil@ifnextchar-{%
+ \global\pgfmathfloatroundmayneedrenormalizetrue
+ \edef\pgfmathresult{-1\the\pgfmathfloat@tmptoks}%
+ \pgfmathroundto@impl@gobble@rest
+ }{%
+ \pgfmathroundto@impl@ADD@ONE@NEXT
+ }%
+ }%
+ }%
+ }%
+}
+
+\def\pgfmathroundto@impl@ADD@ONE@ITERATE@gobble@dot.{%
+ \pgfmathfloatroundhasperiodfalse
+ \aftergroup\pgfmathfloatroundhasperiodfalse
+ \pgfmathroundto@impl@ADD@ONE@ITERATE
+}
+
+\def\pgfmathroundto@impl@ADD@ONE@NEXT@COLLECT#1{%
+ \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}%
+ \pgfmathroundto@impl@ADD@ONE@ITERATE
+}
+\def\pgfmathroundto@impl@ADD@ONE@NEXT#1{%
+ \ifnum#1=9
+ \ifnum\c@pgfmathroundto@offsetbehindperiod<0
+ \ifpgfmathfloat@fixed@digits@after@period
+ \pgfmathfloat@tmptoks=\expandafter{\expandafter0\the\pgfmathfloat@tmptoks}%
+ \else
+ % silently DROP digit
+ \fi
+ \else
+ \pgfmathfloat@tmptoks=\expandafter{\expandafter0\the\pgfmathfloat@tmptoks}%
+ \fi
+ \advance\c@pgfmathroundto@offsetbehindperiod by1
+ \ifnum\c@pgfmathroundto@offsetbehindperiod=0
+ \ifpgfmathfloat@fixed@digits@after@period
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE}%
+ \else
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE@gobble@dot}%
+ \fi
+ \else
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE}%
+ \fi
+ \else
+ % re-use this counter:
+ \c@pgfmathroundto@lastzeros=#1
+ \advance\c@pgfmathroundto@lastzeros by1
+ \edef\pgfmathresult{\the\c@pgfmathroundto@lastzeros\the\pgfmathfloat@tmptoks}%
+ \pgfmathfloat@tmptoks=\expandafter{\pgfmathresult}%
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@REVERSE@ITERATE}%
+ \fi
+ \pgfmathround@nextcmd
+}
+
+
+\def\pgfmathroundto@impl@discard@suffix@zeros{%
+ \ifnum\c@pgfmathroundto@lastzeros=\c@pgfmathroundto@offsetbehindperiod
+ \ifpgfmathround@impl@PREPERIOD@is@negative@zero
+ \pgfmathfloatroundhasperiodfalse
+ \aftergroup\pgfmathfloatroundhasperiodfalse
+ \def\pgfmathresult{0}% write '0' instead of '-0'
+ \else
+ \expandafter\pgfmathroundto@impl@discard@period\pgfmathround@input\pgfmathfloat@EOI
+ \fi
+ \else
+ \ifnum\c@pgfmathroundto@lastzeros=0
+ \expandafter\pgfmathroundto@impl@REVERSE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI
+ \else
+ \expandafter\pgfmathroundto@impl@discard@suffix@zeros@ITERATE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI
+ \fi
+ \fi
+}
+
+% PRECONDITION:
+% \c@pgfmathroundto@lastzeros > 0
+\def\pgfmathroundto@impl@discard@suffix@zeros@ITERATE#1{%
+ \advance\c@pgfmathroundto@lastzeros by-1
+ \ifnum\c@pgfmathroundto@lastzeros=0
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@REVERSE}%
+ \else
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@discard@suffix@zeros@ITERATE}%
+ \fi
+ \pgfmathround@nextcmd
+}
+
+% Usage:
+% \pgfmathroundto@impl@REVERSE#1\pgfmathfloat@EOI
+% -> writes #1 reversed into \pgfmathfloat@tmptoks
+\def\pgfmathroundto@impl@REVERSE{%
+ \pgfmathfloat@tmptoks={}%
+ \pgfmathroundto@impl@REVERSE@ITERATE
+}
+
+\def\pgfmathroundto@impl@REVERSE@ITERATE{%
+ \pgfutil@ifnextchar\pgfmathfloat@EOI{%
+ \edef\pgfmathresult{\the\pgfmathfloat@tmptoks}%
+ \pgfmathroundto@impl@gobble
+ }{%
+ \pgfmathroundto@impl@REVERSE@NEXT
+ }%
+}
+
+\def\pgfmathroundto@impl@REVERSE@NEXT#1{%
+ \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}%
+ \pgfmathroundto@impl@REVERSE@ITERATE
+}
+
+\def\pgfmathroundto@impl@BEGIN@DOT.{%
+ \pgfmathfloat@tmptoks=\expandafter{\expandafter.\the\pgfmathfloat@tmptoks}%
+ \c@pgfmathroundto@offsetbehindperiod=0
+ \pgfmathroundto@impl@ITERATE@DOT
+}
+\def\pgfmathroundto@impl@ITERATE@DOT{%
+ \pgfutil@ifnextchar\pgfmathfloat@EOI{%
+ % finished.
+ \pgfmathroundto@impl@gobble@and@start
+ }{%
+ \pgfmathroundto@impl@NEXT@DOT
+ }%
+}
+\def\pgfmathroundto@impl@NEXT@DOT#1{%
+ \ifnum\c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec
+ \def\pgfmathround@next{#1}%
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@gobble@rest@and@start}%
+ \else
+ \advance\c@pgfmathroundto@offsetbehindperiod by1
+ \ifnum#1=0
+ \advance\c@pgfmathroundto@lastzeros by1
+ \else
+ \c@pgfmathroundto@lastzeros=0
+ \fi
+ \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}%
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ITERATE@DOT}%
+ \fi
+ \pgfmathround@nextcmd
+}%
+
+% in contrast to pgfmathroundto@impl@ITERATE@NODOT, this method here
+% checks also for signs
+\def\pgfmathroundto@impl@ITERATE@NODOT@firstcall#1{%
+ \def\pgfmathround@cur{#1}%
+ \ifx\pgfmathround@cur\pgfmathfloat@EOI
+ \pgfmathround@impl@PREPERIOD@is@negative@zerofalse
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@start}%
+ \else
+ \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@PERIOD
+ \pgfmathround@impl@PREPERIOD@is@negative@zerofalse
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@BEGIN@DOT.}%
+ \else
+ \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@MINUS
+ \else
+ \pgfmathround@impl@PREPERIOD@is@negative@zerofalse
+ \fi
+ \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}%
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ITERATE@NODOT}%
+ \fi
+ \fi
+ \pgfmathround@nextcmd
+}
+
+\def\pgfmathroundto@impl@ITERATE@NODOT#1{%
+ \def\pgfmathround@cur{#1}%
+ \ifx\pgfmathround@cur\pgfmathfloat@EOI
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@start}%
+ \else
+ \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@PERIOD
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@BEGIN@DOT.}%
+ \else
+ \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@ZERO
+ \else
+ \pgfmathround@impl@PREPERIOD@is@negative@zerofalse
+ \fi
+ \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}%
+ \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ITERATE@NODOT}%
+ \fi
+ \fi
+ \pgfmathround@nextcmd
+}
+
+%--------------------------------------------
+% END of pgfmathroundto implementation.
+%--------------------------------------------
+
+
+% flags, mantissa and exponent has already been stored into
+% \pgfmathfloat@a@* [using ...@Mtok]
+%
+% PRECONDITION:
+% \ifpgfmathfloatroundhasperiod = \iftrue outside of the current
+% group
+%
+% POSTCONDITION:
+% \ifpgfmathfloatroundhasperiod will be set after the current TeX
+% group.
+\def\pgfmathfloatround@impl{%
+ \expandafter\pgfmathroundto@impl\expandafter{\the\pgfmathfloat@a@Mtok}%
+ \ifpgfmathfloatroundmayneedrenormalize
+ \ifpgfmathfloatroundhasperiod
+ \expandafter\pgfmathfloatround@impl@renormalize\pgfmathresult\pgfmathfloat@EOI%
+ \else
+ \expandafter\pgfmathfloatround@impl@renormalize\pgfmathresult.\pgfmathfloat@EOI%
+ \fi
+ \advance\pgfmathfloat@a@E by1
+ \fi
+ \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgfmathresult}{\the\pgfmathfloat@a@E}%
+}
+
+\def\pgfmathfloatround@impl@renormalize#1#2.#3\pgfmathfloat@EOI{%
+ \pgfmathroundto@impl{#1.#2#3}%
+}
+
+
+
+
+
+% ATTENTION: this thing REQUIRES a period in the mantissa!
+% collects everything into \pgfmathresult
+\def\pgfmathfloattofixed@impl#1.#2\relax{%
+ \ifnum\pgfmathfloat@a@E<0
+ \ifcase-\pgfmathfloat@a@E
+ \or%e-1
+ \pgfmathfloat@a@Mtok={0.}%
+ \or%e-2
+ \pgfmathfloat@a@Mtok={0.0}%
+ \or%e-3
+ \pgfmathfloat@a@Mtok={0.00}%
+ \or%e-4
+ \pgfmathfloat@a@Mtok={0.000}%
+ \or%e-5
+ \pgfmathfloat@a@Mtok={0.0000}%
+ \or%e-6
+ \pgfmathfloat@a@Mtok={0.00000}%
+ \or%e-7
+ \pgfmathfloat@a@Mtok={0.000000}%
+ \or%e-8
+ \pgfmathfloat@a@Mtok={0.0000000}%
+ \or%e-9
+ \pgfmathfloat@a@Mtok={0.00000000}%
+ \or%e-10
+ \pgfmathfloat@a@Mtok={0.000000000}%
+ \else%<= -11
+ \pgfmathfloat@a@Mtok={0.0000000000}%
+ \advance\pgfmathfloat@a@E by10
+ \pgfutil@loop
+ \ifnum\pgfmathfloat@a@E<-1
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok 0}%
+ \advance\pgfmathfloat@a@E by1
+ \pgfutil@repeat
+ \fi
+ \def\pgfmathfloat@loc@TMPb{#2}%
+ \def\pgfmathfloat@loc@TMPc{0}%
+ \ifx\pgfmathfloat@loc@TMPb\pgfmathfloat@loc@TMPc
+ \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok #1}%
+ \else
+ \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok #1#2}%
+ \fi
+ \else
+ %--------------------------------------------------
+ % \ifnum\pgfmathfloat@a@E=0%
+ % \edef\pgfmathresult{#1.#2}%
+ % \else
+ % \pgfmathfloat@a@Mtok={#1}%
+ % \pgfmathfloattofixed@impl@collectmantissa#2\count\pgfmathfloat@a@E
+ % \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok}%
+ % \fi
+ %--------------------------------------------------
+ \pgfmathfloat@a@Mtok{#1}%
+ \pgfmathfloattofixed@impl@pos#2000000000\pgfmathfloat@EOI
+ \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok}%
+ \fi
+}
+
+% FIXME: this implementation here is very fast, but it introduces trailing zeros. Is that acceptable?
+\def\pgfmathfloattofixed@impl@pos#1#2#3#4#5#6#7#8#9\pgfmathfloat@EOI{%
+ \ifcase\pgfmathfloat@a@E
+ % e+0
+ \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok .#1#2#3#4#5#6#7#8#9}%
+ \or%e+1
+ \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1.#2#3#4#5#6#7#8#9}%
+ \or%e+2
+ \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2.#3#4#5#6#7#8#9}%
+ \or%e+3
+ \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3.#4#5#6#7#8#9}%
+ \or%e+4
+ \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4.#5#6#7#8#9}%
+ \or%e+5
+ \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5.#6#7#8#9}%
+ \or%e+6
+ \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6.#7#8#9}%
+ \or%e+7
+ \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6#7.#8#9}%
+ \or%e+8
+ \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6#7#8.#9}%
+ \else%>=9
+ \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6#7#8}%
+ \advance\pgfmathfloat@a@E by-8
+ \pgfmathfloattofixed@impl@collectmantissa#9\count\pgfmathfloat@a@E
+ \fi
+}%
+
+\def\pgfmathfloattofixed@impl@collectmantissa#1#2\count#3{%
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok #1}%
+ \advance\pgfmathfloat@a@E by-1%
+ \def\pgfmathfloat@loc@TMPb{#2}%
+ \ifx\pgfmathfloat@loc@TMPb\pgfutil@empty
+ \pgfutil@loop
+ \ifnum\pgfmathfloat@a@E>0%
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok 0}%
+ \advance\pgfmathfloat@a@E by-1%
+ \pgfutil@repeat
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok .0}%
+ \else
+ \ifnum\pgfmathfloat@a@E=0
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok .#2}%
+ \else
+ \pgfmathfloattofixed@impl@collectmantissa#2\count#3%
+ \fi
+ \fi
+}
+
+
+% ============================================
+%
+%
+% \pgfmathfloatparsenumber implementation
+%
+%
+% ============================================
+
+% accepted parser tokens:
+\def\pgfmathfloatparsenumber@tok@ZERO{0}
+\def\pgfmathfloatparsenumber@tok@PLUS{+}
+\def\pgfmathfloatparsenumber@tok@MINUS{-}
+\def\pgfmathfloatparsenumber@tok@PERIOD{.}
+
+\newif\ifpgfmathfloatparsenumberpendingperiod
+
+\def\pgfflt@EOI{p@EOI}%
+\def\pgfflt@EOI@unexpanded{\pgfflt@EOI}%
+
+% Starts a finite-start-machine parser to read a number.
+%
+% The machine's state is represented by the macro which is currently
+% processed; state transitions are realised using \csname...#1\endcsname
+% constructions.
+%
+% It assigns \pgfmathfloat@a@S, \pgfmathfloat@a@Mtok, \pgfmathfloat@a@E.
+\def\pgfflt@impl#1{%
+ \pgfmathfloatparsenumberpendingperiodfalse
+ \pgfmathfloat@tmptoks={}% this register is used to collect PENDING ZEROS
+ \pgfmathfloat@a@E=0
+ % start parsing: check for sign:
+ \expandafter\ifx\csname pgfflt@#1\endcsname\relax
+ \pgfmathfloat@a@S=1
+ \expandafter\pgfflt@init\expandafter#1%
+ \else
+ \expandafter\expandafter\csname pgfflt@#1\endcsname
+ \fi
+}
+% State transitions:
+\expandafter\def\csname pgfflt@+\endcsname{%
+ \pgfmathfloat@a@S=1 %
+ \pgfflt@init}%
+\expandafter\def\csname pgfflt@-\endcsname{%
+ \pgfmathfloat@a@S=2 %
+ \pgfflt@init}%
+\expandafter\def\csname pgfflt@\pgfflt@EOI\endcsname{%
+ \pgfmathfloatparsenumber@handleerror{empty number}{}{}}%
+
+\pgfkeys{
+ /pgf/fpu/handlers/empty number/.style 2 args={%
+ /pgf/fpu/handlers/invalid number={#1}{#2}%
+ },
+ /pgf/fpu/empty number is zero/.style={%
+ /pgf/fpu/handlers/empty number/.code 2 args={%
+ \pgfmathfloatcreate{0}{0.0}{0}%
+ }%
+ },%
+ /pgf/fpu/handlers/invalid number/.code 2 args={%
+ \pgfmath@error{Could not parse input '#1' as a floating point number, sorry. The unreadable part was near '#2'.}{}%
+ },
+ /pgf/fpu/handlers/wrong lowlevel format/.code 2 args={%
+ \pgfmath@error{Sorry, an internal routine of the floating point unit got an ill-formatted floating point number `#1'. The unreadable part was near '#2'.}{}%
+ \let\pgfmathresult=\pgfutil@empty
+ },
+}
+
+% #1 the error handler
+% #2 the number which was invalid.
+% #3 the part which produced the error
+%
+% POSTCONDITION: the three registers
+% \pgfmathfloat@a@S
+% \pgfmathfloat@a@Mtok
+% \pgfmathfloat@a@E
+% will contain the number which results from the error handler.
+\def\pgfmathfloatparsenumber@handleerror#1#2#3{%
+ \let\pgfmathresult=\pgfutil@empty
+ \pgfmathfloatparsenumberpendingperiodfalse
+ \pgfkeys{/pgf/fpu/handlers/#1={#2}{#3}}%
+ \ifx\pgfmathresult\pgfutil@empty
+ \pgfmathfloat@a@S=3
+ \pgfmathfloat@a@Mtok={0.0}%
+ \pgfmathfloat@a@E=0
+ \else
+ \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E
+ \fi
+}
+\def\pgfflt@error#1\pgfflt@EOI{%
+ \begingroup
+ \pgfmathfloat@a@Mtok={#1}%
+ \xdef\pgfmathfloat@glob@TMP{%
+ \noexpand\pgfmathfloatparsenumber@handleerror
+ {invalid number}{\pgfmathresult}{\the\pgfmathfloat@a@Mtok}}%
+ \endgroup
+ \pgfmathfloat@glob@TMP
+}%
+
+
+
+% FROM: checksign.
+%
+\def\pgfflt@init#1{%
+ \expandafter\ifx\csname pgffltA@#1\endcsname\relax
+ \expandafter\pgfflt@error\expandafter#1%
+ \else
+ \expandafter\expandafter\csname pgffltA@#1\endcsname
+ \fi}
+% state transitions:
+\expandafter\def\csname pgffltA@0\endcsname{\pgfflt@leadingzero}% FIXME: inline optimization!
+\expandafter\def\csname pgffltA@1\endcsname{\pgfflt@nonzerodigit1}%
+\expandafter\def\csname pgffltA@2\endcsname{\pgfflt@nonzerodigit2}%
+\expandafter\def\csname pgffltA@3\endcsname{\pgfflt@nonzerodigit3}%
+\expandafter\def\csname pgffltA@4\endcsname{\pgfflt@nonzerodigit4}%
+\expandafter\def\csname pgffltA@5\endcsname{\pgfflt@nonzerodigit5}%
+\expandafter\def\csname pgffltA@6\endcsname{\pgfflt@nonzerodigit6}%
+\expandafter\def\csname pgffltA@7\endcsname{\pgfflt@nonzerodigit7}%
+\expandafter\def\csname pgffltA@8\endcsname{\pgfflt@nonzerodigit8}%
+\expandafter\def\csname pgffltA@9\endcsname{\pgfflt@nonzerodigit9}%
+\def\pgfflt@nonzerodigit#1{%
+ \pgfmathfloat@a@Mtok={#1}%
+ \pgfmathfloatparsenumberpendingperiodtrue
+ \pgfflt@positiveexp}%
+\expandafter\def\csname pgffltA@n\endcsname{\pgfflt@readnan}% FIXME: inlining?
+\expandafter\def\csname pgffltA@N\endcsname{\pgfflt@readnan}% FIXME: inlining?
+\expandafter\def\csname pgffltA@i\endcsname{\pgfflt@readinf}% FIXME: inlining?
+\expandafter\def\csname pgffltA@I\endcsname{\pgfflt@readinf}% FIXME: inlining?
+\expandafter\def\csname pgffltA@.\endcsname{% read '.9' like '0.9'
+ \pgfmathfloat@a@E=-1
+ \pgfflt@leadingzero@foundperiod}%
+
+\def\pgfflt@finish#1\pgfflt@EOI{}
+
+\def\pgfflt@readnan #1#2{%
+ \def\pgfflt@readnan@ok{1}%
+ \if#1a\else\if#1A\else\def\pgfflt@readnan@ok{0}\fi\fi
+ \if#2n\else\if#2N\else\def\pgfflt@readnan@ok{0}\fi\fi
+ \if\pgfflt@readnan@ok1%
+ \pgfmathfloat@a@S=3\relax%
+ \pgfmathfloat@a@Mtok={0.0}%
+ \pgfmathfloat@a@E=0%
+ \expandafter\pgfflt@finish
+ \else
+ \def\pgfflt@readnan@{\pgfflt@error #1#2}%
+ \expandafter\pgfflt@readnan@
+ \fi
+}
+\def\pgfflt@readinf #1#2{%
+ \def\pgfflt@readinf@ok{1}%
+ \if#1n\else\if#1N\else\def\pgfflt@readinf@ok{0}\fi\fi
+ \if#2f\else\if#2F\else\def\pgfflt@readinf@ok{0}\fi\fi
+ \if\pgfflt@readinf@ok1%
+ \ifnum\pgfmathfloat@a@S=1 %
+ \pgfmathfloat@a@S=4 %
+ \pgfmathfloat@a@Mtok={0.0}%
+ \else
+ \pgfmathfloat@a@S=5 %
+ \pgfmathfloat@a@Mtok={0.0}%
+ \fi
+ \pgfmathfloat@a@E=0 %
+ \expandafter\pgfflt@finish
+ \else
+ \def\pgfflt@readinf@{\pgfflt@error #1#2}%
+ \expandafter\pgfflt@readinf@
+ \fi
+}
+\def\pgfflt@leadingzero#1{%
+ \expandafter\ifx\csname pgffltB@#1\endcsname\relax
+ \expandafter\pgfflt@error\expandafter#1%
+ \else
+ \expandafter\expandafter\csname pgffltB@#1\endcsname
+ \fi}
+% State transitions:
+\expandafter\def\csname pgffltB@0\endcsname{\pgfflt@leadingzero}%
+\expandafter\def\csname pgffltB@1\endcsname{\pgfmathfloat@a@Mtok={1}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp}
+\expandafter\def\csname pgffltB@2\endcsname{\pgfmathfloat@a@Mtok={2}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp}
+\expandafter\def\csname pgffltB@3\endcsname{\pgfmathfloat@a@Mtok={3}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp}
+\expandafter\def\csname pgffltB@4\endcsname{\pgfmathfloat@a@Mtok={4}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp}
+\expandafter\def\csname pgffltB@5\endcsname{\pgfmathfloat@a@Mtok={5}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp}
+\expandafter\def\csname pgffltB@6\endcsname{\pgfmathfloat@a@Mtok={6}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp}
+\expandafter\def\csname pgffltB@7\endcsname{\pgfmathfloat@a@Mtok={7}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp}
+\expandafter\def\csname pgffltB@8\endcsname{\pgfmathfloat@a@Mtok={8}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp}
+\expandafter\def\csname pgffltB@9\endcsname{\pgfmathfloat@a@Mtok={9}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp}
+\expandafter\def\csname pgffltB@\pgfmathfloat@POSTFLAGSCHAR\endcsname{\pgfmathfloat@a@Mtok={0}\pgfflt@readlowlevelfloat}%
+\expandafter\def\csname pgffltB@.\endcsname{%
+ \pgfmathfloat@a@E=-1
+ \pgfflt@leadingzero@foundperiod}%
+\expandafter\def\csname pgffltB@e\endcsname{%
+ \pgfmathfloat@a@S=0\relax%
+ \pgfmathfloat@a@Mtok={0.0}%
+ \pgfmathfloat@a@E=0%
+ \pgfflt@readexponent}%
+\let\pgffltB@E=\pgffltB@e
+\expandafter\def\csname pgffltB@\pgfflt@EOI\endcsname{%
+ \pgfmathfloat@a@S=0\relax%
+ \pgfmathfloat@a@Mtok={0.0}%
+ \pgfmathfloat@a@E=0}%
+
+\def\pgfflt@leadingzero@foundperiod#1{%
+ \expandafter\ifx\csname pgffltC@#1\endcsname\relax
+ \expandafter\pgfflt@error\expandafter#1%
+ \else
+ \expandafter\expandafter\csname pgffltC@#1\endcsname
+ \fi}
+% State transitions:
+\expandafter\def\csname pgffltC@0\endcsname{%
+ \advance\pgfmathfloat@a@E by-1
+ \pgfflt@leadingzero@foundperiod}%
+\expandafter\def\csname pgffltC@1\endcsname{\pgfmathfloat@a@Mtok={1}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}%
+\expandafter\def\csname pgffltC@2\endcsname{\pgfmathfloat@a@Mtok={2}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}%
+\expandafter\def\csname pgffltC@3\endcsname{\pgfmathfloat@a@Mtok={3}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}%
+\expandafter\def\csname pgffltC@4\endcsname{\pgfmathfloat@a@Mtok={4}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}%
+\expandafter\def\csname pgffltC@5\endcsname{\pgfmathfloat@a@Mtok={5}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}%
+\expandafter\def\csname pgffltC@6\endcsname{\pgfmathfloat@a@Mtok={6}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}%
+\expandafter\def\csname pgffltC@7\endcsname{\pgfmathfloat@a@Mtok={7}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}%
+\expandafter\def\csname pgffltC@8\endcsname{\pgfmathfloat@a@Mtok={8}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}%
+\expandafter\def\csname pgffltC@9\endcsname{\pgfmathfloat@a@Mtok={9}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}%
+\expandafter\def\csname pgffltC@e\endcsname{%
+ \pgfmathfloat@a@S=0\relax%
+ \pgfmathfloat@a@Mtok={0.0}%
+ \pgfmathfloat@a@E=0%
+ \pgfflt@readexponent}%
+\let\pgffltC@E=\pgffltC@e
+\expandafter\def\csname pgffltC@\pgfflt@EOI\endcsname{%
+ \pgfmathfloat@a@S=0\relax%
+ \pgfmathfloat@a@Mtok={0.0}%
+ \pgfmathfloat@a@E=0}%
+
+
+\def\pgfflt@positiveexp#1{%
+ \expandafter\ifx\csname pgffltD@#1\endcsname\relax
+ \expandafter\pgfflt@error\expandafter#1%
+ \else
+ \expandafter\expandafter\csname pgffltD@#1\endcsname
+ \fi}
+% State transitions:
+\expandafter\def\csname pgffltD@0\endcsname{%
+ \advance\pgfmathfloat@a@E by1
+ \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}%
+ \pgfflt@pendingzeros@positiveexp}%
+\expandafter\def\csname pgffltD@1\endcsname{\pgffltD@nonzerodigit1}%
+\expandafter\def\csname pgffltD@2\endcsname{\pgffltD@nonzerodigit2}%
+\expandafter\def\csname pgffltD@3\endcsname{\pgffltD@nonzerodigit3}%
+\expandafter\def\csname pgffltD@4\endcsname{\pgffltD@nonzerodigit4}%
+\expandafter\def\csname pgffltD@5\endcsname{\pgffltD@nonzerodigit5}%
+\expandafter\def\csname pgffltD@6\endcsname{\pgffltD@nonzerodigit6}%
+\expandafter\def\csname pgffltD@7\endcsname{\pgffltD@nonzerodigit7}%
+\expandafter\def\csname pgffltD@8\endcsname{\pgffltD@nonzerodigit8}%
+\expandafter\def\csname pgffltD@9\endcsname{\pgffltD@nonzerodigit9}%
+\expandafter\def\csname pgffltD@\pgfmathfloat@POSTFLAGSCHAR\endcsname{\pgfflt@readlowlevelfloat}%
+\expandafter\def\csname pgffltD@.\endcsname{\pgfflt@finish@number@after@period}% FIXME : inlining?
+\expandafter\def\csname pgffltD@e\endcsname{\pgfflt@readexponent}% FIXME : inlining?
+\let\pgffltD@E=\pgffltD@e
+\expandafter\def\csname pgffltD@\pgfflt@EOI\endcsname{}% NOP
+\def\pgffltD@nonzerodigit#1{%
+ \advance\pgfmathfloat@a@E by1
+ \ifpgfmathfloatparsenumberpendingperiod
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}%
+ \pgfmathfloatparsenumberpendingperiodfalse
+ \fi
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}%
+ \pgfflt@positiveexp}%
+
+% Read a low-level floating point.
+% Since we are in the second state, \pgfmathfloat@a@Mtok contains the
+% FLAGS. The post-flags-char has also been read.
+\def\pgfflt@readlowlevelfloat#1e#2]\pgfflt@EOI{%
+ \pgfmathfloatparsenumberpendingperiodfalse
+ \pgfmathfloat@a@S=\the\pgfmathfloat@a@Mtok\relax
+ \pgfmathfloat@a@Mtok={#1}%
+ \pgfmathfloat@a@E=#2
+}%
+
+\def\pgfflt@readexponent#1\pgfflt@EOI{%
+ \afterassignment\pgfflt@readexponent@
+ \pgfmathfloat@b@E=#1 \pgfflt@EOI% the white space is important, otherwise \pgfflt@EOI will be expanded.
+}
+\def\pgfflt@readexponent@#1{%
+ \advance\pgfmathfloat@a@E by\pgfmathfloat@b@E\relax
+ %
+ % sanity checking:
+ \def\pgfmathfloat@loc@TMPb{#1}%
+ \ifx\pgfmathfloat@loc@TMPb\pgfflt@EOI@unexpanded
+ \else
+ \def\pgfmathfloat@loc@TMPb{\pgfflt@error#1}%
+ \expandafter\pgfmathfloat@loc@TMPb
+ \fi
+}
+
+\def\pgfflt@pendingzeros@positiveexp#1{%
+ \expandafter\ifx\csname pgffltE@#1\endcsname\relax
+ \expandafter\pgfflt@error\expandafter#1%
+ \else
+ \expandafter\expandafter\csname pgffltE@#1\endcsname
+ \fi}
+% State transitions:
+\expandafter\def\csname pgffltE@0\endcsname{%
+ \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}%
+ \advance\pgfmathfloat@a@E by1
+ \pgfflt@pendingzeros@positiveexp}%
+\expandafter\def\csname pgffltE@1\endcsname{\pgffltE@nonzerodigit1}%
+\expandafter\def\csname pgffltE@2\endcsname{\pgffltE@nonzerodigit2}%
+\expandafter\def\csname pgffltE@3\endcsname{\pgffltE@nonzerodigit3}%
+\expandafter\def\csname pgffltE@4\endcsname{\pgffltE@nonzerodigit4}%
+\expandafter\def\csname pgffltE@5\endcsname{\pgffltE@nonzerodigit5}%
+\expandafter\def\csname pgffltE@6\endcsname{\pgffltE@nonzerodigit6}%
+\expandafter\def\csname pgffltE@7\endcsname{\pgffltE@nonzerodigit7}%
+\expandafter\def\csname pgffltE@8\endcsname{\pgffltE@nonzerodigit8}%
+\expandafter\def\csname pgffltE@9\endcsname{\pgffltE@nonzerodigit9}%
+\expandafter\def\csname pgffltE@.\endcsname{\pgfflt@finish@number@after@period}% FIXME : inlining?
+\def\pgffltE@e{\pgfflt@readexponent}% FIXME : inlining?
+\let\pgffltE@E=\pgffltE@e
+\expandafter\def\csname pgffltE@\pgfflt@EOI\endcsname{}% NOP
+\def\pgffltE@nonzerodigit#1{%
+ \advance\pgfmathfloat@a@E by1
+ \ifpgfmathfloatparsenumberpendingperiod
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}%
+ \pgfmathfloatparsenumberpendingperiodfalse
+ \fi
+ \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}%
+ \pgfmathfloat@tmptoks={}%
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}%
+ \pgfflt@positiveexp}%
+
+\def\pgfflt@finish@number@after@period#1{%
+ \expandafter\ifx\csname pgffltF@#1\endcsname\relax
+ \expandafter\pgfflt@error\expandafter#1%
+ \else
+ \expandafter\expandafter\csname pgffltF@#1\endcsname
+ \fi}
+% State transitions:
+\expandafter\def\csname pgffltF@0\endcsname{%
+ \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}%
+ \pgfflt@pendingzeros}%
+\expandafter\def\csname pgffltF@1\endcsname{\pgffltF@nonzerodigit1}%
+\expandafter\def\csname pgffltF@2\endcsname{\pgffltF@nonzerodigit2}%
+\expandafter\def\csname pgffltF@3\endcsname{\pgffltF@nonzerodigit3}%
+\expandafter\def\csname pgffltF@4\endcsname{\pgffltF@nonzerodigit4}%
+\expandafter\def\csname pgffltF@5\endcsname{\pgffltF@nonzerodigit5}%
+\expandafter\def\csname pgffltF@6\endcsname{\pgffltF@nonzerodigit6}%
+\expandafter\def\csname pgffltF@7\endcsname{\pgffltF@nonzerodigit7}%
+\expandafter\def\csname pgffltF@8\endcsname{\pgffltF@nonzerodigit8}%
+\expandafter\def\csname pgffltF@9\endcsname{\pgffltF@nonzerodigit9}%
+\def\pgffltF@e{\pgfflt@readexponent}%
+\let\pgffltF@E=\pgffltF@e
+\expandafter\def\csname pgffltF@\pgfflt@EOI\endcsname{}% NOP
+\def\pgffltF@nonzerodigit#1{%
+ \ifpgfmathfloatparsenumberpendingperiod
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}%
+ \pgfmathfloatparsenumberpendingperiodfalse
+ \fi
+ \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}%
+ \pgfmathfloat@tmptoks={}%
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}%
+ \pgfflt@finish@number@after@period}%
+
+
+\def\pgfflt@pendingzeros#1{%
+ \expandafter\ifx\csname pgffltG@#1\endcsname\relax
+ \expandafter\pgfflt@error\expandafter#1%
+ \else
+ \expandafter\expandafter\csname pgffltG@#1\endcsname
+ \fi}
+% State transitions:
+\expandafter\def\csname pgffltG@0\endcsname{%
+ \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}%
+ \pgfflt@pendingzeros}%
+\expandafter\def\csname pgffltG@1\endcsname{\pgffltG@nonzerodigit1}%
+\expandafter\def\csname pgffltG@2\endcsname{\pgffltG@nonzerodigit2}%
+\expandafter\def\csname pgffltG@3\endcsname{\pgffltG@nonzerodigit3}%
+\expandafter\def\csname pgffltG@4\endcsname{\pgffltG@nonzerodigit4}%
+\expandafter\def\csname pgffltG@5\endcsname{\pgffltG@nonzerodigit5}%
+\expandafter\def\csname pgffltG@6\endcsname{\pgffltG@nonzerodigit6}%
+\expandafter\def\csname pgffltG@7\endcsname{\pgffltG@nonzerodigit7}%
+\expandafter\def\csname pgffltG@8\endcsname{\pgffltG@nonzerodigit8}%
+\expandafter\def\csname pgffltG@9\endcsname{\pgffltG@nonzerodigit9}%
+\def\pgffltG@e{\pgfflt@readexponent}% FIXME: inlining?
+\let\pgffltG@E=\pgffltG@e
+\expandafter\def\csname pgffltG@\pgfflt@EOI\endcsname{}% NOP
+\def\pgffltG@nonzerodigit#1{%
+ \ifpgfmathfloatparsenumberpendingperiod
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}%
+ \pgfmathfloatparsenumberpendingperiodfalse
+ \fi
+ \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}%
+ \pgfmathfloat@tmptoks={}%
+ \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}%
+ \pgfflt@finish@number@after@period}%
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathbase.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex
index cd34d3a8db0..a4e510d4dc8 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathbase.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex
@@ -9,7 +9,46 @@
%
% This file provides basic macros for converting between bases.
%
-% Version 1.414213 29/9/2007
+% Version 1.4142135 8/11/2008
+
+% Base conversion operations for the parser.
+%
+\pgfmathdeclarefunction{bin}{1}{%
+ \begingroup%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \c@pgfmath@counta=#1\relax\pgfmath@%
+ \expandafter\pgfmathbasetobase\expandafter\pgfmathresult\expandafter{\the\c@pgfmath@counta}{10}{2}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+\pgfmathdeclarefunction{hex}{1}{%
+ \begingroup%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \c@pgfmath@counta=#1\relax\pgfmath@%
+ \expandafter\pgfmathbasetobase\expandafter\pgfmathresult\expandafter{\the\c@pgfmath@counta}{10}{16}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+\pgfmathdeclarefunction{Hex}{1}{%
+ \begingroup%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \c@pgfmath@counta=#1\relax\pgfmath@%
+ \expandafter\pgfmathbasetoBase\expandafter\pgfmathresult\expandafter{\the\c@pgfmath@counta}{10}{16}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+\pgfmathdeclarefunction{oct}{1}{%
+ \begingroup%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \c@pgfmath@counta=#1\relax\pgfmath@%
+ \expandafter\pgfmathbasetobase\expandafter\pgfmathresult\expandafter{\the\c@pgfmath@counta}{10}{8}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% Additional macros:
% \pgfmathbasetodec
%
@@ -30,14 +69,14 @@
\pgfmath@checknumber{#2}%
\pgfmath@checkbase{#3}%
\def\pgfmath@base{#3}%
- \def\pgfmath@macro{#1}%
- \c@pgfmath@counta1\relax%
- \def\pgfmath@reversed{}%
- \expandafter\pgfmathbasetodec@#2\pgfmathbasetodec}
+ \def\pgfmath@base@macro{#1}%
+ \c@pgfmath@counta=1\relax%
+ \let\pgfmath@reversed=\pgfmath@empty%
+ \expandafter\pgfmathbasetodec@#2\pgfmath@base@stop}
\def\pgfmathbasetodec@#1{%
- \ifx\pgfmathbasetodec#1%
- \c@pgfmath@countb0%
+ \ifx#1\pgfmath@base@stop%
+ \c@pgfmath@countb=0%
\divide\c@pgfmath@counta by\pgfmath@base\relax%
\expandafter\pgfmathbasetodec@@%
\else%
@@ -50,32 +89,33 @@
\def\pgfmathbasetodec@@@#1{%
\ifx\pgfmathbasetodec#1\relax%
- \expandafter\edef\pgfmath@macro{\the\c@pgfmath@countb}%
- \let\pgfmath@next\pgfmathbasetodec@@@@%
+ \expandafter\edef\pgfmath@base@macro{\the\c@pgfmath@countb}%
+ \let\pgfmath@next=\pgfmathbasetodec@@@@%
\else%
\chardef\pgfmath@charnum`#1\relax%
- \c@pgfmath@countc\pgfmath@charnum%
+ \c@pgfmath@countc=\pgfmath@charnum\relax%
\ifnum\c@pgfmath@countc>96\relax%
- \advance\c@pgfmath@countc-87\relax%
+ \advance\c@pgfmath@countc by-87\relax%
\else
\ifnum\c@pgfmath@countc>64\relax%
- \advance\c@pgfmath@countc-55\relax%
+ \advance\c@pgfmath@countc by-55\relax%
\else
- \advance\c@pgfmath@countc-48\relax%
- \fi\fi%
+ \advance\c@pgfmath@countc by-48\relax%
+ \fi%
+ \fi%
\ifnum\c@pgfmath@countc<\pgfmath@base\relax%
- \multiply\c@pgfmath@countc\c@pgfmath@counta\relax%
- \advance\c@pgfmath@countb\c@pgfmath@countc%
+ \multiply\c@pgfmath@countc by\c@pgfmath@counta%
+ \advance\c@pgfmath@countb by\c@pgfmath@countc%
\divide\c@pgfmath@counta by\pgfmath@base\relax%
\let\pgfmath@next\pgfmathbasetodec@@@%
\else
\pgfmath@error{Digit `#1' invalid for base \pgfmath@base}%
- \let\pgfmath@next\relax%
+ \let\pgfmath@next=\relax%
\fi%
\fi%
\pgfmath@next}
\def\pgfmathbasetodec@@@@{%
- \expandafter\pgfmath@ensurenumberlength\expandafter{\pgfmath@macro}%
+ \expandafter\pgfmath@ensurenumberlength\expandafter{\pgfmath@base@macro}%
}
% \pgfmathdectobase
@@ -97,16 +137,16 @@
\def\pgfmathdectobase#1#2#3{%
\pgfmath@checknumber{#2}%
\pgfmath@checkbase{#3}%
- \c@pgfmath@counta#2\relax%
- \def#1{}%
+ \c@pgfmath@counta=#2\relax%
+ \let#1=\pgfmath@empty%
\pgfmathloop
\ifnum\c@pgfmath@counta>0\relax%
- \c@pgfmath@countb\c@pgfmath@counta%
- \divide\c@pgfmath@countb#3\relax%
- \multiply\c@pgfmath@countb-#3\relax%
- \advance\c@pgfmath@countb\c@pgfmath@counta%
+ \c@pgfmath@countb=\c@pgfmath@counta%
+ \divide\c@pgfmath@countb by#3\relax%
+ \multiply\c@pgfmath@countb by-#3\relax%
+ \advance\c@pgfmath@countb by\c@pgfmath@counta%
\edef#1{\csname pgfmath@lowercase digit@\the\c@pgfmath@countb\endcsname#1}%
- \divide\c@pgfmath@counta#3\relax%
+ \divide\c@pgfmath@counta by#3\relax%
\repeatpgfmathloop%
\pgfmath@ensurenumberlength{#1}}
@@ -129,35 +169,35 @@
\def\pgfmathdectoBase#1#2#3{%
\pgfmath@checkbase{#3}%
\pgfmath@checknumber{#2}%
- \c@pgfmath@counta#2\relax%
- \def#1{}%
+ \c@pgfmath@counta=#2\relax%
+ \let#1=\pgfmath@empty%
\pgfmathloop
\ifnum\c@pgfmath@counta>0\relax%
- \c@pgfmath@countb\c@pgfmath@counta%
- \divide\c@pgfmath@countb#3\relax%
- \multiply\c@pgfmath@countb-#3\relax%
- \advance\c@pgfmath@countb\c@pgfmath@counta%
+ \c@pgfmath@countb=\c@pgfmath@counta%
+ \divide\c@pgfmath@countb by#3\relax%
+ \multiply\c@pgfmath@countb by-#3\relax%
+ \advance\c@pgfmath@countb by\c@pgfmath@counta%
\edef#1{\csname pgfmath@uppercase digit@\the\c@pgfmath@countb\endcsname#1}%
- \divide\c@pgfmath@counta#3\relax%
+ \divide\c@pgfmath@counta by#3\relax%
\repeatpgfmathloop%
\pgfmath@ensurenumberlength{#1}}
-\def\pgfmath@createdigits{%
- \def\pgfmath@digitstyle{lowercase digit}%
- \c@pgfmath@counta0\relax%
- \pgfmath@createdigits@0123456789abcdefghijklmnopqrstuvwxyz\pgfmath@createdigits%
- \def\pgfmath@digitstyle{uppercase digit}%
- \c@pgfmath@counta0\relax%
- \pgfmath@createdigits@0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\pgfmath@createdigits}
+\def\pgfmath@base@digits@create{%
+ \def\pgfmath@base@digit@style{lowercase digit}%
+ \c@pgfmath@counta=0\relax%
+ \pgfmath@base@digits@create@0123456789abcdefghijklmnopqrstuvwxyz\pgfmath@base@digits@create%
+ \def\pgfmath@base@digit@style{uppercase digit}%
+ \c@pgfmath@counta=0\relax%
+ \pgfmath@base@digits@create@0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\pgfmath@base@digits@create}
-\def\pgfmath@createdigits@#1{%
- \ifx\pgfmath@createdigits#1\relax%
+\def\pgfmath@base@digits@create@#1{%
+ \ifx\pgfmath@base@digits@create#1\relax%
\else%
- \expandafter\pgfmath@def\expandafter{\pgfmath@digitstyle}{\the\c@pgfmath@counta}{#1}%
- \advance\c@pgfmath@counta1\relax%
- \expandafter\pgfmath@createdigits@%
+ \expandafter\pgfmath@def\expandafter{\pgfmath@base@digit@style}{\the\c@pgfmath@counta}{#1}%
+ \advance\c@pgfmath@counta by1\relax%
+ \expandafter\pgfmath@base@digits@create@%
\fi}
-\pgfmath@createdigits
+\pgfmath@base@digits@create
% \pgfmathbasetobase
%
@@ -177,8 +217,8 @@
% \mynumber <- 721
%
\def\pgfmathbasetobase#1#2#3#4{%
- \pgfmathbasetodec{\pgfmath@temp}{#2}{#3}%
- \pgfmathdectobase{#1}{\pgfmath@temp}{#4}
+ \pgfmathbasetodec{\pgfmath@base@temp}{#2}{#3}%
+ \pgfmathdectobase{#1}{\pgfmath@base@temp}{#4}%
}
% \pgfmathbasetobase
@@ -199,8 +239,8 @@
% \mynumber <- 142
%
\def\pgfmathbasetoBase#1#2#3#4{%
- \pgfmathbasetodec{\pgfmath@temp}{#2}{#3}%
- \pgfmathdectoBase{#1}{\pgfmath@temp}{#4}
+ \pgfmathbasetodec{\pgfmath@base@temp}{#2}{#3}%
+ \pgfmathdectoBase{#1}{\pgfmath@base@temp}{#4}%
}
\def\pgfmath@checkbase#1{%
@@ -209,7 +249,8 @@
\else%
\ifnum#1>36\relax%
\pgfmath@error{Cannot process numbers in base `#1'.}%
- \fi\fi}
+ \fi%
+ \fi}
\def\pgfmath@checknumber#1{%
\expandafter\pgfmath@checknumber@#1\pgfmath@}
@@ -236,27 +277,27 @@
% \foo <- 000007FF
%
\def\pgfmath@ensurenumberlength#1{%
- \def\pgfmath@tempa{#1}%
+ \def\pgfmath@base@tempa{#1}%
\expandafter\c@pgfmath@counta\pgfmath@basenumberlength\relax%
\expandafter\pgfmath@ensurenumberlength@#1\pgfmath@ensurenumberlength}
\def\pgfmath@ensurenumberlength@#1{%
\ifx\pgfmath@ensurenumberlength#1\relax%
\expandafter\pgfmath@ensurenumberlength@@%
\else%
- \advance\c@pgfmath@counta-1\relax%
+ \advance\c@pgfmath@counta by-1\relax%
\expandafter\pgfmath@ensurenumberlength@
\fi}
\def\pgfmath@ensurenumberlength@@{%
- \edef\pgfmath@tempb{\pgfmath@tempa}%
+ \edef\pgfmath@base@tempb{\pgfmath@base@tempa}%
\pgfmath@ensurenumberlength@@@}
\def\pgfmath@ensurenumberlength@@@{%
\ifnum\c@pgfmath@counta>0\relax%
- \advance\c@pgfmath@counta-1\relax%
- \edef\pgfmath@tempb{0\pgfmath@tempb}%
+ \advance\c@pgfmath@counta by-1\relax%
+ \edef\pgfmath@base@tempb{0\pgfmath@base@tempb}%
\expandafter\pgfmath@ensurenumberlength@@@%
\fi%
- \expandafter\edef\pgfmath@tempa{\pgfmath@tempb}}
+ \expandafter\edef\pgfmath@base@tempa{\pgfmath@base@tempb}}
\def\pgfmathsetbasenumberlength#1{\def\pgfmath@basenumberlength{#1}}
-\pgfmathsetbasenumberlength{1}% \ No newline at end of file
+\pgfmathsetbasenumberlength{1}%
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex
new file mode 100644
index 00000000000..ca741fa7adc
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex
@@ -0,0 +1,713 @@
+% Copyright 2007 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.
+
+% This file defines the mathematical functions and operators.
+%
+% Version 1.4142135 25/8/2008
+
+% add function.
+%
+\pgfmathdeclarefunction{add}{2}{%
+ \begingroup%
+ \pgfmath@x=#1pt\relax%
+ \pgfmath@y=#2pt\relax%
+ \advance\pgfmath@x by\pgfmath@y%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
+}
+
+
+% subtract function.
+%
+\pgfmathdeclarefunction{subtract}{2}{%
+ \begingroup%
+ \pgfmath@x=#1pt\relax%
+ \pgfmath@y=#2pt\relax%
+ \advance\pgfmath@x by-\pgfmath@y%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
+}
+
+% neg function.
+%
+\pgfmathdeclarefunction{neg}{1}{%
+ \begingroup%
+ \pgfmath@x=-#1pt\relax%
+ \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+% change the precedence for neg.
+% Otherwise, unary minus and exponentiation won't have the correct precedence
+% (test '-2^2')
+\def\pgfmath@operation@neg@precedence{500}
+
+% multiply function.
+%
+\pgfmathdeclarefunction{multiply}{2}{%
+ \begingroup%
+ \pgfmath@x=#1pt\relax%
+ \pgfmath@y=#2pt\relax%
+ \pgfmath@x=\pgfmath@tonumber{\pgfmath@y}\pgfmath@x%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
+}
+
+% divide function.
+%
+\newif\ifpgfmath@divide@period
+
+\pgfmathdeclarefunction{divide}{2}{%
+ \begingroup%
+ \pgfmath@x=#1pt\relax%
+ \pgfmath@y=#2pt\relax%
+ \let\pgfmath@sign=\pgfmath@empty%
+ \ifdim0pt=\pgfmath@y%
+ \pgfmath@error{You've asked me to divide `#1' by `#2', %
+ but I cannot divide any number by `#2'}%
+ \fi%
+ \afterassignment\pgfmath@xa%
+ \c@pgfmath@counta\the\pgfmath@y\relax%
+ \ifdim0pt=\pgfmath@xa%
+ \divide\pgfmath@x by\c@pgfmath@counta%
+ \else%
+ \ifdim0pt>\pgfmath@x%
+ \def\pgfmath@sign{-}%
+ \pgfmath@x=-\pgfmath@x%
+ \fi%
+ \ifdim0pt>\pgfmath@y%
+ \expandafter\def\expandafter\pgfmath@sign\expandafter{\pgfmath@sign-}%
+ \pgfmath@y=-\pgfmath@y%
+ \fi%
+ \ifdim1pt>\pgfmath@y%
+ \pgfmathreciprocal@{\pgfmath@tonumber{\pgfmath@y}}%
+ \pgfmath@x=\pgfmath@sign\pgfmathresult\pgfmath@x%
+ \else%
+ \def\pgfmathresult{0}%
+ \pgfmath@divide@periodtrue%
+ \c@pgfmath@counta=0\relax%
+ \pgfmathdivide@@%
+ \pgfmath@x=\pgfmath@sign\pgfmathresult pt\relax%
+ \fi%
+ \fi%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
+}
+
+\def\pgfmath@small@number{0.00002}
+
+\def\pgfmathdivide@@{%
+ \let\pgfmath@next=\relax%
+ \ifdim\pgfmath@small@number pt<\pgfmath@x%
+ \ifdim\pgfmath@small@number pt<\pgfmath@y%
+ \ifdim\pgfmath@y>\pgfmath@x%
+ \ifpgfmath@divide@period%
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult.}%
+ \pgfmath@divide@periodfalse%
+ \fi%
+ \pgfmathdivide@dimenbyten\pgfmath@y%
+ \ifdim\pgfmath@y>\pgfmath@x%
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult0}%
+ \fi%
+ \else%
+ \c@pgfmath@counta=\pgfmath@x%
+ \c@pgfmath@countb=\pgfmath@y%
+ \divide\c@pgfmath@counta by\c@pgfmath@countb%
+ \pgfmath@ya=\c@pgfmath@counta\pgfmath@y%
+ \advance\pgfmath@x by-\pgfmath@ya%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\pgfmathresult
+ \expandafter\expandafter\expandafter{\expandafter\pgfmathresult\the\c@pgfmath@counta}%
+ \fi%
+ \let\pgfmath@next=\pgfmathdivide@@%
+ \fi%
+ \fi%
+ \pgfmath@next%
+}
+
+\def\pgfmathdivide@dimenbyten#1{%
+ \edef\pgfmath@temp{\pgfmath@tonumber{#1}}%
+ \expandafter\pgfmathdivide@@dimenbyten\pgfmath@temp\@@#1\@@}
+\def\pgfmathdivide@@dimenbyten#1.#2\@@#3\@@{%
+ \pgfmath@tempcnta=#1\relax%
+ \divide\pgfmath@tempcnta by10\relax%
+ \pgfmath@tempcntb=\pgfmath@tempcnta%
+ \multiply\pgfmath@tempcnta by-10\relax%
+ \advance\pgfmath@tempcnta by#1\relax%
+ #3=\the\pgfmath@tempcntb.\the\pgfmath@tempcnta#2pt\relax%
+}
+
+
+% reciprocal function.
+%
+\pgfmathdeclarefunction{reciprocal}{1}{%
+ \begingroup%
+ \expandafter\pgfmath@x#1pt\relax%
+ \ifdim\pgfmath@x=0pt\relax%
+ \pgfmath@error{You asked me to calculate `1/#1', but I cannot divide any number by zero}{}%
+ \fi%
+ \edef\pgfmath@reciprocaltemp{\pgfmath@tonumber{\pgfmath@x}}%
+ \expandafter\pgfmathreciprocal@@\pgfmath@reciprocaltemp0000000\pgfmath@}
+\def\pgfmathreciprocal@@#1.#2#3#4#5#6#7\pgfmath@{%
+ \c@pgfmath@counta#2#3#4#5#6\relax%
+ % If the number is an integer, use TeX arithmatic.
+ \ifnum\c@pgfmath@counta=0\relax%
+ \pgfmath@x1pt\relax%
+ \divide\pgfmath@x#1\relax%
+ \else%
+ \ifnum#1>100\relax%
+ \c@pgfmath@counta#1#2#3#4\relax%
+ \c@pgfmath@countb1000000000\relax%
+ \divide\c@pgfmath@countb\c@pgfmath@counta%
+ \c@pgfmath@counta\c@pgfmath@countb%
+ \divide\c@pgfmath@counta10000\relax%
+ \pgfmath@x\c@pgfmath@counta pt\relax%
+ \multiply\c@pgfmath@counta-10000\relax%
+ \advance\c@pgfmath@countb\c@pgfmath@counta%
+ \pgfmath@y\c@pgfmath@countb pt\relax%
+ \divide\pgfmath@y1000000\relax%
+ \advance\pgfmath@x\pgfmath@y%
+ \else%
+ \c@pgfmath@counta#1#2#3#4#5#6\relax%
+ \c@pgfmath@countb1000000000\relax%
+ \divide\c@pgfmath@countb\c@pgfmath@counta%
+ \c@pgfmath@counta\c@pgfmath@countb%
+ \divide\c@pgfmath@counta10000\relax%
+ \pgfmath@x\c@pgfmath@counta pt\relax%
+ \multiply\c@pgfmath@counta-10000\relax%
+ \advance\c@pgfmath@countb\c@pgfmath@counta%
+ \pgfmath@y\c@pgfmath@countb pt\relax%
+ \pgfmath@y.1\pgfmath@y% Yes! This way is more accurate. Go figure...
+ \pgfmath@y.1\pgfmath@y%
+ \pgfmath@y.1\pgfmath@y%
+ \pgfmath@y.1\pgfmath@y%
+ \advance\pgfmath@x\pgfmath@y%
+ \fi%
+ \fi%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
+}
+
+% div function.
+%
+\pgfmathdeclarefunction{div}{2}{%
+ \begingroup%
+ \pgfmathdivide@{#1}{#2}%
+ \ifdim\pgfmathresult pt<0pt\relax%
+ \pgfmathceil@{\pgfmathresult}%
+ \else%
+ \pgfmathfloor@{\pgfmathresult}%
+ \fi%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \c@pgfmath@counta=\pgfmathresult\relax\pgfmath@%
+ \edef\pgfmathresult{\the\c@pgfmath@counta}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% mod function.
+%
+\pgfmathdeclarefunction{mod}{2}{%
+ \begingroup%
+ \pgfmath@xa#1pt%
+ \pgfmath@xb#2pt%
+ \pgfmath@x\pgfmath@xa%
+ \c@pgfmath@counta\pgfmath@xa%
+ \c@pgfmath@countb\pgfmath@xb%
+ \divide\c@pgfmath@counta\c@pgfmath@countb%
+ \multiply\pgfmath@xb\c@pgfmath@counta%
+ \advance\pgfmath@x-\pgfmath@xb%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
+}
+
+% Mod function (never negative).
+%
+\pgfmathdeclarefunction{Mod}{2}{%
+ \begingroup%
+ \pgfmathmod@{#1}{#2}%
+ \pgfmath@x=\pgfmathresult pt\relax%
+ \ifdim\pgfmath@x<0pt\relax%
+ \advance\pgfmath@x by#2pt\relax%
+ \fi%
+ \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% abs function.
+%
+\pgfmathdeclarefunction{abs}{1}{%
+ \begingroup%
+ \expandafter\pgfmath@x#1pt\relax%
+ \ifdim\pgfmath@x<0pt\relax%
+ \pgfmath@x-\pgfmath@x%
+ \fi%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
+}
+
+% e constant.
+%
+\pgfmathdeclarefunction{e}{0}{\def\pgfmathresult{2.718281828}}
+
+% ln function.
+%
+% This is based on an algorithm due to Rouben Rostamian and
+% uses coefficients contributed by Alain Matthes.
+%
+\pgfmathdeclarefunction{ln}{1}{%
+ \begingroup%
+ \expandafter\pgfmath@x#1pt\relax%
+ \ifdim\pgfmath@x>0pt\else%
+ \pgfmath@error{I cannot calculate the logarithm of `#1'}{}%
+ \fi%
+ \c@pgfmath@counta=0\relax%
+ \ifdim\pgfmath@x>2pt\relax%
+ \ifdim\pgfmath@x<128pt\relax%
+ \ifdim\pgfmath@x<8pt\relax%
+ \ifdim\pgfmath@x<4pt\relax%
+ \divide\pgfmath@x by2\relax%
+ \c@pgfmath@counta=1\relax%
+ \else%
+ \divide\pgfmath@x by4\relax%
+ \c@pgfmath@counta=2\relax%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x<32pt\relax%
+ \ifdim\pgfmath@x<16pt\relax%
+ \divide\pgfmath@x by8\relax%
+ \c@pgfmath@counta=3\relax%
+ \else%
+ \divide\pgfmath@x by16\relax%
+ \c@pgfmath@counta=4\relax%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x<64pt\relax%
+ \divide\pgfmath@x by32\relax%
+ \c@pgfmath@counta=5\relax%
+ \else%
+ \divide\pgfmath@x by64\relax%
+ \c@pgfmath@counta=6\relax%
+ \fi%
+ \fi%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x<2048pt\relax%
+ \ifdim\pgfmath@x<512pt\relax%
+ \ifdim\pgfmath@x<256pt\relax%
+ \divide\pgfmath@x by128\relax%
+ \c@pgfmath@counta=7\relax%
+ \else%
+ \divide\pgfmath@x by256\relax%
+ \c@pgfmath@counta=8\relax%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x<1024pt\relax%
+ \divide\pgfmath@x by512\relax%
+ \c@pgfmath@counta=9\relax%
+ \else%
+ \divide\pgfmath@x by1024\relax%
+ \c@pgfmath@counta=10\relax%
+ \fi%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x<8192pt\relax%
+ \ifdim\pgfmath@x<4096pt\relax%
+ \divide\pgfmath@x by2048\relax%
+ \c@pgfmath@counta=11\relax%
+ \else%
+ \divide\pgfmath@x by4096\relax%
+ \c@pgfmath@counta =12\relax%
+ \fi%
+ \else%
+ \divide\pgfmath@x by8192\relax%
+ \c@pgfmath@counta=13\relax%
+ \fi%
+ \fi%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x<1pt\relax%
+ \ifdim\pgfmath@x>0.0078125pt\relax% 2^-7
+ \ifdim\pgfmath@x>0.125pt\relax% 2^-3
+ \ifdim\pgfmath@x>0.5pt\relax% 2^-1
+ \multiply\pgfmath@x by2\relax%
+ \c@pgfmath@counta=-1\relax%
+ \else%
+ \multiply\pgfmath@x by4\relax%
+ \c@pgfmath@counta=-2\relax%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x>0.03125pt\relax% 2^-5
+ \ifdim\pgfmath@x>0.0625pt\relax%
+ \multiply\pgfmath@x by8\relax%
+ \c@pgfmath@counta=-3\relax%
+ \else%
+ \multiply\pgfmath@x by16\relax%
+ \c@pgfmath@counta=-4\relax%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x>0.015625pt\relax% 2^-6
+ \multiply\pgfmath@x by32\relax%
+ \c@pgfmath@counta=-5\relax%
+ \else%
+ \multiply\pgfmath@x by64\relax%
+ \c@pgfmath@counta=-6\relax%
+ \fi%
+ \fi%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x>0.000244140625pt\relax% 2^-11
+ \ifdim\pgfmath@x>0.001953125pt\relax% 2^-9
+ \ifdim\pgfmath@x>0.00390625pt\relax% 2^-8
+ \multiply\pgfmath@x by128\relax%
+ \c@pgfmath@counta=-7\relax%
+ \else%
+ \multiply\pgfmath@x by256\relax%
+ \c@pgfmath@counta=-8\relax%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x>0.0009765625pt\relax% 2^-10
+ \multiply\pgfmath@x by512\relax%
+ \c@pgfmath@counta=-9\relax%
+ \else%
+ \multiply\pgfmath@x by1024\relax%
+ \c@pgfmath@counta=-10\relax%
+ \fi%
+ \fi%
+ \else%
+ \ifdim\pgfmath@x>0.0001220703125pt\relax% 2^13
+ \ifdim\pgfmath@x>0.0002441406256pt\relax% 2^12
+ \multiply\pgfmath@x by2048\relax%
+ \c@pgfmath@counta=-11\relax%
+ \else%
+ \multiply\pgfmath@x by4096\relax%
+ \c@pgfmath@counta=-12\relax%
+ \fi%
+ \else%
+ \multiply\pgfmath@x by8192\relax%
+ \c@pgfmath@counta=-13\relax%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ %
+ % Use A+(B+(C+(D+(E+F*x)*x)*x)*x)*x
+ %
+ % where:
+ % A = -2.787927935
+ % B = 5.047861502
+ % C = -3.489886985
+ % D = 1.589480044
+ % E = -.4025153233
+ % F = 0.04300521312
+ %
+ \edef\pgfmath@temp{\pgfmath@tonumber{\pgfmath@x}}%
+ \pgfmath@x=0.04300521312\pgfmath@x%
+ \advance\pgfmath@x by-.4025153233pt\relax%
+ \pgfmath@x=\pgfmath@temp\pgfmath@x%
+ \advance\pgfmath@x by1.589480044pt\relax%
+ \pgfmath@x=\pgfmath@temp\pgfmath@x%
+ \advance\pgfmath@x by-3.489886985pt\relax%
+ \pgfmath@x=\pgfmath@temp\pgfmath@x%
+ \advance\pgfmath@x by5.047861502pt\relax%
+ \pgfmath@x=\pgfmath@temp\pgfmath@x%
+ \advance\pgfmath@x by-2.787927935pt\relax%
+ \advance\pgfmath@x by\c@pgfmath@counta pt\relax%
+ \pgfmath@x=0.6931471806\pgfmath@x%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
+}
+
+% log2 function.
+%
+\pgfmathdeclarefunction{log2}{1}{%
+ \begingroup%
+ \pgfmathln@{#1}%
+ \pgfmath@x=\pgfmathresult pt\relax%
+ \pgfmath@x=1.442695041\pgfmath@x% 1/ln(2).
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
+}
+
+% log10 function
+%
+\pgfmathdeclarefunction{log10}{1}{%
+ \begingroup%
+ \pgfmathln@{#1}%
+ \pgfmath@x=\pgfmathresult pt\relax%
+ \pgfmath@x=0.43429441\pgfmath@x% 1/ln(10).
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
+}
+
+% exp function.
+%
+\pgfmathdeclarefunction{exp}{1}{%
+ \begingroup%
+ \pgfmath@xc=#1pt\relax%
+ \ifdim\pgfmath@xc<-9pt%
+ \pgfmath@x=1sp\relax%
+ \else%
+ \ifdim\pgfmath@xc<0pt%
+ \pgfmath@xc=-\pgfmath@xc%
+ \fi%
+ \pgfmath@x=1pt\relax%
+ \pgfmath@xa=1pt\relax%
+ \pgfmath@xb=\pgfmath@x%
+ \pgfmathloop%
+ \divide\pgfmath@xa by\pgfmathcounter%
+ \pgfmath@xa=\pgfmath@tonumber\pgfmath@xc\pgfmath@xa%
+ \advance\pgfmath@x by\pgfmath@xa%
+ \ifdim\pgfmath@x=\pgfmath@xb%
+ \else%
+ \pgfmath@xb=\pgfmath@x%
+ \repeatpgfmathloop%
+ \ifdim#1pt<0pt%
+ \pgfmathreciprocal@{\pgfmath@tonumber\pgfmath@x}%
+ \pgfmath@x=\pgfmathresult pt\relax%
+ \fi%
+ \fi%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
+}
+
+% sqrt function.
+%
+\pgfmathdeclarefunction{sqrt}{1}{%
+ \begingroup%
+ \expandafter\pgfmath@x#1pt\relax%
+ \ifdim\pgfmath@x<0pt\relax%
+ \pgfmath@error{I cannot calculate the square-root of the negative number `#1'}{}%
+ \else%
+ \ifdim\pgfmath@x<10pt\relax%
+ \def\pgfmath@zeros{0}%
+ \def\pgfmath@targetiterations{1}%
+ \else%
+ \ifdim\pgfmath@x<100pt\relax%
+ \def\pgfmath@zeros{}%
+ \def\pgfmath@targetiterations{1}%
+ \else%
+ \ifdim\pgfmath@x<1000pt\relax%
+ \def\pgfmath@zeros{0}%
+ \def\pgfmath@targetiterations{2}%
+ \else%
+ \ifdim\pgfmath@x<10000pt\relax%
+ \def\pgfmath@zeros{}%
+ \def\pgfmath@targetiterations{2}%
+ \else%
+ \def\pgfmath@zeros{0}%
+ \def\pgfmath@targetiterations{3}%
+ \fi\fi\fi\fi\fi%
+ \edef\pgfmath@temp{\pgfmath@zeros\pgfmath@tonumber{\pgfmath@x}}%
+ \expandafter\pgfmath@sqrt@\pgfmath@temp\pgfmath@%
+}
+\def\pgfmath@sqrt@#1.#2\pgfmath@{\pgfmath@@sqrt@#1#2\pgfmath@empty\pgfmath@empty\pgfmath@}
+
+\def\pgfmath@@sqrt@#1#2{%
+ \c@pgfmath@countb=#1#2\relax%
+ \ifnum\c@pgfmath@countb>35\relax%
+ \ifnum\c@pgfmath@countb>63\relax%
+ \ifnum\c@pgfmath@countb>80\relax%
+ \c@pgfmath@counta=9\relax%
+ \else%
+ \c@pgfmath@counta=8\relax%
+ \fi%
+ \else%
+ \ifnum\c@pgfmath@countb>48\relax%
+ \c@pgfmath@counta=7\relax%
+ \else%
+ \c@pgfmath@counta=6\relax%
+ \fi%
+ \fi%
+ \else%
+ \ifnum\c@pgfmath@countb>15\relax%
+ \ifnum\c@pgfmath@countb>24\relax%
+ \c@pgfmath@counta5\relax%
+ \else%
+ \c@pgfmath@counta=4\relax%
+ \fi%
+ \else%
+ \ifnum\c@pgfmath@countb>3\relax%
+ \ifnum\c@pgfmath@countb>8\relax%
+ \c@pgfmath@counta=3\relax%
+ \else%
+ \c@pgfmath@counta=2\relax%
+ \fi%
+ \else%
+ \ifnum\c@pgfmath@countb>0\relax%
+ \c@pgfmath@counta=1\relax%
+ \else%
+ \c@pgfmath@counta=0\relax%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \edef\pgfmath@root{\the\c@pgfmath@counta}%
+ \edef\pgfmath@rootspecial{\the\c@pgfmath@counta}%
+ \multiply\c@pgfmath@counta by-\c@pgfmath@counta\relax%
+ \advance\c@pgfmath@counta by#1#2\relax%
+ \edef\pgfmath@remainder{\the\c@pgfmath@counta}%
+ \pgfmath@@@sqrt@%
+}
+
+\def\pgfmath@@@sqrt@#1#2{%
+ \ifx\pgfmath@empty#1%
+ \edef\pgfmath@remainder{\pgfmath@remainder00}%
+ \def\pgfmath@tokens{\pgfmath@empty\pgfmath@empty}%
+ \else%
+ \ifx\pgfmath@empty#2%
+ \edef\pgfmath@remainder{\pgfmath@remainder#10}%
+ \def\pgfmath@tokens{\pgfmath@empty\pgfmath@empty}%
+ \else%
+ \edef\pgfmath@remainder{\pgfmath@remainder#1#2}%
+ \def\pgfmath@tokens{}%
+ \fi\fi%
+ \c@pgfmath@counta=\pgfmath@rootspecial\relax%
+ \multiply\c@pgfmath@counta by20\relax%
+ \c@pgfmath@countb=\c@pgfmath@counta%
+ \multiply\c@pgfmath@countb by6\relax%
+ \advance\c@pgfmath@countb by36\relax%
+ \c@pgfmath@countc=\c@pgfmath@counta%
+ \multiply\c@pgfmath@countc by2\relax%
+ \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
+ \advance\c@pgfmath@countb by-\c@pgfmath@countc%
+ \advance\c@pgfmath@countb by-20\relax%
+ \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
+ \advance\c@pgfmath@countb by-\c@pgfmath@countc%
+ \advance\c@pgfmath@countb by-12\relax%
+ \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
+ \advance\c@pgfmath@countb by-\c@pgfmath@counta%
+ \advance\c@pgfmath@countb by-3\relax%
+ \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
+ \def\pgfmath@digit{0}%
+ \else%
+ \def\pgfmath@digit{1}%
+ \fi%
+ \else%
+ \advance\c@pgfmath@countb by\c@pgfmath@counta%
+ \advance\c@pgfmath@countb by5\relax%
+ \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
+ \def\pgfmath@digit{2}%
+ \else%
+ \def\pgfmath@digit{3}%
+ \fi%
+ \fi%
+ \else%
+ \advance\c@pgfmath@countb by\c@pgfmath@counta%
+ \advance\c@pgfmath@countb by9\relax%
+ \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
+ \def\pgfmath@digit{4}%
+ \else%
+ \def\pgfmath@digit{5}%
+ \fi%
+ \fi%
+ \else%
+ \advance\c@pgfmath@countb by\c@pgfmath@countc%
+ \advance\c@pgfmath@countb by28\relax%
+ \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
+ \advance\c@pgfmath@countb by-\c@pgfmath@counta%
+ \advance\c@pgfmath@countb by-15\relax%
+ \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
+ \def\pgfmath@digit{6}%
+ \else%
+ \def\pgfmath@digit{7}%
+ \fi%
+ \else%
+ \advance\c@pgfmath@countb by\c@pgfmath@counta%
+ \advance\c@pgfmath@countb by17\relax%
+ \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
+ \def\pgfmath@digit{8}%
+ \else%
+ \def\pgfmath@digit{9}%
+ \fi%
+ \fi%
+ \fi%
+ \edef\pgfmath@rootspecial{\pgfmath@rootspecial\pgfmath@digit}%
+ \advance\c@pgfmath@counta by\pgfmath@digit\relax%
+ \multiply\c@pgfmath@counta by-\pgfmath@digit\relax%
+ \advance\c@pgfmath@counta by\pgfmath@remainder\relax%
+ \edef\pgfmath@remainder{\the\c@pgfmath@counta}%
+ \c@pgfmath@counta=\pgfmath@targetiterations\relax%
+ \advance\c@pgfmath@counta by-1\relax%
+ \edef\pgfmath@targetiterations{\the\c@pgfmath@counta}%
+ \ifnum\c@pgfmath@counta=0\relax%
+ \edef\pgfmath@root{\pgfmath@root.\pgfmath@digit}%
+ \else%
+ \edef\pgfmath@root{\pgfmath@root\pgfmath@digit}%
+ \fi%
+ \ifnum\c@pgfmath@counta=-4\relax% -n+1 digits of precision.
+ \let\pgfmath@next\pgfmath@sqrt@end%
+ \else%
+ \let\pgfmath@next\pgfmath@@@sqrt@%
+ \fi%
+ \expandafter\pgfmath@next\pgfmath@tokens%
+}
+
+\def\pgfmath@sqrt@end#1\pgfmath@{%
+ \edef\pgfmathresult{\pgfmath@root}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup}
+
+% \pgfmathpow
+%
+% Calculates #1 ^ #2
+%
+\pgfmathdeclarefunction{pow}{2}{%
+ \begingroup%
+ \pgfmath@xa=#1pt%
+ \pgfmath@xb=#2pt%
+ \afterassignment\pgfmath@x%
+ \expandafter\c@pgfmath@counta\the\pgfmath@xb\relax%
+ \ifnum\c@pgfmath@counta<0\relax%
+ \c@pgfmath@counta=-\c@pgfmath@counta%
+ \pgfmathreciprocal@{#1}%
+ \pgfmath@xa=\pgfmathresult pt\relax%
+ \fi
+ \ifdim\pgfmath@x=0pt\relax%
+ \pgfmath@x=1pt\relax%
+ \pgfmathloop%
+ \ifnum\c@pgfmath@counta>0\relax%
+ \ifodd\c@pgfmath@counta%
+ \pgfmath@x=\pgfmath@tonumber{\pgfmath@x}\pgfmath@xa%
+ \fi
+ \ifnum\c@pgfmath@counta>1\relax%
+ \pgfmath@xa=\pgfmath@tonumber{\pgfmath@xa}\pgfmath@xa%
+ \fi%
+ \divide\c@pgfmath@counta by2\relax%
+ \repeatpgfmathloop%
+ \else%
+ \pgfmathln@{#1}%
+ \pgfmath@x=\pgfmathresult pt\relax%
+ \pgfmath@x=\pgfmath@tonumber{\pgfmath@xb}\pgfmath@x%
+ \pgfmathexp@{\pgfmath@tonumber{\pgfmath@x}}%
+ \pgfmath@x=\pgfmathresult pt\relax%
+ \fi%
+ \pgfmath@returnone\pgf@x%
+ \endgroup%
+}
+
+% factorial function.
+%
+\pgfmathdeclarefunction{factorial}{1}{%
+ \begingroup%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \c@pgfmath@counta=#1\relax\pgfmath@%
+ \pgfmath@x=1pt\relax%
+ \pgfmathloop%
+ \ifnum\c@pgfmath@counta<2\relax%
+ \else%
+ \multiply\pgfmath@x by\c@pgfmath@counta%
+ \advance\c@pgfmath@counta by-1\relax%
+ \repeatpgfmathloop%
+ \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex
new file mode 100644
index 00000000000..a493b6c6b62
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex
@@ -0,0 +1,240 @@
+% Copyright 2007 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.
+
+% Declare a function for the parser.
+%
+% #1 - the name of the function.
+% #2 - arity (or ... for variable arguments).
+% #3 - the code for the function.
+%
+% Use \pgfmathdeclarefunction* to force a redefinition if the function exists already.
+\def\pgfmathdeclarefunction{\pgfmath@ifnextchar*\pgfmathdeclarefunction@force\pgfmathdeclarefunction@check}
+\def\pgfmathdeclarefunction@check#1#2#3{%
+ \expandafter\ifx\csname pgfmath@function@#1\endcsname\relax%
+ \pgfmath@declarefunction{#1}{#2}{#3}%
+ \else%
+ \pgfmath@error{The function `#1' already exists}{}%
+ \fi%
+}
+\def\pgfmathdeclarefunction@force*{\pgfmath@declarefunction}%
+
+\def\pgfmathredeclarefunction#1#2{%
+ \expandafter\ifx\csname pgfmath@function@#1\endcsname\relax%
+ \pgfmath@error{The function `#1' does not exist}{}%
+ \else%
+ \pgfmath@namedef{pgfmath#1@}{#2}%
+ \fi%
+}
+
+\def\pgfmath@declarefunction#1#2{%
+ \pgfmath@namedef{pgfmath@function@#1}{#1}%
+ \pgfmath@namedef{pgfmath@operation@#1@type}{function}%
+ \pgfmath@namedef{pgfmath@operation@#1@arity}{#2}%
+ \pgfmath@namedef{pgfmath@operation@#1@infix}{#1}%
+ \pgfmath@namedef{pgfmath@operation@#1@precedence}{1000}%
+ \expandafter\ifx\csname pgfmath@operation@#1@arity\endcsname\pgfmath@dots%
+ \pgfmath@namedef{pgfmath@operation@#1@arity}{1}%
+ \else%
+ \ifnum\csname pgfmath@operation@#1@arity\endcsname>9\relax%
+ \pgfmath@namedef{pgfmath@operation@#1@arity}{1}%
+ \fi%
+ \fi%
+ \edef\pgfmath@marshal{%
+ \noexpand\pgfmath@@declarefunction%
+ {\expandafter\noexpand\csname pgfmath#1\endcsname}%
+ {\expandafter\noexpand\csname pgfmath#1@\endcsname}%
+ {\csname pgfmath@operation@#1@arity\endcsname}%
+ }%
+ \pgfmath@marshal%
+}
+
+% #1 - \pgfmath<name>.
+% #2 - \pgfmath<name>@.
+% #3 - arity.
+% #4 - code for function <name>.
+%
+\def\pgfmath@@declarefunction#1#2#3#4{% Function of arity 0 - 9.
+ \ifcase#3\relax%
+ \def#1{#2}%
+ \def#2{#4}%
+ \or
+ \def#1##1{\pgfmathparse{##1}\expandafter#2\expandafter{\pgfmathresult}}%
+ \def#2##1{#4}%
+ \else%
+ \pgfmath@toks={}%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>#3\relax%
+ \else%
+ \expandafter\pgfmath@addto@toks\expandafter{\pgfmath@char@hash}%
+ \expandafter\pgfmath@addto@toks\expandafter{\pgfmathcounter}%
+ \repeatpgfmathloop%
+ \edef\pgfmath@head{\noexpand\def\noexpand#1\the\pgfmath@toks}%
+ \edef\pgfmath@@head{\noexpand\def\noexpand#2\the\pgfmath@toks}%
+ \pgfmath@toks={}%
+ \def\pgfmath@arguments{}%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>#3\relax%
+ \else%
+ \pgfmath@addto@toks{\pgfmathparse}%
+ \expandafter\expandafter\expandafter\pgfmath@addto@toks%
+ \expandafter\expandafter\expandafter{\expandafter\expandafter\expandafter%
+ {\expandafter\pgfmath@char@hash\pgfmathcounter}}%
+ \pgfmath@addto@toks{\let}%
+ \expandafter\pgfmath@addto@toks\expandafter{%
+ \csname pgfmath@argument@\pgfmathcounter\endcsname=\pgfmathresult}%
+ \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter%
+ \pgfmath@arguments\expandafter\expandafter\expandafter{\expandafter%
+ \pgfmath@arguments\expandafter{\csname pgfmath@argument@\pgfmathcounter\endcsname}}%
+ \repeatpgfmathloop%
+ \expandafter\pgfmath@addto@toks\expandafter{\expandafter#2\pgfmath@arguments}%
+ \edef\pgfmath@body{{\the\pgfmath@toks}}%
+ \expandafter\pgfmath@head\pgfmath@body%
+ \pgfmath@@head{#4}%
+ \fi%
+}
+
+\def\pgfmath@addto@toks#1{%
+ \edef\pgfmath@toks@expanded{\the\pgfmath@toks}%
+ \expandafter\pgfmath@toks\expandafter{\pgfmath@toks@expanded#1}}
+
+% Key for declaring local functions.
+%
+\pgfkeys{%
+ /pgf/declare function/.code={%
+ \pgfmath@local@functions#1@=@;%
+ }
+}
+
+\def\pgfmath@local@gobbleone#1{}
+\def\pgfmath@local@at{@}%
+
+\def\pgfmath@local@functions{%
+ \pgfutil@ifnextchar x{\pgfmath@local@@functions}{\pgfmath@local@@functions}%
+}
+
+\def\pgfmath@local@@functions#1=#2;{%
+ \def\pgfmath@local@temp{#1}%
+ \ifx\pgfmath@local@temp\pgfmath@local@at%
+ \let\pgfmath@local@next=\relax%
+ \else%
+ \pgfmath@local@function#1=#2;%
+ \let\pgfmath@local@next=\pgfmath@local@functions%
+ \fi%
+ \pgfmath@local@next%
+}
+
+\def\pgfmath@local@function{%
+ \let\pgfmath@local@name=\pgfutil@empty%
+ \let\pgfmath@local@args=\pgfutil@empty%
+ \let\pgfmath@local@body=\pgfutil@empty%
+ \pgfmath@local@@function}
+
+\def\pgfmath@local@@function#1{%
+ \if#1=%
+ \let\pgfmath@local@next=\pgfmath@local@function@body%
+ \else%
+ \if#1(%
+ \let\pgfmath@local@next=\pgfmath@local@function@args%
+ \else%
+ \expandafter\def\expandafter\pgfmath@local@name\expandafter{\pgfmath@local@name#1}%
+ \let\pgfmath@local@next=\pgfmath@local@@function%
+ \fi%
+ \fi%
+ \pgfmath@local@next%
+}
+
+\def\pgfmath@local@function@args#1){%
+ \def\pgfmath@local@args{#1}%
+ \pgfmath@local@@function}
+
+\def\pgfmath@local@function@body#1;{%
+ \def\pgfmath@local@body{#1}%
+ \begingroup%
+ \c@pgf@counta=0\relax%
+ \ifx\pgfmath@local@args\pgfmath@empty%
+ \expandafter\pgfmath@toks\expandafter=\expandafter{\pgfmath@local@body}%
+ \else%
+ \pgfmath@toks={}%
+ \expandafter\pgfmath@local@function@@body\pgfmath@local@args,,%
+ \fi%
+ \xdef\pgfmath@local@temp{%
+ \noexpand\pgfmathdeclarefunction{\pgfmath@local@name}{\the\c@pgf@counta}%
+ {\noexpand\pgfmathparse{\the\pgfmath@toks}}%
+ }%
+ \endgroup%
+ \pgfmath@local@temp%
+}
+
+\def\pgfmath@local@function@@body#1,{%
+ \def\pgfmath@local@test{#1}%
+ \ifx\pgfmath@local@test\pgfutil@empty%
+ \let\pgfmath@local@next=\relax%
+ \else%
+ \edef\pgfmath@local@var@string{@\expandafter\pgfmath@local@gobbleone\string#1}%
+ \advance\c@pgf@counta by1\relax%
+ \expandafter\expandafter\expandafter\pgfmath@toks\expandafter\expandafter\expandafter=%
+ \expandafter\expandafter\expandafter{\expandafter\pgfmath@char@hash\the\c@pgf@counta}%
+ \edef#1{\the\pgfmath@toks}%
+ \pgfmath@toks={}%
+ \expandafter\pgfmath@local@function@@@body\pgfmath@local@body @%
+ \edef\pgfmath@local@body{\the\pgfmath@toks}%
+ \let\pgfmath@local@next=\pgfmath@local@function@@body%
+ \fi%
+ \pgfmath@local@next%
+}
+
+\def\pgfmath@local@function@@@body{%
+ \pgfutil@ifnextchar\bgroup{\pgfmath@local@function@@@body@bgroup}%
+ {\pgfmath@local@function@@@body@nobgroup}}%
+
+\def\pgfmath@local@function@@@body@bgroup#1{%
+ \begingroup%
+ \pgfmath@toks={}%
+ \pgfmath@local@function@@@body#1 @%
+ \xdef\pgfmath@local@temp{{\the\pgfmath@toks}}%
+ \endgroup%
+ \expandafter\pgfmath@addto@toks\expandafter{\pgfmath@local@temp}%
+ \pgfmath@local@function@@@body%
+}
+
+\def\pgfmath@local@function@@@body@nobgroup#1{%
+ \ifx#1@%
+ \let\pgfmath@local@next=\relax%
+ \else%
+ \let\pgfmath@local@next=\pgfmath@local@function@@@body%
+ \edef\pgfmath@local@var@@string{@\expandafter\pgfmath@local@gobbleone\string#1}%
+ \ifx\pgfmath@local@var@@string\pgfmath@local@var@string%
+ \expandafter\pgfmath@addto@toks\expandafter{#1}%
+ \else%
+ \edef\pgfmath@local@temp{\the\pgfmath@toks}%
+ \pgfmath@toks={#1}%
+ \edef\pgfmath@local@@temp{\the\pgfmath@toks}%
+ \expandafter\pgfmath@toks\expandafter=\expandafter{\pgfmath@local@temp}%
+ \expandafter\pgfmath@addto@toks\expandafter{\pgfmath@local@@temp}%
+ \fi%
+ \fi%
+ \pgfmath@local@next%
+}
+
+% Allows to define 'x' as some \TeX command '#2'.
+\def\pgfmathdeclarepseudoconstant#1#2{%
+ \pgfmathdeclarefunction*{#1}{0}{#2}%
+}%
+% Redefines a pseudo constant '#1'.
+\def\pgfmathredeclarepseudoconstant#1#2{%
+ \pgfmathredeclarefunction{#1}{#2}%
+}%
+
+\input pgfmathfunctions.basic.code.tex
+\input pgfmathfunctions.trigonometric.code.tex
+\input pgfmathfunctions.random.code.tex
+\input pgfmathfunctions.comparison.code.tex
+\input pgfmathfunctions.base.code.tex
+\input pgfmathfunctions.round.code.tex
+\input pgfmathfunctions.misc.code.tex
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex
new file mode 100644
index 00000000000..54a8d64220e
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex
@@ -0,0 +1,179 @@
+% Copyright 2007 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.
+
+% This file defines the mathematical functions and operators.
+%
+% Version 1.4142135 11/8/2008
+
+\pgfmathdeclarefunction{greater}{2}{%
+ \begingroup%
+ \ifdim#1pt>#2pt\relax%
+ \def\pgfmathresult{1}%
+ \else%
+ \def\pgfmathresult{0}%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+\let\pgfmathgreaterthan=\pgfmathgreater
+
+\pgfmathdeclarefunction{less}{2}{%
+ \begingroup%
+ \ifdim#1pt<#2pt\relax%
+ \def\pgfmathresult{1}%
+ \else%
+ \def\pgfmathresult{0}%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+\let\pgfmathlessthan=\pgfmathless
+
+\pgfmathdeclarefunction{equal}{2}{%
+ \begingroup%
+ \ifdim#1pt=#2pt\relax%
+ \def\pgfmathresult{1}%
+ \else%
+ \def\pgfmathresult{0}%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+\let\pgfmathequalto=\pgfmathequal
+
+
+% approxequalto function from Christian Feuersanger.
+%
+\newif\ifpgfmathcomparison
+\pgfmathdeclarefunction{approxequalto}{2}{%
+ \begingroup%
+ \pgfmath@x=#1pt\relax%
+ \pgfmath@y=#2pt\relax%
+ \advance\pgfmath@x by-\pgfmath@y%
+ \ifdim\pgfmath@x<0pt\relax%
+ \multiply\pgfmath@x by-1\relax%
+ \fi
+ \ifdim\pgfmath@x<0.0001pt\relax%
+ \def\pgfmathresult{1.0}%
+ \global\pgfmathcomparisontrue%
+ \else%
+ \def\pgfmathresult{0.0}%
+ \global\pgfmathcomparisonfalse%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+
+
+% ifthenelse function.
+%
+\pgfmathdeclarefunction{ifthenelse}{3}{%
+ \begingroup%
+ \ifdim#1pt=0.0pt\relax%
+ \expandafter\def\expandafter\pgfmathresult\expandafter{#3}%
+ \else%
+ \expandafter\def\expandafter\pgfmathresult\expandafter{#2}%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% notequal function.
+%
+\pgfmathdeclarefunction{notequal}{2}{%
+ \begingroup%
+ \ifdim#1pt=#2pt\relax%
+ \def\pgfmathresult{0}%
+ \else%
+ \def\pgfmathresult{1}%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% notless function.
+%
+\pgfmathdeclarefunction{notless}{2}{%
+ \begingroup%
+ \ifdim#1pt<#2pt\relax%
+ \def\pgfmathresult{0}%
+ \else%
+ \def\pgfmathresult{1}%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% notgreater function.
+%
+\pgfmathdeclarefunction{notgreater}{2}{%
+ \begingroup%
+ \ifdim#1pt>#2pt\relax%
+ \def\pgfmathresult{0}%
+ \else%
+ \def\pgfmathresult{1}%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% and function.
+%
+\pgfmathdeclarefunction{and}{2}{%
+ \begingroup%
+ \def\pgfmathresult{1}%
+ \ifdim#1pt=0pt\relax%
+ \def\pgfmathresult{0}%
+ \else%
+ \ifdim#2pt=0pt\relax%
+ \def\pgfmathresult{0}%
+ \fi%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% or function.
+%
+\pgfmathdeclarefunction{or}{2}{%
+ \begingroup%
+ \def\pgfmathresult{0}%
+ \ifdim#1pt=0pt\relax%
+ \ifdim#2pt=0pt\relax%
+ \else%
+ \def\pgfmathresult{1}%
+ \fi%
+ \else%
+ \def\pgfmathresult{1}%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% not function.
+%
+\pgfmathdeclarefunction{not}{1}{%
+ \begingroup%
+ \ifdim#1pt=0pt\relax%
+ \def\pgfmathresult{1}%
+ \else%
+ \def\pgfmathresult{0}%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% true function.
+%
+\pgfmathdeclarefunction{true}{0}{\def\pgfmathresult{1}}
+
+% false function.
+%
+\pgfmathdeclarefunction{false}{0}{\def\pgfmathresult{0}}
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex
new file mode 100644
index 00000000000..65460e4b3cc
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex
@@ -0,0 +1,320 @@
+% Copyright 2007 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.
+
+% This file defines the mathematical functions and operators.
+%
+% Version 1.414213 29/9/2007
+
+% veclen function adpated from ideas due to Rouben Rostamian.
+%
+% Calcluate the Eulidean length of a 2D vector.
+%
+%
+\pgfmathdeclarefunction{veclen}{2}{%
+ \begingroup%
+ \pgfmath@x#1pt\relax%
+ \pgfmath@y#2pt\relax%
+ \ifdim\pgfmath@x<0pt\relax%
+ \pgfmath@x-\pgfmath@x%
+ \fi%
+ \ifdim\pgfmath@y<0pt\relax%
+ \pgfmath@y-\pgfmath@y%
+ \fi%
+ \ifdim\pgfmath@x=0pt\relax%
+ \pgfmath@x\pgfmath@y%
+ \else%
+ \ifdim\pgfmath@y=0pt\relax%
+ \else%
+ \ifdim\pgfmath@x>\pgfmath@y%
+ \pgfmath@xa\pgfmath@x%
+ \pgfmath@x\pgfmath@y%
+ \pgfmath@y\pgfmath@xa%
+ \fi%
+ % We use a scaling factor to reduce errors.
+ \ifdim\pgfmath@y>10000pt\relax%
+ \c@pgfmath@counta1500\relax%
+ \else%
+ \ifdim\pgfmath@y>1000pt\relax%
+ \c@pgfmath@counta150\relax%
+ \else%
+ \ifdim\pgfmath@y>100pt\relax%
+ \c@pgfmath@counta50\relax%
+ \else%
+ \c@pgfmath@counta1\relax%
+ \fi%
+ \fi%
+ \fi%
+ \divide\pgfmath@x\c@pgfmath@counta\relax%
+ \divide\pgfmath@y\c@pgfmath@counta\relax%
+ \pgfmathreciprocal@{\pgfmath@tonumber{\pgfmath@y}}%
+ \pgfmath@x\pgfmathresult\pgfmath@x%
+ \pgfmath@xa\pgfmath@tonumber{\pgfmath@x}\pgfmath@x%
+ \edef\pgfmath@temp{\pgfmath@tonumber{\pgfmath@xa}}%
+ %
+ % Use A+x^2*(B+x^2*(C+x^2*(D+E*x^2)))
+ % where
+ % A = +1.000012594
+ % B = +0.4993615349
+ % C = -0.1195159052
+ % D = +0.04453994279
+ % E = -0.01019210944
+ %
+ \pgfmath@x-0.01019210944\pgfmath@xa%
+ \advance\pgfmath@x0.04453994279pt\relax%
+ \pgfmath@x\pgfmath@temp\pgfmath@x%
+ \advance\pgfmath@x-0.1195159052pt\relax%
+ \pgfmath@x\pgfmath@temp\pgfmath@x%
+ \advance\pgfmath@x0.4993615349pt\relax%
+ \pgfmath@x\pgfmath@temp\pgfmath@x%
+ \advance\pgfmath@x1.000012594pt\relax%
+ \ifdim\pgfmath@y<0pt\relax%
+ \pgfmath@y-\pgfmath@y%
+ \fi%
+ \pgfmath@x\pgfmath@tonumber{\pgfmath@y}\pgfmath@x%
+ % Invert the scaling factor.
+ \multiply\pgfmath@x\c@pgfmath@counta\relax%
+ \fi%
+ \fi%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
+}
+
+% Hyperbolic functions contributed by Martin Heller.
+%
+\pgfmathdeclarefunction{cosh}{1}{%
+ \begingroup
+ \edef\pgfmath@arg{#1}%
+ \pgfmathexp@{\pgfmath@arg}%
+ \pgfmath@x=\pgfmathresult pt\relax%
+ \pgfmathexp@{-\pgfmath@arg}%
+ \advance\pgfmath@x by\pgfmathresult pt\relax%
+ \divide\pgfmath@x by2\relax%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup}
+
+\pgfmathdeclarefunction{sinh}{1}{%
+ \begingroup
+ \edef\pgfmath@arg{#1}%
+ \pgfmathexp@{\pgfmath@arg}%
+ \pgfmath@x=\pgfmathresult pt\relax%
+ \pgfmathexp@{-\pgfmath@arg}%
+ \advance\pgfmath@x by-\pgfmathresult pt\relax%
+ \divide\pgfmath@x by2\relax%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup
+}%
+
+\pgfmathdeclarefunction{tanh}{1}{%
+ \begingroup
+ \edef\pgfmath@arg{#1}%
+ \pgfmathsinh@{\pgfmath@arg}%
+ \pgfmath@x=\pgfmathresult pt\relax%
+ \pgfmathcosh@{\pgfmath@arg}%
+ \pgfmath@y=\pgfmathresult pt\relax%
+ \pgfmathdivide@{\pgfmath@tonumber{\pgfmath@x}}{\pgfmath@tonumber{\pgfmath@y}}%
+ \pgfmath@x=\pgfmathresult pt\relax%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup
+}%
+
+% \pgfmathscientific
+%
+% Return the value of #1e#2
+%
+% e.g. \pgfmathscientific{1.23456789123}{4}
+%
+% defines \pgfmathresult as 12345.67891
+%
+% NB These arguments *are not parsed*, as the long mantissa would be lost.
+%
+\def\pgfmathscientific#1#2{%
+ \begingroup%
+ \edef\pgfmath@sci@exponent{#2}%
+ \pgfmath@x#1pt\relax%
+ \ifdim\pgfmath@x<0pt\relax%
+ \pgfmath@x-\pgfmath@x%
+ \edef\pgfmath@sci@sign{-}%
+ \expandafter\edef\expandafter\pgfmath@temp\expandafter{\expandafter\pgfmath@gobbleone#1}%
+ \else%
+ \edef\pgfmath@sci@sign{+}%
+ \edef\pgfmath@temp{#1}%
+ \fi%
+ \expandafter\pgfmath@in@\expandafter.\expandafter{#1}%
+ \ifpgfmath@in@%
+ \else%
+ \edef\pgfmath@temp{\pgfmath@temp.0}%
+ \fi%
+ \expandafter\pgfmath@scientific@@\pgfmath@temp00000000000\pgfmath@}
+
+\def\pgfmath@scientific@@#1.#2#3#4#5#6{%
+ \edef\pgfmath@sci@int{#1}%
+ \edef\pgfmath@sci@mantissaA{#2#3#4#5#6}%
+ \pgfmath@scientific@@@}
+
+\def\pgfmath@scientific@@@#1#2#3#4#5#6\pgfmath@{%
+ \edef\pgfmath@sci@mantissaB{#1#2#3#4#5}%
+ \c@pgfmath@counta\pgfmath@sci@exponent\relax%
+ \c@pgfmath@countb\c@pgfmath@counta%
+ \ifnum\c@pgfmath@counta<0\relax%
+ \c@pgfmath@counta-\c@pgfmath@counta%
+ \fi%
+ \pgfmathpow@{10}{\the\c@pgfmath@counta}%
+ \afterassignment\pgfmath@gobbletilpgfmath@
+ \c@pgfmath@countc\pgfmathresult\relax\pgfmath@
+ \edef\pgfmath@sci@factor{\the\c@pgfmath@countc}%
+ \ifnum\c@pgfmath@countb<0\relax%
+ % xE-y: easy...
+ \pgfmath@x\pgfmath@sci@int.\pgfmath@sci@mantissaA pt\relax%
+ \divide\pgfmath@x\pgfmath@sci@factor\relax%
+ \else%
+ % xE+y:
+ % Must do this way so as not lose digits in a long mantissa. Sigh...
+ \c@pgfmath@counta\pgfmath@sci@int%
+ \c@pgfmath@countb\pgfmath@sci@mantissaA%
+ \multiply\c@pgfmath@counta\pgfmath@sci@factor\relax%
+ \multiply\c@pgfmath@countb\pgfmath@sci@factor\relax%
+ \c@pgfmath@countc\c@pgfmath@countb%
+ \divide\c@pgfmath@countb100000\relax%
+ \advance\c@pgfmath@counta\c@pgfmath@countb%
+ \multiply\c@pgfmath@countb100000\relax%
+ \advance\c@pgfmath@countc-\c@pgfmath@countb%
+ \c@pgfmath@countb\pgfmath@sci@mantissaB\relax%
+ \multiply\c@pgfmath@countb\pgfmath@sci@factor\relax%
+ \divide\c@pgfmath@countb100000\relax%
+ \advance\c@pgfmath@countc\c@pgfmath@countb%
+ \advance\c@pgfmath@countc100000\relax%
+ \edef\pgfmath@sci@result{\pgfmath@sci@sign\the\c@pgfmath@counta.\expandafter\pgfmath@gobbleone\the\c@pgfmath@countc pt}%
+ \pgfmath@x\pgfmath@sci@result\relax%
+ \fi%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup}
+
+
+
+% width function.
+%
+\pgfmathdeclarefunction{width}{1}{%
+ \begingroup%
+ \setbox\pgfmath@box=\hbox{{\pgfmath@selectfont{#1}}}%
+ \pgfmath@x=\wd\pgfmath@box%
+ \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+
+% height function.
+%
+\pgfmathdeclarefunction{height}{1}{%
+ \begingroup%
+ \setbox\pgfmath@box=\hbox{{\pgfmath@selectfont{#1}}}%
+ \pgfmath@x=\ht\pgfmath@box%
+ \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+% depth function.
+%
+\pgfmathdeclarefunction{depth}{1}{%
+ \begingroup%
+ \setbox\pgfmath@box=\hbox{{\pgfmath@selectfont{#1}}}%
+ \pgfmath@x=\dp\pgfmath@box%
+ \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
+
+
+% array function.
+%
+\pgfmathdeclarefunction{array}{2}{%
+ \begingroup%
+ \afterassignment\pgfmath@gobbletilpgfmath@\pgfmath@count=#2\relax\pgfmath@%
+ \expandafter\pgfmatharray@@#1\pgfmath@stop%
+}
+
+\def\pgfmath@token@stop{\pgfmath@stop}%
+\def\pgfmatharray@@#1{%
+ \def\pgfmath@temp{#1}%
+ \advance\pgfmath@count by-1\relax%
+ \ifx\pgfmath@temp\pgfmath@token@stop%
+ \pgfmath@error{Array index out of bounds.}{}%
+ \def\pgfmathresult{0}%
+ \pgfmath@smuggleone\pgfmathresult\endgroup%
+ \let\pgfmath@next=\relax%
+ \else%
+ \ifnum\pgfmath@count=-1\relax%
+ \def\pgfmathresult{#1}%
+ \let\pgfmath@next=\pgfmatharray@@@%
+ \else%
+ \let\pgfmath@next=\pgfmatharray@@%
+ \fi%
+ \fi%
+ \pgfmath@next}
+
+\def\pgfmatharray@@@#1\pgfmath@stop{%
+ \pgfmath@smuggleone\pgfmathresult\endgroup%
+}
+
+
+% max function.
+%
+\pgfmathdeclarefunction{max}{...}{%
+ \begingroup%
+ \pgfmath@x=-16383pt\relax%
+ \pgfmathmax@@#1{}}
+
+\def\pgfmathmax@@#1{%
+ \def\pgfmath@temp{#1}%
+ \ifx\pgfmath@temp\pgfmath@empty%
+ \let\pgfmath@next=\pgfmathmax@@@%
+ \else%
+ \ifdim#1pt>\pgfmath@x%
+ \pgfmath@x=#1pt\relax%
+ \fi%
+ \let\pgfmath@next=\pgfmathmax@@%
+ \fi%
+ \pgfmath@next}
+
+\def\pgfmathmax@@@{\pgfmath@returnone\pgfmath@x\endgroup}%
+
+% For compatability with old code.
+\def\pgfmathmax#1#2{%
+ \pgfmathparse{getargs(#1,#2)}%
+ \expandafter\pgfmathmax@\expandafter{\pgfmathresult}%
+}
+
+% min function.
+%
+\pgfmathdeclarefunction{min}{...}{%
+ \begingroup%
+ \pgfmath@x=16383pt\relax%
+ \pgfmathmin@@#1{}}
+
+\def\pgfmathmin@@#1{%
+ \def\pgfmath@temp{#1}%
+ \ifx\pgfmath@temp\pgfmath@empty%
+ \let\pgfmath@next=\pgfmathmin@@@%
+ \else%
+ \ifdim#1pt<\pgfmath@x%
+ \pgfmath@x=#1pt\relax%
+ \fi%
+ \let\pgfmath@next=\pgfmathmin@@%
+ \fi%
+ \pgfmath@next}
+
+\def\pgfmathmin@@@{\pgfmath@returnone\pgfmath@x\endgroup}%
+
+% For compatability with old code.
+\def\pgfmathmin#1#2{%
+ \pgfmathparse{getargs(#1,#2)}%
+ \expandafter\pgfmathmin@\expandafter{\pgfmathresult}%
+}
+
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathrnd.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex
index ea8d5bb3092..2811d67c101 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathrnd.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex
@@ -39,8 +39,8 @@
%
% #1 -> the new seed.
%
-\def\pgfmathsetseed#1{\pgfmathparse{#1}\expandafter\pgfmath@setseed\pgfmathresult\relax}%
-\def\pgfmath@setseed#1.#2\relax{\def\pgfmath@rnd@z{#1}}%
+\def\pgfmathsetseed#1{\pgfmathparse{#1}\expandafter\pgfmath@setseed\pgfmathresult.0\pgfmath@stop}%
+\def\pgfmath@setseed#1.#2\pgfmath@stop{\def\pgfmath@rnd@z{#1}}%
% Alternative paramaters - see Press et al (1992) p278-279,
% for discussion.
@@ -86,7 +86,7 @@
%
% Generates a pseudo-random number between 0 and 1.
%
-\def\pgfmathrnd{%
+\pgfmathdeclarefunction{rnd}{0}{%
\begingroup%
\pgfmathgeneratepseudorandomnumber%
\c@pgfmath@counta\pgfmathresult%
@@ -95,12 +95,12 @@
\multiply\c@pgfmath@countb-100001\relax%
\advance\c@pgfmath@countb\c@pgfmath@counta%
\advance\c@pgfmath@countb1000000\relax%
- \expandafter\pgfmathrnd@\the\c@pgfmath@countb\pgfmath@%
+ \expandafter\pgfmathrnd@@\the\c@pgfmath@countb\pgfmath@%
\pgfmath@returnone\pgfmath@x%
\endgroup%
}%
-\def\pgfmathrnd@#1#2#3\pgfmath@{%
+\def\pgfmathrnd@@#1#2#3\pgfmath@{%
\edef\pgfmath@temp{#2.#3}%
\pgfmath@x=\pgfmath@temp pt\relax%
}%
@@ -109,7 +109,7 @@
%
% Generates a pseudo-random number between -1 and 1.
%
-\def\pgfmathrand{%
+\pgfmathdeclarefunction{rand}{0}{%
\begingroup%
\pgfmathgeneratepseudorandomnumber%
\c@pgfmath@counta\pgfmathresult%
@@ -123,12 +123,12 @@
\else%
\advance\c@pgfmath@countb1000000\relax%
\fi%
- \expandafter\pgfmathrand@\the\c@pgfmath@countb\pgfmath@%
+ \expandafter\pgfmathrand@@\the\c@pgfmath@countb\pgfmath@%
\pgfmath@returnone\pgfmath@x%
\endgroup%
}%
-\def\pgfmathrand@#1#2#3#4\pgfmath@{%
+\def\pgfmathrand@@#1#2#3#4\pgfmath@{%
\ifx#1-%
\edef\pgfmath@temp{-#3.#4}%
\else%
@@ -137,6 +137,32 @@
\pgfmath@x=\pgfmath@temp pt\relax%
}%
+\pgfmathdeclarefunction{random}{...}{%
+ \begingroup%
+ \def\pgfmath@temp{#1}%
+ \ifx\pgfmath@temp\pgfmath@empty%
+ \pgfmathrnd@%
+ \else%
+ \expandafter\pgfmathrandom@@#1\pgfmath@stop%
+ \fi%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup}
+
+\def\pgfmathrandom@@{\futurelet\pgfmath@token\pgfmathrandom@@@}
+\def\pgfmathrandom@@@{%
+ \ifx\pgfmath@token\bgroup%
+ \expandafter\pgfmath@random@@@@%
+ \else%
+ \expandafter\pgfmath@random@@@@@%
+ \fi%
+}
+\def\pgfmath@random@@@@@#1\pgfmath@stop{%
+ \pgfmathrandominteger\pgfmathresult{1}{#1}%
+}
+\def\pgfmath@random@@@@#1#2\pgfmath@stop{%
+ \pgfmathrandominteger\pgfmathresult{#1}{#2}%
+}
+
% \pgfmathrandominteger
%
% Return a 'randomly' selected integer in the range #2 - #3 (inclusive).
@@ -209,4 +235,5 @@
\pgfmath@ifundefined{pgfmath@randomlist@#2}{\pgfmath@error{Unknown random list `#2'}}{%
\edef\pgfmath@randomlistlength{\csname pgfmath@randomlist@#2\endcsname}%
\pgfmathrandominteger{\pgfmath@randomtemp}{1}{\pgfmath@randomlistlength}%
- \def#1{\csname pgfmath@randomlist@#2@\pgfmath@randomtemp\endcsname}}} \ No newline at end of file
+ \def#1{\csname pgfmath@randomlist@#2@\pgfmath@randomtemp\endcsname}}}
+ \ No newline at end of file
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex
new file mode 100644
index 00000000000..03f9ca270ae
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex
@@ -0,0 +1,112 @@
+% Copyright 2007 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.
+
+% This file defines the mathematical functions and operators.
+%
+% Version 1.414213 29/9/2007
+
+% round function. Uses asymmetric half-up rounding.
+%
+\pgfmathdeclarefunction{round}{1}{%
+ \begingroup%
+ \expandafter\pgfmath@x#1pt\relax%
+ \afterassignment\pgfmath@xa%
+ \expandafter\c@pgfmath@counta\the\pgfmath@x\relax%
+ \pgfmath@xb\pgfmath@x%
+ \ifdim\pgfmath@xb<0pt\relax%
+ \ifdim\pgfmath@xa<0.5pt\relax%
+ \else%
+ \advance\c@pgfmath@counta-1\relax%
+ \fi%
+ \else%
+ \ifdim\pgfmath@xa<0.5pt\relax%
+ \else%
+ \advance\c@pgfmath@counta1\relax%
+ \fi%
+ \fi%
+ \pgfmath@returnone\the\c@pgfmath@counta pt%
+ \endgroup%
+}%
+
+% floor function.
+%
+\pgfmathdeclarefunction{floor}{1}{%
+ \begingroup%
+ \expandafter\pgfmath@x#1pt\relax%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@%
+ \expandafter\pgfmath@x#1pt\relax%
+ \ifdim\pgfmath@x<0pt\relax%
+ \advance\c@pgfmath@counta by -1\relax%
+ \fi%
+ \pgfmath@x\c@pgfmath@counta pt\relax%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
+}%
+
+% ceil function.
+%
+\pgfmathdeclarefunction{ceil}{1}{%
+ \begingroup%
+ \expandafter\pgfmath@x#1pt\relax%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@%
+ \pgfmath@y\pgfmath@x%
+ \advance\pgfmath@y-\c@pgfmath@counta pt\relax%
+ \pgfmath@x\c@pgfmath@counta pt\relax%
+ \ifdim\pgfmath@y>0pt\relax%
+ \advance\pgfmath@x1pt\relax%
+ \fi%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
+}%
+
+% int function
+%
+\pgfmathdeclarefunction{int}{1}{%
+ \begingroup%
+ \expandafter\pgfmathint@@#1.\pgfmath@stop
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup}
+
+\def\pgfmathint@@#1.#2\pgfmath@stop{%
+ \def\pgfmath@temp{#1}%
+ \ifx\pgfmath@temp\pgfmath@empty%
+ \def\pgfmathresult{0}%
+ \else%
+ \pgfmath@in@{#1}{+-+0-0}%
+ \ifpgfmath@in@
+ \def\pgfmathresult{0}%
+ \else%
+ \def\pgfmathresult{#1}%
+ \fi%
+ \fi}
+
+% frac function.
+%
+\pgfmathdeclarefunction{frac}{1}{%
+ \begingroup%
+ \expandafter\pgfmathfrac@@#1.\pgfmath@stop%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup}
+
+\def\pgfmathfrac@@#1.{%
+ \pgfmath@ifnextchar\pgfmath@stop{\def\pgfmathresult{0.0}\pgfmath@gobbleone}{\pgfmathfrac@@@}%
+}
+\def\pgfmathfrac@@@#1.\pgfmath@stop{\def\pgfmathresult{0.#1}}
+
+% real function.
+%
+\pgfmathdeclarefunction{real}{1}{%
+ \begingroup%
+ \pgfmath@x=#1pt\relax%
+ \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+}
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathtrig.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex
index 20d86dd8bdf..6b60eb7ec16 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathtrig.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-% This file defines the trigonometric functions/operations.
+% This file defines the trigonometric functions/functions.
%
% Much of this file is based on ideas and code (particularly
% the old \pgfcoremath.code.tex) due to Till Tantau.
@@ -16,18 +16,14 @@
% \pgfmathpi
%
-\def\pgfmathpi{\edef\pgfmathresult{\pgfmath@pi}}
-\def\pgfmath@pi{3.14159}
+\pgfmathdeclarefunction{pi}{0}{\def\pgfmathresult{3.141592654}}
% \pgfmathradians
% (for comptability with 1.18 beta, will be deprecated)
%
% Convert #1 from radians to degrees (accurate to 1 deg).
%
-\def\pgfmathradians#1{%
- \pgfmathparse{#1}%
- \pgfmathradians@{\pgfmathresult}}
-\def\pgfmathradians@#1{%
+\pgfmathdeclarefunction{radians}{1}{%
\begingroup%
\expandafter\pgfmath@x#1pt\relax%
\pgfmath@x57.29577\pgfmath@x\relax% 57.29577 = 360/(2*pi)
@@ -39,10 +35,7 @@
%
% Convert #1 from radians to degrees.
%
-\def\pgfmathdeg#1{%
- \pgfmathparse{#1}%
- \pgfmathdeg@{\pgfmathresult}}
-\def\pgfmathdeg@#1{%
+\pgfmathdeclarefunction{deg}{1}{%
\begingroup%
\expandafter\pgfmath@x#1pt\relax%
\pgfmath@x57.29577\pgfmath@x\relax% 57.29577 = 360/(2*pi)
@@ -54,10 +47,7 @@
%
% Convert #1 from degrees to radians.
%
-\def\pgfmathrad#1{%
- \pgfmathparse{#1}%
- \pgfmathrad@{\pgfmathresult}}
-\def\pgfmathrad@#1{%
+\pgfmathdeclarefunction{rad}{1}{%
\begingroup%
\expandafter\pgfmath@x#1pt\relax%
\pgfmath@x3.14159\pgfmath@x%
@@ -70,10 +60,7 @@
%
% Calculate the sine of #1 (in degrees).
%
-\def\pgfmathsin#1{%
- \pgfmathparse{#1}%
- \pgfmathsin@{\pgfmathresult}}
-\def\pgfmathsin@#1{%
+\pgfmathdeclarefunction{sin}{1}{%
% Let #1 = a.b
% Then sin(#1) \approx (1-b)*sin(a) + b*sin(a+1)
%
@@ -114,10 +101,7 @@
%
% Calculate the cosine of #1 (in degrees).
%
-\def\pgfmathcos#1{%
- \pgfmathparse{#1}%
- \expandafter\pgfmathcos@\expandafter{\pgfmathresult}}
-\def\pgfmathcos@#1{%
+\pgfmathdeclarefunction{cos}{1}{%
% Let x = a.b
% Then cos(x) \approx (1-b)*cos(a) + b*cos(a+1)
%
@@ -171,10 +155,7 @@
%
% Calculate the tangent of #1 (in degrees).
%
-\def\pgfmathtan#1{%
- \pgfmathparse{#1}%
- \pgfmathtan@{\pgfmathresult}}
-\def\pgfmathtan@#1{%
+\pgfmathdeclarefunction{tan}{1}{%
\begingroup%
\edef\pgfmath@temparg{#1}%
\pgfmathcos@{\pgfmath@temparg}%
@@ -183,19 +164,6 @@
\pgfmathsin@{\pgfmath@temparg}%
\pgfmath@x\pgfmathresult pt\relax%
\pgfmath@x\pgfmath@tantemp\pgfmath@x%
- \ifdim\pgfmath@x<0pt\relax%
- \c@pgfmath@countb-1\relax%
- \else%
- \c@pgfmath@countb1\relax%
- \fi%
- % Adjust to 4 decimal places. This gets rid of some annoyingly tiny errors.
- \afterassignment\pgfmath@x%
- \expandafter\c@pgfmath@counta\the\pgfmath@x\relax%
- \ifdim\pgfmath@x<.0001pt\relax%
- \pgfmath@x0pt\relax%
- \fi%
- \advance\pgfmath@x\c@pgfmath@counta pt%
- \multiply\pgfmath@x\c@pgfmath@countb%
\pgfmath@returnone\pgfmath@x%
\endgroup%
}
@@ -204,10 +172,7 @@
%
% Calculate the cosec of #1 (in degrees).
%
-\def\pgfmathcosec#1{%
- \pgfmathparse{#1}%
- \pgfmathcosec@{\pgfmathresult}}
-\def\pgfmathcosec@#1{%
+\pgfmathdeclarefunction{cosec}{1}{%
\expandafter\pgfmathsin@\expandafter{#1}%
\pgfmathreciprocal@{\pgfmathresult}%
}
@@ -216,10 +181,7 @@
%
% Calculate the sec of #1 (in degrees).
%
-\def\pgfmathsec#1{%
- \pgfmathparse{#1}%
- \pgfmathsec@{\pgfmathresult}}
-\def\pgfmathsec@#1{%
+\pgfmathdeclarefunction{sec}{1}{%
\expandafter\pgfmathcos@\expandafter{#1}%
\pgfmathreciprocal@{\pgfmathresult}%
}
@@ -228,10 +190,7 @@
%
% Calculate the cotangent of #1 (in degrees).
%
-\def\pgfmathcot#1{%
- \pgfmathparse{#1}%
- \pgfmathcot@{\pgfmathresult}}
-\def\pgfmathcot@#1{%
+\pgfmathdeclarefunction{cot}{1}{%
\begingroup%
\edef\pgfmath@temparg{#1}%
\pgfmathsin@{\pgfmath@temparg}%
@@ -240,19 +199,6 @@
\pgfmathcos@{\pgfmath@temparg}%
\pgfmath@x\pgfmathresult pt\relax%
\pgfmath@x\pgfmath@tantemp\pgfmath@x%
- \ifdim\pgfmath@x<0pt\relax%
- \c@pgfmath@countb-1\relax%
- \else%
- \c@pgfmath@countb1\relax%
- \fi%
- % Adjust to 4 decimal places. This gets rid of some annoyingly tiny errors.
- \afterassignment\pgfmath@x%
- \expandafter\c@pgfmath@counta\the\pgfmath@x\relax%
- \ifdim\pgfmath@x<.0001pt\relax%
- \pgfmath@x0pt\relax%
- \fi%
- \advance\pgfmath@x\c@pgfmath@counta pt%
- \multiply\pgfmath@x\c@pgfmath@countb%
\pgfmath@returnone\pgfmath@x%
\endgroup%
}
@@ -261,10 +207,7 @@
%
% The asin of #1
%
-\def\pgfmathasin#1{%
- \pgfmathparse{#1}%
- \expandafter\pgfmathasin@\expandafter{\pgfmathresult}}
-\def\pgfmathasin@#1{%
+\pgfmathdeclarefunction{asin}{1}{%
\begingroup%
\expandafter\pgfmath@x#1pt\relax%
\pgfmath@xa\pgfmath@x%
@@ -287,10 +230,7 @@
%
% The acos of #1
%
-\def\pgfmathacos#1{%
- \pgfmathparse{#1}%
- \expandafter\pgfmathacos@\expandafter{\pgfmathresult}}
-\def\pgfmathacos@#1{%
+\pgfmathdeclarefunction{acos}{1}{%
\begingroup%
\expandafter\pgfmath@x#1pt\relax%
\pgfmath@xa\pgfmath@x%
@@ -303,19 +243,13 @@
\expandafter\pgfmath@x\csname pgfmath@acos@\the\c@pgfmath@counta\endcsname pt\relax%
\ifdim\pgfmath@xa<0pt\relax%
\pgfmath@x-\pgfmath@x%
+ \advance\pgfmath@x by180pt\relax%
\fi%
\pgfmath@returnone\pgfmath@x%
\endgroup%
}
-% \pgfmathasin
-%
-% The atan of #1
-%
-\def\pgfmathatan#1{%
- \pgfmathparse{#1}%
- \expandafter\pgfmathatan@\expandafter{\pgfmathresult}}
-\def\pgfmathatan@#1{%
+\pgfmathdeclarefunction{atan}{1}{%
\begingroup%
\expandafter\pgfmath@x#1pt\relax%
\pgfmath@xa\pgfmath@x%
@@ -344,7 +278,40 @@
\endgroup%
}
-
+\pgfmathdeclarefunction{atan2}{2}{%
+ \begingroup%
+ \pgfmath@x=#1pt\relax%
+ \ifdim\pgfmath@x<0pt\relax%
+ \pgfmath@x=-\pgfmath@x%
+ \fi%
+ \ifdim\pgfmath@x<0.001pt\relax%
+ \ifdim#2pt<0pt\relax%
+ \pgfmath@x=-90pt\relax%
+ \else%
+ \ifdim#2pt>0pt\relax%
+ \pgfmath@x=90pt\relax%
+ \else%
+ \pgfmath@x=0pt\relax%
+ \fi%
+ \fi%
+ \else%
+ \pgfmathdivide@{#2}{#1}%
+ \expandafter\pgfmathatan@\expandafter{\pgfmathresult}%
+ \pgfmath@x=\pgfmathresult pt\relax%
+ \ifdim#2pt<0pt\relax%
+ \ifdim#1pt<0pt\relax%
+ \advance\pgfmath@x by-180pt\relax%
+ \fi%
+ \else%
+ \ifdim#1pt<0pt\relax%
+ \advance\pgfmath@x by180pt\relax%
+ \fi%
+ \fi%
+ \fi%
+ \pgfmath@returnone\pgfmath@x%
+ \endgroup%
+}
+
\def\pgfmath@def#1#2#3{\expandafter\def\csname pgfmath@#1@#2\endcsname{#3}}
\pgfmath@def{cos}{0}{1.00000} \pgfmath@def{cos}{1}{0.99985}
\pgfmath@def{cos}{2}{0.99939} \pgfmath@def{cos}{3}{0.99863}
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathoperations.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathoperations.code.tex
deleted file mode 100644
index 452b9fa0b2c..00000000000
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathoperations.code.tex
+++ /dev/null
@@ -1,1488 +0,0 @@
-% Copyright 2007 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.
-
-% This file defines the mathematical functions and operators.
-%
-% Version 1.414213 29/9/2007
-
-% This file defines the mathematical functions and operators.
-%
-% Adding/redefining extra operators/functions:
-%
-% Each operator/function XXX has two forms:
-%
-%
-% \pgfmathXXX#1... a public version which evaluates any
-% arguments passed to it and passes the
-% results on to...
-%
-% \pgfmathXXX@#1... a non-public version which performs
-% required calculation on arguments which
-% must have already been evaluated (i.e.
-% *without* dimensions).
-%
-% If a function XXX is to be included in the parser, it is
-% recommended, for consistency, that where possible, the
-% pgfmathparser file should define the macro \pgfmath@parseXXX.
-% The parser should (ideally) then call \pgfmathXXX@.
-%
-% It is also recommened that all calculations (where necessary)
-% take place within a TeX group. \pgfmath@returnone#1 makes and
-% expanded version of #1 global and stores this in \pgfmathresult
-% after the group is ended.
-%
-
-\input pgfmathtrig.code.tex% Load the trig. stuff.
-\input pgfmathrnd.code.tex% Load the random stuff.
-
-
-% \pgfmathadd
-%
-% Add #1 and #2.
-%
-\def\pgfmathadd#1#2{%
- \edef\pgfmath@marshal{%
- \noexpand\pgfmathparse{#2}
- \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult%
- \noexpand\pgfmathparse{#1}%
- }%
- \pgfmath@marshal%
- \pgfmathadd@{\pgfmathresult}{\pgfmath@arg}}
-\def\pgfmathadd@#1#2{%
- \begingroup%
- \pgfmath@x#1pt%
- \pgfmath@y#2pt%
- \advance\pgfmath@x by\pgfmath@y%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
-}
-
-% \pgfmathsubtract
-%
-% Subtract #2 from #1.
-%
-\def\pgfmathsubtract#1#2{%
- \edef\pgfmath@marshal{%
- \noexpand\pgfmathparse{#2}
- \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult%
- \noexpand\pgfmathparse{#1}%
- }%
- \pgfmath@marshal%
- \pgfmathsubtract@{\pgfmathresult}{\pgfmath@arg}}
-\def\pgfmathsubtract@#1#2{%
- \begingroup%
- \pgfmath@x#1pt%
- \pgfmath@y#2pt%
- \advance\pgfmath@x-\pgfmath@y%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
-}
-
-% \pgfmathmultiply
-%
-% Multiply #1 by #2.
-%
-\def\pgfmathmultiply#1#2{%
- \edef\pgfmath@marshal{%
- \noexpand\pgfmathparse{#2}
- \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult%
- \noexpand\pgfmathparse{#1}%
- }%
- \pgfmath@marshal%
- \pgfmathmultiply@{\pgfmathresult}{\pgfmath@arg}}
-\def\pgfmathmultiply@#1#2{%
- \begingroup%
- \pgfmath@x#1pt%
- \pgfmath@y#2pt%
- \pgfmath@x\pgfmath@tonumber{\pgfmath@y}\pgfmath@x%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
-}
-
-% \pgfmathdivide
-%
-% Divide #1 by #2.
-%
-\def\pgfmathdivide#1#2{%
- \edef\pgfmath@marshal{%
- \noexpand\pgfmathparse{#2}
- \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult%
- \noexpand\pgfmathparse{#1}%
- }%
- \pgfmath@marshal%
- \pgfmathdivide@{\pgfmathresult}{\pgfmath@arg}}
-\def\pgfmathdivide@#1#2{%
- \begingroup%
- \pgfmath@x#1pt%
- \pgfmath@y#2pt%
- \def\pgfmath@sign{}%
- \ifdim\pgfmath@y=0pt\relax%
- \pgfmath@error{You've asked me to divide `#1' by `#2', %
- but I cannot divide any number by `#2'}%
- \fi%
- \afterassignment\pgfmath@xa%
- \expandafter\c@pgfmath@counta\the\pgfmath@y\relax%
- %
- % If y is an integer, use TeX arithmatic.
- %
- \ifdim\pgfmath@xa=0pt\relax%
- \divide\pgfmath@x\c@pgfmath@counta\relax%
- \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
- \let\pgfmath@next\pgfmathdivide@@@%
- \else%
- %
- % Simple long division.
- %
- \ifdim\pgfmath@x<0pt\relax%
- \def\pgfmath@sign{-}%
- \pgfmath@x-\pgfmath@x%
- \fi%
- \ifdim\pgfmath@y<0pt\relax%
- \edef\pgfmath@sign{\pgfmath@sign-}%
- \pgfmath@y-\pgfmath@y%
- \fi%
- \pgfmath@ya\pgfmath@y%
- \c@pgfmath@counta0\relax%
- \ifdim\pgfmath@x>\pgfmath@ya%
- \ifdim\pgfmath@ya<1638.4pt\relax%
- \pgfmathmultiply@dimenbyten\pgfmath@ya%
- \ifdim\pgfmath@ya>\pgfmath@x%
- \pgfmathdivide@dimenbyten\pgfmath@ya%
- \c@pgfmath@counta0\relax%
- \else%
- \ifdim\pgfmath@ya<1638.4pt\relax%
- \pgfmathmultiply@dimenbyten\pgfmath@ya%
- \ifdim\pgfmath@ya>\pgfmath@x%
- \pgfmathdivide@dimenbyten\pgfmath@ya%
- \c@pgfmath@counta1\relax%
- \else%
- \ifdim\pgfmath@ya<1638.4pt\relax%
- \pgfmathmultiply@dimenbyten\pgfmath@ya%
- \ifdim\pgfmath@ya>\pgfmath@x%
- \pgfmathdivide@dimenbyten\pgfmath@ya%
- \c@pgfmath@counta2\relax%
- \else%
- \ifdim\pgfmath@ya<1638.4pt\relax%
- \pgfmathmultiply@dimenbyten\pgfmath@ya%
- \ifdim\pgfmath@ya>\pgfmath@x%
- \pgfmathdivide@dimenbyten\pgfmath@ya%
- \c@pgfmath@counta3\relax%
- \else%
- \pgfmath@error{The result of `#1/#2' is too big for me}{}%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- %
- % If y < 1pt use reciprocal operation.
- %
- \ifdim\pgfmath@y<1pt\relax%
- \ifdim\pgfmath@y<.00007pt\relax%
- \pgfmath@error{The result of `#1/#2' is too big for me}{}%
- \fi%
- \pgfmathreciprocal@{\pgfmath@tonumber{\pgfmath@y}}%
- \pgfmath@x\pgfmathresult\pgfmath@x%
- \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
- \let\pgfmath@next\pgfmathdivide@@@%
- \else%
- \pgfmath@y\pgfmath@ya%
- \def\pgfmathresult{}%
- \let\pgfmath@next\pgfmathdivide@@%
- \fi%
- \fi%
- \pgfmath@next%
-}
-
-\def\pgfmathdivide@dimenbyten#1{%
- \edef\pgfmath@temp{\pgfmath@tonumber{#1}}%
- \expandafter\pgfmathdivide@@dimenbyten\pgfmath@temp\@@#1\@@}
-\def\pgfmathdivide@@dimenbyten#1.#2\@@#3\@@{%
- \pgfmath@tempcnta#1\relax%
- \divide\pgfmath@tempcnta10\relax%
- \pgfmath@tempcntb\pgfmath@tempcnta%
- \multiply\pgfmath@tempcnta-10\relax%
- \advance\pgfmath@tempcnta#1\relax%
- #3\the\pgfmath@tempcntb.\the\pgfmath@tempcnta#2pt\relax%
-}
-
-\def\pgfmathmultiply@dimenbyten#1{%
- \edef\pgfmath@temp{\pgfmath@tonumber{#1}}%
- \expandafter\pgfmathmultiply@@dimenbyten\pgfmath@temp\@@#1\@@}
-\def\pgfmathmultiply@@dimenbyten#1.#2#3\@@#4\@@{#4#1#2.#3pt\relax}
-
-\def\pgfmathdivide@@{%
- \ifdim\pgfmath@x>\pgfmath@y%
- \pgfmath@yb6.0\pgfmath@y%
- \ifdim\pgfmath@yb>\pgfmath@x% 6*y
- \advance\pgfmath@yb-\pgfmath@y%
- \advance\pgfmath@yb-\pgfmath@y%
- \ifdim\pgfmath@yb>\pgfmath@x% 4*y
- \advance\pgfmath@yb-\pgfmath@y%
- \advance\pgfmath@yb-\pgfmath@y%
- \ifdim\pgfmath@yb>\pgfmath@x% 2*y
- \advance\pgfmath@yb-\pgfmath@y%
- \ifdim\pgfmath@yb>\pgfmath@x% 1*y
- \c@pgfmath@countb0\relax%
- \else%
- \c@pgfmath@countb1\relax%
- \fi%
- \else%
- \advance\pgfmath@yb\pgfmath@y% 3*y
- \ifdim\pgfmath@yb>\pgfmath@x%
- \c@pgfmath@countb2\relax%
- \else%
- \c@pgfmath@countb3\relax%
- \fi%
- \fi%
- \else%
- \advance\pgfmath@yb\pgfmath@y% 5*y
- \ifdim\pgfmath@yb>\pgfmath@x%
- \c@pgfmath@countb4\relax%
- \else%
- \c@pgfmath@countb5\relax%
- \fi%
- \fi%
- \else%
- \advance\pgfmath@yb\pgfmath@y%
- \advance\pgfmath@yb\pgfmath@y%
- \ifdim\pgfmath@yb>\pgfmath@x% 8*y
- \advance\pgfmath@yb-\pgfmath@y%
- \ifdim\pgfmath@yb>\pgfmath@x% 7*y
- \c@pgfmath@countb6\relax%
- \else%
- \c@pgfmath@countb7\relax%
- \fi%
- \else%
- \advance\pgfmath@yb\pgfmath@y%
- \ifdim\pgfmath@yb>\pgfmath@x% 9*y
- \c@pgfmath@countb8\relax%
- \else%
- \c@pgfmath@countb9\relax%
- \fi%
- \fi%
- \fi%
- \else%
- \c@pgfmath@countb=0\relax%
- \fi%
- \ifnum\c@pgfmath@countb=0\relax%
- \edef\pgfmathresult{\pgfmathresult0}%
- \else%
- \pgfmath@yb\c@pgfmath@countb\pgfmath@y%
- \advance\pgfmath@x-\pgfmath@yb%
- \edef\pgfmathresult{\pgfmathresult\the\c@pgfmath@countb}%
- \fi%
- \pgfmathdivide@dimenbyten\pgfmath@y%
- \ifnum\c@pgfmath@counta=0\relax%
- \edef\pgfmathresult{\pgfmathresult.}%
- \fi%
- \advance\c@pgfmath@counta-1\relax%
- \ifdim\pgfmath@y=0pt\relax%
- \let\pgfmath@next\pgfmathdivide@@@%
- \else%
- \let\pgfmath@next\pgfmathdivide@@%
- \fi%
- \pgfmath@next%
-}
-
-\def\pgfmathdivide@@@{%
- \pgfmath@x\pgfmath@sign\pgfmathresult pt\relax%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
-}
-
-
-% \pgfmathgreaterthan
-%
-% 1.0 if #1 > #2. Otherwise 0.0
-%
-\def\pgfmathgreaterthan#1#2{%
- \edef\pgfmath@marshal{%
- \noexpand\pgfmathparse{#2}
- \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult%
- \noexpand\pgfmathparse{#1}%
- }%
- \pgfmath@marshal%
- \pgfmathgreaterthan@{\pgfmathresult}{\pgfmath@arg}}
-\def\pgfmathgreaterthan@#1#2{%
- \begingroup%
- \pgfmath@x#1pt%
- \pgfmath@y#2pt%
- \advance\pgfmath@x-\pgfmath@y%
- \ifdim\pgfmath@x>0pt\relax%
- \pgfmath@x1pt\relax%
- \else%
- \pgfmath@x0pt\relax%
- \fi%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
-}
-
-% \pgfmathlessthan
-%
-% 1.0 if #1< #2. Otherwise 0.0
-%
-\def\pgfmathlessthan#1#2{%
- \edef\pgfmath@marshal{%
- \noexpand\pgfmathparse{#2}
- \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult%
- \noexpand\pgfmathparse{#1}%
- }%
- \pgfmath@marshal%
- \pgfmathlessthan@{\pgfmathresult}{\pgfmath@arg}}
-\def\pgfmathlessthan@#1#2{%
- \begingroup%
- \pgfmath@x#1pt%
- \pgfmath@y#2pt%
- \advance\pgfmath@x-\pgfmath@y\relax%
- \ifdim\pgfmath@x<0pt\relax%
- \pgfmath@x1pt\relax%
- \else%
- \pgfmath@x0pt\relax%
- \fi%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
-}
-
-% \pgfmathequalto
-%
-% 1.0 if #1 = #2. Otherwise 0.0
-%
-\def\pgfmathequalto#1#2{%
- \edef\pgfmath@marshal{%
- \noexpand\pgfmathparse{#2}
- \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult%
- \noexpand\pgfmathparse{#1}%
- }%
- \pgfmath@marshal%
- \pgfmathequalto@{\pgfmathresult}{\pgfmath@arg}}
-\def\pgfmathequalto@#1#2{%
- \begingroup%
- \pgfmath@x#1pt%
- \pgfmath@y#2pt%
- \advance\pgfmath@x-\pgfmath@y%
- \ifdim\pgfmath@x=0pt\relax%
- \pgfmath@x1pt\relax%
- \else%
- \pgfmath@x0pt\relax%
- \fi%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
-}
-
-% \pgfmathreciprocal
-%
-% 1 / #1
-%
-\def\pgfmathreciprocal#1{%
- \pgfmathparse{#1}%
- \pgfmathreciprocal@{\pgfmathresult}}
-\def\pgfmathreciprocal@#1{%
- \begingroup%
- \expandafter\pgfmath@x#1pt\relax%
- \ifdim\pgfmath@x=0pt\relax%
- \pgfmath@error{You asked me to calculate `1/#1', but I cannot divide any number by zero}{}%
- \fi%
- \edef\pgfmath@reciprocaltemp{\pgfmath@tonumber{\pgfmath@x}}%
- \expandafter\pgfmathreciprocal@@\pgfmath@reciprocaltemp0000000\pgfmath@}
-\def\pgfmathreciprocal@@#1.#2#3#4#5#6#7\pgfmath@{%
- \c@pgfmath@counta#2#3#4#5#6\relax%
- % If the number is an integer, use TeX arithmatic.
- \ifnum\c@pgfmath@counta=0\relax%
- \pgfmath@x1pt\relax%
- \divide\pgfmath@x#1\relax%
- \else%
- \ifnum#1>100\relax%
- \c@pgfmath@counta#1#2#3#4\relax%
- \c@pgfmath@countb1000000000\relax%
- \divide\c@pgfmath@countb\c@pgfmath@counta%
- \c@pgfmath@counta\c@pgfmath@countb%
- \divide\c@pgfmath@counta10000\relax%
- \pgfmath@x\c@pgfmath@counta pt\relax%
- \multiply\c@pgfmath@counta-10000\relax%
- \advance\c@pgfmath@countb\c@pgfmath@counta%
- \pgfmath@y\c@pgfmath@countb pt\relax%
- \divide\pgfmath@y1000000\relax%
- \advance\pgfmath@x\pgfmath@y%
- \else%
- \c@pgfmath@counta#1#2#3#4#5#6\relax%
- \c@pgfmath@countb1000000000\relax%
- \divide\c@pgfmath@countb\c@pgfmath@counta%
- \c@pgfmath@counta\c@pgfmath@countb%
- \divide\c@pgfmath@counta10000\relax%
- \pgfmath@x\c@pgfmath@counta pt\relax%
- \multiply\c@pgfmath@counta-10000\relax%
- \advance\c@pgfmath@countb\c@pgfmath@counta%
- \pgfmath@y\c@pgfmath@countb pt\relax%
- \pgfmath@y.1\pgfmath@y% Yes! This way is more accurate. Go figure...
- \pgfmath@y.1\pgfmath@y%
- \pgfmath@y.1\pgfmath@y%
- \pgfmath@y.1\pgfmath@y%
- \advance\pgfmath@x\pgfmath@y%
- \fi%
- \fi%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
-}
-
-% \pgfmathln
-%
-% Calculate ln(#1}
-%
-% This is based on an algorithm due to Rouben Rostamian and
-% uses coefficients contributed by Alain Matthes.
-%
-\def\pgfmathln#1{\pgfmathparse{#1}\pgfmathln@{\pgfmathresult}}
-\def\pgfmathln@#1{%
- \begingroup%
- \expandafter\pgfmath@x#1pt\relax%
- \ifdim\pgfmath@x>0pt\else%
- \pgfmath@error{I cannot calculate the logarithm of `#1'}{}%
- \fi%
- \c@pgfmath@counta0\relax%
- \ifdim\pgfmath@x>2pt\relax%
- \ifdim\pgfmath@x<128pt\relax%
- \ifdim\pgfmath@x<8pt\relax%
- \ifdim\pgfmath@x<4pt\relax%
- \divide\pgfmath@x2\relax%
- \c@pgfmath@counta1\relax%
- \else%
- \divide\pgfmath@x4\relax%
- \c@pgfmath@counta2\relax%
- \fi%
- \else%
- \ifdim\pgfmath@x<32pt\relax%
- \ifdim\pgfmath@x<16pt\relax%
- \divide\pgfmath@x8\relax%
- \c@pgfmath@counta3\relax%
- \else%
- \divide\pgfmath@x16\relax%
- \c@pgfmath@counta4\relax%
- \fi%
- \else%
- \ifdim\pgfmath@x<64pt\relax%
- \divide\pgfmath@x32\relax%
- \c@pgfmath@counta5\relax%
- \else%
- \divide\pgfmath@x64\relax%
- \c@pgfmath@counta6\relax%
- \fi%
- \fi%
- \fi%
- \else%
- \ifdim\pgfmath@x<2048pt\relax%
- \ifdim\pgfmath@x<512pt\relax%
- \ifdim\pgfmath@x<256pt\relax%
- \divide\pgfmath@x128\relax%
- \c@pgfmath@counta7\relax%
- \else%
- \divide\pgfmath@x256\relax%
- \c@pgfmath@counta8\relax%
- \fi%
- \else%
- \ifdim\pgfmath@x<1024pt\relax%
- \divide\pgfmath@x512\relax%
- \c@pgfmath@counta9\relax%
- \else%
- \divide\pgfmath@x1024\relax%
- \c@pgfmath@counta10\relax%
- \fi%
- \fi%
- \else%
- \ifdim\pgfmath@x<8192pt\relax%
- \ifdim\pgfmath@x<4096pt\relax%
- \divide\pgfmath@x2048\relax%
- \c@pgfmath@counta11\relax%
- \else%
- \divide\pgfmath@x4096\relax%
- \c@pgfmath@counta12\relax%
- \fi%
- \else%
- \divide\pgfmath@x8192\relax%
- \c@pgfmath@counta13\relax%
- \fi%
- \fi%
- \fi%
- \else%
- \ifdim\pgfmath@x<1pt\relax%
- \ifdim\pgfmath@x>0.0078125pt\relax% 2^-7
- \ifdim\pgfmath@x>0.125pt\relax% 2^-3
- \ifdim\pgfmath@x>0.5pt\relax% 2^-1
- \multiply\pgfmath@x2\relax%
- \c@pgfmath@counta-1\relax%
- \else%
- \multiply\pgfmath@x4\relax%
- \c@pgfmath@counta-2\relax%
- \fi%
- \else%
- \ifdim\pgfmath@x>0.03125pt\relax% 2^-5
- \ifdim\pgfmath@x>0.0625pt\relax%
- \multiply\pgfmath@x8\relax%
- \c@pgfmath@counta-3\relax%
- \else%
- \multiply\pgfmath@x16\relax%
- \c@pgfmath@counta-4\relax%
- \fi%
- \else%
- \ifdim\pgfmath@x>0.015625pt\relax% 2^-6
- \multiply\pgfmath@x32\relax%
- \c@pgfmath@counta-5\relax%
- \else%
- \multiply\pgfmath@x64\relax%
- \c@pgfmath@counta-6\relax%
- \fi%
- \fi%
- \fi%
- \else%
- \ifdim\pgfmath@x>0.000244140625pt\relax% 2^-11
- \ifdim\pgfmath@x>0.001953125pt\relax% 2^-9
- \ifdim\pgfmath@x>0.00390625pt\relax% 2^-8
- \multiply\pgfmath@x128\relax%
- \c@pgfmath@counta-7\relax%
- \else%
- \multiply\pgfmath@x256\relax%
- \c@pgfmath@counta-8\relax%
- \fi%
- \else%
- \ifdim\pgfmath@x>0.0009765625pt\relax% 2^-10
- \multiply\pgfmath@x512\relax%
- \c@pgfmath@counta-9\relax%
- \else%
- \multiply\pgfmath@x1024\relax%
- \c@pgfmath@counta-10\relax%
- \fi%
- \fi%
- \else%
- \ifdim\pgfmath@x>0.0001220703125pt\relax% 2^13
- \ifdim\pgfmath@x>0.0002441406256pt\relax% 2^12
- \multiply\pgfmath@x2048\relax%
- \c@pgfmath@counta-11\relax%
- \else%
- \multiply\pgfmath@x4096\relax%
- \c@pgfmath@counta-12\relax%
- \fi%
- \else%
- \multiply\pgfmath@x8192\relax%
- \c@pgfmath@counta-13\relax%
- \fi%
- \fi%
- \fi%
- \fi%
- \fi%
- %
- % Use A+(B+(C+(D+(E+F*x)*x)*x)*x)*x
- %
- % where:
- % A = -2.787927935
- % B = 5.047861502
- % C = -3.489886985
- % D = 1.589480044
- % E = -.4025153233
- % F = 0.04300521312
- %
- \edef\pgfmath@temp{\pgfmath@tonumber{\pgfmath@x}}%
- \pgfmath@x0.04300521312\pgfmath@x%
- \advance\pgfmath@x-.4025153233pt\relax%
- \pgfmath@x\pgfmath@temp\pgfmath@x%
- \advance\pgfmath@x1.589480044pt\relax%
- \pgfmath@x\pgfmath@temp\pgfmath@x%
- \advance\pgfmath@x-3.489886985pt\relax%
- \pgfmath@x\pgfmath@temp\pgfmath@x%
- \advance\pgfmath@x5.047861502pt\relax%
- \pgfmath@x\pgfmath@temp\pgfmath@x%
- \advance\pgfmath@x-2.787927935pt\relax%
- \advance\pgfmath@x\c@pgfmath@counta pt\relax%
- \pgfmath@x0.6931471806\pgfmath@x%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
-}
-
-% \pgfmathabs
-%
-% Calculate |#1|
-%
-\def\pgfmathabs#1{%
- \pgfmathparse{#1}%
- \pgfmathabsolute@{\pgfmathresult}}
-\def\pgfmathabs@#1{%
- \begingroup%
- \expandafter\pgfmath@x#1pt\relax%
- \ifdim\pgfmath@x<0pt\relax%
- \pgfmath@x-\pgfmath@x%
- \fi%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
-}
-
-% \pgfmathmod
-%
-% Calculate #1 mod #2.
-%
-\def\pgfmathmod#1#2{%
- \edef\pgfmath@marshal{%
- \noexpand\pgfmathparse{#2}
- \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult%
- \noexpand\pgfmathparse{#1}%
- }%
- \pgfmath@marshal%
- \pgfmathmod@{\pgfmathresult}{\pgfmath@arg}%
-}
-\def\pgfmathmod@#1#2{%
- \begingroup%
- \pgfmath@xa#1pt%
- \pgfmath@xb#2pt%
- \pgfmath@x\pgfmath@xa%
- \c@pgfmath@counta\pgfmath@xa%
- \c@pgfmath@countb\pgfmath@xb%
- \divide\c@pgfmath@counta\c@pgfmath@countb%
- \multiply\pgfmath@xb\c@pgfmath@counta%
- \advance\pgfmath@x-\pgfmath@xb%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
-}
-
-% \pgfmathsqrt
-%
-% Square-root of #1.
-%
-%
-\def\pgfmathsqrt#1{\pgfmathparse{#1}\pgfmathsqrt@{\pgfmathresult}}
-\def\pgfmathsqrt@#1{%
- \begingroup%
- \expandafter\pgfmath@x#1pt\relax%
- \ifdim\pgfmath@x<0pt\relax%
- \pgfmath@error{I cannot calculate the square-root of the negative number `#1'}{}%
- \else%
- \ifdim\pgfmath@x<10pt\relax%
- \def\pgfmath@zeros{0}%
- \def\pgfmath@targetiterations{1}%
- \else%
- \ifdim\pgfmath@x<100pt\relax%
- \def\pgfmath@zeros{}%
- \def\pgfmath@targetiterations{1}%
- \else%
- \ifdim\pgfmath@x<1000pt\relax%
- \def\pgfmath@zeros{0}%
- \def\pgfmath@targetiterations{2}%
- \else%
- \ifdim\pgfmath@x<10000pt\relax%
- \def\pgfmath@zeros{}%
- \def\pgfmath@targetiterations{2}%
- \else%
- \def\pgfmath@zeros{0}%
- \def\pgfmath@targetiterations{3}%
- \fi\fi\fi\fi\fi%
- \edef\pgfmath@temp{\pgfmath@zeros\pgfmath@tonumber{\pgfmath@x}}%
- \expandafter\pgfmath@sqrt@\pgfmath@temp\pgfmath@%
-}
-\def\pgfmath@sqrt@#1.#2\pgfmath@{\pgfmath@@sqrt@#1#2\pgfmath@empty\pgfmath@empty\pgfmath@}
-
-\def\pgfmath@@sqrt@#1#2{%
- \c@pgfmath@countb#1#2\relax%
- \ifnum\c@pgfmath@countb>35\relax%
- \ifnum\c@pgfmath@countb>63\relax%
- \ifnum\c@pgfmath@countb>80\relax%
- \c@pgfmath@counta9\relax%
- \else%
- \c@pgfmath@counta8\relax%
- \fi%
- \else%
- \ifnum\c@pgfmath@countb>48\relax%
- \c@pgfmath@counta7\relax%
- \else%
- \c@pgfmath@counta6\relax%
- \fi%
- \fi%
- \else%
- \ifnum\c@pgfmath@countb>15\relax%
- \ifnum\c@pgfmath@countb>24\relax%
- \c@pgfmath@counta5\relax%
- \else%
- \c@pgfmath@counta4\relax%
- \fi%
- \else%
- \ifnum\c@pgfmath@countb>3\relax%
- \ifnum\c@pgfmath@countb>8\relax%
- \c@pgfmath@counta3\relax%
- \else%
- \c@pgfmath@counta2\relax%
- \fi%
- \else%
- \ifnum\c@pgfmath@countb>0\relax%
- \c@pgfmath@counta1\relax%
- \else%
- \c@pgfmath@counta0\relax%
- \fi%
- \fi%
- \fi%
- \fi%
- \edef\pgfmath@root{\the\c@pgfmath@counta}%
- \edef\pgfmath@rootspecial{\the\c@pgfmath@counta}%
- \multiply\c@pgfmath@counta-\c@pgfmath@counta\relax%
- \advance\c@pgfmath@counta#1#2\relax%
- \edef\pgfmath@remainder{\the\c@pgfmath@counta}%
- \pgfmath@@@sqrt@%
-}
-
-\def\pgfmath@@@sqrt@#1#2{%
- \ifx\pgfmath@empty#1%
- \edef\pgfmath@remainder{\pgfmath@remainder00}%
- \def\pgfmath@tokens{\pgfmath@empty\pgfmath@empty}%
- \else%
- \ifx\pgfmath@empty#2%
- \edef\pgfmath@remainder{\pgfmath@remainder#10}%
- \def\pgfmath@tokens{\pgfmath@empty\pgfmath@empty}%
- \else%
- \edef\pgfmath@remainder{\pgfmath@remainder#1#2}%
- \def\pgfmath@tokens{}%
- \fi\fi%
- \c@pgfmath@counta\pgfmath@rootspecial\relax%
- \multiply\c@pgfmath@counta20\relax%
- \c@pgfmath@countb\c@pgfmath@counta%
- \multiply\c@pgfmath@countb6\relax%
- \advance\c@pgfmath@countb36\relax%
- \c@pgfmath@countc\c@pgfmath@counta\relax%
- \multiply\c@pgfmath@countc2\relax%
- \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
- \advance\c@pgfmath@countb-\c@pgfmath@countc%
- \advance\c@pgfmath@countb-20\relax%
- \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
- \advance\c@pgfmath@countb-\c@pgfmath@countc%
- \advance\c@pgfmath@countb-12\relax%
- \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
- \advance\c@pgfmath@countb-\c@pgfmath@counta%
- \advance\c@pgfmath@countb-3\relax%
- \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
- \def\pgfmath@digit{0}%
- \else%
- \def\pgfmath@digit{1}%
- \fi%
- \else%
- \advance\c@pgfmath@countb\c@pgfmath@counta%
- \advance\c@pgfmath@countb5\relax%
- \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
- \def\pgfmath@digit{2}%
- \else%
- \def\pgfmath@digit{3}%
- \fi%
- \fi%
- \else%
- \advance\c@pgfmath@countb\c@pgfmath@counta%
- \advance\c@pgfmath@countb9\relax%
- \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
- \def\pgfmath@digit{4}%
- \else%
- \def\pgfmath@digit{5}%
- \fi%
- \fi%
- \else%
- \advance\c@pgfmath@countb\c@pgfmath@countc%
- \advance\c@pgfmath@countb28\relax%
- \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
- \advance\c@pgfmath@countb-\c@pgfmath@counta%
- \advance\c@pgfmath@countb-15\relax%
- \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
- \def\pgfmath@digit{6}%
- \else%
- \def\pgfmath@digit{7}%
- \fi%
- \else%
- \advance\c@pgfmath@countb\c@pgfmath@counta%
- \advance\c@pgfmath@countb17\relax%
- \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax%
- \def\pgfmath@digit{8}%
- \else%
- \def\pgfmath@digit{9}%
- \fi%
- \fi%
- \fi%
- \edef\pgfmath@rootspecial{\pgfmath@rootspecial\pgfmath@digit}%
- \advance\c@pgfmath@counta\pgfmath@digit\relax%
- \multiply\c@pgfmath@counta-\pgfmath@digit\relax%
- \advance\c@pgfmath@counta\pgfmath@remainder\relax%
- \edef\pgfmath@remainder{\the\c@pgfmath@counta}%
- \c@pgfmath@counta\pgfmath@targetiterations\relax%
- \advance\c@pgfmath@counta-1\relax%
- \edef\pgfmath@targetiterations{\the\c@pgfmath@counta}%
- \ifnum\c@pgfmath@counta=0\relax%
- \edef\pgfmath@root{\pgfmath@root.\pgfmath@digit}%
- \else%
- \edef\pgfmath@root{\pgfmath@root\pgfmath@digit}%
- \fi%
- \ifnum\c@pgfmath@counta=-4\relax% -n+1 digits of precision.
- \let\pgfmath@next\pgfmath@sqrt@end%
- \else%
- \let\pgfmath@next\pgfmath@@@sqrt@%
- \fi%
- \expandafter\pgfmath@next\pgfmath@tokens%
-}
-
-\def\pgfmath@sqrt@end#1\pgfmath@{%
- \edef\pgfmathresult{\pgfmath@root}%
- \pgfmath@smuggleone\pgfmathresult%
- \endgroup}
-
-% \pgfmathpow
-%
-% Calculates #1 ^ #2
-%
-\def\pgfmathpow#1#2{%
- \edef\pgfmath@marshal{%
- \noexpand\pgfmathparse{#2}
- \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult%
- \noexpand\pgfmathparse{#1}%
- }%
- \pgfmath@marshal%
- \pgfmathpow@{\pgfmathresult}{\pgfmath@arg}}
-\def\pgfmathpow@#1#2{%
- \begingroup%
- \pgfmath@xa#1pt%
- \pgfmath@xb#2pt%
- \afterassignment\pgfmath@x%
- \expandafter\c@pgfmath@counta\the\pgfmath@xb\relax%
- \ifnum\c@pgfmath@counta<0\relax%
- \c@pgfmath@counta-\c@pgfmath@counta%
- \pgfmathreciprocal@{#1}%
- \pgfmath@xa\pgfmathresult pt\relax%
- \fi
- \ifdim\pgfmath@x=0pt\relax%
- \pgfmath@x1pt\relax%
- \pgfmathloop%
- \ifnum\c@pgfmath@counta>0\relax%
- \ifodd\c@pgfmath@counta%
- \pgfmath@x\pgfmath@tonumber{\pgfmath@x}\pgfmath@xa%
- \fi
- \ifnum\c@pgfmath@counta>1\relax%
- \pgfmath@xa\pgfmath@tonumber{\pgfmath@xa}\pgfmath@xa%
- \fi%
- \divide\c@pgfmath@counta2\relax%
- \repeatpgfmathloop%
- \else%
- \pgfmathln@{#1}%
- \pgfmath@x\pgfmathresult pt\relax%
- \pgfmath@x\pgfmath@tonumber{\pgfmath@xb}\pgfmath@x%
- \pgfmathexp@{\pgfmath@tonumber{\pgfmath@x}}%
- \pgfmath@x\pgfmathresult pt\relax%
- \fi%
- \pgfmath@returnone\pgf@x%
- \endgroup%
-}
-
-% \pgfmathround
-%
-% Asymmetric Half-up rounding.
-%
-\def\pgfmathround#1{\pgfmathparse{#1}\pgfmathround@{\pgfmathresult}}
-\def\pgfmathround@#1{%
- \begingroup%
- \expandafter\pgfmath@x#1pt\relax%
- \afterassignment\pgfmath@xa%
- \expandafter\c@pgfmath@counta\the\pgfmath@x\relax%
- \pgfmath@xb\pgfmath@x%
- \ifdim\pgfmath@xb<0pt\relax%
- \ifdim\pgfmath@xa<0.5pt\relax%
- \else%
- \advance\c@pgfmath@counta-1\relax%
- \fi%
- \else%
- \ifdim\pgfmath@xa<0.5pt\relax%
- \else%
- \advance\c@pgfmath@counta1\relax%
- \fi%
- \fi%
- \pgfmath@returnone\the\c@pgfmath@counta pt%
- \endgroup%
-}%
-
-% \pgfmathfloor
-%
-% Floor function.
-%
-\def\pgfmathfloor#1{\pgfmathparse{#1}\pgfmathfloor@{\pgfmathresult}}
-\def\pgfmathfloor@#1{%
- \begingroup%
- \expandafter\pgfmath@x#1pt\relax%
- \afterassignment\pgfmath@gobbletilpgfmath@%
- \expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@%
- \pgfmath@x\c@pgfmath@counta pt\relax%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
-}%
-
-% \pgfmathceil
-%
-% Ceiling function.
-%
-\def\pgfmathceil#1{\pgfmathparse{#1}\pgfmathceil@{\pgfmathresult}}
-\def\pgfmathceil@#1{%
- \begingroup%
- \expandafter\pgfmath@x#1pt\relax%
- \afterassignment\pgfmath@gobbletilpgfmath@%
- \expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@%
- \pgfmath@y\pgfmath@x%
- \advance\pgfmath@y-\c@pgfmath@counta pt\relax%
- \pgfmath@x\c@pgfmath@counta pt\relax%
- \ifdim\pgfmath@y>0pt\relax%
- \advance\pgfmath@x1pt\relax%
- \fi%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
-}%
-
-% \pgfmathexp
-%
-% A Maclaurens expansion for e^#1.
-% 0 <= #1 < ln(16384).
-%
-\def\pgfmathexp#1{\pgfmathparse{#1}\pgfmathexp@{\pgfmathresult}}
-\def\pgfmathexp@#1{%
- \begingroup%
- \edef\pgfmath@arg{#1}%
- \pgfmath@x1pt\relax%
- \pgfmath@xa1pt\relax%
- \pgfmath@xb\pgfmath@x%
- \pgfmathloop%
- \pgfmath@xc\pgfmathcounter pt\relax%
- \c@pgfmath@counta\pgfmath@xc%
- \divide\c@pgfmath@counta65536\relax%
- \pgfmath@xc1pt\relax%
- \divide\pgfmath@xc\c@pgfmath@counta%
- \pgfmath@xa\pgfmath@tonumber{\pgfmath@xc}\pgfmath@xa%
- \expandafter\pgfmath@xa\pgfmath@arg\pgfmath@xa%
- \advance\pgfmath@x\pgfmath@xa%
- \ifdim\pgfmath@x=\pgfmath@xb%
- \else%
- \pgfmath@xb\pgfmath@x%
- \repeatpgfmathloop%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
-}
-
-
-
-% \pgfmathvectorlength
-%
-% Calcluate the Eulidean length of a 2D vector.
-%
-% This based on polynomial approximation co-efficents
-% contributed by Rouben Rostamian.
-%
-% #1 - the x component of the vector.
-% #2 - the y component of the vector.
-%
-\def\pgfmathveclen#1#2{%
- \edef\pgfmath@marshal{%
- \noexpand\pgfmathparse{#2}
- \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult%
- \noexpand\pgfmathparse{#1}%
- }%
- \pgfmath@marshal%
- \pgfmathveclen@{\pgfmathresult}{\pgfmath@arg}%
-}
-\def\pgfmathveclen@#1#2{%
- \begingroup%
- \pgfmath@x#1pt\relax%
- \pgfmath@y#2pt\relax%
- \ifdim\pgfmath@x<0pt\relax%
- \pgfmath@x-\pgfmath@x%
- \fi%
- \ifdim\pgfmath@y<0pt\relax%
- \pgfmath@y-\pgfmath@y%
- \fi%
- \ifdim\pgfmath@x=0pt\relax%
- \pgfmath@x\pgfmath@y%
- \else%
- \ifdim\pgfmath@y=0pt\relax%
- \else%
- \ifdim\pgfmath@x>\pgfmath@y%
- \pgfmath@xa\pgfmath@x%
- \pgfmath@x\pgfmath@y%
- \pgfmath@y\pgfmath@xa%
- \fi%
- % We use a scaling factor to reduce errors.
- \ifdim\pgfmath@y>10000pt\relax%
- \c@pgfmath@counta1500\relax%
- \else%
- \ifdim\pgfmath@y>1000pt\relax%
- \c@pgfmath@counta150\relax%
- \else%
- \ifdim\pgfmath@y>100pt\relax%
- \c@pgfmath@counta50\relax%
- \else%
- \c@pgfmath@counta1\relax%
- \fi%
- \fi%
- \fi%
- \divide\pgfmath@x\c@pgfmath@counta\relax%
- \divide\pgfmath@y\c@pgfmath@counta\relax%
- \pgfmathreciprocal@{\pgfmath@tonumber{\pgfmath@y}}%
- \pgfmath@x\pgfmathresult\pgfmath@x%
- \pgfmath@xa\pgfmath@tonumber{\pgfmath@x}\pgfmath@x%
- \edef\pgfmath@temp{\pgfmath@tonumber{\pgfmath@xa}}%
- %
- % Use A+x^2*(B+x^2*(C+x^2*(D+E*x^2)))
- % where
- % A = +1.000012594
- % B = +0.4993615349
- % C = -0.1195159052
- % D = +0.04453994279
- % E = -0.01019210944
- %
- \pgfmath@x-0.01019210944\pgfmath@xa%
- \advance\pgfmath@x0.04453994279pt\relax%
- \pgfmath@x\pgfmath@temp\pgfmath@x%
- \advance\pgfmath@x-0.1195159052pt\relax%
- \pgfmath@x\pgfmath@temp\pgfmath@x%
- \advance\pgfmath@x0.4993615349pt\relax%
- \pgfmath@x\pgfmath@temp\pgfmath@x%
- \advance\pgfmath@x1.000012594pt\relax%
- \ifdim\pgfmath@y<0pt\relax%
- \pgfmath@y-\pgfmath@y%
- \fi%
- \pgfmath@x\pgfmath@tonumber{\pgfmath@y}\pgfmath@x%
- % Invert the scaling factor.
- \multiply\pgfmath@x\c@pgfmath@counta\relax%
- \fi%
- \fi%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
-}
-
-% \pgfmathmax
-%
-% Return the maximum of #1 or #2
-%
-\def\pgfmathmax#1#2{%
- \edef\pgfmath@marshal{%
- \noexpand\pgfmathparse{#2}
- \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult%
- \noexpand\pgfmathparse{#1}%
- }%
- \pgfmath@marshal%
- \pgfmathmax@{\pgfmathresult}{\pgfmath@arg}}%
-\def\pgfmathmax@#1#2{%
- \begingroup
- \pgfmath@x#1pt%
- \pgfmath@y#2pt\relax%
- \ifdim\pgfmath@x>\pgfmath@y%
- \pgfmath@returnone\pgfmath@x%
- \else%
- \pgfmath@returnone\pgfmath@y%
- \fi%
- \endgroup
-}
-
-% \pgfmathmax
-%
-% Return the minimim of #1 or #2
-%
-\def\pgfmathmin#1#2{%
- \edef\pgfmath@marshal{%
- \noexpand\pgfmathparse{#2}
- \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult%
- \noexpand\pgfmathparse{#1}%
- }%
- \pgfmath@marshal%
- \pgfmathmin@{\pgfmathresult}{\pgfmath@arg}}%
-\def\pgfmathmin@#1#2{%
- \begingroup
- \pgfmath@x#1pt%
- \pgfmath@y#2pt%
- \relax%
- \ifdim\pgfmath@x<\pgfmath@y%
- \pgfmath@returnone\pgfmath@x%
- \else%
- \pgfmath@returnone\pgfmath@y%
- \fi%
- \endgroup%
-}
-
-% \pgfmathscientific
-%
-% Return the value of #1e#2
-%
-% e.g. \pgfmathscientific{1.23456789123}{4}
-%
-% defines \pgfmathresult as 12345.67891
-%
-% NB These arguments *are not parsed*, as the long mantissa would be lost.
-%
-\def\pgfmathscientific#1#2{%
- \begingroup%
- \edef\pgfmath@sci@exponent{#2}%
- \pgfmath@x#1pt\relax%
- \ifdim\pgfmath@x<0pt\relax%
- \pgfmath@x-\pgfmath@x%
- \edef\pgfmath@sci@sign{-}%
- \edef\pgfmath@temp{\pgfmath@gobbleone#1}%
- \else%
- \edef\pgfmath@sci@sign{+}%
- \edef\pgfmath@temp{#1}%
- \fi%
- \expandafter\pgfmath@scientific@@\pgfmath@temp00000000000\pgfmath@}
-
-\def\pgfmath@scientific@@#1.#2#3#4#5#6{%
- \edef\pgfmath@sci@int{#1}%
- \edef\pgfmath@sci@mantissaA{#2#3#4#5#6}%
- \pgfmath@scientific@@@}
-
-\def\pgfmath@scientific@@@#1#2#3#4#5#6\pgfmath@{%
- \edef\pgfmath@sci@mantissaB{#1#2#3#4#5}%
- \c@pgfmath@counta\pgfmath@sci@exponent\relax%
- \c@pgfmath@countb\c@pgfmath@counta%
- \ifnum\c@pgfmath@counta<0\relax%
- \c@pgfmath@counta-\c@pgfmath@counta%
- \fi%
- \pgfmathpow@{10}{\the\c@pgfmath@counta}%
- \afterassignment\pgfmath@gobbletilpgfmath@
- \c@pgfmath@countc\pgfmathresult\relax\pgfmath@
- \edef\pgfmath@sci@factor{\the\c@pgfmath@countc}%
- \ifnum\c@pgfmath@countb<0\relax%
- % xE-y: easy...
- \pgfmath@x\pgfmath@sci@int.\pgfmath@sci@mantissaA pt\relax%
- \divide\pgfmath@x\pgfmath@sci@factor\relax%
- \else%
- % xE+y:
- % Must do this way so as not lose digits in a long mantissa. Sigh...
- \c@pgfmath@counta\pgfmath@sci@int%
- \c@pgfmath@countb\pgfmath@sci@mantissaA%
- \multiply\c@pgfmath@counta\pgfmath@sci@factor\relax%
- \multiply\c@pgfmath@countb\pgfmath@sci@factor\relax%
- \c@pgfmath@countc\c@pgfmath@countb%
- \divide\c@pgfmath@countb100000\relax%
- \advance\c@pgfmath@counta\c@pgfmath@countb%
- \multiply\c@pgfmath@countb100000\relax%
- \advance\c@pgfmath@countc-\c@pgfmath@countb%
- \c@pgfmath@countb\pgfmath@sci@mantissaB\relax%
- \multiply\c@pgfmath@countb\pgfmath@sci@factor\relax%
- \divide\c@pgfmath@countb100000\relax%
- \advance\c@pgfmath@countc\c@pgfmath@countb%
- \advance\c@pgfmath@countc100000\relax%
- \edef\pgfmath@sci@result{\pgfmath@sci@sign\the\c@pgfmath@counta.\expandafter\pgfmath@gobbleone\the\c@pgfmath@countc pt}%
- \pgfmath@x\pgfmath@sci@result\relax%
- \fi%
- \pgfmath@returnone\pgfmath@x%
- \endgroup}
-
-
-
-
-
-% *** The following commands DO NOT WORK without the rest of PGF ***
-%
-% (a dumping ground for stuff that doesn't really belong anywhere else)
-
-% \pgfmathanglebetweenpoints
-%
-% Define \pgfmathresult as the angle between points #1 and #2
-% Should get the quadrants right as well.
-%
-\def\pgfmathanglebetweenpoints#1#2{%
- \begingroup%
- \pgf@process{\pgfpointdiff{#1}{#2}}%
- %
- % First approximate the angle of the external point...
- %
- \pgf@xa\pgf@x%
- \pgf@ya\pgf@y%
- \pgf@xb\pgf@x%
- \pgf@yb\pgf@y%
- \ifdim\pgf@xa<0pt\relax%
- \pgf@xa-\pgf@xa%
- \fi%
- \ifdim\pgf@ya<0pt\relax%
- \pgf@ya-\pgf@ya%
- \fi%
- \ifdim\pgf@ya>\pgf@xa%
- \pgf@x\pgf@xa%
- \pgf@y\pgf@ya%
- \else%
- \pgf@x\pgf@ya%
- \pgf@y\pgf@xa%
- \fi%
- \ifdim\pgf@y=0pt\relax%
- \pgf@x0pt%
- \else%
- \pgfmathreciprocal@{\pgfmath@tonumber{\pgf@y}}%
- \pgf@x\pgfmathresult\pgf@x%
- \fi%
- \multiply\pgf@x1000\relax%
- \afterassignment\pgfmath@gobbletilpgfmath@%
- \expandafter\c@pgf@counta\the\pgf@x\relax\pgfmath@%
- \expandafter\pgf@x\csname pgfmath@atan@\the\c@pgf@counta\endcsname pt\relax%
- \ifdim\pgfmath@ya>\pgfmath@xa\relax%
- \pgf@x-\pgf@x%
- \advance\pgf@x90pt%
- \fi%
- \ifdim\pgf@xb<0pt%
- \ifdim\pgf@yb>0pt%
- \pgf@x-\pgf@x%
- \fi%
- \advance\pgf@x180pt\relax%
- \else%
- \ifdim\pgf@yb<0pt%
- \pgf@x-\pgf@x%
- \advance\pgf@x360pt\relax%
- \fi\fi%
- \pgfmath@returnone\pgf@x%
- \endgroup%
-}
-
-%
-% \pgfmathrotatepointaround
-%
-% Rotate point #1 about point #2 by #3 degrees.
-%
-\def\pgfmathrotatepointaround#1#2#3{%
- \pgf@process{%
- \pgf@process{#2}%
- \pgf@xa\pgf@x%
- \pgf@ya\pgf@y%
- \pgf@xb\pgf@x%
- \pgf@yb\pgf@y%
- \pgf@process{#1}%
- \advance\pgf@x-\pgf@xa%
- \advance\pgf@y-\pgf@ya%
- \pgfmathsetmacro\angle{#3}%
- \pgfmathsin@{\angle}%
- \let\sineangle\pgfmathresult%
- \pgfmathcos@{\angle}%
- \let\cosineangle\pgfmathresult%
- \pgf@xa\cosineangle\pgf@x%
- \advance\pgf@xa-\sineangle\pgf@y%
- \pgf@ya\sineangle\pgf@x%
- \advance\pgf@ya\cosineangle\pgf@y%
- \pgf@x\pgf@xb%
- \pgf@y\pgf@yb%
- \advance\pgf@x\pgf@xa%
- \advance\pgf@y\pgf@ya%
- }%
-}
-
-% \pgfmathanglebetweenlines
-%
-% Calculate the clockwise angle between a line from point #1
-% to point #2 and a line from #3 to point #4.
-%
-\def\pgfmathanglebetweenlines#1#2#3#4{%
- \begingroup%
- \pgfmathanglebetweenpoints{#1}{#2}%
- \let\firstangle\pgfmathresult%
- \pgfmathanglebetweenpoints{#3}{#4}%
- \let\secondangle\pgfmathresult%
- \ifdim\firstangle pt>\secondangle pt\relax%
- \pgfmathadd@{\secondangle}{360}%
- \let\secondangle\pgfmathresult%
- \fi%
- \pgfmathsubtract@{\secondangle}{\firstangle}%
- \pgfmath@smuggleone\pgfmathresult%
- \endgroup%
-}
-
-% \pgfmathpointreflectalongaxis
-%
-% Reflects point #2 around an axis centered on #2 at an angle #3.
-%
-\def\pgfmathreflectpointalongaxis#1#2#3{%
- \pgf@process{%
- \pgfmathanglebetweenpoints{#2}{#1}%
- \pgfmath@tempdima\pgfmathresult pt\relax%
- \pgfmathparse{#3}%
- \advance\pgfmath@tempdima-\pgfmathresult pt\relax%
- \pgfmath@tempdima-2.0\pgfmath@tempdima%
- \pgfmathrotatepointaround{#1}{#2}{\pgfmath@tonumber{\pgfmath@tempdima}}%
- }%
-}
-
-
-% \pgfmathpointintersectionoflineandarc
-%
-% A bit experimental at the moment:
-%
-% Locates the point where a line crosses an eliptical arc. If the line
-% does not cross the arc, a meaningless point will result.
-%
-% #1 the point of the line on the "convex" side of the arc.
-% #2 the point of the line on the "concave" side of the arc.
-% #3 the center of the eliptical arc.
-% #4 start angle of the arc.
-% #5 end angle of the arc.
-% #6 radii of the arc.
-%
-\def\pgfmathpointintersectionoflineandarc#1#2#3#4#5#6{%
- \pgf@process{%
- %
- % Get the required angle.
- %
- \pgfmathanglebetweenpoints{#2}{#1}%
- \let\x\pgfmathresult%
- %
- % Get the radii of the arc.
- %
- \pgfmath@in@{and }{#6}%
- \ifpgfmath@in@%
- \pgf@polar@#6\@@%
- \else%
- \pgf@polar@#6 and #6\@@%
- \fi%
- \edef\xarcradius{\the\pgf@x}%
- \edef\yarcradius{\the\pgf@y}%
- %
- % Get the start and end angles of the arc...
- %
- \pgfmathsetmacro\s{#4}%
- \pgfmathsetmacro\e{#5}%
- %
- % ...and also with rounding.
- %
- \pgfmathmod@{\s}{360}%
- \ifdim\pgfmathresult pt<0pt\relax%
- \pgfmathadd@{\pgfmathresult}{360}%
- \fi%
- \let\ss\pgfmathresult%
- \pgfmathmod@{\e}{360}%
- \ifdim\pgfmathresult pt<0pt\relax%
- \pgfmathadd@{\pgfmathresult}{360}%
- \fi%
- \let\ee\pgfmathresult%
- %
- % Hackery for when arc straddles zero.
- %
- \ifdim\ee pt<\ss pt\relax%
- \pgfmathadd@{\x}{180}%
- \pgfmathmod@{\pgfmathresult}{360}%
- \let\x\pgfmathresult%
- \fi%
- \def\m{360}% Measure of nearness.
- \pgfmathadd@{\s}{\e}%
- \pgfmathdivide@{\pgfmathresult}{2}%
- \let\n\pgfmathresult% The best estimate (default to middle of arc).
- \pgfmathloop%
- \pgfmathadd@{\s}{\e}%
- \pgfmathdivide@{\pgfmathresult}{2}%
- \let\p\pgfmathresult%
- \ifdim\p pt=\s pt\relax%
- \else%
- \pgfmathanglebetweenpoints{#2}{%
- \pgfpointadd{#3}{%
- \pgf@x\xarcradius\relax%
- \pgfmathcos@{\p}%
- \pgf@x\pgfmathresult\pgf@x%
- \pgf@y\yarcradius\relax%
- \pgfmathsin@{\p}%
- \pgf@y\pgfmathresult\pgf@y%
- }%
- }%
- %
- % Hackery for when arc straddles zero.
- %
- \ifdim\ee pt<\ss pt\relax%
- \pgfmathadd@{\pgfmathresult}{180}%
- \pgfmathmod@{\pgfmathresult}{360}%
- \fi%
- \let\q\pgfmathresult%
- %
- % More hackery...
- %
- \ifdim\x pt>335pt\relax%
- \ifdim\q pt<45pt\relax%
- \pgfmathadd@{\q}{360}%
- \let\q\pgfmathresult%
- \fi%
- \fi%
- \ifdim\x pt=\q pt% Found it!
- \pgfmathbreakloop% Breaks after current iteration is complete.
- \else
- \ifdim\x pt<\q pt\relax%
- \let\e\p%
- \else%
- \let\s\p%
- \fi%
- \fi%
- \pgfmathsubtract@{\x}{\q}%
- \pgfmathabs@{\pgfmathresult}%
- %
- % Save the estimate if it is better than any previous estimate.
- %
- \ifdim\pgfmathresult pt<\m pt\relax%
- \let\m\pgfmathresult%
- \let\n\p%
- \fi%
- \repeatpgfmathloop%
- \pgfpointadd{#3}{\pgfpointpolar{\n}{\xarcradius and \yarcradius}}%
- }%
-}
-
-% \pgfmathangleonellipse
-%
-% Find the angle corresponding to a point on the border of an ellispe.
-%
-% #1 - the point on the border.
-% #2 - the radii of the ellipse.
-%
-\def\pgfmathangleonellipse#1#2{%
- \begingroup%
- \pgfmath@in@{and }{#2}%
- \ifpgfmath@in@%
- \pgf@polar@#2\@@%
- \else%
- \pgf@polar@#2 and #2\@@%
- \fi%
- \pgf@xa\pgf@x%
- \pgf@ya\pgf@y%
- \pgf@process{#1}%
- \ifdim\pgf@x=0pt\relax%
- \pgfutil@tempdima1pt\relax%
- \else%
- \pgfutil@tempdima\pgf@x%
- \pgfmathdivide@{\pgfmath@tonumber{\pgf@xa}}{\pgfmath@tonumber{\pgfutil@tempdima}}%
- \pgfutil@tempdima\pgfmathresult pt\relax%
- \fi%
- \ifdim\pgf@y=0pt\relax%
- \pgfutil@tempdima1pt\relax%
- \else%
- \pgfmathdivide@{\pgfmath@tonumber{\pgf@y}}{\pgfmath@tonumber{\pgf@ya}}%
- \pgfutil@tempdima\pgfmathresult\pgfutil@tempdima%
- \pgfmathatan@{\pgfmath@tonumber{\pgfutil@tempdima}}%
- \fi%
- %
- \pgfutil@tempdima\pgfmathresult pt\relax%
- \ifdim\pgfutil@tempdima<0pt\relax%
- \advance\pgfutil@tempdima360pt\relax%
- \fi%
- \ifdim\pgf@x<0pt\relax%
- \ifdim\pgf@y=0pt\relax%
- \pgfutil@tempdima180pt\relax%
- \else%
- \ifdim\pgf@y<0pt\relax%
- \advance\pgfutil@tempdima180pt\relax%
- \else%
- \advance\pgfutil@tempdima-180pt\relax%
- \fi%
- \fi%
- \else%
- \ifdim\pgf@x=0pt\relax%
- \ifdim\pgf@y<0pt\relax%
- \pgfutil@tempdima270pt\relax%
- \else%
- \pgfutil@tempdima90pt\relax%
- \fi%
- \else%
- \ifdim\pgf@y=0pt\relax%
- \pgfutil@tempdima0pt\relax%
- \fi%
- \fi%
- \fi%
- \pgfmath@returnone\pgfutil@tempdima%
- \endgroup%
-} \ No newline at end of file
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
index 3d69d34b73c..81f6545897e 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
@@ -1,970 +1,772 @@
-% Copyright 2007 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.
-% This file parses/evaluates a decimal expression.
-%
-% Version 1.414213 29/9/2007
+\newdimen\pgfmath@dimen
+\newcount\pgfmath@count
+\newbox\pgfmath@box
+\newtoks\pgfmath@toks
-% \pgfmathparse, \pgfmathqparse
-%
-% Evaluates a decimal expression.
-%
-% #1 - the expression.
-%
-% returns
-%
-% x = the result as a dimension.
-%
-% E.g.
-% \pgfmathparse{3pt*2cm+1.5}
-% \pgfmathqparse{3pt*2cm+1.5pt}
-%
-% Every number in \pgfmathqparse *must*
-% specify a unit.
-%
\newif\ifpgfmath@quickparse
+\newif\ifpgfmathfloat
+\newif\ifpgfmathunitsdeclared
+\newif\ifpgfmathignoreunitscale
+
+\def\pgfmathprint#1{\pgfmathparse{#1}\pgfmathresult}
\def\pgfmathparse{%
- \pgfmath@quickparsefalse%
- \pgfmathparse@}
+ \begingroup%
+ \pgfmath@catcodes%
+ \pgfmath@quickparsefalse%
+ \ifpgfmathfloat%
+ \let\pgfmath@parse@next=\pgfmathfloatparsenumber%
+ \else%
+ \let\pgfmath@parse@next=\pgfmathparse@%
+ \fi%
+ \pgfmath@parse@next}
-\def\pgfmathqparse{%
- \pgfmath@quickparsetrue%
- \pgfmathparse@}
-
-\def\pgfmath@calcreal#1{#1}%
-\def\pgfmath@calcminof#1#2{min(#1,#2)}%
-\def\pgfmath@calcmaxof#1#2{max(#1,#2)}%
-\def\pgfmath@calcratio#1#2{#1/#2}%
+\def\pgfmath@catcodes{% Maybe unecessary.
+ \catcode`\==12%
+ \catcode`\,=12%
+ \catcode`\|=12%
+ \catcode`\&=12%
+}
+\def\pgfmathqparse{%
+ \begingroup%
+ \pgfmath@catcodes%
+ \pgfmath@quickparsetrue%
+ \pgfmathparse@}
+
\def\pgfmathparse@#1{%
- \begingroup%
- % Reinstall correct font, so that dimensions like 1em are correct
+ % Stuff for calc compatiability.
+ \let\real=\pgfmath@calc@real%
+ \let\minof=\pgfmath@calc@minof%
+ \let\maxof=\pgfmath@calc@maxof%
+ \let\ratio=\pgfmath@calc@ratio%
+ \let\widthof=\pgfmath@calc@widthof%
+ \let\heightof=\pgfmath@calc@heightof%
+ \let\depthof=\pgfmath@calc@depthof%
+ % Restore font.
\pgfmath@selectfont%
- \let\real\pgfmath@calcreal%
- \let\minof\pgfmath@calcminof%
- \let\maxof\pgfmath@calcmaxof%
- \let\ratio\pgfmath@calcratio%
- \edef\pgfmath@temp{#1}%
- \pgfmath@resetparsingparameters%
+ % Expand expression so any reamining CSs are registers
+ % or box dimensions (i.e., \wd, \ht, \dp).
+ \edef\pgfmath@expression{#1}%
+ % No units yet.
\global\pgfmathunitsdeclaredfalse%
- \ifpgfmath@quickparse%
- \let\pgfmath@parseoperand\pgfmath@quickparseoperand%
- \else%
- \let\pgfmath@parseoperand\pgfmath@parseoperand%
- \fi%
- \let\pgfmath@parsepostgroup\pgfmath@parseoperator%
- \expandafter\pgfmath@parse@\pgfmath@temp @@@@@@@@@@@\pgfmath@empty}
+ % Set up stack.
+ \pgfmath@stack@operation={{}{}{}}%
+ \pgfmath@stack@operand={{}{}{}}%
+ \let\pgfmath@stack@operation@top=\pgfmath@stack@empty%
+ \let\pgfmath@stack@operand@top=\pgfmath@stack@empty%
+ % An expression always begins with an operand.
+ \expandafter\pgfmath@bgroup@strip\expandafter{\pgfmath@expression}%
+ \expandafter\pgfmath@parse@@operand\pgfmath@bgroup@stripped @@@@\pgfmath@parse@stop%
+}%
+\def\pgfmath@parse@end#1\pgfmath@parse@stop{%
+ \pgfmathpostparse%
+ \pgfmath@smuggleone\pgfmathresult%
+ \endgroup%
+ \ignorespaces}%
-% \pgfmath@resetparsingparameters
-%
-% Reset the stack at the begining of the parse/group.
-%
-\def\pgfmath@resetparsingparameters{%
- \pgfmath@stack{\pgfmath@empty\pgfmath@empty\pgfmath@empty\pgfmath@empty}%
- \def\pgfmath@stacknextoperator{\pgfmath@empty}% Will not work with \let
-}
-% \pgfmath@parse@
-%
-% Start parsing. Expect one of
-% 1) the end of the parse
-% 2) the start of a group
-% 3) a (possible) operand.
+\let\pgfmathpostparse=\relax%
+
+% For compatiability with older version.
%
-\def\pgfmath@parse@#1{%
- \def\pgfmath@token{}%
- \ifx#1@%
- \let\pgfmath@parsenext\pgfmath@endparse%
- \else%
- \ifx#1(%
- \let\pgfmath@parsenext\pgfmath@startparsegroup%
- \else%
- \edef\pgfmath@token{#1}%
- \let\pgfmath@parsenext\pgfmath@parseoperand%
- \fi\fi%
- \pgfmath@parsenext%
+\def\pgfmathscaleresult{%
+ \ifpgfmathunitsdeclared%
+ \else%
+ \ifpgfmathignoreunitscale%
+ \else%
+ \afterassignment\pgfmath@gobbletilpgfmath@%
+ \pgfmath@x\pgfmathresultunitscale pt\relax\pgfmath@%
+ \expandafter\pgfmath@x\pgfmathresult\pgfmath@x%
+ \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}%
+ \fi%
+ \fi%
}
-
-% If no TeX units are declared *at any point* in the parse
-% the result is scaled by \pgfmathresultunitscale.
-\newif\ifpgfmathunitsdeclared
\def\pgfmathsetresultunitscale#1{\def\pgfmathresultunitscale{#1}}
\def\pgfmathresultunitscale{1}
-% \pgfmath@endparse
-%
-% Everything stops here.
-%
-\def\pgfmath@endparse#1\pgfmath@empty{%
- \pgfmath@processalloperations%
- \pgfmath@stackpop{\pgfmathresult}%
- \begingroup%
- \ifpgfmathunitsdeclared%
- \pgfmath@x1pt\relax%
- \else%
- \afterassignment\pgfmath@gobbletilpgfmath@%
- \pgfmath@x\pgfmathresultunitscale pt\relax\pgfmath@%
- \fi%
- \expandafter\pgfmath@x\pgfmathresult\pgfmath@x%
- \pgfmath@returnone\pgfmath@x%
- \endgroup%
- \pgfmath@smuggleone{\pgfmathresult}%
- \endgroup%
- \ignorespaces%
-}
+% Stuff for compatability with the calc package.
+%
+\def\pgfmath@calc@real#1{#1}
+\def\pgfmath@calc@minof#1#2{min(#1,#2)}
+\def\pgfmath@calc@maxof#1#2{max(#1,#2)}
+\def\pgfmath@calc@ratio#1#2{#1/#2}
+\def\pgfmath@calc@widthof#1{width("#1")}
+\def\pgfmath@calc@heightof#1{height("#1")}
+\def\pgfmath@calc@depthof#1{depth("#1")}
+
+\def\pgfmath@bgroup{\string\pgfmath@bgroup}
+\def\pgfmath@egroup{\string\pgfmath@egroup}
+\def\pgfmath@egroup@token{\pgfmath@egroup}
+
+\def\pgfmath@text@@{@}
+\def\pgfmath@text@operator{operator}
+\def\pgfmath@text@function{function}
+\def\pgfmath@dots{...}
+\def\pgfmath@char@zero{0}
+\def\pgfmath@char@quote{"}
+\def\pgfmath@char@exclamation{!}
+\def\pgfmath@char@plus{+}
+\def\pgfmath@char@minus{-}
+\def\pgfmath@char@period{.}
+\def\pgfmath@char@leftangle{<}
+\def\pgfmath@char@leftbracket{[}
+\pgfmath@toks={#}
+\edef\pgfmath@char@hash{\the\pgfmath@toks}
+
+\def\pgfmath@tokens@make#1#2{%
+ \def\pgfmath@prefix{#1}%
+ \expandafter\pgfmath@tokens@@make#2{}}
+
+\def\pgfmath@tokens@@make#1{%
+ \def\pgfmath@token{#1}%
+ \ifx\pgfmath@token\pgfmath@empty%
+ \else%
+ \pgfmath@namedef{pgfmath@token@\pgfmath@prefix @\string#1}{#1}%
+ \expandafter\pgfmath@tokens@@make%
+ \fi}
-% \pgfmath@startparsegroup
-%
-% When opening ( is scanned start a new group.
+\pgfmath@tokens@make{box}{\wd\ht\dp}
+\pgfmath@tokens@make{unit}{{bp}{cc}{cm}{dd}{em}{ex}{in}{mm}{pc}{pt}{sp}}
+\pgfmath@tokens@make{numeric}{.0123456789}
+\pgfmath@tokens@make{number}{0123456789}
+\pgfmath@tokens@make{functional}{_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ}
+\pgfmath@tokens@make{exponent}{eE}
+\pgfmath@tokens@make{group}{{()}{[]}{\pgfmath@bgroup\pgfmath@egroup}}
+\pgfmath@tokens@make{specials}{@)]\pgfmath@egroup}
+\pgfmath@tokens@make{hexadecimal}{0123456789ABCDEFabcdef}
+\pgfmath@tokens@make{octal}{01234567}
+\pgfmath@tokens@make{binary}{01}
+
+\pgfmath@namedef{pgfmath@base@0x}{16}
+\pgfmath@namedef{pgfmath@base@0X}{16}
+\pgfmath@namedef{pgfmath@base@0b}{2}
+\pgfmath@namedef{pgfmath@base@0B}{2}
+
+% Determine if a register is a count or a dimension/skip register.
%
-\def\pgfmath@startparsegroup{%
+\newif\ifpgfmath@dimen@
+\def\pgfmath@dimen@#1{%
\begingroup%
- \let\pgfmath@parsepostgroup\pgfmath@parseoperator%
- \pgfmath@resetparsingparameters%
- \pgfmath@parse@}
-
-% \pgfmath@endparsegroup
-%
-% When closing ) is scanned, processes all waiting
-% operations (within the group) and close the group.
-%
-\def\pgfmath@endparsegroup{%
- \pgfmath@processalloperations%
- \pgfmath@stackpop{\pgfmathresult}%
- \expandafter\pgfmath@x\pgfmathresult pt\relax%
- \pgfmath@returnone\pgfmath@x%
+ \afterassignment\pgfmath@dimen@@%
+ #1=0.0pt\relax\pgfmath@}
+\def\pgfmath@dimen@@#1#2\pgfmath@{%
\endgroup%
- \pgfmath@parsepostgroup%
-}
+ \ifx#1.%
+ \pgfmath@dimen@false%
+ \else%
+ \pgfmath@dimen@true%
+ \fi}
-% \pgfmath@parseoperator
-%
-% An operator is expected here.
-% Or the end of the parse or parse group.
-%
-\def\pgfmath@parseoperator#1{%
- \def\pgfmath@token{}%
- % Push the operand in \pgfmathresult on to the stack.
- \expandafter\pgfmath@stackpushoperand\expandafter{\pgfmathresult}%
- \ifx#1@%
- \let\pgfmath@parsenext\pgfmath@endparse%
+\def\pgfmath@parse@ifbgroup#1#2{%
+ \let\pgfmath@parse@bgroup@after=#1%
+ \let\pgfmath@parse@nobgroup@after=#2%
+ \futurelet\pgfmath@token@let%
+ \pgfmath@parse@@ifbgroup}
+
+\def\pgfmath@parse@@ifbgroup{%
+ \ifx\pgfmath@token@let\bgroup%
+ \let\pgfmath@parse@next=\pgfmath@parse@@@ifbgroup%
\else%
- \ifx#1+%
- \let\pgfmath@parsenext\pgfmath@parseadd%
+ \ifx\pgfmath@token@let\pgfmath@sptoken%
+ \let\pgfmath@parse@next=\pgfmath@parse@@@@ifbgroup%
\else%
- \ifx#1-%
- \let\pgfmath@parsenext\pgfmath@parsesubtract%
- \else%
- \ifx#1*%
- \let\pgfmath@parsenext\pgfmath@parsemultiply%
- \else%
- \ifx#1/%
- \let\pgfmath@parsenext\pgfmath@parsedivide%
- \else
- \ifx#1)%
- \let\pgfmath@parsenext\pgfmath@endparsegroup%
- \else%
- \ifx#1r%
- \let\pgfmath@parsenext\pgfmath@parseradians%
- \else%
- \ifx#1>%
- \let\pgfmath@parsenext\pgfmath@parsegreaterthan%
- \else%
- \ifx#1<%
- \let\pgfmath@parsenext\pgfmath@parselessthan%
- \else%
- \if#1=%
- \let\pgfmath@parsenext\pgfmath@parseequalto%
- \else%
- \if#1^%
- \let\pgfmath@parsenext\pgfmath@parsepower%
- \else%
- \pgfmath@error{Unknown operator `#1'}%
- \let\pgfmath@parsenext\relax%
- \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi%
- \pgfmath@parsenext%
-}
-
-% Use a \toks register as a stack.
-\newtoks\pgfmath@stack
+ \let\pgfmath@parse@next=\pgfmath@parse@nobgroup@after%
+ \fi%
+ \fi%
+ \pgfmath@parse@next}
-% \pgfmath@stackpushoperator
-%
-% Push an operator (actually its macro e.g., \pgfmathadd@)
-% on to the stack. And keep track of it using the macro
-% \pgfmath@stacknextoperator.
-%
-\def\pgfmath@stackpushoperator#1{%
- \edef\pgfmath@temp{\noexpand#1\the\pgfmath@stack}%
- \expandafter\pgfmath@stack\expandafter{\pgfmath@temp}%
- \def\pgfmath@stacknextoperator{#1}}% <- Must \def. Cannot \let.
+\def\pgfmath@parse@@@ifbgroup#1{\pgfmath@parse@bgroup@after\pgfmath@bgroup#1\pgfmath@egroup}
-% \pgfmath@stackpushoperand
-%
-% Push an operand (i.e. a number) on the stack. It is
-% put within a TeX group to make popping a lot simpler.
-%
-\def\pgfmath@stackpushoperand#1{%
- \edef\pgfmath@temp{{#1}\the\pgfmath@stack}%
- \expandafter\pgfmath@stack\expandafter{\pgfmath@temp}%
+{
+\def\:{\pgfmath@parse@@@@ifbgroup}
+\expandafter\gdef\: {\futurelet\pgfmath@token@let\pgfmath@parse@@ifbgroup}
}
-% \pgfmath@stackpeek
-%
-% Peek (i.e. without removal) at the top of the stack.
-%
-\def\pgfmath@stackpeek{\expandafter\pgfmath@stackpeek@\the\pgfmath@stack\pgfmath@}
-\def\pgfmath@stackpeek@#1#2\pgfmath@{#1}%
+% Parse an operand.
+%
+\def\pgfmath@parse@operand{\expandafter\pgfmath@parse@@operand\pgfmath@token@next}%
-% \pgfmath@stackpop
-%
-% Pop (i.e. remove) the top of the stack into #1.
-%
-\def\pgfmath@stackpop#1{\expandafter\pgfmath@stackpop@\expandafter#1\the\pgfmath@stack\pgfmath@}
-\def\pgfmath@stackpop@#1#2#3\pgfmath@{\edef#1{#2}\pgfmath@stack{#3}}%
+\def\pgfmath@parse@@operand{\pgfmath@parse@ifbgroup{\pgfmath@parse@@operand}{\pgfmath@parse@@operand@}}
-% \pgfmath@stackpopoperation
-%
-% Remove and perform an operation from the stack.
-%
-\def\pgfmath@stackpopoperation{%
- \expandafter\pgfmath@stackpopoperation@\the\pgfmath@stack\pgfmath@%
-}
-\def\pgfmath@stackpopoperation@#1#2#3#4#5\pgfmath@{%
- \ifx\pgfmath@empty#1\relax%
- \pgfmath@stack{\pgfmath@empty\pgfmath@empty\pgfmath@empty\pgfmath@empty}%
+\def\pgfmath@parse@@operand@#1{%
+ \def\pgfmath@token{#1}%
+ \ifx\pgfmath@token\pgfmath@char@plus% Ignore.
+ \let\pgfmath@parse@next=\pgfmath@parse@@operand%
\else%
- \ifx\pgfmath@empty#2\relax%
- \pgfmath@stack{{#1}\pgfmath@empty\pgfmath@empty\pgfmath@empty\pgfmath@empty}%
+ \ifx\pgfmath@token\pgfmath@char@minus%
+ \pgfmath@stack@push@operation{neg}% Unary minus.
+ \let\pgfmath@parse@next=\pgfmath@parse@@operand%
\else%
- #2{#3}{#1}%
- \pgfmath@stack{#4#5}%
- \expandafter\pgfmath@stackpushoperand\expandafter{\pgfmathresult}%
- \fi\fi%
- \def\pgfmath@stacknextoperator{#4}}
+ \expandafter\ifx\csname pgfmath@operation@\expandafter\string\pgfmath@token @prefix\endcsname\pgfmath@token%
+ \let\pgfmath@parse@next=\pgfmath@parse@prefix@operator%
+ \else%
+ \ifpgfmath@quickparse%
+ \let\pgfmath@parse@next=\pgfmath@qparse@operand%
+ \else%
+ \let\pgfmath@number=\pgfmath@empty%
+ \expandafter\ifx\csname pgfmath@token@functional@\string#1\endcsname\relax%
+ \let\pgfmath@base=\pgfmath@empty%
+ \let\pgfmath@token@next=\pgfmath@token%
+ \if#10% Check for octal prefix.
+ \def\pgfmath@base{8}%
+ \fi%
+ \let\pgfmath@parse@next=\pgfmath@parse@number%
+ \else%
+ \let\pgfmath@function=\pgfmath@token%
+ \let\pgfmath@parse@next=\pgfmath@parse@function%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \pgfmath@parse@next%
+}
-% \pgfmath@processalloperations
-%
-% Process all operation in the stack. The
-% overall result is at the top of the stack.
+% Parse prefix operators.
%
-\def\pgfmath@processalloperations{%
- \expandafter\pgfmath@in@\pgfmath@stacknextoperator{\pgfmath@empty}%
- \ifpgfmath@in@%
- \let\pgfmath@processnext\relax%
+\def\pgfmath@parse@prefix@operator{%
+ \ifx\pgfmath@token\pgfmath@char@quote% Quote character.
+ \let\pgfmath@parse@next=\pgfmath@parse@operand@quote%
\else%
- \pgfmath@stackpopoperation%
- \let\pgfmath@processnext\pgfmath@processalloperations%
+ \ifx\pgfmath@token\pgfmath@char@exclamation% Prefix !.
+ \pgfmath@stack@push@operation{not}%
+ \let\pgfmath@parse@next=\pgfmath@parse@@operand%
+ \else% Anything else, just push and hope.
+ \expandafter\pgfmath@stack@push@operation\expandafter{\pgfmath@token}%
+ \let\pgfmath@parse@next=\pgfmath@parse@@operand%
+ \fi%
\fi%
- \pgfmath@processnext}
+ \pgfmath@parse@next%
+}%
-% \pgfmath@processoperationsuntil
-%
-% Process operations in the stack, until the specified
-% operation/s is/are encountered. The overall result is
-% at the top of the stack.
-%
-\def\pgfmath@processoperationsuntil#1{%
- \expandafter\pgfmath@in@\pgfmath@stacknextoperator{#1\pgfmath@empty}%
- \ifpgfmath@in@%
- \let\pgfmath@processnext\pgfmath@processoperationsuntil@end%
+
+% Quote part of an expression.
+%
+\def\pgfmath@parse@operand@quote#1"{%
+ \def\pgfmathresult{#1}%
+ \expandafter\pgfmath@stack@push@operand\expandafter{\pgfmathresult}%
+ \pgfmath@parse@@operator%
+}
+
+% Quick operand parsing. Should always have units.
+% No functions, base conversion, quoting or scientific notation
+% are permitted.
+\def\pgfmath@qparse@operand{%
+ \afterassignment\pgfmath@qparse@@operand%
+ \pgfmath@dimen\pgfmath@token}
+\def\pgfmath@qparse@@operand{%
+ \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@dimen}}%
+ \expandafter\pgfmath@stack@push@operand\expandafter{\pgfmathresult}%
+ \pgfmath@parse@@operator%
+}
+
+% Parse a number, which can take the form:
+%
+% 1. An integer, or a decimal, with or without units.
+% 2. A dimension/skip or a count register.
+% 3. A dimension register preceded by a number or count register.
+% 4. A box dimension (e.g., \wd\mybox).
+% 5. A box dimension preceded by a number or a count register.
+% 6. Scientific notation (e.g., 1.234567e-10).
+% 7. A binary, hexadeciaml, or octal number.
+%
+\def\pgfmath@parse@number{\pgfmath@parse@ifbgroup{\pgfmath@parse@number}{\pgfmath@parse@number@}}
+\def\pgfmath@parse@number@#1{%
+ \let\pgfmath@token=\pgfmath@token@next%
+ \def\pgfmath@token@next{#1}%
+ \pgfmath@parse@@number}
+
+\def\pgfmath@parse@@number{%
+ \ifx\pgfmath@token\pgfmath@egroup@token%
+ \expandafter\pgfmath@stack@push@operand\expandafter{\pgfmath@number}%
+ \let\pgfmath@parse@next=\pgfmath@parse@@@operator%
\else%
- \pgfmath@stackpopoperation%
- \let\pgfmath@processnext\pgfmath@processoperationsuntil%
+ \expandafter\ifcat\pgfmath@token\relax% A CS?
+ \expandafter\ifx\csname pgfmath@token@box@\expandafter\string\pgfmath@token\endcsname\relax%
+ % So, is the CS is a dimension or a count register?
+ \expandafter\pgfmath@dimen@\pgfmath@token%
+ \ifpgfmath@dimen@% A dimension register.
+ \global\pgfmathunitsdeclaredtrue%
+ \pgfmath@dimen=\pgfmath@number\pgfmath@token%
+ \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@dimen}}%
+ \expandafter\pgfmath@stack@push@operand\expandafter{\pgfmathresult}%
+ \let\pgfmath@parse@next=\pgfmath@parse@operator%
+ \else% A count register.
+ \pgfmath@count=\pgfmath@token%
+ \expandafter\def\expandafter\pgfmath@number\expandafter{\the\pgfmath@count}%
+ \expandafter\ifcat\pgfmath@token@next\relax%
+ % A CS following a count register should be \wd, \ht or \dp.
+ \let\pgfmath@parse@next=\pgfmath@parse@number%
+ \else%
+ \let\pgfmathresult=\pgfmath@number%
+ \expandafter\pgfmath@stack@push@operand\expandafter{\pgfmathresult}%
+ \let\pgfmath@parse@next=\pgfmath@parse@operator%
+ \fi%
+ \fi%
+ \else%
+ % This should be a box specification, for example, 0.5\wd\mybox.
+ \global\pgfmathunitsdeclaredtrue%
+ \pgfmath@dimen=\pgfmath@number\pgfmath@token\pgfmath@token@next%
+ \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@dimen}}%
+ \expandafter\pgfmath@stack@push@operand\expandafter{\pgfmathresult}%
+ \let\pgfmath@parse@next=\pgfmath@parse@@operator%
+ \fi%
+ \else%
+ \expandafter\ifx\csname pgfmath@token@numeric@\expandafter\string\pgfmath@token\endcsname\relax%
+ % It isn't numeric (i.e., 012345679.), so it might be units...
+ \expandafter\ifx\csname pgfmath@token@unit@\pgfmath@token\expandafter\string\pgfmath@token@next\endcsname\relax%
+ % ...or the exponent characters...
+ \expandafter\ifx\csname pgfmath@token@exponent@\pgfmath@token\endcsname\relax%
+ % ...or a base prefix...
+ \expandafter\ifx\csname pgfmath@base@\pgfmath@number\pgfmath@token\endcsname\relax%
+ % ...none of the above...
+ \ifx\pgfmath@base\pgfmath@empty%
+ \let\pgfmathresult=\pgfmath@number%
+ \else%
+ \ifx\pgfmath@number\pgfmath@char@zero%
+ \let\pgfmathresult=\pgfmath@number%
+ \else%
+ % Convert from octal.
+ \expandafter\pgfmathbasetobase\expandafter\pgfmathresult\expandafter{\pgfmath@number}{8}{10}%
+ \fi%
+ \fi%
+ \expandafter\pgfmath@stack@push@operand\expandafter{\pgfmathresult}%
+ \let\pgfmath@parse@next=\pgfmath@parse@@@operator%
+ \else%
+ % ...here, it is a base prefix 0x, 0X, 0b or 0B
+ \expandafter\let\expandafter\pgfmath@base\expandafter=%
+ \csname pgfmath@base@\pgfmath@number\pgfmath@token\endcsname%
+ \let\pgfmath@parse@next=\pgfmath@parse@base%
+ \fi%
+ \else% ... and here, it is the exponent characters.
+ \let\pgfmath@parse@next=\pgfmath@parse@exponent%
+ \fi%
+ \else% ...but here it is units.
+ \global\pgfmathunitsdeclaredtrue%
+ \pgfmath@dimen=\pgfmath@number\pgfmath@token\pgfmath@token@next\relax%
+ \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@dimen}}%
+ \expandafter\pgfmath@stack@push@operand\expandafter{\pgfmathresult}%
+ \let\pgfmath@parse@next=\pgfmath@parse@@operator%
+ \fi%
+ \else% It is numeric.
+ \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\pgfmath@number%
+ \expandafter\expandafter\expandafter{\expandafter\pgfmath@number\pgfmath@token}%
+ \ifx\pgfmath@token\pgfmath@char@period%
+ \let\pgfmath@base=\pgfmath@empty%
+ \fi%
+ \let\pgfmath@parse@next=\pgfmath@parse@number%
+ \fi%
+ \fi%
\fi%
- \pgfmath@processnext{#1}}
-\def\pgfmath@processoperationsuntil@end#1{}
+ \pgfmath@parse@next%
+}
+% Parse the exponent of a number.
+%
+% REMARK: this method will be overwritten by the FPU library. Please
+% keep changes consistent...
+\def\pgfmath@parse@exponent{%
+ \afterassignment\pgfmath@parse@@exponent%
+ \pgfmath@count\pgfmath@token@next}
+\def\pgfmath@parse@@exponent{%
+ \pgfmathscientific{\pgfmath@number}{\the\pgfmath@count}%
+ \expandafter\pgfmath@stack@push@operand\expandafter{\pgfmathresult}%
+ \pgfmath@parse@@operator%
+}
-% OK. Now the operators are parsed.
-% These correspond to the + - / * ^ < > = operators and r (postfix) function.
+% Parse binary or hexadecimal numbers (octal numbers done elsehwere).
%
-\def\pgfmath@parseadd{%
- % If no operator has been assigned (i.e. + is the first operator scanned),
- % do nothing, except add addition to the stack.
- \ifx\pgfmath@stacknextoperator\pgfmath@empty%
+\def\pgfmath@parse@base{%
+ \ifnum\pgfmath@base=2\relax%
+ \let\pgfmath@parse@next=\pgfmath@parse@binary%
\else%
- % Empty the process stack up to any inequalities.
- \pgfmath@processoperationsuntil{\pgfmathequalto@\pgfmathlessthan@\pgfmathgreaterthan@}%
+ \ifnum\pgfmath@base=16\relax%
+ \let\pgfmath@parse@next=\pgfmath@parse@hexadecimal%
+ \else%
+ \pgfmath@error{Unexpected numerical base `\pgfmath@base'}{}%
+ \def\pgfmathresult{0}%
+ \let\pgfmath@parse@next=\pgfmath@parse@end%
+ \fi%
\fi%
- \pgfmath@stackpushoperator{\pgfmathadd@}%
- \pgfmath@parse@}
+ \let\pgfmath@number=\pgfmath@empty%
+ \expandafter\pgfmath@parse@next\pgfmath@token@next%
+}
-\def\pgfmath@parsesubtract{%
- % If no operator has been assigned (i.e. - is the first operator scanned),
- % do nothing, except add subtract to the stack.
- \ifx\pgfmath@stacknextoperator\pgfmath@empty%
+\def\pgfmath@parse@binary#1{%
+ \expandafter\ifx\csname pgfmath@token@binary@#1\endcsname\relax%
+ \expandafter\pgfmathbasetobase\expandafter\pgfmathresult\expandafter{\pgfmath@number}{2}{10}%
+ \expandafter\pgfmath@stack@push@operand\expandafter{\pgfmathresult}%
+ \def\pgfmath@token@next{#1}%
+ \let\pgfmath@parse@next=\pgfmath@parse@operator%
\else%
- % Empty the process stack up to any inequalities.
- \pgfmath@processoperationsuntil{\pgfmathequalto@\pgfmathlessthan@\pgfmathgreaterthan@}%
+ \expandafter\def\expandafter\pgfmath@number\expandafter{\pgfmath@number#1}%
+ \let\pgfmath@parse@next=\pgfmath@parse@binary%
\fi%
- \pgfmath@stackpushoperator{\pgfmathsubtract@}%
- \pgfmath@parse@}
-
-\def\pgfmath@parsemultiply{%
- % If no operator has been assigned (i.e. * is the first operator scanned),
- % do nothing, except push multiply onto the stack.
- \ifx\pgfmath@stacknextoperator\pgfmath@empty%
+ \pgfmath@parse@next%
+}
+
+\def\pgfmath@parse@hexadecimal#1{%
+ \expandafter\ifx\csname pgfmath@token@hexadecimal@#1\endcsname\relax%
+ \expandafter\pgfmathbasetobase\expandafter\pgfmathresult\expandafter{\pgfmath@number}{16}{10}%
+ \expandafter\pgfmath@stack@push@operand\expandafter{\pgfmathresult}%
+ \def\pgfmath@token@next{#1}%
+ \let\pgfmath@parse@next=\pgfmath@parse@operator%
\else%
- % Process all operations up to inequalites or addition/subtraction
- \pgfmath@processoperationsuntil{\pgfmathequalto@\pgfmathlessthan@\pgfmathgreaterthan@%
- \pgfmathadd@\pgfmathsubtract@}%
+ \expandafter\def\expandafter\pgfmath@number\expandafter{\pgfmath@number#1}%
+ \let\pgfmath@parse@next=\pgfmath@parse@hexadecimal%
\fi%
- \pgfmath@stackpushoperator{\pgfmathmultiply@}%
- \pgfmath@parse@}
+ \pgfmath@parse@next%
+}
-\def\pgfmath@parsedivide{%
- % If no operator has been assigned (i.e. / is the first operator scanned),
- % do nothing, except push divide onto the stack.
- \ifx\pgfmath@stacknextoperator\pgfmath@empty%
+% Parse a function.
+%
+\def\pgfmath@parse@function{\pgfmath@parse@ifbgroup{\pgfmath@parse@function}{\pgfmath@parse@@function}}
+\def\pgfmath@parse@function@{\futurelet\pgfmath@token@let\pgfmath@parse@@function}
+\def\pgfmath@parse@@function{%
+ \ifx\pgfmath@token@let\pgfmath@sptoken%
+ \let\pgfmath@token=\pgfmath@empty%
+ \let\pgfmath@parse@next=\pgfmath@parse@@@@function%
\else%
- % Process all operations up to inequalites or addition/subtraction
- \pgfmath@processoperationsuntil{\pgfmathequalto@\pgfmathlessthan@\pgfmathgreaterthan@%
- \pgfmathadd@\pgfmathsubtract@}%
+ \let\pgfmath@parse@next=\pgfmath@parse@@@function%
\fi%
- \pgfmath@stackpushoperator{\pgfmathdivide@}%
- \pgfmath@parse@}
-
-\def\pgfmath@parsegreaterthan{%
- % On scanning an equality/inequality operator everything up to
- % (but not including) the operator is evaluated...
- \pgfmath@processalloperations%
- % ...and the operation pushed onto the stack.
- \pgfmath@stackpushoperator{\pgfmathgreaterthan@}%
- \pgfmath@parse@}
-
-\def\pgfmath@parselessthan{%
- \pgfmath@processalloperations%
- \pgfmath@stackpushoperator{\pgfmathlessthan@}%
- \pgfmath@parse@}
-
-\def\pgfmath@parseequalto={%
- \pgfmath@processalloperations%
- \pgfmath@stackpushoperator{\pgfmathequalto@}%
- \pgfmath@parse@}
-
-\def\pgfmath@parsepower{%
- % Easy, just push power onto the stack.
- \pgfmath@stackpushoperator{\pgfmathpow@}%
- \pgfmath@parse@}
-
-\def\pgfmath@parseradians{%
- % r is a post-fix function...
- \ifx\pgfmath@primaryoperation\pgfmath@empty%
- \else%
- \pgfmath@processoperationsuntil{\pgfmathequalto@\pgfmathlessthan@\pgfmathgreaterthan@%
- \pgfmathadd@\pgfmathsubtract@}%
- \fi%
- \pgfmath@stackpop{\pgfmath@temp}%
- \pgfmathdeg@{\pgfmath@temp}%
- % ...so processing returns to \pgfmath@parseoperator
- \pgfmath@parseoperator}
-
-\newcount\c@pgfmath@parsecounta
-\newcount\c@pgfmath@parsecountb
-\newcount\c@pgfmath@parsecountc
-\newdimen\pgfmath@parsex
+ \pgfmath@parse@next}
+
+\def\pgfmath@parse@@@function#1{%
+ \expandafter\ifx\csname pgfmath@token@functional@\expandafter\string#1\endcsname\relax%
+ \expandafter\ifx\csname pgfmath@token@number@\expandafter\string#1\endcsname\relax%
+ \def\pgfmath@token{#1}% Not from A-Z, a-z, 0-9, or _.
+ \let\pgfmath@parse@next=\pgfmath@parse@@@@function%
+ \else% It is from 0-9.
+ \expandafter\def\expandafter\pgfmath@function\expandafter{\pgfmath@function#1}%
+ \let\pgfmath@parse@next=\pgfmath@parse@function@%
+ \fi%
+ \else% It is from from A-Z, a-z, or _.
+ \edef\pgfmath@function{\pgfmath@function#1}%
+ \let\pgfmath@parse@next=\pgfmath@parse@function@%
+ \fi%
+ \pgfmath@parse@next}
-% \pgfmath@quickparseoperand
-%
-% An operand can *only* be a dimension.
-%
-\def\pgfmath@quickparseoperand{%
- \afterassignment\pgfmath@quickparseoperand@%
- \pgfmath@parsex\pgfmath@token}
-\def\pgfmath@quickparseoperand@{%
- \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@parsex}}%
- \pgfmath@parseoperator%
-}
-
-% \pgfmath@parseoperand
-%
-% An operand can be an ASCII number (with or without dimensions, with
-% or without a decimal point), a TeX register (count, dimen or skip,
-% which may have expanded with \the), or a function e.g. sin(X).
-%
-% It is assumed that after \edef-ing, the only unexpanded tokens are registers.
-%
-\def\pgfmath@parseoperand{%
- \def\pgfmath@sign{}%
- \expandafter\pgfmath@parseoperandsign\pgfmath@token}
-\def\pgfmath@parseoperandsign#1{%
- \pgfmath@in@#1{-+}%
- \ifpgfmath@in@
- % Gobble multiple signs.
- \edef\pgfmath@sign{\pgfmath@sign#1}%
- \expandafter\pgfmath@parseoperandsign%
+\def\pgfmath@parse@@@@function{%
+ \expandafter\ifx\csname pgfmath@function@\pgfmath@function\endcsname\relax%
+ \pgfmath@error{Unknown function `\pgfmath@function'}{}%
+ \def\pgfmathresult{0}%
+ \let\pgfmath@parse@next=\pgfmath@parse@end%
\else%
- \expandafter\pgfmath@parsenumberorfunction\expandafter#1%
+ \expandafter\ifnum\csname pgfmath@operation@\pgfmath@function @arity\endcsname=0\relax%
+ % Functions with zero arity are called directly.
+ \csname pgfmath\pgfmath@function @\endcsname%
+ \expandafter\pgfmath@stack@push@operand\expandafter{\pgfmathresult}%
+ \let\pgfmath@parse@next=\pgfmath@parse@@operator%
+ \else% Otherwise, they are pushed onto the operator stack
+ \expandafter\pgfmath@stack@push@operation\expandafter{\pgfmath@function}%
+ \let\pgfmath@parse@next=\pgfmath@parse@@operand%
+ \fi%
+ \fi%
+ \expandafter\pgfmath@parse@next\pgfmath@token}
+
+% Parse an operator.
+%
+\def\pgfmath@parse@operator{\pgfmath@parse@ifbgroup{\pgfmath@parse@operator}{\pgfmath@parse@operator@}}%
+\def\pgfmath@parse@operator@#1{% Get one token.
+ \let\pgfmath@token=\pgfmath@token@next%
+ \def\pgfmath@token@next{#1}%
+ \pgfmath@parse@@@operator}
+
+\def\pgfmath@parse@@operator{\pgfmath@parse@ifbgroup{\pgfmath@parse@@operator}{\pgfmath@parse@@operator@}}%
+\def\pgfmath@parse@@operator@#1{% Get first token...
+ \def\pgfmath@token{#1}%
+ \pgfmath@parse@ifbgroup{\pgfmath@parse@@operator@@}{\pgfmath@parse@@operator@@}}%
+\def\pgfmath@parse@@operator@@#1{% ...and second token.
+ \def\pgfmath@token@next{#1}%
+ \pgfmath@parse@@@operator}
+
+\def\pgfmath@parse@@@operator{%
+ \expandafter\ifx\csname pgfmath@operator@\pgfmath@token\expandafter\string\pgfmath@token@next\endcsname\relax%
+ % Not a double character operator.
+ \expandafter\ifx\csname pgfmath@operator@\pgfmath@token\endcsname\relax%
+ % Not a single character operator.
+ \pgfmath@error{Unknown operator `\pgfmath@token' or `\pgfmath@token\pgfmath@token@next'}{}%
+ \def\pgfmathresult{0}%
+ \let\pgfmath@parse@next=\pgfmath@parse@end%
+ \else%
+ \expandafter\pgfmath@operation@process\expandafter{\pgfmath@token}%
+ \ifx\pgfmath@token\pgfmath@text@@%
+ \let\pgfmath@parse@next=\pgfmath@parse@end%
+ \else%
+ \expandafter\ifx\csname pgfmath@operation@\pgfmath@token @postfix\endcsname\pgfmath@token%
+ % Postfix operators are followed by an operator.
+ \ifx\pgfmath@token@next\pgfmath@char@leftbracket% Except [.
+ \let\pgfmath@parse@next=\pgfmath@parse@operand%
+ \else%
+ \let\pgfmath@parse@next=\pgfmath@parse@operator%
+ \fi%
+ \else%
+ % Any other operator is followed by an operand.
+ \let\pgfmath@parse@next=\pgfmath@parse@operand%
+ \fi%
+ \fi%
+ \fi%
+ \else%
+ % A double character operator...
+ \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter%
+ \pgfmath@token\expandafter\expandafter\expandafter%
+ {\expandafter\pgfmath@token\pgfmath@token@next}%
+ \expandafter\pgfmath@operation@process\expandafter{\pgfmath@token}%
+ % ...is always followed by an operand.
+ \let\pgfmath@parse@next=\pgfmath@parse@@operand%
\fi%
+ \pgfmath@parse@next%
}
-\newif\ifpgfmath@dimen@
-\def\pgfmath@ifregisterdimen@#1\pgfmath@{%
- \pgfmath@in@{p}{#1}%
- \ifpgfmath@in@%
- \pgfmath@dimen@true%
+% Process an operation.
+%
+\def\pgfmath@operation@process#1{%
+ \def\pgfmath@operator{#1}%
+ \ifx\pgfmath@stack@operation@top\pgfmath@stack@empty%
\else%
- \pgfmath@dimen@false%
- \fi}
-
-\def\pgfmath@parsenumberorfunction#1{%
- \let\pgfmath@parsenext\pgfmath@parsenumberorfunction@simple%
- \ifx#1\wd\let\pgfmath@parsenext\pgfmath@boxdimen\fi%
- \ifx#1\ht\let\pgfmath@parsenext\pgfmath@boxdimen\fi%
- \ifx#1\dp\let\pgfmath@parsenext\pgfmath@boxdimen\fi%
- \pgfmath@parsenext#1%
-}
-
-\def\pgfmath@boxdimen#1#2{%
- \pgfmath@parsex=\pgfmath@sign#1#2%
- \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@parsex}}%
- \global\pgfmathunitsdeclaredtrue% a dimension has units
- \pgfmath@parseoperator%
+ \pgfmath@operation@@process%
+ \fi%
+ \expandafter\ifx\csname pgfmath@token@specials@#1\endcsname\relax%
+ \pgfmath@stack@push@operation{#1}%
+ \fi%
}
-\def\pgfmath@parsenumberorfunction@simple#1{%
- \expandafter\ifcat#1\relax%
- % So, a TeX register.
- \afterassignment\pgfmath@ifregisterdimen@%
- \pgfmath@parsex\pgfmath@sign#1pt\relax\pgfmath@%
- \ifpgfmath@dimen@%
- % A dimension! So stop scanning operand here.
- \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@parsex}}%
- \global\pgfmathunitsdeclaredtrue% a dimension has units
- \def\pgfmath@temp{}%
- \let\pgfmath@parsenext\pgfmath@parseoperator%
+% Process the operation stack.
+%
+\def\pgfmath@operation@@process{%
+ \ifx\pgfmath@stack@operation@top\pgfmath@stack@empty%
+ \let\pgfmath@parse@next=\relax%
+ \else%
+ \ifnum\csname pgfmath@operation@\pgfmath@operator @precedence\endcsname>%
+ \csname pgfmath@operation@\pgfmath@stack@operation@top @precedence\endcsname\relax%
+ % If the precedence of the scanned operator is greater than the
+ % precedence of the operator at the top of the stack, do nothing.
+ \let\pgfmath@parse@next=\relax%
\else%
- % A count! Expand it, but carry on as usual as it might
- % be immediately followed by a dimension.
- \ifdim\pgfmath@parsex<0pt\relax%
- \edef\pgfmath@sign{\pgfmath@sign-}%
- \pgfmath@parsex-\pgfmath@parsex%
+ \let\pgfmath@stack@operation@last=\pgfmath@stack@operation@top%
+ \expandafter\ifx\csname pgfmath@operator@\pgfmath@stack@operation@top\endcsname\relax%
+ \pgfmath@function@@@process%
+ \else%
+ \pgfmath@operator@@@process%
+ \fi%
+ \expandafter\pgfmath@stack@push@operand\expandafter{\pgfmathresult}%
+ \expandafter\ifx\csname pgfmath@token@group@\pgfmath@stack@operation@last\pgfmath@operator\endcsname\relax%
+ \let\pgfmath@parse@next=\pgfmath@operation@@process%
+ \else%
+ \let\pgfmath@parse@next=\relax%
\fi%
- \edef\pgfmath@temp{\pgfmath@tonumber{\pgfmath@parsex}}%
- \let\pgfmath@parsenext\pgfmath@parsenumberorfunction@%
\fi%
- \else%
- % Could be a number or a function...?
- \edef\pgfmath@temp{#1}%
- \let\pgfmath@parsenext\pgfmath@parsenumberorfunction@%
\fi%
- \expandafter\pgfmath@parsenext\pgfmath@temp%
-}%
-
-\def\pgfmath@parsenumberorfunction@#1{%
- \ifx#1(% It might be a group e.g. -(1+2)...
- \let\pgfmath@parsenext\pgfmath@parseoperandgroup%
+ \pgfmath@parse@next%
+}
+
+% Process an operator.
+%
+\def\pgfmath@operator@@@process{% Process an operator.
+ \pgfmath@stack@pop@operation\pgfmath@@operator%
+ \pgfmath@stack@pop@operand\pgfmath@operand@a%
+ \ifcase\csname pgfmath@operation@\pgfmath@@operator @arity\endcsname\relax%
+ % Zero arity operators (!).
+ \or%
+ \pgfmath@operator@@@@process{\pgfmath@operand@a}%
+ \or%
+ \pgfmath@stack@pop@operand\pgfmath@operand@b%
+ \pgfmath@operator@@@@process{\pgfmath@operand@b}{\pgfmath@operand@a}%
+ \or%
+ \pgfmath@stack@pop@operand\pgfmath@operand@b%
+ \expandafter\pgfmath@operator@@@@process\expandafter%
+ {\expandafter\pgfmath@operand@b\expandafter}\pgfmath@operand@a%
\else%
- \pgfmath@in@{#1}{.0123456789}%
- \ifpgfmath@in@% ... or a number...
- \let\pgfmath@parsenext\pgfmath@parsenumber%
- \else% ... or a function.
- \let\pgfmath@parsenext\pgfmath@parsefunction%
- \fi%
+ % No operators with more than tenary arity.
\fi%
- \pgfmath@parsenext#1%
-}%
-
-\def\pgfmath@parseoperandgroup({%
- \let\pgfmath@postparsegroup\pgfmath@@parseoperandgroup%
- \pgfmath@startparsegroup%
-}
-
-\def\pgfmath@@parseoperandgroup{%
- \let\pgfmath@postparsegroup\pgfmath@parseoperator%
- \edef\pgfmathresult{\pgfmath@sign\pgfmathresult}%
- \pgfmath@parseoperator%
}
-\def\pgfmath@parsenumber{%
- % Consider the number 3.14159
- % 3 is parsed by assignment to a, then '.' is absorbed and 14159
- % parsed by assignement to b (actually b=114159, see below).
- \c@pgfmath@parsecountc0\relax%
- \afterassignment\pgfmath@parsedecimalpoint%
- \c@pgfmath@parsecounta0}
-
-\def\pgfmath@parsedecimalpoint#1{%
- \ifx#1.% Is there a decimal point? If not, see if there are any units.
- \let\pgfmath@parsenext\pgfmath@parsemantissa%
- \else%
- \c@pgfmath@parsecountb10\relax% The first digit of b is gobbled (see below).
- \let\pgfmath@parsenext\pgfmath@parseunits%
- \fi%
- \pgfmath@parsenext#1}
-
-
+\def\pgfmath@operator@@@@process{%
+ \csname pgfmath%
+ \csname pgfmath@operation@\pgfmath@@operator @name\endcsname%
+ @\endcsname}
-% We would like to assign the following number (which is the mantisse)
-% to a number. However, for a very long mantisse as in 3.141592653589793238462643
-% this will fail since the number becomes too large.
+% Process a function.
%
-% Because of this, we have to do some ``magic'': We scan 9 tokens and
-% then do an assignment with a guard after 9 tokens so that the
-% assigment cannot fail.
-%
-\def\pgfmath@parsemantissa.#1#2#3#4#5#6#7#8#9{%
- \afterassignment\pgfmath@checkforguard%
- % Consider the number: 2.005
- % 2 is assigned to a, but b will be assigned 5, which is *not right*.
- % So using 1 here hereresults in b=1005. The first digit is then
- % gobbled later, when expanded with \the.
- \c@pgfmath@parsecountb1#1#2#3#4#5#6#7#8#9\relax}%
-
-\def\pgfmath@checkforguard{%
- \pgfmath@ifnextchar\relax%
- {%
- % Ok, this is a looong mantisse. Start gobbling all following
- % numbers
- \pgfmath@gobblemantisse%
- }%
- {%
- \pgfmath@removeguard%
- }%
+\def\pgfmath@function@@@process{% Process a function.
+ \ifnum\csname pgfmath@operation@\pgfmath@stack@operation@top @arity\endcsname>0\relax%
+ \pgfmath@stack@pop@operation\pgfmath@@function%
+ \pgfmath@stack@pop@operand\pgfmath@@operand%
+ \ifnum\csname pgfmath@operation@\pgfmath@@function @arity\endcsname>1\relax%
+ \ifnum\csname pgfmath@operation@\pgfmath@@function @arity\endcsname>9\relax%
+ \csname pgfmath\pgfmath@@function @\endcsname{\pgfmath@@operand}%
+ \else%
+ \expandafter\pgfmath@function@@@@process\pgfmath@@operand%
+ \fi
+ \else%
+ \expandafter\pgfmath@function@@@@process\expandafter{\pgfmath@@operand}%
+ \fi%
+ \fi%
}
-\def\pgfmath@gobblemantisse\relax#1#2#3#4#5#6#7#8#9{%
- \afterassignment\pgfmath@checkforguard%
- \c@pgfmath@parsecountc0#1#2#3#4#5#6#7#8#9\relax% these digits are ignored
-}
+\def\pgfmath@function@@@@process{\csname pgfmath\pgfmath@@function @\endcsname}
-\def\pgfmath@removeguard#1\relax{\pgfmath@parseunits#1}
-
-
-\def\pgfmath@parseunits#1{%
- % Here the extra first digit in b is gobbled.
- \edef\pgfmath@resulttemp{%
- \pgfmath@sign\the\c@pgfmath@parsecounta.\expandafter\pgfmath@gobbleone\the\c@pgfmath@parsecountb}%
- % Check whether #1 is a \dp, \wd, or \ht
- \let\pgfmath@parsenext=\pgfmath@parseunits@simple%
- \ifx#1\wd\let\pgfmath@parsenext=\pgfmath@parseunits@boxdimen\fi%
- \ifx#1\ht\let\pgfmath@parsenext=\pgfmath@parseunits@boxdimen\fi%
- \ifx#1\dp\let\pgfmath@parsenext=\pgfmath@parseunits@boxdimen\fi%
- \pgfmath@parsenext#1%
-}
+% Stack.
+%
+\newtoks\pgfmath@stack@operand
+\newtoks\pgfmath@stack@operation
+\let\pgfmath@stack@empty=\pgfmath@empty
-\def\pgfmath@parseunits@boxdimen#1#2{%
- \pgfmath@parsex=\pgfmath@sign#1#2%
- \pgfmath@parsex\pgfmath@resulttemp\pgfmath@parsex%
- \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@parsex}}%
- \global\pgfmathunitsdeclaredtrue% a dimension has units
- \pgfmath@parseoperator%
-}
+\def\pgfmath@stack@push#1#2{%
+ \def\pgfmath@stack@top{#2}%
+ \expandafter\expandafter\expandafter#1%
+ \expandafter\expandafter\expandafter{\expandafter\expandafter\expandafter%
+ {\expandafter\pgfmath@stack@top\expandafter}\the#1}}%
-\def\pgfmath@parseunits@simple#1{%
- % Now check if #1 is actually a register.
- \ifcat#1\relax%
- \afterassignment\pgfmath@ifregisterdimen@%
- \pgfmath@parsex#1pt\relax\pgfmath@%
- \pgfmath@parsex\pgfmath@resulttemp\pgfmath@parsex%
- \ifpgfmath@dimen@% If it's a dimen stop scanning operand here.
- \global\pgfmathunitsdeclaredtrue% a dimension has units
- \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@parsex}}%
- \let\pgfmath@parsenext\pgfmath@parseoperator%
- \else
- \edef\pgfmath@resulttemp{\pgfmath@tonumber{\pgfmath@parsex}}%
- \let\pgfmath@parsenext\pgfmath@parseunits@%
- \fi%
- \expandafter\pgfmath@parsenext%
- \else%
- \expandafter\pgfmath@parseunits@\expandafter#1%
- \fi}
+\def\pgfmath@stack@pop#1#2{\expandafter\pgfmath@stack@@pop\the#1\pgfmath@stack@stop{#1}{#2}}
+\def\pgfmath@stack@@pop#1#2#3\pgfmath@stack@stop#4#5{\def#5{#1}#4={{#2}#3}\def\pgfmath@stack@top{#2}}
-\def\pgfmath@parseunits@#1#2{%
- % Check if #1 is an operator, or the character `@' indicating the end of the parse.
- \pgfmath@in@#1{@+-*/^r<>=()}%
- \ifpgfmath@in@%
- \edef\pgfmath@tokens{#1#2}%
- \edef\pgfmathresult{\pgfmath@resulttemp}%
- \let\pgfmath@parsenext\pgfmath@parseoperator%
- \else%
- \pgfmath@in@#1{Ee}% e+0X
- \ifpgfmath@in@%
- % Oh no! It might be and em or an ex...
- \pgfmath@in@#2{mx}%
- \ifpgfmath@in@%
- \global\pgfmathunitsdeclaredtrue%
- \pgfmath@parsex\pgfmath@resulttemp#1#2\relax%
- \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@parsex}}%
- \edef\pgfmath@tokens{}%
- \let\pgfmath@parsenext\pgfmath@parseoperator%
- \else%
- \edef\pgfmath@tokens{#2}%
- \let\pgfmath@parsenext\pgfmath@parsescientific%
- \fi%
- \else
- % Anything else *should* be a TeX unit.
- \global\pgfmathunitsdeclaredtrue%
- \pgfmath@parsex\pgfmath@resulttemp#1#2\relax%
- \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@parsex}}%
- \edef\pgfmath@tokens{}%
- \let\pgfmath@parsenext\pgfmath@parseoperator%
- \fi\fi%
- \expandafter\pgfmath@parsenext\pgfmath@tokens%
-}
+\def\pgfmath@stack@push@operation#1{%
+ \pgfmath@stack@push\pgfmath@stack@operation{#1}%
+ \let\pgfmath@stack@operation@top=\pgfmath@stack@top}
-% Parse 'Scientific' notation in the form xEyy
-%
-\def\pgfmath@parsescientific{%
- \afterassignment\pgfmath@parsescientific@%
- \c@pgfmath@parsecounta}
-
-\def\pgfmath@parsescientific@{%
- \edef\pgfmath@parsesci@temp{\pgfmath@resulttemp\the\c@pgfmath@parsecountc}%
- \expandafter\pgfmathscientific\expandafter{\pgfmath@parsesci@temp}%
- {\the\c@pgfmath@parsecounta}%
- \edef\pgfmath@resulttemp{\pgfmathresult}%
- \pgfmath@parseunits@}
-
-% Functions parsed (not calculated) here are:
-%
-% round(X) 'half-up' rounding.
-% floor(X) floor function.
-% ciel(X) ceiling function.
-% abs(X) absolute function.
-%
-% exp(X) e^X (0 <= X <~= 9.7).
-% ln(X) logarithm of X.
-% pow(X,Y) X^Y,
-%
-% sin(X) sine function.
-% cos(X) cosine function.
-% tan(X) tan function.
-% asin(X) arcsine of X (in radians) -1 <= X <= 1
-% acos(X) arccosine of X (in radians) -1 <= X <= 1
-% atan(X) arctangent of X (in radians) -1 <= X <= 1
-% veclen(X,Y) the length Z where Z^2 = X^2 + Y^2
-% mod(X,Y) X modulo Y
-% max(X,Y) the maximum of X or Y
-% min(X,Y) the minimum of X or Y
-%
-% NB veclen, mod, max, and min *cannot* be nested.
-%
-% deg(X) converts X to degrees (X in radians)
-% rad(X) converts X to radians (X in degrees)
-%
-% rnd generate pseudo-random number X (0 <= X <= 1).
-% rand generate pseudo-random number X (1 <= X <= -1).
-% sqrt(X) square root.
-%
-% pi the constant PI.
-
-\def\pgfmath@parsefunction{%
- \def\pgfmath@parsedfunctionname{}%
- \futurelet\pgfmath@parsetoken\pgfmath@parsefunction@@}
-\def\pgfmath@parsefunction@@#1{%
- \pgfmath@in@#1{()@+-*/^<>=}% A function name ends with one of these...
- \ifpgfmath@in@%
- \let\pgfmath@parsefunctionnext\pgfmath@parsefunction@end%
- \else%
- \ifx\pgfmath@parsetoken\pgfmath@sptoken% ...or a space.
- \let\pgfmath@parsefunctionnext\pgfmath@parsefunction@end%
- \else%
- \let\pgfmath@parsefunctionnext\pgfmath@parsefunction@continue%
- \fi\fi%
- \pgfmath@parsefunctionnext#1}
-
-\def\pgfmath@parsefunction@end#1{%
- \expandafter\ifx\csname pgfmath@parsefunction@\pgfmath@parsedfunctionname\endcsname\relax%
- \pgfmath@reportunknownfunction%
- \let\pgfmath@parsefunctionnext\relax%
- \else%
- \let\pgfmath@parsefunctionnext\pgfmath@executeparsefunction@%
- \fi%
- \pgfmath@parsefunctionnext#1}
-
-\def\pgfmath@parsefunction@continue#1{%
- \edef\pgfmath@parsedfunctionname{\pgfmath@parsedfunctionname#1}%
- \futurelet\pgfmath@parsetoken\pgfmath@parsefunction@@}
+\def\pgfmath@stack@pop@operation#1{%
+ \pgfmath@stack@pop\pgfmath@stack@operation{#1}%
+ \let\pgfmath@stack@operation@top=\pgfmath@stack@top}
-\def\pgfmath@executeparsefunction@{\csname pgfmath@parsefunction@\pgfmath@parsedfunctionname\endcsname}
-
-
-\def\pgfmath@reportunknownfunction{%
- \pgfmath@error{Unknown function `\pgfmath@parsedfunctionname'}{}%
-}
-
-% \pgfmath@postfunction
-%
-% In scanning a function e.g. sin(40), we subvert the normal parsing
-% group mechanism by messing around with \pgfmath@parsepostgroup, so
-% that after scanning ), the parser doesn't scan for an operator, but
-% returns to the macros scanning the function.
-% Here the mechanism is restored, and the value of the function is
-% stored along with the approprate sign, which was saved earlier.
-%
-\def\pgfmath@postfunction{%
- \let\pgfmath@parsepostgroup\pgfmath@parseoperator%
- \edef\pgfmathresult{\pgfmath@sign\pgfmathresult}%
- \pgfmath@parseoperator}
+% REMARK: This method will be overwritten by the FPU library. Please
+% keep any changes consistent.
+\def\pgfmath@stack@push@operand#1{%
+ \pgfmath@stack@push\pgfmath@stack@operand{#1}%
+ \let\pgfmath@stack@operand@top=\pgfmath@stack@top}
+
+\def\pgfmath@stack@pop@operand#1{%
+ \pgfmath@stack@pop\pgfmath@stack@operand{#1}%
+ \let\pgfmath@stack@operand@top=\pgfmath@stack@top}
-% \pgfmath@parsefunction@abs
+% Declare an operator for the parser.
%
-\def\pgfmath@parsefunction@abs{%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@abs@%
- \expandafter\pgfmath@parse@}
-\def\pgfmath@parsefunction@abs@{%
- \expandafter\pgfmathabs@\expandafter{\pgfmathresult}%
- \pgfmath@postfunction%
-}
-
-% \pgfmath@parsefunction@sqrt
+% It is not recommended that new operators be created as
+% the parser is not fully robust for arbitrary operators.
%
-\def\pgfmath@parsefunction@sqrt{%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@sqrt@%
- \expandafter\pgfmath@parse@}
-\def\pgfmath@parsefunction@sqrt@{%
- \expandafter\pgfmathsqrt@\expandafter{\pgfmathresult}%
- \pgfmath@postfunction%
+\def\pgfmathdeclareoperator#1#2#3#4#5{%
+ \pgfmath@namedef{pgfmath@operator@\string#1}{#1}%
+ \pgfmath@namedef{pgfmath@operation@\string#1@name}{#2}%
+ \pgfmath@namedef{pgfmath@operation@\string#1@arity}{#3}%
+ \pgfmath@namedef{pgfmath@operation@\string#1@#4}{#1}%
+ \pgfmath@namedef{pgfmath@operation@\string#1@precedence}{#5}%
}
-% \pgfmath@parsefunction@round
-%
-\def\pgfmath@parsefunction@round{%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@round@%
- \expandafter\pgfmath@parse@}
-\def\pgfmath@parsefunction@round@{%
- \expandafter\pgfmathround@\expandafter{\pgfmathresult}%
- \pgfmath@postfunction%
-}
+\pgfmathdeclareoperator{+}{add} {2}{infix}{500}
+\pgfmathdeclareoperator{-}{subtract}{2}{infix}{500}
+\pgfmathdeclareoperator{*}{multiply}{2}{infix}{700}
+\pgfmathdeclareoperator{/}{divide} {2}{infix}{700}
+\pgfmathdeclareoperator{^}{pow} {2}{infix}{900}
-% \pgfmath@parsefunction@floor
-%
-\def\pgfmath@parsefunction@floor{%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@floor@%
- \expandafter\pgfmath@parse@}
-\def\pgfmath@parsefunction@floor@{%
- \expandafter\pgfmathfloor@\expandafter{\pgfmathresult}%
- \pgfmath@postfunction%
-}
+\pgfmathdeclareoperator{<} {} {1}{prefix} {1}
-% \pgfmath@parsefunction@ceil
-%
-\def\pgfmath@parsefunction@ceil{%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@ceil@%
- \expandafter\pgfmath@parse@}
-\def\pgfmath@parsefunction@ceil@{%
- \expandafter\pgfmathceil@\expandafter{\pgfmathresult}%
- \pgfmath@postfunction%
-}
+\pgfmathdeclareoperator{>} {greater} {2}{infix} {250}
+\pgfmathdeclareoperator{<} {less} {2}{infix} {250}
+\pgfmathdeclareoperator{==}{equal} {2}{infix} {250}
+\pgfmathdeclareoperator{>=}{notless} {2}{infix} {250}
+\pgfmathdeclareoperator{<=}{notgreater}{2}{infix} {250}
+\pgfmathdeclareoperator{&&}{and} {2}{infix} {200}
+\pgfmathdeclareoperator{||}{or} {2}{infix} {200}
+\pgfmathdeclareoperator{!=}{notequalto}{2}{infix} {250}
+\pgfmathdeclareoperator{!} {not} {1}{prefix}{975}
+\pgfmathdeclareoperator{?} {ifthenelse}{3}{infix} {100}
+\pgfmathdeclareoperator{:} {@@collect} {2}{infix}{101}
-% \pgfmath@parsefunction@sin
-%
-\def\pgfmath@parsefunction@sin{%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@sin@%
- \expandafter\pgfmath@parse@}
-\def\pgfmath@parsefunction@sin@{%
- \expandafter\pgfmathsin@\expandafter{\pgfmathresult}%
- \pgfmath@postfunction%
-}
+\pgfmathdeclareoperator{!}{factorial}{1}{postfix}{800}% Must be defined after prefix ! operator.
+\pgfmathdeclareoperator{r}{deg} {1}{postfix}{600}
-% \pgfmath@parsefunction@cos
-%
-\def\pgfmath@parsefunction@cos{%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@cos@%
- \expandafter\pgfmath@parse@}
-\def\pgfmath@parsefunction@cos@{%
- \expandafter\pgfmathcos@\expandafter{\pgfmathresult}%
- \pgfmath@postfunction%
-}
+\pgfmathdeclareoperator{,}{@collect} {2}{infix} {10}
+\pgfmathdeclareoperator{[}{@startindex}{2}{prefix} {7}
+\pgfmathdeclareoperator{]}{@endindex} {0}{postfix}{6}
+\pgfmathdeclareoperator{(}{@startgroup}{1}{prefix} {5}
+\pgfmathdeclareoperator{)}{@endgroup} {0}{postfix}{4}
-% \pgfmath@parsefunction@asin
-%
-\def\pgfmath@parsefunction@asin{%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@asin@%
- \expandafter\pgfmath@parse@}
-\def\pgfmath@parsefunction@asin@{%
- \expandafter\pgfmathasin@\expandafter{\pgfmathresult}%
- \pgfmath@postfunction%
-}
+\pgfmathdeclareoperator{\pgfmath@bgroup}{@startarray}{1}{prefix} {3}
+\pgfmathdeclareoperator{\pgfmath@egroup}{@endarray} {1}{postfix}{2}%
-% \pgfmath@parsefunction@acos
-%
-\def\pgfmath@parsefunction@acos{%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@acos@%
- \expandafter\pgfmath@parse@}
-\def\pgfmath@parsefunction@acos@{%
- \expandafter\pgfmathacos@\expandafter{\pgfmathresult}%
- \pgfmath@postfunction}
-
-% \pgfmath@parsefunction@atan
-%
-\def\pgfmath@parsefunction@atan{%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@atan@%
- \expandafter\pgfmath@parse@}
-\def\pgfmath@parsefunction@atan@{%
- \expandafter\pgfmathatan@\expandafter{\pgfmathresult}%
- \pgfmath@postfunction%
-}
+% Special operators.
+\pgfmathdeclareoperator{"}{}{1}{prefix}{1}
+\pgfmathdeclareoperator{@}{}{0}{postfix}{0}
-% \pgfmath@parsefunction@tan
-%
-\def\pgfmath@parsefunction@tan{%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@tan@%
- \expandafter\pgfmath@parse@}
-\def\pgfmath@parsefunction@tan@{%
- \expandafter\pgfmathtan@\expandafter{\pgfmathresult}%
- \pgfmath@postfunction%
-}
+% Internal functions.
-% \pgfmath@parsefunction@cot
+% Begin and end parenthesis ().
%
-\def\pgfmath@parsefunction@cot{%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@cot@%
- \expandafter\pgfmath@parse@}
-\def\pgfmath@parsefunction@cot@{%
- \expandafter\pgfmathcot@\expandafter{\pgfmathresult}%
- \pgfmath@postfunction%
-}
+\def\pgfmath@startgroup@#1{\edef\pgfmathresult{#1}}
+\def\pgfmath@endgroup@{}% Never actually called.
-% \pgfmath@parsefunction@sec
+% Begin and end array access [].
%
-\def\pgfmath@parsefunction@sec{%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@sec@%
- \expandafter\pgfmath@parse@}
-\def\pgfmath@parsefunction@sec@{%
- \expandafter\pgfmathsec@\expandafter{\pgfmathresult}%
- \pgfmath@postfunction%
-}
+\def\pgfmath@startindex@#1#2{%
+ \expandafter\pgfmatharray@#1{#2}%
+ \expandafter\pgfmath@bgroup@strip\expandafter{\pgfmathresult}%
+ \ifx\pgfmath@token@let\bgroup%
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\expandafter{\pgfmathresult}}%
+ \fi}
+\def\pgfmath@endindex@{}% Never actually called.
-% \pgfmath@parsefunction@cosec
+% Begin and end array {}.
%
-\def\pgfmath@parsefunction@cosec{%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@cosec@%
- \expandafter\pgfmath@parse@}
-\def\pgfmath@parsefunction@cosec@{%
- \expandafter\pgfmathcosec@\expandafter{\pgfmathresult}%
- \pgfmath@postfunction%
-}
+\def\pgfmath@startarray@#1{\expandafter\def\expandafter\pgfmathresult\expandafter{\expandafter{#1}}}
+\def\pgfmath@endarray@#1{\expandafter\def\expandafter\pgfmathresult\expandafter{#1}}% Never actually called.
-% \pgfmath@parsefunction@rad
-%
-\def\pgfmath@parsefunction@rad{%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@rad@%
- \pgfmath@parse@}
-\def\pgfmath@parsefunction@rad@{%
- \expandafter\pgfmathrad@\expandafter{\pgfmathresult}%
- \pgfmath@postfunction}%
-
-% \pgfmath@parsefunction@rad
-%
-\def\pgfmath@parsefunction@deg{%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@deg@%
- \expandafter\pgfmath@parse@}
-\def\pgfmath@parsefunction@deg@{%
- \expandafter\pgfmathdeg@\expandafter{\pgfmathresult}%
- \pgfmath@postfunction}%
-
-% \pgfmath@parsefunction@rnd
-%
-\def\pgfmath@parsefunction@rnd{%
- \expandafter\pgfmathrnd%
- \expandafter\pgfmath@postfunction}
-
-% \pgfmath@parsefunction@rand
-%
-\def\pgfmath@parsefunction@rand{%
- \expandafter\pgfmathrand%
- \expandafter\pgfmath@postfunction}%
-
-% \pgfmath@parsefunction@exp
-%
-\def\pgfmath@parsefunction@exp{%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@exp@%
- \expandafter\pgfmath@parse@}
-\def\pgfmath@parsefunction@exp@{%
- \expandafter\pgfmathexp@\expandafter{\pgfmathresult}%
- \pgfmath@postfunction%
-}
-% \pgfmath@parsefunction@ln
-%
-\def\pgfmath@parsefunction@ln{%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@ln@%
- \expandafter\pgfmath@parse@}
-\def\pgfmath@parsefunction@ln@{%
- \expandafter\pgfmathln@\expandafter{\pgfmathresult}%
- \pgfmath@postfunction%
+\def\pgfmath@@collect@#1#2{%
+ \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter%
+ \pgfmathresult\expandafter\expandafter\expandafter{\expandafter\expandafter\expandafter%
+ {\expandafter#1\expandafter}\expandafter{#2}}%
}
-
-% \pgfmath@parsefunction@pi
+% Collect items separated by ,.
%
-\def\pgfmath@parsefunction@pi{%
- \pgfmathpi%
- \pgfmath@postfunction%
+\def\pgfmath@collect@#1#2{%
+ \expandafter\def\expandafter\pgfmath@collect@original\expandafter{#1}%
+ \expandafter\pgfmath@bgroup@strip\expandafter{#1}%
+ \ifx\pgfmath@token@let\bgroup%
+ \ifx\pgfmath@collect@original\pgfmath@bgroup@stripped%
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmath@bgroup@stripped}%
+ \else%
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\expandafter{\pgfmath@bgroup@stripped}}%
+ \fi%
+ \else%
+ \expandafter\def\expandafter\pgfmathresult\expandafter{\expandafter{\pgfmath@bgroup@stripped}}%
+ \fi%
+ \expandafter\pgfmath@bgroup@strip\expandafter{#2}%
+ \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter%
+ \pgfmathresult\expandafter\expandafter\expandafter%
+ {\expandafter\pgfmathresult\expandafter{\pgfmath@bgroup@stripped}}%
}
-% \pgfmath@parsefunction@veclen
+% Strip braces from a token sequence.
%
-\def\pgfmath@parsefunction@veclen{%
- \expandafter\pgfmath@parsefunction@veclen@}
-\def\pgfmath@parsefunction@veclen@(#1,{%
- \pgfmathparse@{#1}\edef\pgfmath@firstoperand{\pgfmathresult}%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@veclen@@
- \pgfmath@startparsegroup}
-\def\pgfmath@parsefunction@veclen@@{%
- \edef\pgfmath@secondoperand{\pgfmathresult}%
- \pgfmathveclen@{\pgfmath@firstoperand}{\pgfmath@secondoperand}%
- \pgfmath@postfunction}
-
-% \pgfmath@parsefunction@mod
-%
-\def\pgfmath@parsefunction@mod{%
- \expandafter\pgfmath@parsefunction@mod@}
-\def\pgfmath@parsefunction@mod@(#1,{%
- \pgfmathparse@{#1}\edef\pgfmath@firstoperand{\pgfmathresult}%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@mod@@
- \pgfmath@startparsegroup}
-\def\pgfmath@parsefunction@mod@@{%
- \edef\pgfmath@secondoperand{\pgfmathresult}%
- \pgfmathmod@{\pgfmath@firstoperand}{\pgfmath@secondoperand}%
- \pgfmath@postfunction}
-
-% \pgfmath@parsefunction@max
-%
-\def\pgfmath@parsefunction@max{%
- \expandafter\pgfmath@parsefunction@max@}
-\def\pgfmath@parsefunction@max@(#1,{%
- \pgfmathparse@{#1}\edef\pgfmath@firstoperand{\pgfmathresult}%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@max@@
- \pgfmath@startparsegroup}
-\def\pgfmath@parsefunction@max@@{%
- \edef\pgfmath@secondoperand{\pgfmathresult}%
- \pgfmathmax@{\pgfmath@firstoperand}{\pgfmath@secondoperand}%
- \pgfmath@postfunction}
-
-% \pgfmath@parsefunction@min
-%
-\def\pgfmath@parsefunction@min{%
- \expandafter\pgfmath@parsefunction@min@}
-\def\pgfmath@parsefunction@min@(#1,{%
- \pgfmathparse@{#1}\edef\pgfmath@firstoperand{\pgfmathresult}%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@min@@
- \pgfmath@startparsegroup}
-\def\pgfmath@parsefunction@min@@{%
- \edef\pgfmath@secondoperand{\pgfmathresult}%
- \pgfmathmin@{\pgfmath@firstoperand}{\pgfmath@secondoperand}%
- \pgfmath@postfunction}
-
-% \pgfmath@parsefunction@pow
-%
-\def\pgfmath@parsefunction@pow{%
- \expandafter\pgfmath@parsefunction@pow@}
-\def\pgfmath@parsefunction@pow@(#1,{%
- \pgfmathparse@{#1}\edef\pgfmath@firstoperand{\pgfmathresult}%
- \let\pgfmath@parsepostgroup\pgfmath@parsefunction@pow@@
- \pgfmath@startparsegroup}
-\def\pgfmath@parsefunction@pow@@{%
- \edef\pgfmath@secondoperand{\pgfmathresult}%
- \pgfmathpow@{\pgfmath@firstoperand}{\pgfmath@secondoperand}%
- \pgfmath@postfunction} \ No newline at end of file
+\def\pgfmath@bgroup@strip#1{%
+ \def\pgfmath@bgroup@strip@last{#1}%
+ \pgfmath@bgroup@@strip{#1}\pgfmath@\pgfmath@@\pgfmath@@@}
+
+\def\pgfmath@bgroup@strip@#1{%
+ \def\pgfmath@bgroup@strip@last{#1}%
+ \pgfmath@bgroup@@strip#1\pgfmath@\pgfmath@@\pgfmath@@@}
+
+\def\pgfmath@bgroup@pgfmath@{\pgfmath@}
+
+\def\pgfmath@bgroup@@strip{\futurelet\pgfmath@token@let\pgfmath@bgroup@@@strip}
+\def\pgfmath@bgroup@@@strip#1#2#3\pgfmath@@@{%
+ \ifx\pgfmath@token@let\bgroup%
+ \def\pgfmath@bgroup@test{#2}%
+ \ifx\pgfmath@bgroup@test\pgfmath@bgroup@pgfmath@%
+ \def\pgfmath@next{\pgfmath@bgroup@strip@{#1}}%
+ \else%
+ \let\pgfmath@bgroup@stripped=\pgfmath@bgroup@strip@last%
+ \let\pgfmath@next=\relax%
+ \fi%
+ \else%
+ \pgfmath@bgroup@@@@strip#1#2#3%
+ \let\pgfmath@next=\relax%
+ \fi%
+ \pgfmath@next%
+}
+
+\def\pgfmath@bgroup@@@@strip#1\pgfmath@\pgfmath@@{\def\pgfmath@bgroup@stripped{#1}}%
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex
index db2c38fa350..5e353007618 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex
@@ -20,14 +20,15 @@
% #1 - count or dimen.
% #2 - a control sequence.
%
-\newbox\pgfmath@box%
\def\pgfmath@ensureregister#1#2{%
- \setbox\pgfmath@box\hbox\bgroup% In case #2 is a defined macro. Unlikely, but you never know...
+ \begingroup%
+ \setbox0=\hbox\bgroup\begingroup% In case #2 is a defined macro. Unlikely, but you never know...
\afterassignment\pgfmath@@ensureregister%
\noexpand#20.0pt\let\pgfmath@temp\relax\relax\pgfmath@#2#1\pgfmath@}
\def\pgfmath@@ensureregister#1#2\pgfmath@#3#4#5\pgfmath@{%
- \egroup%
+ \endgroup\egroup%
+ \endgroup%
\ifx#4c%
\ifx#1.% Already a count register.
\else%
@@ -181,8 +182,18 @@
\let\pgfmath@PackageError\PackageError%
\fi%
-\def\pgfmath@error#1#2{\pgfmath@PackageError{PGF Math}{#1}{#2}}
-\def\pgfmath@warning#1{\pgfmath@PackageWarning{PGF Math}{#1}}
+\def\pgfmath@error#1#2{%
+ \pgfmath@PackageError{PGF Math}{%
+ #1%
+ \pgfutil@ifundefined{pgfmath@expression}{}{ (in '\pgfmath@expression')}%
+ }{#2}%
+}
+\def\pgfmath@warning#1{%
+ \pgfmath@PackageWarning{PGF Math}{%
+ #1%
+ \pgfutil@ifundefined{pgfmath@expression}{}{ (in '\pgfmath@expression')}%
+ }%
+}
% \pgfmath@pt
%
@@ -208,6 +219,9 @@
\def\pgfmath@gobbleone#1{}%
+\def\pgfmath@namedef#1{\expandafter\def\csname#1\endcsname}
+\def\pgfmath@nameedef#1{\expandafter\edef\csname#1\endcsname}
+
% \pgfmathloop
%
% A version of the standard TeX and LaTeX
@@ -233,9 +247,6 @@
% \pgfmath@returnone
%
-% \edef \pfgmathresult to the value of #1 after the end
-% of a group, which *must directly follow*.
-%
% #1 - a dimension representing a number or dimension.
%
% Changed by TT: made faster and simpler since it is used
@@ -248,11 +259,7 @@
\expandafter\endgroup\expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmath@temp}%
}
-
-% \pgfmath@returntwo
-%
-% Removed by TT: not used.
-
+\let\pgfmathreturn=\pgfmath@returnone
% \pgfmath@smuggleone
%
@@ -263,3 +270,5 @@
%
\def\pgfmath@smuggleone#1\endgroup{%
\expandafter\endgroup\expandafter\def\expandafter#1\expandafter{#1}}
+
+\let\pgfmathsmuggle=\pgfmath@smuggleone
diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledatavisualization.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledatavisualization.code.tex
new file mode 100644
index 00000000000..1c78bb221e6
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledatavisualization.code.tex
@@ -0,0 +1,3035 @@
+% Copyright 2006 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 $Header: /cvsroot/pgf/pgf/generic/pgf/modules/pgfmoduledatavisualization.code.tex,v 1.37 2010/08/24 21:28:58 tantau Exp $
+
+\usepgfmodule{oo,shapes}
+\usepgflibrary{fpu}
+
+
+% This module defines the basic framework for data visualization.
+
+% In order to visualize data, you first need data. The format for this
+% data is not specified, indeed, different formats are possible. A
+% data point is created each time the command \pgfdatapoint is
+% used. The "parameters" of the data point are just the current values
+% of the keys or macros in the current scope.
+%
+% A set of data points created using the \pgfdata command.
+% When a data point is created, a number of signals are emitted, see
+% the description of \pgfdatapoint. To actually visualize something,
+% objects should be created that listen to these signals and that
+% handle them.
+%
+% The following class manages a data visualization
+
+\pgfooclass{data visualization}
+{
+ % Class data visualization
+ %
+ % This class is used to "manage" a data visualization. It provides
+ % methods for hooking into the data visualization process and its
+ % constructor initializes the signals that are issued during a data
+ % visualization.
+ %
+ % When a data visualization object is created, a whole bunch of
+ % signal objects. You should then create objects that connect to
+ % these signals. They will be emitted when datapoints come
+ % available.
+ %
+ % It is permissible to have several data visualization objects
+ % active at the same time.
+ %
+ % To use a data visualization object, you should (possibly
+ % repeatedly) call the method add data() or the macro \pgfdata. You should also
+ % create transformation, mapping and visualization objects. Then,
+ % you should, first, call the method survey, which will "survey" the
+ % data, allowing the mapping and bounding objects to compute the
+ % correct ranges. You may then create further objects based on this
+ % data. Then, you should call the "visualize" method, which will
+ % invoke the visualization signals for the data points.
+
+
+ % These attribute store code that should be executed at certain
+ % points. The order is the following:
+ %
+ % 1. "before survey" code
+ % 2. "begin survey" phase signal
+ % 3. "at start survey" code
+ % 4. data points are processed
+ % 5. "at end survey" code
+ % 6. "end survey" phase signal
+ % 7. "after survey" code
+ %
+ % The first seven points will be repeated until the method "do
+ % another survey" is no longer called during a survey.
+ %
+ % 8. "before visualization" code
+ % 9. "begin visualization" phase signal
+ % 10. "at start visualization" code
+ % 11. data points are processed once more
+ % 12. "at end visualization" code
+ % 13. "end visualization" phase signal
+ % 14. "after visualization" code
+ \attribute before survey;
+ \attribute at start survey;
+ \attribute at end survey;
+ \attribute after survey;
+ \attribute before visualization;
+ \attribute at start visualization;
+ \attribute at end visualization;
+ \attribute after visualization;
+
+ %
+ % Survey counts and handling
+ %
+
+ \attribute survey count=1;
+ % Each time a survey is done before the visualization is done, this
+ % count is incremented. Normally, there is only one survey, but
+ % objects may request another survey or even more surveys to be
+ % done, giving them a chance to setup further internal values. By
+ % accessing this count (via the get survey count method), you can
+ % find out which survey is currently being done.
+
+ \attribute number of surveys=1;
+ % By increasing this count, you can request additional surveys to be
+ % done.
+
+
+ % Stores the to-be-visualized data
+ \attribute data;
+
+
+ % Stores the signal objects
+ \attribute prepare datapoint signal;
+ \attribute map datapoint signal;
+ \attribute transform datapoint signal;
+ \attribute visualize datapoint signal;
+ \attribute finish datapoint signal;
+ \attribute survey datapoint signal;
+ \attribute phase signal;
+ \attribute path signal;
+ \attribute direction signal;
+ \attribute style signal;
+
+
+ % Constructor
+ %
+ % Inits the signals
+ \method data visualization() {
+ \pgfoonew{prepare datapoint signal}=new signal()%
+ \pgfoonew{map datapoint signal}=new signal()%
+ \pgfoonew{transform datapoint signal}=new signal()%
+ \pgfoonew{visualize datapoint signal}=new signal()%
+ \pgfoonew{finish datapoint signal}=new signal()%
+ \pgfoonew{survey datapoint signal}=new signal()%
+ \pgfoonew{phase signal}=new signal()%
+ \pgfoonew{path signal}=new signal()%
+ \pgfoonew{direction signal}=new signal()%
+ \pgfoonew{style signal}=new signal()%
+ %
+ % Store this object in a key
+ %
+ \pgfoothis.get handle(\pgf@dv@me)
+ \pgfkeyslet{/pgf/data visualization/obj}\pgf@dv@me
+ }
+
+ % The phase signal will emit the following constants:
+ \def\pgfdvbeforesurvey{1}
+ \def\pgfdvbeginsurvey{2}
+ \def\pgfdvendsurvey{3}
+ \def\pgfdvaftersurvey{4}
+ \def\pgfdvbeforevisualization{5}
+ \def\pgfdvbeginvisualization{6}
+ \def\pgfdvendvisualization{7}
+ \def\pgfdvaftervisualization{8}
+
+ % The path signale will meit the following constants:
+ \def\pgfdvpathmovetotoken{5}
+ \def\pgfdvpathlinetotoken{6}
+ \def\pgfdvdirectionfromtoken{7}
+ \def\pgfdvdirectiontotoken{8}
+
+ % Method
+ %
+ % Connect the object #1's slot "#2" to the signal named "#3"
+ \method connect(#1,#2,#3) {
+ \pgfoovalueof{#3}.connect(#1,#2)
+ }
+
+ % Method
+ %
+ % Add data that is to be visualized. The code #1 should call the
+ % \pgfdatapoint macro for each data point it creates.
+ \method add data(#1) {
+ \pgfooappend{data}{#1}
+ }
+
+
+ % Setters
+ \method before survey(#1) {
+ \pgfooappend{before survey}{#1}
+ }
+ \method at start survey(#1) {
+ \pgfooappend{at start survey}{#1}
+ }
+ \method before visualization(#1) {
+ \pgfooappend{before visualization}{#1}
+ }
+ \method at start visualization(#1) {
+ \pgfooappend{at start visualization}{#1}
+ }
+
+ % Method
+ \method at end survey(#1) {
+ \pgfooprefix{at end survey}{#1}
+ }
+ \method after survey(#1) {
+ \pgfooprefix{after survey}{#1}
+ }
+ \method at end visualization(#1) {
+ \pgfooprefix{at end visualization}{#1}
+ }
+ \method after visualization(#1) {
+ \pgfooprefix{after visualization}{#1}
+ }
+
+
+ % Method
+ %
+ % Copy the signals to macros. This is just for efficiency (ha!)
+ \method prepare signal macros() {
+ \pgfooget{prepare datapoint signal}\pgf@signalpreparedatapoint
+ \pgfooget{map datapoint signal}\pgf@signalmapdatapoint
+ \pgfooget{transform datapoint signal}\pgf@signaltransformdatapoint
+ \pgfooget{visualize datapoint signal}\pgf@signalvisualizedatapoint
+ \pgfooget{finish datapoint signal}\pgf@signalfinishdatapoint
+ \pgfooget{survey datapoint signal}\pgf@signalsurveydatapoint
+ \pgfooget{phase signal}\pgf@signalphase
+ \pgfooget{path signal}\pgf@signalpath
+ \pgfooget{direction signal}\pgf@signaldirection
+ \pgfooget{style signal}\pgf@signalstyle
+ }
+
+
+ % Survey method
+ %
+ % Call this method to "survey" the data. This should be done before
+ % the "visualize" method is called.
+ \method survey() {
+ % Survey phase.
+ \let\pgfdatapoint=\pgfdatapoint@surveyphase%
+ \pgfoothis.prepare signal macros()
+ \pgfooset{survey count}{1}
+ \pgfutil@loop
+ \pgf@signalphase.emit(\pgfdvbeforesurvey)
+ \pgfoovalueof{before survey}%
+ \pgf@signalphase.emit(\pgfdvbeginsurvey)
+ \pgfoovalueof{at start survey}
+ \pgfoovalueof{data}%
+ \pgfoovalueof{at end survey}
+ \pgf@signalphase.emit(\pgfdvendsurvey)%
+ \pgfoovalueof{after survey}
+ \pgf@signalphase.emit(\pgfdvaftersurvey)
+ \c@pgf@counta=\pgfoovalueof{survey count}\relax
+ \c@pgf@countb=\pgfoovalueof{number of surveys}\relax
+ \ifnum\c@pgf@counta<\c@pgf@countb
+ \advance\c@pgf@counta by1\relax
+ \pgfooeset{survey count}{\the\c@pgf@counta}
+ \pgfutil@repeat
+ }
+
+ % Getter
+ \method get survey count(#1) {
+ \pgfooget{survey count}{#1}
+ }
+
+ % Request another survey to be done
+ \method do an additional survey() {
+ \c@pgf@counta=\pgfoovalueof{number of surveys}\relax
+ \advance\c@pgf@counta by1\relax
+ \pgfooeset{number of surveys}{\the\c@pgf@counta}
+ }
+
+ % Visualize method
+ %
+ % This method will cause the actual visualization.
+ \method visualize() {
+ % Visualization phase.
+ \let\pgfdatapoint=\pgfdatapoint@visualizationphase%
+ \pgfoothis.prepare signal macros()
+ \pgf@signalphase.emit(\pgfdvbeforevisualization)%
+ \pgfoovalueof{before visualization}
+ \pgf@signalphase.emit(\pgfdvbeginvisualization)%
+ \pgfoovalueof{at start visualization}
+ \pgfoovalueof{data}%
+ \pgfoovalueof{at end visualization}
+ \pgf@signalphase.emit(\pgfdvendvisualization)%
+ \pgfoovalueof{after visualization}
+ \pgf@signalphase.emit(\pgfdvaftervisualization)%
+ }
+}
+
+
+%
+% The data point keys
+%
+% Unlike other keys, the subkeys of /data point/ can simply be set
+% directly. If the key has not been initialized, it will automatically
+% be.
+\pgfkeys{/data point/.unknown/.code={%
+ \pgfkeyssetvalue{/data point/\pgfkeyscurrentname}{#1}
+ }}
+
+
+
+
+% Create and handle a data point
+%
+% Description:
+%
+% This command is called by the survey and the visualize methods
+% whenever a complete data point has been produced. Depending on the
+% current circumstances, different signals will be emitted.
+%
+% The data that is represented by the data point is not given as a
+% parameter. Rather, it is stored in macros and keys, that is, the
+% data point is conceptually given by the settings of all the keys and
+% macros in the local scope.
+%
+% There are two phases to data processing: In the survey phase data
+% points are produced and handled in order to find out things like
+% their number or the minimum and maximum values of attributes, so
+% that axes and picture sizes can be prepared correctly. In the
+% visualization phase, data point are actually shown.
+%
+% During the survey phase, for each data point the signal
+% "surveydatapoint" is emitted.
+%
+% During the visualization phase, more signals are emitted. A prepare
+% signal is emitted first, giving all objects a
+% chance to "prepare" for the data point. Note that it is permissible
+% for an object to manipulate the data point here (and also
+% in later on).
+%
+% Next, the command \pgfdvmapdatapointtocanvas is called. Mainly,
+% the effect of this command is to setup the keys /data point/canvas x
+% and /data point/canvas y, see the description of this command for
+% more details.
+%
+% The next step consists of signaling "visualize data point". Objects
+% listening to this will cause some form of visualization of the
+% data point to occur.
+%
+% Before the visualization is started, it is checked whether the key
+% /data point/name is set (to a non-empty value). If so,
+% a coordinate is created with the given canvas x and y values and
+% this key's value as name.
+%
+% Finally, finish data point allows objects to do any final processing
+% of the data point.
+
+\def\pgfdatapoint@surveyphase{%
+ \pgf@signalpreparedatapoint.emit()%
+ \pgf@signalmapdatapoint.emit()%
+ \pgf@signalsurveydatapoint.emit()%
+}
+
+\def\pgfdatapoint@visualizationphase{%
+ \pgf@signalpreparedatapoint.emit()%
+ \pgfdvmapdatapointtocanvas%
+ \pgfkeysifdefined{/data point/name}
+ {%
+ \pgfcoordinate{\pgfkeysvalueof{/data point/name}}{\pgfpointdvdatapoint}%
+ }{}%
+ \pgf@signalvisualizedatapoint.emit()%
+ \pgf@signalfinishdatapoint.emit()%
+}
+
+
+
+% Compute a position of a data point
+%
+% Description:
+%
+% This command uses a special signal to compute the position where a
+% data point should be visualized on the canvas. In detail, the
+% following happens:
+%
+% A local scope is created and the
+% transformation matrix is reset. Then, two signals are emitted: First,
+% "map data points" and then "transform data point". The first
+% lets listening objects "map" the object by setting up
+% attributes of the data point. The second asks objects
+% listening to this signal to transform the current transformation
+% matrix. After the signals, we compute where
+% the origin lies inside this transformed coordinate system. Then the
+% two keys /data point/canvas x and /data point/canvas y are set to
+% the values of this position. The local scope ends (but the settings
+% of the keys persist by a bit of magic), thus restoring the
+% transformation matrix to its original value.
+
+\def\pgfdvmapdatapointtocanvas{%
+ {%
+ \pgfpointdvlocaldatapoint
+ % Smuggle outside group
+ \expandafter%
+ }%
+ \edef\pgf@marshal{%
+ \noexpand\pgfkeyssetvalue{/data point/canvas x}{\the\pgf@x}
+ \noexpand\pgfkeyssetvalue{/data point/canvas y}{\the\pgf@y}
+ }%
+ \pgf@marshal%
+}
+
+% Help functions for locating a canvas data point
+%
+% Description:
+%
+% The first function returns the data point computed by a
+% canvasposition... call.
+
+\def\pgfpointdvdatapoint{%
+ \pgfqpoint{\pgfkeysvalueof{/data point/canvas x}}{\pgfkeysvalueof{/data point/canvas y}}%
+}
+
+\def\pgfpointdvlocaldatapoint{%
+ {%
+ % only returns the data point in \pgf@x and \pgf@y, does not set
+ % canvas x and canvas y
+ \pgf@signalmapdatapoint.emit()%
+ \pgftransformreset%
+ \pgf@signaltransformdatapoint.emit()%
+ \pgfpointtransformed{\pgfpointorigin}%
+ }%
+}
+
+
+
+%
+% Special path constructions commands
+%
+%
+% The following commands are used to construct paths based on
+% datapoints.
+%
+% Normally, all these methods need to do is to compute the current
+% canvas position of the current data point and then do a moveto,
+% lineto or some other operation to this position.
+%
+% However, when the coordinate system is weird, like with polar
+% coordinates or spherical or log-polar coordinate or whatever, a
+% straight line "along an attribute" is no longer a straight line.
+% In this case, two actions can be taken:
+%
+% 1. The problem can be ignored, resulting in a wrong line.
+% 2. Some clever algorithm kicks in an replaces the straight line by
+% the correct replacement.
+%
+% As always, when a computer tries to be clever, things can go
+% wrong... Nevertheless, some support for the second method is
+% given. This works as follows: Objects can register to the data
+% visualization path signal. This signal is emitted every time the
+% lineto or moveto commands are executed. If an object reacts to such
+% a command and handles it, it should set
+% \pgfdvhandledtrue.
+
+\newif\ifpgfdvhandled
+
+\def\pgfdv@generic#1#2#3{%
+ {%
+ \pgfdvhandledfalse%
+ \pgf@signalmapdatapoint.emit()%
+ #1.emit(#2)%
+ \ifpgfdvhandled%
+ \else%
+ \pgf@process{%
+ \pgftransformreset%
+ \pgf@signaltransformdatapoint.emit()%
+ \pgfpointtransformed{\pgfpointorigin}%
+ }%
+ #3{}%
+ \fi%
+ }%
+}
+
+
+% Handle a moveto
+%
+% This command has no parameters since the target of the moveto is
+% given by the canvas position of the current local data point.
+\def\pgfpathdvmoveto{%
+ \pgfdv@generic{\pgf@signalpath}{\pgfdvpathmovetotoken}{\pgfpathmoveto}
+}
+
+
+% Handle a lineto
+%
+% This command has no parameters since the target of the moveto is
+% given by the canvas position of the current local data point.
+\def\pgfpathdvlineto{%
+ \pgfdv@generic{\pgf@signalpath}{\pgfdvpathlinetotoken}{\pgfpathlineto}
+}
+
+
+
+% Compute a normalized vector pointing from some point to another.
+%
+% #1 = code for setting the attributes of the first point
+% #2 = code for setting the attributes of the second point
+%
+% Using #1 and #2 you specify two data points. These are then
+% localized on the canvas and a vector pointing from the first data
+% point to the second one is returned. However, for instance in polar
+% coordinates the vector may actually "point along" the angle axis.
+%
+% Internally, this command first sets up the first data point and then
+% emits a "path" signal with the \pgfdvpathdirectionfromtoken set and
+% then sets up the second point and emits the corresponding
+% ...totoken.
+%
+
+\def\pgfpointdvdirection#1#2{%
+ {
+ {
+ #1
+ \pgfdv@generic{\pgf@signaldirection}{\pgfdvdirectionfromtoken}{\xdef\pgf@dv@from{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}
+ }
+ {
+ #2
+ \pgfdv@generic{\pgf@signaldirection}{\pgfdvdirectiontotoken}{
+ \edef\pgf@dv@dir@xa{\the\pgf@x}
+ \edef\pgf@dv@dir@ya{\the\pgf@y}
+ \pgf@process{
+ \pgfpointnormalised{%
+ \pgfpointdiff{\pgf@dv@from}{\pgfqpoint{\pgf@dv@dir@xa}{\pgf@dv@dir@ya}}
+ }
+ }
+ }
+ }
+ }
+}
+
+
+
+
+
+%
+%
+% Data parsing and formatting
+%
+%
+
+
+
+% Run the rendering pipeline on a dataset.
+%
+% #1 = options with path /pgf/data/
+% #2 = optionally data given inline in curly braces.
+%
+% Description:
+%
+% This command is used to define a data set. For a single data
+% visualization, multiple data sets can be defined, they will
+% accumulate. Data can be in different formats, as specified by the
+% "format" key, and you can define new formats.
+%
+% The setting of the following keys is important:
+%
+% /pgf/data visualization/obj contains a handle to the dv-object
+% /pgf/data/format stores the format (see below)
+% /pgf/data/source determines where the data is.
+%
+% If source is empty, the data is stored in the argument that
+% follows. Otherwise, the file whose name is stored in source is read.
+% This data is stored in an internal variable, which is local to the
+% current group.
+%
+% After the group, the key "/pgf/data/continue code" will be
+% executed.
+%
+% When the data is actually used later on (during a survey or a
+% visualization), independently of what source is used, a format
+% handler is started for each data set. This works as follows: first,
+% the handler's startup code is executed. Then for each line of the
+% data file/the data given inline, the line handler function is
+% called. Finally, the data format end handler is called.
+%
+% The format handler's job is to call \pgfdatapoint each time a
+% complete data point has been produced.
+%
+% Example:
+%
+% \pgfoonew \dv=new data visualization()
+% \pgfoonew \obj=new attribute mapper(...)
+% ...
+%
+% \pgfkeys{/pgf/data/.cd,
+% column 1=dax/low,
+% column 2=dax/high,
+% column 3=dax/entry,
+% column 4=dax/exit}
+%
+% \pgfdata[format=space separated columns]
+% {
+% % today
+% 2000 2300 2100 2200
+% 2000 2350 2200 2500
+% 2200 2300 2250 2260
+% 1800 2260 2260 1900
+% 2000 2300 2100 2200
+% }
+%
+% \pgfdata[format=comma separated columns]
+% {
+% % yesterday
+% 2000, 2350, 2200, 2250
+% 2200, 2300, 2250, 2260
+% }
+%
+% \pgfdata[source=data,format=comma separated columns]
+%
+% \dv.survey()
+% \dv.visualize()
+
+\def\pgfdata{\pgfutil@ifnextchar[{\pgf@dataset@data@opt}{\pgf@dataset@data@opt[]}}%}
+\def\pgf@dataset@data@opt[#1]{%
+ % Ok, add one data thing...
+ \pgfkeysvalueof{/pgf/data visualization/obj}.add data(\pgf@do@data{#1})%
+ \begingroup%
+ \pgfkeys{/pgf/data/.cd,/pgf/every data/.try,#1}%
+ \pgfkeysgetvalue{/pgf/data/continue code}\pgf@dv@cont@code%
+ \global\let\pgf@dv@cont@code\pgf@dv@cont@code%
+ \pgfkeysgetvalue{/pgf/data/format}\pgf@dv@format%
+ \expandafter\let\expandafter\pgf@dv@format@catcodes\csname pgfdv@format@\pgf@dv@format @catcodes\endcsname%
+ \ifx\pgf@dv@format@catcodes\relax
+ \PackageError{pgf}{Unknown data format '\pgf@dv@format'}{}%
+ \else%
+ \pgfkeysgetvalue{/pgf/data/source}\pgf@dv@source%
+ \ifx\pgf@dv@source\pgfutil@empty%
+ \let\pgf@next\pgf@dataset@grab@inline%
+ \else%
+ \let\pgf@next\pgf@dataset@grab@external%
+ \fi%
+ \pgf@next%
+}
+\def\pgf@dataset@grab@inline{%
+ \pgfutil@ifnextchar\bgroup{%
+ \begingroup%
+ \catcode`\^^M=\active%
+ \pgf@dv@format@catcodes%
+ \pgf@dataset@grab@@inline}%
+ {\PackageError{pgf}{Opening brace expected}{}}%
+}
+\def\pgf@dataset@grab@external{%
+ \fi%
+ \endgroup%
+ \pgfkeysvalueof{/pgf/data visualization/obj}.add data({{{\pgf@dataset@do@external}}})%
+ \pgf@dv@cont@code%
+}
+
+{\catcode`\^^M=\active%
+ \gdef\pgf@dataset@grab@@inline#1{%
+ \endgroup%
+ \pgfkeysvalueof{/pgf/data visualization/obj}.add data({{{\pgf@dataset@do@inline#1^^M\pgf@@eol}}})%
+ \fi%
+ \endgroup%
+ \pgf@dv@cont@code%
+ }%
+}%
+\def\pgf@@eol{\pgf@eol}
+
+\def\pgf@do@data#1#2{%
+ \begingroup%
+ \pgfkeys{/pgf/data/.cd,/pgf/every data/.try,#1}%
+ \pgfkeysgetvalue{/pgf/data/format}\pgf@dv@format%
+ \expandafter\let\expandafter\pgf@dv@format@line\csname pgfdv@format@\pgf@dv@format @line\endcsname%
+ \expandafter\let\expandafter\pgf@dv@format@emptyline\csname pgfdv@format@\pgf@dv@format @empty\endcsname%
+ \csname pgfdv@format@\pgfkeysvalueof{/pgf/data/format}@startup\endcsname%
+ #2%
+ \csname pgfdv@format@\pgfkeysvalueof{/pgf/data/format}@end\endcsname%
+ \endgroup%
+}
+
+
+%
+% Read external file
+%
+
+\def\pgf@dataset@do@external{%
+ \csname pgfdv@format@\pgfkeysvalueof{/pgf/data/format}@catcodes\endcsname%
+ \immediate\openin\r@pgf@reada=\pgfkeysvalueof{/pgf/data/source} %
+ \ifeof\r@pgf@reada\relax
+ \PackageError{pgf}{Data source '\pgfkeysvalueof{/pgf/data/source}' not found}{}%
+ \else
+ \pgf@dataset@readline%
+ \fi
+ \immediate\closein\r@pgf@reada%
+}
+
+\def\pgf@partext{\par}%
+\def\pgf@dataset@readline{%
+ \immediate\read\r@pgf@reada to \pgf@temp%
+ \ifx\pgf@temp\pgf@partext%
+ \pgf@dv@format@emptyline%
+ \else%
+ \ifx\pgf@temp\pgfutil@empty%
+ \pgf@dv@format@emptyline%
+ \else%
+ \expandafter\pgf@dv@format@line\pgf@temp\pgfeol%
+ \fi%
+ \fi%
+ \ifeof\r@pgf@reada\else\expandafter\pgf@dataset@readline\fi%
+}
+
+
+%
+% Read inline data
+%
+
+\def\pgf@dataset@do@inline{%
+ \pgf@dv@handle@line%
+}
+
+{\catcode`\^^M=\active%
+\gdef\pgf@dv@handle@line{%
+ \pgfutil@ifnextchar^^M{\pgf@dv@format@emptyline\expandafter\pgf@dv@handle@line\pgfutil@gobble}%
+ {\pgfutil@ifnextchar\pgf@@eol{\pgfutil@gobble}{\pgf@dv@handle@nonemptyline}}%
+}%
+\gdef\pgf@dv@handle@nonemptyline#1^^M{%
+ \pgf@dv@format@line#1\pgfeol%
+ \pgf@dv@handle@line%
+}%
+}
+
+\pgfkeys{
+ /pgf/data/data visualization obj/.initial=\undefined,
+ /pgf/data/format/.initial=table,% the default format
+ /pgf/data/source/.initial=,
+ /pgf/data/continue code/.initial=
+}
+
+
+
+
+
+
+% Define a data format
+%
+% #1 = format name
+% #2 = catcode code
+% #3 = startup code
+% #4 = line arguments
+% #5 = line code
+% #6 = empty line code
+% #7 = end code
+%
+% Description:
+%
+% This command defines a new data format for data visualization. When
+% a data set is visualized and the format is set to #1, this handler
+% is used to parse the data.
+%
+% In detail, the \dataset command will select a source. Before this
+% source is read, #2 will be executed to setup the
+% catcodes. Additionally, each time the data is parsed, #3 will be
+% called. Then, for each nonempty line of the source, the
+% command #5 is executed, where the line will be matched against the
+% argument pattern given in #4. For empty lines, #6 will be executed
+% instead. At the end of the source, #7 will be executed.
+
+\def\pgfdeclaredataformat#1#2#3#4#5#6#7{%
+ \expandafter\def\csname pgfdv@format@#1@catcodes\endcsname{#2}%
+ \expandafter\def\csname pgfdv@format@#1@startup\endcsname{#3}%
+ \expandafter\def\csname pgfdv@format@#1@line\endcsname#4\pgfeol{#5}%
+ \expandafter\def\csname pgfdv@format@#1@empty\endcsname{#6}%
+ \expandafter\def\csname pgfdv@format@#1@end\endcsname{#7}%
+}
+
+
+
+%
+% Predefined standard formats
+%
+
+% TeX code format
+%
+% Description:
+%
+% The lines of the data set are assumed to contain executable TeX
+% code that will call \pgfdatapoint.
+%
+% Example:
+%
+% \pgfdatavisualizationrender[format=TeX code]
+% \dataset{
+% \pgfkeyssetvalue{/data point/x}{5}
+% \pgfkeyssetvalue{/data point/y}{5}
+% \pgfdatapoint
+% \pgfkeyssetvalue{/data point/x}{6}
+% \pgfkeyssetvalue{/data point/y}{6}
+% \pgfdatapoint
+% }
+
+\pgfdeclaredataformat{TeX code}{}{}{#1}{#1 }{}{}
+
+
+
+% Key-value lines format
+%
+% Description:
+%
+% The lines of the data set are passed to \pgfkeys with the path set
+% to /data point.
+%
+% Example:
+%
+% \data[format=key value pairs] {
+% x=5, y=6, hi=9
+% x=7, y=6, lo=10
+% }
+
+\pgfdeclaredataformat{key value pairs}{}{}{#1}{{\pgfkeys{/data point/.cd,#1}\pgfdatapoint}}{}{}
+
+
+
+
+
+% Table format
+%
+% Description:
+%
+% A table consists of a head line, which contains the attribute names
+% of the values that will be found in the following lines. Each line
+% (except for the headline) contains one data point.
+%
+% Inside each line the data points are separated by a separator like a
+% comma or a space or a colon. The separator can be configured using
+% the key /pgf/data/separator (leave the separator empty or set it to
+% \space for a space as separator). The default separator is a comma.
+%
+% Some tables will miss the headline. In this case, using the
+% /pgf/data/headline key you can provide a headline yourself.
+%
+% Example:
+%
+% \data[format=table] {
+% x y
+% 10 5
+% 11 6
+% 6 7
+% }
+%
+% \data[format=table,separator={,}] {
+% x, y
+% 10, 5
+% 11, 6
+% 6, 7
+% }
+%
+% \data[format=table,headline=x y] {
+% 10 5
+% 11 6
+% 6 7
+% }
+
+\pgfdeclaredataformat{table}
+{} % no catcodes
+{
+ \pgfkeysgetvalue{/pgf/data/headline}\pgf@dv@headline
+ \pgfkeysgetvalue{/pgf/data/separator}\pgf@dv@separator
+ \ifx\pgf@dv@separator\pgfutil@empty
+ \let\pgf@dv@separator\space
+ \fi
+ \ifx\pgf@dv@separator\pgf@dv@spacetext
+ \let\pgf@dv@separator\space
+ \fi
+ \expandafter\def\expandafter\pgf@dv@till@separator%
+ \expandafter##\expandafter1\pgf@dv@separator{\pgf@dv@table@handle{##1}}
+ \expandafter\def\expandafter\pgf@dv@till@separator@head%
+ \expandafter##\expandafter1\pgf@dv@separator{\pgf@dv@head@handle{##1}}
+ \ifx\pgf@dv@headline\pgfutil@empty
+ % Ok, read headline from file
+ \pgfdv@firstlinetrue
+ \else
+ % Headline already set
+ \pgfdv@firstlinefalse
+ \expandafter\pgf@dv@parse@headline\expandafter{\pgf@dv@headline}
+ \fi
+}
+{#1} % special line pattern, so read everything
+{
+ \ifpgfdv@firstline
+ \pgfdv@firstlinefalse
+ \pgf@dv@parse@headline{#1}
+ \else
+ {
+ \c@pgf@counta=0\relax% keep track of attribute number
+ \def\pgf@marshal{\pgf@dv@parse@table#1}
+ \expandafter\expandafter\expandafter\pgf@marshal%
+ \expandafter\pgf@dv@separator\expandafter\pgfeol\pgf@dv@separator
+ \pgfdatapoint
+ }
+ \fi
+}
+{} % ignore empty lines
+{} % no special end code
+
+\newif\ifpgfdv@firstline
+
+\pgfkeys{
+ /pgf/data/separator/.initial={,},
+ /pgf/data/headline/.initial=
+}
+\def\pgf@dv@spacetext{\space}
+
+\def\pgf@dv@parse@table{%
+ \pgfutil@ifnextchar"% Special, but ignored right now...
+ {\PackageError{pgf}{csv with quotes not yet implemented}{}}
+ {\pgf@dv@till@separator}
+}
+\def\pgf@dv@table@handle#1{%
+ \def\pgf@temp{#1}%
+ \ifx\pgf@temp\pgfeoltext%
+ % Bingo! Stop
+ \let\pgf@next=\relax%
+ \else%
+ \advance\c@pgf@counta by1\relax%
+ \pgfkeysgetvalue{/pgf/data/table/attribute \the\c@pgf@counta}\pgf@dv@target
+ \ifx\pgf@dv@target\relax%
+ \edef\pgf@dv@target{attribute \the\c@pgf@counta}
+ \pgfkeyslet{/pgf/data/table/attribute \the\c@pgf@counta}\pgf@dv@target
+ \fi
+ \pgfkeyssetvalue{/data point/\pgf@dv@target}{#1}
+ \let\pgf@next=\pgf@dv@parse@table%
+ \fi%
+ \pgf@next%
+}
+
+
+
+\def\pgf@dv@parse@headline#1{
+ \c@pgf@counta=0\relax% keep track of attribute number
+ \def\pgf@marshal{\pgf@dv@doparse@headline#1}
+ \expandafter\expandafter\expandafter\pgf@marshal%
+ \expandafter\pgf@dv@separator\expandafter\pgfeol\pgf@dv@separator
+}
+
+\def\pgf@dv@doparse@headline{%
+ \pgfutil@ifnextchar"% Special, but ignored right now...
+ {\PackageError{pgf}{csv with quotes not yet implemented}{}}
+ {\pgf@dv@till@separator@head}
+}
+\def\pgf@dv@head@handle#1{%
+ \def\pgf@temp{#1}%
+ \ifx\pgf@temp\pgfeoltext%
+ % Bingo! Stop
+ \let\pgf@next=\relax%
+ \else%
+ \advance\c@pgf@counta by1\relax%
+ \pgfkeyssetvalue{/pgf/data/table/attribute \the\c@pgf@counta}{#1}
+ \let\pgf@next=\pgf@dv@doparse@headline%
+ \fi%
+ \pgf@next%
+}
+
+\def\pgfeoltext{\pgfeol}
+
+
+%
+%
+% Micro math kernel for dv
+%
+%
+
+% The idea behind the following methods is to "abstract away" which
+% math engine is used. In the future, something fancy build on luatex
+% might be used, so it would we should not rely directly on the
+% fpu library code.
+%
+% The system works as follows: First, you "enter" a number into the
+% engine. When you do so, it is converted into some internal
+% representation that cannot be accessed any more and is called a
+% "math variable" henceforth. All commands of the
+% math system only work on math variables.
+%
+% In order to "exit" a value stored in a math variable from the
+% engine, some other macros can be used.
+%
+% Operations like addition or multiplication take two math variables
+% and store the result in another math variable.
+
+
+
+% Store a value in a math variable of the math engine
+%
+% #1 = a math variable (a macro name) that is to store the value
+% #2 = an expression describing a number
+%
+%
+% Description:
+%
+% The #2 should be an expression that evaluates to a number. However,
+% due to the way the pgf math engine(s) work, currently, there are
+% several restrictions/the syntax is not as simple as one might
+% hope. Fortunately, the syntax is hopefully compatible with
+% easier-to-use future systems.
+%
+% The syntax is as follows: #2 may be
+%
+% 1. a simple high-precision number. This number is currently directly
+% passed to \pgfmathfloatparsenumber, so typical permissible values
+% are "100" or "10000000000000" or "nan" or "-5.673543345345e9000"
+%
+% 2. a mathematical expression, which *must* be surrounded by
+% parantheses. From a "mathematical" point of view these
+% parantheses are superfluous, but the they are used to help pgf
+% distinguish expressions from high-precision numbers. (If, in the
+% future, expressions may contain high precision numbers, the
+% parantheses will simply be ignored.)
+%
+% The expression is evaluated using \pgfmathparse, which means that
+% TeX-precision is used. This means, for instance, that numbers
+% larger than about 16500 will create error messages.
+%
+% The advantage is that you may say write things like "(5+6)" or
+% "(pi/2)".
+%
+% 3. In case #2 starts with an exclamation mark (indicating an
+% "escape"), everything following the mark is simply evaluated by
+% TeX. The effect of evaluating #2 should be that the math
+% variable "\pgfdvmathvalue" is set to some value. This value will
+% then be transferred to #1.
+%
+% 4. In case #2 is the result of calling \pgfdvmathexitbyserializing, the
+% "serialized" value is restored. The idea is that the serialized
+% will turn its internal representation of a number into something
+% that can be stored as a text somewhere.
+%
+% Currently, "@" at the beginning of #2 is used to indicate that
+% what follows is a serialized version of a math variable.
+%
+% In order to determine which of the above cases is to be used for a
+% variable, the first symbol #2 is checked, *after* the first symbol
+% of #2 has been expanded once (using \expandafter once).
+%
+% Example:
+%
+% \pgfdvmathenter{\mymacro}{20000000000000}
+% \pgfdvmathenter{\mymacro}{(5+pi)}
+% \pgfdvmathenter{\mymacro}{!\pgfdvmathadd{\pgfdvmathvalue}{\a}{\b}}
+%
+% \pgfdvmathenter{\foo}{5}
+% \pgfdvmathexitbyserializing{\somevalue}{\foo}
+% \pgfdvmathenter{\mymacro}{\somevalue}
+
+\def\pgfdvmathenter#1#2{%
+ \expandafter\pgfdvmathenter@check\expandafter#1#2\pgfdvmath@end%
+}
+\def\pgfdvmathenter@check#1{%
+ \pgfutil@ifnextchar @{\pgfdvmath@internal#1}{%
+ \pgfutil@ifnextchar ({\pgfdvmath@expression#1}{%)
+ \pgfutil@ifnextchar !{\pgfdvmath@execute#1}{\pgfdvmath@normal#1}}}%
+}
+
+\def\pgfdvmath@internal#1@#2\pgfdvmath@end{%
+ \def#1{#2}%
+}
+\def\pgfdvmath@expression#1(#2)#3\pgfdvmath@end{%
+ \pgfmathparse{#2}%
+ \pgfmathfloatparsenumber{\pgfmathresult}%
+ \let#1=\pgfmathresult%
+}
+\def\pgfdvmath@execute#1!#2\pgfdvmath@end{%
+ #2%
+ \let#1=\pgfdvmathvalue%
+}
+\def\pgfdvmath@normal#1#2\pgfdvmath@end{%
+ \pgfmathfloatparsenumber{#2}%
+ \let#1=\pgfmathresult%
+}
+
+
+
+% Print a math variable in the math engine using \pgfmathprintnumber
+%
+% #1 = math variable
+%
+% Description:
+%
+% See the description of \pgfmathprintnumber
+%
+% Example:
+%
+% \pgfdvmathenter{\mymacro}{20000000000000}
+% \pgfdvmathexitbyprinting{\mymacro}
+
+\def\pgfdvmathexitbyprinting#1{%
+ \pgfmathprintnumber{#1}%
+}
+
+
+
+% Exit a math variable as a number in a scientific and portable number
+% format in a macro
+%
+% #1 = macro in which to store the value
+% #2 = math variable
+%
+% Description:
+%
+% You can exit a number using this operation. You can then directly
+% reenter the number using \pgfdvmathenter
+%
+% Example:
+%
+% \pgfdvmathenter{\mynumber}{20000000000000}
+% \pgfdvmathexitbyscientificformat{\mymacro}{\mynumber}
+
+\def\pgfdvmathexitbyscientificformat#1#2{%
+ \edef#1{\pgfmathfloatvalueof#2}%
+}
+
+
+
+% Exit a math variable as a "serialized" (= string-based)
+% version.
+%
+% #1 = macro in which to store the value
+% #2 = math variable
+%
+% Description:
+%
+% The serialized version can be reentered using
+% \pgfmathenter and is similar to \pgfdvmathexitbyscientificformat,
+% but exiting and entering are (a bit) faster.
+%
+% Example:
+%
+% \pgfdvmathenter{\mynumber}{20000000000000}
+% \pgfdvmathexitbyserializing{\mymacro}{\mynumber}
+
+\def\pgfdvmathexitbyserializing#1#2{%
+ \edef#1{@#2}%
+}
+
+
+
+
+
+% Operations on two numbers
+%
+% #1 = macro that should store the result of applying the
+% corresponding operation to the following:
+% #2 = entered number
+% #3 = entered number
+%
+% Description:
+%
+% Sets #1 to the result of applying an operation to #2 and #3
+%
+% Example:
+%
+% \pgfdvmathenter{\a}{2000}
+% \pgfdvmathenter{\b}{5+6}
+% \pgfdvmathadd{\c}{\a}{\b}
+
+\def\pgfdvmathadd#1#2#3{%
+ \pgfmathfloatadd{#2}{#3}%
+ \let#1=\pgfmathresult%
+}
+\def\pgfdvmathsub#1#2#3{%
+ \pgfmathfloatsubtract{#2}{#3}%
+ \let#1=\pgfmathresult%
+}
+\def\pgfdvmathmul#1#2#3{%
+ \pgfmathfloatmultiply{#2}{#3}%
+ \let#1=\pgfmathresult%
+}
+\def\pgfdvmathdiv#1#2#3{%
+ \pgfmathfloatdivide{#2}{#3}%
+ \let#1=\pgfmathresult%
+}
+
+
+
+
+% Log, ln and exponent functions
+%
+% #1 = a math variable
+% #2 = a math variable
+%
+% Description
+%
+% \pgfdvmathln will compute #1 = ln(#2)
+% \pgfdvmathlog will compute #1 = log_{10}(#2)
+% \pgfdvmathexp will compute #1 = exp(#2)
+% \pgfdvmathpowten will compute #1 = 10^{#2}
+
+\def\pgfdvmathln#1#2{%
+ \pgfmathfloatln{#2}%
+ \let#1=\pgfmathresult%
+}
+
+\def\pgfdvmathlog#1#2{%
+ \pgfmathfloatln{#2}%
+ \pgfmathfloatmultiply{\pgfmathresult}{\pgfdvmathalwaysloge}%
+ \let#1=\pgfmathresult%
+}
+
+\def\pgfdvmathexp#1#2{%
+ \pgfmathfloatexp{#2}%
+ \let#1=\pgfmathresult%
+}
+
+\def\pgfdvmathpowten#1#2{%
+ \pgfmathfloattofixed{#2}%
+ \let\pgf@dv@temp=\pgfmathresult%
+ \pgfmathround{\pgf@dv@temp}%
+ \let\pgf@dv@temp@round=\pgfmathresult%
+ \pgf@x=\pgf@dv@temp@round pt%
+ \pgf@x=-\pgf@x%
+ \advance\pgf@x by\pgf@dv@temp pt\relax%
+ \ifdim\pgf@x>0.0002pt%
+ \pgfmathfloatmultiply{#2}{\pgfdvmathalwayslnten}%
+ \pgfmathfloatexp{\pgfmathresult}%
+ \else
+ \ifdim\pgf@x<-0.0002pt%
+ \pgfmathfloatmultiply{#2}{\pgfdvmathalwayslnten}%
+ \pgfmathfloatexp{\pgfmathresult}%
+ \else
+ \pgf@x=\pgf@dv@temp@round sp%
+ \c@pgf@counta=\pgf@x%
+ \pgfmathfloatcreate{1}{1.0}{\the\c@pgf@counta}%
+ \fi
+ \fi
+ \let#1=\pgfmathresult%
+}
+
+
+% Floor functions
+%
+% #1 = a math variable
+% #2 = a math variable
+%
+% Description
+%
+% Sets #1 to the largest integer less or equal to #2
+
+\def\pgfdvmathfloor#1#2{%
+ \pgfmathifisint{#2}{%
+ \let#1=#2%
+ }{%
+ \pgfmathfloatgetflags#2\c@pgf@counta%
+ \ifcase\c@pgf@counta
+ \let#1=\pgfdvmathalwayszero%
+ \or
+ \pgfmathfloatfloor{#2}%
+ \let#1=\pgfmathresult%
+ \or
+ \pgfmathfloatsubtract{\pgfdvmathalwaysone}{#2}%
+ \pgfmathfloatfloor{\pgfmathresult}%
+ \pgfmathfloatsubtract{\pgfdvmathalwayszero}{\pgfmathresult}%
+ \let#1=\pgfmathresult%
+ \or\let#1=#2%
+ \or\let#1=#2%
+ \or\let#1=#2%
+ \fi%
+ }%
+}
+
+
+% Advanced unary operations
+%
+% #1 = macro that should store the result of applying the
+% operation to an entered number
+% #2 = the operation (as a string like "ln")
+% #3 = entered number
+%
+% Description:
+%
+% Sets #1 to the result of applying #2 to #3
+%
+% Example:
+%
+% \pgfdvmathenter{\a}{2000}
+% \pgfdvmathunaryop{\b}{ln}{\a}
+
+\def\pgfdvmathunaryop#1#2#3{%
+ \csname pgfmathfloat#2\endcsname{#3}%
+ \let#1=\pgfmathresult%
+}
+
+
+% Advanced binary operations
+%
+% #1 = macro that should store the result of applying the
+% operation to two entered number
+% #2 = the operation (as a string like "veclen")
+% #3 = first argument (an entered number)
+% #4 = second argument (an entered number)
+%
+% Description:
+%
+% Sets #1 to the result of applying #2 to #3
+%
+% Example:
+%
+% \pgfdvmathenter{\a}{3}
+% \pgfdvmathenter{\b}{4}
+% \pgfdvmathbinop{\c}{veclen}{\a}{\b}
+
+\def\pgfdvmathbinop#1#2#3#4{%
+ \csname pgfmathfloat#2\endcsname{#3}{#4}%
+ \let#1=\pgfmathresult%
+}
+
+
+
+% Comparing values
+%
+% #1 = first math variable
+% #2 = second math variable
+% #3 = code to-be-executed if #1 < #2
+% #4 = code to-be-executed if #1 >= #2
+%
+%
+% Example:
+%
+% \pgfdvmathenter{\a}{3}
+% \pgfdvmathenter{\b}{4}
+% \pgfdvmathifless{\a}{\b}{yes}{should not happen}
+
+\def\pgfdvmathifless#1#2#3#4{%
+ \pgfmathfloatlessthan{#1}{#2}%
+ \ifpgfmathfloatcomparison#3\else#4\fi%
+}
+
+
+
+
+%
+%
+% Standard objects for data visualization
+%
+%
+
+
+%
+% Transformers
+%
+
+\pgfooclass{linear transformer}
+{
+ % Class linear transformer
+ %
+ % This class is a transformer class. It reacts to the transform
+ % datapoint signal. When this signal is raised, it will shift the
+ % coordinate system as follows: If the current value of /data
+ % point/this.attribute is 0, then the system is shifted to the
+ % current value of this.origin. If the current value is 1, the
+ % system is shifted to this.origin + this.unit vector. For other
+ % values of /data point/this.attribuate, the shift is interpolated
+ % between these two values.
+
+
+ \attribute attribute;
+ % The attribute (/data point/this.attribute) by which
+ % the unit vector is multiplied. If it is empty (which is
+ % different from 0), no transformation is done at all.
+
+ \attribute origin = \pgfpointorigin;
+ % The shift in case the /data point/this.attribute is 0.
+
+ \attribute unit vector;
+ % The coordinate system is additionally shifted by this amount
+ % times the current value of /data point/this.attribute.
+
+
+ % Constructor
+ %
+ % #1 = attribute that is being transformed. Example: x
+ % #2 = a vector corresponding to one unit of #1.
+ % Example: \pgfpoint{1cm}{0cm}
+ \method linear transformer(#1,#2) {
+ \pgfooset{attribute}{#1}
+ \pgf@process{#2}
+ \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}
+ \pgfoolet{unit vector}\pgf@temp%
+ }
+
+ % Method
+ \method default connects() {
+ \pgfoothis.get handle(\pgf@dv@me)
+ \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,transform,transform datapoint signal)
+ }
+
+ % Setter
+ \method set origin(#1) {
+ \pgf@process{#1}
+ \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}
+ \pgfoolet{origin}\pgf@temp%
+ }
+
+ % Slot
+ %
+ % This slot should be connected to the transform datapoint
+ % signal. When this signal is emitted, the coordinate system will be
+ % shifted according to the current value of the attribute.
+ \method transform() {
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{attribute}}\pgf@dv@val%
+ \ifx\pgf@dv@val\pgfutil@empty%
+ \else%
+ \ifx\pgf@dv@val\relax%
+ \else%
+ \pgfdvmathenter{\pgf@dv@math@var}{\pgf@dv@val}%
+ \pgfdvmathexitbyscientificformat{\pgf@dv@val}{\pgf@dv@math@var}%
+ \pgftransformshift{\pgfoovalueof{origin}}%
+ \pgfmathfloatgetexponent\pgf@dv@math@var\c@pgf@counta%
+ \ifnum\c@pgf@counta<-3\relax%
+ \else%
+ \pgftransformshift{\pgfpointscale{\pgf@dv@val}{\pgfoovalueof{unit vector}}}%
+ \fi%
+ \fi%
+ \fi%
+ }
+
+}
+
+
+%
+% Numerical mapping of attributes to other attributes
+%
+
+\pgfooclass{interval mapper}
+{
+ % Class interval mapper
+ %
+ % This interval mapper reacts to the map datapoint signal. Its purpose is to
+ % map one attribute to another attribute. For the first attribute,
+ % an intervals is specified.
+ %
+ % In addition to the in interval [a,b] there is also an outinterval
+ % [c,d]. Values in the range [a,b] are linearly mapped to the
+ % range [c,d] and the result is stored in the second attribute.
+ %
+ % For instance, if the first range is [10,20] and the second range
+ % is [0,100], then 10 is mapped to 0, 11 is mapped to 10, 20 is
+ % mapped to 100 and 30 is mapped to 200.
+ %
+ % It is permissible to specify an additional non-linear
+ % transformation function f. In this case, for an input value x the
+ % position of f(x) inside the interval [f(a),f(b)] is determined and
+ % this position is linearly mapped to [c,d].
+ %
+ % For example, if f(x) = log_10 (x) and the first range [a,b] =
+ % [10,1000] and the second range is [1,2], then 10 is mapped to 1,
+ % 100 is mapped to 1.5 (since f(100) = 3 lies in the middle
+ % between f(10) = 2 and f(1000) = 4) and 100000 is mapped to 3.
+
+
+ \attribute in;
+ % The name of the input attribute. If the value of this attribute
+ % is empty or undefined, no mapping is done.
+ %
+ % The in attribute may have a subkey called .../const. If this key
+ % has a value different from \relax, it will always be used instead
+ % of the in attribute itself. This can be useful to temporarily
+ % set a constant value to a key inside a mapping chain.
+
+% \attribute clip;
+% % The code for clipping the interval. Will set \pgf@dvcliptrue, if a
+% % clip is necessary.
+
+ \attribute out;
+ % The name of the output attribute.
+
+ \attribute trans;
+ % Stores (more or less) the transformation function.
+
+ \attribute out min;
+ % Start of the second range (the value of c).
+
+ \attribute trans in min;
+ % Transformed value of the start of the first range (the value
+ % f(a)).
+
+ \attribute scale;
+ % The scaling factor, that is, the value of (f(d)-f(c))/(b-a).
+
+
+ % Constructor
+ %
+ % #1 = input attribute. Example: velocity.
+ % #2 = output attribute. Example: x
+ % #3 = optional transformation function. The input value for this
+ % function is stored in entered number \pgfvalue.
+ % The output of the function should be stored in the
+ % same entered number.
+ %
+ % The intervals are set using setter methods later on.
+ %
+ \method interval mapper(#1,#2,#3) {
+ \pgfooset{in}{#1}
+ \pgfooset{out}{#2}
+ \def\pgf@temp{#3}%
+ \ifx\pgf@temp\pgfutil@empty%
+ \else%
+ \pgfooset{trans}{%
+ #3%
+ }%
+ \fi%
+ }
+
+ % Method
+ \method default connects() {
+ \pgfoothis.get handle(\pgf@dv@me)
+ \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,map,map datapoint signal)
+ }
+
+% % Method
+% \method set clip interval(#1,#2) {
+% \def\pgfdvmin{#1}%
+% \def\pgfdvmax{#2}%
+% \ifx\pgfdvmin\pgfutil@empty%
+% \else%
+% \pgfdvmathenter{\pgf@dv@temp}{\pgfdvmin}%
+% \pgfdvmathexitbyserializing{\pgfdvmin}{\pgf@dv@temp}%
+% \fi
+% \ifx\pgfdvmax\pgfutil@empty%
+% \else%
+% \pgfdvmathenter{\pgf@dv@temp}{\pgfdvmax}%
+% \pgfdvmathexitbyserializing{\pgfdvmax}{\pgf@dv@temp}%
+% \fi
+% \pgfooeset{clip}{%
+% \noexpand\pgf@dvclipfalse%
+% \ifx\pgfdvmin\pgfutil@empty%
+% \else%
+% \noexpand\pgfdvmathenter{\noexpand\pgf@dv@temp}{\pgfdvmin}%
+% \noexpand\pgfdvmathifless{\noexpand\pgfvalue}{\noexpand\pgf@dv@temp}{\noexpand\pgf@dvcliptrue}{}%
+% \fi%
+% \ifx\pgfdvmax\pgfutil@empty%
+% \else%
+% \noexpand\pgfdvmathenter{\noexpand\pgf@dv@temp}{\pgfdvmax}%
+% \noexpand\pgfdvmathifless{\noexpand\pgf@dv@temp}{\noexpand\pgfvalue}{\noexpand\pgf@dvcliptrue}{}%
+% \fi%
+% }
+% }
+
+ % Method
+ %
+ % #1 = in interval minimum
+ % #2 = in interval maximum
+ % #3 = out interval minimum
+ % #4 = out interval maximum
+ %
+ % This method will (re)compute the correct mappings for the interval
+ % mapper.
+ \method set interval values(#1,#2,#3,#4) {
+ {%
+ \pgfdvmathenter{\pgf@in@interval@min}{#1}
+ \pgfdvmathenter{\pgf@in@interval@max}{#2}
+ \pgfdvmathenter{\pgf@out@interval@min}{#3}
+ \pgfdvmathenter{\pgf@out@interval@max}{#4}
+ % Let's start with the output, it's easier...
+ \pgfoolet{out min}{\pgf@out@interval@min}
+ \pgfdvmathsub{\pgf@out@diff}{\pgf@out@interval@max}{\pgf@out@interval@min}
+ \let\pgfvalue=\pgf@in@interval@min
+ \pgfoovalueof{trans}
+ \let\pgf@in@interval@min@transformed=\pgfvalue
+ \pgfoolet{trans in min}{\pgf@in@interval@min@transformed}%
+ \let\pgfvalue=\pgf@in@interval@max
+ \pgfoovalueof{trans}
+ \let\pgf@in@interval@max@transformed=\pgfvalue
+ \pgfdvmathsub{\pgf@diff@in@transformed}{\pgf@in@interval@max@transformed}{\pgf@in@interval@min@transformed}
+ %
+ % Precompute the scaling
+ %
+ \pgfdvmathdiv{\pgf@scale}{\pgf@out@diff}{\pgf@diff@in@transformed}%
+ \pgfoolet{scale}{\pgf@scale}%
+ }%
+ }
+
+ % Slot
+ \method map() {
+ \pgfooget{scale}\pgf@temp
+ \ifx\pgf@temp\pgfutil@empty%
+ % not yet setup
+ \else%
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{in}/const}\pgf@dv@external@value%
+ \ifx\pgf@dv@external@value\relax%
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{in}}\pgf@dv@external@value%
+ \fi%
+ \ifx\pgf@dv@external@value\pgfutil@empty%
+ \else%
+ \ifx\pgf@dv@external@value\relax%
+ \else%
+% % Clip?
+ \pgfdvmathenter{\pgfvalue}{\pgf@dv@external@value}%
+% \pgfoovalueof{clip}%
+% \ifpgf@dvclip%
+% \pgfkeyslet{/data point/\pgfoovalueof{out}}\pgfutil@empty%
+% \else%
+ \pgf@dv@mapper@trans{}
+% \fi%
+ \fi%
+ \fi%
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{in}/min}\pgf@dv@external@value%
+ \ifx\pgf@dv@external@value\relax\else%
+ \ifx\pgf@dv@external@value\pgfutil@empty\else%
+ \pgfdvmathenter{\pgfvalue}{\pgf@dv@external@value}%
+ \pgf@dv@mapper@trans{/min}
+ \fi
+ \fi
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{in}/max}\pgf@dv@external@value%
+ \ifx\pgf@dv@external@value\relax\else%
+ \ifx\pgf@dv@external@value\pgfutil@empty\else%
+ \pgfdvmathenter{\pgfvalue}{\pgf@dv@external@value}%
+ \pgf@dv@mapper@trans{/max}
+ \fi
+ \fi
+ \fi%
+ }
+
+ \def\pgf@dv@mapper@trans#1{
+ \pgfooget{trans in min}{\pgf@dv@trans@in@min}%
+ \pgfooget{scale}{\pgf@dv@scale}%
+ \pgfooget{out min}{\pgf@dv@out@min}%
+ \pgfoovalueof{trans}%
+ \pgfdvmathsub{\pgfvalue}{\pgfvalue}{\pgf@dv@trans@in@min}%
+ \pgfdvmathmul{\pgfvalue}{\pgfvalue}{\pgf@dv@scale}%
+ \pgfdvmathadd{\pgfvalue}{\pgfvalue}{\pgf@dv@out@min}%
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{out}#1/offset}\pgf@dv@external@offset%
+ \ifx\pgf@dv@external@offset\relax\else%
+ \ifx\pgf@dv@external@offset\pgfutil@empty\else%
+ \pgfdvmathenter{\pgf@dv@offset}{\pgf@dv@external@offset}%
+ \pgfdvmathadd{\pgfvalue}{\pgfvalue}{\pgf@dv@offset}
+ \fi
+ \fi
+ \pgfdvmathexitbyserializing{\pgf@temp}{\pgfvalue}%
+ \pgfkeyslet{/data point/\pgfoovalueof{out}#1}\pgf@temp%
+ }
+}
+
+
+
+
+
+%\newif\ifpgf@dvclip
+\newif\ifpgf@dvignore
+
+\pgfooclass{scaling mapper}
+{
+ % Class scaling mapper
+ %
+ % A scaling mapper is (mainly) used to scale an attribute in such a way
+ % that it can be rendered easily on a page. The idea is that you
+ % specify some attribute and a desired target interval size (like
+ % [0,5]). The scaling mapper will then survey the data and will setup a
+ % interval mapper in such a way that the minimum value present in the data is
+ % mapped to 0 and the maximum to 5. However, it is also possible to,
+ % say, only have the maximum value mapped to 5 and have 0 be mapped
+ % to 0. Other, more complicated specifications are also possible.
+ %
+ % The scaling mapper internally creates several objects: First, a surveyor
+ % for determining the minimum and maximum values of the attribute
+ % and a interval mapper for then mapping the values to the scaled
+ % values. Additionally, interval objects are needed.
+
+ \attribute in;
+ % The to-be-scaled attribute;
+
+ \attribute out;
+ % The attribute storing the scaled value.
+
+ \attribute in range obj;
+ % This interval keep track of the range of the in attribute
+
+ \attribute scaling spec;
+ % A specification of how the scaling should be performed.
+ %
+ % The format is the following:
+ %
+ % #1 at #2 and #3 at #4
+ %
+ % Here, #2 and #4 must be numbers. #1 and #3 can either be numbers
+ % or #1 can be the text "min" and #3 can be the text "max".
+ %
+ % The effect of such a specification is the following: The value #1
+ % is mapped to #2, the value #3 is mapped to #4 and values between
+ % #1 and #3 (or outside this range) are mapped linearly to a value
+ % between (or outside) #2 and #4. In case #1 is set to "min", the
+ % smallest observed value of the in-attribute is mapped to #3 and
+ % similarly for a value of "max" for #3.
+ %
+ % Additionally, as for a interval mapper, a function f might be specified
+ % that deforms the linear mapping. In case f is specified,
+ % f(#1) is mapped to #2 and f(#3) is mapped to #4.
+
+ \attribute function;
+ % Stores the function
+
+ \attribute interval mapper;
+ % Stores the interval mapper object
+
+ \attribute range surveyor;
+ % Stores the range surveyor object
+
+
+ % Constructor
+ %
+ % #1 = in attribute
+ % #2 = out attribute
+ % #3 = scaling specification
+ % #4 = optional function
+ %
+ \method scaling mapper(#1,#2,#3,#4) {
+ %
+ % Save the parameters in attributes
+ %
+ \pgfooset{in}{#1}
+ \pgfooset{out}{#2}
+ \pgfooset{scaling spec}{#3}
+ \pgfooset{function}{#4}
+ %
+ % Now setup the objects for the before survey phase
+ %
+ %
+ % First, the in range interval
+ \pgfoonew \pgf@dv@in@range@obj=new interval(,)
+ \pgfoolet{in range obj}\pgf@dv@in@range@obj
+ % Second, the in range surveyor. We do not need to store this
+ % object, it will "do its work in the background"
+ \pgfoonew \pgf@dv@range@obj=new range surveyor(#1,\pgf@dv@in@range@obj)
+ \pgf@dv@range@obj.default connects()
+ \pgfoolet{range surveyor}\pgf@dv@range@obj
+ %
+ %
+ % The interval mapper:
+ %
+ \pgfoonew{interval mapper}=new interval mapper(#1,#2,#4)
+ \pgfoovalueof{interval mapper}.default connects()
+ }
+
+ % Method
+ \method default connects() {
+ \pgfoothis.get handle(\pgf@dv@me)
+ \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,phase,phase signal)
+ }
+
+
+% % Method
+% %
+% % #1 = a min clip -- everything below this value will be clipped
+% % #2 = a max value -- everything above this value will be clipped
+% %
+% % Sets a clipping for the underlying interval mapper.
+% %
+% \method set clip interval(#1,#2) {
+% \pgfoovalueof{interval mapper}.set clip interval({#1},{#2})%
+% }
+
+ % Getter
+ %
+ % Returns an interval object that stores the range of the in
+ % attribute.
+ \method get in range interval() {
+ \pgfooget{in range obj}\pgfdvinrangeinterval
+ }
+
+
+ % Getter
+ %
+ % Returns the out attribute.
+ %
+ \method get out() {
+ \pgfooget{out}\pgfdvout
+ }
+
+ % Getter
+ %
+ % Returns the function attribute.
+ %
+ \method get function(#1) {
+ \pgfooget{function}#1
+ }
+
+ % Method
+ %
+ % #1 = a included in value
+ %
+ % This method only affects the survey. The value #1 is recorded as
+ % if it were encountered for the in attribute at some point.
+ %
+ \method include in value(#1) {
+ \pgfoovalueof{range surveyor}.include attribute value({#1})
+ }
+
+
+ % Method
+ %
+ % #1 = value for the attribute
+ %
+ % Sets the attribute to the (evaluated) given value (evaluation
+ % using \pgfmathparse). When the value is evaluated, the values of
+ % \pgfdvmin and \pgfdvmax will be set to the minimum and maximum
+ % values of the in interval. (See \pgfdvmathenter with the "!"-notation).
+ %
+ % In case #1 is set to the special value "min", it evaluates to
+ % \pgfdvmin, when set to "max" it evaluates to \pgfdvmax.
+ %
+ \method set in to(#1) {
+ \edef\pgf@temp{#1}
+ \ifx\pgf@temp\pgf@min@text
+ \pgf@dv@lib@set@mm%
+ \let\pgf@dv@value\pgfdvmin
+ \else
+ \ifx\pgf@temp\pgf@max@text
+ \pgf@dv@lib@set@mm%
+ \let\pgf@dv@value\pgfdvmax
+ \else
+ \pgfdvmathenter{\pgf@dv@value}{\pgf@temp}
+ \fi
+ \fi
+ \pgfdvmathexitbyserializing{\pgf@dv@serial}{\pgf@dv@value}
+ \pgfkeyslet{/data point/\pgfoovalueof{in}}\pgf@dv@serial
+ }
+ \def\pgf@dv@lib@set@mm{
+ \pgfooget{in range obj}\pgfdvinrangeinterval
+ \pgfdvinrangeinterval.get min and max()%
+ }
+
+
+ % Slot
+ \method phase(#1) {
+ \ifx#1\pgfdvendsurvey
+ % Ok, we setup the interval mapper.
+ %
+ % We start by computing the interval borders:
+ \pgfoovalueof{in range obj}.get min and max()
+ \ifx\pgfdvmin\pgfutil@empty% undefined, since no data points
+ \else%
+ \pgfooget{scaling spec}\pgf@temp
+ \expandafter\pgf@lib@dv@parse@scaling\pgf@temp\pgf@stop%
+ \pgfoovalueof{interval mapper}.set interval values(%
+ \pgf@lib@dv@min,\pgf@lib@dv@max,%
+ \pgf@lib@dv@min@at,\pgf@lib@dv@max@at)
+ \fi
+ \fi
+ }
+
+
+ % Internal helper
+ \def\pgf@lib@dv@parse@scaling#1 at#2and #3 at#4\pgf@stop{%
+ \def\pgf@lib@dv@min{#1}%
+ \pgfdvmathenter{\pgf@lib@dv@min@at@mv}{#2}
+ \def\pgf@lib@dv@max{#3}%
+ \pgfdvmathenter{\pgf@lib@dv@max@at@mv}{#4}
+ \ifx\pgf@lib@dv@min\pgf@min@text%
+ \let\pgf@lib@dv@min@mv\pgfdvmin
+ \else
+ \pgfdvmathenter{\pgf@lib@dv@min@mv}{\pgf@lib@dv@min}
+ \fi
+ \ifx\pgf@lib@dv@max\pgf@max@text%
+ \let\pgf@lib@dv@max@mv\pgfdvmax
+ \else
+ \pgfdvmathenter{\pgf@lib@dv@max@mv}{\pgf@lib@dv@max}
+ \fi
+ \pgfdvmathexitbyserializing{\pgf@lib@dv@min}{\pgf@lib@dv@min@mv}
+ \pgfdvmathexitbyserializing{\pgf@lib@dv@min@at}{\pgf@lib@dv@min@at@mv}
+ \pgfdvmathexitbyserializing{\pgf@lib@dv@max}{\pgf@lib@dv@max@mv}
+ \pgfdvmathexitbyserializing{\pgf@lib@dv@max@at}{\pgf@lib@dv@max@at@mv}
+ }
+ \def\pgf@min@text{min}
+ \def\pgf@max@text{max}
+}
+
+
+
+
+
+%
+% Surveyors
+%
+
+\pgfooclass{range surveyor}
+{
+ % Class range surveyor
+ %
+ % A range surveyor is used only in the survey phase. Its job is to
+ % determine the minimum and maximum values of an attribute that are
+ % "seen" during the survey phase. Based on this value, the size of,
+ % say, an axis can be detemined later on.
+ %
+ % In case the attribute has the sub-attributes "min" and "max", they
+ % are also taken into account.
+
+ \attribute attribute;
+ % The to-be-surveyed attribute
+
+ \attribute interval obj;
+ % The interval object that protocols the minimum and maximum
+ % values.
+
+
+ % Constructor
+ %
+ % #1 = the attribute
+ % #2 = handle to the interval object
+ %
+ \method range surveyor(#1,#2) {
+ \pgfooset{attribute}{#1}
+ \pgfoolet{interval obj}#2
+ }
+
+ % Method
+ \method default connects() {
+ \pgfoothis.get handle(\pgf@dv@me)
+ \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,survey,survey datapoint signal)
+ }
+
+ % Method
+ %
+ % #1 = a value
+ %
+ % Adjust the interval as if during the survey this value were
+ % encountered
+ \method include attribute value(#1) {
+ \def\pgf@dv@val{#1}
+ \pgfoovalueof{interval obj}.adjust(\pgf@dv@range@surv)
+ }
+
+ % Slot
+ %
+ % This slot should be connected to the survey datapoint signal. For
+ % each datapoint, this method will call the adjust method of the
+ % interval.
+ %
+ \method survey() {
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{attribute}}\pgf@dv@val%
+ \pgfoovalueof{interval obj}.adjust(\pgf@dv@range@surv)
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{attribute}/min}\pgf@dv@val%
+ \pgfoovalueof{interval obj}.adjust(\pgf@dv@range@surv)
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{attribute}/max}\pgf@dv@val%
+ \pgfoovalueof{interval obj}.adjust(\pgf@dv@range@surv)
+ }
+
+ \def\pgf@dv@range@surv{%
+ \ifx\pgf@dv@val\relax%
+ \else%
+ \edef\pgf@dv@val{\pgf@dv@val}%
+ \ifx\pgf@dv@val\pgfutil@empty%
+ \else%
+ \pgfdvmathenter{\pgf@dv@value}{\pgf@dv@val}%
+ % Now, protocol value
+ \ifx\pgfdvmin\pgfutil@empty%
+ \let\pgfdvmin\pgf@dv@value%
+ \else%
+ \pgfdvmathifless{\pgf@dv@value}{\pgfdvmin}{\let\pgfdvmin\pgf@dv@value}{}%
+ \fi%
+ \ifx\pgfdvmax\pgfutil@empty%
+ \let\pgfdvmax\pgf@dv@value%
+ \else%
+ \pgfdvmathifless{\pgfdvmax}{\pgf@dv@value}{\let\pgfdvmax\pgf@dv@value}{}%
+ \fi%
+ \fi%
+ \fi
+ }
+}
+
+
+
+%
+% Visualizers
+%
+
+\usepgflibrary{plothandlers}
+
+
+
+\pgfooclass{plot handler visualizer}
+{
+ % Class plot handler visualizer
+ %
+ % This visualizer uses one or more plot handlers to visualize data points.
+ % As the data points are processed, the canvas positions of the data
+ % points are recorded. At the end of a group of data points, the
+ % recorded stream of canvas position is visualized (rendered)
+ % using plot handlers. For instance, when the lineto plot handler
+ % is used, the data points are connected by straight lines, when the
+ % curveto plot handler is used, they are connected by smooth curves
+ % and so on.
+ %
+ % Since plot lines are not drawn immediately, but only at the end,
+ % when everything has been collected, multiple plot handlers can
+ % coexist peacefully at the same time.
+ %
+ % You can specify a "filter", which will cause only those data
+ % points to be visualized by the visualizer that pass the test. The
+ % filter should set \pgfdvfilterpassedfalse for to-be-filtered data
+ % point.
+ %
+ % The keys /data point/<name>/execute at begin and /data
+ % point/<name>/execute at end, where <name> is the name of
+ % the visualizer, should store code that is to be executed directly
+ % before and after the stream of coordinates is created. Typically,
+ % these keys will store commands to use the path created by the plot
+ % handler.
+
+ \attribute handlers;
+ % The to-be-used handlers
+
+ \attribute name;
+ % Filter code
+
+ \attribute filter=\pgfdvnamedvisualizerfilter;
+ % Filter code
+
+ \attribute positions;
+ % An internal protocol of the positions on the stream
+
+ \attribute cache;
+ % An internal cache. Positions are first inserted into this
+ % cache. Every 100 steps this cache is moved to positions. The idea
+ % behind this is that it will avoid the quadratic time increase that
+ % is normally caused when a protocol is build in TeX.
+
+
+ % Constructor
+ %
+ % #1 = A name
+ % #2 = A comma-separated list of handlers like
+ % "\pgfplothandlerlineto,\pgfplothandlercurveto"
+ %
+ \method plot handler visualizer(#1,#2) {
+ \pgfooset{name}{#1}
+ \pgfooset{handlers}{#2}
+ }
+
+ % Method
+ \method default connects() {
+ \pgfoothis.get handle(\pgf@dv@me)
+ \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,protocol,visualize datapoint signal)
+ \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,phase,phase signal)
+ }
+
+ % Setter
+ \method set filter(#1) {
+ \pgfooset{filter}{#1}
+ }
+
+ % Slot
+ \method protocol() {
+ \pgfdvfilterpassedtrue
+ \pgfoovalueof{filter}
+ \ifpgfdvfilterpassed%
+ \pgf@dv@line@cache@it
+ \fi%
+ }
+
+ \def\pgf@dv@line@cache@it{
+ % Cache it
+ \pgfooget{cache}\pgf@dv@cache
+ \edef\pgf@dv@add{\noexpand\pgf@dv@ph{\pgfkeysvalueof{/data point/canvas x}}{\pgfkeysvalueof{/data point/canvas y}}}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\pgf@dv@cache%
+ \expandafter\expandafter\expandafter{\expandafter\pgf@dv@cache\pgf@dv@add}%
+ % Possibly flush cache
+ \global\advance\pgf@lib@dv@cache@count by1\relax%
+ \ifnum\pgf@lib@dv@cache@count=100\relax%
+ \global\pgf@lib@dv@cache@count=0\relax%
+ % Append cache to positions
+ \pgfooget{positions}\pgf@dv@temp
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\pgf@dv@temp%
+ \expandafter\expandafter\expandafter{\expandafter\pgf@dv@temp\pgf@dv@cache}%
+ \pgfoolet{positions}\pgf@dv@temp
+ \let\pgf@dv@cache\pgfutil@empty
+ \fi
+ \pgfoolet{cache}\pgf@dv@cache
+ }
+
+ % Slot
+ \method phase(#1) {%
+ \ifx#1\pgfdvendvisualization%
+ \pgfoothis.render()%
+ \fi%
+ }
+
+ % Internal method
+ \method render() {
+ \pgfscope
+ \pgfooget{handlers}\tikz@dv@temp@list
+ \foreach\tikz@dv@temp in\tikz@dv@temp@list{
+ \ifx\tikz@dv@temp\pgfutil@empty
+ \else
+ \pgfkeysvalueof{/data point/\pgfoovalueof{name}/execute at begin}
+ \tikz@dv@temp
+ \pgfplotstreamstart
+ \pgfoovalueof{positions}
+ \pgfoovalueof{cache}
+ \pgfplotstreamend
+ \pgfkeysvalueof{/data point/\pgfoovalueof{name}/execute at end}
+ \fi
+ }
+ \endpgfscope
+ \pgfoolet{positions}\pgfutil@empty
+ \pgfoolet{cache}\pgfutil@empty
+ }
+
+ \def\pgf@dv@ph#1#2{\pgfplotstreampoint{\pgfqpoint{#1}{#2}}}
+}
+
+\newcount\pgf@lib@dv@cache@count
+
+
+% A possible filter for unnamed visualizers
+%
+% #1 = Text to be compared with key /data point/visualizer
+%
+% Description:
+%
+% In a data visualization with multiple visualizers, data points
+% typically "belong" only to a single visualizer. It is, thus,
+% necessary to filter data points accoring to the current
+% visualizer. This current visualizer is assumed to be stored in /data
+% point/visualizer.
+%
+% When objects allow you to set a filter, you can use this filter to
+% test against /data point/visualizer being equal to #1.
+
+\def\pgfdvvisualizerfilter#1{%
+ \pgfkeysgetvalue{/data point/visualizer}\pgf@dv@visualizer%
+ \def\pgf@temp{#1}%
+ \ifx\pgf@temp\pgf@dv@visualizer%
+ \else
+ \pgfdvfilterpassedfalse
+ \fi%
+}
+
+
+
+% A filter for named visualizer
+%
+% Description:
+%
+% This filter works like \pgfdvvisualizerfilter, only it assumes the
+% the object defines a "name" attribute. In this case, the value of
+% /data point/visualizer is tested against this attribute.
+
+\def\pgfdvnamedvisualizerfilter{%
+ \pgfkeysgetvalue{/data point/visualizer}\pgf@dv@visualizer%
+ \pgfooget{name}\pgf@temp%
+ \ifx\pgf@temp\pgf@dv@visualizer%
+ \else
+ \pgfdvfilterpassedfalse
+ \fi%
+}
+
+
+
+\pgfooclass{rectangle visualizer}
+{
+ % Class rectangle visualizer
+ %
+ % This visualizer visualizes a datapoint as a rectangle. It needs
+ % two attributes a1 and a2, each of which must have min and max
+ % subattributes. Then, it draws a rectangle between (a1/min,a2/min)
+ % and (a1/max,a2/max).
+
+ \attribute attribute 1;
+ \attribute attribute 2;
+ % The attributes
+
+ \attribute use path attribute;
+ % The attribute that stores the to-be-taken action
+
+
+ % Constructor
+ %
+ % #1 = first attribute
+ % #2 = second attribute
+ %
+ \method rectangle visualizer(#1,#2,#3) {
+ \pgfooset{attribute 1}{#1}
+ \pgfooset{attribute 2}{#2}
+ \pgfooset{use path attribute}{#3}
+ }
+
+ % Method
+ \method default connects() {
+ \pgfoothis.get handle(\pgf@dv@me)
+ \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,visualize,visualize datapoint signal)
+ }
+
+ % Slot
+ \method visualize() {
+ {
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{attribute 1}/min}\pgf@dv@amin
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{attribute 1}/max}\pgf@dv@amax
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{attribute 2}/min}\pgf@dv@bmin
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{attribute 2}/max}\pgf@dv@bmax
+ \ifx\pgf@dv@amin\relax\else\ifx\pgf@dv@amin\pgfutil@empty\else
+ \ifx\pgf@dv@bmin\relax\else\ifx\pgf@dv@bmin\pgfutil@empty\else
+ \ifx\pgf@dv@amax\relax\else\ifx\pgf@dv@amax\pgfutil@empty\else
+ \ifx\pgf@dv@bmax\relax\else\ifx\pgf@dv@bmax\pgfutil@empty\else
+ \pgfkeyssetvalue{/data point/\pgfoovalueof{attribute 1}}{\pgf@dv@amin}
+ \pgfkeyssetvalue{/data point/\pgfoovalueof{attribute 2}}{\pgf@dv@bmin}
+ \pgfpathdvmoveto
+ \pgfkeyssetvalue{/data point/\pgfoovalueof{attribute 2}}{\pgf@dv@bmax}
+ \pgfpathdvlineto
+ \pgfkeyssetvalue{/data point/\pgfoovalueof{attribute 1}}{\pgf@dv@amax}
+ \pgfpathdvlineto
+ \pgfkeyssetvalue{/data point/\pgfoovalueof{attribute 2}}{\pgf@dv@bmin}
+ \pgfpathdvlineto
+ \pgfkeyssetvalue{/data point/\pgfoovalueof{attribute 1}}{\pgf@dv@amin}
+ \pgfpathdvlineto
+ \pgfpathclose
+ \pgfkeysvalueof{/data point/\pgfoovalueof{use path attribute}}
+ \fi\fi
+ \fi\fi
+ \fi\fi
+ \fi\fi
+ }
+ }
+}
+
+\newcount\pgf@lib@dv@cache@count
+
+
+
+%
+% Label positioning classes
+%
+
+\pgfooclass{label visualizer}
+{
+ % Class label visualizer
+ %
+ % The job of this class is to visualize a label of a curve or some
+ % other object.
+ %
+ % The idea is as follows: This class monitors a certain
+ % attribute. When this attribute reaches a certain value for the
+ % first time, the following happens: A normalized vector of the line
+ % connecting the current canvas position to the canvas position of
+ % the previous data point is computed and stored in pgf@x/pgf@y. The
+ % coordinate system is shifted so that the current data point is at
+ % the origin. Then, some drawing code is executed.
+
+ \attribute attribute;
+ % The monitored attribute
+
+ \attribute filter;
+ % Filter code, see plot handler visualizer doc.
+
+ \attribute threshold;
+ % When the attribute exceeds this threshold, the drawing code is
+ % executed
+
+ \attribute before canvas position=;
+ % Stores canvas position of the data point before the interesting one
+
+ \attribute canvas position=;
+ % Stores canvas position of the data point
+
+ \attribute code;
+ % To-be-executed code when the label should be drawn
+
+
+ % Constructor
+ %
+ % #1 = attribute
+ % #2 = a macro, storing the threshold
+ % #3 = code
+ % #4 = filter code
+ %
+ \method label visualizer(#1,#2,#3,#4) {
+ \pgfooset{attribute}{#1}
+ \ifx#2\pgfutil@empty
+ \else
+ \pgfdvmathenter{\pgf@temp}{#2}
+ \fi
+ \pgfoolet{threshold}\pgf@temp
+ \pgfooset{code}{#3}
+ \pgfooset{filter}{#4}
+ }
+
+ % Method
+ \method default connects() {
+ \pgfoothis.get handle(\pgf@dv@me)
+ \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,test,visualize datapoint signal)
+ \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,phase,phase signal)
+ }
+
+ % Slot
+ \method test() {
+ \pgfdvfilterpassedtrue
+ \pgfoovalueof{filter}
+ \ifpgfdvfilterpassed%
+ \pgfooget{attribute}\pgf@dv@attribute
+ \ifx\pgf@dv@attribute\pgfutil@empty%
+ % nothing to do (anymore)
+ \else%
+ \pgf@dv@label@vis@record
+ \fi%
+ \fi%
+ }
+
+ \def\pgf@dv@label@vis@record{
+ % Record current position
+ \edef\pgf@dv@pos{%
+ \noexpand\pgfqpoint%
+ {\pgfkeysvalueof{/data point/canvas x}}%
+ {\pgfkeysvalueof{/data point/canvas y}}}%
+ \pgfooget{canvas position}\pgf@dv@temp%
+ \pgfoolet{before canvas position}\pgf@dv@temp%
+ \pgfoolet{canvas position}\pgf@dv@pos%
+ % Now check threshold
+ \pgfooget{threshold}\pgf@dv@thres%
+ \ifx\pgf@dv@thres\pgfutil@empty%
+ \else%
+ % Hmm, have to check, whether the value is, indeed, correct
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{attribute}}\pgf@dv@val
+ \ifx\pgf@dv@val\relax%
+ \else\ifx\pgf@dv@val\pgfutil@empty%
+ \else%
+ \pgfdvmathenter{\pgf@dv@value}{\pgf@dv@val}%
+ \pgfooget{threshold}{\pgf@dv@thres}
+ % Now, protocol value
+ \pgfdvmathifless{\pgf@dv@value}{\pgf@dv@thres}{}{%
+ \pgfoolet{attribute}\pgfutil@empty% Stop!
+ }%
+ \fi\fi%
+ \fi%
+ }
+
+ % Slot
+ \method phase(#1) {%
+ \ifx#1\pgfdvendvisualization%
+ \scope
+ \pgfcoordinate{label visualizer coordinate}{\pgfoovalueof{canvas position}}
+ \pgfcoordinate{label visualizer coordinate'}{\pgfoovalueof{before canvas position}}
+ \pgfoovalueof{code}
+ \endscope
+ \fi%
+ }
+
+}
+
+
+
+%
+% Style sheets
+%
+\pgfooclass{style attribute}
+{
+ % Class style attribute
+ %
+ % Instances of this class are used to select a style based on the
+ % current value of an attribute.
+ %
+ % Instances of this class monitor an attribute. Whenever the "style"
+ % signal is raised, the object investigates the current value of the
+ % attribute. It then looks up /pgf/data visualization/style
+ % sheets/<name of style sheet>/<value of the attribute> and executes
+ % this key, provided it is defined. If it not defined, the key
+ % /pgf/data visualization/style sheets/<name of style sheet>/default
+ % style is executed with the value as a parameter.
+
+ \attribute attribute;
+ % The name of the attribute
+
+ \attribute style sheet name;
+ % The styling function
+
+ % Constructor
+ %
+ % #1 = attribute (including, if present, /data point/)
+ % #2 = style sheet name
+ %
+ \method style attribute(#1,#2) {
+ \pgfooset{attribute}{#1}
+ \pgfooset{style sheet name}{#2}
+ }
+
+ % Method
+ \method default connects() {
+ \pgfoothis.get handle(\pgf@dv@me)
+ \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,invoke style,style signal)
+ }
+
+ % Slots
+ \method invoke style() {
+ \pgfooget{attribute}\pgf@dv@temp
+ \pgfkeysgetvalue{\pgf@dv@temp}\pgf@dv@temp@val
+ \ifx\pgf@dv@temp@val\pgfutil@empty%do nothing
+ \else\ifx\pgf@dv@temp@val\relax%do nothing
+ \else%
+ \pgfkeysifdefined{\pgf@dv@temp/\pgf@dv@temp@val}{\pgfkeysgetvalue{\pgf@dv@temp/\pgf@dv@temp@val}\pgf@dv@temp@val}{}% redirect
+ \edef\pgf@temp{/pgf/data visualization/style sheets/\pgfoovalueof{style sheet name}}
+ \pgfkeysifassignable{\pgf@temp/\pgf@dv@temp@val}{%
+ \pgfkeysalso{\pgf@temp/\pgf@dv@temp@val}}{%
+ \pgfkeysalso{\pgf@temp/default style/.expand once=\pgf@dv@temp@val}
+ }
+ \fi\fi%
+ }
+}
+
+
+% Declares a new style sheet
+%
+% #1 = name of style sheet
+% #2 = settings
+%
+% Description:
+%
+% This is a shortcut for doing a /.cd to /pgf/data visualization/style sheets/#1
+
+\def\pgfdvdeclarestylesheet#1#2{
+ \pgfkeys{/pgf/data visualization/style sheets/#1/.cd,#2}
+}
+
+
+
+
+
+
+
+
+
+%
+% Legend container class
+%
+
+\pgfooclass{legend}
+{
+ % Class legend
+ %
+ % This class is used to collect entries into a legend. The idea is
+ % that, say, for each line of a picture you would like to have an
+ % entry in a legend. Then you prepare these entries and send
+ % them to a legend container object. It will collect the entries
+ % and, at the end, arrange them in rows and columns by
+ % separating them using \pgfdvnextcell and \pgfdvendrow.
+ %
+ % By surrounding the resulting arrangement by a call to \pgfmatrix or
+ % a call to \halign you can then create a legend.
+ %
+ % To specify how the entries should be arranged, a size
+ % specification and two directions are needed.
+ %
+ % For the size specification you specify either the ideal number of
+ % columns and the maximum number of rows or you specify the ideal
+ % number of rows and the maximum number of columns. In the first
+ % case, the class first tries to create as many columns as specified
+ % by the "ideal" parameter. If there are less entries than this
+ % parameter, you obviously get less columns, namely as many as there
+ % are entries, each column containing only one entry. If there are
+ % more entries that the ideal number of columns, you get multiple
+ % columns, each containing as many entries to make sure that the
+ % ideal number is met. However, if a column would get more than the
+ % specified maximum number of elements per column, you get more
+ % columns that the ideal number -- to ensure that no column contains
+ % more than the desired number. The case is symmetric, but with the
+ % roles of columns and rows exchanged.
+ %
+ % Here is an example: You specify that you want 2 columns, ideally,
+ % each having a maximum of 4 entries. Here is what you would get:
+ %
+ % Number of entries & Number of resulting columns ... & ... and rows
+ % 1 & 1 & 1
+ % 2 & 2 & 1
+ % 3 & 2 & 2
+ % 4 & 2 & 2
+ % 5 & 2 & 3
+ % 6 & 2 & 3
+ % 7 & 2 & 4
+ % 8 & 2 & 4
+ % 9 & 3 & 4
+ % 10 & 3 & 4
+ % 11 & 3 & 4
+ % 12 & 3 & 4
+ % 13 & 4 & 4
+ %
+ %
+ % Once the number of columns and rows has been computed, the next
+ % step is to "fill" the table. For this, eight strategies may be
+ % specified: right then down, right then up, left then down, left
+ % then up, up then right, up then left, down then right, down then
+ % left. A strategy like "right then up" means the following: Each
+ % new entry should placed right of the previous entry in the
+ % arrangement. However, once the maximum number of elements in a row
+ % has been reached, the a new row should be started that is placed
+ % above ("up") then just-assembled row.
+ %
+ %
+ %
+ %
+ % Example:
+ %
+ % You create an object \legend and then call
+ %
+ % \pgfoofnew \legend=new legend(columns,2,3,down then right)
+ % \legend.add entry(first)
+ % \legend.add entry(second)
+ % \legend.add entry(third)
+ % \legend.add entry(fourth)
+ % \legend.add entry(fifth)
+ % \legend.add entry(sixth)
+ % \legend.add entry(seventh)
+ % \legend.get arrangment(\arrangement)
+ %
+ % Then \arrangment will expand to
+ %
+ % first \pgfdvnextcell fourth \pgfdvnextcell seventh \pgfdvendrow
+ % second \pgfdvnextcell fifth \pgfdvnextcell third \pgfdvendrow
+ % third \pgfdvendrow sixth \pgfdvnextcell \pgfdvendrow
+ %
+ % By saying \let\pgfdvendrow=\\ and \let\pgfdvnextcell=&, you
+ % can use \arrangment inside a table.
+
+
+ \attribute entries;
+ % Collectes the entries
+
+ \attribute columns or rows;
+ % Specifies whether columns or rows are specified
+
+ \attribute ideal;
+ % The ideal number of columns/rows
+
+ \attribute max;
+ % The maximum number of entries per column/row
+
+ \attribute strategy;
+ % Specifies how the matrix should be filled
+
+ \attribute number of entries=0;
+ % Counts the number of entries that have been stored
+
+
+ % Constructor
+ %
+ % #1 = "columns" or "rows" -> specifies whether the ideal number and
+ % the max entries number refer to columns or the row
+ % #2 = the ideal number of #1's
+ % #3 = the maximum number of entries in a #1
+ % #4 = one of the eight strategies
+ %
+ \method legend(#1,#2,#3,#4) {
+ \pgfooset{columns or rows}{#1}
+ \pgfooset{ideal}{#2}
+ \pgfooset{max}{#3}
+ \pgfooset{strategy}{#4}
+ }
+
+ % Method
+ \method add entry(#1) {
+ \pgfooappend{entries}{{#1}}
+ \c@pgf@counta=\pgfoovalueof{number of entries}\relax%
+ \advance\c@pgf@counta by1\relax%
+ \pgfooeset{number of entries}{\the\c@pgf@counta}
+ }
+
+ % Method
+ \method get arrangement(#1) {
+ {
+ %
+ % Step 1: Compute the desired number of rows or columns
+ %
+ %
+ % Compute the ideal number of entries per row/column (called
+ % "target" in the following) and entries per colum/row (called
+ % "per target" in the following)
+ %
+ % if (number of entries > ideal)
+ \ifnum\pgfoovalueof{number of entries}>\pgfoovalueof{ideal}\relax%
+ % {
+ % if (ideal * max > number of entries)
+ \c@pgf@counta=\pgfoovalueof{ideal}\relax%
+ \multiply\c@pgf@counta by\pgfoovalueof{max}\relax%
+ \ifnum\c@pgf@counta>\pgfoovalueof{number of entries}\relax
+ % {
+ % target = ideal;
+ % per target = ceil (number of entries / ideal);
+ \c@pgf@counta=\pgfoovalueof{ideal}\relax%
+ \c@pgf@countb=\pgfoovalueof{number of entries}\relax
+ \advance\c@pgf@countb by-1\relax
+ \divide\c@pgf@countb by\c@pgf@counta\relax%
+ \advance\c@pgf@countb by1\relax%
+ % }
+ % else
+ % {
+ % target = ceil(number of entries / max);
+ % per target = max;
+ \else
+ \c@pgf@countb=\pgfoovalueof{max}\relax%
+ \c@pgf@counta=\pgfoovalueof{number of entries}\relax
+ \advance\c@pgf@counta by-1\relax
+ \divide\c@pgf@counta by\c@pgf@countb\relax%
+ \advance\c@pgf@counta by1\relax%
+ \fi
+ % }
+ % }
+ % else
+ % {
+ % target = number of entries;
+ % per target = 1;
+ % }
+ \else
+ \c@pgf@counta=\pgfoovalueof{number of entries}\relax%
+ \c@pgf@countb=1\relax%
+ \fi%
+ %
+ % Ensure that counta = rows, countb = columns
+ %
+ \pgfooget{columns or rows}\pgf@temp
+ \ifx\pgf@temp\pgf@dv@columnstext%
+ \c@pgf@countc=\c@pgf@counta\relax
+ \c@pgf@counta=\c@pgf@countb\relax
+ \c@pgf@countb=\c@pgf@countc\relax
+ \fi
+ \edef\temp{rows: \the\c@pgf@counta, columns: \the\c@pgf@countb}\temp
+ %
+ % Now arrange the matrix
+ %
+ \csname pgf@dv@legend@init@\pgfoovalueof{strategy}\endcsname
+ \expandafter\let\expandafter\pgf@dv@updater\csname pgf@dv@legend@update@\pgfoovalueof{strategy}\endcsname
+ \pgfooget{entries}\pgf@temp
+ \expandafter\pgf@dv@legend@arrange\pgf@temp\pgf@stop
+ %
+ % Now assemble the matrix
+ %
+ \edef\pgf@dv@row@list{1,...,\the\c@pgf@counta}
+ \edef\pgf@dv@column@list{1,...,\the\c@pgf@countb}
+ \global\let\pgf@dv@matrix\pgfutil@empty
+ \foreach \pgf@dv@row in \pgf@dv@row@list
+ {
+ \global\let\pgf@dv@matrix@row\pgf@dv@first@mark
+ \foreach \pgf@dv@column in \pgf@dv@column@list
+ {
+ \expandafter\let\expandafter\pgf@temp\csname pgf@dv@legend@entry@\pgf@dv@row @\pgf@dv@column\endcsname
+ \ifx\pgf@temp\relax
+ \let\pgf@temp\pgfutil@empty
+ \fi
+ \ifx\pgf@dv@matrix@row\pgf@dv@first@mark
+ \global\let\pgf@dv@matrix@row\pgf@temp
+ \else
+ \expandafter\pgfutil@g@addto@macro\expandafter\pgf@dv@matrix@row\expandafter{\expandafter\pgfdvnextcell\pgf@temp}
+ \fi
+ }
+ \pgfutil@g@addto@macro\pgf@dv@matrix@row{\pgfdvendrow}
+ \expandafter\pgfutil@g@addto@macro\expandafter\pgf@dv@matrix\expandafter{\pgf@dv@matrix@row}
+ }
+ \global\let\pgf@dv@matrix@row\relax
+ }
+ \let#1\pgf@dv@matrix
+ \global\let\pgf@dv@matrix\relax
+ }
+
+ \def\pgf@dv@first@mark{\pgf@dv@first@mark}
+
+ \def\pgf@dv@legend@arrange{%
+ \pgfutil@ifnextchar\pgf@stop{\pgfutil@gobble}{\pgf@dv@legend@handle@entry}
+ }
+
+ \def\pgf@dv@legend@handle@entry#1{
+ \expandafter\def\csname pgf@dv@legend@entry@\the\c@pgf@countc @\the\c@pgf@countd\endcsname{#1}%
+ \pgf@dv@updater%
+ \pgf@dv@legend@arrange%
+ }
+
+ \expandafter\def\csname pgf@dv@legend@init@down then right\endcsname{%
+ \c@pgf@countc=1\relax%
+ \c@pgf@countd=1\relax%
+ }
+
+ \expandafter\def\csname pgf@dv@legend@update@down then right\endcsname{%
+ \advance\c@pgf@countc by1\relax
+ \ifnum\c@pgf@countc>\c@pgf@counta\relax%
+ \c@pgf@countc=1\relax%
+ \advance\c@pgf@countd by1\relax%
+ \fi%
+ }
+
+ \expandafter\def\csname pgf@dv@legend@init@right then down\endcsname{%
+ \c@pgf@countc=1\relax%
+ \c@pgf@countd=1\relax%
+ }
+
+ \expandafter\def\csname pgf@dv@legend@update@right then down\endcsname{%
+ \advance\c@pgf@countd by1\relax
+ \ifnum\c@pgf@countd>\c@pgf@countb\relax%
+ \c@pgf@countd=1\relax%
+ \advance\c@pgf@countc by1\relax%
+ \fi%
+ }
+
+ \expandafter\def\csname pgf@dv@legend@init@up then right\endcsname{%
+ \c@pgf@countc=\c@pgf@counta\relax%
+ \c@pgf@countd=1\relax%
+ }
+
+ \expandafter\def\csname pgf@dv@legend@update@up then right\endcsname{%
+ \advance\c@pgf@countc by-1\relax
+ \ifnum\c@pgf@countc=0\relax%
+ \c@pgf@countc=\c@pgf@counta\relax%
+ \advance\c@pgf@countd by1\relax%
+ \fi%
+ }
+
+ \expandafter\def\csname pgf@dv@legend@init@right then up\endcsname{%
+ \c@pgf@countc=\c@pgf@counta\relax%
+ \c@pgf@countd=1\relax%
+ }
+
+ \expandafter\def\csname pgf@dv@legend@update@right then up\endcsname{%
+ \advance\c@pgf@countd by1\relax
+ \ifnum\c@pgf@countd>\c@pgf@countb\relax%
+ \c@pgf@countd=1\relax%
+ \advance\c@pgf@countc by-1\relax%
+ \fi%
+ }
+
+ \expandafter\def\csname pgf@dv@legend@init@left then up\endcsname{%
+ \c@pgf@countc=\c@pgf@counta\relax%
+ \c@pgf@countd=\c@pgf@countb\relax%
+ }
+
+ \expandafter\def\csname pgf@dv@legend@update@left then up\endcsname{%
+ \advance\c@pgf@countd by-1\relax
+ \ifnum\c@pgf@countd=0\relax%
+ \c@pgf@countd=\c@pgf@countb\relax%
+ \advance\c@pgf@countc by-1\relax%
+ \fi%
+ }
+
+ \expandafter\def\csname pgf@dv@legend@init@up then left\endcsname{%
+ \c@pgf@countc=\c@pgf@counta\relax%
+ \c@pgf@countd=\c@pgf@countb\relax%
+ }
+
+ \expandafter\def\csname pgf@dv@legend@update@up then left\endcsname{%
+ \advance\c@pgf@countc by-1\relax
+ \ifnum\c@pgf@countc=0\relax%
+ \c@pgf@countc=\c@pgf@counta\relax%
+ \advance\c@pgf@countd by-1\relax%
+ \fi%
+ }
+
+ \expandafter\def\csname pgf@dv@legend@init@left then down\endcsname{%
+ \c@pgf@countc=1\relax%
+ \c@pgf@countd=\c@pgf@countb\relax%
+ }
+
+ \expandafter\def\csname pgf@dv@legend@update@left then down\endcsname{%
+ \advance\c@pgf@countd by-1\relax
+ \ifnum\c@pgf@countd=0\relax%
+ \c@pgf@countd=\c@pgf@countb\relax%
+ \advance\c@pgf@countc by1\relax%
+ \fi%
+ }
+
+ \expandafter\def\csname pgf@dv@legend@init@down then left\endcsname{%
+ \c@pgf@countc=1\relax%
+ \c@pgf@countd=\c@pgf@countb\relax%
+ }
+
+ \expandafter\def\csname pgf@dv@legend@update@down then left\endcsname{%
+ \advance\c@pgf@countc by1\relax
+ \ifnum\c@pgf@countc>\c@pgf@countb\relax%
+ \c@pgf@countc=1\relax%
+ \advance\c@pgf@countd by-1\relax%
+ \fi%
+ }
+
+ \def\pgf@dv@columnstext{columns}
+}
+
+
+
+%
+% Help classes
+%
+
+\pgfooclass{interval}
+{
+ % Class interval
+ %
+ % Instances of this class store intervals. When either the min or
+ % the max value is empty, this corresponds to "not yet set", (not to
+ % "infinity).
+
+ \attribute min;
+ % The minimum value of the interval
+
+ \attribute max;
+ % The maximum value of the interval
+
+ % Constructor
+ %
+ % #1 = initial minimum value
+ % #2 = initial maximum value
+ %
+ \method interval(#1,#2) {
+ \pgfooset{min}{#1}
+ \pgfooset{max}{#2}
+ }
+
+ % Method
+ \method default connects() {
+ }
+
+ % Sets the minimum/maximum to a new value
+ \method set min(#1) {
+ \pgfooset{min}{#1}
+ }
+ \method set max(#1) {
+ \pgfooset{max}{#1}
+ }
+
+ % Getter
+ %
+ % Returns the current values of the minimum and maximum in the
+ % macros \pgfdvmin and \pgfdvmax.
+ \method get min and max() {
+ \pgfooget{min}\pgfdvmin
+ \pgfooget{max}\pgfdvmax
+ }
+
+ % Adjusts the mimum and maximum values
+ %
+ % #1 = some code. When this code is executed, the values of
+ % \pgfdvmin and \pgfdvmax will be set to the current values of
+ % the minimum/maximum. The code may change these values. The
+ % changed values will then be stored.
+ %
+ % This method does nothing that cannot be achieved also by calling
+ % set/get methods, but it is easier to use and faster.
+ \method adjust(#1) {
+ {%
+ \pgfooget{min}\pgfdvmin
+ \pgfooget{max}\pgfdvmax
+ #1%
+ \pgfoolet{min}\pgfdvmin
+ \pgfoolet{max}\pgfdvmax
+ }%
+ }
+}
+
+
+
+\pgfooclass{count}
+{
+ % Class count
+ %
+ % This class can be used to count the number of data points that are
+ % present or that have a certain property. By default, for every
+ % data point a counter is incremented and the value of this counter
+ % is stored in an attribute. You can also specify an increment for
+ % the counter and some action that should be taken when the counter
+ % reaches zero. You can also specify that certain data points should
+ % not have an effect on the counter.
+ %
+ % Counters can serve different purposes.
+ %
+ % 1. For plotting points in a table or sequence, the counter can be
+ % used to provide the position along one axis.
+ % 2. By using the counter as a repetitive count down one can for
+ % instance have only every 10th data point be marked.
+
+ \attribute attribute;
+ % The attribute that will be set to the current value of the counter
+
+ \attribute val=0;
+ % The current value of the counter
+
+ \attribute step=1;
+ % The stepping by which the counter is incremented for each
+ % datapoint
+
+ \attribute start val=0;
+ % The start value of the counter
+
+ \attribute filter=;
+ % This attribute stores some code that is executed for each
+ % data point. If the data point sets the TeX-if ifpgfdvfilterpassed to
+ % true, then the counter is not incremented.
+
+
+ % Constructor
+ %
+ % #1 = The attribute in which the counter value is stored
+ %
+ \method count(#1) {
+ \pgfooset{attribute}{#1}
+ }
+
+ % Method
+ \method default connects() {
+ \pgfoothis.get handle(\pgf@dv@me)
+ \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,apply,prepare datapoint signal)
+ \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,phase,phase signal)
+ }
+
+ % Setter
+ \method set value(#1) {
+ \pgfooset{val}{#1}
+ \pgfkeyssetvalue{/data point/\pgfoovalueof{attribute}}{#1}%
+ }
+
+ % Setter
+ \method set start value(#1) {
+ \pgfooset{start val}{#1}
+ }
+
+ % Setter
+ \method set filter(#1) {
+ \pgfooset{filter}{#1}
+ }
+
+ % Setter
+ \method set step(#1) {
+ \pgfooset{step}{#1}
+ }
+
+ % Slot
+ \method apply() {
+ \pgfdvfilterpassedtrue%
+ \pgfoovalueof{filter}%
+ \ifpgfdvfilterpassed%
+ \pgfmathparse{\pgfoovalueof{val}+\pgfoovalueof{step}}%
+ \pgfoolet{val}\pgfmathresult%
+ \pgfkeyslet{/data point/\pgfoovalueof{attribute}}\pgfmathresult%
+ \fi%
+ }
+
+ % Slot
+ \method phase(#1) {
+ \ifx#1\pgfdvbeginsurvey
+ \pgfooeset{val}{\pgfoovalueof{start val}}
+ \else \ifx#1\pgfdvbeginvisualization
+ \pgfooeset{val}{\pgfoovalueof{start val}}
+ \fi\fi
+ }
+}
+
+\newif\ifpgfdvfilterpassed
+
+
+
+
+\pgfooclass{accumulator}
+{
+ % Class accumulator
+ %
+ % This class is used to keep track of the sum of the values of some
+ % attribute. When this object is connected to some attribute, the
+ % subkey attribute/sum will always contain the sum of all values in
+ % all previous data points with respect to this
+ % attribute. Furthermore, the subkey attribute/prev key will hold
+ % the previous sum, which is sometimes also useful to have access
+ % to.
+
+ \attribute attribute;
+ % The attribute to-be-accumulated
+
+ \attribute sum;
+ % The initial value of the sum
+
+ % Constructor
+ %
+ % #1 = to-be-accumulated attribute
+ \method accumulator(#1) {
+ \pgfooset{attribute}{#1}
+ \pgfoothis.reset()
+ }
+
+ % Method
+ \method default connects() {
+ \pgfoothis.get handle(\pgf@dv@me)
+ \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,apply,prepare datapoint signal)
+ \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,phase,phase signal)
+ }
+
+ % Slot
+ \method apply() {%
+ % Save old sum
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{attribute}/sum}\pgf@temp%
+ \pgfkeyslet{/data point/\pgfoovalueof{attribute}/prev sum}\pgf@temp%
+ % Add new attribute...
+ \pgfkeysgetvalue{/data point/\pgfoovalueof{attribute}}{\pgf@temp@b}%
+ \pgfdvmathenter{\pgf@dv@new@val}{\pgf@temp@b}%
+ % ... to sum
+ \pgfooget{sum}\pgf@dv@sum%
+ \pgfdvmathadd{\pgf@dv@sum}{\pgf@dv@new@val}{\pgf@dv@sum}%
+ \pgfoolet{sum}\pgf@dv@sum
+ % Record in attribute
+ \pgfdvmathexitbyscientificformat{\pgf@dv@serial@sum}{\pgf@dv@sum}
+ \pgfkeyslet{/data point/\pgfoovalueof{attribute}/sum}\pgf@dv@serial@sum
+ }
+
+ % Method
+ %
+ % Use this method to reset the sum at any point.
+ %
+ \method reset() {
+ \pgfdvmathenter{\pgf@dv@temp}{0}
+ \pgfoolet{sum}{\pgf@dv@temp}
+ \pgfdvmathexitbyserializing{\pgf@dv@zero}{\pgf@dv@temp}
+ \pgfkeyslet{/data point/\pgfoovalueof{attribute}/prev sum}{\pgf@dv@zero}
+ \pgfkeyslet{/data point/\pgfoovalueof{attribute}/sum}{\pgf@dv@zero}
+ }
+
+ % Slot
+ \method phase(#1) {
+ \ifx#1\pgfdvbeginsurvey
+ \pgfoothis.reset()
+ \else \ifx#1\pgfdvbeginvisualization
+ \pgfoothis.reset()
+ \fi\fi
+ }
+}
+
+
+
+
+
+
+
+%
+%
+% Help keys and, attributes
+%
+%
+
+\pgfkeys{% do not even think of changing the values of the following:
+ /data point/always true/.initial=true,
+ /data point/always false/.initial=false,
+ /data point/always 0/.initial=0,
+ /data point/always 1/.initial=1,
+ /data point/always empty/.initial=,
+ /data point/always pgfusepath stroke/.initial=\pgfusepath{stroke}
+}
+
+\pgfdvmathenter{\pgfdvmathalwaysloge}{0.434294481903252}
+\pgfdvmathenter{\pgfdvmathalwayslnten}{2.302585092994046}
+\pgfdvmathenter{\pgfdvmathalwayszero}{0}
+\pgfdvmathenter{\pgfdvmathalwaysone}{1}
+
+
+\endinput
+
+
+
+
+
+
diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledecorations.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledecorations.code.tex
index 739a28395c2..9834e91f0ec 100644
--- a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledecorations.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledecorations.code.tex
@@ -1,4 +1,4 @@
-% Copyright 2008 by Mark Wibrow
+% Copyright 2008 by Mark Wibrow and Till Tantau
%
% This file may be distributed and/or modified
%
@@ -57,10 +57,11 @@
start radius/.initial=2.5pt,
end radius/.initial=2.5pt,
radius/.style={start radius=#1,end radius=#1},
- path has corners/.is if=pgfdecoratepathhascorners
+ path has corners/.is if=pgfdecoratepathhascorners,
+ reverse path/.is if=pgf@decorate@inputsegmentobjects@reverse
}
\newif\ifpgfdecoratepathhascorners
-
+\newif\ifpgf@decorate@inputsegmentobjects@reverse
% Declare a decoration
%
@@ -490,6 +491,7 @@
}
+
% Enviroment \pgfmetadecoration \endpgfmetadecoration
%
% Decorate a path with decoration automatons!
@@ -539,12 +541,12 @@
% \endpgfpicture
%
\def\pgfmetadecoration#1{%
- \begingroup%
- \let\decoration\pgf@metadecoration@decoration%
- \let\beforedecoration\pgf@metadecoration@beforedecoration%
- \let\afterdecoration\pgf@metadecoration@afterdecoration%
- \def\pgf@metadecoration@name{#1}%
- \pgf@decoration@env%
+ \begingroup%
+ \let\decoration\pgf@metadecoration@decoration%
+ \let\beforedecoration\pgf@metadecoration@beforedecoration%
+ \let\afterdecoration\pgf@metadecoration@afterdecoration%
+ \def\pgf@metadecoration@name{#1}%
+ \pgf@decoration@env%
}
\def\endpgfmetadecoration{%
@@ -611,6 +613,21 @@
\bgroup%
}
+\def\pgf@decorate@path@check@moveto#1{%
+ \expandafter\pgf@decorate@path@@check@moveto#1\pgf@decorate@stop\pgf@decorate@@stop}
+
+\def\pgf@decorate@token@stop{\pgf@decorate@stop}%
+\def\pgf@decorate@path@@check@moveto#1#2#3#4\pgf@decorate@@stop#5#6{%
+ \def\pgf@decorate@temp{#4}%
+ \pgf@x=#2\relax%
+ \pgf@y=#3\relax%
+ \ifx\pgf@decorate@temp\pgf@decorate@token@stop%
+ #5%
+ \else%
+ #6%
+ \fi%
+}
+
\def\pgf@decoration@endenv{%
\egroup%
\pgftransformreset%
@@ -623,6 +640,18 @@
\ifx\pgfdecoratedpath\pgfutil@empty%
\PackageError{PGF}{I cannot decorate an empty path}{}%
\else%
+ %
+ % If the path consists of a single moveto token, make it
+ % a very small horizontal line.
+ %
+ \pgf@decorate@path@check@moveto\pgfdecoratedpath{%
+ \advance\pgf@x by0.0001pt\relax%
+ \edef\pgfdecoratedpath{%
+ \expandafter\noexpand\pgfdecoratedpath%
+ \noexpand\pgfsyssoftpath@linetotoken{\the\pgf@x}{\the\pgf@y}%
+ }%
+ }%
+ {}%
%
% Remove special round tokens and get points.
%
@@ -631,6 +660,16 @@
% Parse the soft path into a series of decorated input segment objects.
%
\pgf@decorate@parsesoftpath{\pgfdecoratedpath}{\pgf@decorate@inputsegmentobjects}%
+ %
+ % Setup further options
+ %
+ \pgfkeys{/pgf/every decoration/.try}%
+ %
+ % Reverse objects if necessary.
+ %
+ \ifpgf@decorate@inputsegmentobjects@reverse%
+ \pgf@decorate@inputsegmentobjects@reverse{\pgf@decorate@inputsegmentobjects}{\pgf@decorate@inputsegmentobjects}%
+ \fi%
%
\let\pgf@decorated@remainingdistance\pgf@decorate@totalpathlength%
%
@@ -647,13 +686,8 @@
\pgf@decorate@getnextinputsegmentobject\pgf@decorate@nextinputsegmentobject%
\pgf@decorate@processnextinputsegmentobject%
\pgf@decorate@distancetomove0pt\relax%
- %
- % Setup further options
- %
- \pgfkeys{/pgf/every decoration/.try}%
\fi%
-}%
-
+}%
@@ -1194,25 +1228,24 @@
% Process the next input segment object.
%
\def\pgf@decorate@processnextinputsegmentobject{%
- %
+ \let\pgfdecorationpreviousinputsegment\pgfdecoratecurrentinputsegment%
\let\pgf@decorate@currentinputsegmentobject\pgf@decorate@nextinputsegmentobject%
\pgf@decorate@getnextinputsegmentobject\pgf@decorate@nextinputsegmentobject%
- %
+ %
% If the current input segment object is a moveto, execute the
% object macro and get the next input segment object.
%
- \expandafter\pgfutil@in@\expandafter\pgf@decorate@inputsegmentobject@moveto%
- \expandafter{\pgf@decorate@currentinputsegmentobject}%
- \ifpgfutil@in@%
- \pgf@decorate@currentinputsegmentobject%
+ \pgf@decorate@is@closepath@false%
+ \pgf@decorate@currentinputsegmentobject%
+ \ifx\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentmoveto%
+ \pgfpathmoveto{\pgf@decorate@inputsegment@first}%
+ \let\pgfdecorationpreviousinputsegment\pgfdecorationcurrentinputsegment%
\let\pgf@decorate@currentinputsegmentobject\pgf@decorate@nextinputsegmentobject%
\pgf@decorate@getnextinputsegmentobject\pgf@decorate@nextinputsegmentobject%
- \relax%
+ \pgf@decorate@is@closepath@false%
+ \pgf@decorate@currentinputsegmentobject%
\fi%
%
- \pgf@decorate@is@closepath@false%
- \pgf@decorate@currentinputsegmentobject%
- %
% Teensy hack in case a path goes nowhere.
%
\ifdim\pgfdecoratedinputsegmentlength=0pt\relax%
@@ -1221,8 +1254,41 @@
\pgfdecoratedinputsegmentremainingdistance\pgfdecoratedinputsegmentlength\relax%
\pgfdecoratedinputsegmentcompleteddistance0pt\relax%
\def\pgf@decorate@inputsegmenttime{0}%
- \pgfmathanglebetweenpoints{\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@supporta}%
- \let\pgfdecoratedangle\pgfmathresult%
+ %
+ % Get the angle at the start of the input segment.
+ %
+ \ifx\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentcurveto%
+ \pgfmathanglebetweenpoints{\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@supporta}%
+ \let\pgfdecoratedangle\pgfmathresult%
+ \let\pgfdecoratedinputsegmentstartangle\pgfmathresult%
+ \pgfmathanglebetweenpoints{\pgf@decorate@inputsegment@supportb}{\pgf@decorate@inputsegment@last}%
+ \let\pgfdecoratedinputsegmentendangle\pgfmathresult%
+ \else%
+ \pgfmathanglebetweenpoints{\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@last}%
+ \let\pgfdecoratedangle\pgfmathresult%
+ \let\pgfdecoratedinputsegmentstartangle\pgfmathresult%
+ \let\pgfdecoratedinputsegmentendangle\pgfmathresult%
+ \fi%
+ %
+ % Get the angle to the next input segment.
+ %
+ \begingroup%
+ \pgf@decorate@nextinputsegmentobject%
+ \global\let\pgf@decorate@temp\pgfdecorationcurrentinputsegment%
+ \ifx\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentmoveto%
+ \expandafter\pgf@decorate@currentinputsegmentobject%
+ \fi%
+ \ifx\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentcurveto%
+ \pgfmathanglebetweenpoints{\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@supporta}%
+ \else%
+ \pgfmathanglebetweenpoints{\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@last}%
+ \fi%
+ \pgf@x-\pgfdecoratedangle pt\relax%
+ \advance\pgf@x\pgfmathresult pt\relax%
+ \edef\pgfdecoratedangletonextinputsegment{\the\pgf@x}%
+ \pgfmath@smuggleone\pgfdecoratedangletonextinputsegment%
+ \endgroup%
+ \let\pgfdecorationnextinputsegmentobject\pgf@decorate@temp%
}
@@ -1232,18 +1298,30 @@
\newif\ifpgf@decorate@is@closepath@%
+% Input segment types.
+%
+% These allow comparison with \ifx using
+%
+% \pgfdecorationcurrentinputsegment
+% \pgfdecorationnextinputsegment
+% \pgfdecorationcurrentprevioussegment
+%
+\def\pgfdecorationinputsegmentmoveto{moveto}
+\def\pgfdecorationinputsegmentlineto{lineto}
+\def\pgfdecorationinputsegmentcurveto{curveto}
+\def\pgfdecorationinputsegmentclosepath{closepath}
+\def\pgfdecorationinputsegmentlast{last}
% Input segment object moveto.
%
\def\pgf@decorate@inputsegmentobject@moveto#1{%
- \pgfpathmoveto{#1}%
\def\pgf@decorate@inputsegment@first{#1}%
\def\pgf@decorate@inputsegment@supporta{#1}%
\def\pgf@decorate@inputsegment@supportb{#1}%
\def\pgf@decorate@inputsegment@last{#1}%
\edef\pgf@decorate@lastmoveto{#1}%
\def\pgfdecoratedinputsegmentlength{0pt}%
- \let\pgf@decorate@splitinputsegmentobject\pgf@decorate@splitinputsegmentobject@move%
+ \let\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentmoveto%
}
% Input segment object lineto.
@@ -1251,17 +1329,28 @@
\def\pgf@decorate@inputsegmentobject@lineto#1#2#3{%
\def\pgfdecoratedinputsegmentlength{#1}%
\def\pgf@decorate@inputsegment@first{#2}%
+ \def\pgf@decorate@inputsegment@last{#3}%
%
- % OK, lines don't need supports, but this means angle calculations
- % do not have to be done individually for each object.
+ % Supports should be defined like this, so if treated as a curve,
+ % equal time steps will correspond to equal distances.
%
- \def\pgf@decorate@inputsegment@supporta{#3}%
- \def\pgf@decorate@inputsegment@supportb{#2}%
- \def\pgf@decorate@inputsegment@last{#3}%
+ \pgfpointdiff{#2}{#3}%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \pgfextract@process\pgf@decorate@inputsegment@supporta{%
+ \pgf@process{#2}%
+ \advance\pgf@x0.333333\pgf@xa%
+ \advance\pgf@y0.333333\pgf@ya%
+ }%
+ \pgfextract@process\pgf@decorate@inputsegment@supportb{%
+ \pgf@process{#2}%
+ \advance\pgf@x0.666666\pgf@xa%
+ \advance\pgf@y0.666666\pgf@ya%
+ }%
%
\let\pgf@decorate@movealonginputsegment\pgf@decorate@movealonginputsegment@line%
\let\pgf@decorate@transformtoinputsegment\pgf@decorate@transformtoinputsegment@line%
- \let\pgf@decorate@splitinputsegmentobject\pgf@decorate@splitinputsegmentobject@line%
+ \let\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentlineto%
}
% Input segment object curveto.
@@ -1275,7 +1364,7 @@
%
\let\pgf@decorate@movealonginputsegment\pgf@decorate@movealonginputsegment@curve%
\let\pgf@decorate@transformtoinputsegment\pgf@decorate@transformtoinputsegment@curve%
- \let\pgf@decorate@splitinputsegmentobject\pgf@decorate@splitinputsegmentobject@curve%
+ \let\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentcurveto%
}
% Input segment object closepath.
@@ -1287,18 +1376,33 @@
%
\def\pgfdecoratedinputsegmentlength{#1}%
\def\pgf@decorate@inputsegment@first{#2}%
- \def\pgf@decorate@inputsegment@supporta{#3}%
- \def\pgf@decorate@inputsegment@supportb{#2}%
- \def\pgf@decorate@inputsegment@last{#3}%
- %
+ \def\pgf@decorate@inputsegment@last{#3}%
+ %
+ \pgfpointdiff{#2}{#3}%
+ \pgf@xa\pgf@x%
+ \pgf@ya\pgf@y%
+ \pgfextract@process\pgf@decorate@inputsegment@supporta{%
+ \pgf@process{#2}%
+ \advance\pgf@x0.333333\pgf@xa%
+ \advance\pgf@y0.333333\pgf@ya%
+ }%
+ \pgfextract@process\pgf@decorate@inputsegment@supportb{%
+ \pgf@process{#2}%
+ \advance\pgf@x0.666666\pgf@xa%
+ \advance\pgf@y0.666666\pgf@ya%
+ }%
+ %
\let\pgf@decorate@movealonginputsegment\pgf@decorate@movealonginputsegment@line%
\let\pgf@decorate@transformtoinputsegment\pgf@decorate@transformtoinputsegment@line%
- \let\pgf@decorate@splitinputsegmentobject\pgf@decorate@splitinputsegmentobject@line%
+ \let\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentclosepath%
}
+
% Input segment object endofinputsegments.
%
-\def\pgf@decorate@inputsegmentobject@endofinputsegments{}
+\def\pgf@decorate@inputsegmentobject@endofinputsegments{%
+ \let\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentlast%
+}
@@ -1493,7 +1597,7 @@
% \pgfpathlineto{\pgfpoint{12pt}{0pt}}
% \pgfgetpath\softpath
%
-% \pgf@decorate@parsesoftpath{\softpath}{\parsedsoftpath}{}
+% \pgf@decorate@parsesoftpath{\softpath}{\parsedsoftpath}
%
% results in:
%
@@ -1855,6 +1959,150 @@
}
+% Macro to reverse a set of input segment objects.
+%
+% #1 - a macro holding the input segment objects.
+% #2 - a macro holding the reversed input segment objects.
+%
+\def\pgf@decorate@inputsegmentobjects@reverse#1#2{%
+ \def\pgf@decorate@path@storein{#2}%
+ \def\pgf@decorate@inputsegments@@temp{}%
+ \expandafter\pgf@decorate@inputsegments@@reverse@pass@first#1\pgf@stop}
+
+\def\pgf@decorate@inputsegments@@reverse@pass@first#1#2\pgf@stop{%
+ \def\pgf@decorate@temp{#1}%
+ \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter%
+ \pgf@decorate@inputsegments@@temp\expandafter\expandafter\expandafter%
+ {\expandafter\pgf@decorate@temp\pgf@decorate@inputsegments@@temp}%
+ \def\pgf@decorate@test{#2}
+ \ifx\pgf@decorate@test\pgfutil@empty%
+ \def\pgf@decorate@next{%
+ \expandafter\pgf@decorate@inputsegmentobjects@reverse@pass@second\pgf@decorate@inputsegments@@temp\pgf@stop%
+ }%
+ \else%
+ \def\pgf@decorate@next{\pgf@decorate@inputsegments@@reverse@pass@first#2\pgf@stop}%
+ \fi%
+ \pgf@decorate@next%
+}
+\def\pgf@decorate@inputsegmentobjects@reverse@pass@second#1#2#3\pgf@stop{%
+ \def\pgf@decorate@inputsegments@temp{#3}%
+ \def\pgf@decorate@inputsegments@@temp{}%
+ \let\pgf@decorate@current@inputsegmentobject=\pgfutil@empty
+ \let\pgf@decorate@last@object=\pgfutil@empty
+ \pgf@decorate@inputsegmentobjects@reverse@moveto@waitingtrue%
+ \pgf@decorate@inputsegmentobjects@reverse@closepath@waitingfalse%
+ \expandafter\pgf@decorate@path@@reverse@pass@second\pgf@decorate@inputsegments@temp\pgf@stop}%
+
+
+\def\pgf@decorate@path@@reverse@pass@second#1{%
+ \ifx#1\pgf@stop%
+ \expandafter\def\expandafter\pgf@decorate@inputsegments@@temp\expandafter{%
+ \pgf@decorate@inputsegments@@temp%
+ {\pgf@decorate@inputsegmentobject@endofinputsegments}%
+ {\pgf@decorate@inputsegmentobject@endofinputsegments}
+ }%
+ \expandafter\let\pgf@decorate@path@storein=\pgf@decorate@inputsegments@@temp%
+ \let\pgf@decorate@next=\relax%
+ \else%
+ \ifx#1\pgf@decorate@inputsegmentobject@moveto%
+ \let\pgf@decorate@next=\pgf@decorate@inputsegmentobjects@reverse@moveto%
+ \else%
+ \ifx#1\pgf@decorate@inputsegmentobject@lineto%
+ \let\pgf@decorate@next=\pgf@decorate@inputsegmentobjects@reverse@lineto%
+ \else%
+ \ifx#1\pgf@decorate@inputsegmentobject@curveto%
+ \let\pgf@decorate@next=\pgf@decorate@inputsegmentobjects@reverse@curveto%
+ \else%
+ \ifx#1\pgf@decorate@inputsegmentobject@closepath%
+ \let\pgf@decorate@next=\pgf@decorate@inputsegmentobjects@reverse@closepath%
+ \else%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \pgf@decorate@next%
+}
+
+\newif\ifpgf@decorate@inputsegmentobjects@reverse@moveto@waiting
+
+\def\pgf@decorate@inputsegmentobjects@reverse@moveto#1{%
+ \ifpgf@decorate@inputsegmentobjects@reverse@closepath@waiting%
+ \edef\pgf@decorate@current@inputsegmentobject{%
+ {\noexpand\pgf@decorate@inputsegmentobject@closepath%
+ {\pgf@decorate@reverse@closepath@length}%
+ {\pgf@decorate@last}%
+ {#1}%
+ }%
+ }%
+ \pgf@decorate@inputsegmentobjects@reverse@closepath@waitingfalse%
+ \else%
+ \let\pgf@decorate@current@inputsegmentobject=\pgfutil@empty%
+ \fi%
+ \pgf@decorate@inputsegmentobjects@reverse@moveto@waitingtrue%
+ \pgf@decorate@path@@@reverse@pass@second%
+}
+
+\newif\ifpgf@decorate@inputsegmentobjects@reverse@closepath@waiting
+
+\def\pgf@decorate@inputsegmentobjects@reverse@closepath#1#2#3{%
+ \pgf@decorate@inputsegmentobjects@reverse@closepath@waitingtrue%
+ \def\pgf@decorate@reverse@closepath@length{#1}%
+ \def\pgf@decorate@current@inputsegmentobject{}%
+ \pgf@decorate@inputsegmentobjects@reverse@lineto{#1}{#2}{#3}%
+}
+
+\def\pgf@decorate@inputsegmentobjects@reverse@lineto#1#2#3#4{%
+ \ifpgf@decorate@inputsegmentobjects@reverse@moveto@waiting%
+ \def\pgf@decorate@current@inputsegmentobject{{\pgf@decorate@inputsegmentobject@moveto{#3}}}%
+ \pgf@decorate@inputsegmentobjects@reverse@moveto@waitingfalse%
+ \else%
+ \let\pgf@decorate@current@inputsegmentobject=\pgfutil@empty%
+ \fi%
+ \def\pgf@decorate@append@inputsegmentobject{{\pgf@decorate@inputsegmentobject@lineto{#1}{#3}{#2}}}%
+ \ifx#4\pgf@decorate@inputsegmentobject@moveto%
+ \ifpgf@decorate@inputsegmentobjects@reverse@closepath@waiting%
+ \def\pgf@decorate@append@inputsegmentobject{{\pgf@decorate@inputsegmentobject@closepath{#1}{#3}{#2}}}%
+ \pgf@decorate@inputsegmentobjects@reverse@closepath@waitingfalse%
+ \else%
+ \def\pgf@decorate@append@inputsegmentobject{{\pgf@decorate@inputsegmentobject@lineto{#1}{#3}{#2}}}%
+ \fi%
+ \fi%
+ \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter%
+ \pgf@decorate@current@inputsegmentobject\expandafter\expandafter\expandafter%
+ {\expandafter\pgf@decorate@current@inputsegmentobject\pgf@decorate@append@inputsegmentobject}
+ \def\pgf@decorate@last{#2}%
+ \pgf@decorate@path@@@reverse@pass@second#4%
+}
+
+\def\pgf@decorate@inputsegmentobjects@reverse@curveto#1#2#3#4#5{%
+ \ifpgf@decorate@inputsegmentobjects@reverse@moveto@waiting%
+ \def\pgf@decorate@current@inputsegmentobject{%
+ {\pgf@decorate@inputsegmentobject@moveto{#5}}%
+ {\pgf@decorate@inputsegmentobject@curveto{#1}{#5}{#4}{#3}{#2}}%
+ }%
+ \pgf@decorate@inputsegmentobjects@reverse@moveto@waitingfalse%
+ \else%
+ \def\pgf@decorate@current@inputsegmentobject{{\pgf@decorate@inputsegmentobject@curveto{#1}{#5}{#4}{#3}{#2}}}%
+ \fi%
+ \def\pgf@decorate@last{#2}%
+ \pgf@decorate@path@@@reverse@pass@second%
+}
+
+\def\pgf@decorate@path@@@reverse@pass@second{%
+ \ifx\pgf@decorate@current@inputsegmentobject\pgfutil@empty%
+ \else%
+ \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter%
+ \pgf@decorate@inputsegments@@temp\expandafter\expandafter\expandafter%
+ {\expandafter\pgf@decorate@inputsegments@@temp\pgf@decorate@current@inputsegmentobject}%
+ \fi%
+ \pgf@decorate@path@@reverse@pass@second%
+}%
+
+
+
+
+
\let\startpgfdecoration=\pgfdecoration
\let\stoppgfdecoration=\endpgfdecoration
diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.code.tex
index c808f60d762..32024c047d6 100644
--- a/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/modules/pgfmodulematrix.code.tex,v 1.1 2008/01/15 10:27:34 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/modules/pgfmodulematrix.code.tex,v 1.4 2010/08/24 21:28:58 tantau Exp $
\usepgfmodule{shapes}
@@ -77,7 +77,7 @@
%
% Next, the whole resulting matrix, which is given as #7, is placed
% inside a node whose name is given as #3, whose shape is #1, and
-% whose anchor is #1. This means that the resulting node is shifted
+% whose anchor is #2. This means that the resulting node is shifted
% such that the given anchor lies at the origin. Then, as for a normal
% node, the #4 path usage command is used for the node.
%
@@ -159,6 +159,7 @@
\PackageError{pgf}{You cannot nest pgfmatrix environments, yet}{}
\fi%
\bgroup%
+ \everycr{}%
#6%
\def\pgf@matrix@par@shape{#1}%
\def\pgf@matrix@par@anchor{#2}%
@@ -360,6 +361,9 @@
% Step 4: Collect everything in a cell box
%
\setbox\pgf@matrix@cell=\hbox\bgroup\bgroup%
+ % make sure that cell pictures are not affected if matrizes have
+ % 'overlay' option on:
+ \pgf@relevantforpicturesizetrue
\pgfsys@beginpicture%
\normalbaselines%
% Find out whether the cell is empty:
diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleoo.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleoo.code.tex
new file mode 100644
index 00000000000..e80d3ac06bb
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleoo.code.tex
@@ -0,0 +1,451 @@
+% Copyright 2006 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 $Header: /cvsroot/pgf/pgf/generic/pgf/modules/pgfmoduleoo.code.tex,v 1.8 2010/02/22 22:49:21 tantau Exp $
+
+
+
+% Support of object-oriented programming in TeX.
+
+
+% The oo support works as follows:
+%
+% The main supported concepts are classes, objects, methods,
+% attributes and signal/slots. A class defines a set of methods, which are,
+% in the end, just normal TeX macros. Once a class has been created,
+% it can be instantiated by calling the \pgfoonew command, resulting
+% in a new object. Objects are local to their group. Given an object,
+% you can send it a message, resulting in the method code of the
+% object's method to be executed. While an object exists, it has a set
+% of attributes whose values can change over time. Attributes values
+% are not local to TeX groups, rather their life-cycle is the same as
+% the object's (which, however, is local to the group in which the
+% object was declared).
+%
+% The implementation is as follows: There is an ID counter that is
+% increased each time an object is created. This counter is local to
+% the group, which means that when a group ends the counter will
+% revert to the previous value, allowing objects to the reused in
+% subsequent groups.
+%
+% A method is just a normal \TeX macro, but to call it you write
+% \objecthandle.methodname(parameters). The \objecthandle is a macro
+% that is created when you say \pgfoonew. The special object
+% \pgfoothis is the current object.
+%
+% Attributes are stored globally in internal TeX macros whose name is
+% composed of the object number and the attribute name.
+
+
+
+
+% Declares a class
+%
+% #1 = class name
+% #2 = methods
+%
+% Description:
+%
+% This command declares a class for futurue use. Inside #2, the macro
+% \method can be used to declare a method. The \method macro takes a
+% method name, parameters (methods are normal TeX macros, after all)
+% and body.
+
+\long\def\pgfooclass#1#2{%
+ \def\pgfoo@classname{#1}%
+ \let\pgfoo@origmethod=\method%
+ \let\pgfoo@origattribute=\attribute%
+ \let\method=\pgfoo@declaremethod%
+ \let\attribute=\pgfoo@declareattribute%
+ \let\pgfoo@attribute@collection=\pgfutil@empty%
+ \let\pgfoo@attribute@collection@gc=\pgfutil@empty%
+ #2%
+ % Attribute initializer:
+ \expandafter\let\csname pgfooY\pgfoo@classname.@pgfooinit\endcsname\pgfoo@attribute@collection%
+ \expandafter\let\csname pgfooY\pgfoo@classname.@pgfoogc\endcsname\pgfoo@attribute@collection@gc%
+ % Always persent methods:
+ \expandafter\let\csname pgfooY\pgfoo@classname.get handle\endcsname\pgfoo@obj%
+ \expandafter\let\csname pgfooY\pgfoo@classname.get id\endcsname\pgfoo@id%
+ \let\method=\pgfoo@origmethod%
+ \let\attribute=\pgfoo@origattribute%
+}
+
+
+
+% Declare a method
+%
+% Description:
+%
+% Defines a method. To use/invoke this method for an object \object,
+% you write \object.methodname(parameters). This will cause the method
+% body to be invoked with the argument "(parameters)".
+%
+% To define the method \method should be directly followed by the
+% method name and, then, by (, followed by a parameter pattern,
+% followed by ), followed by the message body. Spaces are allowed only
+% after "\method" and after the closing ).
+%
+% Example:
+%
+% \pgfooclass{MyPlot}{
+%
+% \attribute x=0;
+% \attribute y=0;
+%
+% \method MyPlot() {
+% }
+%
+% \method getX(#1) {
+% \pgfooget{x}{#1}
+% }
+%
+% \method setPoint(#1,#2) {
+% \pgfooset{x}{#1}
+% \pgfooset{y}{#2}
+% }
+% }
+
+\def\pgfoo@declaremethod#1(#2)#3{%
+ \expandafter\long\expandafter\def\csname pgfooY\pgfoo@classname.#1\endcsname(#2){#3}%
+}
+
+
+% Declare an attribute
+%
+% #1 = attribute name
+% #2 = optional default value
+%
+% Description:
+%
+% Declares the attribute #1 for the current class. If the attribute
+% name is followed by =, the text following the equal sign is the
+% default value.
+
+\def\pgfoo@declareattribute#1;{%
+ \pgfutil@in@{ =}{#1}%
+ \ifpgfutil@in@%
+ \pgfoo@declareunpackspace#1;%
+ \else%
+ \pgfutil@in@={#1}%
+ \ifpgfutil@in@%
+ \pgfoo@declareunpack#1;%
+ \else%
+ \expandafter\def\expandafter\pgfoo@attribute@collection\expandafter{\pgfoo@attribute@collection\pgfoolet{#1}\pgfutil@empty}%
+ \expandafter\def\expandafter\pgfoo@attribute@collection@gc\expandafter{\pgfoo@attribute@collection@gc\pgfoolet{#1}\relax}%
+ \fi%
+ \fi%
+}
+\def\pgfoo@declareunpack#1=#2;{%
+ \expandafter\def\expandafter\pgfoo@attribute@collection\expandafter{\pgfoo@attribute@collection\pgfooset{#1}{#2}}%
+ \expandafter\def\expandafter\pgfoo@attribute@collection@gc\expandafter{\pgfoo@attribute@collection@gc\pgfoolet{#1}\relax}%
+}
+\def\pgfoo@declareunpackspace#1 =#2;{%
+ \expandafter\def\expandafter\pgfoo@attribute@collection\expandafter{\pgfoo@attribute@collection\pgfooset{#1}{#2}}%
+ \expandafter\def\expandafter\pgfoo@attribute@collection@gc\expandafter{\pgfoo@attribute@collection@gc\pgfoolet{#1}\relax}%
+}
+
+
+\newcount\pgfoo@objectcount
+\newcount\pgfoothis@count
+
+% The attribute value method
+%
+% #1 = attr
+%
+% This method inserts the current value of the given attribute for the
+% current object.
+
+\def\pgfoovalueof#1{%
+ \csname pgfooX\the\pgfoothis@count @#1\endcsname%
+}
+
+
+% The attribute get method
+%
+% #1 = attr
+% #2 = macro
+%
+% This method makes the macro equal to the current value of the
+% attribute for the current object.
+
+\def\pgfooget#1#2{%
+ \expandafter\let\expandafter#2\csname pgfooX\the\pgfoothis@count @#1\endcsname%
+}
+
+
+% The attribute set method
+%
+% #1 = attr
+% #2 = value
+%
+% This method sets the given attribute for the current object to the
+% given value.
+
+\long\def\pgfooset#1#2{%
+ \expandafter\gdef\csname pgfooX\the\pgfoothis@count @#1\endcsname{#2}%
+}
+
+
+% The attribute set method (expanded version)
+%
+% #1 = attr
+% #2 = value
+%
+% This method sets the given attribute for the current object to the
+% expanded version of the given value.
+
+\long\def\pgfooeset#1#2{%
+ \expandafter\xdef\csname pgfooX\the\pgfoothis@count @#1\endcsname{#2}%
+}
+
+
+% The attribute let method
+%
+% #1 = attr
+% #2 = value
+%
+% This method sets the given attribute for the current object to the
+% given value using \let.
+
+\def\pgfoolet#1#2{%
+ \expandafter\global\expandafter\let\csname pgfooX\the\pgfoothis@count @#1\endcsname#2%
+}
+
+
+% Add something to an attribute at the end
+%
+% #1 = attr
+% #2 = code
+%
+% This method adds the give code to the attr at the end.
+
+\def\pgfooappend#1#2{%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\pgf@oo@temp\expandafter\expandafter\expandafter{\csname pgfooX\the\pgfoothis@count @#1\endcsname#2}%
+ \expandafter\global\expandafter\let\csname pgfooX\the\pgfoothis@count @#1\endcsname\pgf@oo@temp%
+}
+
+
+% Add something to an attribute at the beginning
+%
+% #1 = attr
+% #2 = code
+%
+% This method adds the give code to the attr at the beginning.
+
+\def\pgfooprefix#1#2{%
+ \pgfooget{#1}\pgf@oo@temp%
+ \def\pgf@oo@@temp{#2}%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\pgf@oo@temp%
+ \expandafter\expandafter\expandafter{\expandafter\pgf@oo@@temp\pgf@oo@temp}%
+ \pgfoolet{#1}\pgf@oo@temp%
+}
+
+
+
+% Instantiate an object
+%
+% Possible syntax:
+%
+% 1) \pgfoonew new <class name>(<constructor parameters)
+% 2) \pgfoonew \<objectname>=new <class name>(<constructor parameters)
+% 3) \pgfoonew{attribute}=new <class name>(<constructor parameters)
+%
+% Description:
+%
+% Creates an object. After the object has been created, the method
+% called <class name> (the constructor) is invoked. If the
+% \<objectname>= part is present, the macro is assigned to the newly
+% created object.
+
+\def\pgfoonew{%
+ \pgfutil@ifnextchar n{%
+ \pgfoo@new\pgfoo@dummy=%
+ }{%
+ \pgfutil@ifnextchar\bgroup{%
+ \pgfoo@new@attribute%
+ }{%
+ \pgfoo@new%
+ }%
+ }%
+}
+\def\pgfoo@new#1=new #2(#3){%
+ \expandafter\ifx\csname pgfooY#2.get id\endcsname\relax%
+ \PackageError{pgfoo}{Unknown class '#2'}{}%
+ \else%
+ \advance\pgfoo@objectcount by 1\relax%
+ \edef\pgfoolastobj{\noexpand\pgfoo@caller{\the\pgfoo@objectcount}}%
+ \expandafter\gdef\csname pgfooX\the\pgfoo@objectcount @class\endcsname{#2}%
+ \let#1\pgfoolastobj%
+ {%
+ \pgfoothis@count\pgfoo@objectcount%
+ \csname pgfooY\csname pgfooX\the\pgfoothis@count @class\endcsname.@pgfooinit\endcsname%
+ }%
+ \pgfoolastobj.#2(#3)%
+ \aftergroup\pgfoogc% cleanup after group
+ \fi%
+}
+\def\pgfoo@new@attribute#1=new #2(#3){%
+ \pgfoo@new\pgf@oo@temp=new #2(#3)%
+ \pgfoolet{#1}\pgf@oo@temp%
+}
+
+
+\def\pgfoo@caller#1.#2(#3){%
+ \def\pgf@marshal{%
+ \pgfoothis@count=#1\relax%
+ \csname pgfooY\csname pgfooX\the\pgfoothis@count @class\endcsname.#2\endcsname(#3)%
+ }%
+ \expandafter\pgf@marshal\expandafter\pgfoothis@count\the\pgfoothis@count\relax%
+}
+\let\pgfoo@orig@caller=\pgfoo@caller
+
+% The special "this" object
+
+\def\pgfoothis.#1(#2){%
+ \csname pgfooY\csname pgfooX\the\pgfoothis@count @class\endcsname.#1\endcsname(#2)%
+}
+
+
+
+
+
+% Get the object id
+%
+% #1 = macro to store the id
+%
+% Description:
+%
+% This special method allows you to access the object id. You can then
+% use \pgfoocall to call a method using this id. This is mainly useful
+% when you wish to store the id for a longer time.
+
+\def\pgfoo@id(#1){%
+ \edef#1{\the\pgfoothis@count}%
+}
+
+% Yields the object with the given id
+%
+% #1 = id
+%
+% Description:
+%
+% Given an object id, \pgfooobj{<id>} will yield the object having
+% this id.
+
+\def\pgfooobj#1{%
+ \pgfoo@caller{#1}%
+}
+
+
+% Get the object
+%
+% #1 = macro to store the object
+%
+% Description:
+%
+% This special method allows you to get a new handle to a given
+% object. If \obj is an object, you could normally just say
+% \let#1=\obj. However, if \obj happens to be \pgfoothis, then you may
+% wish to get a handle to the object itself, not to the special macro
+% \pgfoothis. In this case you can say \obj.get handle(#1).
+
+\def\pgfoo@obj(#1){%
+ \edef#1{\noexpand\pgfoo@caller{\the\pgfoothis@count}}%
+}
+
+
+
+% The garbage collector
+%
+% Description:
+%
+% This method frees space ocupied by unused objects. Garbage are
+% objects that have been destroyed because of the end of the scope in
+% which they were created. In this case, however, the memory used by
+% this object is not immediately reused because the attributes of the
+% object are actually stored in global variables. When the garbage
+% collector is called, it will set all these global variables to
+% \relax, thereby ensuring that no memory is needed for them.
+
+\def\pgfoogc{%
+ {%
+ % We do this in a group...
+ \pgfoothis@count\pgfoo@objectcount% this is temporary...
+ \let\pgfoo@next=\pgfoo@dogc%
+ \pgfoo@next%
+ }%
+}
+\def\pgfoo@dogc{%
+ \advance\pgfoothis@count by 1\relax%
+ \expandafter\ifx\csname pgfooX\the\pgfoothis@count @class\endcsname\relax%
+ \let\pgfoo@next=\relax%
+ \else%
+ % Cleanup this object:
+ % The following is the fast version of \pgfooobj{\the\pgfoo@objectcount}.@pgfoogc:
+ \csname pgfooY\csname pgfooX\the\pgfoothis@count @class\endcsname.@pgfoogc\endcsname%
+ \expandafter\global\expandafter\let\csname pgfooX\the\pgfoothis@count @class\endcsname\relax%
+ \fi%
+ \pgfoo@next%
+}
+
+
+
+
+%
+%
+% Signal class
+%
+%
+
+\pgfooclass{signal}
+{
+ %
+ % This class implements signals.
+ %
+ % After you have created a signal object, you can call
+ % connect to connect a slot. Then, whenever the emit method is
+ % called, all connected methods get called.
+
+ % Attribute
+ \attribute emitter;
+ % Collects the objects that should be called.
+
+ % Constructor
+ \method signal() {}
+
+ % Connect a slot (method) #2 of object #1
+ \method connect(#1,#2) {%
+ {%
+ #1.get id(\pgf@tempid)%
+ % Save in emmiter
+ \pgfooget{emitter}\pgf@temp%
+ \let\pgfoo@signal@call=\relax% avoid expansion
+ \edef\pgf@temp{\pgf@temp\pgfoo@signal@call{\pgf@tempid}{#2}}%
+ \pgfoolet{emitter}\pgf@temp%
+ }%
+ }
+
+ \def\pgfoo@signal@call#1#2{%
+ \def\pgf@temp{\pgfooobj{#1}.#2}%
+ \expandafter\pgf@temp\expandafter(\pgfoo@signal@args)%
+ }
+
+ % Emit a signal
+ \method emit(#1) {%
+ \def\pgfoo@signal@args{#1}%
+ \pgfoovalueof{emitter}
+ }
+}
+
+
+
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleparser.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleparser.code.tex
new file mode 100644
index 00000000000..ed13b25324c
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleparser.code.tex
@@ -0,0 +1,111 @@
+% 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/modules/pgfmoduleparser.code.tex,v 1.1 2009/01/12 12:56:09 tantau Exp $
+
+%
+% This file defines commands for defining a letter-by-letter parser
+% based on a dfa.
+%
+
+
+
+
+% Parse the following text
+%
+% #1 = parser
+%
+% Description:
+%
+% This command starts the parser #1 in the initial state "initial". It
+% will parse the following text, stopping when the state "final" has
+% been reached.
+
+\def\pgfparserparse#1{%
+ \def\pgf@parser{#1}%
+ \def\pgf@parser@state{initial}%
+ \pgf@parser@parse%
+}
+\def\pgf@parser@parse{%
+ \futurelet\pgf@parser@symbol\pgf@parser@cont%
+}
+\def\pgf@parser@cont{%
+ % Ok, defined?
+ \expandafter\let\expandafter\pgf@parser@action%
+ \csname pgf@parser@a@\pgf@parser @\pgf@parser@state @\meaning\pgf@parser@symbol\endcsname%
+ \ifx\pgf@parser@action\relax%
+ \expandafter\let\expandafter\pgf@parser@action%
+ \csname pgf@parser@a@\pgf@parser @all@\meaning\pgf@parser@symbol\endcsname%
+ \ifx\pgf@parser@action\relax%
+ \PackageError{pgfparse}{Unexpected character
+ '\meaning\pgf@parser@symbol' in parser '\pgf@parser' in state
+ '\pgf@parser@state'}{}%
+ \fi%
+ \fi%
+ \pgf@parser@action%
+ \ifx\pgf@parser@symbol\pgfutil@sptoken%
+ \expandafter\pgf@parser@rid@space%
+ \else%
+ \expandafter\pgf@parser@rid@other%
+ \fi%
+}
+
+\def\pgf@parser@ridded{%
+ \ifx\pgf@parser@state\pgf@parser@final@text%
+ % done
+ \else%
+ \expandafter\pgf@parser@parse%
+ \fi%
+}
+
+\def\pgf@parser@final@text{final}
+
+{%
+ \def\:{\pgf@parser@rid@space} \expandafter\gdef\: {\futurelet\pgf@parser@ignore\pgf@parser@ridded}
+ \gdef\pgf@parser@rid@other{\afterassignment\pgf@parser@ridded\let\pgf@parser@ignore=}
+}
+
+
+
+% Switches the state
+%
+% #1 = new state
+%
+% Description:
+%
+% This command can be used inside a state action to switch to a
+% different state.
+
+\def\pgfparserswitch#1{\def\pgf@parser@state{#1}}
+
+
+
+
+% Defines an action to be taken in a state for some symbol
+%
+% #1 = parser
+% #2 = state
+% #3 = symbol text (result of saying \meaning on the symbol)
+% #4 = action
+%
+% Description:
+%
+% When the parser encounters #3 while being in state #2, then code #4
+% is executed.
+%
+% When #2 is set to the special text "all", then the symbol is handled
+% in all states by #4, except when a state defines something special
+% for this symbol
+
+\def\pgfparserdef#1#2#3#4{%
+ \expandafter\def\csname pgf@parser@a@#1@#2@#3\endcsname{#4}
+}
+
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex
index 5e7a703fd37..ea55ca8517b 100644
--- a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/modules/pgfmoduleplot.code.tex,v 1.1 2008/01/15 10:27:34 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/modules/pgfmoduleplot.code.tex,v 1.8 2010/10/22 17:34:17 ludewich Exp $
% PGF's plotting interface works as follows:
@@ -33,7 +33,7 @@
% \pgfplotstreamend
%
% By themselves, the \pgfplotstreamxxxx commands do not do anything by
-% default. Rather, the ``use'' such a stream, you must first install a
+% default. Rather, to ``use'' such a stream, you must first install a
% stream handler. For example, the ``lineto'' handler will simply
% translate every \pgfplotstreampoint into a \pgfpathlineto.
%
@@ -118,6 +118,29 @@
+% This handler turns creates a series of lineto commands, with the
+% last command being a closepath, resulting in a closed path.
+%
+% Example:
+%
+% \pgfplothandlerpolygon
+% \pgfplotxyfile{mytable}
+
+\def\pgfplothandlerpolygon{%
+ \def\pgf@plotstreamstart{%
+ \global\let\pgf@plotstreampoint=\pgf@plot@line@handler@close%
+ \global\let\pgf@plotstreamspecial=\pgfutil@gobble%
+ \global\let\pgf@plotstreamend=\pgfpathclose%
+ }%
+}
+
+\def\pgf@plot@line@handler@close#1{%
+ \pgfpathmoveto{#1}%
+ \global\let\pgf@plotstreampoint=\pgfpathlineto%
+}
+
+
+
% More handlers are defined in pgflibraryplothandlers
@@ -187,8 +210,8 @@
\def\pgfplotxyfile#1{%
\begingroup%
\pgfplotstreamstart%
- \openin1=#1
- \ifeof1
+ \openin\r@pgf@reada=#1
+ \ifeof\r@pgf@reada
\PackageWarning{pgf}{Plot data file `#1' not found.}
\else
\catcode`\#=14
@@ -201,7 +224,7 @@
\let\pgf@savedpar=\par%
\def\pgf@partext{\par}
\def\pgf@readxyfile{%
- \read1 to \pgf@temp%
+ \pgfutil@read\r@pgf@reada to \pgf@temp%
\let\par=\pgf@savedpar%
\edef\pgf@temp{\pgf@temp}%
\ifx\pgf@temp\pgfutil@empty%
@@ -209,7 +232,7 @@
\else%
\expandafter\pgf@parsexyline\pgf@temp\pgf@stop%
\fi\fi%
- \ifeof1\else\expandafter\pgf@readxyfile\fi%
+ \ifeof\r@pgf@reada\else\expandafter\pgf@readxyfile\fi%
}
\def\pgf@parsexyline#1 #2 #3\pgf@stop{%
@@ -236,8 +259,8 @@
\def\pgfplotxyzfile#1{%
\begingroup%
\pgfplotstreamstart%
- \openin1=#1
- \ifeof1
+ \openin\r@pgf@reada=#1
+ \ifeof\r@pgf@reada
\PackageWarning{pgf}{Plot data file `#1' not found.}
\else
\catcode`\#=14
@@ -248,13 +271,13 @@
}
\def\pgf@readxyzfile{%
- \read1 to \pgf@temp%
+ \pgfutil@read\r@pgf@reada to \pgf@temp%
\ifx\pgf@temp\pgfutil@empty%
\else\ifx\pgf@temp\pgf@partext%
\else%
\expandafter\pgf@parsexyzline\pgf@temp\pgf@stop%
\fi\fi%
- \ifeof1\else\expandafter\pgf@readxyzfile\fi%
+ \ifeof\r@pgf@reada\else\expandafter\pgf@readxyzfile\fi%
}
\def\pgf@parsexyzline#1 #2 #3 #4\pgf@stop{%
@@ -285,38 +308,58 @@
{
\catcode`\%=12
\catcode`\"=12
- \xdef\pgf@gnuplot@head#1{set terminal table; set output "#1.table"; set format "%.5f"}
+ \xdef\pgf@gnuplot@head{set table \noexpand\pgf@plottablefile@quoted; set format "%.5f"}
}
-\newwrite\pgf@plotwrite
+\let\pgf@plotwrite=\w@pgf@writea
\newif\ifpgf@resample@plot
\def\pgfplotgnuplot{\pgfutil@ifnextchar[{\pgf@plotgnuplot}{\pgf@plotgnuplot[\jobname]}}%}
\def\pgf@plotgnuplot[#1]#2{%
\pgf@resample@plottrue%
+ \pgfutilpreparefilename{#1.gnuplot}%
+ \let\pgf@plotgnuplotfile=\pgfretval
+ \pgfutilpreparefilename{#1.table}%
+ \let\pgf@plottablefile=\pgfretval
+ \let\pgf@plottablefile@quoted=\pgfretvalquoted
% Check, whether it is up-to-date
- \openin\pgfutil@inputcheck=#1.gnuplot
+ \openin\pgfutil@inputcheck=\pgf@plotgnuplotfile\relax
\ifeof\pgfutil@inputcheck%
\else%
- \read\pgfutil@inputcheck to\pgf@temp% ignored
- \read\pgfutil@inputcheck to\pgf@plot@line%
+ \pgfutil@read\pgfutil@inputcheck to\pgf@temp% ignored
+ \pgfutil@read\pgfutil@inputcheck to\pgf@plot@line%
+ \closein\pgfutil@inputcheck
\edef\pgf@plot@code{#2\space}%
\ifx\pgf@plot@code\pgf@plot@line%
- \openin\pgfutil@inputcheck=#1.table
+ \openin\pgfutil@inputcheck=\pgfretval\relax
\ifeof\pgfutil@inputcheck%
\else%
+ \closein\pgfutil@inputcheck
\pgf@resample@plotfalse%
\fi%
\fi%
\fi
\ifpgf@resample@plot%
- \immediate\openout\pgf@plotwrite=#1.gnuplot
- \immediate\write\pgf@plotwrite{\pgf@gnuplot@head{#1}}%
- \immediate\write\pgf@plotwrite{#2}%
+ \immediate\openout\pgf@plotwrite=\pgf@plotgnuplotfile\relax
+ \immediate\pgfutil@write\pgf@plotwrite{\pgf@gnuplot@head}%
+ \immediate\pgfutil@write\pgf@plotwrite{#2}%
\immediate\closeout\pgf@plotwrite%
- \immediate\write18{gnuplot #1.gnuplot}
+ \immediate\pgfutil@write18{gnuplot \pgf@plotgnuplotfile}%
+ \fi%
+ % temporarily redefine \pgf@parsexyline
+ \let\pgf@savedparsexyline=\pgf@parsexyline%
+ \let\pgf@parsexyline=\pgf@parsegnuplotxyline%
+ \pgfplotxyfile{\pgf@plottablefile}%
+ \let\pgf@parsexyline=\pgf@savedparsexyline%
+}
+
+\def\pgf@parsegnuplotxyline#1 #2 #3\pgf@stop{%
+ \edef\pgf@xyline@flag@val{#3}%
+ \edef\pgf@xyline@flag@undef{u\space}%
+ \ifx\pgf@xyline@flag@val\pgf@xyline@flag@undef%
+ \else%
+ \pgfplotstreampoint{\pgfpointxy{#1}{#2}}%
\fi%
- \pgfplotxyfile{#1.table}
}
diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.code.tex
index 63f6bf5be9b..da75b3e2e43 100644
--- a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/modules/pgfmoduleshapes.code.tex,v 1.4 2008/02/13 15:10:06 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/modules/pgfmoduleshapes.code.tex,v 1.13 2010/09/09 13:52:57 cjorssen Exp $
@@ -43,6 +43,7 @@
{%
\let\pgf@sh@savedmacros=\pgfutil@empty% MW
\let\pgf@sh@savedpoints=\pgfutil@empty%
+ \def\shape@name{#1}% CJ
\csname pgf@sh@s@#1\endcsname%
\pgf@sh@savedpoints%
\pgf@sh@savedmacros% MW
@@ -52,20 +53,30 @@
\pgf@y=-\pgf@y%
}%
\expandafter\pgfsavepgf@process\csname pgf@sh@sa@#3\endcsname{%
- \pgf@sh@reanchor{#1}{#2}%
+ \pgf@sh@reanchor{#1}{#2}% FIXME : this is double work!
}%
% Save the saved points and the transformation matrix
- \edef\pgf@test{#3}%
- \ifx\pgf@test\pgfutil@empty%
+ \edef\pgf@node@name{#3}%
+ \ifx\pgf@positionnodelater@macro\relax%
\else%
- \expandafter\xdef\csname pgf@sh@ns@#3\endcsname{#1}%
- \edef\pgf@sh@@temp{\noexpand\gdef\expandafter\noexpand\csname pgf@sh@np@#3\endcsname}%
+ % Rename node
+ \edef\pgf@node@name{not yet positioned@\pgf@node@name}%
+ % Interrupt bounding box!
+ \pgfinterruptboundingbox%
+ % Put everything in our box:
+ \setbox\pgfpositionnodelaterbox=\hbox\bgroup%
+ %
+ \fi%
+ \ifx\pgf@node@name\pgfutil@empty%
+ \else%
+ \expandafter\xdef\csname pgf@sh@ns@\pgf@node@name\endcsname{#1}%
+ \edef\pgf@sh@@temp{\noexpand\gdef\expandafter\noexpand\csname pgf@sh@np@\pgf@node@name\endcsname}%
\expandafter\pgf@sh@@temp\expandafter{\pgf@sh@savedpoints}%
- \edef\pgf@sh@@temp{\noexpand\gdef\expandafter\noexpand\csname pgf@sh@ma@#3\endcsname}% MW
+ \edef\pgf@sh@@temp{\noexpand\gdef\expandafter\noexpand\csname pgf@sh@ma@\pgf@node@name\endcsname}% MW
\expandafter\pgf@sh@@temp\expandafter{\pgf@sh@savedmacros}% MW
\pgfgettransform\pgf@temp
- \expandafter\xdef\csname pgf@sh@nt@#3\endcsname{\pgf@temp}%
- \expandafter\xdef\csname pgf@sh@pi@#3\endcsname{\pgfpictureid}%
+ \expandafter\xdef\csname pgf@sh@nt@\pgf@node@name\endcsname{\pgf@temp}%
+ \expandafter\xdef\csname pgf@sh@pi@\pgf@node@name\endcsname{\pgfpictureid}%
\fi%
\pgfutil@ifundefined{pgf@sh@bbg@#1}{}
{{\pgfscope\csname pgf@sh@bbg@#1\endcsname\endpgfscope}}%
@@ -87,7 +98,18 @@
{\csname pgf@sh@fg@#1\endcsname#4}%
\pgfutil@ifundefined{pgf@sh@ffg@#1}{}%
{{\pgfscope\csname pgf@sh@ffg@#1\endcsname\endpgfscope}}%
- \pgf@nodecallback{#3}%
+ \ifx\pgf@positionnodelater@macro\relax%
+ \expandafter\pgf@nodecallback\expandafter{\pgf@node@name}%
+ \else%
+ \egroup% Close box
+ \edef\pgfpositionnodelaterminx{\the\pgf@picminx}%
+ \edef\pgfpositionnodelaterminy{\the\pgf@picminy}%
+ \edef\pgfpositionnodelatermaxx{\the\pgf@picmaxx}%
+ \edef\pgfpositionnodelatermaxy{\the\pgf@picmaxy}%
+ \let\pgfpositionnodelatername=\pgf@node@name%
+ \pgf@positionnodelater@macro%
+ \endpgfinterruptboundingbox%
+ \fi%
}%
}%
}
@@ -144,6 +166,109 @@
}
}
+
+
+% Create a node that is positioned later
+%
+% #1 = macro to be called after the next node has been created
+%
+% Description:
+%
+% You can use this command to create a node that is "positioned
+% later". The idea is the following: Normally, when a node is created
+% using a command like \pgfnode, the node is immediately inserted into
+% the current picture. In particular, you have no chance to change the
+% position of a created node after it has been create.
+%
+% Using \pgfpositionnodelater, you can change the default
+% behaviour. This command is not a replacement for \pgfnode, but is
+% called before such a command and will cause the following to happen:
+% The node is created, but not inserted into the picture. Instead, it
+% is stored in the box \pgfpositionnodelaterbox. Furthermore, the node
+% is not relevant for the picture's bounding box, but a bounding box
+% for the node is computed and stored in the macros
+% \pgfpositionnodelaterboundboxminx to
+% \pgfpositionnodelaterboundboxmaxy. Finally, the
+% macro #1 is called with the following macros setup:
+%
+% \pgfpositionnodelaterbox
+% A box register (box 0 by default) that stores the node's paths and
+% texts. You should move the contents of this box to a box of your
+% choice.
+%
+% \pgfpositionnodelatername
+% The name of the just-created-node. This name will be the
+% originally "desired" name of the box plus the prefix "not yet
+% positioned box@".
+%
+% \pgfpositionnodelaterminx
+% \pgfpositionnodelatermaxx
+% \pgfpositionnodelaterminy
+% \pgfpositionnodelatermaxy
+% These four macros store the bounding box as dimensions that are
+% guarenteed to end with "pt".
+%
+% By setting #1 to \relax (which is the default), you can switch off
+% the whole mechanism
+%
+% Once a late node has been created, you can add arbitrary code in the
+% same picture. Then, at some later point, you call
+% \pgfpositionnodenow to finally position the node at a given position.
+%
+% When \pgfpositionnodenow is called, the macros mentioned above
+% should have the exact same values they had when #1 is called.
+
+\def\pgfpositionnodelater#1{\let\pgf@positionnodelater@macro=#1\relax}
+\pgfpositionnodelater{\relax}
+\def\pgfpositionnodelaterbox{0}
+
+
+% Position a node that has been scheduled for later insertion
+%
+% #1 = position in the picture, where the original anchor should go,
+% now
+%
+% Description:
+%
+% This command works in concert with \pgfpositionnodelater, see the
+% description there. When \pgfpositionnodenow is called, the macros
+% \pgfpositionnodelaterbox and so one should be set to the values they
+% had when the macro given to \pgfpositionnodelater was called. Then,
+% the box described by these macros will be inserted into the picture
+% at the position given #1. More precisely, the original node will
+% have been positioned such that the anchor given upon invocation is
+% at (0,0) and the node is now shifted by #1 before being inserted
+% into the actual picture.
+
+\def\pgfpositionnodenow#1{%
+ {%
+ \pgfpointtransformed{#1}%
+ \edef\pgf@temp@shift{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}
+ \pgftransformreset%
+ \pgftransformshift{\pgf@temp@shift}%
+ \setbox\pgfpositionnodelaterbox=\hbox{\pgfsys@beginpicture\box\pgfpositionnodelaterbox\pgfsys@endpicture}%
+ \pgfqboxsynced{\pgfpositionnodelaterbox}%
+ \pgf@shift@node{\pgfpositionnodelatername}{\pgf@temp@shift}%
+ % Bounding box update...
+ \pgfpointtransformed{\pgfqpoint{\pgfpositionnodelaterminx}{\pgfpositionnodelaterminy}}%
+ \pgf@protocolsizes{\pgf@x}{\pgf@y}
+ \pgfpointtransformed{\pgfqpoint{\pgfpositionnodelatermaxx}{\pgfpositionnodelatermaxy}}%
+ \pgf@protocolsizes{\pgf@x}{\pgf@y}
+ % Naming and callbacks
+ \expandafter\pgfpositionnodenow@rename\pgfpositionnodelatername\relax%
+ }%
+}
+
+\def\pgfpositionnodenow@rename not yet positioned@#1\relax{%
+ \pgfnoderename{#1}{not yet positioned@#1}
+ \pgf@nodecallback{#1}%
+}
+
+
+
+
+
+
% Alias a node
%
% #1 = new node name
@@ -165,12 +290,68 @@
\pgf@node@gnamelet{pgf@sh@nt@#1}{pgf@sh@nt@#2}%
\pgf@node@gnamelet{pgf@sh@pi@#1}{pgf@sh@pi@#2}%
\pgf@node@gnamelet{pgf@sh@ma@#1}{pgf@sh@ma@#2}%
+ \pgf@nodecallback{#1}%
}
\def\pgf@node@gnamelet#1#2{%
\expandafter\let\expandafter\pgf@temp\csname #2\endcsname%
\expandafter\global\expandafter\let\csname #1\endcsname=\pgf@temp%
}
+% Rename a node
+%
+% #1 = new name
+% #2 = old name
+%
+% Description:
+%
+% Renames a node. This is like an alias, only the memory used for the
+% old name is freed.
+
+\def\pgfnoderename#1#2{%
+ \pgfnodealias{#1}{#2}%
+ \expandafter\global\expandafter\let\csname pgf@sh@ns@#2\endcsname\relax
+ \expandafter\global\expandafter\let\csname pgf@sh@np@#2\endcsname\relax
+ \expandafter\global\expandafter\let\csname pgf@sh@nt@#2\endcsname\relax
+ \expandafter\global\expandafter\let\csname pgf@sh@pi@#2\endcsname\relax
+ \expandafter\global\expandafter\let\csname pgf@sh@ma@#2\endcsname\relax
+}
+
+
+% Quickly create a coordinate node
+%
+% #1 = name
+% #2 = coordinate
+%
+% Description:
+%
+% Creates a node of shape coordinate. The following have the same
+% effect, only the second is much faster:
+%
+% { \pgftransformshift{\pgfpoint{1cm}{2cm} \pgfnode{coordinate}{center}{}{foo}{} }
+% \pgfcoordinate{foo}{\pgfpoint{1cm}{2cm}}
+
+\def\pgfcoordinate#1#2{%
+ \edef\pgf@temp{#1}%
+ \ifx\pgf@temp\pgfutil@empty% do nothing
+ \else%
+ \pgf@process{\pgfpointtransformed{#2}}%
+ \expandafter\gdef\csname pgf@sh@ns@#1\endcsname{coordinate}%
+ \expandafter\xdef\csname pgf@sh@np@#1\endcsname{%
+ \noexpand\def\noexpand\centerpoint{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
+ }
+ \expandafter\gdef\csname pgf@sh@nt@#1\endcsname{{1}{0}{0}{1}{0pt}{0pt}}%
+ \expandafter\global\expandafter\let\csname pgf@sh@ma@#1\endcsname\pgfutil@empty%
+ \expandafter\gdef\csname pgf@sh@pi@#1\endcsname{\pgfpictureid}%
+ \fi%
+}
+
+\def\pgf@sh@redeferredanchor#1#2{% CJ
+ \expandafter\gdef\csname pgf@anchor@\shape@name @#1\endcsname{#2}}% CJ
+
+
+
+
+
\def\pgf@sh@resavedanchor#1#2{%
\pgf@process{#2}%
@@ -191,14 +372,12 @@
\pgf@sh@marshal%
}
-% MW
-\newtoks\toks@savedmacro
\def\pgf@sh@resavedmacro#1#2{%
\let#1\pgfutil@empty%
\def\addtosavedmacro##1{%
\expandafter\def\expandafter\pgf@sh@addtomacro@temp\expandafter{#1\noexpand\def\noexpand##1{##1}}%
- \expandafter\toks@savedmacro\expandafter{\pgf@sh@addtomacro@temp}%
- \expandafter\def\expandafter#1\expandafter{\the\toks@savedmacro}%
+ {\expandafter\pgfutil@toks@\expandafter{\pgf@sh@addtomacro@temp}\expandafter}%
+ \expandafter\def\expandafter#1\expandafter{\the\pgfutil@toks@}%
}%
#2\relax%
\edef\pgf@sh@marshal{%
@@ -212,12 +391,31 @@
\def\pgf@sh@reanchor#1#2{%
\pgfutil@ifundefined{pgf@anchor@#1@#2}%
{%
- \pgfmathsetcounter{pgf@counta}{#2}%
- \csname pgf@anchor@#1@border\endcsname{\pgfqpointpolar{\c@pgf@counta}{1pt}}%
+ \pgfutil@ifundefined{pgf@anchor@generic@#2}{%
+ \pgfmathsetcounter{pgf@counta}{#2}%
+ \csname pgf@anchor@#1@border\endcsname{\pgfqpointpolar{\c@pgf@counta}{1pt}}%
+ }{%
+ \csname pgf@anchor@generic@#2\endcsname{#1}%
+ }%
}%
{\csname pgf@anchor@#1@#2\endcsname}%
}
+% Defines a generic anchor, i.e. one which gets the associated shape
+% as first argument.
+%
+% #1: the anchor name.
+% #2: the code of the anchor. It may depend upon '##1', the shape's
+% name.
+%
+% The anchor will be defined locally in the current TeX scope.
+%
+% If the anchor will be referenced later by \pgfpointanchor, the macro \pgfreferencednodename
+% can be used to query the referenced node's name.
+% This macro is not defined during node creation.
+\def\pgfdeclaregenericanchor#1#2{%
+ \expandafter\def\csname pgf@anchor@generic@#1\endcsname##1{#2}%
+}%
% Retrieves an anchor of a shape
@@ -241,6 +439,7 @@
\pgfpointorigin}%
{%
\pgf@process{%
+ \edef\pgfreferencednodename{#1}% for use inside of anchors.
% MW install special macros
\csname pgf@sh@ma@#1\endcsname% MW
% install special coordinates
@@ -305,6 +504,7 @@
\pgfpointorigin}%
{%
\pgf@process{%
+ \edef\pgfreferencednodename{#1}% for use inside of anchors.
% MW install special macros
\csname pgf@sh@ma@#1\endcsname% MW
% install special coordinates
@@ -409,6 +609,7 @@
\let\savedanchor=\pgf@sh@savedanchor
\let\saveddimen=\pgf@sh@saveddimen
\let\savedmacro=\pgf@sh@savedmacro% MW
+ \let\deferredanchor=\pgf@sh@deferredanchor% CJ
\let\anchor=\pgf@sh@anchor
\let\anchorborder=\pgf@sh@anchorborder
\let\behindbackgroundpath=\pgf@sh@behindbgpath
@@ -443,6 +644,9 @@
\def\pgf@sh@savedmacro#1#2{% MW
\expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@\shape@name\endcsname{\pgf@sh@resavedmacro{#1}{#2}}}% MW
\def\pgf@sh@anchor#1#2{\expandafter\gdef\csname pgf@anchor@\shape@name @#1\endcsname{#2}}
+\def\pgf@sh@deferredanchor#1#2{% CJ
+ \expandafter\pgfutil@g@addto@macro
+ \csname pgf@sh@s@\shape@name\endcsname{\pgf@sh@redeferredanchor{#1}{#2}}}% CJ
\def\pgf@sh@anchorborder#1{\expandafter\gdef\csname pgf@anchor@\shape@name @border\endcsname##1{\pgf@process{##1}#1}}
\long\def\pgf@sh@behindbgpath#1{\expandafter\gdef\csname pgf@sh@bbg@\shape@name\endcsname{#1}}
\long\def\pgf@sh@bgpath#1{\expandafter\gdef\csname pgf@sh@bg@\shape@name\endcsname{#1}}
diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulesorting.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulesorting.code.tex
new file mode 100644
index 00000000000..b85fde14501
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulesorting.code.tex
@@ -0,0 +1,69 @@
+% 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/modules/pgfmodulesorting.code.tex,v 1.1 2008/11/12 23:39:37 tantau Exp $
+
+%
+% This file defines commands for sorting data. This is useful for 3d plots,
+% but also for drawing things in the correct order.
+%
+
+
+\newcount\pgfsortingbuckets
+
+
+% Init the sorting
+%
+% #1 = number of buckets
+%
+% Description:
+%
+% This macro inits a sorting. At any time there can be only one active
+% sorting. When you init the sorting, #1 should be a number of
+% buckets. You can then call \pgfsortinginsert to insert code into the
+% buckets. Once you are done, calling \pgfsortingexecute will execute
+% first the code in buckets 0, then the code in bucket 1, and so on to
+% bucket number #1-1.
+%
+\def\pgfsortinginit#1{
+ \pgfsortingbuckets#1\relax%
+ \c@pgf@counta=0\relax
+ \pgfutil@loop
+ \ifnum\c@pgf@counta<\c@pgf@countb\relax%
+ \expandafter\global\expandafter\let\csname pgf@sort@\the\c@pgf@counta\endcsname\pgfutil@empty%
+ \advance\c@pgf@counta by1\relax%
+ \pgfutil@repeat
+}
+
+% Insert code into some bucket
+%
+% #1 = the bucket
+% #2 = the code
+%
+\def\pgfsortinginsert#1#1{
+ \expandafter\let\expandafter\pgf@temp\csname pgf@lib@sort@#1\endcsname%
+ \expandafter\def\expandafter\pgf@temp\expandafter{\pgf@temp#2}%
+ \expandafter\global\expandafter\let\csname pgf@lib@sort@\the\c@pgf@counta\endcsname\pgf@temp%
+}
+
+
+% After all code has been inserted into the buckets, you can call
+% this method to execute the code in the order of the buckets.
+\def\pgfsortingexecute{
+ \c@pgf@countb=\pgfoovalueof{buckets}\relax
+ \c@pgf@counta=0\relax
+ \pgfutil@loop
+ \ifnum\c@pgf@counta<\c@pgf@countb\relax%
+ \csname pgf@lib@sort@\the\c@pgf@counta\endcsname%
+ \advance\c@pgf@counta by1\relax%
+ \pgfutil@repeat
+}
+
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/rendering/pgfrenderpoints.code.tex b/Master/texmf-dist/tex/generic/pgf/rendering/pgfrenderpoints.code.tex
new file mode 100644
index 00000000000..48d36bae8bf
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/rendering/pgfrenderpoints.code.tex
@@ -0,0 +1,138 @@
+% Copyright 2006 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 $Header: /cvsroot/pgf/pgf/generic/pgf/rendering/pgfrenderpoints.code.tex,v 1.2 2007/03/09 17:49:33 tantau Exp $
+
+
+
+
+
+% Create a 3D point
+%
+% #1 = macro name in which the point object should be stored
+% #2 to #4 = x-, y- and z-coordinate of the point
+%
+% Note:
+%
+% The quick version does not call \setlength and is faster.
+%
+% Example:
+%
+% \pgfrenderpointcreate{\pgfpoint{2pt+3cm}{3cm}}
+
+\def\pgfrenderpointcreate#1#2#3#4{%
+ \pgfmathsetlength\pgf@xa{#2}%
+ \pgfmathsetlength\pgf@xb{#3}%
+ \pgfmathsetlength\pgf@xc{#4}%
+ \pgfqrenderpointcreate{\the\pgf@xa}{\the\pgf@xb}{\the\pgf@xc}%
+}
+
+\def\pgfqrenderpointcreate#1#2#3#4{%
+ \edef#1{\pgf@xa=#2\relax\pgf@xb=#3\pgf@xc=#4\relax}%
+}
+
+\def\pgf@render@unpack#1{%
+ #1%
+}
+
+
+% The origin point object
+%
+% Description:
+%
+% This object is always the origin.
+%
+
+\pgfqrenderpointcreate\pgfrenderobjorigin{0pt}{0pt}{0pt}
+
+
+
+
+% Add two 3D vectors
+%
+% #1 = name of new vector (may be one of the input)
+% #2 = name of first vector
+% #3 = name of second vector
+%
+% Description:
+%
+% The points #2 and #3 are added and the result is stored in #1. If #1
+% equals either #2 or #3, to point is overwritten.
+%
+% Example:
+%
+% \pgfrenderpointcreate{\myvec}{1cm}{2cm}{3cm}
+% \pgfrenderpointcreate{\offset}{1cm}{0cm}{0cm}
+% \pgfrenderpointadd{\myvec}{\myvec}{\offset}
+
+\def\pgfrenderpointadd#1#2#3{%
+ \pgf@render@unpack#2%
+ \pgf@ya=\pgf@xa%
+ \pgf@yb=\pgf@xb%
+ \pgf@yc=\pgf@xc%
+ \pgf@render@unpack#3%
+ \advance\pgf@xa by\pgf@ya%
+ \advance\pgf@xb by\pgf@yb%
+ \advance\pgf@xc by\pgf@yc%
+ \pgfqrenderpointcreate#1{\the\pgf@xa}{\the\pgf@xb}{\the\pgf@xc}%
+}
+
+
+% Scale a 3D vectors
+%
+% #1 = name of new vector (may be one of the input)
+% #2 = scale
+% #3 = name of vector to be scaled
+%
+% Description:
+%
+% Sets #1 := #2*#3.
+%
+% Example:
+%
+% \pgfrenderpointcreate{\myvec}{1cm}{2cm}{3cm}
+% \pgfrenderpointscale{\myvec}{2}{\myvec}
+
+\def\pgfrenderpointscale#1#2#3{%
+ \pgf@render@unpack#3%
+ \pgf@xa=#2\pgf@xa%
+ \pgf@xb=#2\pgf@xb%
+ \pgf@xc=#2\pgf@xc%
+ \pgfqrenderpointcreate#1{\the\pgf@xa}{\the\pgf@xb}{\the\pgf@xc}%
+}
+
+
+
+
+% Project a 3D point to 2D
+%
+% #1 = 3D point object
+%
+% Description:
+%
+% This command takes a 3D point object and sets \pgf@x to the x-value
+% of the point and \pgf@y to the y-value.
+%
+% Example:
+%
+% \pgfpointprojection{\mypoint}
+
+\def\pgfpointprojection#1{%
+ \pgf@render@unpack{#1}%
+ \pgf@x=\pgf@xa%
+ \pgf@y=\pgf@ya%
+}
+
+
+
+
+
+
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/rendering/pgfrendertransform.code.tex b/Master/texmf-dist/tex/generic/pgf/rendering/pgfrendertransform.code.tex
new file mode 100644
index 00000000000..fb6802e9f1c
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/rendering/pgfrendertransform.code.tex
@@ -0,0 +1,117 @@
+% Copyright 2006 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 $Header: /cvsroot/pgf/pgf/generic/pgf/rendering/pgfrendertransform.code.tex,v 1.1 2006/11/12 14:18:46 tantau Exp $
+
+
+
+
+% Create a 3D transformation matrix
+%
+% #1 = macro name in which the transformation matrix should be stored
+% #2 = three comma-separated numbers, representing the first line of
+% the matrix.
+% #3 = three numbers, representing the second line of the matrix.
+% #4 = three numbers, representing the thrid line of the matrix.
+% #5 = 3D point object, used for the offset.
+%
+% Example:
+%
+% \pgfrendertransformcreate{\mymatrix}{1,0,0}{0,1,0}{0,0,1}{\pgfrenderobjorigin}
+
+\def\pgfrendertransformcreate#1#2#3#4#5{%
+ \pgf@render@unpack#5%
+ \edef#1{{#2}{#3}{#4}{\pgf@xa=\the\pgf@xa\pgf@xb=\the\pgf@xb\pgf@xc=\the\pgf@xc}}%
+}
+
+
+
+% Apply a 3D transformation matrix to a 3D point
+%
+% #1 = new point (may be the old point) (#1 := #2*#3)
+% #2 = transformation matrix object
+% #3 = point to be transformed
+%
+% Example:
+%
+% \pgfrendertransform{\newvec}{\mymatrix}{\oldvec}
+
+\def\pgfrendertransform#1#2#3{%
+ \pgf@render@unpack#3%
+ \expandafter\pgf@rendertransform#2%
+ \pgf@xa=\pgf@ya%
+ \pgf@xb=\pgf@yb%
+ \pgf@xc=\pgf@yc%
+}
+
+\def\pgf@rendertransform#1#2#3#4{%
+ \pgf@@rendertransform\pgf@ya#1\relax%
+ \pgf@@rendertransform\pgf@yb#2\relax%
+ \pgf@@rendertransform\pgf@yc#3\relax%
+ #4%
+ \advance\pgf@ya by \pgf@xa%
+ \advance\pgf@yb by \pgf@xb%
+ \advance\pgf@yc by \pgf@xc%
+}
+
+\def\pgf@@rendertransform#1#2,#3,#4\relax{%
+ #1=#2\pgf@xa%
+ \advance#1by#3\pgf@xb%
+ \advance#1by#4\pgf@xc%
+}
+
+
+
+% Concatenate two 3D transformation matrices
+%
+% #1 = new matrix, (#1 := #2*#3)
+% #2 = first matrix
+% #3 = second matrix
+%
+% Example:
+%
+% \pgfrendertransformconcat{\mymatrix}{\rotationmatrix}{\mymatrix}
+
+\def\pgfrendertransformconcat#1#2#3{%
+ \expandafter\pgf@render@extract@columns#3%
+ \pgfrendertransform\pgf@render@temp@a#2\pgf@render@temp@a%
+ \pgfrendertransform\pgf@render@temp@b#2\pgf@render@temp@b%
+ \pgfrendertransform\pgf@render@temp@c#2\pgf@render@temp@c%
+ \pgfrendertransform\pgf@render@temp@d#2\pgf@render@temp@d%
+ \pgf@render@unpack\pgf@render@temp@a%
+ \edef\pgf@temp@a{\pgf@sys@tonumber\pgf@xa}%
+ \edef\pgf@temp@b{\pgf@sys@tonumber\pgf@xb}%
+ \edef\pgf@temp@c{\pgf@sys@tonumber\pgf@xc}%
+ \pgf@render@unpack\pgf@render@temp@b%
+ \edef\pgf@temp@a{\pgf@temp@a,\pgf@sys@tonumber\pgf@xa}%
+ \edef\pgf@temp@b{\pgf@temp@b,\pgf@sys@tonumber\pgf@xb}%
+ \edef\pgf@temp@c{\pgf@temp@c,\pgf@sys@tonumber\pgf@xc}%
+ \pgf@render@unpack\pgf@render@temp@c%
+ \edef\pgf@temp@a{\pgf@temp@a,\pgf@sys@tonumber\pgf@xa}%
+ \edef\pgf@temp@b{\pgf@temp@b,\pgf@sys@tonumber\pgf@xb}%
+ \edef\pgf@temp@c{\pgf@temp@c,\pgf@sys@tonumber\pgf@xc}%
+ \pgfrendertransformcreate#1{\pgf@temp@a}{\pgf@temp@b}{\pgf@temp@c}{\pgf@render@temp@c}%
+}
+
+\def\pgf@render@extract@columns#1#2#3#4{%
+ \pgf@@render@extract@columns#1,#2,#3\relax%
+ \def\pgf@render@temp@d{#4}%
+}
+
+\def\pgf@@render@extract@columns#1,#2,#3,#4,#5,#6,#7,#8,#9\relax{%
+ \pgfqrenderpointcreate\pgf@render@temp@a{#1pt}{#4pt}{#7pt}%
+ \pgfqrenderpointcreate\pgf@render@temp@b{#2pt}{#5pt}{#8pt}%
+ \pgfqrenderpointcreate\pgf@render@temp@c{#3pt}{#6pt}{#9pt}%
+}
+
+
+
+
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg
index 659b541c539..38b32e39b57 100644
--- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg
+++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg
@@ -7,16 +7,23 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgf.cfg,v 1.6 2008/01/13 15:30:04 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgf.cfg,v 1.7 2008/05/14 22:01:48 tantau Exp $
-% Default driver:
-\ifx\pgfsysdriver\@undefined
- \edef\pgfsysdriver{pgfsys-\Gin@driver}
-\fi
+% Copy this file to somewhere local and uncomment one of the following
+% if you do not trust/use/like the automatic driver selection
+% algorithms:
-
-% Uncomment the following if you use dvipdfm and plain tex:
+% \def\pgfsysdriver{pgfsys-dvi.def}
% \def\pgfsysdriver{pgfsys-dvipdfm.def}
+% \def\pgfsysdriver{pgfsys-dvipdfmx.def}
+% \def\pgfsysdriver{pgfsys-dvips.def}
+% \def\pgfsysdriver{pgfsys-pdftex.def}
+% \def\pgfsysdriver{pgfsys-tex4ht.def}
+% \def\pgfsysdriver{pgfsys-textures.def}
+% \def\pgfsysdriver{pgfsys-vtex.def}
+% \def\pgfsysdriver{pgfsys-xetex.def}
+
+% Alternatively, use one of the above commands in your own files.
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf-via-dvi.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf-via-dvi.def
index 03c1821639f..5cbf2fd66ca 100644
--- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf-via-dvi.def
+++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf-via-dvi.def
@@ -7,63 +7,81 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-common-pdf-via-dvi.def,v 1.4 2008/02/05 10:25:36 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-common-pdf-via-dvi.def,v 1.7 2008/05/19 12:52:49 tantau Exp $
% Common driver commands for all drivers that produce pdf via the
% detour of a dvi file
-\def\pgfsys@invoke#1{\special{pdf: content Q #1 q}}
+
+
+% Hboxes
\def\pgfsys@hbox#1{%
- \special{pdf: content Q q -1 0 0 -1 0 0 cm q}%
+ \pgfsys@invoke{q -1 0 0 -1 0 0 cm}%
\special{pdf: content -1 0 0 -1 0 0 cm 3 Tr q}% translate to
% original coordinate system and do
% not show anything
{\hbox to 0pt{\pgfutil@font@normalfont\pgfutil@selectfont.\hss}}% enforce font change
- \special{pdf: content Q 0 Tr q}% end of font change enforcement.
+ \pgfsys@invoke{0 Tr}%
\wd#1=0pt%
\ht#1=0pt%
\dp#1=0pt%
\box#1
- \special{pdf: content Q n Q}%
+ \pgfsys@invoke{n Q Q}%
}
+\def\pgfsys@hboxsynced#1{%
+ {%
+ \pgfsys@beginscope%
+ \setbox\pgf@hbox=\hbox{%
+ \hskip\pgf@pt@x%
+ \raise\pgf@pt@y\hbox{%
+ \pgf@pt@x=0pt%
+ \pgf@pt@y=0pt%
+ \special{pdf: content q}%
+ \pgflowlevelsynccm%
+ \pgfsys@invoke{q -1 0 0 -1 0 0 cm}%
+ \special{pdf: content -1 0 0 -1 0 0 cm q}% translate to original coordinate system
+ \wd#1=0pt%
+ \ht#1=0pt%
+ \dp#1=0pt%
+ \box#1%
+ \pgfsys@invoke{n Q Q Q}%
+ }%
+ \hss%
+ }%
+ \wd\pgf@hbox=0pt%
+ \ht\pgf@hbox=0pt%
+ \dp\pgf@hbox=0pt%
+ \pgfsys@hbox\pgf@hbox%
+ \pgfsys@endscope%
+ }%
+}
+
\def\pgfsys@beginpicture{%
- \special{pdf: content Q 3 Tr q}% do not show anything
+ \pgfsys@invoke{3 Tr}%
\hbox to 0pt{\pgfutil@font@normalfont\pgfutil@selectfont.\hss}% enforce font change
- \special{pdf: content Q 0 Tr q}% end of font change enforcement.
+ \pgfsys@invoke{0 Tr}%
\special{pdf: content q}}
\def\pgfsys@endpicture{%
- \special{pdf: content n Q}%
+ \pgfsys@invoke{n Q}%
}
\def\pgfsys@beginpurepicture{\special{pdf: content q}}
-\def\pgf@sys@pdf@addtopageresources@extgs#1{%
- \ifx\pgf@sys@pdf@obj\@undefined%
- \global\let\pgf@sys@pdf@obj=\relax%
- \special{pdf: obj @pgfopacities << >>}% <<
- \fi%
- \special{pdf: put @pgfopacities << #1 >>}% <<
- \special{pdf: put @resources << /ExtGState @pgfopacities >>}% <<
-}
-\def\pgf@sys@pdf@readdtopageresources@extgs#1{%
- \special{pdf: put @resources << /ExtGState @pgfopacities >>}% <<
-}
-
\def\pgfsys@imagesuffixlist{.pdf:.jpg:.jpeg:.png:}
\def\pgfsys@horishading#1#2#3{%
{%
\pgf@parsefunc{#3}%
\pgf@process{\pgfpoint{\pgf@max}{#2}}%
- \edef\@temp{\noexpand\pgf@sys@atbeginpage{\special{pdf: beginxobj @pgfshade#1 width \the\pgf@max\space height \the\pgf@y}}}\@temp%
- \edef\@temp{\noexpand\pgf@sys@atbeginpage{\special{pdf: put @resources <<
+ \edef\@temp{\noexpand\pgfutil@insertatbegincurrentpage{\special{pdf: beginxobj @pgfshade#1 width \the\pgf@max\space height \the\pgf@y}}}\@temp%
+ \edef\@temp{\noexpand\pgfutil@insertatbegincurrentpage{\special{pdf: put @resources <<
/Shading << /Sh << /ShadingType 2
/ColorSpace /DeviceRGB
/Domain [\pgf@pdfparseddomain]
/Coords [\pgf@doma\space0 \pgf@domb\space0]
/Function \pgf@pdfparsedfunction
/Extend [false false] >> >> >>}}}\@temp% <<
- \pgf@sys@atbeginpage{\special{pdf: content /Sh sh}%
+ \pgfutil@insertatbegincurrentpage{\special{pdf: content /Sh sh}%
\special{pdf: endxobj}}%
\expandafter\xdef\csname @pgfshading#1!\endcsname{%
\hbox to\the\pgf@max{\vbox to#2{\vfil\special{pdf: usexobj @pgfshade#1}}\hfil}}%
@@ -73,15 +91,15 @@
{%
\pgf@parsefunc{#3}%
\pgf@process{\pgfpoint{\pgf@max}{#2}}%
- \edef\@temp{\noexpand\pgf@sys@atbeginpage{\special{pdf: beginxobj @pgfshade#1 width \the\pgf@y\space height \the\pgf@max\space}}}\@temp%
- \edef\@temp{\noexpand\pgf@sys@atbeginpage{\special{pdf: put @resources <<
+ \edef\@temp{\noexpand\pgfutil@insertatbegincurrentpage{\special{pdf: beginxobj @pgfshade#1 width \the\pgf@y\space height \the\pgf@max\space}}}\@temp%
+ \edef\@temp{\noexpand\pgfutil@insertatbegincurrentpage{\special{pdf: put @resources <<
/Shading << /Sh << /ShadingType 2
/ColorSpace /DeviceRGB
/Domain [\pgf@pdfparseddomain]
/Coords [0 \pgf@doma\space0 \pgf@domb]
/Function \pgf@pdfparsedfunction
/Extend [false false] >> >> >>}}}\@temp% <<
- \pgf@sys@atbeginpage{\special{pdf: content /Sh sh}%
+ \pgfutil@insertatbegincurrentpage{\special{pdf: content /Sh sh}%
\special{pdf: endxobj}}%
\expandafter\xdef\csname @pgfshading#1!\endcsname{%
\hbox to#2{\vbox to\the\pgf@max{\vfil\special{pdf: usexobj @pgfshade#1}}\hfil}}%
@@ -101,42 +119,21 @@
\pgf@sys@bp@correct{\pgf@xa}%
\pgf@sys@bp@correct{\pgf@ya}%
\pgfutil@tempdima=2\pgf@max\relax%
- \edef\@temp{\noexpand\pgf@sys@atbeginpage{\special{pdf: beginxobj @pgfshade#1 width \the\pgfutil@tempdima\space height \the\pgfutil@tempdima}}}\@temp%
- \edef\@temp{\noexpand\pgf@sys@atbeginpage{\special{pdf: put @resources <<
+ \edef\@temp{\noexpand\pgfutil@insertatbegincurrentpage{\special{pdf: beginxobj @pgfshade#1 width \the\pgfutil@tempdima\space height \the\pgfutil@tempdima}}}\@temp%
+ \edef\@temp{\noexpand\pgfutil@insertatbegincurrentpage{\special{pdf: put @resources <<
/Shading << /Sh << /ShadingType 3
/ColorSpace /DeviceRGB
/Domain [\pgf@pdfparseddomain]
/Coords [\pgf@sys@tonumber{\pgf@xa} \pgf@sys@tonumber{\pgf@ya} \pgf@doma\space \pgf@sys@tonumber{\pgf@x} \pgf@sys@tonumber{\pgf@y} \pgf@domb]
/Function \pgf@pdfparsedfunction
/Extend [true false] >> >> >>}}}\@temp% <<
- \pgf@sys@atbeginpage{\special{pdf: content /Sh sh}%
+ \pgfutil@insertatbegincurrentpage{\special{pdf: content /Sh sh}%
\special{pdf: endxobj}}%
\expandafter\xdef\csname @pgfshading#1!\endcsname{%
\hbox to\the\pgfutil@tempdima{\vbox to\the\pgfutil@tempdima{\vfil\special{pdf: usexobj @pgfshade#1}}\hfil}}%
}%
}%
-% The following is an ugly hack. We need something like
-% "everyshipout".
-% But it should be ultra-portable...
-\def\pgf@sys@atbeginpage#1{\AtBeginDvi{#1}}
-\AtBeginDocument{% hack for old hyperref
- \ifx\Hy@begindvi\@undefined%
- \let\pgf@sys@continue@hyper=\pgfutil@empty%
- \else%
- \pgf@sys@test@hyper%
- \fi%
- \def\@begindvi{\unvbox\@begindvibox\pgf@sys@continue@hyper}
-}
-
-\def\pgf@sys@test@hyper{%
- \ifHy@implicit%
- \let\pgf@sys@continue@hyper=\Hy@begindvi%
- \else%
- \let\pgf@sys@continue@hyper=\HyPL@EveryPage%
- \fi%
-}
-
\def\pgf@sys@pdf@dvi@tracker{
\def\pgfsys@markposition##1{%
\pdfsavepos%
@@ -154,6 +151,61 @@
\def\pgf@sys@pdf@mark@pos@pgfpageorigin{\pgfpointorigin}
}
+
+
+%
+% Resource management
+%
+
+\newif\ifpgf@sys@pdf@colorspaces@exists
+\newif\ifpgf@sys@pdf@patterns@exists
+\newif\ifpgf@sys@pdf@extgs@exists
+\newif\ifpgf@sys@pdf@colorspaces@created
+\newif\ifpgf@sys@pdf@patterns@created
+\newif\ifpgf@sys@pdf@extgs@created
+\newif\ifpgf@sys@pdf@any@resources
+
+\def\pgf@sys@setuppdfresources@plain{%
+ % This command will setup pdf resource in plain and in latex
+ % mode. ConTeXt has its own handler
+ \pgfutil@insertatbegineverypage{%
+ \pgf@sys@pdf@any@resourcesfalse%
+ \ifpgf@sys@pdf@extgs@exists%
+ \pgf@sys@pdf@any@resourcestrue%
+ \ifpgf@sys@pdf@extgs@created \else \special{pdf: obj @pgfextgs <<>>} \global\pgf@sys@pdf@extgs@createdtrue \fi% <<
+ \fi%
+ \ifpgf@sys@pdf@colorspaces@exists%
+ \pgf@sys@pdf@any@resourcestrue%
+ \ifpgf@sys@pdf@colorspaces@created \else \special{pdf: obj @pgfcolorspaces <<>>} \global\pgf@sys@pdf@colorspaces@createdtrue \fi% <<
+ \fi%
+ \ifpgf@sys@pdf@patterns@exists%
+ \pgf@sys@pdf@any@resourcestrue%
+ \ifpgf@sys@pdf@patterns@created \else \special{pdf: obj @pgfpatterns <<>>} \global\pgf@sys@pdf@patterns@createdtrue \fi% <<
+ \fi%
+ \ifpgf@sys@pdf@any@resources%
+ \special{pdf: put @resources <<
+ \ifpgf@sys@pdf@extgs@exists /ExtGState @pgfextgs \fi
+ \ifpgf@sys@pdf@patterns@exists /Pattern @pgfpattern \fi
+ \ifpgf@sys@pdf@colorspaces@exists /ColorSpace @pgfcolorspaces \fi
+ >>}% <<
+ \fi%
+ }
+ \def\pgf@sys@addpdfresource@extgs@plain##1{%
+ \global\pgf@sys@pdf@extgs@existstrue%
+ \pgfutil@insertatbegincurrentpage{\special{pdf: put @pgfextgs << ##1 >>}}% <<
+ }
+ \def\pgf@sys@addpdfresource@colorspaces@plain##1{%
+ \global\pgf@sys@pdf@colorspaces@existstrue%
+ \pgfutil@insertatbegincurrentpage{\special{pdf: put @pgfcolorspaces << ##1 >>}}% <<
+ }
+ \def\pgf@sys@addpdfresource@patterns@plain##1{%
+ \global\pgf@sys@pdf@patterns@existstrue%
+ \pgfutil@insertatbegincurrentpage{\special{pdf: put @pgfpatterns << ##1 >>}}% <<
+ }
+}
+\pgfutil@setuppdfresources % possibly call the above
+
+
\endinput
%%% Local Variables:
diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def
index 3a88a236de5..c48d1c15238 100644
--- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def
+++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def
@@ -7,11 +7,12 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-common-pdf.def,v 1.8 2007/12/17 14:52:31 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-common-pdf.def,v 1.10 2008/05/19 12:52:49 tantau Exp $
% Common driver commands for all drivers that produce pdf
+
% Path construction:
\def\pgfsys@lineto#1#2{\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgfsysprotocol@literal{l}}
\def\pgfsys@moveto#1#2{\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgfsysprotocol@literal{m}}
@@ -60,15 +61,11 @@
\def\pgfsys@color@gray@fill#1{\pgfsysprotocol@literal{#1 g}}
% Opacity
-\def\pgf@sys@pdf@addtopageresources@extgs#1{\pgf@sys@fail{adding to page resources}}
-\def\pgf@sys@pdf@readdtopageresources@extgs#1{}% not always used
\def\pgfsys@stroke@opacity#1{%
\expandafter\ifx\csname pgf@sys@pdf@so@#1\endcsname\relax%
% Hmm... define...
\expandafter\gdef\csname pgf@sys@pdf@so@#1\endcsname{/pgf@CA#1}%
- \pgf@sys@pdf@addtopageresources@extgs{/pgf@CA#1 << /CA #1 >>}%
- \else%
- \pgf@sys@pdf@readdtopageresources@extgs{/pgf@CA#1 << /CA #1 >>}%
+ \pgfutil@addpdfresource@extgs{/pgf@CA#1 << /CA #1 >>}%<<
\fi%
\pgfsysprotocol@literal{\csname pgf@sys@pdf@so@#1\endcsname\space gs}%
}
@@ -76,9 +73,7 @@
\expandafter\ifx\csname pgf@sys@pdf@fo@#1\endcsname\relax%
% Hmm... define...
\expandafter\gdef\csname pgf@sys@pdf@fo@#1\endcsname{/pgf@ca#1}%
- \pgf@sys@pdf@addtopageresources@extgs{/pgf@ca#1 << /ca #1 >>}%
- \else%
- \pgf@sys@pdf@readdtopageresources@extgs{/pgf@ca#1 << /ca #1 >>}%
+ \pgfutil@addpdfresource@extgs{/pgf@ca#1 << /ca #1 >>}%<<
\fi%
\pgfsysprotocol@literal{\csname pgf@sys@pdf@fo@#1\endcsname\space gs}%
}
diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-postscript.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-postscript.def
index 75d06305bb1..52e0ef9b224 100644
--- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-postscript.def
+++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-postscript.def
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-common-postscript.def,v 1.18 2008/02/07 19:25:41 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-common-postscript.def,v 1.22 2008/10/01 14:19:33 tantau Exp $
% Driver commands for postscript
@@ -263,7 +263,8 @@
{
\pgf@sys@tonumber{\pgf@xa} 1 \pgf@sys@tonumber{\pgf@xb}
{ 1 index 2 copy pgfproc setrgbcolor moveto 1.1 0 rlineto stroke }
- for
+ for
+ pop
}
for
}%
@@ -292,7 +293,8 @@
\pgf@sys@bp@correct\pgf@yb%
\pgf@sys@bp@correct\pgf@xc%
\pgf@sys@bp@correct\pgf@yc%
- \pgfsys@outerinvoke{
+ \edef\pgf@sys@marshal{%
+ \noexpand\pgfutil@insertatbegincurrentpage{\noexpand\pgfsys@outerinvoke{
save true setglobal globaldict begin /pgfpat#1
{
\ifnum#9=0 [/Pattern /DeviceRGB] \else /Pattern \fi\space
@@ -316,7 +318,9 @@
grestore
setcolor
} bind def end restore
- }% <<
+ }}% <<
+ }%
+ \pgf@sys@marshal%
}
\def\pgfsys@setpatternuncolored#1#2#3#4{%
@@ -354,7 +358,7 @@
/pgfdiff 8 index round cvi 8 index round cvi sub 2 mul 1 add def
2 index 6 index sub pgfdiff div % put red-step on stack
2 index 6 index sub pgfdiff div % put green-step on stack
- 2 index 6 index sub pgfdiff div % put green-step on stack
+ 2 index 6 index sub pgfdiff div % put blue-step on stack
pgfheight 9 index 9 index 9 index 14 index
pgfdiff {
3 index 3 index 3 index setrgbcolor % Set color
diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def
index fdf16a61210..fa1cf889bd4 100644
--- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def
+++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-common-svg.def,v 1.20 2008/02/07 19:25:41 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-common-svg.def,v 1.21 2009/03/20 10:31:30 tantau Exp $
% Driver commands for svg
@@ -19,8 +19,8 @@
{%
\pgf@x=#1\relax%
\edef\temp{\expandafter\Pgf@geT\the\pgf@x\space}%
- \toks@\expandafter\expandafter\expandafter{\expandafter\pgf@sys@svgpath\temp}%
- \xdef\pgf@sys@svgpath{\the\toks@}%
+ \pgfutil@toks@\expandafter\expandafter\expandafter{\expandafter\pgf@sys@svgpath\temp}%
+ \xdef\pgf@sys@svgpath{\the\pgfutil@toks@}%
}%
}
\def\pgf@sys@addtosvgpath#1{\pgfutil@g@addto@macro\pgf@sys@svgpath{#1\space}}
diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def
index 16edebc350b..4124784d999 100644
--- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def
+++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-dvipdfm.def,v 1.18 2007/12/17 14:52:31 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-dvipdfm.def,v 1.19 2008/05/14 16:05:56 tantau Exp $
% Driver commands for dvipdfm
@@ -21,6 +21,7 @@
% dvipdfm-specific stuff:
%
+\def\pgfsys@invoke#1{\special{pdf: content Q #1 q}} % ugly, but necessary...
%
diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfmx.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfmx.def
index 57ccbab304d..b9669434a4a 100644
--- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfmx.def
+++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfmx.def
@@ -7,21 +7,409 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-dvipdfmx.def,v 1.1 2008/02/05 10:57:46 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-dvipdfmx.def,v 1.3 2009/05/22 07:25:48 jinhwancho Exp $
-% Driver commands for dvipdfm
+% Driver commands for dvipdfmx
+%
+% Modified by Jin-Hwan Cho <chofchof@ktug.or.kr> on April 18, 2009.
+% This driver requires the version DVIPDFMX-20080605 that is contained
+% in texlive 2008 or later.
%
% Load common pdf and pdf in dvi commands:
%
\input pgfsys-common-pdf.def
-\input pgfsys-common-pdf-via-dvi.def
+% For unique object name:
+\newcount\pgfsys@objnum\pgfsys@objnum\@ne
+
+% `pdf:code' is an abbreviation of `pdf:literal direct', the idea of which
+% came from pdfTeX's primitive \pdfliteral direct.
+\def\pgfsys@invoke#1{\special{pdf:code #1}}
+
+% If color is changed by \pgfsys@invoke explicitly, the color
+% optimization routine in dvipdfmx does not work correctly
+% because the routine checks color specials only. For example,
+%
+% \special{color push 0}\pgfsys@invoke{1 g 1 G}\special{color push 0}
%
-% dvipdfm-specific stuff:
+% the last color special will be ignored the optimization routine
+% thinks that the color has changed to the same color.
+% To avoid this problem, we need to change the color temporarily to another.
%
+% We assume that black is the default color when no color is specified.
+\def\start@force@reset@color{%
+ \special{pdf:bcolor [1]}%
+ \special{pdf:bcolor [0]}%
+}
+\def\stop@force@reset@color{%
+ \special{pdf:ecolor}%
+ \special{pdf:ecolor}%
+}
+
+% We cannot use many codes in pgfsys-common-pdf-via-dvi.def.
+% So it is rewritten here (with some bugs fixed).
+\def\pgfsys@hboxsynced#1{%
+ {%
+ \pgfsys@beginscope%
+ \setbox\pgf@hbox=\hbox{%
+ \hskip\pgf@pt@x%
+ \raise\pgf@pt@y\hbox{%
+ \pgf@pt@x=0pt%
+ \pgf@pt@y=0pt%
+ % The order of `pdf:bcontent' is important here. It should be
+ % followed by \pgflowlevelsynccm, not reverse order.
+ \special{pdf:bcontent}%
+ \pgflowlevelsynccm%
+ \start@force@reset@color%
+ \pgfsys@hbox#1%
+ \stop@force@reset@color%
+ \special{pdf:econtent}}%
+ \hss%
+ }%
+ \wd\pgf@hbox=0pt%
+ \ht\pgf@hbox=0pt%
+ \dp\pgf@hbox=0pt%
+ \box\pgf@hbox%
+ \pgfsys@endscope%
+ }%
+}
+
+% All text materials between `pdf:bcontent' and `pdf:econtent' are
+% treated in the relative coordinate.
+\def\pgfsys@beginpicture{\special{pdf:bcontent}}
+\def\pgfsys@endpicture{\special{pdf:econtent}}
+
+\def\pgfsys@imagesuffixlist{.pdf:.jpg:.jpeg:.png:.bmp:}
+
+% Shaidng came from pgfsys-pdftex.def
+\def\pgfsys@horishading#1#2#3{%
+ {%
+ \pgf@parsefunc{#3}%
+ \pgfmathparse{#2}%
+ \pgf@process{\pgfpoint{\pgf@max}{#2}}%
+ \edef\@tempa{\noexpand\pgfutil@insertatbegincurrentpagefrombox{%
+ \special{pdf:bxobj @pgfshade\the\pgfsys@objnum\space width \the\pgf@max\space height \pgfmathresult pt}%
+ \special{pdf:put @resources
+ <<
+ /Shading << /Sh << /ShadingType 2
+ /ColorSpace /DeviceRGB
+ /Domain [\pgf@pdfparseddomain]
+ /Coords [\pgf@doma\space0 \pgf@domb\space0]
+ /Function \pgf@pdfparsedfunction
+ /Extend [false false] >> >>
+ >>}%
+ \pgfsys@invoke{/Sh sh}%
+ \special{pdf:exobj}}}\@tempa% <<
+ \expandafter\xdef\csname @pgfshading#1!\endcsname{%
+ \hbox to\the\pgf@max{\vbox to\pgfmathresult pt{\vfil\special{pdf:uxobj @pgfshade\the\pgfsys@objnum}}\hfil}}%
+ }%
+ \global\advance\pgfsys@objnum\@ne%
+}
+\def\pgfsys@vertshading#1#2#3{%
+ {%
+ \pgf@parsefunc{#3}%
+ \pgfmathparse{#2}%
+ \pgf@process{\pgfpoint{\pgf@max}{#2}}%
+ \edef\@tempa{\noexpand\pgfutil@insertatbegincurrentpagefrombox{%
+ \special{pdf:bxobj @pgfshade\the\pgfsys@objnum\space width \pgfmathresult pt\space height \the\pgf@max}%
+ \special{pdf:put @resources
+ <<
+ /Shading << /Sh << /ShadingType 2
+ /ColorSpace /DeviceRGB
+ /Domain [\pgf@pdfparseddomain]
+ /Coords [0 \pgf@doma\space0 \pgf@domb]
+ /Function \pgf@pdfparsedfunction
+ /Extend [false false] >> >>
+ >>}%
+ \pgfsys@invoke{/Sh sh}%
+ \special{pdf:exobj}}}\@tempa% <<
+ \expandafter\xdef\csname @pgfshading#1!\endcsname{%
+ \hbox to\pgfmathresult pt{\vbox to\the\pgf@max{\vfil\special{pdf:uxobj @pgfshade\the\pgfsys@objnum}}\hfil}}%
+ }%
+ \global\advance\pgfsys@objnum\@ne%
+}
+\def\pgfsys@radialshading#1#2#3{%
+ {%
+ \pgf@parsefunc{#3}%
+ \pgf@process{#2}%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{\pgfpoint{\pgf@max}{\pgf@max}}%
+ \advance\pgf@xa by \pgf@x%
+ \advance\pgf@ya by \pgf@y%
+ \pgf@sys@bp@correct{\pgf@x}%
+ \pgf@sys@bp@correct{\pgf@y}%
+ \pgf@sys@bp@correct{\pgf@xa}%
+ \pgf@sys@bp@correct{\pgf@ya}%
+ \pgfutil@tempdima=2\pgf@max%
+ \edef\@tempa{\noexpand\pgfutil@insertatbegincurrentpagefrombox{%
+ \special{pdf:bxobj @pgfshade\the\pgfsys@objnum\space width \the\pgfutil@tempdima\space height \the\pgfutil@tempdima}%
+ \special{pdf:put @resources
+ <<
+ /Shading << /Sh << /ShadingType 3
+ /ColorSpace /DeviceRGB
+ /Domain [\pgf@pdfparseddomain]
+ /Coords [\pgf@sys@tonumber{\pgf@xa} \pgf@sys@tonumber{\pgf@ya} \pgf@doma\space \pgf@sys@tonumber{\pgf@x} \pgf@sys@tonumber{\pgf@y} \pgf@domb]
+ /Function \pgf@pdfparsedfunction
+ /Extend [true false] >> >>
+ >>}%
+ \pgfsys@invoke{/Sh sh}%
+ \special{pdf:exobj}}}\@tempa% <<
+ \expandafter\xdef\csname @pgfshading#1!\endcsname{%
+ \hbox to\the\pgfutil@tempdima{\vbox to\the\pgfutil@tempdima{\vfil\special{pdf:uxobj @pgfshade\the\pgfsys@objnum}}\hfil}}%
+ }%
+ \global\advance\pgfsys@objnum\@ne%
+}
+\def\pgfsys@functionalshading#1#2#3#4{%
+ {%
+ \pgf@process{#2}%
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{#3}%
+ \pgf@xb=\pgf@x%
+ \pgf@yb=\pgf@y%
+ \advance\pgf@x by-\pgf@xa%
+ \advance\pgf@y by-\pgf@ya%
+ \pgf@sys@bp@correct{\pgf@xa}%
+ \pgf@sys@bp@correct{\pgf@ya}%
+ \pgf@sys@bp@correct{\pgf@xb}%
+ \pgf@sys@bp@correct{\pgf@yb}%
+ \pgf@xc=-\pgf@xa%
+ \pgf@yc=-\pgf@ya%
+ % Now build the function
+ \edef\@tempa{\noexpand\pgfutil@insertatbegincurrentpagefrombox{%
+ \special{pdf:stream @pgfstream\the\pgfsys@objnum\space({#4}) <</FunctionType 4
+ /Domain [\pgf@sys@tonumber{\pgf@xa}\space\pgf@sys@tonumber{\pgf@xb}\space\pgf@sys@tonumber{\pgf@ya}\space\pgf@sys@tonumber{\pgf@yb}]
+ /Range [0 1 0 1 0 1]>>}}}\@tempa%
+ \edef\@tempa{\noexpand\pgfutil@insertatbegincurrentpagefrombox{%
+ \special{pdf:bxobj @pgfshade\the\pgfsys@objnum\space width \the\pgf@x\space height \the\pgf@y}%
+ \special{pdf:put @resources <</Shading <</Sh <</ShadingType 1
+ /ColorSpace /DeviceRGB
+ /Matrix [1 0 0 1 \pgf@sys@tonumber{\pgf@xc}\space\pgf@sys@tonumber{\pgf@yc}]
+ /Domain [\pgf@sys@tonumber{\pgf@xa}\space\pgf@sys@tonumber{\pgf@xb}\space\pgf@sys@tonumber{\pgf@ya}\space\pgf@sys@tonumber{\pgf@yb}]
+ /Function @pgfstream\the\pgfsys@objnum>> >> >>}%
+ \pgfsys@invoke{/Sh sh}%
+ \special{pdf:exobj}}}\@tempa% <<
+ \expandafter\xdef\csname @pgfshading#1!\endcsname{%
+ \leavevmode\hbox to\the\pgf@x{\vbox to\the\pgf@y{\vfil\special{pdf:uxobj @pgfshade\the\pgfsys@objnum}}\hfil}}%
+ }%
+ \global\advance\pgfsys@objnum\@ne%
+}
+% \pgf@sys@pdf@dvi@tracker was not touched!
+\def\pgf@sys@pdf@dvi@tracker{
+ \def\pgfsys@markposition##1{%
+ \pdfsavepos%
+ \edef\pgf@temp{##1}%
+ \expandafter\write\expandafter\pgfutil@auxout\expandafter{%
+ \expandafter\noexpand\expandafter\pgfsyspdfmark\expandafter{\pgf@temp}{\the\pdflastxpos}{\the\pdflastypos}}%
+ }
+ \def\pgfsyspdfmark##1##2##3{%
+ \expandafter\gdef\csname pgf@sys@pdf@mark@pos@##1\endcsname{\pgfqpoint{##2sp}{##3sp}}%
+ }
+ \def\pgfsys@getposition##1##2{%
+ \edef\pgf@marshal{\let\noexpand##2=\expandafter\noexpand\csname pgf@sys@pdf@mark@pos@##1\endcsname}%
+ \pgf@marshal%
+ }
+ \def\pgf@sys@pdf@mark@pos@pgfpageorigin{\pgfpointorigin}
+}
+
+% Resource management: bugs were fixed.
+\newif\ifpgf@sys@pdf@colorspaces@exists
+\newif\ifpgf@sys@pdf@patterns@exists
+\newif\ifpgf@sys@pdf@extgs@exists
+\newif\ifpgf@sys@pdf@colorspaces@created
+\newif\ifpgf@sys@pdf@patterns@created
+\newif\ifpgf@sys@pdf@extgs@created
+\newif\ifpgf@sys@pdf@any@resources
+
+\def\pgf@sys@setuppdfresources@plain{%
+ % This command will setup pdf resource in plain and in latex
+ % mode. ConTeXt has its own handler
+ \pgfutil@insertatbegineverypage{%
+ \pgf@sys@pdf@any@resourcesfalse%
+ \ifpgf@sys@pdf@extgs@exists%
+ \pgf@sys@pdf@any@resourcestrue%
+ \ifpgf@sys@pdf@extgs@created\else\special{pdf:obj @pgfextgs <<>>}\global\pgf@sys@pdf@extgs@createdtrue\fi% <<
+ \fi%
+ \ifpgf@sys@pdf@colorspaces@exists%
+ \pgf@sys@pdf@any@resourcestrue%
+ \ifpgf@sys@pdf@colorspaces@created\else\special{pdf:obj @pgfcolorspaces <<>>}\global\pgf@sys@pdf@colorspaces@createdtrue\fi% <<
+ \fi%
+ \ifpgf@sys@pdf@patterns@exists%
+ \pgf@sys@pdf@any@resourcestrue%
+ \ifpgf@sys@pdf@patterns@created\else\special{pdf:obj @pgfpatterns <<>>}\global\pgf@sys@pdf@patterns@createdtrue\fi% <<
+ \fi%
+ \ifpgf@sys@pdf@any@resources%
+ \special{pdf:put @resources
+ <<
+ \ifpgf@sys@pdf@extgs@exists /ExtGState @pgfextgs \fi
+ \ifpgf@sys@pdf@patterns@exists /Pattern @pgfpatterns \fi
+ \ifpgf@sys@pdf@colorspaces@exists /ColorSpace @pgfcolorspaces \fi
+ >>}% <<
+ \fi%
+ }
+ \def\pgf@sys@addpdfresource@extgs@plain##1{%
+ \global\pgf@sys@pdf@extgs@existstrue%
+ \pgfutil@insertatbegincurrentpage{\special{pdf:put @pgfextgs << ##1 >>}}% <<
+ }
+ \def\pgf@sys@addpdfresource@colorspaces@plain##1{%
+ \global\pgf@sys@pdf@colorspaces@existstrue%
+ \pgfutil@insertatbegincurrentpage{\special{pdf:put @pgfcolorspaces << ##1 >>}}% <<
+ }
+ \def\pgf@sys@addpdfresource@patterns@plain##1{%
+ \global\pgf@sys@pdf@patterns@existstrue%
+ \pgfutil@insertatbegincurrentpage{\special{pdf:put @pgfpatterns << ##1 >>}}% <<
+ }
+}
+\pgfutil@setuppdfresources % possibly call the above
+
+% As pgfsys-pdftex.def, the following code is required
+% to give colors on pattern objects.
+\pgfutil@addpdfresource@colorspaces{ /pgfprgb [/Pattern /DeviceRGB] }
+
+% Image Mask came from pgfsys-pdftex.def
+% generic/pgf/basiclayer/pgfcoreimage.code.tex must be modified!
+\def\pgfsys@defineimage{% width, height, page number
+ \ifx\includegraphics\relax
+ \ifx\pgf@imagewidth\pgfutil@empty\edef\pgf@imagewidth{1bp}\fi% width?
+ \ifx\pgf@imageheight\pgfutil@empty\edef\pgf@imageheight{1bp}\fi% height?
+ \ifx\pgf@imagepage\pgfutil@empty\else\edef\pgf@imagepage{ page \pgf@imagepage}\fi%
+ \ifx\pgf@imageinterpolate\pgfutil@empty\else\edef\pgf@imageinterpolate{ /Interpolate\space\pgf@imageinterpolate}\fi%
+ \ifx\pgf@imagemask\pgfutil@empty\else\xdef\pgf@imagemask{ /SMask @\pgf@imagemask}\fi%
+ \edef\pgf@image{\noexpand\hbox to \pgf@imagewidth{\vbox to \pgf@imageheight{\vfil\special{pdf:image width \pgf@imagewidth\space height \pgf@imageheight\space\pgf@imagepage\space(\pgf@filename) <<\pgf@imageinterpolate\pgf@imagemask\space>>}}\hfil}}%
+ \else
+ \ifx\pgf@imagewidth\pgfutil@empty\else\edef\pgf@imagewidth{width=\pgf@imagewidth,}\fi%
+ \ifx\pgf@imageheight\pgfutil@empty\else\edef\pgf@imageheight{height=\pgf@imageheight,}\fi%
+ \ifx\pgf@imagepage\pgfutil@empty\else\edef\pgf@imagepage{page=\pgf@imagepage,}\fi%
+ \ifx\pgf@imageinterpolate\pgfutil@empty\else\edef\pgf@imageinterpolate{interpolate=\pgf@imageinterpolate,}\fi%
+ \ifx\pgf@imagemask\pgfutil@empty\else\xdef\pgf@imagemask{mask=\pgf@imagemask,}\fi%
+ \edef\pgf@image{\noexpand\includegraphics[\pgf@imageheight\pgf@imagewidth\pgf@imagepage\pgf@imageinterpolate\pgf@imagemask]{\pgf@filename}}%
+ \fi%
+}
+\def\pgfsys@definemask#1{%
+ \ifx\pgf@maskmatte\pgfutil@empty%
+ \else%
+ \edef\pgf@maskmatte{/Matte [\pgf@maskmatte]}%
+ \fi%
+ \edef\pgf@attr{\pgf@maskmatte\space /Decode [1 0]}%
+ \special{pdf:image @pgfmask\the\pgfsys@objnum\space hide (\pgf@filename) << \pgf@attr >>}%
+ \edef\pgf@mask{pgfmask\the\pgfsys@objnum}%
+ \global\advance\pgfsys@objnum\@ne%
+}
+
+% Patterns came from pgfsys-pdftex.def
+% dvipdfmx provides a new special `pdf:stream' for a stream object.
+\def\pgfsys@declarepattern#1#2#3#4#5#6#7#8#9{%
+ % Start building the pattern dictionary:
+ \pgf@xa=#2\relax%
+ \pgf@ya=#3\relax%
+ \pgf@xb=#4\relax%
+ \pgf@yb=#5\relax%
+ \pgf@xc=#6\relax%
+ \pgf@yc=#7\relax%
+ \pgf@sys@bp@correct\pgf@xa%
+ \pgf@sys@bp@correct\pgf@ya%
+ \pgf@sys@bp@correct\pgf@xb%
+ \pgf@sys@bp@correct\pgf@yb%
+ \pgf@sys@bp@correct\pgf@xc%
+ \pgf@sys@bp@correct\pgf@yc%
+ % Now create the pattern object:
+ \special{pdf:stream @pgf@patternobject@#1 (#8)
+ << /Type /Pattern
+ /PatternType 1
+ /PaintType \ifnum#9=0 2 \else 1 \fi
+ /TilingType 1
+ /BBox [\pgf@sys@tonumber\pgf@xa\space\pgf@sys@tonumber\pgf@ya\space\pgf@sys@tonumber\pgf@xb\space\pgf@sys@tonumber\pgf@yb]
+ /XStep \pgf@sys@tonumber\pgf@xc\space
+ /YStep \pgf@sys@tonumber\pgf@yc\space
+ /Resources << >> %<<
+ >>}%
+ \pgfutil@addpdfresource@patterns{/pgfpat#1\space @pgf@patternobject@#1}%
+}
+\def\pgfsys@setpatternuncolored#1#2#3#4{%
+ \pgfsysprotocol@literal{/pgfprgb cs #2 #3 #4 /pgfpat#1\space scn}%
+}
+\def\pgfsys@setpatterncolored#1{%
+ \pgfsysprotocol@literal{/Pattern cs /pgfpat#1\space scn}%
+}
+
+% Opacity masks (fadings) came from pgfsys-pdftex.def
+%
+% One problem was that the second argument of \pgfsys@fadingfrombox
+% is a box so that \pgfutil@insertatbegincurrentpage cannot be used.
+% So, the new command \pgfutil@insertatbegincurrentpagefrombox is written
+% in generic/pgf/utilities/pgfutil-[context,latex,plain].def.
+\def\pgfsys@fadingfrombox#1#2{%
+ \expandafter\ifx\csname pgfsmaskxform@#1\endcsname\relax%
+ {%
+ \pgf@x=-.5\wd#2%
+ \pgf@y=-.5\ht#2%
+ \advance\pgf@y by.5\dp#2%
+ \expandafter\xdef\csname pgfsmasktrans@#1\endcsname{%
+ \noexpand\pgftransformcm{1}{0}{0}{1}{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}%
+ \edef\@tempa{\noexpand\pgfutil@insertatbegincurrentpagefrombox{%
+ \special{pdf:bxobj @pgfsmask\the\pgfsys@objnum\space%
+ width \the\wd#2\space height \the\ht#2\space depth \the\dp#2}%
+ \wd#2=0pt%
+ \ht#2=0pt%
+ \dp#2=0pt%
+ \box#2%
+ \special{pdf:exobj <</Group <</S/Transparency /CS/DeviceGray>> >>}}}\@tempa%
+ \expandafter\xdef\csname pgfsmaskxform@#1\endcsname{\the\pgfsys@objnum}%
+ }%
+ \global\advance\pgfsys@objnum\@ne%
+ \fi%
+}
+\def\pgfsys@usefading#1#2#3#4#5#6#7{%
+ \expandafter\ifx\csname pgfsmaskxform@#1\endcsname\relax%
+ \PackageError{pgf}{Undefined fading '#1'}{}%
+ \else%
+ {%
+ \expandafter\ifx\csname pgfsmask@#1\endcsname\relax%
+ \pgf@sys@pdf@install@mask{#1}%
+ \fi%
+ \pgftransformreset%
+ \pgftransformcm{#2}{#3}{#4}{#5}{\pgfpoint{#6}{#7}}%
+ \csname pgfsmasktrans@#1\endcsname%
+ {%
+ \pgflowlevelsynccm%
+ \pgfsys@invoke{/pgfsmask\csname pgfsmaskxform@#1\endcsname\space gs}%
+ }%
+ \pgftransforminvert%
+ \pgflowlevelsynccm%
+ }%
+ \fi
+}
+\def\pgf@sys@pdf@install@mask#1{%
+ \pgfutil@addpdfresource@extgs{%
+ /pgfsmask\csname pgfsmaskxform@#1\endcsname\space <<
+ /SMask <<
+ /S /Luminosity
+ /G @pgfsmask\csname pgfsmaskxform@#1\endcsname
+ >> >>}%<<
+ \expandafter\let\csname pgfsmask@#1\endcsname\expandafter\csname pgfsmaskxform@#1\endcsname%
+}
+% Transparency groups came from pgfsys-pdftex.def
+\def\pgfsys@transparencygroupfrombox#1{%
+ {%
+ \pgf@sys@bp@correct\pgf@picminx%
+ \pgf@sys@bp@correct\pgf@picmaxx%
+ \pgf@sys@bp@correct\pgf@picminy%
+ \pgf@sys@bp@correct\pgf@picmaxy%
+ \edef\@tempa{\noexpand\pgfutil@insertatbegincurrentpagefrombox{%
+ \special{pdf:bxobj @pgftransgroup\the\pgfsys@objnum\space bbox \pgf@sys@tonumber\pgf@picminx\space\pgf@sys@tonumber\pgf@picminy\space\pgf@sys@tonumber\pgf@picmaxx\space\pgf@sys@tonumber\pgf@picmaxy}%
+ \wd#1=0pt%
+ \ht#1=0pt%
+ \dp#1=0pt%
+ \hskip\pgf@picminx bp\box#1\hskip-\pgf@picminx bp%
+ \special{pdf:exobj <</Group <</S/Transparency>> >>}}}\@tempa%
+ \special{pdf:uxobj @pgftransgroup\the\pgfsys@objnum}%
+ }%
+ \global\advance\pgfsys@objnum\@ne%
+}
%
% Position tracking (needs pdftex >= 1.40.0-alpha-20051205 in dvi mode)
diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def
index af868df5fc4..cec3fa14fda 100644
--- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def
+++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def
@@ -7,13 +7,13 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-dvips.def,v 1.19 2007/12/12 16:57:17 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-dvips.def,v 1.20 2008/04/03 17:04:45 tantau Exp $
% Driver commands for dvips
\def\pgfsys@invoke#1{\special{ps:: #1}}
\def\pgfsys@outerinvoke#1{\special{ps: #1}}
-\def\pgf@sys@postscript@header#1{\AtBeginDvi{\special{! #1}}}
+\def\pgf@sys@postscript@header#1{\pgfutil@insertatbegincurrentpage{\special{! #1}}}
\def\pgf@sys@postscript@object#1{\special{! #1}}
diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def
index c9881df5737..8627a611077 100644
--- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def
+++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-pdftex.def,v 1.20 2007/12/20 10:56:53 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-pdftex.def,v 1.26 2009/05/22 07:25:48 jinhwancho Exp $
% Driver commands for pdf
@@ -22,6 +22,7 @@
%
\def\pgfsys@invoke#1{\pdfliteral{#1}}
+% Synced hboxes
\def\pgfsys@hboxsynced#1{%
{%
\pgfsys@beginscope%
@@ -43,48 +44,6 @@
}
-% Page resources (they are kept in objects and only written at the
-% very end)
-
-\pdfobj reserveobjnum
-\edef\pgf@sys@pdf@extgs@objnum{\the\pdflastobj}
-
-\pdfobj reserveobjnum
-\edef\pgf@sys@pdf@pattern@objnum{\the\pdflastobj}
-
-\immediate \pdfobj {<< /pgfprgb [/Pattern /DeviceRGB] >>}%<<
-\edef\pgf@sys@pdf@cs@objnum{\the\pdflastobj}
-
-\def\pgf@sys@pdf@possible@resources{%
- /ColorSpace \pgf@sys@pdf@cs@objnum\space 0 R
- /Pattern \pgf@sys@pdf@pattern@objnum\space 0 R
- /ExtGState \pgf@sys@pdf@extgs@objnum\space 0 R
-}
-
-{
- \edef\temp{
- \pgf@sys@pdf@possible@resources
- }
- \expandafter\global\expandafter\pdfpageresources\expandafter{\temp}
-}
-
-\expandafter\pgfutil@everybye\expandafter{%
- \the\pgfutil@everybye%
- \immediate \pdfobj useobjnum \pgf@sys@pdf@extgs@objnum {<<\pgf@sys@pgf@resource@list@extgs>>}%<<
- \immediate \pdfobj useobjnum \pgf@sys@pdf@pattern@objnum {<<\pgf@sys@pgf@resource@list@patterns>>}%<<
-}
-
-\let\pgf@sys@pgf@resource@list@extgs=\pgfutil@empty%
-\let\pgf@sys@pgf@resource@list@patterns=\pgfutil@empty%
-
-\def\pgf@sys@pdf@addtopageresources@extgs#1{%
- \xdef\pgf@sys@pgf@resource@list@extgs{\pgf@sys@pgf@resource@list@extgs\space#1}%
-}
-
-\def\pgf@sys@pdf@addtopageresources@patterns#1{%
- \xdef\pgf@sys@pgf@resource@list@patterns{\pgf@sys@pgf@resource@list@patterns\space#1}%
-}
-
\def\pgfsys@imagesuffixlist{.pdf:.jpg:.jpeg:.png:}
\def\pgfsys@defineimage{% width, height, page number
@@ -102,19 +61,19 @@
\edef\pgf@image{\noexpand\pdfrefform\the\pdflastform}%
\else% new version
{\pdfximage \pgf@imageheight \pgf@imagewidth attr
- {\pgf@imageinterpolate\space\pgf@imagemask} \pgf@imagepage
+ {/Interpolate \pgf@imageinterpolate\space\pgf@imagemask} \pgf@imagepage
{\pgf@filename}}%
\edef\pgf@image{\noexpand\pdfrefximage\the\pdflastximage}%
\fi
}%
-\def\pgfsys@definemask{%
+\def\pgfsys@definemask#1{%
\ifx\pgf@maskmatte\pgfutil@empty%
\else%
\edef\pgf@maskmatte{/Matte [\pgf@maskmatte]}%
\fi%
\edef\pgf@attr{{\pgf@maskmatte\space /Decode [1 0]}}%
\immediate\pdfximage attr \pgf@attr {\pgf@filename}%
- \edef\pgf@mask{\the\pdflastximage}%
+ \edef\pgf@mask{/SMask \the\pdflastximage\space 0 R}%
}
\def\pgfsys@horishading#1#2#3{%
{%
@@ -247,7 +206,7 @@
/Resources << >> %<<
}
{#8}%
- \pgf@sys@pdf@addtopageresources@patterns{/pgfpat#1\space \the\pdflastobj\space 0 R}%
+ \pgfutil@addpdfresource@patterns{/pgfpat#1\space \the\pdflastobj\space 0 R}%
}
\def\pgfsys@setpatternuncolored#1#2#3#4{%
@@ -323,6 +282,7 @@
%
\def\pgfsys@fadingfrombox#1#2{%
{%
+ \pgf@sys@pdf@check@resources%
\pgf@x=-.5\wd#2%
\pgf@y=-.5\ht#2%
\advance\pgf@y by.5\dp#2%
@@ -364,7 +324,7 @@
>>
}% <<
\pgfutil@tempboxa%
- \pgf@sys@pdf@addtopageresources@extgs{%
+ \pgfutil@addpdfresource@extgs{%
/pgfsmask\the\pdflastxform\space
<<
/SMask
@@ -380,6 +340,7 @@
% Transparency groups
%
\def\pgfsys@transparencygroupfrombox#1{%
+ \pgf@sys@pdf@check@resources%
\pdfxform
attr { /Group << /S /Transparency >> } %<<
resources { \pgf@sys@pdf@possible@resources }
@@ -387,6 +348,53 @@
\setbox#1=\hbox{\pdfrefxform\pdflastxform}%
}
+
+
+
+%
+% Resource management
+%
+
+\def\pgf@sys@setuppdfresources@plain{%
+ % This command will setup pdf resource in plain and in latex
+ % mode. ConTeXt has its own handler
+ % Page resources (they are kept in objects and only written at the
+ % very end)
+ \pdfobj reserveobjnum \edef\pgf@sys@pdf@extgs@objnum{\the\pdflastobj}
+ \pdfobj reserveobjnum \edef\pgf@sys@pdf@pattern@objnum{\the\pdflastobj}
+ \pdfobj reserveobjnum \edef\pgf@sys@pdf@colrospaces@objnum{\the\pdflastobj}
+ \def\pgf@sys@pdf@possible@resources{%
+ /ColorSpace \pgf@sys@pdf@colrospaces@objnum\space 0 R
+ /Pattern \pgf@sys@pdf@pattern@objnum\space 0 R
+ /ExtGState \pgf@sys@pdf@extgs@objnum\space 0 R
+ }
+ \let\pgf@sys@pdf@check@resources=\relax%
+ \def\pgf@sys@pdf@install@pageresources{
+ {
+ \edef\temp{
+ \pgf@sys@pdf@possible@resources
+ }
+ \expandafter\global\expandafter\pdfpageresources\expandafter{\temp}
+ }
+ }
+ \pgf@sys@pdf@install@pageresources
+ \expandafter\pgfutil@everybye\expandafter{%
+ \the\pgfutil@everybye%
+ \immediate \pdfobj useobjnum \pgf@sys@pdf@extgs@objnum {<<\pgf@sys@pgf@resource@list@extgs>>}%<<
+ \immediate \pdfobj useobjnum \pgf@sys@pdf@pattern@objnum {<<\pgf@sys@pgf@resource@list@patterns>>}%<<
+ \immediate \pdfobj useobjnum \pgf@sys@pdf@colrospaces@objnum {<<\pgf@sys@pgf@resource@list@colorspaces>>}%<<
+ }
+ \let\pgf@sys@pgf@resource@list@extgs=\pgfutil@empty%
+ \let\pgf@sys@pgf@resource@list@patterns=\pgfutil@empty%
+ \let\pgf@sys@pgf@resource@list@colorspaces=\pgfutil@empty%
+ \def\pgf@sys@addpdfresource@extgs@plain##1{\xdef\pgf@sys@pgf@resource@list@extgs{\pgf@sys@pgf@resource@list@extgs\space##1}}
+ \def\pgf@sys@addpdfresource@patterns@plain##1{\xdef\pgf@sys@pgf@resource@list@patterns{\pgf@sys@pgf@resource@list@patterns\space##1}}
+ \def\pgf@sys@addpdfresource@colorspaces@plain##1{\xdef\pgf@sys@pgf@resource@list@colorspaces{\pgf@sys@pgf@resource@list@colorspaces\space##1}}
+}
+\pgfutil@setuppdfresources % possibly call the above
+
+\pgfutil@addpdfresource@colorspaces{ /pgfprgb [/Pattern /DeviceRGB] }
+
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def
index 76202d4c842..71f819cc2bc 100644
--- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def
+++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-tex4ht.def,v 1.16 2008/02/07 19:25:41 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-tex4ht.def,v 1.23 2010/08/18 12:14:47 ludewich Exp $
\RequirePackage{xcolor}
@@ -28,26 +28,104 @@
\newcount\pgf@sys@svg@picnum
+%%
+%% initial support of Mathml and xhtml inside svg through the svg:foreignelement tag
+%%
+%% it'll allow us to have complicated text nodes in the tex4ht driver
+%%
+
+
+%Example (to improve the display, you have to use css)
+%
+%\tikzpicture[svg text only=false]
+%\draw (0,0) node[inner sep=0pt,draw] {tight}
+%(0cm,2em) node[inner sep=5pt,draw] {loose}
+%(0cm,4em) node[fill=red!20] {default};
+%\draw (3,0) node[inner sep=0pt,draw] {TIGHT}
+%(3cm,2em) node[inner sep=5pt,draw] {LOOSE}
+%(3cm,4em) node[fill=red!20] {DEFAULT};
+%\draw (6,0) node[inner sep=0pt,draw] {$tight$}
+%(6cm,2em) node[inner sep=5pt,draw] {$loose$}
+%(6cm,4em) node[fill=red!20] {$default$};
+%\draw (9,0) node[inner sep=0pt,draw] {$TIGHT$}
+%(9cm,2em) node[inner sep=5pt,draw] {$LOOSE$}
+%(9cm,4em) node[fill=red!20] {$Default$};
+%\endtikzpicture
+%
+% you can use the options "svg text css=filename", "svg text id=idname", "svg text class=classname" to customize the display through the use of css
+%
+
+
+
+
+
+
+
+%\def\pgfsys@beginpicture{%
+% % \Configure{[]}{$}{$} these two lines aren't needed for tex4ht and moreother they produce errors with plain tex !
+% % \Configure{()}{$}{$}
+% \Configure{$$}{}{}{}%$$
+% \Configure{$}{}{}{}%$
+% \Configure{SUB}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}}
+% \Configure{SUP}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}}
+% \Configure{SUBSUP}{}{}{}
+% \Configure{htf}
+% {0}{+}{<tspan font-family="}
+% {\%s}{" font-size="\%s}{}{}
+% {">}{</tspan>}
+%}
+
+
+
+%\def\pgfsys@endpicture{%
+% % undo:
+% \Configure{htf}{0}{+}{<span\Hnewline
+% class="}{\%s}{-\%s}{x-x-\%d}{}{">}{</span>}
+%}
+
+% we don't want tex4ht putting <p> and </p> tags automatically in our svg code and causing invalid xhtml in our svg pictures
+\newif\ifpgfsys@CssIncluded@\pgfsys@CssIncluded@false
+\def\pgfsys@beginpicture{%
+ \EndP\HtmlParOff
+ \pgfkeys{/tikz/tex4ht node/escape=false}% text only nodes are the default. Advantage : pure svg pictures are the default, nicer for text only nodes.
+ % Disadvantages : this rendering methods produce more invalid or degraded svg pictures than with the foreignelement tag
+ %% we use css to control the display of foreignelement rendered text nodes
+ \ifpgfsys@CssIncluded@
+ \else
+ \Css{
+ .foreignobject {%
+ line-height:100\%;
+ font-size:120\%; % this is the trick....a font of size 100% in a box scaled down to half size makes it a half size font.
+% you'll have to double the size of things that you want to have a regular size in this half-scaled box though
+ font-family:STIXgeneral,Times,Symbol,cmr10,CMSY10,CMEX10;% can't wait for the stix font...the cmr10, etc font are available from the mozilla site, times and symbols should be okey
+ padding:0;
+ margin:0;
+% background-color:\#12ff55; usefull for debugging positioning
+ text-align:center; % good for centered text nodes...will have to improve that later on...with more integration with tikz options for text nodes
+ }
+ }%
+ \Css{%
+ math {%, math[mode="inline"] {
+ vertical-align:baseline;
+ line-height:100\%;
+ font-size:100\%;
+ font-family:STIXGeneral,Times,Symbol, cmr10,cmsy10,cmex10,cmmi10;
+ font-style: normal;
+ margin:0;
+% background-color:\#99ff99;
+ padding:0;
+ }%
+ }%
+ \pgfsys@CssIncluded@true
+ \fi
+}%
-\def\pgfsys@beginpicture{%
- \Configure{[]}{$}{$}
- \Configure{()}{$}{$}
- \Configure{$$}{}{}{}%$$
- \Configure{$}{}{}{}%$
- \Configure{SUB}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}}
- \Configure{SUP}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}}
- \Configure{SUBSUP}{}{}{}
- \Configure{htf}
- {0}{+}{<tspan font-family="}
- {\%s}{" font-size="\%s}{}{}
- {">}{</tspan>}
-}
\def\pgfsys@endpicture{%
- % undo:
- \Configure{htf}{0}{+}{<span\Hnewline
- class="}{\%s}{-\%s}{x-x-\%d}{}{">}{</span>}
-}
-
+ \HtmlParOn
+ \par% FIXME : was '\Par' but that seems to be undefined!?
+}%
+
+% this is okey for both rendering methods for text nodes (mtext or foreignelement)...
\def\pgfsys@typesetpicturebox#1{%
\global\advance\pgf@sys@svg@picnum by 1\relax%
% Ok, compute width/height
@@ -81,6 +159,13 @@
\pgfsysprotocol@flushcurrentprotocol%
\pgfsys@invoke{" type="image/svg+xml"><p>SVG-Viewer needed.</p></object>}%
\special{t4ht>\jobname-\the\pgf@sys@svg@picnum.svg}%
+%%%%%%%% This is necessary to control the svg through css
+ \pgfkeys{%
+ /tikz/tex4ht node/css/.get=\pgfsys@foreignobject@css
+ }%
+ \pgfsys@invoke{<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>\Hnewline% added that
+ <?xml-stylesheet href="\pgfsys@foreignobject@css.css" type="text/css"?>\Hnewline}% added that
+%%%%%%%%%%%%%%% maybee I should add an option to change the css, for the whole picture
\pgfsys@invoke{<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" width="\the\pgf@xc"
height="\the\pgf@yc" viewBox="}%
@@ -92,19 +177,26 @@
\pgfsys@invoke{) scale(1,-1) translate(0,}%
\pgf@sys@pt\pgf@ya\pgfsysprotocol@flushcurrentprotocol%
\pgfsys@invoke{)">\Hnewline }%
- \pgfmathsetlength\pgf@x{\pgf@shift@baseline}%
- \advance\pgf@x by-\pgf@picminy\relax%
+ %
+ \pgf@ya=\pgf@shift@baseline\relax%
+ \advance\pgf@ya by-\pgf@picminy\relax%
+ %
+ %
\advance\pgf@picmaxy by-\pgf@picminy\relax% maxy is now the height
\advance\pgf@picmaxx by-\pgf@picminx\relax% maxx is now the width
\setbox#1=\hbox{\hskip-\pgf@picminx\lower\pgf@picminy\box#1}%
\ht#1=\pgf@picmaxy%
\wd#1=\pgf@picmaxx%
\dp#1=0pt%
- \leavevmode\raise-\pgf@x\box#1%
+ \leavevmode
+ \pgf@xa=\pgf@trimleft@final\relax \ifdim\pgf@xa=0pt \else\kern\pgf@xa\fi
+ \raise-\pgf@ya\box#1%
+ \pgf@xa=\pgf@trimright@final\relax \ifdim\pgf@xa=0pt \else\kern\pgf@xa\fi
\pgfsys@invoke{</g>\Hnewline </svg>\Hnewline }%
\special{t4ht<\jobname-\the\pgf@sys@svg@picnum.svg}%
-}
+}%
+%% we'll use this hbox for the mtext rendering method (the "text only=true" option)
\def\pgfsys@hbox#1{%
\pgf@x=.5\wd#1%
\ifx\tikz@textcolor\relax%
@@ -130,7 +222,171 @@
\dp#1=0pt%
\box#1
\HCode{</text>\Hnewline }%
-}
+}%
+
+%% we save this definition
+\let\pgfsys@mtext@hbox\pgfsys@hbox
+
+%% we have to use some "evil" ^^ tex4ht hackery
+% tex4ht hackery
+{% grouping necessary cause we change the catcode of ":"
+ \catcode`:=11\relax
+ %%% this is necessary to calculate the size of text nodes with inline maths
+ % (it is an improvement of tex4ht, got to ask eitan gurary if he could put it in the tex4ht code)
+ \gdef\DviMathAlt{%
+ \a:DviMath\leavevmode \MathClass \ht:special{t4ht@(}\hbox\bgroup{\expandafter\ifx\csname ht:everypar\endcsname\relax\expandafter\everypar\else \expandafter\ht:everypar\fi{}\leavevmode\ht:special{t4ht@)}}\DviSend
+ }%
+% these are configures for the foreignelement rendering method of text nodes : we let tex4ht write xhtml and mathml in the svg picture
+%
+ \gdef\pgfsys@foreignobject@configure{%
+ \Configure{$}{\Configure{@math}{%\a:mathml
+ display="inline" }\DviMathAlt}{\EndDviMath}{}%%% we REALLY need to use \DviMathAlt here instead of \DviMath see above remark
+ \Configure{$$}{\Configure{@math}{%\a:mathml
+ display="block" }\IgnorePar
+ \ifvmode\else \HCode{<!--tex4ht:inline-->}\fi\EndP
+ \DviMath}{\EndDviMath\ShowPar\pgfsys@foreignobject@par{\csname HCondtrue\endcsname\noindent}
+ }{\DisplayMathtrue}%
+ \Configure{SUB}{\Send{BACK}{<\a:mathml msub><\a:mathml mrow\Hnewline>}%
+ \Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base}{\Tg</\a:mathml mrow>\TG</\a:mathml msub\Hnewline>}%
+ \Configure{SUP}{\Send{BACK}{<\a:mathml msup><\a:mathml mrow\Hnewline>}%
+ \Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base}{\Tg</\a:mathml mrow>\TG</\a:mathml msup\Hnewline>}%
+ \Configure{SUBSUP}{\Send{BACK}{<\a:mathml msubsup><\a:mathml mrow\Hnewline>}%
+ \Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base}{\Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base}{\Tg</\a:mathml mrow>\TG</\a:mathml msubsup\Hnewline>}%
+ \Configure{htf}{0}{+}{<span\Hnewline
+ class="}{\%s}{-\%s}{x-x-\%d}{}{">}{</span>}%
+ }%
+ \global\let\pgfsys@foreignobject@par=\par % use this instead of \par -- \Configure is no \long macro (at least in one of the older versions).
+
+% these are the configures for the mtext rendering method of text nodes : we turn everything into regular character (don't want math modes or subsup)
+% and we hope it works (it doesn't if the text nodes aren't simple)
+ \gdef\pgfsys@mtext@configure{%
+ % no configures for \(\) and \[\] those might be needed for context or Latex. Let me know !
+ \Configure{$$}{}{}{}% no block maths
+ \Configure{$}{}{}{}%$ no inline maths
+ \Configure{SUB}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}}%
+ \Configure{SUP}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}}%
+ \Configure{SUBSUP}{}{}{}% not both sub and sup
+ \Configure{htf} {0}{+}{<tspan font-family="}{\%s}{" font-size="\%s}{}{}{">}{</tspan>}%
+ }%
+}%
+
+% a counter to produce unique ids for each text node rendered with foreign element
+\newcount\pgf@sys@svg@nodenum
+
+
+% pgfutil@minipage
+%
+% I had to change it to make it play nice with the way tex4ht puts <p> and <\p> tags
+%
+
+\newif\ifpgfsys@textonly
+\def\pgfutil@minipage[#1]#2{%
+ \hbox to#2\bgroup
+ \hsize=#2\relax
+ \vbox\bgroup
+% though it works, I'm desabling the above mentioned hack to make tex4ht behave with <p> <\p>, because it blurps the positioning
+% (I''l try to fix that later, it's a css thing)
+%
+% \ifpgfsys@textonly\else\HtmlParOn\fi
+%
+% \noindent is better as it doesn't produce indentation AND it makes you leave vertical mode
+ \noindent%\leavevmode
+}%
+\def\pgfutil@endminipage{%
+% same thing here
+%
+% \ifpgfsys@textonly\else\EndP\HtmlParOff\fi
+ \egroup\egroup
+}%
+
+
+% I'll have to fix those names later
+\newbox\pgfsys@foreignobject@Box
+\newdimen\pgf@s
+\newdimen\pgf@t
+% this is the alternate hbox routine that renders text nodes through the foreignobject tag
+\def\pgfsys@foreignobject@hbox#1{%
+ % Compute box y translation (x translation is correct).
+ \pgf@y=-\ht#1\relax
+ \HCode{<g transform="scale(1,-1) translate(0,\pgf@sys@tonumber{\pgf@y}) % got to translate in y
+ scale(0.5,0.5)">\Hnewline}% scaling work around (damn dumb browsers !)
+ % Compute box size (scaled 2 times)
+ % this is necessary to make the browser scale the font down 50% (the STUPID browsers won't make font-size:50% happen,
+ % so we have to work around this by making svg scale the things down 50%, doubling the size of the text node frame (i.e. no changement there)
+ \pgf@x=2\wd#1\relax
+ \pgf@y=2\ht#1\relax
+ \advance\pgf@y by 2\dp#1\relax
+ % this is to adjust the y translation to compensate for the differences between the TeX and the Html models for lines
+ \setbox\pgfsys@foreignobject@Box=\hbox{abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
+ $abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZf_1^1\overline D)_1^1\vec i\vec j$}%
+ \pgf@t=\ht#1\relax
+ \advance\pgf@t by -\ht\pgfsys@foreignobject@Box\relax
+ \pgf@s=\pgf@t\relax
+ \advance\pgf@s by \dp#1\relax
+ \advance\pgf@s by -\dp\pgfsys@foreignobject@Box\relax
+ \ifnum\pgf@s>0\relax
+ \pgf@s=0pt
+ \pgf@t=0pt
+ \else
+ \advance \pgf@y by -2\pgf@s\relax
+ \pgf@t=2\pgf@t\relax
+ \fi
+ %
+ \HCode{<foreignObject x="0" y="\pgf@sys@tonumber{\pgf@t}"
+ width="\pgf@sys@tonumber{\pgf@x}" height="\pgf@sys@tonumber{\pgf@y}">}%
+ % this is to make use of the css, class and id options through which you can control the way things display
+ \pgfkeys{%
+ /tikz/tex4ht node/css/.get=\pgfsys@foreignobject@css,%
+ /tikz/tex4ht node/class/.get=\pgfsys@foreignobject@class,%
+ /tikz/tex4ht node/id/.get=\pgfsys@foreignobject@id
+ }%
+ \HCode{<head>\Hnewline
+ <link rel="stylesheet" type="text/css" href="\pgfsys@foreignobject@css.css" />\Hnewline
+ </head>\Hnewline
+% I'll have to look into this, perhaps there are better doctype....&nbsp; aren't recognised and produces invalid svg pictures
+% a workaround (not implemented yet) would be to make them into entities of the svg picture.
+ <body id="\pgfsys@foreignobject@id" class="\pgfsys@foreignobject@class" xmlns="http://www.w3.org/1999/xhtml" >\Hnewline
+ <div>\Hnewline
+ }%
+ \box#1%
+ \HCode{%
+ </div>\Hnewline
+ </body>\Hnewline
+ </foreignObject>\Hnewline
+ }%
+% debug positioning not needed but it would be nice to let it there to control things later on
+% \HCode{<rect x="0" y="0" width="\pgf@sys@tonumber{\pgf@x}" height="\pgf@sys@tonumber{\pgf@y}"
+% style="fill:yellow;stroke:red; fill-opacity:0.5;stroke-opacity:0.5"/>}
+ \HCode{</g>\Hnewline}%
+ \global\advance\pgf@sys@svg@nodenum by 1\relax
+}%
+
+% the options and the code that controls it all (switches between \pgfsys@mtext@hbox and \pgfsys@foreignelement@hbox)
+
+\pgfkeys{%
+ /tikz/.cd,
+ tex4ht node/escape/.is choice,
+ tex4ht node/escape/false/.code={\let\pgfsys@hbox\pgfsys@mtext@hbox\pgfsys@mtext@configure\pgfsys@textonlytrue},
+ tex4ht node/escape/true/.code={\let\pgfsys@hbox\pgfsys@foreignobject@hbox\pgfsys@foreignobject@configure\pgfsys@textonlyfalse},
+ tex4ht node/css/.initial=\jobname,
+ tex4ht node/class/.initial=foreignobject,
+ tex4ht node/id/.initial=\jobname\the\pgf@sys@svg@picnum-\the\pgf@sys@svg@nodenum
+}%
+
+
+
+
+
+
+% this might be needed
+%\font\SvgText=cmr10\relax
+
+
+
+
+% There is something rellay wrong with the way "%" chars are used in here... you should code "}%" to avoid unnecessary spaces
+% and it is unnecessary to code \cs%
+% got to be carefull with numbers though, cf the texbook...2\relax and 2 % are okey
\def\pgfsys@outerinvoke{\ifpgfpicture\expandafter\pgfsys@invoke\else\expandafter\pgfutil@gobble\fi}
@@ -182,8 +438,9 @@
\let\pgf@texht@undeclaredcolor=\@undeclaredcolor
\def\@declaredcolor{\ifpgfpicture\expandafter\pgf@xcolor@declaredcolor\else\expandafter\pgf@texht@declaredcolor\fi}
\def\@undeclaredcolor{\ifpgfpicture\expandafter\pgf@xcolor@undeclaredcolor\else\expandafter\pgf@texht@undeclaredcolor\fi}
- \ConfigureEnv{pgfpicture}{}{}{}{}
-}
+ %\ConfigureEnv{pgfpicture}{}{}{}{} there is no environment in plain TeX and this produces errors
+ % this might be needed for context or latex though....let me know !
+}%
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-xetex.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-xetex.def
index 08a26fdcef0..feaa7f77bae 100644
--- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-xetex.def
+++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-xetex.def
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-xetex.def,v 1.1 2007/12/17 14:52:31 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-xetex.def,v 1.3 2010/02/16 10:56:09 tantau Exp $
% Driver commands for dvipdfm
@@ -18,8 +18,12 @@
\input pgfsys-common-pdf-via-dvi.def
%
-% dvipdfm-specific stuff:
+% dvipdfmx-specific stuff:
%
+
+\def\pgfsys@invoke#1{\special{pdf:literal direct #1 }}
+
+
\ifx\XeTeXversion\@undefined
\PackageError{pgfsys}{XeTeX is not running, but it should. Somehow
the wrong driver got selected}{}
@@ -31,6 +35,12 @@
%
\pgf@sys@pdf@dvi@tracker
+%
+% Page size stuff
+%
+\def\pgfsys@papersize#1#2{%
+ \pdfpageheight#2%
+ \pdfpagewidth#1}
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex
index e568c4c8c90..3cd39c48645 100644
--- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys.code.tex,v 1.31 2008/02/07 19:25:41 tantau Exp $
+\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys.code.tex,v 1.37 2010/06/30 13:06:37 ludewich Exp $
% Load key mechanism
@@ -32,16 +32,16 @@
\pgf@x=#1\relax%
\pgf@x=0.99627\pgf@x%
\edef\temp{\expandafter\Pgf@geT\the\pgf@x\space}%
- \toks@\expandafter\expandafter\expandafter{\expandafter\pgfsysprotocol@currentprotocol\temp}%
- \xdef\pgfsysprotocol@currentprotocol{\the\toks@}%
+ \pgfutil@toks@\expandafter\expandafter\expandafter{\expandafter\pgfsysprotocol@currentprotocol\temp}%
+ \xdef\pgfsysprotocol@currentprotocol{\the\pgfutil@toks@}%
}%
}
\def\pgf@sys@pt#1{%
{%
\pgf@x=#1\relax%
\edef\temp{\expandafter\Pgf@geT\the\pgf@x\space}%
- \toks@\expandafter\expandafter\expandafter{\expandafter\pgfsysprotocol@currentprotocol\temp}%
- \xdef\pgfsysprotocol@currentprotocol{\the\toks@}%
+ \pgfutil@toks@\expandafter\expandafter\expandafter{\expandafter\pgfsysprotocol@currentprotocol\temp}%
+ \xdef\pgfsysprotocol@currentprotocol{\the\pgfutil@toks@}%
}%
}
@@ -56,6 +56,10 @@
\newdimen\pgf@xc
\newdimen\pgf@yc
+\newwrite\w@pgf@writea
+\newread\r@pgf@reada
+\let\pgfutil@inputcheck=\r@pgf@reada
+
% internal counters that are alwyas present when pgfsys is loaded
\newcount\c@pgf@counta
\newcount\c@pgf@countb
@@ -742,15 +746,20 @@
% Called at the end of a pgfpicture.
\def\pgfsys@typesetpicturebox#1{%
- \pgfmathsetlength\pgf@x{\pgf@shift@baseline}%
- \advance\pgf@x by-\pgf@picminy\relax%
+ \pgf@ya=\pgf@shift@baseline\relax%
+ \advance\pgf@ya by-\pgf@picminy\relax%
+ %
+ %
\advance\pgf@picmaxy by-\pgf@picminy\relax% maxy is now the height
\advance\pgf@picmaxx by-\pgf@picminx\relax% maxx is now the width
\setbox#1=\hbox{\hskip-\pgf@picminx\lower\pgf@picminy\box#1}%
\ht#1=\pgf@picmaxy%
\wd#1=\pgf@picmaxx%
\dp#1=0pt%
- \leavevmode\raise-\pgf@x\box#1%
+ \leavevmode%
+ \pgf@xa=\pgf@trimleft@final\relax \ifdim\pgf@xa=0pt \else\kern\pgf@xa\fi
+ \raise-\pgf@ya\box#1%
+ \pgf@xa=\pgf@trimright@final\relax \ifdim\pgf@xa=0pt \else\kern\pgf@xa\fi
}
% Called after a picture has been typeset in box #1. This
% command should insert the box into the normal TeX code. The box #1
@@ -880,6 +889,12 @@
% Discern the driver:
+
+% Default driver:
+\ifx\pgfsysdriver\@undefined
+ \pgfutil@guessdriver
+\fi
+
\input pgf.cfg
\PackageInfo{pgfsys}{Driver file for pgf: \pgfsysdriver}
diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex
index 86c7e5691b4..96fe6db490a 100644
--- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsyssoftpath.code.tex,v 1.6 2008/01/23 13:15:28 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsyssoftpath.code.tex,v 1.7 2008/07/18 19:06:58 ludewich Exp $
% This package provides the pgf system path abstraction layer. This
@@ -113,7 +113,7 @@
}
\def\pgfsyssoftpath@smalloverflow#1{%
\global\advance\pgfsyssoftpath@bigbuffer@items by1\relax%
- \ifnum\pgfsyssoftpath@smallbuffer@items<30\relax% good number?
+ \ifnum\pgfsyssoftpath@bigbuffer@items<30\relax% good number?
\expandafter\expandafter\expandafter\gdef%
\expandafter\expandafter\expandafter\pgfsyssoftpath@bigbuffer%
\expandafter\expandafter\expandafter{\expandafter\pgfsyssoftpath@bigbuffer\pgfsyssoftpath@smallbuffer#1}%
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfexternalwithdepth.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfexternalwithdepth.tex
new file mode 100644
index 00000000000..38eeb306855
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfexternalwithdepth.tex
@@ -0,0 +1,43 @@
+% Copyright 2007 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.
+%
+% In addition to the above licenses, this particular file may also be
+% directly inlined into other documents and this copyright notice may
+% be removed. Additionally, when you inline this file, you may modify
+% it as needed and you may remove comments.
+%
+% This file is intended to be distributed or even inlined into a file
+% when a document needs to be typeset on a system that does not have
+% pgf/TikZ installed.
+
+% "environment" for reading an external graphic. Note that there are
+% no (!) braces around the "name" of the environment
+%
+% #1 = name of the graphics file
+%
+% Example:
+%
+% \beginpgfgraphicnamed{mygraph}
+% \begin{tikzpicture}
+% ...
+% \end{tikzpicture}
+% \endpgfgraphicnamed
+
+\long\def\beginpgfgraphicnamed#1#2\endpgfgraphicnamed{%
+ \begingroup
+ \setbox1=\hbox{\includegraphics{#1}}%
+ \openin1=#1.dpth
+ \ifeof1 \box1
+ \else
+ \read1 to\pgfincludeexternalgraphicsdp \closein1
+ \dimen0=\pgfincludeexternalgraphicsdp\relax
+ \hbox{\lower\dimen0 \box1 }%
+ \fi
+ \endgroup
+}
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
index 46a62f31767..d31ddedfe26 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
@@ -1,4 +1,4 @@
-% Copyright 2006 by Till Tantau
+% Copyright 2008 by Till Tantau and Mark Wibrow
%
% This file may be distributed and/or modified
%
@@ -7,23 +7,72 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/utilities/pgffor.code.tex,v 1.8 2007/11/07 23:21:48 tantau Exp $
-
+\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/utilities/pgffor.code.tex,v 1.18 2010/03/23 14:47:45 vibrovski Exp $
\newdimen\pgffor@iter
\newdimen\pgffor@skip
\newif\ifpgffor@continue
+
\let\pgffor@beginhook=\pgfutil@empty
\let\pgffor@endhook=\pgfutil@empty
\let\pgffor@afterhook=\pgfutil@empty
+% Stack emulation
+%
+\newtoks\pgffor@stack
+\pgffor@stack={{}{}{}}
+
+\def\pgffor@stackpush#1{%
+ \def\pgffor@stacktemp{#1}%
+ \expandafter\expandafter\expandafter\pgffor@stack\expandafter\expandafter\expandafter=%
+ \expandafter\expandafter\expandafter{\expandafter\expandafter\expandafter%
+ {\expandafter\pgffor@stacktemp\expandafter}\the\pgffor@stack}%
+}
+
+\def\pgffor@stackpop{\expandafter\pgffor@@stackpop\the\pgffor@stack\pgffor@stackstop}
+\def\pgffor@@stackpop#1#2\pgffor@stackstop{\pgffor@stack{#2}#1}
+
\def\pgffor@emptyvalues{, \pgffor@stop,}%
-\def\foreach#1in{%
- \def\pgffor@var{#1}%
- \pgfutil@ifnextchar\bgroup{\pgffor@normal@list}{\pgffor@macro@list}}
+\def\pgffor@foreach{%
+ \pgffor@atbeginforeach%
+ \let\pgffor@assign@before@code=\pgfutil@empty%
+ \let\pgffor@assign@after@code=\pgfutil@empty%
+ \let\pgffor@assign@once@code=\pgfutil@empty%
+ \let\pgffor@remember@code=\pgfutil@empty%
+ \let\pgffor@remember@once@code=\pgfutil@empty%
+ \pgffor@alphabeticsequencefalse%
+ \pgffor@contextfalse%
+ %
+ \let\pgffor@var=\pgfutil@empty
+ %
+ \pgffor@vars%
+}
+
+\let\foreach=\pgffor@foreach
+
+\def\pgffor@vars{%
+ \pgfutil@ifnextchar i{\pgffor@@vars@end}{%
+ \pgfutil@ifnextchar[{\pgffor@@vars@opt}{%]
+ \pgfutil@ifnextchar/{\pgffor@@vars@slash@gobble}{%
+ \pgffor@@vars}}}}%
+
+\def\pgffor@@vars@end in{\pgfutil@ifnextchar\bgroup{\pgffor@normal@list}{\pgffor@macro@list}}
+\def\pgffor@@vars@opt[#1]{\pgfkeys{/pgf/foreach/.cd,#1}\pgffor@vars}
+\def\pgffor@@vars#1{\pgffor@var@add#1\pgffor@stop\pgffor@vars}
+\def\pgffor@@vars@slash@gobble/{\pgffor@@vars}
+
+\def\pgffor@var@add#1#2\pgffor@stop{%
+ \ifx\pgffor@var\pgfutil@empty%
+ \def\pgffor@var{#1}%
+ \def\pgffor@mainvar{#1}%
+ \else%
+ \expandafter\def\expandafter\pgffor@var\expandafter{\pgffor@var/#1}%
+ \fi%
+}
+
\def\pgffor@macro@list#1{%
\expandafter\pgffor@normal@list\expandafter{#1}}
\def\pgffor@normal@list#1{%
@@ -31,10 +80,9 @@
\ifx\pgffor@values\pgffor@emptyvalues
\def\pgffor@values{\pgffor@stop,}%
\fi%
- \let\pgffor@body\pgfutil@empty%
+ \let\pgffor@body=\pgfutil@empty%
\global\pgffor@continuetrue%
\pgffor@collectbody}
-
\def\pgffor@collectbody{%
\pgfutil@ifnextchar\foreach{\pgffor@collectforeach}{%
\pgfutil@ifnextchar\bgroup{\pgffor@collectargument}{\pgffor@collectsemicolon}}%
@@ -50,13 +98,18 @@
\expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter{\pgffor@body\foreach#1in{#2}}%
\pgffor@collectbody%
}
-
\long\def\pgffor@collectargument#1{%
- \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter{\pgffor@body{#1}}%
+ \expandafter\pgfutil@in@\expandafter\foreach\expandafter{\pgffor@body}%
+ \ifpgfutil@in@%
+ \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter%
+ {\pgffor@body{#1}}%
+ \else%
+ \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter%
+ {\pgffor@body#1}%
+ \fi%
\pgffor@iterate%
}
-
\def\pgffor@collectsemicolon{%
\let\pgffor@next=\pgffor@collectnormalsemicolon%
\ifnum\the\catcode`\;=\active\relax%
@@ -77,12 +130,17 @@
\expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter{\pgffor@body#1;}%
\pgffor@iterate%
}
-}
+}
\def\pgffor@iterate{%
- \let\pgffor@last\pgfutil@empty%
- \let\pgffor@prevlast\pgfutil@empty%
- \expandafter\pgffor@scan\pgffor@values}
+ % Must do all of these in case the internal stack is used.
+ \let\pgffor@last=\pgfutil@empty%
+ \let\pgffor@prevlast=\pgfutil@empty%
+ \let\pgffor@dotsend=\pgfutil@empty%
+ \let\pgffor@dots@pre=\pgfutil@empty%
+ \let\pgffor@dots@post=\pgfutil@empty%
+ %
+ \expandafter\pgffor@scan\pgffor@values}
\def\pgffor@stop{\pgffor@stop}%
\def\pgffor@dots{...}%
@@ -91,35 +149,54 @@
\def\pgffor@scanround(#1)#2,{\def\pgffor@value{(#1)}\pgffor@scanned}
\def\pgffor@scanone#1,{\def\pgffor@value{#1}\pgffor@scanned}
+
+% Check for dots.
+\newif\ifpgffor@dots@in@
+\def\pgffor@dots@in@#1...#2#3\pgffor@stop{%
+ \ifx\pgffor@dots@@#2%
+ \pgffor@dots@in@false%
+ \else%
+ \pgffor@dots@in@true%
+ \fi%
+}
+
+\def\pgffor@dots@@{\pgffor@dots@@}
+
\def\pgffor@scanned{%
\ifx\pgffor@value\pgffor@stop%
- \let\pgffor@next=\pgffor@after% done!
+ \let\pgffor@next=\pgffor@after% Done!
\else%
- \ifx\pgffor@value\pgffor@dots%
+ % Check for dots. Quicker than \pgfutil@in@ and not suceptable
+ % to false-positives when a token sequence ends in a single full-stop.
+ \expandafter\pgffor@dots@in@\pgffor@value\pgffor@dots@...\pgffor@dots@@\pgffor@stop%
+ \ifpgffor@dots@in@%
\let\pgffor@next=\pgffor@handledots%
\else%
\let\pgffor@next=\pgffor@handlevalue%
\fi%
\ifpgffor@continue%
\else%
- \let\pgffor@next=\pgffor@scan% done!
+ \let\pgffor@next=\pgffor@scan% Done!
\fi%
\fi%
\pgffor@next}
+
\def\pgffor@after{%
\global\pgffor@continuetrue%
+ \pgffor@atendforeach%
\pgffor@afterhook}
-
+
\def\pgffor@handlevalue{%
- \let\pgffor@prevlast\pgffor@last%
- \let\pgffor@last\pgffor@value%
+ \let\pgffor@prevlast=\pgffor@last%
+ \let\pgffor@last=\pgffor@value%
\pgffor@invokebody%
\pgffor@scan%
}
+
\def\pgffor@invokebody{%
- \begingroup%
+ \pgffor@begingroup%
\expandafter\pgfutil@in@\expandafter/\expandafter{\pgffor@var}%
\ifpgfutil@in@%
\expandafter\def\expandafter\pgffor@valuerest\expandafter{\pgffor@value//\relax}%
@@ -127,8 +204,25 @@
\else%
\expandafter\expandafter\expandafter\def\expandafter\pgffor@var\expandafter{\pgffor@value}%
\fi%
+ % Execute assign once code.
+ \ifx\pgffor@assign@once@code\pgfutil@empty%
+ \else%
+ \pgffor@assign@once@code%
+ \fi%
+ % Execute assign before code.
+ \ifx\pgffor@assign@before@code\pgfutil@empty%
+ \else%
+ \pgffor@assign@before@code%
+ \fi%
+ %
\expandafter\pgffor@beginhook\pgffor@body\pgffor@endhook%
- \endgroup%
+ % Execute assign after code.
+ \ifx\pgffor@assign@after@code\pgfutil@empty%
+ \else%
+ \pgffor@assign@after@code%
+ \fi%
+ %
+ \pgffor@endgroup%
}
@@ -145,27 +239,60 @@
\def\pgffor@multiassignrest{\expandafter\pgffor@multiassignfinal\pgffor@valuerest}
\def\pgffor@multiassignfinal#1/#2/\relax{%
+ \def\pgffor@temp{#1}%
+ \ifx\pgffor@currentvar\pgffor@mainvar%
+ \ifpgffor@alphabeticsequence%
+ \pgffor@makealphabetic\pgffor@temp%
+ \fi%
+ \fi%
\def\pgffor@test{#2}%
\ifx\pgffor@test\pgfutil@empty%
- \def\pgffor@valuerest{#1//\relax}% repeat
+ \expandafter\def\expandafter\pgffor@valuerest\expandafter{\pgffor@temp//\relax}% repeat
\else%
\def\pgffor@valuerest{#2/\relax}%
\fi%
- \expandafter\def\pgffor@currentvar{#1}%
+ \expandafter\expandafter\expandafter\def\expandafter\pgffor@currentvar\expandafter{\pgffor@temp}%
+ %
\expandafter\pgffor@multiassign\pgffor@rest/\relax%
-}
-
-
+}
+\def\pgffor@gobblespaces#1{\pgfutil@ifnextchar x{#1}{#1}}
\def\pgffor@handledots{%
- \ifx\pgffor@last\pgfutil@empty%
- \PackageError{pgffor}{``...'' not allowed without prior value}{}%
- \fi%
- \pgffor@dotsscanend%
+ \pgffor@gobblespaces{\expandafter\pgffor@@handledots\pgffor@value\pgffor@@stop}%
+}
+
+\newif\ifpgffor@context
+
+\def\pgffor@@handledots#1...#2\pgffor@@stop{%
+ % Define the context if any.
+ \def\pgffor@dots@pre{#1}%
+ \def\pgffor@dots@post{#2}%
+ \def\pgffor@dots@stripcontext#1##1#2\pgffor@@stop{\def\pgffor@dotsvalue{##1}}%
+ \pgffor@contexttrue%
+ \ifx\pgffor@dots@pre\pgfutil@empty%
+ \ifx\pgffor@dots@post\pgfutil@empty%
+ \pgffor@contextfalse%
+ \def\pgffor@dots@stripcontext##1\pgffor@@stop{\def\pgffor@dotsvalue{##1}}%
+ \fi%
+ \fi%
+ \pgffor@gobblespaces{\pgffor@dotsscanend}%
}
+
+\def\pgffor@dots@value@process#1{%
+ \expandafter\pgffor@dots@stripcontext#1\pgffor@@stop%
+ \expandafter\pgffor@dots@charcheck\pgffor@dotsvalue\pgffor@@stop%
+ \let#1=\pgffor@dotsvalue%
+}
+
\def\pgffor@dotsscanend#1,{%
- \def\pgffor@dotsend{#1}%
+ \pgffor@alphabeticsequencefalse%
+ % Strip context and check for a character sequence.
+ \def\pgffor@dotsend{#1}%
+ \pgffor@dots@value@process{\pgffor@dotsend}%
+ %
+ \pgffor@dots@value@process{\pgffor@last}%
+ %
% calculate skip%
\ifx\pgffor@prevlast\pgfutil@empty%
\ifdim\pgffor@dotsend pt>\pgffor@last pt%
@@ -174,6 +301,7 @@
\pgffor@skip=-1pt%
\fi%
\else%
+ \pgffor@dots@value@process{\pgffor@prevlast}%
\pgffor@skip=\pgffor@last pt%
\pgffor@iter=\pgffor@prevlast pt%
\advance\pgffor@skip by-\pgffor@iter%
@@ -197,19 +325,20 @@
\fi%
\ifpgffor@continue%
\else%
- \let\pgffor@next=\pgffor@endloop% done!
+ \let\pgffor@next=\pgffor@endloop% Done!
\fi%
\pgffor@next%
}
\def\pgffor@endloop{%
- \pgffor@scan%
+ \pgffor@alphabeticsequencefalse%
+ \pgffor@scan%
}
{\catcode`\p=12\catcode`\t=12\gdef\Pgffor@geT#1pt{#1}}
\def\pgffor@doloop{%
- \begingroup%
+ \pgffor@begingroup
\edef\pgffor@temp{\expandafter\Pgffor@geT\the\pgffor@iter}%
\edef\pgffor@incheck{{.0/}{\pgffor@temp/}}%
\expandafter\pgfutil@in@\pgffor@incheck%
@@ -221,16 +350,392 @@
\expandafter\def\expandafter\pgffor@valuerest\expandafter{\pgffor@temp//\relax}%
\expandafter\pgffor@multiassign\pgffor@var/\pgffor@stop/\pgffor@stop/\relax%
\else%
- \expandafter\expandafter\expandafter\def\expandafter\pgffor@var\expandafter{\pgffor@temp}%
+ % Convert to alphabetic sequence, if necessary.
+ \ifpgffor@alphabeticsequence%
+ \pgffor@makealphabetic\pgffor@temp%
+ \expandafter\let\pgffor@var=\pgffor@temp%
+ \else%
+ \expandafter\expandafter\expandafter\def\expandafter\pgffor@var\expandafter{\pgffor@temp}%
+ \fi%
\fi%
+ % Insert any context, if any.
+ \ifpgffor@context%
+ \let\pgffor@temp=\pgffor@dots@pre%
+ \expandafter\pgfutil@append@macrotomacro\expandafter%
+ {\expandafter\pgffor@temp\expandafter}\expandafter{\pgffor@var}%
+ \expandafter\pgfutil@append@macrotomacro\expandafter%
+ {\expandafter\pgffor@temp\expandafter}\expandafter{\pgffor@dots@post}%
+ \expandafter\let\pgffor@var=\pgffor@temp%
+ \fi%
+ % Perform assignments before loop body.
+ \ifx\pgffor@assign@before@code\pgfutil@empty%
+ \else%
+ \pgffor@assign@before@code%
+ \fi%
+ %
\expandafter\pgffor@beginhook\pgffor@body\pgffor@endhook%
- \endgroup%
+ %
+ % Perform assignments after loop body.
+ \ifx\pgffor@assign@after@code\pgfutil@empty%
+ \else%
+ \pgffor@assign@after@code%
+ \fi%
+ \pgffor@endgroup%
\pgffor@loop%
}
\def\pgffor@strip#1.0{\def\pgffor@temp{#1}}
-
\def\breakforeach{\global\pgffor@continuefalse}
+\def\pgffor@gobbletil@pgffor@@stop#1\pgffor@@stop{}
+
+
+\newif\ifpgffor@registeriscount
+
+\def\pgffor@ifcsregister#1{%
+ \expandafter\pgffor@@ifcsregister\meaning#1\pgffor@stop}
+
+\def\pgffor@@ifcsregister#1#2#3#4#5\pgffor@stop{%
+ \if#1m% It is an ordinary (m)acro.
+ \pgffor@registeriscountfalse%
+ \let\pgffor@csnext=\pgfutil@secondoftwo%
+ \else%
+ \if#1u% It is (u)ndefined.
+ \let\pgffor@csnext=\pgfutil@secondoftwo%
+ \pgffor@registeriscountfalse%
+ \else%
+ \let\pgffor@csnext=\pgfutil@firstoftwo%
+ \if#4u% It is a co(u)nt
+ \pgffor@registeriscounttrue%
+ \else% Assume it is a dimen or skip (bad assumption in the general case).
+ \pgffor@registeriscountfalse%
+ \let\pgffor@csnext=\pgfutil@firstoftwo%
+ \fi%
+ \fi%
+ \fi%
+ \pgffor@csnext}
+
+\newif\ifpgffor@alphabeticsequence
+
+%
+\def\pgffor@dots@charcheck#1\pgffor@@stop{%
+ \edef\pgffor@dots@charcheck@temp{#1}%
+ \expandafter\expandafter\expandafter\pgffor@@dotscharcheck\expandafter\meaning\pgffor@dots@charcheck@temp\pgffor@@stop%
+}
+\def\pgffor@@dotscharcheck#1#2\pgffor@@stop{%
+ \if#1t%
+ \afterassignment\pgffor@gobbletil@pgffor@@stop%
+ \expandafter\chardef\expandafter\pgffor@char\expandafter=\expandafter`\pgffor@dots@charcheck@temp\relax\pgffor@@stop%
+ \edef\pgffor@char{\the\pgffor@char}%
+ \ifnum\pgffor@char>64\relax% From A-Z?
+ \ifnum\pgffor@char<91\relax%
+ \let\pgffor@dotsvalue=\pgffor@char%
+ \pgffor@alphabeticsequencetrue%
+ \else%
+ \ifnum\pgffor@char>96\relax% From a-z?
+ \ifnum\pgffor@char<123\relax%
+ \let\pgffor@dotsvalue=\pgffor@char%
+ \pgffor@alphabeticsequencetrue%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+}
+
+\def\pgffor@makealphabetic#1{%
+ % Convert the number in the macro passed as #1 to a-z or A-Z.
+ \pgfutil@tempcnta=#1\relax%
+ \ifnum\pgfutil@tempcnta>95\relax%
+ \advance\pgfutil@tempcnta by-96%
+ \expandafter\def\expandafter#1\expandafter%
+ {\pgffor@alpha\pgfutil@tempcnta}%
+ \else%
+ \advance\pgfutil@tempcnta by-64%
+ \expandafter\def\expandafter#1\expandafter%
+ {\pgffor@Alpha\pgfutil@tempcnta}%
+ \fi%
+}
+
+\def\pgffor@Alpha#1{%
+ \ifcase#1\or A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or K\or L\or M%
+ \or N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or Z\else?\fi%
+}
+
+\def\pgffor@alpha#1{%
+ \ifcase#1\or a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or k\or l\or m%
+ \or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or z\else?\fi%
+}
+
+\newtoks\pgffor@toks
+
+\def\pgffor@addcstotoks#1{%
+ \expandafter\def\expandafter\pgffor@tokstemp\expandafter{\expandafter\def\expandafter#1\expandafter{#1}}%
+ \pgffor@@addcstotoks}
+
+\def\pgffor@addregtotoks#1{%
+ \expandafter\def\expandafter\pgffor@tokstemp\expandafter{\expandafter#1\expandafter=\the#1}%
+ \pgffor@@addcstotoks}
+
+\def\pgffor@addiftotoks#1{%
+ \begingroup%
+ \escapechar=-1\relax%
+ \expandafter\pgffor@@addiftotoks\string#1\pgffor@stop}
+\def\pgffor@@addiftotoks#1#2#3#4#5\pgffor@stop{%
+ \endgroup
+ \csname if#4#5\endcsname%
+ \expandafter\def\expandafter\pgffor@tokstemp\expandafter{\csname#4#5true\endcsname}%
+ \else%
+ \expandafter\def\expandafter\pgffor@tokstemp\expandafter{\csname#4#5false\endcsname}%
+ \fi%
+ \pgffor@@addcstotoks%
+}
+
+\def\pgffor@@addcstotoks{%
+ \expandafter\expandafter\expandafter\pgffor@toks\expandafter\expandafter\expandafter=%
+ \expandafter\expandafter\expandafter{\expandafter\pgffor@tokstemp\the\pgffor@toks}%
+}
+
+% Set up the pgffor scopes.
+
+\def\pgffor@atbeginforeach{%
+ \begingroup%
+}
+
+\def\pgffor@atendforeach{%
+ \global\edef\pgffor@remember@expanded{\pgffor@remember@code}%
+ \endgroup%
+ \ifx\pgffor@remember@expanded\pgfutil@empty%
+ \else%
+ \pgffor@remember@expanded%
+ \global\let\pgffor@remember@expanded=\pgfutil@empty%
+ \fi%
+}
+\def\pgffor@default@begingroup{%
+ \begingroup%
+}
+
+\let\pgffor@remember@once@expanded=\pgfutil@empty
+\let\pgffor@remember@expanded=\pgfutil@empty
+
+\def\pgffor@default@endgroup{%
+ \ifx\pgffor@assign@once@code\pgfutil@empty%
+ \else%
+ \global\edef\pgffor@remember@once@expanded{\pgffor@remember@once@code}%
+ \fi%
+ \ifx\pgffor@remember@code\pgfutil@empty%
+ \else%
+ \global\edef\pgffor@remember@expanded{\pgffor@remember@code}%
+ \fi%
+ \endgroup%
+ %
+ \ifx\pgffor@remember@once@expanded\pgfutil@empty%
+ \else%
+ \pgffor@remember@once@expanded%
+ \let\pgffor@assign@once@code=\pgfutil@empty%
+ \global\let\pgffor@remember@once@expanded=\pgfutil@empty%
+ \fi%
+ %
+ \ifx\pgffor@remember@expanded\pgfutil@empty%
+ \else%
+ \pgffor@remember@expanded%
+ \global\let\pgffor@remember@expanded=\pgfutil@empty%
+ \fi%
+}
+
+\let\pgffor@begingroup=\pgffor@default@begingroup
+\let\pgffor@endgroup=\pgffor@default@endgroup
+
+
+\def\pgffor@stack@begingroup{%
+ \pgffor@toks={}%
+ \pgffor@addcstotoks{\pgffor@mainvar}%
+ \pgffor@addcstotoks{\pgffor@var}%
+ \pgffor@addcstotoks{\pgffor@body}%
+ %
+ \pgffor@addcstotoks{\pgffor@last}%
+ \pgffor@addcstotoks{\pgffor@prevlast}%
+ \pgffor@addcstotoks{\pgffor@dotsend}%
+ %
+ \pgffor@addcstotoks{\pgffor@assign@before@code}%
+ \pgffor@addcstotoks{\pgffor@assign@after@code}%
+ \pgffor@addcstotoks{\pgffor@remember@code}%
+ \pgffor@addcstotoks{\pgffor@remember@once@code}%
+ \pgffor@addcstotoks{\pgffor@dots@pre}%
+ \pgffor@addcstotoks{\pgffor@dots@post}%
+ %
+ \pgffor@addregtotoks{\pgffor@iter}%
+ \pgffor@addregtotoks{\pgffor@skip}%
+ %
+ \pgffor@addiftotoks{\ifpgffor@alphabeticsequence}%
+ \pgffor@addiftotoks{\ifpgffor@context}%
+ \expandafter\pgffor@stackpush\expandafter{\the\pgffor@toks}%
+}
+
+\def\pgffor@stack@endgroup{\pgffor@stackpop}
+
+% Keys stuff.
+
+\newif\ifpgffor@assign@evaluate
+\newif\ifpgffor@assign@once
+
+\pgfkeys{/pgf/foreach/.cd,
+ var/.code=\pgffor@var@add#1\pgffor@stop,
+ scope iterations/.code={
+ \csname if#1\endcsname%
+ \let\pgffor@begingroup=\pgffor@default@begingroup%
+ \let\pgffor@endgroup=\pgffor@default@endgroup%
+ \else%
+ \let\pgffor@begingroup=\pgffor@stack@begingroup%
+ \let\pgffor@endgroup=\pgffor@stack@endgroup%
+ \fi%
+ },
+ evaluate/.code=\pgffor@assign@evaluatetrue\pgffor@assign@oncefalse\pgffor@assign@parse{#1},%
+ assign/.code=\pgffor@assign@evaluatefalse\pgffor@assign@oncefalse\pgffor@assign@parse{#1},%
+ evaluate once/.code=\pgffor@assign@evaluatetrue\pgffor@assign@oncetrue\pgffor@assign@parse{#1},%
+ assign once/.code=\pgffor@assign@evaluatefalse\pgffor@assign@oncetrue\pgffor@assign@parse{#1},%
+ remember/.code=\pgffor@remember@parse{#1},%
+ count/.code=\pgffor@count@parse#1\pgffor@stop
+}
+
+\def\pgffor@assign@parse#1{%
+ \pgfutil@in@;{#1}%
+ \ifpgfutil@in@%
+ \else%
+ \pgfutil@in@={#1}%
+ \fi%
+ \ifpgfutil@in@%
+ \pgffor@assign@@parse#1;\pgffor@stop;%
+ \else%
+ \pgffor@assign@parse@old#1\pgffor@stop%%
+ \fi%
+}
+
+\def\pgffor@stop{\pgffor@stop}
+\def\pgffor@assign@@parse#1;{%
+ \def\pgffor@test{#1}%
+ \ifx\pgffor@test\pgffor@stop%
+ \let\pgffor@next=\relax%
+ \else%
+ \let\pgffor@next=\pgffor@assign@@parse%
+ \ifx\pgffor@test\pgfutil@empty%
+ \else%
+ \pgfutil@in@={#1}%
+ \ifpgfutil@in@%
+ \pgffor@assign@@@parse#1\pgffor@stop%
+ \else%
+ \pgffor@assign@@@parse#1=#1\pgffor@stop%
+ \fi%
+ \fi%
+ \fi%
+ \pgffor@next}
+
+\def\pgffor@assign@@@parse#1=#2\pgffor@stop{%
+ \ifpgffor@assign@evaluate%
+ \ifpgffor@assign@once%
+ \pgfutil@append@tomacro{\pgffor@assign@once@code}{\pgfmathparse{#2}\let#1=\pgfmathresult}%
+ \pgfutil@append@tomacro{\pgffor@remember@once@code}{\noexpand\def\noexpand#1{#2}}%
+ \else
+ \pgfutil@append@tomacro{\pgffor@assign@before@code}{\pgfmathparse{#2}\let#1=\pgfmathresult}%
+ \fi%
+ \else%
+ \ifpgffor@assign@once%
+ \pgfutil@append@tomacro{\pgffor@assign@once@code}{\def#1{#2}}%
+ \pgfutil@append@tomacro{\pgffor@remember@once@code}{\noexpand\def\noexpand#1{#2}}%
+ \else
+ \pgfutil@append@tomacro{\pgffor@assign@before@code}{\def#1{#2}}%
+ \fi%
+ \fi%
+}
+
+\def\pgffor@assign@parse@old#1#2\pgffor@stop{%
+ \pgffor@assign@@parse@old#2\pgffor@stop as#1using #1\pgffor@@stop}
+
+\def\pgffor@assign@@parse@old#1as#2#3\pgffor@@stop{%
+ \pgffor@assign@@@parse@old{#2}#1#3\pgffor@stop\pgffor@@stop}
+
+\def\pgffor@assign@@@parse@old#1#2using #3\pgffor@stop#4\pgffor@@stop{%
+ \pgffor@assign@@@parse#1=#3\pgffor@stop}
+
+
+
+\def\pgffor@remember@parse#1{%
+ \pgfutil@in@ a{#1}% This matches the 'a' in 'as' or 'intially'.
+ \ifpgfutil@in@%
+ \pgffor@remember@parse@old#1\pgffor@stop%
+ \else%
+ \pgffor@remember@@parse#1;\pgffor@stop;%
+ \fi%
+}
+
+\def\pgffor@remember@@parse#1;{%
+ \def\pgffor@test{#1}%
+ \ifx\pgffor@test\pgffor@stop%
+ \let\pgffor@next=\relax%
+ \else%
+ \let\pgffor@next=\pgffor@remember@@parse%
+ \ifx\pgffor@test\pgfutil@empty%
+ \else%
+ \pgfutil@in@={#1}%
+ \ifpgfutil@in@%
+ \pgffor@remember@@@parse#1\pgffor@stop%
+ \else%
+ \pgffor@ifcsregister{#1}{%
+ \pgfutil@append@tomacro{\pgffor@remember@code}{\noexpand#1=\the#1\noexpand\relax}%
+ }%
+ {%
+ \pgfutil@append@tomacro{\pgffor@remember@code}{\noexpand\def\noexpand#1{#1}}%
+ }%
+ \fi%
+ \fi%
+ \fi%
+ \pgffor@next%
+}
+
+\def\pgffor@remember@@@parse#1=#2\pgffor@stop{%
+ \pgffor@ifcsregister{#2}{%
+ \pgfutil@append@tomacro{\pgffor@assign@after@code}{\expandafter\def\expandafter#1\expandafter{\the#2}}%
+ \pgfutil@append@tomacro{\pgffor@remember@code}{\noexpand\def\noexpand#1{#1}}%
+ }%
+ {%
+ \pgfutil@append@tomacro{\pgffor@assign@after@code}{\expandafter\def\expandafter#1\expandafter{#2}}%
+ \pgfutil@append@tomacro{\pgffor@remember@code}{\noexpand\def\noexpand#1{#1}}%
+ }%
+}
+
+\def\pgffor@remember@parse@old#1#2\pgffor@stop{%
+ \pgffor@remember@@parse@old#1#2\pgffor@stop as#1(initially )\pgffor@@stop}
+
+\def\pgffor@remember@@parse@old#1#2as#3#4\pgffor@@stop{%
+ \pgffor@remember@@@parse@old{#1}{#3}#2#4\pgffor@stop\pgffor@@stop}
+
+\def\pgffor@remember@@@parse@old#1#2#3(initially #4)#5\pgffor@stop#6\pgffor@@stop{%
+ \pgfutil@append@tomacro{\pgffor@assign@after@code}{\edef#2{#1}}%
+ \pgfutil@append@tomacro{\pgffor@remember@code}{\noexpand\def\noexpand#2{#2}}%
+ \def\pgffor@test{#4}%
+ \ifx\pgffor@test\pgfutil@empty%
+ \else%
+ \pgfutil@append@tomacro{\pgffor@assign@once@code}{\def#2{#4}}%
+ \fi%
+}
+
+\def\pgffor@count@parse#1#2\pgffor@stop{%
+ \pgffor@count@@parse#1#2\pgffor@stop from 1\pgffor@stop\pgffor@@stop}
+
+\def\pgffor@count@@parse#1#2from#3\pgffor@stop#4\pgffor@@stop{%
+ \pgfutil@append@tomacro\pgffor@remember@code{\noexpand\def\noexpand#1{#1}}%
+ \pgfutil@append@tomacro\pgffor@assign@before@code{\pgfmathparse{int(#1+1)}\let#1=\pgfmathresult}%
+ \pgfmathparse{int(#3-1)}\let#1=\pgfmathresult%
+}
+
+
+\def\pgfutil@append@macrotomacro#1#2{%
+ \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter%
+ #1\expandafter\expandafter\expandafter{\expandafter#1#2}}
+
+\def\pgfutil@append@tomacro#1#2{%
+ \expandafter\def\expandafter#1\expandafter{#1#2}}
+
+
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
index dd660fd6ab7..86e0499ded7 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
@@ -8,7 +8,9 @@
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-% This file is perfectly self-contained, except that the catcode of @ should be made a letter.
+% The files pgfkeys.code.tex and pgfkeysfiltered.code.tex are
+% perfectly self-contained, except that the catcode of @
+% should be made a letter.
% Guard against reading twice
@@ -64,7 +66,7 @@
% \pgfkeyssetvalue{/tikz/length}{2cm-3cm}
% \pgfkeyssetvalue{/algo/swap}{{#2}{#1}}
-\def\pgfkeyssetvalue#1#2{%
+\long\def\pgfkeyssetvalue#1#2{%
\pgfkeys@temptoks{#2}\expandafter\edef\csname pgfk@#1\endcsname{\the\pgfkeys@temptoks}%
}
@@ -85,13 +87,13 @@
%
% \pgfkeysaddvalue{/tikz/length}{}{-3cm}
-\def\pgfkeysaddvalue#1#2#3{%
+\long\def\pgfkeysaddvalue#1#2#3{%
{%
- \toks0{#1}%
+ \toks0{#2}%
\pgfkeysifdefined{#1}
{\pgfkeys@temptoks\expandafter\expandafter\expandafter{\csname pgfk@#1\endcsname}}%
{\pgfkeys@temptoks{}}%
- \toks1{#2}%
+ \toks1{#3}%
\xdef\pgfkeys@global@temp{\the\toks0 \the\pgfkeys@temptoks \the\toks1}% believe or don't: the spaces are important
}%
\pgfkeyslet{#1}\pgfkeys@global@temp%
@@ -169,8 +171,20 @@
%
% \pgfkeysifdefined{/tikz/length}{key exists}{does not exist}
-\def\pgfkeysifdefined#1#2#3{\pgfkeys@ifcsname pgfk@#1\endcsname#2\else#3\fi}
+\long\def\pgfkeysifdefined#1#2#3{\pgfkeys@ifcsname pgfk@#1\endcsname#2\else#3\fi}
+% Tests whether a key is assignable. For standard keys which just
+% store their value, this is identical to \pgfkeysifdefined.
+%
+% But \pgfkeysifassignable is true for command keys as well (but not
+% for handled keys).
+\long\def\pgfkeysifassignable#1#2#3{%
+ \pgfkeysifdefined{#1}%
+ {#2}
+ {\pgfkeysifdefined{#1/.@cmd}%
+ {#2}%
+ {#3}}%
+}%
@@ -259,7 +273,7 @@
\let\pgfkeysdefaultpath\pgfkeys@root
\def\pgfkeys{\expandafter\pgfkeys@@set\expandafter{\pgfkeysdefaultpath}}%
-\def\pgfkeys@@set#1#2{%
+\long\def\pgfkeys@@set#1#2{%
\let\pgfkeysdefaultpath\pgfkeys@root%
\pgfkeys@parse#2,\pgfkeys@mainstop%
\def\pgfkeysdefaultpath{#1}}
@@ -272,7 +286,7 @@
\expandafter\pgfkeys@normal%
\fi%
}
-\def\pgfkeys@normal#1,{%
+\long\def\pgfkeys@normal#1,{%
\pgfkeys@unpack#1=\pgfkeysnovalue=\pgfkeys@stop%
\pgfkeys@parse%
}
@@ -284,7 +298,7 @@
\def\pgfkeysnovalue@text{\pgfkeysnovalue}
\def\pgfkeysvaluerequired{\pgfkeysvaluerequired} % equals only itself
-\def\pgfkeys@unpack#1=#2=#3\pgfkeys@stop{%
+\long\def\pgfkeys@unpack#1=#2=#3\pgfkeys@stop{%
\pgfkeys@spdef\pgfkeyscurrentkey{#1}%
\edef\pgfkeyscurrentkey{\pgfkeyscurrentkey}%
\ifx\pgfkeyscurrentkey\pgfkeys@empty%
@@ -326,6 +340,10 @@
}
+% either handled key or unknown.
+%
+% This macro will be replaced by the /handler config/handle only existing
+% configuration, see below.
\def\pgfkeys@case@three{%
\pgfkeys@split@path%
\pgfkeysifdefined{/handlers/\pgfkeyscurrentname/.@cmd}%
@@ -333,6 +351,80 @@
\expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov}
{\pgfkeys@unknown}%
}
+\let\pgfkeys@case@three@handleall=\pgfkeys@case@three
+\def\pgfkeys@case@three@handle@restricted{%
+ \pgfkeys@split@path%
+ \pgfkeysifdefined{/handlers/\pgfkeyscurrentname/.@cmd}{%
+ \pgfkeys@ifexecutehandler{%
+ \pgfkeysgetvalue{/handlers/\pgfkeyscurrentname/.@cmd}{\pgfkeys@code}%
+ \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov
+ }{%
+ % this here is necessary: /my search path/key/.code
+ % won't be called, so \pgfkeyscurrentpath == '/my search path/key'
+ % -> it should be one directory higher! We want to invoke the
+ % .unknown handler in
+ % '/my search path'
+ %
+ % Idea:
+ % set
+ % - path := '/my search path'
+ % - name := 'key/.code'
+ % - key = '/my search path/key/.code'
+ \let\pgfkeys@temp=\pgfkeyscurrentkey
+ \let\pgfkeys@tempb=\pgfkeyscurrentname
+ \edef\pgfkeyscurrentkey{\pgfkeyscurrentpath}%
+ \pgfkeys@split@path%
+ \let\pgfkeyscurrentkey=\pgfkeys@temp
+ \edef\pgfkeyscurrentname{\pgfkeyscurrentname/\pgfkeys@tempb}%
+ \pgfkeys@unknown
+ }%
+ }{%
+ \pgfkeys@unknown
+ }%
+}
+
+% this macro is to implement the |handly only existing| key in key filtering:
+% #1: the code to invoke IF the key handler shall be executed
+% #2: the code to invoke if it shall not run.
+\def\pgfkeys@ifexecutehandler#1#2{#1}%
+\let\pgfkeys@ifexecutehandler@handleall=\pgfkeys@ifexecutehandler
+\def\pgfkeys@ifexecutehandler@handleonlyexisting#1#2{%
+ \pgfkeys@ifcsname pgfk@excpt@\pgfkeyscurrentname\endcsname%
+ #1% ok, this particular key handler is known and should be processed in any case (for example .try)
+ \else
+ % implement the 'only existing' feature here:
+ \pgfkeysifdefined{\pgfkeyscurrentpath}{#1}{%
+ \pgfkeysifdefined{\pgfkeyscurrentpath/.@cmd}{#1}{#2}%
+ }{}%
+ \fi%
+}%
+\def\pgfkeys@ifexecutehandler@handlefullorexisting#1#2{%
+ \ifpgfkeysaddeddefaultpath
+ \pgfkeys@ifcsname pgfk@excpt@\pgfkeyscurrentname\endcsname%
+%\message{ifexecutehandler(\pgfkeyscurrentkeyRAW, path \pgfkeysdefaultpath): '\pgfkeyscurrentname' is an exception; processing it (on \pgfkeyscurrentpath).}%
+ #1% ok, this particular key handler is known and be processed in any case (for example .try)
+ \else
+ % implement the 'only existing' feature here:
+ \pgfkeysifdefined{\pgfkeyscurrentpath}{%
+%\message{ifexecutehandler(\pgfkeyscurrentkeyRAW, path \pgfkeysdefaultpath): '\pgfkeyscurrentpath' does exist. Executing '\pgfkeyscurrentname'.}%
+ #1%
+ }{%
+ \pgfkeysifdefined{\pgfkeyscurrentpath/.@cmd}{%
+%\message{ifexecutehandler(\pgfkeyscurrentkeyRAW, path \pgfkeysdefaultpath): '\pgfkeyscurrentpath/.@cmd' does exist. Executing '\pgfkeyscurrentname'.}%
+ #1%
+ }{%
+%\message{ifexecutehandler(\pgfkeyscurrentkeyRAW, path \pgfkeysdefaultpath): '\pgfkeyscurrentpath' does NOT exist. Skipping '\pgfkeyscurrentname'.}%
+ #2%
+ }%
+ }%
+ \fi%
+ \else
+%\message{ifexecutehandler(\pgfkeyscurrentkeyRAW, path \pgfkeysdefaultpath): Fully qualified key provided. Executing '\pgfkeyscurrentname'.}%
+ #1% ok, always true if the USER explicitly provided the full key path.
+ \fi
+}%
+\def\pgfkeysaddhandlyonlyexistingexception#1{\expandafter\def\csname pgfk@excpt@#1\endcsname{1}}%
+
\def\pgfkeys@unknown{%
\pgfkeysifdefined{\pgfkeyscurrentpath/.unknown/.@cmd}%
@@ -346,8 +438,8 @@
}
-\def\pgfkey@argumentisspace#1{%
- \def\pgfkeys@spdef##1##2{%
+\long\def\pgfkey@argumentisspace#1{%
+ \long\def\pgfkeys@spdef##1##2{%
\futurelet\pgfkeys@possiblespace\pgfkeys@sp@a##2\pgfkeys@stop\pgfkeys@stop#1\pgfkeys@stop\relax##1}%
\def\pgfkeys@sp@a{%
\ifx\pgfkeys@possiblespace\pgfkeys@sptoken%
@@ -355,10 +447,10 @@
\else%
\expandafter\pgfkeys@sp@b\expandafter#1%
\fi}%
- \def\pgfkeys@sp@b#1##1 \pgfkeys@stop{\pgfkeys@sp@c##1}%
+ \long\def\pgfkeys@sp@b#1##1 \pgfkeys@stop{\pgfkeys@sp@c##1}%
}
\pgfkey@argumentisspace{ }
-\def\pgfkeys@sp@c#1\pgfkeys@stop#2\relax#3{\pgfkeys@temptoks{#1}\edef#3{\the\pgfkeys@temptoks}}
+\long\def\pgfkeys@sp@c#1\pgfkeys@stop#2\relax#3{\pgfkeys@temptoks{#1}\edef#3{\the\pgfkeys@temptoks}}
{\def\:{\global\let\pgfkeys@sptoken= } \: }
@@ -367,6 +459,7 @@
% \pgfkeyscurrentkey does not start with /
\expandafter\futurelet\expandafter\pgfkeys@possibleslash\expandafter\pgfkeys@check@slash\pgfkeyscurrentkey\relax%
}
+\newif\ifpgfkeysaddeddefaultpath
\def\pgfkeys@check@slash{%
\ifx\pgfkeys@possibleslash/%
\expandafter\pgfkeys@nevermind%
@@ -375,8 +468,16 @@
\fi%
}
-\def\pgfkeys@nevermind#1\relax{}
-\def\pgfkeys@addpath#1\relax{\edef\pgfkeyscurrentkey{\pgfkeysdefaultpath#1}}
+\def\pgfkeys@nevermind#1\relax{%
+ \pgfkeysaddeddefaultpathfalse
+ \let\pgfkeyscurrentkeyRAW\pgfkeyscurrentkey
+}
+\def\pgfkeys@addpath#1\relax{%
+ \pgfkeysaddeddefaultpathtrue
+ \def\pgfkeyscurrentkeyRAW{#1}%
+ \edef\pgfkeyscurrentkey{\pgfkeysdefaultpath#1}%
+}
+
\def\pgfkeys@split@path{% Should assign the two codes
% \pgfkeyscurrentname and \pgfcurrentlkeypath
@@ -417,7 +518,7 @@
% \pgfqkeys{/tikz}{myother length/.code=\def\myotherlength{#1}\pgfkeysalso{length=#1}}
\def\pgfqkeys{\expandafter\pgfkeys@@qset\expandafter{\pgfkeysdefaultpath}}%
-\def\pgfkeys@@qset#1#2#3{\def\pgfkeysdefaultpath{#2/}\pgfkeys@parse#3,\pgfkeys@mainstop\def\pgfkeysdefaultpath{#1}}
+\long\def\pgfkeys@@qset#1#2#3{\def\pgfkeysdefaultpath{#2/}\pgfkeys@parse#3,\pgfkeys@mainstop\def\pgfkeysdefaultpath{#1}}
% Sets keys while setting keys
@@ -434,7 +535,7 @@
%
% \pgfkeys{tikz,myother length/.code=\def\myotherlength{#1}\pgfkeysalso{length=#1}}
-\def\pgfkeysalso#1{\pgfkeys@parse#1,\pgfkeys@mainstop}
+\long\def\pgfkeysalso#1{\pgfkeys@parse#1,\pgfkeys@mainstop}
@@ -454,7 +555,7 @@
% \begingroup
% \pgfqkeysalso{/tikz}{myother length/.code=\def\myotherlength{#1}\pgfkeysalso{length=#1}}
-\def\pgfqkeysalso#1#2{\def\pgfkeysdefaultpath{#1/}\pgfkeys@parse#2,\pgfkeys@mainstop}
+\long\def\pgfqkeysalso#1#2{\def\pgfkeysdefaultpath{#1/}\pgfkeys@parse#2,\pgfkeys@mainstop}
@@ -475,12 +576,12 @@
%
% \pgfkeysdef{/my key}{\show#1}
-\def\pgfkeysdef#1#2{%
- \def\pgfkeys@temp##1\pgfeov{#2}%
+\long\def\pgfkeysdef#1#2{%
+ \long\def\pgfkeys@temp##1\pgfeov{#2}%
\pgfkeyslet{#1/.@cmd}{\pgfkeys@temp}%
}
-\def\pgfkeysedef#1#2{%
- \edef\pgfkeys@temp##1\pgfeov{#2}%
+\long\def\pgfkeysedef#1#2{%
+ \long\edef\pgfkeys@temp##1\pgfeov{#2}%
\pgfkeyslet{#1/.@cmd}{\pgfkeys@temp}%
}
@@ -500,19 +601,98 @@
%
% \pgfkeysdefargs{/swap}{#1#2}{#2#1}
-\def\pgfkeysdefargs#1#2#3{%
- \def\pgfkeys@temp#2\pgfeov{#3}%
+\long\def\pgfkeysdefargs#1#2#3{%
+ \long\def\pgfkeys@temp#2\pgfeov{#3}%
\pgfkeyslet{#1/.@cmd}{\pgfkeys@temp}%
\pgfkeyssetvalue{#1/.@args}{#2\pgfeov}%
\pgfkeyssetvalue{#1/.@body}{#3}%
}
-\def\pgfkeysedefargs#1#2#3{%
- \edef\pgfkeys@temp#2\pgfeov{#3}%
+\long\def\pgfkeysedefargs#1#2#3{%
+ \long\edef\pgfkeys@temp#2\pgfeov{#3}%
\pgfkeyslet{#1/.@cmd}{\pgfkeys@temp}%
\pgfkeyssetvalue{#1/.@args}{#2\pgfeov}%
\pgfkeyssetvalue{#1/.@body}{#3}%
}
+% Like \pgfkeysdefargs, but `#2' is an integer denoting the expected
+% *number* of arguments.
+%
+% There is a subtle difference between the 'args' command, when it
+% comes to spaces:
+% a key defined with defargs{#1#2} must not have spaces between the
+% arguments when it is used.
+%
+% See this:
+%
+%--------------------------------------------------
+% % defnargs:
+% \pgfkeysdefnargs{/a}{2}{1=`#1', 2=`#2'}
+% \pgfkeys{
+% /a=
+% {1}
+% {2}
+% }
+% ->defnargs: 1=`1', 2=`2'
+%
+% defargs:
+% \pgfkeysdefargs{/b}{#1#2}{1=`#1', 2=`#2'}
+% \pgfkeys{
+% /b=
+% {1}
+% {2}
+% }
+% ->defargs: 1=`1', 2=` 2' (note the space!)
+%
+% defargs:
+% \pgfkeysdefargs{/b}{#1#2}{1=`#1', 2=`#2'}
+% \pgfkeys{
+% /b=
+% {1}%
+% {2}
+% }
+% ->defargs: 1=`1', 2=`2'
+%--------------------------------------------------
+\long\def\pgfkeysdefnargs#1#2#3{\pgfkeysdefnargs@{#1}{#2}{#3}{\def}}%
+\long\def\pgfkeysedefnargs#1#2#3{\pgfkeysdefnargs@{#1}{#2}{#3}{\edef}}%
+\long\def\pgfkeysdefnargs@#1#2#3#4{%
+ \ifcase#2\relax
+ \pgfkeyssetvalue{#1/.@args}{}%
+ \or
+ \pgfkeyssetvalue{#1/.@args}{##1}%
+ \or
+ \pgfkeyssetvalue{#1/.@args}{##1##2}%
+ \or
+ \pgfkeyssetvalue{#1/.@args}{##1##2##3}%
+ \or
+ \pgfkeyssetvalue{#1/.@args}{##1##2##3##4}%
+ \or
+ \pgfkeyssetvalue{#1/.@args}{##1##2##3##4##5}%
+ \or
+ \pgfkeyssetvalue{#1/.@args}{##1##2##3##4##5##6}%
+ \or
+ \pgfkeyssetvalue{#1/.@args}{##1##2##3##4##5##6}%
+ \or
+ \pgfkeyssetvalue{#1/.@args}{##1##2##3##4##5##6##7}%
+ \or
+ \pgfkeyssetvalue{#1/.@args}{##1##2##3##4##5##6##7##8}%
+ \or
+ \pgfkeyssetvalue{#1/.@args}{##1##2##3##4##5##6##7##8##9}%
+ \else
+ \pgfkeys@error{\string\pgfkeysdefnargs: expected <= 9 arguments, got #2}%
+ \fi
+ \pgfkeysgetvalue{#1/.@args}\pgfkeys@tempargs
+ \def\pgfkeys@temp{\expandafter#4\csname pgfk@#1/.@@body\endcsname}%
+ \expandafter\pgfkeys@temp\pgfkeys@tempargs{#3}%
+ % eliminate the \pgfeov at the end such that TeX gobbles spaces
+ % by using
+ % \pgfkeysdef{#1}{\pgfkeysvalueof{#1/.@@body}##1}
+ % (with expansion of '#1'):
+ \edef\pgfkeys@tempargs{\noexpand\pgfkeysvalueof{#1/.@@body}}%
+ \def\pgfkeys@temp{\pgfkeysdef{#1}}%
+ \expandafter\pgfkeys@temp\expandafter{\pgfkeys@tempargs##1}%
+ \pgfkeyssetvalue{#1/.@body}{#3}%
+}
+
% Defining a key command
@@ -521,8 +701,10 @@
\pgfkeysdef{/handlers/.code 2 args}{\pgfkeysdefargs{\pgfkeyscurrentpath}{##1##2}{#1}}
\pgfkeysdef{/handlers/.ecode}{\pgfkeysedef{\pgfkeyscurrentpath}{#1}}
\pgfkeysdef{/handlers/.ecode 2 args}{\pgfkeysedefargs{\pgfkeyscurrentpath}{##1##2}{#1}}
-\pgfkeysdefargs{/handlers/.code args}{#1#2}{\pgfkeysdefargs{\pgfkeyscurrentpath}{#1}{#2}}
-\pgfkeysdefargs{/handlers/.ecode args}{#1#2}{\pgfkeysedefargs{\pgfkeyscurrentpath}{#1}{#2}}
+\pgfkeysdefnargs{/handlers/.code args}{2}{\pgfkeysdefargs{\pgfkeyscurrentpath}{#1}{#2}}
+\pgfkeysdefnargs{/handlers/.ecode args}{2}{\pgfkeysedefargs{\pgfkeyscurrentpath}{#1}{#2}}
+\pgfkeysdefnargs{/handlers/.code n args}{2}{\pgfkeysdefnargs{\pgfkeyscurrentpath}{#1}{#2}}
+\pgfkeysdefnargs{/handlers/.ecode n args}{2}{\pgfkeysedefnargs{\pgfkeyscurrentpath}{#1}{#2}}
% Adding to a key command
@@ -530,22 +712,31 @@
% Find out, whether with args or not.
\pgfkeysifdefined{\pgfkeyscurrentpath/.@args}%
{% Yes, so add to body and reuse args
- \pgfkeysaddvalue{\pgfkeyscurrentpath/.@body}{#1}{#2}%
- % Redefine code
- \pgfkeysgetvalue{\pgfkeyscurrentpath/.@args}{\pgfkeys@tempargs}
- \pgfkeysgetvalue{\pgfkeyscurrentpath/.@body}{\pgfkeys@tempbody}
- \expandafter\expandafter\expandafter\def\expandafter\pgfkeys@temp\expandafter\pgfkeys@tempargs\expandafter{\pgfkeys@tempbody}%
- \pgfkeyslet{\pgfkeyscurrentpath/.@cmd}{\pgfkeys@temp}%
+ \pgfkeysaddvalue{\pgfkeyscurrentpath/.@body}{#1}{#2}%
+ % Redefine code
+ {%
+ \pgfkeysgetvalue{\pgfkeyscurrentpath/.@args}{\pgfkeys@tempargs}%
+ \pgfkeysgetvalue{\pgfkeyscurrentpath/.@body}{\pgfkeys@tempbody}%
+ \def\pgfkeys@marshal{\expandafter\gdef\expandafter\pgfkeys@global@temp\pgfkeys@tempargs}%
+ \expandafter\pgfkeys@marshal\expandafter{\pgfkeys@tempbody}%
+ }%
+ \pgfkeysifdefined{\pgfkeyscurrentpath/.@@body}{%
+ % support for \pgfkeysndefargs:
+ \pgfkeyslet{\pgfkeyscurrentpath/.@@body}{\pgfkeys@global@temp}%
+ }{%
+ % support for \pgfkeysdefargs:
+ \pgfkeyslet{\pgfkeyscurrentpath/.@cmd}{\pgfkeys@global@temp}%
+ }%
}%
{%
- % No, so single argument. Redefine accordingly.
+ % No, so single argument (simple \pgfkeysdef). Redefine accordingly.
{%
\toks0{#1}%
\pgfkeysifdefined{\pgfkeyscurrentpath/.@cmd}%
{\pgfkeys@temptoks\expandafter\expandafter\expandafter{\csname pgfk@\pgfkeyscurrentpath/.@cmd\endcsname##1\pgfeov}}%
{\pgfkeys@temptoks{}}%
\toks1{#2}%
- \xdef\pgfkeys@global@temp{\the\toks0 \the\pgfkeys@temptoks \the\toks1}%
+ \xdef\pgfkeys@global@temp{\the\toks0 \the\pgfkeys@temptoks \the\toks1 }%
}%
\expandafter\def\expandafter\pgfkeys@temp\expandafter##\expandafter1\expandafter\pgfeov\expandafter{\pgfkeys@global@temp}%
\pgfkeyslet{\pgfkeyscurrentpath/.@cmd}\pgfkeys@temp%
@@ -562,6 +753,7 @@
\pgfkeys{/handlers/.style args/.code 2 args=\pgfkeys{\pgfkeyscurrentpath/.code args={#1}{\pgfkeysalso{#2}}}}
\pgfkeys{/handlers/.estyle args/.code 2 args=\pgfkeys{\pgfkeyscurrentpath/.ecode args={#1}{\noexpand\pgfkeysalso{#2}}}}
\pgfkeys{/handlers/.style 2 args/.code=\pgfkeys{\pgfkeyscurrentpath/.code 2 args=\pgfkeysalso{#1}}}
+\pgfkeys{/handlers/.style n args/.code 2 args=\pgfkeys{\pgfkeyscurrentpath/.code n args={#1}{\pgfkeysalso{#2}}}}
% Adding to a style
@@ -574,7 +766,11 @@
\pgfkeys{/handlers/.initial/.code=\pgfkeyssetvalue{\pgfkeyscurrentpath}{#1}}
\pgfkeys{/handlers/.add/.code 2 args=\pgfkeysaddvalue{\pgfkeyscurrentpath}{#1}{#2}}
+\pgfkeys{/handlers/.prefix/.code=\pgfkeysaddvalue{\pgfkeyscurrentpath}{#1}{}}
+\pgfkeys{/handlers/.append/.code=\pgfkeysaddvalue{\pgfkeyscurrentpath}{}{#1}}
\pgfkeys{/handlers/.get/.code=\pgfkeysgetvalue{\pgfkeyscurrentpath}{#1}}
+\pgfkeys{/handlers/.link/.code=\pgfkeyssetvalue{\pgfkeyscurrentpath}{\pgfkeysvalueof{#1}}}
+
% Defining a default
@@ -614,6 +810,26 @@
.unknown/.style={/errors/unknown choice value=\pgfkeyscurrentkey\pgfkeyscurrentvalue}}}
+% Repeatedly setting a key
+
+\pgfkeys{/handlers/.list/.code=%
+ {%
+ % Use foreach to unfold the list
+ \let\pgf@keys@temp=\pgfutil@empty%
+ \foreach \pgf@keys@key in{#1}%
+ {\expandafter\expandafter\expandafter\gdef%
+ \expandafter\expandafter\expandafter\pgf@keys@temp%
+ \expandafter\expandafter\expandafter{\expandafter\pgf@keys@temp\expandafter{\pgf@keys@key}}}%
+ \edef\pgf@keys@list@path{\pgfkeyscurrentpath}%
+ \expandafter\expandafter\expandafter\pgf@keys@do@list%
+ \expandafter\expandafter\expandafter{\expandafter\pgf@keys@list@path\expandafter}\pgf@keys@temp\pgf@stop%
+ }%
+}
+\def\pgf@keys@do@list#1{\pgfutil@ifnextchar\bgroup{\pgf@keys@do@list@item{#1}}\pgfutil@gobble}
+\def\pgf@keys@do@list@item#1#2{\pgfkeysalso{#1={#2}}\pgf@keys@do@list{#1}}
+
+
+
% Inspection handlers
\pgfkeys{/handlers/.show value/.code=\pgfkeysgetvalue{\pgfkeyscurrentpath}{\pgfkeysshower}\show\pgfkeysshower} % inspect the value
@@ -622,8 +838,65 @@
% Path handling
-\pgfkeys{/handlers/.is family/.code=\pgfkeys{\pgfkeyscurrentpath/.ecode=\edef\noexpand\pgfkeysdefaultpath{\pgfkeyscurrentpath/}}}
-\pgfkeys{/handlers/.cd/.code=\edef\pgfkeysdefaultpath{\pgfkeyscurrentpath/}}
+% Prepares the .unknown handler used by '.search also'.
+% It will be stored into \pgfkeys@global@temp.
+\def\pgfkeys@searchalso@prepare@unknown@handler#1{%
+ \global\def\pgfkeys@global@temp##1\pgfeov{}%
+ \pgfkeys@searchalso@parse#1,\pgfkeys@mainstop
+ {%
+ \toks0=\expandafter{\pgfkeys@global@temp##1\pgfeov}%
+ \toks1={\def\pgfutilnext{\pgfkeysvalueof{/handlers/.unknown/.@cmd}##1\pgfeov}\pgfutilnext}%
+ \xdef\pgfkeys@global@temp{%
+ \noexpand\ifpgfkeysaddeddefaultpath
+ \noexpand\pgfkeyssuccessfalse
+ \noexpand\let\noexpand\pgfkeys@searchalso@name=\noexpand\pgfkeyscurrentkeyRAW
+ \the\toks0 % one or more /.try things; one for each path. The last element won't have a /.try
+ %\noexpand\ifpgfkeyssuccess
+ %\noexpand\else
+ % \the\toks1 % invoke /handlers/.unknown handler
+ %\noexpand\fi
+ \noexpand\else
+ \the\toks1 % invoke /handlers/.unknown handler
+ \noexpand\fi
+ }%
+ \expandafter\gdef\expandafter\pgfkeys@global@temp\expandafter##\expandafter1\expandafter\pgfeov\expandafter{\pgfkeys@global@temp}%
+ }%
+}%
+
+\def\pgfkeys@searchalso@parse{\futurelet\pgfkeys@possiblerelax\pgfkeys@searchalso@parse@main}
+\def\pgfkeys@searchalso@parse@main{%
+ \ifx\pgfkeys@possiblerelax\pgfkeys@mainstop%
+ \expandafter\pgfkeys@cleanup%
+ \else%
+ \expandafter\pgfkeys@searchalso@appendentry%
+ \fi%
+}
+\def\pgfkeys@searchalso@appendentry#1,#2{%
+ \def\pgfkeys@searchalso@nexttok{#2}%
+ \pgfkeys@spdef\pgfkeys@temp{#1}%
+ {%
+ \toks0=\expandafter{\pgfkeys@global@temp##1\pgfeov}%
+ \toks1=\expandafter{\pgfkeys@temp}%
+ \toks2={##1}%
+ \xdef\pgfkeys@global@temp{%
+ \the\toks0 % the space is important!
+ \noexpand\ifpgfkeyssuccess\noexpand\else
+ \noexpand\pgfqkeys{\the\toks1 }{\noexpand\pgfkeys@searchalso@name
+ \ifx\pgfkeys@searchalso@nexttok\pgfkeys@mainstop\else/.try\fi={\the\toks2 }}%
+ \noexpand\fi}%
+ \expandafter\gdef\expandafter\pgfkeys@global@temp\expandafter##\expandafter1\expandafter\pgfeov\expandafter{\pgfkeys@global@temp}%
+ }%
+ \pgfkeys@searchalso@parse#2%
+}
+\pgfkeys{%
+ /handlers/.is family/.code=\pgfkeys{\pgfkeyscurrentpath/.ecode=\edef\noexpand\pgfkeysdefaultpath{\pgfkeyscurrentpath/}},%
+ /handlers/.cd/.code=\edef\pgfkeysdefaultpath{\pgfkeyscurrentpath/},%
+ /handlers/.search also/.code={%
+ \pgfkeys@searchalso@prepare@unknown@handler{#1}%
+%\message{I prepared the '\pgfkeyscurrentpath/.unknown' handler \meaning\pgfkeys@global@temp\space for '#1'.}%
+ \pgfkeyslet{\pgfkeyscurrentpath/.unknown/.@cmd}{\pgfkeys@global@temp}%
+ }
+}%
% Value expansion
@@ -632,7 +905,7 @@
\pgfkeys{/handlers/.expand twice/.code=\expandafter\expandafter\expandafter\pgfkeys@exp@call\expandafter\expandafter\expandafter{#1}}
\pgfkeys{/handlers/.expanded/.code=\edef\pgfkeys@temp{#1}\expandafter\pgfkeys@exp@call\expandafter{\pgfkeys@temp}}
-\def\pgfkeys@exp@call#1{\pgfkeysalso{\pgfkeyscurrentpath=#1}}
+\def\pgfkeys@exp@call#1{\pgfkeysalso{\pgfkeyscurrentpath={#1}}}
% Try to set a key and do nothing if not define
@@ -640,14 +913,15 @@
\pgfkeys{/handlers/.try/.code=\pgfkeys@try}
\pgfkeys{/handlers/.retry/.code=\ifpgfkeyssuccess\else\pgfkeys@try\fi}
\def\pgfkeys@try{%
+ \edef\pgfkeyscurrentkey{\pgfkeyscurrentpath}% make sure that \pgfkeys@code doesn't know about 'try'. Important for .is choice
+ \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text% Hmm... no value
+ \pgfkeysifdefined{\pgfkeyscurrentpath/.@def}%
+ {\pgfkeysgetvalue{\pgfkeyscurrentpath/.@def}{\pgfkeyscurrentvalue}}
+ {}% no default, so leave it
+ \fi%
\pgfkeysifdefined{\pgfkeyscurrentpath/.@cmd}%
{%
\pgfkeysgetvalue{\pgfkeyscurrentpath/.@cmd}{\pgfkeys@code}%
- \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text% Hmm... no value
- \pgfkeysifdefined{\pgfkeyscurrentpath/.@def}%
- {\pgfkeysgetvalue{\pgfkeyscurrentpath/.@def}{\pgfkeyscurrentvalue}}
- {}% no default, so leave it
- \fi%
\expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov%
\pgfkeyssuccesstrue%
}%
@@ -661,7 +935,23 @@
\fi%
\pgfkeyssuccesstrue%
}%
- {\pgfkeyssuccessfalse}%
+ {%
+ \pgfkeys@split@path%
+ \pgfkeysifdefined{/handlers/\pgfkeyscurrentname/.@cmd}{%
+ % in the standard configuration, this check here is redundand
+ % because pgfkeys@ifexecutehandler === true.
+ % It is only interesting for 'handle only existing'.
+ \pgfkeys@ifexecutehandler{%
+ \pgfkeysgetvalue{/handlers/\pgfkeyscurrentname/.@cmd}{\pgfkeys@code}%
+ \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov
+ \pgfkeyssuccesstrue%
+ }{%
+ \pgfkeyssuccessfalse
+ }%
+ }{%
+ \pgfkeyssuccessfalse
+ }%
+ }%
}%
}
@@ -694,6 +984,29 @@
}
}
-
+\pgfkeys{
+ /handler config/.is choice,
+ /handler config/all/.code={%
+ \let\pgfkeys@case@three=\pgfkeys@case@three@handleall
+ \let\pgfkeys@ifexecutehandler=\pgfkeys@ifexecutehandler@handleall
+ },
+ /handler config/only existing/.code={%
+ \let\pgfkeys@case@three=\pgfkeys@case@three@handle@restricted
+ \let\pgfkeys@ifexecutehandler=\pgfkeys@ifexecutehandler@handleonlyexisting
+ },
+ /handler config/full or existing/.code={%
+ \let\pgfkeys@case@three=\pgfkeys@case@three@handle@restricted
+ \let\pgfkeys@ifexecutehandler=\pgfkeys@ifexecutehandler@handlefullorexisting
+ },
+ /handler config/only existing/add exception/.code={\pgfkeysaddhandlyonlyexistingexception{#1}},
+}%
+\pgfkeysaddhandlyonlyexistingexception{.cd}%
+\pgfkeysaddhandlyonlyexistingexception{.try}%
+\pgfkeysaddhandlyonlyexistingexception{.retry}%
+\pgfkeysaddhandlyonlyexistingexception{.lastretry}%
+\pgfkeysaddhandlyonlyexistingexception{.unknown}%
+
+
+\input pgfkeysfiltered.code.tex
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex
new file mode 100644
index 00000000000..c46e418ddad
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex
@@ -0,0 +1,1016 @@
+% Copyright 2008 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 file contains additions to pgfkeys.code.tex (loaded
+% automatically at the end of pgfkeys.code.tex)
+%
+% Improvements:
+%
+% - option filtering
+% you provide
+% - a boolean predicate
+% - a "filter handler" which will be invoked for non-matching options,
+% - a key=value list as usual.
+% The filter sets only matching options and invokes the handler for
+% unmatching ones.
+%
+% - Fast family support as in xkeyval.
+% - A key like /my tree/my option can be associated with /my family
+% - You can efficiently set keys which belong to a set of "active"
+% families.
+% Remaining options can be collected into a macro.
+
+% WARNING:
+% this file overwrites
+% \pgfkeys@addpath
+% \pgfkeys@nevermind
+%
+% all other features are 'additive'
+
+
+% these implementations will be switched dynamically with their
+% filtered versions (in \pgfkeys@install@filter@and@invoke)
+\let\pgfkeys@orig@case@one=\pgfkeys@case@one
+\let\pgfkeys@orig@@set=\pgfkeys@@set
+\let\pgfkeys@orig@@qset=\pgfkeys@@qset
+\let\pgfkeys@orig@try=\pgfkeys@try
+\let\pgfkeys@orig@unknown=\pgfkeys@unknown
+
+\newif\ifpgfkeysfilteringisactive
+\newif\ifpgfkeysfiltercontinue
+\let\pgfkeys@key@predicate=\pgfkeys@empty
+\let\pgfkeys@filtered@handler=\pgfkeys@empty
+\newtoks\pgfkeys@tmptoks
+
+% Performs 'filtered' key settings.
+%
+% For every option for which the path prefixing has already been done,
+% the current key filter predicate will be invoked. If the predicate
+% returns true, pgfkeys will process this key in the normal manner.
+% If not, a key filter handler will be invoked.
+%
+% The *predicate* and *handler* semantics are as follows:
+% PRECONDITION:
+% 1. The variables
+% \pgfkeyscurrentkey (full path including name)
+% \pgfkeyscurrentkeyRAW (the current key as it has been
+% found in the key=value list
+% without path modification)
+% \pgfkeyscurrentvalue
+% are all set. If the current key is a handler variable,
+% \pgfkeyscurrentname
+% and
+% \pgfkeyscurrentpath
+% are also set.
+% 2. The type of option has already been checked, that means
+% case (1) whether '.@cmd' exists
+% case (2) whether the key as such has its value
+% case (3) it is a handler like '.code', '.cd' or whatever.
+% case (0) it is unknown.
+% The actual case number (0-3) will be provided as contents
+% of the macro
+% \pgfkeyscasenumber.
+% It is always a one-character token, so it may be compared
+% with both, \ifnum or \if.
+% Please note that unknown options will be processed with
+% the usual '.unknown' handlers unless the key filter takes
+% control over unknown options as well.
+%
+% POSTCONDITION:
+% the predicate sets
+% \pgfkeysfiltercontinuetrue
+% or
+% \pgfkeysfiltercontinuefalse
+% (the boolean \ifpgfkeysfiltercontinue).
+% Depending on this 'if', option processing will be continued or
+% skipped.
+%
+% The handler can do anything with the option, for example collect
+% unmatched ones.
+%
+% ATTENTION: \pgfkeysfiltered can't be nested (yet). Use the
+% \pgfkeyspredicateAND if you need multiple predicates at once.
+% Nesting would produce unexpected results because the current filter
+% state can't be stored/restored without TeX-groups, therefor it is
+% disabled.
+%
+% ATTENTION: you can't filter error messages.
+%
+% REMARK: In case (3), the macros \pgfkeyscurrentpath and
+% \pgfkeyscurrentname have already been computed, you do not need to
+% invoke \pgfkeyssplitpath. In any other case, neither path nor name
+% are required for the options processing - if you need them for
+% predicates/handlers, you need to compute them by hand.
+%
+%
+% Example:
+% \def\unmatched{}
+% \pgfkeys{/pgf/key filters/is descendant of/.install key filter=/my group}
+% \pgfkeys{/pgf/key filter handlers/append filtered to/.install key filter handler=\unmatched}
+% \pgfkeysfiltered%
+% {/my group/option 1=value 1,/tikz/option 2=value 2}
+% ->
+% will set '/my group/option 1' as usual, but '/tikz/option 2' will not
+% be set. Instead, it will be appended to '\unmatched' such that
+% \unmatched = {/tikz/option 2=value2}
+% after the operation.
+%
+% Arguments:
+% #1: key-value list.
+\def\pgfkeysfiltered{%
+ % produce
+ % '{<default path>}'
+ % each expanded exactly one time into the register:
+ \expandafter\pgfkeysfiltered@@install\expandafter{\pgfkeysdefaultpath}%
+}
+
+% #1: old value of default path.
+% #2: key-value-list.
+\def\pgfkeysfiltered@@install#1#2{%
+ \pgfkeys@install@filter@and@invoke{%
+ \let\pgfkeysdefaultpath\pgfkeys@root%
+ \pgfkeys@parse#2,\pgfkeys@mainstop%
+ \def\pgfkeysdefaultpath{#1}%
+ }%
+}
+
+% Assuming that macro #1 contains a key=value list, this command
+% performs an \pgfkeysalso command for the content of macro #1.
+%
+% It can be used in conjunction with
+% - \pgfkeysfiltered and
+% - \pgfkeysappendfilterednamestomacro:
+% the first pass fill only process options matching the filter, then,
+% a \pgfkeysalsofrom can be used at a later time to set the remaining
+% options.
+%
+% Example:
+% \pgfkeys{/my group/.cd,/utils/exec=\pgfkeysalsofrom\filtered}
+\long\def\pgfkeysalsofrom#1{%
+ \expandafter\pgfkeysalso\expandafter{#1}%
+}
+
+% The same as \pgfkeysalsofrom, but it invokes \pgfkeysalsofiltered.
+\long\def\pgfkeysalsofilteredfrom#1{%
+ \expandafter\pgfkeysalsofiltered\expandafter{#1}%
+}
+
+% #1 = options
+\long\long\def\pgfkeysalsofiltered#1{%
+ \pgfkeys@install@filter@and@invoke{\pgfkeysalso{#1}}%
+}%
+
+% The same like \pgfkeysfiltered, but with quick search path setting.
+%
+% #1: default path
+% #2: key-value-pairs
+\long\def\pgfqkeysfiltered#1{%
+ \expandafter\pgfqkeysfiltered@@install\expandafter{\pgfkeysdefaultpath}{#1}%
+}
+
+% #1: old value of default path.
+% #2: default path
+% #3: key-value-list.
+\long\def\pgfqkeysfiltered@@install#1#2#3{%
+ \pgfkeys@install@filter@and@invoke{%
+ \def\pgfkeysdefaultpath{#2/}\pgfkeys@parse#3,\pgfkeys@mainstop\def\pgfkeysdefaultpath{#1}%
+ }%
+}
+
+% Family management
+%
+% The family code provides the following features:
+% 1. every key can be associated with 0 or 1 'family'.
+% 2. Families are a loose association which are independend of the key
+% hierarchy.
+% For example, /my tree/key1 can belong to family /tikz.
+%
+% 3. It is possible to "activate" or "deactivate" single families.
+% Furthermore, it is possible to set only keys which belong to
+% active families (using \pgfkeysfiltered).
+% 4. Runtime complexities:
+% If you have N options and you only want to process K active
+% families, the runtime is O( N + K ):
+% - activate every family O(K)
+% - use \pgfkeyshasactivefamily as filter predicate O(N)
+% - deactivate every family O(K)
+
+
+% Activates family #1.
+%
+% #1 maybe a macro.
+\def\pgfkeysactivatefamily#1{%
+ \pgfkeysiffamilydefined
+ {#1}%
+ {\csname pgfk@#1/familyactivetrue\endcsname}%
+ {\pgfkeysvalueof{/errors/family unknown/.@cmd}{#1}\pgfeov}%
+%\message{[ACTIVATING FAMILY #1]}%
+}
+
+% Deactivates family #1.
+%
+% #1 maybe a macro.
+\def\pgfkeysdeactivatefamily#1{%
+ \pgfkeysiffamilydefined
+ {#1}%
+ {\csname pgfk@#1/familyactivefalse\endcsname}%
+ {\pgfkeysvalueof{/errors/family unknown/.@cmd}{#1}\pgfeov}%
+%\message{[DEACTIVATING FAMILY #1]}%
+}
+
+% Activates all families in the comma separated list #1.
+%
+% It will also generate code for deactivation of all those families
+% into the command #2.
+%
+% #1: a comma-separated list of fully qualified family names.
+% #2: a command which will be filled with a deactivate-all command.
+\def\pgfkeysactivatefamilies#1#2{%
+ \pgfkeyssavekeyfilterstateto\pgfkeys@cur@state
+ \expandafter\pgfkeysactivatefamilies@impl\expandafter{\pgfkeys@cur@state}{#1}{#2}%
+}
+% #1: commands needed to restore the old filtering state
+% #2: family name list
+% #3: macro name for de-activate command
+\def\pgfkeysactivatefamilies@impl#1#2#3{%
+ \pgfkeysinstallkeyfilter{/pgf/key filters/false}{}%
+ \let#3=\pgfkeys@empty%
+ \def\pgfkeys@filtered@handler{\pgfkeys@family@activate@handler{#3}}%
+ \pgfkeysalsofiltered{#2}%
+ #1%
+}
+
+\def\pgfkeys@family@activate@handler#1{%
+ \pgfkeysactivatefamily{\pgfkeyscurrentkey}%
+ % produce
+ % <old list> '\pgfkeysdeactivatefamily{' <current key> '}'
+ \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter#1\expandafter\pgfkeysdeactivatefamily\expandafter{\pgfkeyscurrentkey}}%
+ \edef#1{\the\pgfkeys@tmptoks}%
+}
+
+% If for testing whether a family exists.
+%
+% #1 = fully qualified family name
+% #2 = if-case
+% #3 = else-case
+%
+% Description:
+%
+% If the family exists, #2 will be executed. Otherwise, #3 will be
+% called.
+\long\def\pgfkeysiffamilydefined#1#2#3{\pgfkeys@ifcsname ifpgfk@#1/familyactive\endcsname#2\else#3\fi}
+
+% Sets the TeX boolean
+% \ifpgfkeysfiltercontinue := ( family #1 is active )
+%
+% Argument:
+% #1 the family name. Maybe a macro.
+\def\pgfkeysisfamilyactive#1{%
+ \pgfkeysiffamilydefined{#1}{%
+ \expandafter\let\expandafter\ifpgfkeysfiltercontinue\csname ifpgfk@#1/familyactive\endcsname
+ }{%
+ \pgfkeysvalueof{/errors/family unknown/.@cmd}{#1}\pgfeov%
+ \expandafter\expandafter\expandafter\let\csname ifpgfkeysfiltercontinue\endcsname\csname iffalse\endcsname
+ }%
+}%
+
+% Retrieve the family of full key #1 into macro #2.
+%
+% Will set the TeX boolean \ifpgfkeyssuccess to whether the full key
+% really has a family.
+%
+% The family for any key is stored in the sub-key #1/family.
+%
+% Parameters:
+% #1: the full key name for which the family is requested. Maybe a
+% macro.
+% #2: a macro name which will be filled with the result.
+\def\pgfkeysgetfamily#1#2{%
+ \pgfkeysifdefined{#1/family}{\pgfkeysgetvalue{#1/family}{#2}\pgfkeyssuccesstrue}{\pgfkeyssuccessfalse}%
+}
+
+% Equivalent to \pgfkeys{#1/.belongs to family=#2}
+\def\pgfkeyssetfamily#1#2{%
+ \pgfkeysiffamilydefined{#2}{%
+ \pgfkeyssetvalue{#1/family}{#2}%
+ }{%
+ \pgfkeysalso{/errors/family unknown=#2}%
+ }%
+}%
+
+
+% Sets \ifpgfkeysfiltercontinue to true iff the current key belongs to
+% the /errors tree.
+\long\def\pgfkeys@cur@is@descendant@of@errors{%
+ \expandafter\pgfkeys@cur@is@descendant@of@errors@impl\pgfkeyscurrentkey/errors\pgf@@eov
+}%
+\long\def\pgfkeys@cur@is@descendant@of@errors@impl#1/errors#2\pgf@@eov{%
+ \def\pgfkeyspred@TMP{#1}%
+ \ifx\pgfkeyspred@TMP\pgfkeys@empty
+%\message{[SPECIAL CHECK] '\pgfkeyscurrentkey' is descendant of '/errors': TRUE.}%
+ \pgfkeysfiltercontinuetrue
+ \else
+%\message{[SPECIAL CHECK] '\pgfkeyscurrentkey' is descendant of '/errors': FALSE.}%
+ \pgfkeysfiltercontinuefalse
+ \fi
+}%
+
+% \pgfkeysinterruptkeyfilter
+% ...
+% \endpgfkeysinterruptkeyfilter
+% temporarily interrupts key filtering and enables it in
+% \endpgfkeysinterruptkeyfilter.
+%
+% If key filtering it not active, this has no effect at all.
+%
+% REMARK:
+% \pgfkeysinterruptkeyfilter...\endpgfkeysinterruptkeyfilter does NOT
+% introduce a \TeX-group.
+\def\pgfkeysinterruptkeyfilter{%
+ \ifpgfkeysfilteringisactive
+ \let\pgfkeys@case@one=\pgfkeys@orig@case@one
+ \let\pgfkeys@try=\pgfkeys@orig@try
+ \let\pgfkeys@unknown=\pgfkeys@orig@unknown
+ \fi
+}
+
+\def\endpgfkeysinterruptkeyfilter{%
+ \ifpgfkeysfilteringisactive
+ \let\pgfkeys@case@one=\pgfkeys@case@one@filtered
+ \let\pgfkeys@try=\pgfkeys@try@filtered
+ \let\pgfkeys@unknown=\pgfkeys@unknown@filtered
+ \fi
+}
+
+% Activates families #1, calls \pgfkeysfiltered and deactivates the
+% families afterwards.
+%
+% REMARK: you need to install a family-based key filter predicate
+% manually to benefit from the activated families!
+%
+% #1: comma separated family list
+% #2: key-value pairs
+%
+% @see \pgfkeysactivatefamiliesandfilteroptions
+\def\pgfkeysactivatefamiliesandfilteroptions#1#2{%
+ \pgfkeysactivatefamilies{#1}{\pgfkeys@family@deactivation}%
+ \pgfkeysfiltered{#2}%
+ \pgfkeys@family@deactivation
+}
+
+% The "quick" variant of \pgfkeysactivatefamiliesandfilteroptions: it
+% also assigns a default path.
+%
+% #1: comma separated family list
+% #2: default path
+% #3: key-value pairs
+\def\pgfqkeysactivatefamiliesandfilteroptions#1#2#3{%
+ \pgfkeysactivatefamilies{#1}{\pgfkeys@family@deactivation}%
+ \pgfqkeysfiltered{#2}{#3}%
+ \pgfkeys@family@deactivation
+}
+
+% Public version of split path:
+\def\pgfkeyssplitpath{\pgfkeys@split@path}%
+
+
+% The same as \pgfkeysactivatefamiliesandfilteroptions but just for
+% ONE family.
+%
+% #1: family (maybe a macro)
+% #2: key-value pairs
+\def\pgfkeysactivatesinglefamilyandfilteroptions#1#2{%
+ \pgfkeysactivatefamily{#1}%
+ \pgfkeysfiltered{#2}%
+ \pgfkeysdeactivatefamily{#1}%
+}
+
+% The "quick" variant of \pgfkeysactivatesinglefamilyandfilteroptions
+%
+% #1: family (maybe a macro)
+% #2: default path
+% #3: key-value pairs
+\def\pgfqkeysactivatesinglefamilyandfilteroptions#1#2#3{%
+ \pgfkeysactivatefamily{#1}%
+ \pgfqkeysfiltered{#2}{#3}%
+ \pgfkeysdeactivatefamily{#1}%
+}
+
+% Installs the key filter '#1' with argument '#2'.
+% This is equivalent to
+% \pgfkeys{#1/.install key filter=#2}
+%
+% The current values of the key filter handler is stored into the public
+% macros
+% \pgfkeyscurrentkeyfilter
+% and
+% \pgfkeyscurrentkeyfilterargs
+%
+% #1: a full key name; may be a macro
+% #2: optional arguments for the key. If the key expects more than one
+% argument, supply '{{first}{second}}'
+\def\pgfkeysinstallkeyfilter#1#2{%
+ \pgfkeysifdefined{#1/.@cmd}{%
+ \edef\pgfkeyscurrentkeyfilter{#1}%
+ \def\pgfkeyscurrentkeyfilterargs{#2}%
+ \pgfkeysgetvalue{#1/.@cmd}{\pgfkeys@key@predicate@}%
+ \def\pgfkeys@key@predicate{\pgfkeys@key@predicate@#2\pgfeov}%
+ }{%
+ \pgfkeysvalueof{/errors/no such key filter/.@cmd}{#1}{#2}\pgfeov%
+ }%
+}
+
+% Installs the key filter handler '#1' with argument '#2'.
+% This is equivalent to
+% \pgfkeys{#1/.install key filter handler=#2}
+%
+% The current values of the key filter handler is stored into the public
+% macros
+% \pgfkeyscurrentkeyfilterhandler
+% and
+% \pgfkeyscurrentkeyfilterhandlerargs
+%
+% #1: a full key name; may be a macro
+% #2: optional arguments for the handler. If the handler expects more than one
+% argument, supply '{{first}{second}}'
+\def\pgfkeysinstallkeyfilterhandler#1#2{%
+ \pgfkeysifdefined{#1/.@cmd}{%
+ \edef\pgfkeyscurrentkeyfilterhandler{#1}%
+ \def\pgfkeyscurrentkeyfilterhandlerargs{#2}%
+ \pgfkeysgetvalue{#1/.@cmd}{\pgfkeys@filtered@handler@}%
+ \def\pgfkeys@filtered@handler{\pgfkeys@filtered@handler@#2\pgfeov}%
+ }{%
+ \pgfkeysvalueof{/errors/no such key filter handler/.@cmd}{#1}{#2}\pgfeov%
+ }%
+}
+
+% Creates a macro which contains commands to re-activate the current
+% key filter and key filter handler. It can be used to temporarily
+% switch the key filter.
+\def\pgfkeyssavekeyfilterstateto#1{%
+ % produce the string
+ % \pgfkeysinstallkeyfilter{...}{...}
+ % \pgfkeysinstallkeyfilterhandler{...}{...}
+ % where each argument is expanded once
+ % FIXME: Do the same with less overhead!
+ \pgfkeys@tmptoks={\pgfkeysinstallkeyfilter}%
+ \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfkeys@tmptoks\expandafter{\pgfkeyscurrentkeyfilter}}%
+ \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfkeys@tmptoks\expandafter{\pgfkeyscurrentkeyfilterargs}\pgfkeysinstallkeyfilterhandler}%
+ \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfkeys@tmptoks\expandafter{\pgfkeyscurrentkeyfilterhandler}}%
+ \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfkeys@tmptoks\expandafter{\pgfkeyscurrentkeyfilterhandlerargs}}%
+ \edef#1{%
+ \the\pgfkeys@tmptoks
+ }%
+}
+
+
+\pgfkeys{%
+ /errors/family unknown/.code=\pgfkeys@error{%
+ Sorry, I do not know family '#1' and can't work with any assoicated family handling. Perhaps you misspelled it?},
+ /errors/no such key filter/.code 2 args=\pgfkeys@error{Sorry, there is no such key filter '#1'.},
+ /errors/no such key filter handler/.code 2 args=\pgfkeys@error{Sorry, there is no such key filter handler '#1'.},
+ % HANDLERS:
+ %
+ % .is family should
+ % 1. '.cd' into the families' path,
+ % 2. define booleans to activate/deactive the family
+ % (see \pgfkeysisfamilyactive)
+ % 3. make sure that \pgfkeyshasactivefamily returns true for
+ % the family itsself.
+ /handlers/.is family/.append code={%
+ %\newif is an \outer macro in plain tex, so this here is not portable:
+ %\expandafter\newif\csname if\pgfkeyscurrentpath/familyactive\endcsname
+ \edef\pgfkeyspred@TMP{pgfk@\pgfkeyscurrentpath/familyactive}%
+ \expandafter\pgfkeys@non@outer@newif\expandafter{\pgfkeyspred@TMP}%
+ \edef\pgfkeyspred@TMP{\pgfkeyscurrentpath/.belongs to family=\pgfkeyscurrentpath}%
+ \expandafter\pgfkeysalso\expandafter{\pgfkeyspred@TMP}%
+ },%
+ /handlers/.activate family/.code=\pgfkeysactivatefamily{\pgfkeyscurrentpath},
+ /handlers/.deactivate family/.code=\pgfkeysdeactivatefamily{\pgfkeyscurrentpath},
+ /handlers/.belongs to family/.code={\pgfkeyssetfamily{\pgfkeyscurrentpath}{#1}},%
+ %
+ %
+ % An addition to the '.try' and '.retry' handlers:
+ %
+ % It is the same as '.retry', but if the option is still unknown, the
+ % usual handlers for unknown keys will be invoked.
+ /handlers/.lastretry/.code={%
+ \ifpgfkeyssuccess\else
+ \pgfkeys@try
+ \ifpgfkeyssuccess\else
+ % discard the '.lastretry' suffix:
+ \edef\pgfkeyscurrentkey{\pgfkeyscurrentpath}%
+ \pgfkeys@split@path%
+ \pgfkeys@unknown
+ \fi
+ \fi
+ },
+ %
+ %
+ /handlers/.install key filter/.code={%
+ \pgfkeysinstallkeyfilter{\pgfkeyscurrentpath}{#1}%
+ },%
+ /handlers/.install key filter handler/.code={%
+ \pgfkeysinstallkeyfilterhandler{\pgfkeyscurrentpath}{#1}%
+ },%
+ %
+ %
+ % KEY FILTER HANDLERS:
+ %
+ /pgf/key filter handlers/append filtered to/.code={%
+ % Produce
+ % <orig key> '={' <value> '}'
+ % where both, the key and the value are expanded just ONCE:
+ \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter\pgfkeyscurrentkeyRAW\expandafter=\expandafter{\pgfkeyscurrentvalue}}%
+ \ifx#1\pgfkeys@empty
+ \else
+ % Produce <old list> ',' <orig key> '={' <value> '}'
+ \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter#1\expandafter,\the\pgfkeys@tmptoks}%
+ \fi
+ \edef#1{\the\pgfkeys@tmptoks}%
+ },%
+ /pgf/key filter handlers/ignore/.code={},
+ /pgf/key filter handlers/ignore/.install key filter handler,
+ /pgf/key filter handlers/log/.code={%
+ \immediate\write16{LOG: the option '\pgfkeyscurrentkey' (was originally '\pgfkeyscurrentkeyRAW') (case \pgfkeyscasenumber) has not been processed due to pgfkeysfiltered.}%
+ },
+ %
+ %
+ % KEY FILTER PREDICATES:
+ %
+ % Returns true iff the currently processed key belongs to an active family.
+ % A family is active if it has been activated before.
+ /pgf/key filters/active families/.code={%
+ \if\pgfkeyscasenumber0%
+ % unknown options shall be processed with the
+ % unknown-handlers.
+ \pgfkeysfiltercontinuetrue
+ \else
+ \if\pgfkeyscasenumber3%
+ \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP
+ \else
+ \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP
+ \fi
+ \ifpgfkeyssuccess
+ \pgfkeysisfamilyactive{\pgfkeyspred@TMP}%
+ \else% Ok, it does not belong to any family.
+ \pgfkeysfiltercontinuefalse
+ \fi
+ \fi
+ },%
+ %
+ %
+ %
+ % This filter works as follows:
+ % 1. if the current key belongs to a family:
+ % return whether its family is active,
+ % 2. if the current key does NOT belong to a family:
+ % return the result of criterion '#1',
+ % 3. the current key is unknown:
+ % return the result of criterion '#2'.
+ %
+ % Arguments:
+ % #1: the predicate which will be invoked in case 2.
+ % It will be invoked with the current case number as argument.
+ % #2: the predicate which will be invoked in case 3 with
+ % the current case number as argument.
+ /pgf/key filters/active families or no family/.code 2 args={%
+ \if\pgfkeyscasenumber0%
+ \pgfkeysevalkeyfilterwith{#2}%
+ \else
+ \if\pgfkeyscasenumber3%
+ \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP
+ \else
+ \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP
+ \fi
+ \ifpgfkeyssuccess
+ \pgfkeysisfamilyactive{\pgfkeyspred@TMP}%
+ \else% Ok, it does not belong to any family.
+ \pgfkeysevalkeyfilterwith{#1}%
+ \fi
+ \fi
+ },
+ /pgf/key filters/active families or no family DEBUG/.code 2 args={%
+ \if\pgfkeyscasenumber0%
+ \immediate\write16{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) invoking unknown handler '#2']}%
+ \pgfkeysevalkeyfilterwith{#2}%
+ \else
+ \if\pgfkeyscasenumber3%
+ \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP
+ \else
+ \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP
+ \fi
+ \ifpgfkeyssuccess
+ \pgfkeysisfamilyactive{\pgfkeyspred@TMP}%
+ \ifpgfkeysfiltercontinue
+ \immediate\write16{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) family is ACTIVE]}%
+ \else
+ \immediate\write16{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) family is NOT active.]}%
+ \fi
+ \else% Ok, it does not belong to any family.
+ \immediate\write16{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) invoking has-no-family-handler '#1']}%
+ \pgfkeysevalkeyfilterwith{#1}%
+ \fi
+ \fi
+ },
+ %
+ % A (faster) shortcut for
+ % /pgf/key filters/active families or no family=
+ % {/pgf/keys filters/false}
+ % {/pgf/keys filters/false}
+ /pgf/key filters/active families and known/.code={%
+ \if\pgfkeyscasenumber0%
+ \pgfkeysfiltercontinuefalse
+ \else
+ \if\pgfkeyscasenumber3%
+ \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP
+ \else
+ \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP
+ \fi
+ \ifpgfkeyssuccess
+ \pgfkeysisfamilyactive{\pgfkeyspred@TMP}%
+ \else% Ok, it does not belong to any family.
+ \pgfkeysfiltercontinuefalse
+ \fi
+ \fi
+ },
+ % A (faster) shortcut for
+ % /pgf/key filters/active families or no family=
+ % {/pgf/key filters/is descendant of=#1}% for keys without family
+ % {/pgf/keys filters/false}
+ /pgf/key filters/active families or descendants of/.code={%
+ \if\pgfkeyscasenumber0%
+ \pgfkeysfiltercontinuefalse
+ \else
+ \if\pgfkeyscasenumber3%
+ \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP
+ \else
+ \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP
+ \fi
+ \ifpgfkeyssuccess
+ \pgfkeysisfamilyactive{\pgfkeyspred@TMP}%
+ \else% Ok, it does not belong to any family.
+ % the 'is descendendant of' implementation has been
+ % COPY PASTED here:
+ %
+ % string prefix comparison:
+ \def\pgfkeysisdescendantof@impl##1#1##2\pgf@@eov{%
+ \def\pgfkeyspred@TMP{##1}%
+ \ifx\pgfkeyspred@TMP\pgfkeys@empty
+ \pgfkeysfiltercontinuetrue
+ \else
+ \pgfkeysfiltercontinuefalse
+ \fi
+ }%
+ \expandafter\pgfkeysisdescendantof@impl\pgfkeyscurrentkey#1\pgf@@eov
+ \fi
+ \fi
+ },
+ %
+ % Processes only options which are childs of #1.
+ % Example:
+ % is descendant of/.install key filter=/foo
+ % will be true for
+ % /foo/bar/x=y
+ % /foo/.cd
+ % /foo/bar/.style=...
+ % but not for
+ % /bar/foo/...
+ /pgf/key filters/is descendant of/.code={%
+ \if\pgfkeyscasenumber0%
+%\message{'\pgfkeyscurrentkey' (case \pgfkeyscasenumber) is UNKNOWN. Calling unknown handler.}%
+ % unknown options shall be processed with the
+ % unknown-handlers.
+ \pgfkeysfiltercontinuetrue
+ \else
+ % string prefix comparison:
+ % [ note : this has been COPY-PASTED to
+ % |active families or descendants of| ]
+ \def\pgfkeysisdescendantof@impl##1#1##2\pgf@@eov{%
+ \def\pgfkeyspred@TMP{##1}%
+ \ifx\pgfkeyspred@TMP\pgfkeys@empty
+%\message{'\pgfkeyscurrentkey' (case \pgfkeyscasenumber) is descendant of '#1': TRUE.}%
+ \pgfkeysfiltercontinuetrue
+ \else
+%\message{'\pgfkeyscurrentkey' (case \pgfkeyscasenumber) is descendant of '#1': FALSE.}%
+ \pgfkeysfiltercontinuefalse
+ \fi
+ }%
+ \expandafter\pgfkeysisdescendantof@impl\pgfkeyscurrentkey#1\pgf@@eov
+ \fi
+ },%
+ %
+ %
+ %
+ % Returns true if the currently processed full key equals #2.
+ /pgf/key filters/equals/.code={%
+ \if\pgfkeyscasenumber0%
+ % Unknown option:
+ \pgfkeysfiltercontinuetrue
+ \else
+ \def\pgfkeyspred@TMP{#1}%
+ \ifx\pgfkeyscurrentkey\pgfkeyspred@TMP
+ \pgfkeysfiltercontinuetrue
+ \else
+ \pgfkeysfiltercontinuefalse
+ \fi
+ \fi
+ },%
+ %
+ %
+ % Argument #1 can be any other (evaluated) filter predicate, its logical return
+ % value will be inverted.
+ % Example:
+ % not/.install key filter={is descendend of=/tikz}
+ % will install a key filter which evaluates 'is descendant of' with argument '/tikz' and returns the logical negation of the result.
+ %
+ /pgf/key filters/not/.code={%
+ \pgfkeysevalkeyfilterwith{#1}%
+ \ifpgfkeysfiltercontinue
+ \pgfkeysfiltercontinuefalse
+ \else
+ \pgfkeysfiltercontinuetrue
+ \fi
+ },%
+ /pgf/key filters/and/.code 2 args={%
+ \pgfkeysevalkeyfilterwith{#1}%
+ \ifpgfkeysfiltercontinue
+ \pgfkeysevalkeyfilterwith{#2}%
+ \fi
+ },%
+ /pgf/key filters/or/.code 2 args={%
+ \pgfkeysevalkeyfilterwith{#1}%
+ \ifpgfkeysfiltercontinue
+ \else
+ \pgfkeysevalkeyfilterwith{#2}%
+ \fi
+ },%
+ /pgf/key filters/true/.code={\pgfkeysfiltercontinuetrue},%
+ /pgf/key filters/true/.install key filter,
+ /pgf/key filters/false/.code={%
+ \pgfkeysfiltercontinuefalse
+ },%
+ %
+ % Returns false if the current key is unknown, which avoids calling
+ % the unknown handlers.
+ /pgf/key filters/defined/.code={%
+ \if\pgfkeyscasenumber0%
+ \pgfkeysfiltercontinuefalse
+ \else
+ \pgfkeysfiltercontinuetrue
+ \fi
+ },
+}%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Private IMPLEMENTATION
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+% This command does THE SAME work as \pgfkeys@case@one,
+% but it applies filtering whenever it identified the type of an
+% option.
+\def\pgfkeys@case@one@filtered{%
+ \pgfkeys@cur@is@descendant@of@errors
+ \ifpgfkeysfiltercontinue
+ \pgfkeys@orig@case@one
+ \else
+ \pgfkeysfiltercontinuetrue
+ \pgfkeysifdefined{\pgfkeyscurrentkey/.@cmd}{%
+ % CASE ONE: a command option
+ \def\pgfkeyscasenumber{1}%
+ \pgfkeys@key@predicate%
+ \ifpgfkeysfiltercontinue
+%\message{PROCESSING KEY \pgfkeyscurrentkey!}%
+ \pgfkeysgetvalue{\pgfkeyscurrentkey/.@cmd}{\pgfkeys@code}%
+ \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov
+ \else
+%\message{FILTERED OUT KEY \pgfkeyscurrentkey!}%
+ \pgfkeys@filtered@handler%
+ \fi
+ }{%
+ % CASE TWO: a normal value option
+ \pgfkeysifdefined{\pgfkeyscurrentkey}{%
+ \def\pgfkeyscasenumber{2}%
+ \pgfkeys@key@predicate%
+ \ifpgfkeysfiltercontinue
+%\message{PROCESSING KEY \pgfkeyscurrentkey!}%
+ \pgfkeys@case@two@extern
+ \else
+%\message{FILTEReD OUT KEY \pgfkeyscurrentkey!}%
+ \pgfkeys@filtered@handler%
+ \fi
+ }{%
+ \pgfkeys@split@path
+ % CASE THREE: a handler
+ \pgfkeysifdefined{/handlers/\pgfkeyscurrentname/.@cmd}{%
+ \pgfkeys@ifexecutehandler{%
+ \def\pgfkeyscasenumber{3}%
+ \pgfkeys@key@predicate%
+ \ifpgfkeysfiltercontinue
+%\message{PROCESSING KEY \pgfkeyscurrentkey!}%
+ \pgfkeysgetvalue{/handlers/\pgfkeyscurrentname/.@cmd}{\pgfkeys@code}%
+ \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov
+ \else
+%\message{FILTERED OUT KEY \pgfkeyscurrentkey!}%
+ \pgfkeys@filtered@handler%
+ \fi
+ }{%
+ \pgfkeys@unknown
+ }%
+ }{%
+ \pgfkeys@unknown
+ }%
+ }%
+ }%
+ \fi
+}%
+
+\def\pgfkeys@unknown@filtered{%
+ % CASE ZERO: an unknown option.
+ \def\pgfkeyscasenumber{0}%
+ \pgfkeys@key@predicate%
+ \ifpgfkeysfiltercontinue
+%\message{PROCESSING KEY \pgfkeyscurrentkey!}%
+ % start normal 'unknown' handlers:
+ \pgfkeys@orig@unknown
+ \else
+%\message{FILTEReD OUT KEY \pgfkeyscurrentkey!}%
+ \pgfkeys@filtered@handler%
+ \fi
+}
+
+% Does the same as \pgfkeys@try, but it also invokes the key filters.
+\def\pgfkeys@try@filtered{%
+ \ifpgfkeysfiltercontinue
+ \pgfkeys@orig@try
+ \else
+ \pgfkeysfiltercontinuetrue
+ \edef\pgfkeyscurrentkey{\pgfkeyscurrentpath}% make sure that \pgfkeys@code doesn't know about 'try'. Important for .is choice
+ \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text% Hmm... no value
+ \pgfkeysifdefined{\pgfkeyscurrentpath/.@def}%
+ {\pgfkeysgetvalue{\pgfkeyscurrentpath/.@def}{\pgfkeyscurrentvalue}}
+ {}% no default, so leave it
+ \fi%
+ \pgfkeysifdefined{\pgfkeyscurrentpath/.@cmd}%
+ {%
+ % CASE ONE: a command option
+ \def\pgfkeyscasenumber{1}%
+ \pgfkeys@key@predicate%
+ \ifpgfkeysfiltercontinue
+ \pgfkeysgetvalue{\pgfkeyscurrentkey/.@cmd}{\pgfkeys@code}%
+ \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov%
+ \else
+ \pgfkeys@filtered@handler%
+ \fi
+ \pgfkeyssuccesstrue%
+ }%
+ {%
+ \pgfkeysifdefined{\pgfkeyscurrentpath}%
+ {% CASE TWO: a normal value option
+ \def\pgfkeyscasenumber{2}%
+ \pgfkeys@key@predicate%
+ \ifpgfkeysfiltercontinue
+ \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text%
+ \pgfkeysvalueof{\pgfkeyscurrentpath}%
+ \else%
+ \pgfkeyslet{\pgfkeyscurrentpath}\pgfkeyscurrentvalue%
+ \fi%
+ \else
+ \pgfkeys@filtered@handler%
+ \fi
+ \pgfkeyssuccesstrue%
+ }%
+ {%
+ \pgfkeys@split@path%
+ \pgfkeysifdefined{/handlers/\pgfkeyscurrentname/.@cmd}{%
+ % CASE THREE: a handled key
+ %
+ % in the standard configuration, this check here is redundand
+ % because pgfkeys@ifexecutehandler === true.
+ % It is only interesting for 'handle only existing'.
+ \pgfkeys@ifexecutehandler{%
+ \def\pgfkeyscasenumber{3}%
+ \pgfkeys@key@predicate%
+ \ifpgfkeysfiltercontinue
+%\message{PROCESSING KEY \pgfkeyscurrentkey!}%
+ \pgfkeysgetvalue{/handlers/\pgfkeyscurrentname/.@cmd}{\pgfkeys@code}%
+ \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov
+ \else
+%\message{FILTERED OUT KEY \pgfkeyscurrentkey!}%
+ \pgfkeys@filtered@handler%
+ \fi
+ \pgfkeyssuccesstrue%
+ }{%
+ \pgfkeyssuccessfalse
+ }%
+ }{%
+ \pgfkeyssuccessfalse
+ }%
+ }%
+ }%
+ \fi
+}
+
+
+% #1 the code to invoke after init and before cleanup
+\def\pgfkeys@install@filter@and@invoke#1{%
+ \ifpgfkeysfilteringisactive
+ \pgfkeys@error{Sorry, nested calls to key filtering routines are not allowed. (reason: It is not possible to properly restore the previous filtering state after returning from the nested call)}%
+ \fi
+ \pgfkeysfilteringisactivetrue
+ \let\pgfkeys@case@one=\pgfkeys@case@one@filtered
+ \let\pgfkeys@try=\pgfkeys@try@filtered
+ \let\pgfkeys@unknown=\pgfkeys@unknown@filtered
+ #1%
+ \let\pgfkeys@case@one=\pgfkeys@orig@case@one
+ \let\pgfkeys@try=\pgfkeys@orig@try
+ \let\pgfkeys@unknown=\pgfkeys@orig@unknown
+ \pgfkeysfilteringisactivefalse
+}
+
+
+%--------------------------------------------------
+% \def\pgfkeys@eval@key@filter@subroutine@case@one{%
+% \pgfkeysifdefined{\pgfkeyscurrentkey/.@cmd}{%
+% \pgfkeysgetvalue{\pgfkeyscurrentkey/.@cmd}{\pgfkeys@code}%
+% \let\pgfkeyspred@TMP=\pgfkeyscurrentvalue
+% \pgfkeys@eval@key@filter@subroutine@restorestate
+% \expandafter\pgfkeys@code\pgfkeyspred@TMP\pgfeov
+% }{%
+% \pgfkeysvalueof{/errors/no such key filter/.@cmd}\pgfkeyscurrentkey\pgfkeyscurrentvalue\pgfeov%
+% }%
+% }
+% % THIS VERSION IS TOO SLOW. See below.
+% \def\pgfkeysevalkeyfilterwith#1{%
+% \edef\pgfkeys@eval@key@filter@subroutine@restorestate{%
+% \noexpand\def\noexpand\pgfkeyscurrentkey{\pgfkeyscurrentkey}%
+% \noexpand\def\noexpand\pgfkeyscurrentkeyRAW{\pgfkeyscurrentkeyRAW}%
+% \noexpand\def\noexpand\pgfkeyscurrentname{\pgfkeyscurrentname}%
+% \noexpand\def\noexpand\pgfkeyscurrentvalue{\pgfkeyscurrentvalue}%
+% \noexpand\pgfkeys@pathtoks={\pgfkeyscurrentpath}%
+% }%
+% \pgfkeysinterruptkeyfilter
+% \let\pgfkeys@case@one=\pgfkeys@eval@key@filter@subroutine@case@one
+% \pgfkeysalso{#1}%
+% \endpgfkeysinterruptkeyfilter% this here also restored \pgfkeys@case@one.
+% \pgfkeys@eval@key@filter@subroutine@restorestate
+% }%
+%--------------------------------------------------
+
+
+% Evaluates a key filter '#1'. Example:
+% \pgfkeysevalkeyfilterwith{/pgf/key filters/equals=/tikz}
+%
+% \pgfkeysevalkeyfilterwith works only if key filtering is
+% active.
+%
+% The argument '#1' MUST be a FULL KEY.
+%
+% The implementation employs a subset of the \pgfkeysalso code.
+\long\def\pgfkeysevalkeyfilterwith#1{%
+ \pgfkeys@eval@key@filter@subroutine@unpack#1=\pgfkeysnovalue=\pgfkeys@stop
+}%
+\long\def\pgfkeys@eval@key@filter@subroutine@unpack#1=#2=#3\pgfkeys@stop{%
+ \pgfkeys@spdef\pgfkeyspred@TMP{#1}%
+ \edef\pgfkeyspred@TMP{\pgfkeyspred@TMP}%
+ \pgfkeys@spdef\pgfkeyspred@TMPB{#2}% TMPB=value
+ \ifx\pgfkeyspred@TMPB\pgfkeysnovalue@text% Hmm... no value
+ \pgfkeysifdefined{\pgfkeyspred@TMP/.@def}%
+ {\pgfkeysgetvalue{\pgfkeyspred@TMP/.@def}{\pgfkeyspred@TMPB}}
+ {}% no default, so leave it
+ \fi%
+ \ifx\pgfkeyspred@TMPB\pgfkeysvaluerequired%
+ \pgfkeysvalueof{/errors/value required/.@cmd}\pgfkeyspred@TMP\pgfkeyspred@TMPB\pgfeov%
+ \else%
+ \pgfkeysifdefined{\pgfkeyspred@TMP/.@cmd}{%
+ \pgfkeysgetvalue{\pgfkeyspred@TMP/.@cmd}{\pgfkeys@code}%
+ \expandafter\pgfkeys@code\pgfkeyspred@TMPB\pgfeov
+ }{%
+ \pgfkeysvalueof{/errors/no such key filter/.@cmd}\pgfkeyspred@TMP\pgfkeyspred@TMPB\pgfeov%
+ }%
+ \fi%
+}
+
+
+\def\pgfkeys@non@outer@newif@#1#2{%
+ \expandafter\edef\csname #2true\endcsname{\noexpand\let\noexpand#1=\noexpand\iftrue}%
+ \expandafter\edef\csname #2false\endcsname{\noexpand\let\noexpand#1=\noexpand\iffalse}%
+ \csname #2false\endcsname
+}%
+
+% For latex and context, this here has the same effect as a \newif
+% applied to 'if#1'. For plain tex, it has also the same effect, but
+% it is not an \outer macro as the plain-tex \newif.
+\def\pgfkeys@non@outer@newif#1{%
+ \expandafter\pgfkeys@non@outer@newif@\csname if#1\endcsname{#1}%
+}
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex
index 97727fdbeb7..6a0a1be016d 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex
@@ -15,8 +15,10 @@
% prints out a message to the log.
-\def\pgfversion{2.00}
-\def\pgftypesetversion{\oldstylenums{2}.\oldstylenums{00}}
+%\def\pgfversion{2.00-cvs}
+%\def\pgftypesetversion{\oldstylenums{2}.\oldstylenums{00}--\textsc{cvs}}
+\def\pgfversion{2.10}
+\def\pgftypesetversion{\oldstylenums{2}.\oldstylenums{10}}
\ifx\pgfrcsloaded\undefined
@@ -87,7 +89,7 @@
\def\ProvidesFile#1[#2]{\wlog{Loading file #1 version #2.}}
\fi
-\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/utilities/pgfrcs.code.tex,v 1.21 2008/02/20 11:00:42 tantau Exp $
+\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/utilities/pgfrcs.code.tex,v 1.24 2010/10/25 20:57:06 ludewich Exp $
\catcode`\@=\pgfrcsatcode
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex
index 29c27b499c7..7b3c34a0510 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex
@@ -39,6 +39,7 @@
\def\pgfutil@firstoftwo#1#2{#1}
\def\pgfutil@secondoftwo#1#2{#2}
\def\pgfutil@empty{}
+\def\pgfutil@gobble@until@relax#1\relax{}
\def\pgfutil@gobble#1{}
\def\pgfutil@gobbletwo#1#2{}
\def\pgfutil@namedef#1{\expandafter\def\csname #1\endcsname}
@@ -46,8 +47,8 @@
\def\pgfutil@@namelet#1#2{\expandafter\let\expandafter#1\csname#2\endcsname}
\long\def\pgfutil@g@addto@macro#1#2{%
\begingroup
- \toks@\expandafter{#1#2}%
- \xdef#1{\the\toks@}%
+ \pgfutil@toks@\expandafter{#1#2}%
+ \xdef#1{\the\pgfutil@toks@}%
\endgroup}
\newif\ifpgfutil@tempswa
@@ -77,6 +78,19 @@
% pgfutil@in@
\newif\ifpgfutil@in@
+
+% Usage:
+% \pgfutil@in@{one}{three two one}
+% \ifpgfutil@in@
+% -> will be true!
+% \else
+% \fi
+%
+% \pgfutil@in@{,}{1234,456567}
+% \ifpgfutil@in@
+% -> will be true!
+% \else
+% \fi
\def\pgfutil@in@#1#2{%
\def\pgfutil@in@@##1#1##2##3\pgfutil@in@@{%
\ifx\pgfutil@in@##2\pgfutil@in@false\else\pgfutil@in@true\fi}%
@@ -106,9 +120,9 @@
% pgfutil@IfFileExists
-\chardef\pgfutil@inputcheck0
+%\chardef\pgfutil@inputcheck0
\def\pgfutil@IfFileExists#1#2#3{%
- \openin\pgfutil@inputcheck#1 %
+ \openin\pgfutil@inputcheck=#1 %
\ifeof\pgfutil@inputcheck
#3\relax
\else
@@ -119,6 +133,13 @@
\def\pgfutil@InputIfFileExists#1#2#3{\pgfutil@IfFileExists{#1}{\input #1\relax#2}{#3}}%
+% pgfutil@loop (from plain.tex)
+
+\def\pgfutil@loop#1\pgfutil@repeat{\def\pgfutil@body{#1}\pgfutil@iterate}
+\def\pgfutil@iterate{\pgfutil@body \let\pgfutil@next\pgfutil@iterate \else\let\pgfutil@next\relax\fi \pgfutil@next}
+\let\pgfutil@repeat=\fi % this makes \loop...\if...\repeat skippable
+
+
% aux-read-hook
\let\pgfutil@aux@read@hook=\relax
@@ -130,4 +151,314 @@
\newtoks\pgfutil@everybye
+%
+% PDF-Resource management -- might seem strange that this is here, but
+% it turns out to be the correct place since latex and context handle
+% this stuff quite differently
+%
+
+% Adding something to the pdf-resources:
+
+\def\pgfutil@addpdfresource@extgs#1{\pgf@sys@addpdfresource@extgs@plain{#1}}
+\def\pgfutil@addpdfresource@colorspaces#1{\pgf@sys@addpdfresource@colorspaces@plain{#1}}
+\def\pgfutil@addpdfresource@patterns#1{\pgf@sys@addpdfresource@patterns@plain{#1}}
+\def\pgfutil@setuppdfresources{\pgf@sys@setuppdfresources@plain}
+
+
+% Inserts the argument at the begin of the current page (hopefully)
+
+\let\pgfutil@insertatbegincurrentpage=\relax
+
+
+% Library files inclusion
+
+
+% Include a library file.
+%
+% #1 = List of names of library file.
+%
+% Description:
+%
+% This command includes a list of library files. For each file X in the
+% list, the file pgflibraryX.code.tex is included, provided this has
+% not been done earlier.
+%
+% For the convenience of Context users, both round and square brackets
+% are possible for the argument.
+%
+% Example:
+%
+% \usepgflibrary{arrows}
+% \usepgflibrary[patterns,snakes]
+
+\def\usepgflibrary{\pgfutil@ifnextchar[{\use@pgflibrary}{\use@@pgflibrary}}%}
+\def\use@pgflibrary[#1]{\use@@pgflibrary{#1}}
+\def\use@@pgflibrary#1{%
+ \edef\pgf@list{#1}%
+ \pgfutil@for\pgf@temp:=\pgf@list\do{%
+ \expandafter\pgfkeys@spdef\expandafter\pgf@temp\expandafter{\pgf@temp}%
+ \ifx\pgf@temp\pgfutil@empty
+ \else
+ \expandafter\ifx\csname pgf@library@\pgf@temp @loaded\endcsname\relax%
+ \expandafter\let\csname pgf@library@\pgf@temp @loaded\endcsname=\pgfutil@empty%
+ \expandafter\edef\csname pgf@library@#1@atcode\endcsname{\the\catcode`\@}
+ \expandafter\edef\csname pgf@library@#1@barcode\endcsname{\the\catcode`\|}
+ \catcode`\@=11
+ \catcode`\|=12
+ \input pgflibrary\pgf@temp.code.tex
+ \catcode`\@=\csname pgf@library@#1@atcode\endcsname
+ \catcode`\|=\csname pgf@library@#1@barcode\endcsname
+ \fi%
+ \fi
+ }%
+}
+
+
+% Include a module file.
+%
+% #1 = List of names of module files.
+%
+% Description:
+%
+% This command includes a list of module files. For each file X in the
+% list, the file pgfmoduleX.code.tex is included, provided this has
+% not been done earlier.
+%
+% For the convenience of Context users, both round and square brackets
+% are possible for the argument.
+%
+% Example:
+%
+% \usepgfmodule{matrix}
+
+\def\usepgfmodule{\pgfutil@ifnextchar[{\use@pgfmodule}{\use@@pgfmodule}}%}
+\def\use@pgfmodule[#1]{\use@@pgfmodule{#1}}
+\def\use@@pgfmodule#1{%
+ \edef\pgf@list{#1}%
+ \pgfutil@for\pgf@temp:=\pgf@list\do{%
+ \expandafter\ifx\csname pgf@module@\pgf@temp @loaded\endcsname\relax%
+ \expandafter\let\csname pgf@module@\pgf@temp @loaded\endcsname=\pgfutil@empty%
+ \expandafter\edef\csname pgf@module@#1@atcode\endcsname{\the\catcode`\@}
+ \expandafter\edef\csname pgf@module@#1@barcode\endcsname{\the\catcode`\|}
+ \catcode`\@=11
+ \catcode`\|=12
+ \input pgfmodule\pgf@temp.code.tex
+ \catcode`\@=\csname pgf@module@#1@atcode\endcsname
+ \catcode`\|=\csname pgf@module@#1@barcode\endcsname
+ \fi%
+ }%
+}
+
+\def\pgfutilensuremath#1{%
+ \ifmmode#1\else$#1$\fi
+}
+
+
+%
+% Guess the driver:
+%
+
+\def\pgfutil@guessdriver{\edef\pgfsysdriver{pgfsys-\Gin@driver}}
+
+\begingroup
+ \catcode`\"=12
+ \edef\pgf@loc@TMPa{"}%
+ %
+ % prepares file names by checking for double colons.
+ %
+ % If '#1' is a usual file name without anything fancy, \pgfretval
+ % will simply contain it. However, if '#1' contains double colons
+ % (introduces, for example, by pdftex because there are white
+ % spaces in '#1'), the routine
+ % - removes the double colons,
+ % - re-inserts them outside of the string.
+ %
+ % \pgfutilpreparefilename{file.tex} -> file.tex
+ % \pgfutilpreparefilename{"A file name".file} -> "A file name.file"
+ %
+ % The resulting file name is returned in '\pgfretval',
+ % furthermore, a *quoted* version of the file name is returned in
+ % \pgfretvalquoted. The latter result is to have some sort of
+ % output normalisation: if the file name as such contains double
+ % quotes, we don't want to insert another set of them.
+ %
+ % This special handling has the following purposes:
+ % 1. Both, treatment of white spaces and double colons is not
+ % properly defined in TeX. Thus, we should only work with them if
+ % necessary and maintain backwards compatibility as far as
+ % possible.
+ % 2. It *should* work if there are spaces.
+ %
+ \gdef\pgfutilpreparefilename#1{%
+ \begingroup
+ \ifnum\the\catcode`\"=13
+ \pgfutilconvertdcolon
+ \fi
+ \xdef\pgf@temp{#1}%
+ \endgroup
+ \expandafter\pgfutil@in@\expandafter"\expandafter{\pgf@temp}%
+ \ifpgfutil@in@
+ \def\pgf@loc@TMPa{\pgfutilstrreplace{"}{}}%
+ \expandafter\pgf@loc@TMPa\expandafter{\pgf@temp}%
+ \edef\pgfretval{"\pgfretval"}% re-insert quotes! Otherwise, TeX can't use the file name.
+ \let\pgfretvalquoted=\pgfretval
+ \else
+ \let\pgfretval=\pgf@temp
+ \edef\pgfretvalquoted{"\pgfretval"}%
+ \fi
+ }%
+ \catcode`\"=13
+ \xdef\pgfutilconvertdcolon{%
+ \noexpand\def\noexpand"{\pgf@loc@TMPa}%
+ }%
+\endgroup
+
+% Usage:
+% \pgfutilstrreplace{<token>}{<replacement>}{<string>}
+%
+% -> will assign the modified string into \pgfretval.
+%
+% #1: the string to search (one or more tokens)
+% #2: zero, one or more tokens which will be inserted instead of '#1'.
+% #3: the string to search in
+\long\def\pgfutilstrreplace#1#2#3{%
+ \def\pgfretval{}%
+ \long\def\pgfutil@search@and@replace@@##1#1##2\pgf@EOI{%
+ \expandafter\def\expandafter\pgfretval\expandafter{\pgfretval ##1#2}%
+ \pgfutil@search@and@replace@loop{#1}{##2}%
+ }%
+ \pgfutil@search@and@replace@loop{#1}{#3}%
+}
+\long\def\pgfutil@search@and@replace@loop#1#2{%
+ \pgfutil@in@{#1}{#2}%
+ \ifpgfutil@in@
+ \def\pgf@loc@TMPa{\pgfutil@search@and@replace@@ #2\pgf@EOI}%
+ \else
+ \expandafter\def\expandafter\pgfretval\expandafter{\pgfretval #2}%
+ \let\pgf@loc@TMPa=\relax
+ \fi
+ \pgf@loc@TMPa
+}%
+
+% Solves a linear equation system of size 2x2 using gauss elimination.
+%
+% It employs TeX register arithmetics to do so.
+% #1: should contain 4 sets of braces with matrix entries,
+% {<a11>}{<a12>}
+% {<a21>}{<a22>}
+% where each entry should be a number without unit.
+% It is acceptable if '#1' is a macro which expands to the expected
+% format.
+% #2: should contain 2 sets of braces with the right-hand-side,
+% {<r1>}{<r2>}
+% where each entry should be a number without unit.
+% It is acceptable if '#2' is a macro which expands to the expected
+% format.
+%
+% It will assign \pgfmathresult to contain two sets of braces with the
+% result.
+%
+% Example:
+% \pgfutilsolvetwotwoleq{
+% {0.24}{1}
+% {-0.97}{0}
+% }{
+% {-7}
+% {18}
+% }
+% -> yields \pgfmathresult={−18.55618}{−2.54642}
+%
+% The algorithm employs column pivotisation.
+\def\pgfutilsolvetwotwoleq#1#2{%
+ \begingroup
+ \dimendef\aa=0
+ \dimendef\ab=1
+ \dimendef\ba=2
+ \dimendef\bb=3
+ \dimendef\ra=4
+ \dimendef\rb=5
+ \dimendef\tmpa=6
+ \dimendef\tmpb=7
+ \edef\pgf@temp{#1}%
+ \expandafter\pgfutilsolvetwotwoleq@A\pgf@temp
+ \edef\pgf@temp{#2}%
+ \expandafter\pgfutilsolvetwotwoleq@r\pgf@temp
+ %
+ \pgfutilsolvetwotwoleq@ifislarger\aa\ba{%
+ % identity "permutation":
+ \def\Pa{a}%
+ \def\Pb{b}%
+ }{%
+ % permutation matrix: switch rows!
+ \def\Pa{b}%
+ \def\Pb{a}%
+ }%
+ % \pivot := 1/aa
+ \pgfmathreciprocal@
+ {\csname m\Pa a\endcsname}%
+ \let\pivot=\pgfmathresult
+ %
+ % \factor := 1/aa * ba
+ \csname \Pb a\endcsname=\pivot\csname \Pb a\endcsname
+ \edef\factor{\expandafter\pgf@sys@tonumber\csname \Pb a\endcsname}%
+ %
+ % bb -= ba/aa * ab
+ \tmpa=-\factor\csname \Pa b\endcsname
+ \advance\csname \Pb b\endcsname by\tmpa
+ %
+ % rb -= ba/aa * ra
+ \tmpa=-\factor\csname r\Pa\endcsname
+ \advance\csname r\Pb\endcsname by\tmpa
+ %
+ % xb := rb / bb (the modified rb and modified bb!)
+ \pgfmathdivide@
+ {\expandafter\pgf@sys@tonumber\csname r\Pb\endcsname}
+ {\expandafter\pgf@sys@tonumber\csname \Pb b\endcsname}%
+ \expandafter\let\csname pgfmathresult\Pb\endcsname=\pgfmathresult
+ %
+ % ra -= xb * ab
+ \tmpa=\csname pgfmathresult\Pb\endcsname\csname \Pa b\endcsname
+ \advance\csname r\Pa\endcsname by-\tmpa
+ %
+ % xa := 1/aa * ra (the modified ra!)
+ \tmpa=\pivot\csname r\Pa\endcsname
+ \expandafter\edef\csname pgfmathresult\Pa\endcsname{\pgf@sys@tonumber\tmpa}%
+ %
+ \edef\pgfmathresult{%
+ {\csname pgfmathresult\Pa\endcsname}%
+ {\csname pgfmathresult\Pb\endcsname}%
+ }%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+\def\pgfutilsolvetwotwoleq@ifislarger#1#2#3#4{%
+ \tmpa=#1
+ \ifdim\tmpa<0pt
+ \multiply\tmpa by-1
+ \fi
+ \tmpb=#2
+ \ifdim\tmpb<0pt
+ \multiply\tmpb by-1
+ \fi
+ \ifdim\tmpa>\tmpb
+ #3%
+ \else
+ #4%
+ \fi
+}%
+\def\pgfutilsolvetwotwoleq@A#1#2#3#4{%
+ \def\maa{#1}\def\mab{#2}%
+ \def\mba{#3}\def\mbb{#3}%
+ \aa=#1pt \ab=#2pt
+ \ba=#3pt \bb=#4pt
+}
+\def\pgfutilsolvetwotwoleq@r#1#2{%
+ \ra=#1pt \rb=#2pt
+}%
+
+% there are funny programs which overwrite \read and \write (like
+% tabularx).
+\let\pgfutil@write=\write
+\let\pgfutil@read=\read
+
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def
index 784cb59cdc9..08d3bf93c77 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def
@@ -59,7 +59,15 @@
\edef#3{\expandafter\expandafter\expandafter\pgfutil@emu@select\csname\string\color@#1\endcsname}%
}
-\let\pgfutil@doifcolorelse=\doifcolorelse
+
+\def\pgfutil@doifcolorelse#1#2#3{%
+ \expandafter\ifx\csname\string\color@#1\endcsname\relax%
+ \doifcolorelse{#1}{\let\pgf@next=\pgfutil@firstoftwo}{\let\pgf@next=\pgfutil@secondoftwo}%
+ \else
+ \let\pgf@next=\pgfutil@firstoftwo%
+ \fi%
+ \pgf@next{#2}{#3}%
+}
\def\pgfutil@reset@color{%
@@ -136,12 +144,12 @@
\edef\pgf@marshal{\noexpand\pgfutil@in@{ g}{\pgf@temp}}%
\pgf@marshal%
\ifpgfutil@in@%
- \expandafter\pgfutil@context@parse@gray\pgf@temp{#1}%
+ \expandafter\pgfutil@context@parse@gray\pgf@temp\pgf@stop{#1}%
\else%
\edef\pgf@marshal{\noexpand\pgfutil@in@{ rg}{\pgf@temp}}%
\pgf@marshal%
\ifpgfutil@in@%
- \expandafter\pgfutil@context@parse@rgb\pgf@temp{#1}%
+ \expandafter\pgfutil@context@parse@rgb\pgf@temp\pgf@stop{#1}%
\else%
\PackageError{pgf}{Color #1 has an unsupported color model.}{}%
\pgfutil@definecolor{#1}{gray}{0}
@@ -149,14 +157,16 @@
\fi%
}
-\def\pgfutil@context@parse@gray#1 g#2{%
- \pgfutil@definecolor{#2}{gray}{#1}
+\def\pgfutil@context@parse@gray#1 g#2\pgf@stop#3{%
+ \pgfutil@definecolor{#3}{gray}{#1}
}
-\def\pgfutil@context@parse@rgb#1 #2 #3 rg#4{%
- \pgfutil@definecolor{#4}{rgb}{#1,#2,#3}
+\def\pgfutil@context@parse@rgb#1 #2 #3 rg#4\pgf@stop#5{%
+ \pgfutil@definecolor{#5}{rgb}{#1,#2,#3}
}
+% Make this command available in general:
+\let\colorlet=\pgfutil@colorlet
% pgfutil@minipage
@@ -174,12 +184,39 @@
\ifx\pdfoutput\@undefined\newcount\pdfoutput\fi
\ifx\pdfoutput\relax\newcount\pdfoutput\fi
-\ifcase\pdfoutput%
- \gdef\Gin@driver{dvips.def}%
-\else%
- \gdef\Gin@driver{pdftex.def}%
-\fi%
+\def\pgfutil@guessdriver{
+ \ifx\XeTeXversion\@undefined
+ \ifx\preloadedspecials\@undefined%
+ \ifcase\pdfoutput%
+ \def\pgfsysdriver{pgfsys-dvips.def}%
+ \else%
+ \def\pgfsysdriver{pgfsys-pdftex.def}% pdfTeX & LuaTeX
+ \fi%
+ \else%
+ \pgfutil@driver@if@in{postscript}{pgfsys-dvips.def}
+ \pgfutil@driver@if@in{tpd}{pgfsys-pdftex.def}
+ \pgfutil@driver@if@in{dpm}{pgfsys-dvipdfm.def}
+ \pgfutil@driver@if@in{dpx}{pgfsys-dvipdfmx.def}
+ \pgfutil@driver@if@in{xetex}{pgfsys-xetex.def}
+ \ifx\pgfsysdriver\relax%
+ \PackageWarning{pgf}{I was not able to discern the driver, the
+ preloaded specials were \preloadedspecials. I am going to use
+ pgfsys-dvips.def}%
+ \def\pgfsysdriver{pgfsys-dvips.def}
+ \fi%
+ \fi
+ \else
+ \def\pgfsysdriver{pgfsys-xetex.def}% should be right
+ \fi
+}
+\def\pgfutil@driver@if@in#1#2{%
+ \edef\pgf@marshal{\noexpand\pgfutil@in@{#1}{\preloadedspecials}}
+ \pgf@marshal
+ \ifpgfutil@in@%
+ \def\pgfsysdriver{#2}%
+ \fi%
+}
% Global colors
@@ -191,7 +228,7 @@
% Font stuff
-\def\pgfutil@font@tiny{\tfxx} % How to do this correctly?
+\def\pgfutil@font@tiny{\tfxx}
\def\pgfutil@font@scriptsize{\tfxx}
\def\pgfutil@font@footnotesize{\tfx}
\def\pgfutil@font@small{\tfx}
@@ -204,9 +241,9 @@
\def\pgfutil@font@itshape{\it}
\def\pgfutil@font@bfseries{\bf}
-\let\pgfutil@font@normalfont=\rm
+\let\pgfutil@font@normalfont=\tf
-\let\pgfutil@selectfont=\rm
+\let\pgfutil@selectfont=\tf
% Extra counters, registers, boxes
@@ -219,14 +256,68 @@
\newdimen\pgfutil@tempdima
\newdimen\pgfutil@tempdimb
+\newbox \pgfutil@voidb@x
+\newtoks \pgfutil@toks@
+
% Module stuff
-\def\pgfutil@usemodule#1{\usemodule[#1]}
+\long\def\pgfutil@usemodule#1{%
+ % seems as if \usemodule resets \catcodes... handle that here:
+ \long\edef\pgf@temp##1{%
+ \noexpand\usemodule[##1]\noexpand\relax%
+ \noexpand\catcode`\noexpand\@=\the\catcode`\@\relax
+ \noexpand\catcode`\noexpand\|=\the\catcode`\|\relax
+ }%
+ \pgf@temp{#1}%
+}
-% End of job stuff
+% Adding something at the begin of the current page:
+
+\let\pgfutil@insertatbegincurrentpagefrombox=\flushatshipout
+\let\pgfutil@insertatbegincurrentpage=\flushatshipout
+\def\pgfutil@insertatbegineverypage#1{\appendtoks #1 \to \everyshipout}
+
+% Adding something to the pdf-resources:
+
+\def\pgfutil@addpdfresource@extgs#1{\appendtoPDFdocumentextgstates{#1}}
+\def\pgfutil@addpdfresource@colorspaces#1{\appendtoPDFdocumentcolorspaces{#1}}
+\def\pgfutil@addpdfresource@patterns#1{\appendtoPDFdocumentpatterns{#1}}
+\def\pgfutil@setuppdfresources{}
+
+\ifx\appendtoPDFdocumentpatterns\undefined
+ \let\docuPDFpatterns\empty
+ \def\checkPDFpatterns
+ {\ifx\docuPDFpatterns\empty \else
+ \ifnum\realpageno=\lastpage\relax
+ \doPDFdictionaryobject{FDF}{docupatterns}{\docuPDFpatterns}%
+ \fi
+ \doPDFgetobjectreference{FDF}{docupatterns}\PDFobjectreference
+ \doPDFpageresource{/Pattern \PDFobjectreference}%
+ \fi}
+ \appendtoksonce \checkPDFpatterns \to \everyshipout
+ \def\appendtoPDFdocumentpatterns#1{\xdef\docuPDFpatterns{\docuPDFpatterns\space#1}}
+\fi
+
+% Collect resources (don't know how to do this otherwise)
+
+\def\pgf@sys@pdf@check@resources{%
+ \global\let\pgf@sys@pdf@possible@resources\pgfutil@empty%
+ \doifobjectreferencefoundelse{FDF}{docushades}
+ {\doPDFgetobjectreference{FDF}{docushades}\PDFobjectreference
+ \xdef\pgf@sys@pdf@possible@resources{\pgf@sys@pdf@possible@resources/Shading \PDFobjectreference}}\donothing
+ \doifobjectreferencefoundelse{FDF}{docuextgstates}
+ {\doPDFgetobjectreference{FDF}{docuextgstates}\PDFobjectreference
+ \xdef\pgf@sys@pdf@possible@resources{\pgf@sys@pdf@possible@resources/ExtGState \PDFobjectreference}}\donothing
+ \doifobjectreferencefoundelse{FDF}{colorspaces}
+ {\doPDFgetobjectreference{FDF}{colorspaces}\PDFobjectreference
+ \xdef\pgf@sys@pdf@possible@resources{\pgf@sys@pdf@possible@resources/ColorSpace \PDFobjectreference}}\donothing
+}
+
+
+% Do something at the end of a job
\appendtoks \the\pgfutil@everybye \to \everybye
@@ -237,9 +328,9 @@
% prefixed by pgfutil@):
\def\PackageInfo#1#2{}
-\def\PackageWarning#1#2{\immediate\write-1{Package #1: Warning! #2.}}%
-\def\PackageError#1#2#3{\immediate\write-1{Package #1: Error! #2.}}%
+\def\PackageWarning#1#2{\immediate\write17{Package #1: Warning! #2.}}%
+\def\PackageError#1#2#3{\immediate\write17{Package #1: Error! #2.}}%
\long\def\AtBeginDocument#1{#1}%
-\long\def\AtBeginDvi#1{#1}%
\endinput
+% vi: ft=tex ts=2 sw=2 expandtab
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
index b50830db666..f9681aa4a56 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
@@ -13,6 +13,9 @@
\let\pgfutil@auxout=\@auxout
\let\pgfutil@tempcnta=\@tempcnta
\let\pgfutil@tempcntb=\@tempcntb
+\let\pgfutil@voidb@x=\voidb@x
+\let\pgfutil@toks@=\toks@
+
\def\pgfutil@definecolor{\definecolor}
\def\pgfutil@color{\color}
@@ -61,4 +64,38 @@
\AtEndDocument{\the\pgfutil@everybye}
+\def\pgfutil@insertatbegincurrentpagefrombox#1{%
+ \global\setbox\pgfutil@abb\hbox{\unhbox\pgfutil@abb#1}%
+}
+\newbox\pgfutil@abb%
+\def\pgfutil@insertatbegincurrentpage#1{%
+ \expandafter\gdef\expandafter\pgfutil@abc\expandafter{\pgfutil@abc#1}%
+}
+\let\pgfutil@abc\pgfutil@empty%
+\def\pgfutil@insertatbegineverypage#1{%
+ \expandafter\gdef\expandafter\pgfutil@abe\expandafter{\pgfutil@abe#1}%
+}
+\let\pgfutil@abe\pgfutil@empty%
+
+\RequirePackage{everyshi}
+\EveryShipout{%
+ % Add at begin page stuff
+ \setbox\@cclv=\vbox{%
+ \setbox\z@=\hbox{\pgfutil@abe\unhbox\pgfutil@abb\pgfutil@abc\global\let\pgfutil@abc\pgfutil@empty}%
+ \wd\z@=\z@
+ \ht\z@=\z@
+ \dp\z@=\z@
+ \box\z@
+ % if TeX changes into vertical mode, it inserts \parskip and
+ % \lineskip. Disable it here:
+ \nointerlineskip
+ \ifvbox\@cclv \unvbox\@cclv \else\hsize=\wd\@cclv \unhbox\@cclv \fi%
+ %\box\@cclv
+ % using \box instead of \unhbox or \unvbox
+ % has the advantage that glue settings won't be
+ % altered (as for \unhbox/\unvbox). But \box breaks compatibility
+ % with the 'remember picture' feature.
+ }%
+}
+
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def
index 9128021faa7..c09cf21fe0f 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def
@@ -157,12 +157,20 @@
\ifx\pdfoutput\@undefined\alloc@0\count\countdef\insc@unt\pdfoutput\fi
\ifx\pdfoutput\relax\alloc@0\count\countdef\insc@unt\pdfoutput\fi
-\ifcase\pdfoutput%
- \gdef\Gin@driver{dvips.def}%
-\else%
- \gdef\Gin@driver{pdftex.def}%
-\fi%
+\def\pgfutil@guessdriver{
+ \ifcase\pdfoutput%
+ \ifx\XeTeXversion\@undefined
+ \def\pgfsysdriver{pgfsys-dvips.def}% hopefully
+ \else
+ \def\pgfsysdriver{pgfsys-xetex.def}% should be right
+ \fi
+ \else%
+ \def\pgfsysdriver{pgfsys-pdftex.def}% should be right
+ \fi%
+}
+
+
% Global colors
@@ -213,14 +221,62 @@
\let\pgfutil@origend=\end
\def\end{\the\pgfutil@everybye\pgfutil@origend}
+% Link to existing stuff
+\let\pgfutil@voidb@x\voidb@x
+\let\pgfutil@toks@\toks@
+
+
+
+
+% Hack shipout. Should perhaps use atbegshi? Not in standard distribution, currently...
+% Code inspired (but patched...) from everyshi.sty:
+
+\def\pgfutil@insertatbegincurrentpagefrombox#1{%
+ \global\setbox\pgfutil@abb\hbox{\unhbox\pgfutil@abb#1}%
+}
+\newbox\pgfutil@abb%
+\def\pgfutil@insertatbegincurrentpage#1{%
+ \expandafter\gdef\expandafter\pgfutil@abc\expandafter{\pgfutil@abc#1}%
+}
+\let\pgfutil@abc\pgfutil@empty%
+\def\pgfutil@insertatbegineverypage#1{%
+ \expandafter\gdef\expandafter\pgfutil@abe\expandafter{\pgfutil@abe#1}%
+}
+\let\pgfutil@abe\pgfutil@empty%
+
+\def\pgfutil@@EveryShipout@Shipout{%
+ \afterassignment\pgfutil@@EveryShipout@Test
+ \setbox255= %
+}
+\def\pgfutil@@EveryShipout@Test{%
+ \ifvoid\@cclv\relax
+ \aftergroup\pgfutil@EveryShipout@Output
+ \else
+ \pgfutil@EveryShipout@Output
+ \fi%
+}
+\def\pgfutil@EveryShipout@Output{%
+ \setbox255=\vbox{%
+ \setbox0=\hbox{\pgfutil@abe\unhbox\pgfutil@abb\pgfutil@abc\global\let\pgfutil@abc\pgfutil@empty}%
+ \wd0=0pt%
+ \ht0=0pt%
+ \dp0=0pt%
+ \box0%
+ \unvbox255%
+ }%
+ \pgfutil@@EveryShipout@Org@Shipout\box\@cclv%
+}
+\let\pgfutil@@EveryShipout@Org@Shipout\shipout
+\let\shipout\pgfutil@@EveryShipout@Shipout
+
+
% The following is still messy and needs to be cleanup up (everything
% prefixed by pgfutil@):
\def\PackageInfo#1#2{}
-\def\PackageWarning#1#2{\immediate\write-1{Package #1: Warning! #2.}}%
-\def\PackageError#1#2#3{\immediate\write-1{Package #1: Error! #2.}}%
+\def\PackageWarning#1#2{\immediate\write17{Package #1: Warning! #2.}}%
+\def\PackageError#1#2#3{\immediate\write17{Package #1: Error! #2.}}%
\long\def\AtBeginDocument#1{#1}%
-\long\def\AtBeginDvi#1{#1}%
\endinput