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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
|
\usepgfmodule{matrix}
\def\pgfmatrixlabelskeleton{
\let\pgf@matrix@compute@origin\pgf@matrix@skeleton@compute@origin
\let\pgf@matrix@shift@nodes@initial\pgf@matrix@skeleton@shift@nodes@initial
\let\pgf@end@matrix\pgf@end@matrix@skeleton
}
\expandafter\def\expandafter\pgf@end@matrix@skeleton\expandafter{\pgf@end@matrix \pgf@matrix@create@skeleton}%
% Creates the skeleton
% orig contains the upper left corner of the different boxes
\def\pgf@matrix@create@skeleton{%
\xdef\pgf@matrix@skel@innerxsep{\pgfkeysvalueof{/pgf/inner xsep}}%
\xdef\pgf@matrix@skel@innerysep{\pgfkeysvalueof{/pgf/inner ysep}}%
\pgfscope%
\pgfgetlastxy\ck@shift@x\ck@shift@y
\pgftransformshift{\pgfpoint{\ck@shift@x}{\ck@shift@y}}%
\pgfset{inner sep=0pt}%
\pgf@matrix@skeleton@create@cells%
\pgf@matrix@skeleton@create@tiling@cells%
\pgf@matrix@skeleton@create@rows%
\pgf@matrix@skeleton@create@tiling@rows%
\pgf@matrix@skeleton@create@columns%
\pgf@matrix@skeleton@create@tiling@columns%
\endpgfscope%
}
\def\pgf@matrix@skeleton@create@cells{%
\newcount\pgf@matrix@skel@next@row
\foreach \pgf@matrix@skel@row in {1, ..., \pgfmatrixcurrentrow} {%
\pgf@matrix@skel@next@row=\pgf@matrix@skel@row
\advance\pgf@matrix@skel@next@row by 1
\pgfmathsetmacro{\pgf@matrix@skel@origy}{\csname pgf@matrix@origy\pgf@matrix@skel@row\endcsname + \csname pgf@matrix@maxy\pgf@matrix@skel@row\endcsname}%
\pgfmathsetmacro{\pgf@matrix@skel@height}{\csname pgf@matrix@maxy\pgf@matrix@skel@row\endcsname - \csname pgf@matrix@miny\pgf@matrix@skel@row\endcsname - \pgflinewidth}%
\pgfmathsetmacro{\pgf@matrix@skel@height}{\pgf@matrix@skel@height - \csname pgf@matrix@row@sep@\the\pgf@matrix@skel@next@row\endcsname}
\foreach \pgf@matrix@skel@col in {1, ..., \pgf@matrix@numberofcolumns} {%
\pgfmathsetmacro{\pgf@matrix@skel@origx}{\csname pgf@matrix@origx\pgf@matrix@skel@col\endcsname + \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname}%
\pgfmathsetmacro{\pgf@matrix@skel@width}{\csname pgf@matrix@maxx\pgf@matrix@skel@col\endcsname - \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname - \pgflinewidth}%
\ifnum\pgf@matrix@skel@col>1\relax%
\pgfmathsetmacro{\pgf@matrix@skel@origx}{\pgf@matrix@skel@origx + \csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname}%
\pgfmathsetmacro{\pgf@matrix@skel@width}{\pgf@matrix@skel@width - \pgflinewidth - \csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname}%
\fi%
{%
\pgfset{minimum width=\pgf@matrix@skel@width, minimum height=\pgf@matrix@skel@height}%
\pgftransformshift{\pgfpoint{\pgf@matrix@skel@origx pt}{\pgf@matrix@skel@origy pt}}%
\pgfnode{rectangle}{north west}{}{\pgf@matrix@par@name-cell-\pgf@matrix@skel@row-\pgf@matrix@skel@col}{}%
}
}
}
}
\def\pgf@matrix@skeleton@create@tiling@cells{%
\newcount\pgf@matrix@skel@next@col
\newcount\pgf@matrix@skel@next@row
\foreach \pgf@matrix@skel@row in {1, ..., \pgfmatrixcurrentrow} {%
\pgf@matrix@skel@next@row=\pgf@matrix@skel@row
\advance\pgf@matrix@skel@next@row by 1
\pgfmathsetmacro{\pgf@matrix@skel@origy}{\csname pgf@matrix@origy\pgf@matrix@skel@row\endcsname + \csname pgf@matrix@maxy\pgf@matrix@skel@row\endcsname}%
\pgfmathsetmacro{\pgf@matrix@skel@height}{\csname pgf@matrix@maxy\pgf@matrix@skel@row\endcsname - \csname pgf@matrix@miny\pgf@matrix@skel@row\endcsname - \pgflinewidth}%
\ifnum\pgf@matrix@skel@row=1\relax%
\pgfmathsetmacro{\pgf@matrix@skel@origy}{\pgf@matrix@skel@origy + \pgf@matrix@skel@innerysep}%
\pgfmathsetmacro{\pgf@matrix@skel@height}{\pgf@matrix@skel@height + \pgf@matrix@skel@innerysep}%
\fi
\ifnum\pgf@matrix@skel@row=\pgfmatrixcurrentrow\relax%
\pgfmathsetmacro{\pgf@matrix@skel@height}{\pgf@matrix@skel@height + \pgf@matrix@skel@innerysep - \pgfmatrixrowsep}%
\fi
\ifnum\pgf@matrix@skel@row>1\relax%
\pgfmathsetmacro{\pgf@matrix@skel@origy}{\pgf@matrix@skel@origy + 0.5 * \csname pgf@matrix@row@sep@\pgf@matrix@skel@row\endcsname}
\pgfmathsetmacro{\pgf@matrix@skel@height}{\pgf@matrix@skel@height + 0.5 * \csname pgf@matrix@row@sep@\pgf@matrix@skel@row\endcsname}
\fi
\ifnum\pgf@matrix@skel@row<\pgfmatrixcurrentrow\relax%
\pgfmathsetmacro{\pgf@matrix@skel@height}{\pgf@matrix@skel@height - 0.5 * \csname pgf@matrix@row@sep@\the\pgf@matrix@skel@next@row\endcsname}
\fi
\foreach \pgf@matrix@skel@col in {1, ..., \pgf@matrix@numberofcolumns} {%
\pgf@matrix@skel@next@col=\pgf@matrix@skel@col
\advance\pgf@matrix@skel@next@col by 1
\pgfmathsetmacro{\pgf@matrix@skel@origx}{\csname pgf@matrix@origx\pgf@matrix@skel@col\endcsname + \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname}%
\pgfmathsetmacro{\pgf@matrix@skel@width}{\csname pgf@matrix@maxx\pgf@matrix@skel@col\endcsname - \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname- \pgflinewidth}%
\ifnum\pgf@matrix@skel@col=1\relax%
\pgfmathsetmacro{\pgf@matrix@skel@origx}{\pgf@matrix@skel@origx - \pgf@matrix@skel@innerxsep}%
\pgfmathsetmacro{\pgf@matrix@skel@width}{\pgf@matrix@skel@width + \pgf@matrix@skel@innerxsep}%
\fi%
\ifnum\pgf@matrix@skel@col=\pgf@matrix@numberofcolumns\relax%
\pgfmathsetmacro{\pgf@matrix@skel@width}{\pgf@matrix@skel@width + \pgf@matrix@skel@innerxsep}%
\fi%
\ifnum\pgf@matrix@skel@col<\pgf@matrix@numberofcolumns%
\pgfmathsetmacro{\pgf@matrix@skel@width}{\pgf@matrix@skel@width + 0.5 * \csname pgf@matrix@column@sep@\the\pgf@matrix@skel@next@col\endcsname}%
\fi%
\ifnum\pgf@matrix@skel@col>1%
\pgfmathsetmacro{\pgf@matrix@skel@origx}{\pgf@matrix@skel@origx + 0.5 * \csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname}%
\pgfmathsetmacro{\pgf@matrix@skel@width}{\pgf@matrix@skel@width - 0.5 * \csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname}%
\fi%
{%
\pgfset{minimum width=\pgf@matrix@skel@width, minimum height=\pgf@matrix@skel@height}%
\pgftransformshift{\pgfpoint{\pgf@matrix@skel@origx pt}{\pgf@matrix@skel@origy pt}}%
\pgfnode{rectangle}{north west}{}{\pgf@matrix@par@name-tiling-cell-\pgf@matrix@skel@row-\pgf@matrix@skel@col}{}%
}
}
}
}
\def\pgf@matrix@skeleton@create@rows{%
\newcount\pgf@matrix@skel@next@row%
\pgfmathsetmacro{\pgf@matrix@skel@width}{\csname pgf@matrix@origx\the\pgf@matrix@numberofcolumns\endcsname + \csname pgf@matrix@maxx\the\pgf@matrix@numberofcolumns\endcsname - \pgflinewidth}%
\pgfmathsetmacro{\pgf@matrix@skel@origx}{\csname pgf@matrix@origx1\endcsname + \csname pgf@matrix@minx1\endcsname}%
\foreach \pgf@matrix@skel@row in {1, ..., \pgfmatrixcurrentrow} {%
\pgf@matrix@skel@next@row=\pgf@matrix@skel@row\relax%
\advance\pgf@matrix@skel@next@row by1\relax%
\pgfmathsetmacro{\pgf@matrix@skel@origy}{\csname pgf@matrix@origy\pgf@matrix@skel@row\endcsname + \csname pgf@matrix@maxy\pgf@matrix@skel@row\endcsname}%
\pgfmathsetmacro{\pgf@matrix@skel@height}{\csname pgf@matrix@maxy\pgf@matrix@skel@row\endcsname - \csname pgf@matrix@miny\pgf@matrix@skel@row\endcsname - \csname pgf@matrix@row@sep@\the\pgf@matrix@skel@next@row\endcsname - \pgflinewidth}%
{%
\pgfset{minimum width=\pgf@matrix@skel@width, minimum height=\pgf@matrix@skel@height}%
\pgftransformshift{\pgfpoint{\pgf@matrix@skel@origx pt}{\pgf@matrix@skel@origy pt}}%
\pgfnode{rectangle}{north west}{}{\pgf@matrix@par@name-row-\pgf@matrix@skel@row}{}%
}
\ifnum\pgf@matrix@skel@row<\pgfmatrixcurrentrow\relax%
\pgfmathsetmacro{\pgf@matrix@skel@origy}{\csname pgf@matrix@origy\the\pgf@matrix@skel@next@row\endcsname + \csname pgf@matrix@maxy\the\pgf@matrix@skel@next@row\endcsname + \csname pgf@matrix@row@sep@\the\pgf@matrix@skel@next@row\endcsname + 0.5 * \pgflinewidth}%
\pgfmathsetmacro{\pgf@matrix@skel@height}{\csname pgf@matrix@row@sep@\the\pgf@matrix@skel@next@row\endcsname}%
{%
\pgfset{minimum width=\pgf@matrix@skel@width, minimum height=\pgf@matrix@skel@height}%
\pgftransformshift{\pgfpoint{\pgf@matrix@skel@origx pt}{\pgf@matrix@skel@origy pt}}%
\pgfnode{rectangle}{north west}{}{\pgf@matrix@par@name-inter-row-\pgf@matrix@skel@row}{}%
}
\fi%
}
}
\def\pgf@matrix@skeleton@create@tiling@rows{%
\newcount\pgf@matrix@skel@next@row%
\pgfmathsetmacro{\pgf@matrix@skel@width}{\csname pgf@matrix@origx\the\pgf@matrix@numberofcolumns\endcsname + \csname pgf@matrix@maxx\the\pgf@matrix@numberofcolumns\endcsname - \pgflinewidth + 2 * \pgf@matrix@skel@innerxsep}%
\pgfmathsetmacro{\pgf@matrix@skel@origx}{\csname pgf@matrix@origx1\endcsname + \csname pgf@matrix@minx1\endcsname - \pgf@matrix@skel@innerxsep}%
\foreach \pgf@matrix@skel@row in {1, ..., \pgfmatrixcurrentrow} {%
\pgf@matrix@skel@next@row=\pgf@matrix@skel@row\relax%
\advance\pgf@matrix@skel@next@row by1\relax%
\pgfmathsetmacro{\pgf@matrix@skel@origy}{\csname pgf@matrix@origy\pgf@matrix@skel@row\endcsname + \csname pgf@matrix@maxy\pgf@matrix@skel@row\endcsname}%
\pgfmathsetmacro{\pgf@matrix@skel@height}{\csname pgf@matrix@maxy\pgf@matrix@skel@row\endcsname - \csname pgf@matrix@miny\pgf@matrix@skel@row\endcsname - \csname pgf@matrix@row@sep@\the\pgf@matrix@skel@next@row\endcsname - \pgflinewidth}%
\ifnum\pgf@matrix@skel@row=1\relax%
\pgfmathsetmacro{\pgf@matrix@skel@origy}{\pgf@matrix@skel@origy + \pgf@matrix@skel@innerysep}%
\pgfmathsetmacro{\pgf@matrix@skel@height}{\pgf@matrix@skel@height + \pgf@matrix@skel@innerysep}%
\fi
\ifnum\pgf@matrix@skel@row=\pgfmatrixcurrentrow\relax%
\pgfmathsetmacro{\pgf@matrix@skel@height}{\pgf@matrix@skel@height + \pgf@matrix@skel@innerysep}%
\fi
\ifnum\pgf@matrix@skel@row>1\relax%
\pgfmathsetmacro{\pgf@matrix@skel@origy}{\pgf@matrix@skel@origy + 0.5 * \csname pgf@matrix@row@sep@\pgf@matrix@skel@row\endcsname}%
\pgfmathsetmacro{\pgf@matrix@skel@height}{\pgf@matrix@skel@height + 0.5 * \csname pgf@matrix@row@sep@\pgf@matrix@skel@row\endcsname}%
\fi%
\ifnum\pgf@matrix@skel@row<\pgfmatrixcurrentrow\relax%
\pgfmathsetmacro{\pgf@matrix@skel@height}{\pgf@matrix@skel@height + 0.5 * \csname pgf@matrix@row@sep@\the\pgf@matrix@skel@next@row\endcsname}%
\fi%
{%
\pgfset{minimum width=\pgf@matrix@skel@width, minimum height=\pgf@matrix@skel@height}%
\pgftransformshift{\pgfpoint{\pgf@matrix@skel@origx pt}{\pgf@matrix@skel@origy pt}}%
\pgfnode{rectangle}{north west}{}{\pgf@matrix@par@name-tiling-row-\pgf@matrix@skel@row}{}%
}
}
}
\def\pgf@matrix@skeleton@create@columns{%
\newcount\pgf@matrix@skel@prev@col%
\pgfmathsetmacro{\pgf@matrix@skel@height}{\csname pgf@matrix@origy1\endcsname + \csname pgf@matrix@maxy1\endcsname - \csname pgf@matrix@miny\the\pgfmatrixcurrentrow\endcsname - \pgfmatrixrowsep - \pgflinewidth}%
\pgfmathsetmacro{\pgf@matrix@skel@origy}{\csname pgf@matrix@origy1\endcsname + \csname pgf@matrix@maxy1\endcsname}%
\foreach \pgf@matrix@skel@col in {1, ..., \pgf@matrix@numberofcolumns} {%
\ifnum\pgf@matrix@skel@col>1\relax%
\pgfmathsetmacro{\pgf@matrix@skel@origx}{\csname pgf@matrix@origx\pgf@matrix@skel@col\endcsname + \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname + \csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname}%
\pgfmathsetmacro{\pgf@matrix@skel@width}{\csname pgf@matrix@maxx\pgf@matrix@skel@col\endcsname - \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname - \csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname - \pgflinewidth}%
\else%
\pgfmathsetmacro{\pgf@matrix@skel@origx}{\csname pgf@matrix@origx\pgf@matrix@skel@col\endcsname + \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname}%
\pgfmathsetmacro{\pgf@matrix@skel@width}{\csname pgf@matrix@maxx\pgf@matrix@skel@col\endcsname - \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname - \pgflinewidth}%
\fi%
{%
\pgfset{minimum width=\pgf@matrix@skel@width, minimum height=\pgf@matrix@skel@height}%
\pgftransformshift{\pgfpoint{\pgf@matrix@skel@origx pt}{\pgf@matrix@skel@origy pt}}%
\pgfnode{rectangle}{north west}{}{\pgf@matrix@par@name-column-\pgf@matrix@skel@col}{}%
}
\ifnum\pgf@matrix@skel@col>1\relax%
\pgf@matrix@skel@prev@col=\pgf@matrix@skel@col\relax%
\advance\pgf@matrix@skel@prev@col by-1\relax%
\pgfmathsetmacro{\pgf@matrix@skel@origx}{\csname pgf@matrix@origx\the\pgf@matrix@skel@prev@col\endcsname + \csname pgf@matrix@maxx\the\pgf@matrix@skel@prev@col\endcsname - 0.5 * \pgflinewidth}%
\pgfmathsetmacro{\pgf@matrix@skel@width}{\csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname}%
{%
\pgfset{minimum width=\pgf@matrix@skel@width, minimum height=\pgf@matrix@skel@height}%
\pgftransformshift{\pgfpoint{\pgf@matrix@skel@origx pt}{\pgf@matrix@skel@origy pt}}%
\pgfnode{rectangle}{north west}{}{\pgf@matrix@par@name-inter-column-\the\pgf@matrix@skel@prev@col}{}%
}
\fi%
}
}
\def\pgf@matrix@skeleton@create@tiling@columns{%
\newcount\pgf@matrix@skel@next@col%
\pgfmathsetmacro{\pgf@matrix@skel@height}{\csname pgf@matrix@origy1\endcsname + \csname pgf@matrix@maxy1\endcsname - \csname pgf@matrix@miny\the\pgfmatrixcurrentrow\endcsname - \pgfmatrixrowsep - \pgflinewidth + 2 * \pgf@matrix@skel@innerysep}%
\pgfmathsetmacro{\pgf@matrix@skel@origy}{\csname pgf@matrix@origy1\endcsname + \csname pgf@matrix@maxy1\endcsname + \pgf@matrix@skel@innerysep}%
\foreach \pgf@matrix@skel@col in {1, ..., \pgf@matrix@numberofcolumns} {%
\pgf@matrix@skel@next@col=\pgf@matrix@skel@col\relax%
\advance\pgf@matrix@skel@next@col by1\relax%
\ifnum\pgf@matrix@skel@col>1\relax%
\pgfmathsetmacro{\pgf@matrix@skel@origx}{\csname pgf@matrix@origx\pgf@matrix@skel@col\endcsname + \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname + \csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname}%
\pgfmathsetmacro{\pgf@matrix@skel@width}{\csname pgf@matrix@maxx\pgf@matrix@skel@col\endcsname - \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname - \csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname - \pgflinewidth}%
\else%
\pgfmathsetmacro{\pgf@matrix@skel@origx}{\csname pgf@matrix@origx\pgf@matrix@skel@col\endcsname + \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname}%
\pgfmathsetmacro{\pgf@matrix@skel@width}{\csname pgf@matrix@maxx\pgf@matrix@skel@col\endcsname - \csname pgf@matrix@minx\pgf@matrix@skel@col\endcsname - \pgflinewidth}%
\fi%
\ifnum\pgf@matrix@skel@col=1\relax%
\pgfmathsetmacro{\pgf@matrix@skel@origx}{\pgf@matrix@skel@origx - \pgf@matrix@skel@innerxsep}%
\pgfmathsetmacro{\pgf@matrix@skel@width}{\pgf@matrix@skel@width + \pgf@matrix@skel@innerxsep}%
\fi
\ifnum\pgf@matrix@skel@col=\pgf@matrix@numberofcolumns\relax%
\pgfmathsetmacro{\pgf@matrix@skel@width}{\pgf@matrix@skel@width + \pgf@matrix@skel@innerxsep}%
\fi
\ifnum\pgf@matrix@skel@col>1\relax%
\pgfmathsetmacro{\pgf@matrix@skel@origx}{\pgf@matrix@skel@origx - 0.5 * \csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname}%
\pgfmathsetmacro{\pgf@matrix@skel@width}{\pgf@matrix@skel@width + 0.5 * \csname pgf@matrix@column@sep@\pgf@matrix@skel@col\endcsname}%
\fi
\ifnum\pgf@matrix@skel@col<\pgf@matrix@numberofcolumns\relax%
\pgfmathsetmacro{\pgf@matrix@skel@width}{\pgf@matrix@skel@width + 0.5 * \csname pgf@matrix@column@sep@\the\pgf@matrix@skel@next@col\endcsname}%
\fi
{%
\pgfset{minimum width=\pgf@matrix@skel@width, minimum height=\pgf@matrix@skel@height}%
\pgftransformshift{\pgfpoint{\pgf@matrix@skel@origx pt}{\pgf@matrix@skel@origy pt}}%
\pgfnode{rectangle}{north west}{}{\pgf@matrix@par@name-tiling-column-\pgf@matrix@skel@col}{}%
}
}
}
% Compute the real positions of the origins
% We must now compute the real positions of the origins of all the
% small pictures. To this end, we need to compute prefix sums. After
% the procedure is done, the origx and the origy will contain the origin
% positions.
\def\pgf@matrix@skeleton@compute@origin{%
%
% Inverse prefix sum on the vertical positions
%
{%
\ifnum\pgfmatrixcurrentrow>0\relax%
\expandafter\gdef\csname pgf@matrix@origy\the\pgfmatrixcurrentrow\endcsname{0pt}%
\fi%
\c@pgf@counta=\pgfmatrixcurrentrow\relax%
\loop%
\ifnum\c@pgf@counta>1\relax%
\pgf@y=\csname pgf@matrix@origy\the\c@pgf@counta\endcsname\relax%
\advance\pgf@y by\csname pgf@matrix@maxy\the\c@pgf@counta\endcsname\relax
\advance\c@pgf@counta by-1\relax%
\pgf@ya=\csname pgf@matrix@miny\the\c@pgf@counta\endcsname\relax%
\advance\pgf@y by-\pgf@ya\relax%
\expandafter\xdef\csname pgf@matrix@origy\the\c@pgf@counta\endcsname{\the\pgf@y}%
\repeat%
}%
%
% Prefix sum on the horizontal positions
%
{%
\ifnum\pgf@matrix@numberofcolumns>0\relax%
\pgf@x=\csname pgf@matrix@minx1\endcsname\relax%
\pgf@x=-\pgf@x%
\expandafter\xdef\csname pgf@matrix@origx1\endcsname{\the\pgf@x}%
\fi%
\c@pgf@counta=1\relax%
\loop%
\ifnum\c@pgf@counta<\pgf@matrix@numberofcolumns\relax%
\pgf@x=\csname pgf@matrix@origx\the\c@pgf@counta\endcsname\relax%
\advance\pgf@x by\csname pgf@matrix@maxx\the\c@pgf@counta\endcsname\relax%
\advance\c@pgf@counta by1\relax%
\pgf@xa=\csname pgf@matrix@minx\the\c@pgf@counta\endcsname\relax%
\advance\pgf@x by-\pgf@xa\relax%
\expandafter\xdef\csname pgf@matrix@origx\the\c@pgf@counta\endcsname{\the\pgf@x}%
\repeat%
}%
}
% Shift the nodes to their origins
% The following procedure shifts all nodes in
% \pgf@matrix@node@list to their location inside a temporary
% picture. This picture will later be shifted again to its final
% position in the real picture.
\def\pgf@matrix@skeleton@shift@nodes@initial{%
{%
\pgfutil@for\pgf@matrix@node@name:=\pgf@matrix@node@list\do{%
\ifx\pgf@matrix@node@name\pgfutil@empty%
\else%
\expandafter\ifx\csname pgf@matrix@node@visited@\pgf@matrix@node@name\endcsname\relax%
\pgf@shift@node{\pgf@matrix@node@name}{%
\pgf@x=\csname pgf@matrix@origx%
\expandafter\expandafter\expandafter\pgfutil@secondoftwo\csname pgf@matrix@node@location@\pgf@matrix@node@name\endcsname\endcsname%
\pgf@y=\csname pgf@matrix@origy%
\expandafter\expandafter\expandafter\pgfutil@firstoftwo\csname pgf@matrix@node@location@\pgf@matrix@node@name\endcsname\endcsname%
}%
\expandafter\let\csname pgf@matrix@node@visited@\pgf@matrix@node@name\endcsname=\pgfutil@empty%
\fi%
\fi%
}%
}%
}
% End of line
\def\pgfmatrixendrow{%
% if the cell contains nothing, the following \let will be at the
% beginning (macro expansion has stopped here since neither \omit
% nor \span was found)
\let\pgf@matrix@signal@cell@end=\pgf@matrix@signal@cell@end%
&\pgf@matrix@correct@calltrue%
\global\pgf@matrix@fixedfalse%
\pgf@y=0pt%
\pgf@matrix@addtolength\pgf@y{\pgfmatrixrowsep}%
\pgfutil@ifnextchar[{\pgfmatrixendrow@skip}{
{
\advance\pgfmatrixcurrentrow by1\relax % only temporary for the following:
\expandafter\xdef\csname pgf@matrix@row@sep@\the\pgfmatrixcurrentrow\endcsname{\the\pgf@y}%
}
\pgf@matrix@finish@line}%
}
\def\pgfmatrixendrow@skip[#1]{%
\pgf@matrix@addtolength\pgf@y{#1}%
{
\advance\pgfmatrixcurrentrow by1\relax % only temporary for the following:
\expandafter\xdef\csname pgf@matrix@row@sep@\the\pgfmatrixcurrentrow\endcsname{\the\pgf@y}%
}
\pgf@matrix@finish@line%
}
|