Debian Codegraph @

texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypositioning.code.tex

raw
1 % Copyright 2018 by Till Tantau
2 %
3 % This file may be distributed and/or modified
4 %
5 % 1. under the LaTeX Project Public License and/or
6 % 2. under the GNU Public License.
7 %
8 % See the file doc/generic/pgf/licenses/LICENSE for more details.
9
10 \ProvidesFileRCS{tikzlibrarypositioning.code.tex}
11
12
13 \tikzset{above/.code=\tikz@lib@place@handle@{#1}{south}{0}{1}{north}{1}}%
14 \tikzset{above left/.code=\tikz@lib@place@handle@{#1}{south east}{-1}{1}{north west}{0.707106781}}%
15 \tikzset{above right/.code=\tikz@lib@place@handle@{#1}{south west}{1}{1}{north east}{0.707106781}}%
16 \tikzset{base left/.code =\tikz@lib@place@handle@{#1}{base east}{-1}{0}{base west}{1}}%
17 \tikzset{base right/.code=\tikz@lib@place@handle@{#1}{base west}{1}{0}{base east}{1}}%
18 \tikzset{below/.code=\tikz@lib@place@handle@{#1}{north}{0}{-1}{south}{1}}%
19 \tikzset{below left/.code=\tikz@lib@place@handle@{#1}{north east}{-1}{-1}{south west}{0.707106781}}%
20 \tikzset{below right/.code=\tikz@lib@place@handle@{#1}{north west}{1}{-1}{south east}{0.707106781}}%
21 \tikzset{left/.code =\tikz@lib@place@handle@{#1}{east}{-1}{0}{west}{1}}%
22 \tikzset{mid left/.code =\tikz@lib@place@handle@{#1}{mid east}{-1}{0}{mid west}{1}}%
23 \tikzset{mid right/.code=\tikz@lib@place@handle@{#1}{mid west}{1}{0}{mid east}{1}}%
24 \tikzset{right/.code=\tikz@lib@place@handle@{#1}{west}{1}{0}{east}{1}}%
25
26 \newif\iftikz@lib@ignore@size
27
28 % Hook into resets:
29 \pgfutil@g@addto@macro\tikz@node@reset@hook{\tikz@addtransform{\tikz@lib@pos@call}\let\tikz@lib@pos@call=\relax}%
30
31 \tikzset{on grid/.is if=tikz@lib@ignore@size}%
32
33 \tikzset{node distance=1cm and 1cm}%
34
35 \def\tikz@lib@place@handle@#1#2#3#4#5#6{%
36 \def\tikz@anchor{#2}%
37 \let\tikz@do@auto@anchor=\relax%
38 \edef\tikz@temp{#1}%
39 \def\tikz@lib@place@single@factor{#6}%
40 \expandafter\tikz@lib@place@handle@@\expandafter{\tikz@temp}{#3}{#4}{#5}%
41 }%
42 \def\tikz@lib@place@handle@@#1#2#3#4{%
43 \pgfutil@in@{of }{#1}%
44 \ifpgfutil@in@%
45 \tikz@lib@place@of#1\tikz@stop{#4}%
46 \else%
47 \edef\tikz@lib@place@nums{#1}%
48 \fi%
49 \ifx\tikz@lib@place@nums\pgfutil@empty%
50 % Ok, nothing to do, we have set the anchor and we are happy...
51 \else%
52 \expandafter\tikz@lib@place@parse@nums\expandafter{\tikz@lib@place@nums}%
53 \pgf@x=#2\pgf@x%
54 \pgf@y=#3\pgf@y%
55 \edef\tikz@lib@pos@call{\noexpand\pgftransformshift{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}%
56 \fi%
57 }%
58
59 \def\tikz@lib@place@parse@nums#1{%
60 \pgfutil@in@{and}{#1}%
61 \ifpgfutil@in@%
62 \tikz@lib@place@parse@nums@#1\tikz@stop%
63 \else%
64 \tikz@lib@place@parse@nums@#1and#1\tikz@stop%
65 \pgf@x=\tikz@lib@place@single@factor\pgf@x%
66 \pgf@y=\tikz@lib@place@single@factor\pgf@y%
67 \fi
68 }%
69 \def\tikz@lib@place@parse@nums@#1and#2\tikz@stop{%
70 \pgfmathparse{#2}%
71 \ifpgfmathunitsdeclared%
72 \pgf@xa=\pgfmathresult pt%
73 \pgf@ya=0pt%
74 \else%
75 \let\tikz@lib@temp=\pgfmathresult%
76 \pgf@process{\pgfpointxy{\tikz@lib@temp}{0}}%
77 \pgf@xa=\pgf@x%
78 \pgf@ya=\pgf@y%
79 \fi%
80 \pgfmathparse{#1}%
81 \ifpgfmathunitsdeclared%
82 \advance\pgf@ya by\pgfmathresult pt%
83 \else%
84 \let\tikz@lib@temp=\pgfmathresult%
85 \pgf@process{\pgfpointxy{0}{\tikz@lib@temp}}%
86 \advance\pgf@xa by\pgf@x%
87 \advance\pgf@ya by\pgf@y%
88 \fi%
89 \pgf@x=\pgf@xa%
90 \pgf@y=\pgf@ya%
91 }%
92
93 \def\tikz@lib@place@of#1of #2\tikz@stop#3{%
94 \def\tikz@temp{#1}%
95 \ifx\tikz@temp\pgfutil@empty%
96 \tikz@lib@place@of@{\tikz@node@distance}{#2}{#3}%
97 \else%
98 \tikz@lib@place@of@{#1}{#2}{#3}%
99 \fi%
100 }%
101 \def\tikz@lib@place@of@#1#2#3{%
102 \tikz@scan@one@point\tikz@lib@place@remember(#2)%
103 \iftikz@shapeborder%
104 % Ok, this is relative to a border.
105 \iftikz@lib@ignore@size%
106 \edef\tikz@node@at{\noexpand\pgfpointanchor{\tikz@shapeborder@name}{center}}%
107 \def\tikz@anchor{center}%
108 \else%
109 \edef\tikz@node@at{\noexpand\pgfpointanchor{\tikz@shapeborder@name}{#3}}%
110 \fi%
111 \fi%
112 \edef\tikz@lib@place@nums{#1}%
113 }%
114 \def\tikz@lib@place@remember#1{\def\tikz@node@at{#1}}%
115
116
117
118 \endinput