-
Notifications
You must be signed in to change notification settings - Fork 0
/
tikzConfig.tex
83 lines (82 loc) · 2.85 KB
/
tikzConfig.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
\makeatletter
\def\pgfutil@firstofmany#1#2\pgf@stop{#1}
\def\pgfutil@secondofmany#1#2\pgf@stop{#2}
\def\tikz@lib@place@of@#1#2#3{%
\def\pgf@tempa{fit bounding box}%
\edef\pgf@temp{\expandafter\pgfutil@firstofmany#2\pgf@stop}
\if\pgf@temp(%
\tikz@lib@place@fit@scan{#2}{0}%
\else\if\pgf@temp|
\expandafter\tikz@lib@place@fit@scan\expandafter{\pgfutil@secondofmany#2\pgf@stop}{1}%
\else\ifx\pgf@temp\tikz@activebar
\expandafter\tikz@lib@place@fit@scan\expandafter{\pgfutil@secondofmany#2\pgf@stop}{1}%
\else\if\pgf@temp-
\expandafter\tikz@lib@place@fit@scan\expandafter{\pgfutil@secondofmany#2\pgf@stop}{2}%
\else\if\pgf@temp+
\expandafter\tikz@lib@place@fit@scan\expandafter{\pgfutil@secondofmany#2\pgf@stop}{3}%
\else
\def\pgf@tempa{#2}%
\fi
\fi
\fi
\fi
\fi
\expandafter\tikz@scan@one@point\expandafter\tikz@lib@place@remember\expandafter(\pgf@tempa)%
\iftikz@shapeborder%
% Ok, this is relative to a border.
\iftikz@lib@ignore@size%
\edef\tikz@node@at{\noexpand\pgfpointanchor{\tikz@shapeborder@name}{center}}%
\def\tikz@anchor{center}%
\else%
\edef\tikz@node@at{\noexpand\pgfpointanchor{\tikz@shapeborder@name}{#3}}%
\fi%
\fi%
\edef\tikz@lib@place@nums{#1}%
}
\def\tikz@lib@place@fit@scan#1#2{
\pgf@xb=-16000pt\relax%
\pgf@xa=16000pt\relax%
\pgf@yb=-16000pt\relax%
\pgf@ya=16000pt\relax%
\if\pgfutil@firstofmany#1\pgf@stop(%
\tikz@lib@fit@scan#1\pgf@stop%
\else
\tikz@lib@fit@scan(#1)\pgf@stop
\fi
\ifdim\pgf@xa>\pgf@xa
% shouldn't happen
\else
\expandafter\def\csname pgf@sh@ns@fit bounding box\endcsname{rectangle}%
\expandafter\edef\csname pgf@sh@np@fit bounding box\endcsname{%
\def\noexpand\southwest{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}%
\def\noexpand\northeast{\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}%
}%
\expandafter\def\csname pgf@sh@nt@fit bounding box\endcsname{{1}{0}{0}{1}{0pt}{0pt}}%
\expandafter\def\csname pgf@sh@pi@fit bounding box\endcsname{\pgfpictureid}%
\ifcase#2\relax
\or % 1 = vertical
\pgf@y=\pgf@yb%
\advance\pgf@y by-\pgf@ya%
\edef\pgf@marshal{\noexpand\tikzset{minimum height={\the\pgf@y-2*(\noexpand\pgfkeysvalueof{/pgf/outer ysep})}}}%
\pgf@marshal
\or % 2 = horizontal
\pgf@x=\pgf@xb%
\advance\pgf@x by-\pgf@xa%
\edef\pgf@marshal{\noexpand\tikzset{minimum width={\the\pgf@x-2*(\noexpand\pgfkeysvalueof{/pgf/outer xsep})}}}%
\pgf@marshal
\or % 3 = both directions
\pgf@y=\pgf@yb%
\advance\pgf@y by-\pgf@ya%
\pgf@x=\pgf@xb%
\advance\pgf@x by-\pgf@xa%
\edef\pgf@marshal{\noexpand\tikzset{minimum height={\the\pgf@y-2*(\noexpand\pgfkeysvalueof{/pgf/outer ysep})},minimum width={\the\pgf@x-2*(\noexpand\pgfkeysvalueof{/pgf/outer xsep})}}}%
\pgf@marshal
\fi
\fi
}
\tikzset{
fit bounding box/.code={\tikz@lib@place@fit@scan{#1}{0}},
span vertical/.code={\tikz@lib@place@fit@scan{#1}{1}},
span horizontal/.code={\tikz@lib@place@fit@scan{#1}{2}},
span/.code={\tikz@lib@place@fit@scan{#1}{3}}}
\makeatother