diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex | 164 |
1 files changed, 100 insertions, 64 deletions
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 887e86e00e7..843a8cd23f4 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.43 2015/05/14 14:43:05 cfeuersaenger Exp $ +\ProvidesFileRCS{pgfcorearrows.code.tex} @@ -19,7 +19,7 @@ % % This command is used to define a new arrow tip kind. For more % details on the description of the keys, please see the pgfmanual. -% +% % name = Name of the arrow. If the name contains a dash % (hyphen), the text before the hyphen is the start name % and the text behind it the end name. @@ -36,7 +36,7 @@ % will then be available inside the "code". Values needed % only for the "... end" keys and the convex hull do not % need to be saved since these are also executed only -% once. +% once. % drawing code = Code for drawing the arrow. When the cache key is set to % true, which is the default, the code will be protocolled % and the resulting code is inserted using \pgflowlevelobj. @@ -56,10 +56,10 @@ % arrow tip was already installed with the same macro % names (and caching is true), the cached code is % used. Note that when you use dimensions here, add \the. -% -% Inside the setup code, the following macros are available: % -% \pgfarrowsettipend +% Inside the setup code, the following macros are available: +% +% \pgfarrowssettipend % The code should draw an arrow pointing "right along the x % axis". The "tip" key specifies how far the arrow goes % along the x axis, that is, it should be the x coordinate @@ -69,20 +69,20 @@ % "\pgfarrowresult", which is \let to be equal to % \pgf@x. A \relax will be added after the code provided % here, so you can write things like "\pgfarrowresult=1pt". -% \pgfarrowsetbackend +% \pgfarrowssetbackend % The leftmost x-coordinate that is still part of the % arrow tip (the "back end" of the arrow"). This coordinate % will be used when multiple arrow tips are % composed. Defaults to 0pt. -% \pgfarrowsetlineend +% \pgfarrowssetlineend % The x-coordinate where a line should stop inside the arrow % tip so that it gets "obscured" by the arrow. Defaults to 0pt. -% \pgfarrowsetvisualtipend +% \pgfarrowssetvisualtipend % When the arrow tip is drawn in flex mode, it is rotated % such that the x-coordinates of "visual tip end" and "visual -% back end" lie on the path. Defaults to \pgfarrowsettipend. -% \pgfarrowsetvisualbackend -% See above. Defaults to \pgfarrowsetbackend +% back end" lie on the path. Defaults to \pgfarrowssettipend. +% \pgfarrowssetvisualbackend +% See above. Defaults to \pgfarrowssetbackend \def\pgfdeclarearrow#1{% \let\pgf@decl@arrow@defaults\pgfutil@empty% @@ -136,10 +136,10 @@ \expandafter\let\csname pgf@ar@do@cache@\pgf@decl@arrow@name@end\endcsname\pgf@decl@arrow@cache% \else% \pgferror{Arrow tip '\pgf@decl@arrow@name@end' was already - defined with key 'means' previously and you cannot change this}% + defined with key 'means' previously and you cannot change this}% \fi% \else% - \pgferror{You cannot set both the 'means' and also the 'drawing code' + \pgferror{You cannot set both the 'means' and also the 'drawing code' keys for arrow tip '\pgf@decl@arrow@name@end'}% \fi% \fi% @@ -185,11 +185,11 @@ % Handler for defining arrow tips: -% +% % Description: -% +% % When you write "my name/.tip = arrow spec", this has the same -% effect as writeing \pgfdeclarearrow{name = my name, means = arrow spec}. +% effect as writing \pgfdeclarearrow{name = my name, means = arrow spec}. \pgfkeys{/handlers/.tip/.code=% \expandafter\expandafter\expandafter\pgf@arrows@unravel\pgfkeyscurrentpath/\pgf@stop% @@ -201,11 +201,11 @@ % Draw an arrow -% +% % #1 = arrow specification -% +% % Description: -% +% % Draws the arrow in the given specification (and "end" % specification). The arrow will be drawn such that it touches the % origin "from the left", that is, the arrow will lie completely in @@ -223,14 +223,14 @@ % Compute the length of an arrow -% +% % #1 = arrow specification -% +% % Description: -% +% % In \pgf@x, this will return the total length of the arrow given as % #1, in \pgf@xa it will return the distance from the tip to the line -% end. +% end. \def\pgfarrowtotallength#1{% {% @@ -250,10 +250,10 @@ % #1 = An arrow specification % % Description: -% +% % An "arrow specification" is a sequence of names of meta arrow tips % together with options in brackets. In detail: -% +% % In #1, consider the text from the start up to the first bracket. If % this text is the name of a (meta) arrow tip, we use this arrow tip % with the provided options. If it is the name of a arrow tip @@ -261,8 +261,8 @@ % each arrow tip inside the shorthand. If the text is neither or the % above, the first letter of text is treated as a shorthand without % options. -% -% The special arrow tip "." is used to indicate the end of the line. +% +% The special arrow tip "." is used to indicate the end of the line. % % \pgfsetarrowsend{stealth[reversed]} % \pgfsetarrowsend{stealth[length=1pt] . stealth[length=2pt]} @@ -322,11 +322,11 @@ \fi% \fi% \fi% - \expandafter\pgf@next\pgf@temp[% + \expandafter\pgf@next\pgf@temp[% } \def\pgf@arrows@empty[#1]{% - \pgfutil@ifnextchar\pgf@stop\pgf@arrows@parser@done\pgfarrows@parser% + \pgfutil@ifnextchar\pgf@stop\pgf@arrows@parser@done\pgfarrows@parser% } \def\pgf@arrows@single@char@parser#1{% @@ -343,13 +343,13 @@ \let\pgf@temp\pgf@untranslated% \let\pgf@next\pgf@arrows@unknown% \else% - \let\pgf@next\pgf@arrows@shorthand@parsed% + \let\pgf@next\pgf@arrows@shorthand@parsed% \fi% \else% - \let\pgf@next\pgf@arrows@meta@parsed% + \let\pgf@next\pgf@arrows@meta@parsed% \fi \fi - \expandafter\pgf@next\pgf@temp[]% + \expandafter\pgf@next\pgf@temp[]% } \def\pgf@arrows@unknown#1[]#2[#3]{% \pgferror{Unknown arrow tip kind '#1#2'}% @@ -357,12 +357,12 @@ \def\pgf@arrows@meta@parsed#1[#2]{% % Ok, run the keys #2. This will add commands to \pgf@arrows@options: - % + % \let\pgf@arrows@options\pgf@arrows@options@initial% \pgfkeys{/pgf/arrow keys/.cd,#2}% % Append the arrow and its options to the arrow tip sequence: \expandafter\pgf@arrows@meta@set\expandafter{\pgf@arrows@options}{#1}{\pgf@arrow@handle}% - \pgfutil@ifnextchar\pgf@stop\pgf@arrows@parser@done\pgfarrows@parser% + \pgfutil@ifnextchar\pgf@stop\pgf@arrows@parser@done\pgfarrows@parser% } \def\pgf@arrows@parser@done#1{% @@ -370,7 +370,7 @@ \def\pgf@arrows@dot@parsed#1[#2]{% \pgf@arrows@append@to@tips{\pgf@arrow@handle@dot}% - \pgfutil@ifnextchar\pgf@stop\pgf@arrows@parser@done\pgfarrows@parser% + \pgfutil@ifnextchar\pgf@stop\pgf@arrows@parser@done\pgfarrows@parser% } \def\pgf@arrows@meta@set#1#2#3{% @@ -385,7 +385,7 @@ \fi% \expandafter\expandafter\expandafter\def% \expandafter\expandafter\expandafter\pgf@arrow@tip@sequence% - \expandafter\expandafter\expandafter{\expandafter\pgf@tempa\pgf@tempb}% + \expandafter\expandafter\expandafter{\expandafter\pgf@tempa\pgf@tempb}% } \def\pgf@arrows@shorthand@parsed#1[#2]{% @@ -398,7 +398,7 @@ \expandafter\expandafter\expandafter\pgf@arrows@meta@set\expandafter\expandafter\expandafter{% \expandafter\pgf@arrows@options\expandafter}\expandafter{\csname pgf@ar@means@#1\endcsname}{\pgf@arrow@handle@shorthand}% \fi% - \pgfutil@ifnextchar\pgf@stop\pgf@arrows@parser@done\pgfarrows@parser% + \pgfutil@ifnextchar\pgf@stop\pgf@arrows@parser@done\pgfarrows@parser% } @@ -426,7 +426,7 @@ % #1 = An arrow specification % % Description: -% +% % This works like \pgfsetarrowsend, only the order of the tips in the % arrow specification is reversed and the "reversed names" are used. % @@ -517,14 +517,14 @@ }, fill/.value required, open/.style={fill=none}, - .unknown/.code={ + .unknown/.code={ \expandafter\pgfutil@in@\expandafter!\expandafter{\pgfkeyscurrentname}% \ifpgfutil@in@% % this is a color! \expandafter\pgfarrowsaddtooptions\expandafter{\expandafter\def\expandafter\pgf@arrows@stroke@color\expandafter{\pgfkeyscurrentname}}% \else% \pgfutil@doifcolorelse{\pgfkeyscurrentname} - {% + {% \expandafter\pgfarrowsaddtooptions\expandafter{\expandafter\def\expandafter\pgf@arrows@stroke@color\expandafter{\pgfkeyscurrentname}}% } {% @@ -586,7 +586,7 @@ \pgf@x#1% \ifdim\pgfinnerlinewidth>0pt% \pgf@arrows@inner@line@width@dep{#2}{#3}% - \else% + \else% \advance\pgf@x by#2\pgflinewidth% \fi% } @@ -618,12 +618,12 @@ \def\pgf@arrow@id@count{0}% % Compute the arrow id of an arrow -% +% % #1 = arrow name % #2 = options -% +% % Description: -% +% % Returns the an id in \pgf@arrow@id that identifies the instantiation % of the given arrow. If the arrow was not instantiated, this happens now. @@ -637,7 +637,7 @@ % 3. Local: #2\relax% % 4. Nested: - \pgf@arrows@nested@options% + \pgf@arrows@nested@options% % 5. Last options: \pgf@arrows@late@options% % 6. Scaling: @@ -658,6 +658,7 @@ \expandafter\global\expandafter\let\csname\pgf@arrow@fullname{#1}\endcsname\pgf@arrow@id@count% \global\let\pgf@arrow@id\pgf@arrow@id@count% {% + \pgfclearid% \csname pgf@ar@setup@#1\endcsname% % Handle reversal \ifpgfarrowreversed% @@ -773,12 +774,12 @@ \def\pgfarrowssetvisualbackend#1{\pgf@x#1\edef\pgf@arrows@the@visualbackend{\the\pgf@x}} -% Internal computatin of the line end (shortening) for an arrow -% +% Internal computation of the line end (shortening) for an arrow +% % #1 = arrow tip list -% +% % Description: -% +% % \pgf@xa will contain the necessary path shortening for the given % arrow tip list, \pgf@xb will contain the total length of the arrow % tip list (sum of the differences between tip end and back end plus @@ -820,15 +821,52 @@ +\def\pgf@arrow@rigid@arrow#1#2{% + {% + \pgf@xb=#2% + \pgftransformxshift{-\pgf@xb}% + \let\pgf@arrow@handle\pgf@arrow@rigid + \let\pgf@arrow@handle@dot\relax% + #1% + }% +} + + +\def\pgf@arrow@rigid#1#2{% + % Prepare: + {% + \pgfarrows@getid{#1}{#2}% + % Do shift: + \expandafter\expandafter\expandafter\pgf@arrow@drawer@shift\csname pgf@ar@ends@\pgf@arrow@id\endcsname% + % Do slant: + \ifdim\pgfarrows@slant pt=0pt% + \else% + \pgftransformxslant{\pgfarrows@slant}% + \fi% + % do swap: + \ifpgfarrowswap% + \pgftransformyscale{-1}% + \fi% + {% + \csname pgf@ar@saves@\pgf@arrow@id\endcsname% + \pgf@arrows@rigid@hull% + }% + \expandafter}% + % Transform to next tip: + \expandafter\pgftransformxshift\expandafter{\the\pgf@xc}% +} + + + % Draw an arrow -% +% % #1 = arrow tip list % #2 = total length of the arrow (the value of \pgf@xb computed by % \pgf@arrow@compute@shortening) -% +% % Description: -% +% % Draws an arrow tip list. The coordinate system must have been % transformed so that the to-be-drawn arrow points right and should % "end" at the origin. @@ -850,7 +888,7 @@ \pgfarrows@getid{#1}{#2}% % Do shift: \expandafter\expandafter\expandafter\pgf@arrow@drawer@shift\csname pgf@ar@ends@\pgf@arrow@id\endcsname% - % Do slant: + % Do slant: \ifdim\pgfarrows@slant pt=0pt% \else% \pgftransformxslant{\pgfarrows@slant}% @@ -866,7 +904,7 @@ \pgflowlevelsynccm\csname pgf@ar@cache@\pgf@arrow@id\endcsname% \endpgfscope% \pgf@arrows@rigid@hull% - }% + }% \expandafter}% % Transform to next tip: \expandafter\pgftransformxshift\expandafter{\the\pgf@xc}% @@ -890,7 +928,7 @@ \pgf@arrows@color@setup@restore@std@colors \pgfsetfillcolor{pgfstrokecolor}% \fi% - \else% + \else% \pgf@arrows@color@setup@restore@std@colors \pgfsetfillcolor{\pgf@arrows@fill@color}% \fi% @@ -958,12 +996,13 @@ } + % Sets arrows % % #1 = An arrow specification of the form % <start spec>-<end spec>. This will call \pgfsetstartarrow{start % spec} and \pgfsetendarrow{end spec}. -% +% % Alternatively, it may be of the form [options]. In this case, % the arrow options are set for the local scope and all arrows in % the current scope will have these options set. @@ -986,7 +1025,7 @@ \pgfutil@ifnextchar\pgf@stop{% \let\pgf@arrows@options\pgf@arrows@options@scope% \pgfkeys{/pgf/arrow keys/.cd,#1}% - \let\pgf@arrows@options@scope\pgf@arrows@options% + \let\pgf@arrows@options@scope\pgf@arrows@options% % Ok, setup the options \pgfutil@gobble% }{% @@ -999,10 +1038,9 @@ - % % Predefined arrows: -% +% % A dot is used to indicate the end of the line: @@ -1036,7 +1074,7 @@ -% Compatibility with old arrow system: +% Compatibility with old arrow system: \pgfkeys {} @@ -1054,7 +1092,7 @@ \def\pgfsetarrowoptions#1#2{\expandafter\def\csname pgf@arrow@compat@opt@#1\endcsname{#2}} \def\pgfgetarrowoptions#1{\csname pgf@arrow@compat@opt@#1\endcsname} \def\pgfarrowsdeclare#1#2#3#4{% - \pgfdeclarearrow{ name ={#1}-{#2}, setup code ={#3}, drawing code={#4}, parameters/.expand once={\csname pgf@arrow@compat@opt@#2\endcsname}} + \pgfdeclarearrow{ name ={#1}-{#2}, setup code ={#3}, drawing code={#4}, parameters/.expand once={\csname pgf@arrow@compat@opt@#2\endcsname}}% \expandafter\def\csname pgf@arrow@compat@opt@#2\endcsname{0}} \def\pgfarrowsleftextend#1{\pgfmathsetlength\pgf@xa{#1}\pgfarrowssetbackend{\pgf@xa}} \def\pgfarrowsrightextend#1{\pgfmathsetlength\pgf@xb{#1}\pgfarrowssettipend{\pgf@xb}} @@ -1213,5 +1251,3 @@ \endinput - - |