Debian Codegraph @

texmf-dist/tex/latex/spectralsequences/sseqkeys.code.tex

raw
1 %%
2 %% Package: spectralsequences v1.3.3 2023-01-28
3 %% Author: Hood Chatham
4 %% Email: [email protected]
5 %% Date: 2023-01-28
6 %% License: Latex Project Public License
7 %%
8 %% File: sseqkeys.code.tex
9 %% Exposes: \sseqset
10 %%
11 %% Sets up the keys for sseqpages. There are a lot of them...
12 %%
13
14
15 % Run \pgfqkeys{directory}{keys} but for a list of directories. Helps to avoid code duplication.
16 \def\sseq@pgfqkeysdirlist#1#2{%
17 \sseq@temptoks{#2}%
18 \sseq@pgfqkeysdirlist@#1,\sseq@nil
19 }
20
21 \def\sseq@pgfqkeysdirlist@#1,{%
22 \sseq@eval{\@nx\pgfqkeys{#1}{\the\sseq@temptoks}}%
23 \@ifnextchar\sseq@nil{\@gobble}{\sseq@pgfqkeysdirlist@}%
24 }
25
26 %%%% Interface macros:
27 % These are the things that are used outside of this section:
28 \let\sseq@pgfkeys@error@save\pgfkeys@error
29 \pgfkeys{/sseqpages/userstyles/.unknown/.code={\sseq@passoptionto{\sseq@sseqsetdirectory}}}
30 \protected\def\sseqset#1{\pgfqkeys{/sseqpages/userstyles}{#1}}
31
32 \def\sseq@sseqsetdirectory{/sseqpages/global/default}
33 \def\sseq@set{\pgfqkeys{/sseqpages}}
34
35 %%%
36 %%% Local Keys
37 %%%
38
39 % This is where and how we are going to store the results of our local options. Note that definitions need to be local to allow recursion.
40 \def\sseq@savedoptioncode{}
41 \def\sseq@d@addto@options{\sseq@d@addto@macro\sseq@savedoptioncode}
42 \def\sseq@e@addto@options{\sseq@e@addto@macro\sseq@savedoptioncode}
43
44 % #1 -- name of key
45 % #2 -- options
46 % This is the main way that we use options. (We also use \pgfqkeys{/sseqpages/global} and some similar things)
47 % Dumps out code that the option indexes into \sseq@savedoptioncode
48 % This is because \pgfkeys has a high performance cost, so instead of using \pgfkeys once per page,
49 % we use this once when putting together the spectral sequence and save the result.
50 \def\sseq@processoptions#1#2{%
51 \def\sseq@savedoptioncode{}%
52 \sseq@protectedeval{\@nx % TODO: get rid of this protectedeval
53 \pgfqkeys{/sseqpages/#1}{#2}
54 }%
55 }
56
57 % First pass versus second pass:
58 % Lots of options mainly do stuff on the drawing run, but still need to warn the sseq setup algorithms that they're around
59 % on the first pass. Some only do things on the first pass or only do things on the second pass.
60 % For example, shifts: shifts apply a coordinate transform on the second pass, but also need to factor into the coordinates of
61 % classes etc which are computed at specification time not at draw time. So xshift=2 increases \sseq@x by 2 on its first pass and
62 % applies a coordinate transform by 2cm on the second pass.
63
64 % normal mode does the firstpass options now and saves the secondpass options in \sseq@savedoptioncode for later use.
65 % firstpass mode does the firstpass options and throws away the secondpass options.
66 % secondpass mode throws away the firstpass options and does the secondpass options NOW
67 % bothpass mode does both firstpass and secondpass options NOW
68 % We spend the vast majority of our time in normal mode.
69
70 \def\sseq@options@use#1{#1}
71 \def\sseq@options@normalmode{\let\sseq@options@firstpass\sseq@options@use\let\sseq@options@secondpass\sseq@d@addto@options}
72 \def\sseq@options@firstpassmode{\let\sseq@options@firstpass\sseq@options@use\let\sseq@options@secondpass\@gobble}
73 \def\sseq@options@secondpassmode{\let\sseq@options@firstpass\@gobble\let\sseq@options@secondpass\sseq@options@use}
74 \def\sseq@options@bothpassmode{\let\sseq@options@firstpass\sseq@options@use\let\sseq@options@secondpass\sseq@options@use}
75 \sseq@options@normalmode
76
77 \pgfqkeys{/handlers}{
78 .sseq @ first pass code/.code={
79 \pgfkeysalso{\pgfkeyscurrentpath/.code={\sseq@options@firstpass{#1}}}
80 },
81 .sseq @ first pass append code/.code={
82 \pgfkeysalso{\pgfkeyscurrentpath/.append code={\sseq@options@firstpass{#1}}}
83 },
84 .sseq @ second pass code/.code={
85 \pgfkeysalso{\pgfkeyscurrentpath/.code={\sseq@options@secondpass{#1}}}
86 },
87 .sseq @ second pass append code/.code={
88 \pgfkeysalso{\pgfkeyscurrentpath/.append code={\sseq@options@secondpass{#1}}}
89 },
90 .sseq @ second pass store in/.code={
91 \pgfkeysalso{\pgfkeyscurrentpath/.code={\sseq@options@secondpass{\def#1{##1}}}}
92 },
93 .sseq @ code/.code 2 args={
94 \pgfkeysalso{\pgfkeyscurrentpath/.code={\sseq@options@firstpass{#1}}}
95 \pgfkeysalso{\pgfkeyscurrentpath/.append code={\sseq@options@secondpass{#1}}}
96 },
97 .sseq @ transform/.code={
98 \sseq@keys@lastpart
99 \edef\sseq@temppath{\pgfkeyscurrentpath/\sseq@temp}
100 \pgfkeysalso{\sseq@temppath/.code/.expanded={\@nx\sseq@checktransform{\sseq@temp}\unexpanded{{##1}}}}
101 \pgfkeysalso{\sseq@temppath/.sseq @ second pass append code/.expanded={\@nx\sseq@pgfkeysdocommand{\sseq@temp}\unexpanded{{##1}}}}%
102 },
103 .sseq @ stdparse do transform/.code={
104 \sseq@keys@lastpart
105 \edef\sseq@temppath{\pgfkeyscurrentpath/\sseq@temp}
106 \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text
107 \pgfkeysalso{\sseq@temppath/.code/.expanded={\@nx\sseq@standardparse\@nx\sseq@options@secondpass{\@nx\sseq@pgfkeysdocommand{\sseq@temp}\unexpanded{{##1}}}}}
108 \else
109 \pgfkeysalso{\sseq@temppath/.code/.expanded={\@nx\sseq@standardparse\@nx\sseq@options@secondpass{\@nx\sseq@pgfkeysdocommand{\sseq@temp}{#1}}}s}
110 \fi
111 },
112 .sseq @ illegal/.code={
113 \sseq@keys@lastpart
114 \edef\sseq@temppath{\pgfkeyscurrentpath/\sseq@temp}
115 \pgfkeysalso{\sseq@temppath/.code/.expanded={\@nx\sseq@error@n{option-illegal}{\sseq@temp}}}
116 },
117 .sseq @ illegal as global/.code={
118 \sseq@keys@lastpart
119 \pgfkeysalso{/sseqpages/global/\sseq@temp/.code/.expanded={\@nx\sseq@error@n{option-illegal-as-global}{\sseq@temp}}}
120 },
121 .sseq @ global only/.code={
122 \sseq@keys@lastpart
123 \pgfkeysalso{/sseqpages/\sseq@temp/.code/.expanded={\@nx\sseq@error@n{option-global-only}{\sseq@temp}}}
124 }
125 }
126
127
128 %%% Some easy internal macros
129
130 % This is for .unknown handlers. Try same key in different directory #1.
131 \def\sseq@passoptionto#1{\sseq@eval{\@nx\pgfqkeys{#1}{\pgfkeyscurrentname={\unexpanded\@xp{\pgfkeyscurrentvalue}}}}}
132
133 % Immediately execute a key that is either a tikz or pgf key.
134 % #1 -- key
135 % #2 -- value
136 \def\sseq@pgfkeysdocommand#1#2{
137 \sseq@tempiffalse
138 \sseq@pgfkeysdocommand@try{/tikz}{#1}{#2}
139 \sseq@pgfkeysdocommand@try{/pgf}{#1}{#2}
140 \ifsseq@tempif\else\sseq@error@internal@nn{do-command-failed}{#1}{#2}\fi
141 }
142
143 % Execute a key if \sseq@tempif is true and it is defined, if so set \sseq@tempif to false.
144 % These are meant to cascade.
145 % #1 -- directory
146 % #2 -- key
147 % #3 -- value
148 \def\sseq@pgfkeysdocommand@try#1#2#3{
149 \ifsseq@tempif\else
150 \pgfkeysifdefined{#1/#2/.@cmd}{
151 \sseq@tempiftrue
152 \def\pgfkeysdefaultpath{#1/}
153 \edef\pgfkeyscurrentkey{#1/#2}
154 \pgfkeysgetvalue{#1/#2/.@cmd}{\pgfkeys@code}%
155 \pgfkeys@code#3\pgfeov
156 }{
157 \pgfkeysifdefined{#1/#2}{
158 \sseq@tempiftrue
159 \pgfkeyssetvalue{#1/#2}{#3}
160 }{}
161 }
162 \fi
163 }
164
165 %%%
166 % Our main unknown option handler
167 % This is copied from the standard tikz .unknown handler, but instead of running the code it stores it in \sseq@savedoptioncode.
168 % When it tries the key in /tikz and in /pgf it also recursively expands \pgfkeysalso's.
169
170 \def\sseq@keys@unknown@error@normal{\sseq@error{unknown-key}} % a hook so we can turn off errors if we like
171 \let\sseq@keys@unknown@error\sseq@keys@unknown@error@normal % This is used in .sseq style
172 \let\sseq@add@tikzkey@to@options\sseq@e@addto@options % another hook for .sseq style
173
174 \def\sseq@keys@unknown{%
175 \let\tikz@key\pgfkeyscurrentname
176 \sseq@keys@try@addtooptions{/sseqpages/userstyles,/tikz,/pgf}{}{%
177 \@xp\pgfutil@in@\@xp!\@xp{\tikz@key}%
178 \ifpgfutil@in@%
179 % this is a color!
180 \sseq@keys@unknown@handlecolor
181 \else%
182 \pgfutil@doifcolorelse{\tikz@key}%
183 {%
184 \sseq@keys@unknown@handlecolor
185 }%
186 {%
187 % Ok, second chance: This might be an arrow specification:
188 \@xp\pgfutil@in@\@xp-\@xp{\tikz@key}%
189 \ifpgfutil@in@%
190 % Ah, an arrow spec!
191 \sseq@add@tikzkey@to@options{\@nx\sseq@options@secondpass{\@nx\tikz@processarrows{\tikz@key}}}%
192 \else%
193 % Ok, third chance: A shape!
194 \@xp\ifx\csname pgf@sh@s@\tikz@key\endcsname\relax%
195 \sseq@keys@unknown@error%
196 \else%
197 \sseq@add@tikzkey@to@options{\@nx\sseq@options@secondpass{\def\@nx\tikz@shape{\tikz@key}}}%
198 \fi%
199 \fi%
200 }%
201 \fi%
202 }%
203 }
204
205
206 \def\sseq@keys@unknown@handlecolor{%
207 \sseq@add@tikzkey@to@options{\@nx\sseq@options@secondpass{\@nx\tikz@addoption{\@nx\tikz@compat@color@set{\tikz@key}}}}%
208 \sseq@add@tikzkey@to@options{\@nx\sseq@options@secondpass{\def\@nx\tikz@textcolor{\tikz@key}}}%
209 }
210
211 %%% \sseq@keys@try@addtooptions
212 % #1 -- a comma separated list of directories
213 % #2 -- success code
214 % #3 -- failure code
215 %
216 % This is for the main .unknown handler and for \sseq@addstylecodetooptions (which pretends to be \pgfkeys executed in a directory with only a .unknown)
217 % Tries to run the current key (\pgfkeyscurrentname=\pgfkeyscurrentvalue) in each of the directories in turn.
218 % If it finds the key in one of the directories, recursively expand the \pgfkeysalso in the code,
219 % add the final result to \sseq@savedoptioncode, and run success code. Otherwise run failure code.
220 %
221 % The goal is to avoid storing any commands that require the use of pgfkeys.
222 % This is only a partial solution, because it misses \tikzset, \pfgqkeys, etc.
223 % \pgfkeysalso is particularly dangerous though because we might not remember what directory it was supposed to happen in.
224 % In order to get the recursive expansion of \pgfkeysalso's we need to modify the pgfkeys algorithm so that it
225 % passes control back to \sseq@keys@addtooptions@checkalso when it's done.
226 % Modifies tikz commands \pgfkeys@case@one and \pgfkeys@case@two@extern from file /pgf/utilities/pgfkeys.code.tex lines 352 and 365
227 \def\sseq@keys@try@addtooptions#1{%
228 \sseq@keys@try@addtooptions@#1,\sseq@nil
229 }
230 \def\sseq@keys@try@addtooptions@#1,{%
231 \bgroup
232 \def\pgfkeysdefaultpath{#1/}%
233 \def\next{\egroup\@ifnextchar\sseq@nil{\@xp\@secondoftwo\@gobble}{\sseq@keys@try@addtooptions@}}%
234 \pgfkeysifdefined{#1/\pgfkeyscurrentname/.@cmd}{%
235 \edef\pgfkeyscurrentkey{#1/\pgfkeyscurrentname}%
236 \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text% Hmm... no value
237 \pgfkeysifdefined{#1/\pgfkeyscurrentname/.@def}%
238 {\pgfkeysgetvalue{#1/\pgfkeyscurrentname/.@def}{\pgfkeyscurrentvalue}}%
239 {}% no default, so leave it
240 \fi%
241 \pgfkeysgetvalue{#1/\pgfkeyscurrentname/.@cmd}{\pgfkeys@code}%
242 \sseq@eval{\@nx\sseq@keys@addtooptions@checkalso{\unexpanded\@xptwo{\@xp\pgfkeys@code\pgfkeyscurrentvalue\pgfeov}}}%
243 \sseq@smuggle@macro\sseq@savedoptioncode
244 \egroup
245 \def\next{\@xp\@firstoftwo\sseq@gobble@to@nil}%
246 }{%
247 \pgfkeysifdefined{#1/\pgfkeyscurrentname}{%
248 \egroup
249 \sseq@add@tikzkey@to@options{\@nx\sseq@options@secondpass{\@nx\pgfkeyssetvalue{#1/\pgfkeyscurrentname}{\unexpanded\@xp{\pgfkeyscurrentvalue}}}}%
250 \def\next{\@xp\@firstoftwo\sseq@gobble@to@nil}%
251 }{}%
252 }%
253 \next
254 }
255
256 % Iterate over list and run \pgfkeysalso's when we find them. Note that we use our variants of \pgfkeys@case@... which hand control back to this command,
257 % so this is recursive -- the result is guaranteed not to have any instance of \pgfkeysalso in it!
258 \def\sseq@keys@addtooptions@checkalso#1{%
259 \let\pgfkeys@case@one\sseq@pgfkeys@case@one@store
260 \let\pgfkeys@case@two@extern\sseq@pgfkeys@case@two@extern@store
261 \sseq@keys@addtooptions@checkalso@#1\pgfkeysalso\sseq@nil
262 }
263
264 \def\sseq@keys@addtooptions@checkalso@#1\pgfkeysalso#2{%
265 \def\sseq@tempa{/tikz/}%
266 \def\sseq@tempb{/pgf/}%
267 % This is an extra hook I needed to add so that my own keys can execute code when they need to...
268 \sseq@keys@addtooptions@checkdo#1\sseq@keys@do\sseq@nil
269 \ifx\sseq@nil#2% We're done, restore pgfkeys.
270 \let\pgfkeys@case@one\sseq@pgfkeys@case@one@save
271 \let\pgfkeys@case@two@extern\sseq@pgfkeys@case@two@extern@save
272 \else
273 \ifx\expandafter#2 % if they wanted to expand the first token, handle that
274 \sseq@add@tikzkey@to@options{\sseq@options@secondpass@iftikz{\relax\relax}}% The last token was an \expandafter, we need to keep it from doing anything
275 \@xptwo\sseq@keys@addtooptions@checkalso@xp
276 \else
277 \pgfkeysalso{#2}%
278 \@xptwo\sseq@keys@addtooptions@checkalso@
279 \fi
280 \fi
281 }
282
283 \def\sseq@keys@addtooptions@checkalso@xp#1{%
284 \@xp\pgfkeysalso\@xp{#1}%
285 \sseq@keys@addtooptions@checkalso@
286 }
287
288 % Used to get collections code to run right.
289 \def\sseq@keys@addtooptions@checkdo#1\sseq@keys@do#2{%
290 \sseq@add@tikzkey@to@options{\sseq@options@secondpass@iftikz{\unexpanded{#1}}}%
291 \ifx#2\sseq@nil\else
292 #2%
293 \@xp\sseq@keys@addtooptions@checkdo
294 \fi
295 }
296
297
298 % This has to be expandable, so \sseq@tempa and \sseq@tempb are set to "/tikz/" and "/pgf/" ahead of time
299 % Defer the command if it is in directories /pgf or /tikz, otherwise run it now. TODO: explain here why we need this.
300 \def\sseq@options@secondpass@iftikz{%
301 \ifx\pgfkeysdefaultpath\sseq@tempa
302 \@nx\sseq@options@secondpass
303 \else
304 \ifx\pgfkeysdefaultpath\sseq@tempb
305 \@nx\sseq@options@secondpass
306 \else
307 \@xptwo\@firstofone
308 \fi
309 \fi
310 }
311
312
313 % Here we hook into pgfkeys. This is remarkably easy!
314 \let\sseq@pgfkeys@case@one@save\pgfkeys@case@one
315 \let\sseq@pgfkeys@case@two@extern@save\pgfkeys@case@two@extern
316 \def\sseq@pgfkeys@case@one@store{%
317 \pgfkeysifdefined{\pgfkeyscurrentkey/.@cmd}%
318 {\pgfkeysgetvalue{\pgfkeyscurrentkey/.@cmd}{\pgfkeys@code}%
319 \ifx\pgfkeys@code\relax\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
320 {\pgfkeys@unknown}%
321 % The following line is the only change, it used to be
322 % \@xp\pgfkeys@code\pgfkeyscurrentvalue\pgfeov which would just run the
323 % code. Instead we recursively expand the \pgfkeysalso's and then store in
324 % it in \sseq@savedoptioncode
325 {\sseq@eval{\@nx\sseq@keys@addtooptions@checkalso{\unexpanded\@xptwo{\@xp\pgfkeys@code\pgfkeyscurrentvalue\pgfeov}}}}}%
326 {\pgfkeys@case@two}%
327 }
328 \def\sseq@pgfkeys@case@two@extern@store{%
329 \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text%
330 \pgfkeysvalueof{\pgfkeyscurrentkey}% this probably isn't a real case
331 \else%
332 % The following line is the only change, it used to be (roughly) \pgfkeyssetvalue{\pgfkeyscurrentkey}{\pgfkeyscurrentvalue}
333 % which would immediately set the value. Instead we store in it \sseq@savedoptioncode
334 \sseq@add@tikzkey@to@options{\@nx\sseq@options@secondpass{\@nx\pgfkeyssetvalue{\pgfkeyscurrentkey}{\unexpanded\@xp{\pgfkeyscurrentvalue}}}}%
335 \fi%
336 }
337
338 \pgfkeys{%
339 /sseqpages/.is family,
340 /sseqpages/.unknown/.code={\sseq@keys@unknown},
341 %
342 /sseqpages/class/.unknown/.code={%
343 \expandafter\ifx\csname pgf@sh@s@\pgfkeyscurrentname\endcsname\relax % is it the name of a shape?
344 \sseq@passoptionto{/sseqpages}%
345 \else
346 \sseq@e@addto@options{\def\@nx\tikz@shape{\pgfkeyscurrentname}}% if so, store it
347 \fi
348 },
349 /sseqpages/.is family,
350 /sseqpages/scope/.is family,
351 /sseqpages/scope/.unknown/.code={\sseq@passoptionto{/sseqpages}},
352 /sseqpages/class/.is family,
353 /sseqpages/class/label/.is family,
354 /sseqpages/class/label/.unknown/.code={\sseq@keys@unknown},
355 /sseqpages/class/label/pin/.unknown/.code={\sseq@keys@unknown},
356 /sseqpages/class/node texts/.is family,
357 /sseqpages/class/node texts/.unknown/.code={\sseq@passoptionto{/tikz}},
358 /sseqpages/differential/.is family,
359 /sseqpages/differential/.unknown/.code={\sseq@passoptionto{/sseqpages}},
360 /sseqpages/struct line/.is family,
361 /sseqpages/struct line/.unknown/.code={\sseq@passoptionto{/sseqpages}},
362 /sseqpages/extension/.is family,
363 /sseqpages/extension/.unknown/.code={\sseq@passoptionto{/sseqpages}},
364 /sseqpages/label/.is family,
365 /sseqpages/label/.unknown/.code={\sseq@keys@unknown},
366 /sseqpages/tikz primitives/.is family,
367 /sseqpages/tikz primitives/.unknown/.code={\sseq@keys@unknown},
368 % One off directories
369 /sseqpages/fit/.is family,
370 /sseqpages/fit/.unknown/.code={\sseq@passoptionto{/sseqpages}},
371 /sseqpages/foreach/.unknown/.code={\sseq@passoptionto{/pgf/foreach}},
372 /sseqpages/class placement/.unknown/.code={\sseq@passoptionto{/tikz}}
373 }
374
375 \pgfqkeys{/sseqpages/class}{shape/.code={\edef\tikz@shape{\pgfkeyscurrentname}}} % shape=whatever shape passing
376
377 \newif\ifsseq@pin
378 \pgfqkeys{/sseqpages/class/label}{% maybe implement multipart node labels this way? No way!
379 node/.sseq @ first pass code={\sseq@classlabelfalse},
380 inside/.sseq @ first pass code={\sseq@classlabelfalse},
381 pin/.sseq @ first pass code = {
382 \let\sseq@savedoptioncode@save\sseq@savedoptioncode
383 \sseq@processoptions{class/label/pin}{#1}
384 \edef\sseq@savedoptioncode{\unexpanded\@xp{\sseq@savedoptioncode@save}\@nx\sseq@d@addto@macro\@nx\sseq@pinoptions{\unexpanded\@xp{\sseq@savedoptioncode}}}
385 },
386 pin/.sseq @ second pass append code = {\sseq@pintrue}
387 }
388 \def\sseq@pinoptions{}
389
390 %% label directions
391 \def\sseq@labeldirectionlist{\\{above}\\{below}\\{left}\\{right}\\{above left}\\{above right}\\{below left}\\{below right}}
392 \def\sseq@setlabeldirectionkeys#1{
393 \@ifnextchar[{\sseq@setlabeldirectionkeys@{#1}}{\sseq@setlabeldirectionkeys@{#1}[/.code]}%]
394 }
395 \def\sseq@setlabeldirectionkeys@#1[#2]#3{
396 \bgroup
397 \def\sseq@temp##1{#3}
398 \sseq@temptoks{}
399 \def\\##1{
400 \sseq@eval{\sseq@temptoks{\the\sseq@temptoks##1#2={\unexpanded\@xp{\sseq@temp{##1}}},}}
401 }
402 \sseq@labeldirectionlist
403 \sseq@eval{\egroup\@nx\pgfqkeys{#1}{\the\sseq@temptoks}}
404 }
405 \begingroup
406 \def\\#1{\@xp\sseq@addtostorelist\csname sseq@default@#1@distance\endcsname{1ex}}
407 \sseq@labeldirectionlist
408 \endgroup
409 \def\sseq@defaultlabeldistance#1{\@xp\csname sseq@default@#1@distance\endcsname}
410 \def\sseq@setdefaultlabeldistance#1#2{\sseq@savedpaths@add{\@xp\gdef\csname sseq@default@#1@distance\endcsname{#2}}}
411 \def\sseq@setdefaultlabeldistances#1{\def\\##1{\sseq@setdefaultlabeldistance{##1}{#1}}\sseq@labeldirectionlist}
412
413
414
415 \sseq@setlabeldirectionkeys{/sseqpages/class/label}[/.sseq @ first pass code]{\sseq@classlabeltrue}
416 \sseq@setlabeldirectionkeys{/sseqpages/class/label}[/.sseq @ second pass append code]{\sseq@class@positionlabel{#1}{##1}}
417 \sseq@setlabeldirectionkeys{/sseqpages/class/label}[/.default]{\sseq@defaultlabeldistance{#1}}
418 \sseq@setlabeldirectionkeys{/sseqpages/global/class/label}[/.default]{\sseq@defaultlabeldistance{#1}}
419
420 \sseq@setlabeldirectionkeys{/sseqpages/global}[ label distance/.code]{\sseq@setdefaultlabeldistance{#1}{##1}}
421 \sseq@setlabeldirectionkeys{/sseqpages}[ label distance/.code]{\sseq@setdefaultlabeldistance{#1}{##1}}
422
423 \sseq@pgfqkeysdirlist{/sseqpages/global,/sseqpages}{
424 label distance/.code={\sseq@setdefaultlabeldistances{#1}}
425 }
426
427 \def\sseq@class@positionlabel#1#2{\ifx\tikz@fig@name\undefined\else\sseq@pgfkeysdocommand{#1}{#2 of \tikz@fig@name}\fi}
428
429
430
431 \sseq@addtostorelist\sseq@classlabel@handler{} % \sseq@classlabel@handler is public via "class label handler"
432 \def\sseq@classlabel@handler@default#1{\def\result{#1}}
433 \sseq@addtostorelist\sseq@classname@handler{} % \sseq@classname@handler is public via "class name handler"
434 \def\sseq@classname@handler@default#1{\def\result{#1}}
435
436 \def\sseq@labeltextfn#1{#1} % labeltextfn is private
437 \def\sseq@labeltextfn@rotatescale#1{%
438 \@nx\ifmmode
439 \@nx\scalebox{\sseq@labletext@scale@factor}{\@nx\rotatebox{\sseq@labletext@rotate@angle}{$#1$}}%
440 \@nx\else
441 \@nx\scalebox{\sseq@labletext@scale@factor}{\@nx\rotatebox{\sseq@labletext@rotate@angle}{#1}}%
442 \@nx\fi
443 }
444 \def\sseq@labletext@rotate@angle{0}
445 \def\sseq@labletext@scale@factor{1}
446
447 \bgroup\lccode`8=`p\lccode`9=`t\lowercase{\egroup
448 \def\sseq@eatpt#189{#1}
449 }
450
451 \sseq@pgfqkeysdirlist{/sseqpages/label,/sseqpages/class/label}{
452 rotate/.code={%
453 \let\sseq@labeltextfn\sseq@labeltextfn@rotatescale
454 \edef\sseq@labletext@rotate@angle{\@xp\sseq@eatpt\the\dimexpr\sseq@labletext@rotate@angle pt+#1pt}%
455 },
456 scale/.code={%
457 \let\sseq@labeltextfn\sseq@labeltextfn@rotatescale
458 \edef\sseq@labletext@scale@factor{\@xp\sseq@eatpt\the\dimexpr\sseq@labletext@scale@factor pt*#1}%
459 },
460 % shift/.sseq @ second pass code={\pgfkeysalso{xshift=\sseq@shift@getx#1}\pgfkeysalso{yshift=\sseq@shift@gety#1}}
461 }
462
463
464 \pgfqkeys{/sseqpages/global}{
465 background color/.initial=white
466 }
467 \pgfqkeys{/sseqpages/label}{
468 description/.code={%
469 \edef\sseq@edgeoptionhook{\@nx\pgfkeys{/tikz/fill=\pgfkeysvalueof{/sseqpages/global/background color}}}%
470 },
471 description/.sseq @ second pass append code={%
472 \pgfkeysalso{/tikz/anchor=center}%
473 }
474 }
475
476 \def\sseq@edgeoptionhook{}% This is just to make description work.
477
478 %% Labels
479 %% The code for this that actually does most of the work is inside of sseqmain.code.tex -- search for "Labels"
480 %% This just handles the interface with the keyvalue system here.
481
482
483 %% Quote handling
484 % \sseq@handlequote will be installed later as the 'first char syntax' for ".
485 % Problem is that 'first char syntax' isn't allowed to care what directory it is in, but we need different handling
486 % for classes versus edges versus scopes. Solution is to use \pgfkeysalso and then define the handler in a key.
487 \def\sseq@protectlabel{\@nx\sseq@protectlabel\@nx}
488 \def\sseq@handlequote#1{\pgfkeysalso{handle quote=#1}}
489 \pgfkeys{%
490 /sseqpages/class/handle quote/.code={%
491 \let\tikz@quotes@as@save\tikz@quotes@as
492 \let\tikz@quotes@as\sseq@handleclassquotes
493 \tikz@quote@parser{#1}%
494 \let\tikz@quotes@as\tikz@quotes@as@save
495 },
496 /sseqpages/handle quote/.code={%
497 \let\tikz@quotes@as\sseq@handleedgequotes
498 \tikz@quote@parser{#1}%
499 \let\tikz@quotes@as\tikz@quotes@as@save
500 }
501 }
502
503 % We just do the parsing in sseqkeys, \sseq@handleclassquotes@inner which does the main work is defined sseqmain.
504 \def\sseq@handlescopequotes#1#2{% We use this via \let\tikz@quotes@as\sseq@handleclassquotes
505 /utils/exec={% so it's called inside \pgfkeysalso{stuff}. Need to surround with /utils/exec={} to get out.
506 \global\let\sseq@classnodetext\pgfutil@empty%
507 \global\let\sseq@classnodetextoptions\pgfutil@empty%
508 \global\let\sseq@classlabelnodes\pgfutil@empty%
509 \sseq@handleclassquotes@inner{#1}{#2}
510 }
511 }
512
513 % We use this via \let\tikz@quotes@as\sseq@handleclassquotes
514 % so it's called inside \pgfkeysalso{stuff}. Need to surround with /utils/exec={} to get out.
515 \def\sseq@handleclassquotes#1#2{/utils/exec={\sseq@d@addto@macro\sseq@processlabels{\sseq@handleclassquotes@inner{#1}{#2}}}}
516
517
518
519 \def\sseq@checktransform@error{\sseq@error@nn{illegal-transform}}
520 \let\sseq@checktransform\sseq@checktransform@error
521
522
523 %% Parsing, background vs foreground, and context
524 \def\sseq@standardparse{%
525 \let\sseq@tikzprimitives@coords@maybeclass\sseq@tikzprimitives@coords@notaclass
526 \let\sseq@checktransform\@gobbletwo
527 \let\sseq@tikz@shifttransform\sseq@okayshifttransform
528 % TODO: This needs fixing:
529 %((((((((((((((((((
530 \def\class##1){\sseq@setthiscall{\string\class##1)}\sseq@error@x{standard-parse}{\string\class}}%
531 \def\replaceclass##1){\sseq@setthiscall{\string\replaceclass##1)}\sseq@error@x{standard-parse}{\string\replaceclass}}%
532 \def\classoptions##1){\sseq@setthiscall{\string\classoptions##1)}\sseq@error@x{standard-parse}{\string\classoptions}}%
533 \def\d##1){\sseq@setthiscall{\string\d##1)}\sseq@error@x{standard-parse}{\string\d}}%
534 \def\doptions##1){\sseq@setthiscall{\string\doptions##1)}\sseq@error@x{standard-parse}{\string\doptions}}%
535 \def\structline##1)##2){\sseq@setthiscall{\string\structline##1)##2)}\sseq@error@x{standard-parse}{\string\structline}}%
536 \def\structlineoptions##1)##2){\sseq@setthiscall{\string\structlineoptions##1)##2)}\sseq@error@x{standard-parse}{\string\structlineoptions}}%
537 }
538
539 % I don't think this is ever actually used...
540 \def\sseq@nodeparse{%
541 \let\sseq@tikzprimitives@coords@maybeclass\sseq@tikzprimitives@coords@maybeclass@save
542 \let\sseq@tikzprimitives@coords@maybeclass
543 \def\sseq@transform{\sseq@error@nn{illegal-transform}} % Disallow most coordinate transforms
544 \let\sseq@shifttransform\sseq@checkshifttransform
545 \let\class\sseq@class
546 \let\replaceclass\sseq@replaceclass
547 \let\structline\sseq@structline
548 }
549
550 \sseq@pgfqkeysdirlist{/sseqpages,/sseqpages/tikz primitives}{%
551 standard parse/.code={
552 \let\sseq@firstpass@shifttransform\@gobbletwo
553 \sseq@d@addto@options{\sseq@standardparse}
554 \pgfkeys{/sseqpages/tikz primitives/shift/.sseq @ second pass code={\tikzset{shift={##1}}}}
555 },
556 node parse/.code={ % This is never used, probably broken, and likely shouldn't exist
557 \let\sseq@firstpass@shifttransform\sseq@firstpass@checkshifttransform
558 \let\sseq@checktransform\sseq@checktransform@error
559 \sseq@d@addto@options{\sseq@nodeparse}
560 },
561 background/.code={\sseq@setsavedpaths{background}\pgfkeysalso{standard parse}},
562 foreground/.code={\ifsseq@keepchanges\sseq@setsavedpaths{standard}\else\sseq@setsavedpaths{temporary}\fi\pgfkeysalso{node parse}}
563 }
564
565 \pgfkeys{
566 /sseqpages/tikz primitives/handle quote/.sseq @ second pass code={\tikzset{#1}},
567 /tikz/handle quote/.code={\sseq@error{tikz-edge-quotes}}
568 }
569
570
571 \sseq@pgfqkeysdirlist{/sseqpages/class,/sseqpages/differential}{
572 standard parse/.sseq @ first pass code={\sseq@error@n{option-tikz-prims-only}{standard parse}},
573 background/.sseq @ first pass code={\sseq@error@n{option-tikz-prims-only}{background}}
574 }
575
576 % Some class options. All of these will make changes local to the current \class command. They are communicated to \class via these commands,
577 % which we initialize here as empty.
578 \def\sseq@class@tag{}
579 \def\sseq@class@tagprefix{}
580 \def\sseq@class@name{}
581 \def\sseq@namehandler{}
582 \def\sseq@currenttag{\sseq@class@tag}% for the user ??
583 \def\sseq@tooltip{}
584 \pgfqkeys{/sseqpages/scope}{
585 tag/.code={\pgfkeys@spdef\sseq@class@tag{#1}},
586 tag prefix/.code={\pgfkeys@spdef\temp{#1}\sseq@e@addto@macro\sseq@class@tagprefix{\unexpanded\@xp{#1}}}
587 }
588
589 \def\sseq@classinsert{}
590 \def\sseq@classnameprefix{}
591 \def\sseq@classnamepostfix{}
592 \pgfqkeys{/sseqpages}{
593 class name prefix/.store in=\sseq@classnameprefix,
594 class name postfix/.store in=\sseq@classnamepostfix
595 }
596
597 \pgfqkeys{/sseqpages/class}{
598 name/.code={%
599 \sseq@protectedeval{\@nx\sseq@classname@handler{\sseq@classnameprefix#1\sseq@classnamepostfix}}%
600 \edef\sseq@class@name{\unexpanded\@xp{\result}}%
601 \pgfkeysalso{/sseqpages/alias/.expand once=\detokenize\@xp{\sseq@class@name}}%
602 },
603 show name/.store in=\sseq@class@showname,
604 page/.code={\sseq@getnumrange@defaultupperboundinfty\sseq@class@page{#1}},% page & gen are only for \classoptions.
605 generation/.code={\sseq@getnumrange@defaultupperboundinfty\sseq@gen{#1}}, % \class tests if \sseq@class@page is set and throw an error if so.
606 tag/.code={\sseq@d@addto@macro\sseq@class@tag{#1}},
607 offset/.store in=\sseq@tempoffset,
608 tooltip/.sseq @ first pass code={\ifx\sseqtooltip\undefined \sseq@error{no-tooltip}\else \def\sseq@tooltip{#1}\fi},
609 insert/.store in=\sseq@classinsert
610 }
611
612 \pgfqkeys{/sseqpages/struct line}{
613 page/.code={\sseq@getnumrange@defaultupperboundinfty\sseq@structline@page{#1}}
614 }
615
616 \def\sseq@fitalso{}
617 \pgfqkeys{/sseqpages/fit}{
618 fit/.sseq @ first pass code={\sseq@d@addto@macro\sseq@fitalso{#1}},
619 page/.code={\sseq@getnumrange@defaultupperboundinfty\sseq@fit@page{#1}}
620 }
621
622 \def\sseq@getnumrange#1#2{%
623 \pgfutil@in@{--}{#2}\ifpgfutil@in@
624 \sseq@getnumrange@range#1#2\sseq@nil
625 \else
626 \sseq@getnumrange@range#1#2--#2\sseq@nil
627 \fi
628 }
629
630 \def\sseq@getnumrange@defaultupperboundinfty#1#2{%
631 \pgfutil@in@{--}{#2}\ifpgfutil@in@
632 \sseq@getnumrange@range#1#2\sseq@nil
633 \else
634 \sseq@getnumrange@range#1#2--\sseq@infinity\sseq@nil
635 \fi
636 }
637
638 \def\sseq@getnumrange@range#1#2--#3\sseq@nil{%
639 \ifx\infty#2
640 \edef#1{\sseq@infinity}%
641 \@xp\edef\csname\sseq@macroname#1max\endcsname{\sseq@infinity}%
642 \else
643 \edef#1{\the\numexpr#2}%
644 \ifx\infty#3
645 \@xp\edef\csname\sseq@macroname#1max\endcsname{\sseq@infinity}%
646 \else
647 \@xp\edef\csname\sseq@macroname#1max\endcsname{\the\numexpr#3}%
648 \fi
649 \fi
650 }
651
652
653
654 %% Needs tikz
655 % Force \class or \d to fall back to using tikz to render their output
656 % Rather than using the faster direct \pgf primitives (largely copied from tikz to maximize compatibility)
657 % Drawing with tikz is slower, but I don't want to reimplement these features
658 \def\sseq@needstikzandpass#1#2{\sseq@needstikzandpass@{#2}#1,\@nila}
659 \def\sseq@needstikzandpass@#1#2,{%
660 \sseq@needstikzandpass@@{#2}#1,\@nilb
661 \@ifnextchar\@nila{\@gobble}{\sseq@needstikzandpass@{#1}}
662 }
663 \def\sseq@needstikzandpass@@#1#2,{%
664 \pgfqkeys{#1}{#2/.code={\sseq@options@firstpass{\sseq@needstikztrue}\sseq@options@secondpass{\sseq@pgfkeysdocommand{#2}{##1}\sseq@needstikztrue}}}%
665 \@ifnextchar\@nilb{\@gobble}{\sseq@needstikzandpass@@{#1}}%
666 }
667
668 \pgfqkeys{/sseqpages}{needs tikz/.code=\sseq@needstikztrue}
669 % All of these things need tikz to draw but otherwise require no special handling.
670 \sseq@needstikzandpass{/sseqpages}{%
671 shade, blend mode, pattern, path picture, path fading, decorate, pin, label % should pin be here?
672 }
673
674 \sseq@needstikzandpass{/sseqpages/differential,/sseqpages/struct line,/sseqpages/extension}{%
675 bend left, bend right, in, out, relative, looseness, in looseness, out looseness,
676 min distance, max distance, out min distance, out max distance, in min distance, in max distance, distance,
677 controls, in control, out control,
678 loop, loop above, loop below, loop left, loop right % maybe delete the loops and replace them with errors? It's pretty pointless to use these.
679 }
680
681 % circle split/.code=\sseq@needstikzandpass,
682 % circle solidus/.code=\sseq@needstikzandpass,
683 % ellipse split/.code=\sseq@needstikzandpass,
684 % rectangle split/.code=\sseq@needstikzandpass,
685 % align/.code=\sseq@needstikzandpass,
686
687 \sseq@addtostorelist\sseq@runoffarrow@start@differential@spec{}
688 \sseq@addtostorelist\sseq@runoffarrow@end@differential@spec{>}
689 \sseq@addtostorelist\sseq@runoffarrow@start@structline@spec{...}
690 \sseq@addtostorelist\sseq@runoffarrow@end@structline@spec{...}
691 \sseq@pgfqkeysdirlist{/sseqpages/global,/sseqpages}{
692 run off differentials/.code args={#1-#2}{\def\sseq@runoffarrow@start@differential@spec{#1}\def\sseq@runoffarrow@end@differential@spec{#2}},
693 run off struct lines/.code args={#1-#2}{\def\sseq@runoffarrow@start@structline@spec{#1}\def\sseq@runoffarrow@end@structline@spec{#2}},
694 run off extensions/.code args={#1-#2}{\def\sseq@runoffarrow@start@extension@spec{#1}\def\sseq@runoffarrow@end@extension@spec{#2}},
695 run off/.forward to=/sseqpages/run off differentials,
696 run off/.forward to=/sseqpages/run off struct lines,
697 run off/.forward to=/sseqpages/run off extensions,
698 }
699
700
701 \sseq@pgfqkeysdirlist{/sseqpages/edge, /sseqpages/differential, /sseqpages/struct line, /sseqpages/extension}{
702 source anchor/.sseq @ second pass store in=\sseq@edgesourceanchor,
703 target anchor/.sseq @ second pass store in=\sseq@edgetargetanchor,
704 shorten >/.sseq @ second pass code={\sseq@pgfkeysdocommand{shorten >}{#1}},
705 shorten </.sseq @ second pass code={\sseq@pgfkeysdocommand{shorten <}{#1}},
706 }
707 \pgfqkeys{/sseqpages/differential}{
708 /sseqpages/differential/invisible/.sseq @ first pass code={\sseq@drawdifferentialfalse}
709 }
710 \newif\ifsseq@drawdifferential
711 \sseq@drawdifferentialtrue
712
713 %%%
714 %%% Global Keys
715 %%%
716
717 %%% Style options
718
719 %% Add key code to \sseq@savedoptioncode
720 % #1 -- a list of directories to search
721 % #2 -- keys
722 %
723 % This is pretty similar in basic concept to \sseq@processoptions, but instead of using the .unknown handlers to walk up the directory,
724 % it just tries the key in each directory in the list. I'm not actually sure anymore why it was important to do it this way, but there probably was a good reason...
725 %
726 % This is a faster and sloppier way of doing:
727 % \def\sseq@temp{#1}
728 % \pgfqkeys{/sseqpages/alwaysunknown}{#2}
729 % and defining an event handler: alwaysunknown/.unknown/.code={\@xp\sseq@keys@try@addtooptions\@xp{\sseq@temp}{}{\sseq@keys@unknown}
730 % That basically takes advantage of the pgfkeys parser but gives me back control over what to do with the parsed things.
731 %
732 % For some reason I made the probably misguided decision that that approach was too slow, even though this isn't performance
733 % critical code. Maybe I had a better reason for doing this that I can't remember. Instead I copied pgfkeys but deleted all the
734 % parts that are useless in this context, which is most of it. Occasionally bugs crop up here when it turns out I deleted a little too much.
735 %
736 % This uses a hook \sseq@addstylecodetooptions@unknown to allow the sseqs style to sift out the nonglobal keys and handle them differently.
737 %
738 % Copied with modification from /pgf/utilities/pfgkeys.code.tex
739
740 \def\sseq@addstylecodetooptions#1#2{%
741 \def\sseq@directorylist{#1}%
742 \sseq@simple@pgfkeys@parse#2,\pgfkeys@mainstop
743 }
744
745 \def\sseq@simple@pgfkeys@parse{\futurelet\pgfkeys@possiblerelax\sseq@simple@pgfkeys@parse@main}
746 \def\sseq@simple@pgfkeys@parse@main{%
747 \ifx\pgfkeys@possiblerelax\pgfkeys@mainstop%
748 \@xp\@gobble
749 \else%
750 \@xp\sseq@simple@pgfkeys@@normal
751 \fi%
752 }
753
754 \def\sseq@simple@pgfkeys@@normal#1,{%
755 \sseq@simple@pgfkeys@unpack#1=\pgfkeysnovalue=\pgfkeys@stop
756 \sseq@simple@pgfkeys@parse
757 }
758
759 \def\sseq@simple@pgfkeys@unpack#1=#2=#3\pgfkeys@stop{%
760 \pgfkeys@spdef\pgfkeyscurrentkey{#1}%
761 \pgfkeys@spdef\pgfkeyscurrentvalue{#2}%
762 \ifx\pgfkeyscurrentkey\pgfkeys@empty\else
763 \def\next{\@xp\sseq@keys@try@addtooptions\@xp{\sseq@directorylist}{}{\sseq@addstylecodetooptions@unknown}}%
764 % We deleted the general "first char syntax" handler, so we need to do our own check for the quote.
765 \sseq@simple@pgfkeys@checkquote#1\sseq@nil{%
766 \def\pgfkeyscurrentname{handle quote}%
767 \def\pgfkeyscurrentvalue{#1}%
768 }{%
769 \edef\pgfkeyscurrentkey{\pgfkeyscurrentkey}%
770 \ifx\pgfkeyscurrentkey\pgfkeys@empty
771 \let\next\relax
772 \else%
773 \let\pgfkeyscurrentname\pgfkeyscurrentkey
774 \fi
775 }%
776 \@xp\next
777 \fi
778 }
779 % This is a hook for the "sseqs" style.
780 \let\sseq@addstylecodetooptions@unknown\sseq@keys@unknown
781
782 \long\def\sseq@simple@pgfkeys@checkquote#1#2\sseq@nil{%
783 \ifx#1"%
784 \@xp\@firstoftwo
785 \else
786 \@xp\@secondoftwo
787 \fi
788 }
789
790
791 \def\sseq@stylelist{}
792 \def\sseq@clearchangestyles{}
793
794 % The basic idea here is we make a tokens list \sseq@structlinestyle and define a key "struct lines" that takes a list of keys
795 % and adds the keys to \sseq@structlinestyle. In order to do this, I need some special trick to delete spaces.
796 % The macro \sseq@setmacronospaces defined in spectralsequences.sty accomplishes this.
797
798 \def\sseq@newstyles#1#2{\def\sseq@temppath{#1}\sseq@newstyles@#2,\sseq@nil}
799 \def\sseq@newstyles@#1,{\sseq@newsseqstyle{\sseq@trimleadingspaces#1}\@ifnextchar\sseq@nil{\@gobble}{\sseq@newstyles@}}
800
801 \def\sseq@set@newstyle#1{\pgfqkeys{/sseqpages}{#1}\pgfqkeys{/sseqpages/global}{#1}\pgfqkeys{/sseqpages/global/default}{#1}}
802
803 % Here are two useful wrappers around addstylecodetotoks.
804
805 % #1 -- token list
806 % #2 -- path
807 % #3 -- code
808 \def\sseq@addstylecodetotoks#1#2#3{%
809 \let\sseq@savedoptioncode@store\sseq@savedoptioncode
810 \edef\sseq@savedoptioncode{\the#1}%
811 \sseq@addstylecodetooptions{#2}{#3}%
812 #1\@xp{\sseq@savedoptioncode}%
813 \let\sseq@savedoptioncode\sseq@savedoptioncode@store
814 }
815
816 % #1 -- macro
817 % #2 -- path
818 % #3 -- code
819 \def\sseq@addstylecodetomacro#1#2#3{%
820 \let\sseq@savedoptioncode@store\sseq@savedoptioncode
821 \let\sseq@savedoptioncode#1%
822 \sseq@addstylecodetooptions{#2}{#3}%
823 \let#1\sseq@savedoptioncode
824 \let\sseq@savedoptioncode\sseq@savedoptioncode@store
825 }
826
827 \def\sseq@newsseqstyle#1{%
828 \sseq@setmacronospaces\sseq@tempcmd{sseq@#1style}%
829 \edef\sseq@tempcmdb{\csname\@xp\sseq@macroname\sseq@tempcmd @page\endcsname}%
830 \sseq@setmacronospaces\sseq@tempcmdc{sseq@the#1style}%
831 \@xp\edef\sseq@tempcmdc{\@nx\the\@xp\@nx\sseq@tempcmd\@nx\the\sseq@tempcmdb}%
832 \@xp\newtoks\sseq@tempcmd
833 \@xp\newtoks\sseq@tempcmdb
834 \sseq@x@addto@macro\sseq@stylelist{\sseq@tempcmd{\@nx\the\sseq@tempcmd}}%
835 \sseq@x@addto@macro\sseq@clearchangestyles{\sseq@tempcmdb{}}%
836 \sseq@set@newstyle{%
837 #1s/.ecode={%
838 \@nx\sseq@addstylecodetotoks{\sseq@tempcmd}{\sseq@temppath}{##1}
839 \@nx\ifsseq@inprogress
840 \@nx\sseq@savedpaths@xadd{\@nx\sseq@style@object{\sseq@tempcmd{\@nx\the\sseq@tempcmd}}}%
841 \@nx\fi
842 },%
843 change #1s/.ecode={%
844 \@nx\ifsseq@ispageenv\@nx\else\@nx\sseq@error@nn{change-style-data}{#1}{##1}\@nx\fi
845 \@nx\ifsseq@hasname\@nx\else\@nx\sseq@error@nn{change-style-standalone}{#1}{##1}\@nx\fi
846 \@nx\sseq@addstylecodetotoks{\sseq@tempcmdb}{\sseq@temppath}{##1}
847 }
848 }%
849 }
850
851
852 \newtoks\sseq@sseqstyle
853 \newtoks\sseq@sseqstyle@page
854 \def\sseq@thesseqstyle{\the\sseq@sseqstyle\the\sseq@sseqstyle@page}
855
856 % sseqs has to be handled separately, because it must decide whether an option is a global option or not
857 % and handle them at different times. This makes the code a little trickier.
858 \def\sseq@sseqstyle@globalpart{}
859 \sseq@g@addto@macro\sseq@stylelist{\sseq@sseqstyle{\the\sseq@sseqstyle}}%
860 \sseq@g@addto@macro\sseq@clearchangestyles{\sseq@sseqstyle@page{}}%
861 \sseq@set@newstyle{
862 sseqs/.code={%
863 % This will get called on each key that isn't a defined global option. Then we add it to \sseq@sseqstyle to be applied
864 % locally to absolutely everything.
865 \def\sseq@addstylecodetooptions@unknown{%
866 \let\sseq@sseqstyle@globalpart\sseq@savedoptioncode
867 \edef\sseq@savedoptioncode{\the\sseq@sseqstyle}%
868 \sseq@keys@unknown
869 \sseq@sseqstyle\@xp{\sseq@savedoptioncode}%
870 \let\sseq@savedoptioncode\sseq@sseqstyle@globalpart
871 }%
872 \sseq@addstylecodetomacro\sseq@sseqstyle@globalpart{/sseqpages/global}{#1}%
873 \ifsseq@inprogress
874 \sseq@savedpaths@xadd{\@nx\sseq@style@object{\sseq@sseqstyle{\the\sseq@sseqstyle}}}%
875 \fi
876 % Restore hook
877 \let\sseq@addstylecodetooptions@unknown\sseq@keys@unknown
878 },%
879 % It's not clear to me that "change sseqs" should even exist as an option.
880 change sseqs/.code={%
881 \ifsseq@ispageenv\else\sseq@error@nn{change-style-data}{sseq}{#1}\fi
882 \ifsseq@hasname\else\sseq@error@nn{change-style-standalone}{sseq}{#1}\fi
883 \sseq@addstylecodetotoks{\sseq@sseqstyle@page}{\sseq@temppath}{#1}%
884 }
885 }
886
887
888 % sseq needs special handling, so is done by hand above.
889 %\sseq@newstyles{/sseqpages/}{sseq}% DON'T make this /global/default! Bad things will happen.
890 \sseq@newstyles{/sseqpages/label,/sseqpages/edge,/sseqpages}{edge, label, edge label, differential label, struct line label, extension label}
891 \sseq@newstyles{/sseqpages/class,/sseqpages}{class, permanent cycle, transient cycle, this page cycle}
892 \sseq@newstyles{/sseqpages/differential,/sseqpages/edge,/sseqpages}{differential}
893 \sseq@newstyles{/sseqpages/struct line,/sseqpages/edge,/sseqpages}{struct line, this page struct line}
894 \sseq@newstyles{/sseqpages/extension,/sseqpages/edge,/sseqpages}{extension}
895 \sseq@newstyles{/sseqpages/class/label}{class label, inner class label, outer class label}
896 \sseq@newstyles{/sseqpages/class/label/pin}{pin}
897 \sseq@newstyles{/sseqpages/tikz primitives}{tikz primitive}
898 \sseq@newstyles{/sseqpages/fit}{circle class}
899
900
901 \sseq@set@newstyle{sseq/.style={sseqs={#1}},change sseq/.style={change sseqs={#1}},
902 classes/.style={classs={#1}},change classes/.style={change classs={#1}},
903 circle classes/.style={circle classs={#1}},change circle classes/.style={change circle classs={#1}},
904 }% "class" has a nonstandard plural
905 \sseq@set@newstyle{
906 cycles/.code={\pgfkeysalso{classes={#1}}},
907 permanent classes/.code={\pgfkeysalso{permanent cycles={#1}}},
908 transient classes/.code={\pgfkeysalso{transient cycles={#1}}},
909 this page classes/.code={\pgfkeysalso{this page cycles={#1}}},
910 }%
911
912 \def\sseq@newplotstyle#1{
913 \sseq@setmacronospaces\sseq@tempcmd{sseq@#1style}
914 \sseq@setmacronospaces\sseq@tempcmdb{sseq@#1style@default}
915 \sseq@eval{\@nx\sseq@addtostorelist\@xp\@nx\sseq@tempcmd{\@xp\@nx\sseq@tempcmdb}}
916 \@xp\def\sseq@tempcmdb{}
917 \pgfqkeys{/sseqpages/global}{%
918 #1 style/.ecode={
919 \@nx\sseq@addstylecodetomacro{\@xp\@nx\sseq@tempcmd}{/tikz}{##1}
920 }
921 }
922 % Only difference here is \sseq@tempcmdb -- which puts it in the default code -- instead of \sseq@tempcmd
923 \pgfqkeys{/sseqpages/global/default}{%
924 #1 style/.ecode={
925 \@nx\sseq@addstylecodetomacro{\@xp\@nx\sseq@tempcmdb}{/tikz}{##1}
926 }
927 }
928 }
929
930
931 \def\sseq@newplotstyles#1{\def\sseq@temppath{#1}\sseq@newplotstyles@#1,\sseq@nil}
932 \def\sseq@newplotstyles@#1,{\sseq@newplotstyle{\sseq@trimleadingspaces#1}\@ifnextchar\sseq@nil{\@gobble}{\sseq@newplotstyles@}}
933 \sseq@newplotstyles{x tick, y tick}
934
935
936 %%
937 %%
938 %% Families (also called collections in code)
939 %%
940 %% These are supposed to make it easy to display / hide and change appearance of logically connected families of classes.
941 %% In order to allow a set of options to be given that applies uniformly to all features, we separately apply the options in each of these bins.
942 %%
943
944
945 \def\sseq@featurelist{\\{class}\\{differential}\\{structline}\\{extension}\\{circleclass}\\{tikzprimitive}}
946 \def\sseq@mapfeaturelist#1{\def\\##1{#1}\sseq@featurelist}
947
948 \def\sseq@familylist{}
949 \def\sseq@collections@featuretype{}
950 \def\sseqnewfamily#1{%
951 % Make five bins associated to the new family, one for each feature type. Add them to storelist with empty defaults.
952 \sseq@mapfeaturelist{
953 \@xp\sseq@setmacronospaces\csname sseq@tempcmd@##1\endcsname{sseq@user@#1@##1@style}
954 \@xp\sseq@setmacronospaces\csname sseq@tempcmd@##1@default\endcsname{sseq@user@#1@##1@style@default}
955 \sseq@eval{\@nx\sseq@addtostorelist\@xptwo\@nx\csname sseq@tempcmd@##1\endcsname{\@xptwo\@nx\csname sseq@tempcmd@##1@default\endcsname}}
956 \@xptwo\def\csname sseq@user@#1@##1@style@default\endcsname{}
957 }
958 % This is for deciding what set of options to apply to a feature
959 \@xp\sseq@setnospaces\csname sseq@tempcmd\endcsname{sseq@user@#1}
960 %
961 % A flag to decide whether to draw the family. Set/unset using "draw family" and "no family".
962 \@xp\sseq@addtostorelist\csname sseq@#1@maybedraw\endcsname{}
963 \makeatletter % the tikz people added an extra \scantokens into ecode...
964 \pgfqkeys{/sseqpages/global}{%
965 #1 style/.ecode={%
966 \@nx\sseq@addstylecodetomacro\@xp\@nx\sseq@tempcmd@class{/sseqpages/class,/sseqpages/collections/class}{##1}%
967 \@nx\sseq@addstylecodetomacro\@xp\@nx\sseq@tempcmd@differential{/sseqpages/differential,/sseqpages/collections/differential}{##1}%
968 \@nx\sseq@addstylecodetomacro\@xp\@nx\sseq@tempcmd@structline{/sseqpages/struct line,/sseqpages/collections/struct line}{##1}%
969 \@nx\sseq@addstylecodetomacro\@xp\@nx\sseq@tempcmd@extension{/sseqpages/extension,/sseqpages/collections/extension}{##1}%
970 \@nx\sseq@addstylecodetomacro\@xp\@nx\sseq@tempcmd@circleclass{/sseqpages/fit,/sseqpages/collections/fit}{##1}%
971 \@nx\sseq@addstylecodetomacro\@xp\@nx\sseq@tempcmd@tikzprimitive{/sseqpages/tikz primitives,/sseqpages/collections/tikz primitives}{##1}%
972 },
973 draw #1/.ecode = {\def\@xp\@nx\csname sseq@#1@maybedraw\endcsname{\@nx\sseq@drawtrue}},
974 no #1/.ecode = {\def\@xp\@nx\csname sseq@#1@maybedraw\endcsname{\@nx\sseq@drawfalse}}
975 }%
976 \pgfqkeys{/sseqpages/global/default}{%
977 #1 style/.ecode={%
978 \@nx\sseq@addstylecodetomacro\@xp\@nx\sseq@tempcmd@class@default{/sseqpages/class}{##1}%
979 \@nx\sseq@addstylecodetomacro\@xp\@nx\sseq@tempcmd@differential@default{/sseqpages/differential}{##1}%
980 \@nx\sseq@addstylecodetomacro\@xp\@nx\sseq@tempcmd@structline@default{/sseqpages/struct line}{##1}%
981 \@nx\sseq@addstylecodetomacro\@xp\@nx\sseq@tempcmd@structline@default{/sseqpages/extension}{##1}%
982 \@nx\sseq@addstylecodetomacro\@xp\@nx\sseq@tempcmd@circleclass@default{/sseqpages/fit}{##1}%
983 \@nx\sseq@addstylecodetomacro\@xp\@nx\sseq@tempcmd@tikzprimitive@default{/sseqpages/tikz primitives}{##1}%
984 },
985 draw #1/.ecode = {\def\@xp\@nx\csname sseq@#1@maybedraw@default\endcsname{\@nx\sseq@drawtrue}},
986 no #1/.ecode = {\def\@xp\@nx\csname sseq@#1@maybedraw@default\endcsname{\@nx\sseq@drawfalse}}
987 }%
988 %
989 \pgfqkeys{/sseqpages}{
990 #1/.ecode={
991 \@nx\sseq@d@addto@macro\@nx\sseq@familylist{\@nx\csname sseq@#1@maybedraw\endcsname}
992 \@nx\sseq@options@secondpass{
993 \unexpanded\@xp{\@xp\csname\sseq@tempcmd @\sseq@collections@featuretype @style\endcsname}
994 }
995 }
996 }
997 }
998
999
1000
1001
1002 \def\sseq@collections@classlabels@hook{}
1003 \def\sseq@collections@innerclasslabels@hook{}
1004 \def\sseq@collections@outerclasslabels@hook{}
1005 \def\sseq@collections@pins@hook{}
1006
1007 \def\sseq@collections@labels@hook{}
1008 \def\sseq@collections@edgelabels@hook{}
1009 \def\sseq@collections@differentiallabels@hook{}
1010 \def\sseq@collections@structlinelabels@hook{}
1011
1012 \def\sseq@collections@setempty#1{\sseq@collections@setempty@#1,\sseq@nil}
1013 \def\sseq@collections@setempty@#1,{
1014 \pgfqkeys{/sseqpages/collections}{
1015 class/#1/.code={},
1016 differential/#1/.code={},
1017 struct line/#1/.code={},
1018 extension/#1/.code={},
1019 fit/#1/.code={},
1020 tikz primitives/#1/.code={}
1021 }
1022 \@ifnextchar\sseq@nil{\@gobble}{\sseq@collections@setempty@}
1023 }
1024
1025 \sseq@collections@setempty{%
1026 classes, cycles, permanent classes, permanent cycles, transient classes, transient cycles, this page classes, this page cycles,
1027 edges, differentials, extensions, struct lines, this page struct lines, circleclasses, tikz primitives,
1028 labels, edge labels, differential labels, struct line labels, extension labels,
1029 class labels, inner class labels, outer class labels,pins
1030 }
1031
1032 % #1 -- path
1033 % #2 -- hook name
1034 % #3 -- code
1035 \def\sseq@collections@addtohook#1#2#3{
1036 \sseq@keys@do{
1037 \let\sseq@savedoptioncode@store\sseq@savedoptioncode\let\sseq@savedoptioncode\empty
1038 \pgfqkeys{#1}{#3}
1039 \edef\sseq@savedoptioncode{\unexpanded\@xp{\sseq@savedoptioncode@store}\def\@nx#2{\unexpanded\@xp{\sseq@savedoptioncode}}}
1040 }
1041 }
1042
1043 \pgfqkeys{/sseqpages/collections}{
1044 class/classes/.style={/sseqpages/class/.cd,#1},
1045 class/cycles/.style={/sseqpages/class/.cd,#1},
1046 class/permanent classes/.code={\ifsseq@permanentcycle\pgfkeysalso{/sseqpages/class/.cd,#1}\fi},
1047 class/permanent cycles/.code={\ifsseq@permanentcycle\pgfkeysalso{/sseqpages/class/.cd,#1}\fi},
1048 class/transient classes/.code={\ifsseq@permanentcycle\else\pgfkeysalso{/sseqpages/class/.cd,#1}\fi},
1049 class/transient cycles/.code={\ifsseq@permanentcycle\else\pgfkeysalso{/sseqpages/class/.cd,#1}\fi},
1050 class/this page classes/.code={\ifsseq@thispage\pgfkeysalso{/sseqpages/class/.cd,#1}\fi},
1051 class/this page cycles/.code={\ifsseq@thispage\pgfkeysalso{/sseqpages/class/.cd,#1}\fi},
1052 differential/edges/.style={/sseqpages/differential/.cd,#1},
1053 differential/differentials/.style={/sseqpages/differential/.cd,#1},
1054 struct line/edges/.style={/sseqpages/struct line/.cd,#1},
1055 struct line/struct lines/.style={/sseqpages/struct line/.cd,#1},
1056 struct line/this page struct lines/.code={\ifsseq@thispage\pgfkeysalso{/sseqpages/struct line/.cd,#1}\fi},
1057 extension/edges/.style={/sseqpages/extension/.cd,#1},
1058 extension/extensions/.style={/sseqpages/extension/.cd,#1},
1059 fit/circleclasses/.style={/sseqpages/fit/.cd,#1},
1060 tikz primitives/tikz primitives/.style={/sseqpages/tikz primitives/.cd,#1},
1061 % labels
1062 class/class labels/.code/.expanded={\unexpanded\@xp{\sseq@collections@addtohook{/sseqpages/class/label}{\sseq@collections@classlabels@hook}{#1}}},
1063 class/inner class labels/.code/.expanded={\unexpanded\@xp{\sseq@collections@addtohook{/sseqpages/class/label}{\sseq@collections@innerclasslabels@hook}{#1}}},
1064 class/outer class labels/.code/.expanded={\unexpanded\@xp{\sseq@collections@addtohook{/sseqpages/class/label}{\sseq@collections@outerclasslabels@hook}{#1}}},
1065 class/pins/.code/.expanded={\unexpanded\@xp{\sseq@collections@addtohook{/sseqpages/class/label/pin}{\sseq@collections@pins@hook}{#1}}},
1066 %
1067 class/labels/.code/.expanded={\unexpanded\@xp{\sseq@collections@addtohook{/sseqpages/label}{\sseq@collections@labels@hook}{#1}}},
1068 differential/labels/.code/.expanded={\unexpanded\@xp{\sseq@collections@addtohook{/sseqpages/label}{\sseq@collections@labels@hook}{#1}}},
1069 struct line/labels/.code/.expanded={\unexpanded\@xp{\sseq@collections@addtohook{/sseqpages/label}{\sseq@collections@labels@hook}{#1}}},
1070 %
1071 differential/edge labels/.code/.expanded=
1072 {\unexpanded\@xp{\sseq@collections@addtohook{/sseqpages/label}{\sseq@collections@edgelabels@hook}{#1}}},
1073 struct line/edge labels/.code/.expanded=
1074 {\unexpanded\@xp{\sseq@collections@addtohook{/sseqpages/label}{\sseq@collections@edgelabels@hook}{#1}}},
1075 extension/edge labels/.code/.expanded=
1076 {\unexpanded\@xp{\sseq@collections@addtohook{/sseqpages/label}{\sseq@collections@edgelabels@hook}{#1}}},
1077 differential/differential labels/.code/.expanded=
1078 {\unexpanded\@xp{\sseq@collections@addtohook{/sseqpages/label}{\sseq@collections@differentiallabels@hook}{#1}}},
1079 struct line/struct line labels/.code/.expanded=
1080 {\unexpanded\@xp{\sseq@collections@addtohook{/sseqpages/label}{\sseq@collections@structlinelabels@hook}{#1}}},
1081 extension/extension labels/.code/.expanded=
1082 {\unexpanded\@xp{\sseq@collections@addtohook{/sseqpages/label}{\sseq@collections@extensionlabels@hook}{#1}}},
1083 }
1084
1085
1086
1087
1088 %%% Global keys handlers and infrastructure
1089
1090 \def\sseq@keys@lastpart{%
1091 \edef\pgfkeyscurrentkey{\pgfkeyscurrentpath}%
1092 \pgfkeys@split@path
1093 \edef\sseq@temp{\pgfkeyscurrentname}%
1094 \edef\sseq@temp@ii{\pgfkeyscurrentkey}%
1095 }
1096
1097 \def\sseq@sanitize@intexpr#1#2{
1098 \sseq@ifintexpr{#1}{
1099 \edef\sseq@sanitize@output{\the\numexpr#1}
1100 }{
1101 \sseq@error@xx{invalid-intexpr}{\unexpanded{#2}}{#1}
1102 \sseq@break
1103 }
1104 }
1105
1106 \def\sseq@sanitize@positiveintexpr#1#2{
1107 \sseq@sanitize@intexpr{#1}{#2}
1108 \ifnum\sseq@sanitize@output<1\relax
1109 \sseq@error@xx{invalid-positive-intexpr}{\unexpanded{#2}}{#1}
1110 \@xp\sseq@break
1111 \fi
1112 }
1113
1114 \def\sseq@sanitize@dimenexpr#1#2{
1115 \sseq@ifpgfmathexpr{#1}{
1116 \ifpgfmathunitsdeclared\else
1117 \sseq@error@xx{invalid-dimenexpr}{\unexpanded{#2}}{#1}
1118 \@xp\sseq@break
1119 \fi
1120 \edef\sseq@sanitize@output{\sseq@mathresult}
1121 }{
1122 \sseq@error@xx{invalid-dimenexpr}{\unexpanded{#2}}{#1}
1123 \sseq@break
1124 }
1125 }
1126
1127 \def\sseq@sanitize@color#1#2{
1128 \begingroup
1129 \global\sseq@gtempiffalse
1130 \def\c@lor@error##1{\global\sseq@gtempiftrue}
1131 \color{#1}
1132 \endgroup
1133 \ifsseq@gtempif
1134 \sseq@error@xx{invalid-color}{\unexpanded{#2}}{#1}
1135 \@xp\sseq@break
1136 \else
1137 \def\sseq@sanitize@output{#1}
1138 \fi
1139 }
1140
1141 \pgfqkeys{/handlers}{
1142 .sseq store in/.code 2 args={%
1143 \sseq@addtostorelist#1{#2}%
1144 \sseq@keys@lastpart
1145 \pgfkeys{%
1146 \sseq@temp@ii/.store in=#1,%
1147 /sseqpages/global/default/\sseq@temp/.store in/.expand once=\csname \sseq@macroname#1@default\endcsname
1148 }%
1149 },
1150 .sseq store in sanitize/.code n args={3}{%
1151 \sseq@addtostorelist#1{#2}%
1152 \sseq@keys@lastpart
1153 \pgfkeys{%
1154 \sseq@temp@ii/.code/.expanded={%
1155 \unexpanded{#3{##1}}{\sseq@temp=\unexpanded{##1}}%
1156 \unexpanded{\edef#1{\unexpanded\@xp{\sseq@sanitize@output}}}%
1157 \sseq@breakpoint
1158 },
1159 \sseq@temp@ii/.value required,
1160 /sseqpages/global/default/\sseq@temp/.code/.expanded={%
1161 \unexpanded{#3{##1}}{\sseq@temp=\unexpanded{##1}}%
1162 \edef\@xp\@nx\csname \sseq@macroname#1@default\endcsname\unexpanded{{\unexpanded\@xp{\sseq@sanitize@output}}}%
1163 \sseq@breakpoint
1164 },
1165 /sseqpages/global/default/\sseq@temp/.value required
1166 }%
1167
1168 },
1169 .sseq store int in/.code 2 args={
1170 \sseq@keys@lastpart
1171 \pgfkeysalso{%
1172 \sseq@temp@ii/.sseq store in sanitize={#1}{#2}\sseq@sanitize@intexpr
1173 }
1174 },
1175 .sseq store positive int in/.code 2 args={
1176 \sseq@keys@lastpart
1177 \pgfkeysalso{%
1178 \sseq@temp@ii/.sseq store in sanitize={#1}{#2}\sseq@sanitize@positiveintexpr
1179 }
1180 },
1181 .sseq store dimen in/.code 2 args={
1182 \sseq@keys@lastpart
1183 \pgfkeysalso{%
1184 \sseq@temp@ii/.sseq store in sanitize={#1}{#2}\sseq@sanitize@dimenexpr
1185 }
1186 },
1187 .sseq append to style/.code 2 args={%
1188 \sseq@addkeytostorelist{#1}{\pgfkeysalso{#2}}%
1189 \sseq@keys@lastpart
1190 \pgfkeys{%
1191 \sseq@temp@ii/.style={#1/.append style={##1}},%
1192 /sseqpages/global/default/\sseq@temp/.ecode={%
1193 \@nx\apptocmd\@xp\@nx\csname pgfk@#1/.@cmd@default\endcsname{\@nx\pgfkeysalso{##1}}{}{\@nx\sseq@error{this-shouldnt-happen}}%
1194 \global\let\@xp\@nx\csname pgfk@#1/.@cmd@default\endcsname\@xp\@nx\csname pgfk@#1/.@cmd@default\endcsname
1195 }%
1196 }%
1197 },
1198 .sseq is if/.code={%
1199 \sseq@addiftostorelist@truedefault{#1}%
1200 \sseq@keys@lastpart
1201 \pgfkeys{%
1202 \sseq@temp@ii/.is if=sseq@#1,%
1203 /sseqpages/global/default/\sseq@temp/.code={\@xp\edef\csname sseq@#1@default\endcsname{\global\@xp\@nx\csname sseq@#1##1\endcsname}},%
1204 /sseqpages/global/default/\sseq@temp/.default=true,%
1205 }%
1206 },
1207 .sseq is if false/.code={%
1208 \sseq@keys@lastpart
1209 \pgfkeys{%
1210 /sseqpages/global/\sseq@temp/.code/.expanded={\@xp\@nx\csname sseq@#1false\endcsname},
1211 /sseqpages/global/\sseq@temp/.value forbidden,
1212 % value forbidden and ecode don't work correctly together so we have to use .code/.expanded .
1213 % I made a thread here: https://sourceforge.net/p/pgf/discussion/477362/thread/3e75d813/
1214 /sseqpages/global/default/\sseq@temp/.code/.expanded={\def\@xp\@nx\csname sseq@#1@default\endcsname{\global\@xp\@nx\csname sseq@#1false\endcsname}},
1215 /sseqpages/global/default/\sseq@temp/.value forbidden,
1216 }%
1217 },
1218 .sseq default code/.code={%
1219 \sseq@keys@lastpart
1220 \pgfkeys{/sseqpages/global/default/\sseq@temp/.code={#1}}%
1221 },
1222 .sseq default code 2 args/.code={%
1223 \sseq@keys@lastpart
1224 \pgfkeys{/sseqpages/global/default/\sseq@temp/.code 2 args={#1}}%
1225 },
1226 .sseq default error/.code={%
1227 \sseq@keys@lastpart
1228 \pgfkeys{/sseqpages/global/default/\sseq@temp/.ecode={\@nx\sseq@error@n{option-no-default-allowed}{\sseq@temp}}}%
1229 },
1230 .sseq x y alias/.code={%
1231 \sseq@keys@lastpart
1232 \ifx\pgfkeysnovalue#1%
1233 \edef\sseq@tempb##1{##1 \sseq@temp}%
1234 \else
1235 \def\sseq@tempb##1{#1}%
1236 \sseq@usedparam\sseq@tempb
1237 \fi
1238 \pgfkeys{%
1239 /sseqpages/global/\sseq@temp/.code/.expanded={\@nx\pgfkeysalso{\sseq@tempb{x}=\unexpanded{{##1}},\sseq@tempb{y}=\unexpanded{{##1}}}},%
1240 /sseqpages/global/default/\sseq@temp/.code/.expanded={\@nx\pgfkeysalso{\sseq@tempb{x}=\unexpanded{{##1}},\sseq@tempb{y}=\unexpanded{{##1}}}}%
1241 }%
1242 }
1243 }
1244
1245 \bgroup\lccode`*=`#\lowercase{\egroup
1246 \def\sseq@usedparam#1{
1247 \@xp\sseq@usedparam@\@xp#1\meaning#1*\@nil
1248 }
1249 \def\sseq@usedparam@#1#2->#3*#4\@nil{
1250 \sseq@ifempty{#4}{
1251 \@xp\def\@xp#1\@xp##\@xp1\@xp{\@xp##\@xp1\@xp\space#1{}}
1252 }{}
1253 }
1254 }
1255
1256 \def\sseq@patchrepeat#1#2#3{%
1257 \patchcmd#1{#2}{#3}{\sseq@patchrepeat{#1}{#2}{#3}}{}%
1258 }
1259
1260 \def\sseq@stylehandler@processpath#1#2{%
1261 \def\sseq@savedoptioncode{}%
1262 \sseq@eval{\@nx\sseq@addstylecodetooptions{/sseqpages/#1}{\unexpanded\@xp{\sseq@keybody{*1}}}}%
1263 \edef\sseq@savedoptioncode##1{\unexpanded\@xp{\sseq@savedoptioncode}}%
1264 \sseq@patchrepeat\sseq@savedoptioncode{*1}{##1}%
1265 \sseq@eval{\@nx\pgfqkeys{/sseqpages/#1}{\sseq@temp/.#2={\unexpanded\@xp{\sseq@savedoptioncode{##1}}}}}%
1266 }
1267
1268 \def\sseq@add@tikzkey@to@options@forstylehander#1{\sseq@e@addto@options{#1}}
1269 \pgfqkeys{/handlers}{ % defines sseq style, etc
1270 sseq @@ make style handler/.style 2 args={%
1271 .sseq #1/.code={%
1272 \def\sseq@keybody####1{##1}%
1273 \sseq@keys@lastpart
1274 \let\sseq@savedoptioncode@store\sseq@savedoptioncode
1275 \def\sseq@keys@unknown@error{}%
1276 \let\sseq@add@tikzkey@to@options\sseq@add@tikzkey@to@options@forstylehander
1277 %
1278 \sseq@stylehandler@processpath{scope}{#2}%
1279 \sseq@stylehandler@processpath{class}{#2}%
1280 \sseq@stylehandler@processpath{differential}{#2}%
1281 \sseq@stylehandler@processpath{struct line}{#2}%
1282 \sseq@stylehandler@processpath{extension}{#2}%
1283 \sseq@stylehandler@processpath{circle classes}{#2}%
1284 \sseq@stylehandler@processpath{tikz primitives}{#2}%
1285 %
1286 \let\sseq@savedoptioncode\sseq@savedoptioncode@store
1287 \let\sseq@addstylecodetooptions@unknown\sseq@keys@unknown
1288 \let\sseq@keys@unknown@error\sseq@keys@unknown@error@normal
1289 \let\sseq@add@tikzkey@to@options\sseq@e@addto@options
1290 }%
1291 },%
1292 sseq @@ make code handler/.style={%
1293 .sseq #1/.code={%
1294 \sseq@keys@lastpart
1295 \pgfkeys{
1296 /sseqpages/class/\sseq@temp/.#1={##1},%
1297 /sseqpages/differential/\sseq@temp/.#1={##1},%
1298 /sseqpages/struct line/\sseq@temp/.#1={##1}%
1299 /sseqpages/extension/\sseq@temp/.#1={##1}%
1300 }%
1301 }%
1302 },
1303 %
1304 sseq @@ make style handler={style}{code},
1305 sseq @@ make style handler={prefix style}{prefix code},
1306 sseq @@ make style handler={append style}{append code},
1307 sseq @@ make code handler=code,
1308 sseq @@ make code handler=prefix code,
1309 sseq @@ make code handler=append code,
1310 % these just are the same as /.style, etc.
1311 .global sseq style/.code={\pgfkeys{\pgfkeyscurrentpath/.code=\pgfkeysalso{#1}}},
1312 .global sseq prefix style/.code={\pgfkeys{\pgfkeyscurrentpath/.add code={\pgfkeysalso{#1}}{}}},
1313 .global sseq append style/.code={\pgfkeys{\pgfkeyscurrentpath/.add code={}{\pgfkeysalso{#1}}}},
1314 %
1315 %
1316 .sseq grading/.code 2 args={%
1317 \sseq@keys@lastpart
1318 \pgfkeys{%
1319 /sseqpages/global/\sseq@temp/.estyle={\unexpanded{degree={#1}{#2}}},%I'm not really sure why these need to be estyle and \unexpanded but it does...
1320 /sseqpages/global/default/\sseq@temp/.estyle={\unexpanded{degree={#1}{#2}}},%
1321 /sseqpages/\sseq@temp/.sseq @ global only
1322 }%
1323 },
1324 Adams grading/.sseq grading={-1}{#1},
1325 homological Serre grading/.sseq grading={-#1}{#1-1},
1326 cohomological Serre grading/.sseq grading={#1}{1-#1},
1327 }
1328
1329 %%% Define global keys setter
1330 % Most keys are run twice -- once in the "/sseqpages/global" directory and once in the "/sseqpages/global/default" directory
1331 % The default "default" behavior is to add the option to the "sseq" style.
1332 % Keys prefixed by a tilde or using an "ignored" handler are only run in the "/sseqpages/global directory".
1333 \gdef\sseq@globalkeys#1{%
1334 \let\sseq@storetilde~%
1335 \def~{}%
1336 \pgfqkeys{/sseqpages/global}{#1}% run keys in global directory
1337 \sseq@globalkeys@#1,\sseq@nil % handle defaults
1338 \let~\sseq@storetilde
1339 }
1340
1341 \def\sseq@globalkeys@#1,{%
1342 \sseq@tempiftrue
1343 \sseq@keys@removehandler{#1}% this sets \sseq@tempif to be false if it has an ignored handler
1344 % It also sets \sseq@temp to be the key.
1345 \ifsseq@tempif % If not ignored handler
1346 \pgfkeys{/sseqpages/\sseq@temp/.sseq @ global only}%
1347 % Check if no previous default behavior is defined, and if not, define it to pass key to sseqs.
1348 \pgfkeysifdefined{/sseqpages/global/default/\sseq@temp/.@cmd}{}{%
1349 \pgfkeys{/sseqpages/global/default/\sseq@temp/.ecode={\@nx\pgfkeysalso{sseqs={\sseq@temp}}}}%
1350 }%
1351 \fi
1352 \sseq@globalkeys@next
1353 }
1354
1355 \def\sseq@globalkeys@eatentry#1,{%
1356 \sseq@globalkeys@next
1357 }
1358
1359 % iterate over keys, throwing away empty keys and ones that start with ~.
1360 \def\sseq@globalkeys@next{%
1361 \@ifnextchar\sseq@nil{\@gobble}{%
1362 \@ifnextchar~{\sseq@globalkeys@eatentry}{%
1363 \@ifnextchar,{\sseq@globalkeys@eatentry}{%
1364 \sseq@globalkeys@
1365 }%
1366 }%
1367 }%
1368 }
1369
1370 % Handlers to ignore for
1371 \def\sseq@keys@ignorehandlers{%
1372 \\{value forbidden}\\{value required}\\{default}%\\{sseq store in}\\{sseq is if}%
1373 \\{sseq default code}\\{sseq default code 2 args}%
1374 }
1375 \def\sseq@keys@removehandler#1{\sseq@keys@removehandler@#1=\sseq@nil}
1376 \def\sseq@keys@removehandler@#1/.#2=#3\sseq@nil{%
1377 \bgroup
1378 \def\sseq@temp{#2}%
1379 \def\\##1{\def\sseq@tempii{##1}\ifx\sseq@tempii\sseq@temp \global\sseq@tempiffalse\let\\\@gobble\fi}%
1380 \sseq@keys@ignorehandlers
1381 \egroup
1382 \def\sseq@temp{#1}%
1383 }
1384
1385
1386 %%% Define global keys
1387 \def\sseq@currentoptionpath{default}
1388 \pgfkeys{
1389 % \sseq@currentoptionpath is set to \sseq@thename in \sseqdata, then "temp" in \sseqpage
1390 /sseqpages/global/.unknown/.code={%
1391 \let\sseq@tempa\pgfkeyscurrentname
1392 \let\sseq@tempb\pgfkeyscurrentvalue
1393 \sseq@eval{\@nx\pgfqkeys{/sseqpages/global}{/sseqpages/userstyles/\sseq@tempa/.try={\unexpanded\@xp{\sseq@tempb}}}}
1394 \ifpgfkeyssuccess\else
1395 \pgfkeysifdefined{/tikz/\pgfkeyscurrentname/.@cmd}{\@firstofone}{\pgfkeysifdefined{/tikz/\pgfkeyscurrentname}{\@firstofone}{%
1396 \sseq@error{unknown-global}\@gobble
1397 }}{%
1398 \pgfkeysalso{{\sseq@currentoptionpath} options/.append code/.expand twice={\@xp\@xp\@xp\tikzset\@xp\@xp\@xp{\@xp\sseq@tempa\@xp=\@xp{\sseq@tempb}}}}%
1399 \sseq@eval{%
1400 \global\let\@xp\@nx\csname pgfk@/sseqpages/global/{\sseq@currentoptionpath} options/.@cmd\endcsname
1401 \@xp\@nx\csname pgfk@/sseqpages/global/{\sseq@currentoptionpath} options/.@cmd\endcsname
1402 }%
1403 }%
1404 \fi
1405 },
1406 /sseqpages/global/default/.unknown/.code={%
1407 \sseq@passoptionto{/sseqpages/global}%
1408 },
1409 /sseqpages/global/{default} options/.code={},
1410 /sseqpages/global/name only/.unknown/.code={},
1411 /sseqpages/global/sseqstyle/.unknown/.code={}
1412 }
1413
1414 \pgfqkeys{/sseqpages/global/name only}{
1415 name/.code={\def\sseq@thename{#1}\sseq@hasnametrue},
1416 name/.value required,
1417 keep changes/.is if=sseq@keepchanges,
1418 update existing/.code={\ifsseq@ispageenv\sseq@error{page-update-existing}\fi\sseq@updateexistingtrue},
1419 update existing/.sseq default code={\sseq@updateexistingtrue}
1420 }
1421
1422 \def\sseq@printnum@inftytosymbol#1{%
1423 \ifnum#1=\sseq@infinity\relax
1424 $\infty$%
1425 \else
1426 #1%
1427 \fi
1428 }
1429
1430
1431 \sseq@addtostorelist\sseq@grid{\relax}
1432 \sseq@addiftostorelist{hasdegree}
1433 \let\sseq@maybemathswitch\relax
1434 \sseq@globalkeys{%
1435 name/.code={},
1436 name/.sseq default error,
1437 ~page/.code={
1438 \ifsseq@hasname
1439 \sseq@getnumrange\sseq@thepage{#1}%
1440 \sseq@thepagecount=\sseq@thepage\relax
1441 \let\page\sseq@thepage
1442 \ifnum\sseq@thepage=\sseq@infinity
1443 \def\page{$\infty$}%
1444 \fi
1445 \def\sseq@temp{\sseq@novalue}
1446 \ifx\sseq@printpageas\sseq@temp
1447 \def\sseq@printpageas{Page \page}
1448 \ifnum\sseq@thepage<\sseq@thepagemax
1449 \ifnum\sseq@thepagemax=\sseq@infinity\relax
1450 \def\sseq@printpageas{Page \page\space(all differentials)}
1451 \else
1452 \def\sseq@printpageas{Page \page\space(differentials of length $\leq\sseq@thepagemax$)}
1453 \fi
1454 \fi
1455 \fi
1456 \edef\sseq@thepagemm{\the\numexpr\sseq@thepagecount-1\relax}
1457 \ifnum\sseq@thepagemax=\z@
1458 \let\sseq@thepagemaxpp\sseq@infinity
1459 \else
1460 \edef\sseq@thepagemaxpp{\the\numexpr\sseq@thepagemax+1\relax}
1461 \fi
1462 \else
1463 \sseq@error{page-no-name}
1464 \fi
1465 },
1466 ~page/.sseq default error,% implement page default?
1467 degree/.code 2 args={\def\sseq@targetx##1{#1}\def\sseq@targety##1{#2}},
1468 degree/.sseq default code 2 args={\def\sseq@targetx@default##1{#1}\def\sseq@targety@default##1{#2}},
1469 strict degree/.sseq is if=strictdegree,
1470 lax degree/.sseq is if false=strictdegree,
1471 update existing/.code={}, % processed with "name" key and "keep changes" key in /sseqpages/global/name only
1472 keep changes/.code={%
1473 \ifsseq@hasname\else\sseq@error{keep-changes-no-name}\fi
1474 \ifsseq@ispageenv\else\sseq@error@n{only-for-sseqpages}{keep-changes}\fi
1475 },
1476 grid/.code={\ifcsname sseq@grid@#1\endcsname\@xp\let\@xp\sseq@grid\csname sseq@grid@#1\endcsname\else\sseq@error@n{unknown-grid}{#1}\fi},
1477 grid/.sseq default code={\ifcsname sseq@grid@#1\endcsname\@xp\let\@xp\sseq@grid@default\csname sseq@grid@#1\endcsname\else\sseq@error@n{unknown-grid}{#1}\fi},
1478 grid color/.sseq store in sanitize=\sseq@gridcolor{gray}\sseq@sanitize@color,
1479 grid step/.sseq x y alias,
1480 grid step/.value required,
1481 x grid step/.sseq store positive int in=\sseq@xgridstep{1},
1482 y grid step/.sseq store positive int in=\sseq@ygridstep{1},
1483 math nodes/.sseq is if=mathnodes, % TODO: make this locally toggleable
1484 custom clip/.sseq store in=\sseq@customclip{},
1485 clip/.sseq is if=clip,
1486 draw differentials/.sseq is if=drawdifferentials,
1487 no differentials/.sseq is if false={drawdifferentials},
1488 draw struct lines/.sseq is if=drawstructlines,
1489 no struct lines/.sseq is if false={drawstructlines},
1490 draw orphan edges/.sseq is if=draworphanedges,
1491 no orphan edges/.sseq is if false={draworphanedges},
1492 class pattern/.sseq store in=\sseq@classpattern{standard},
1493 class pattern/.add code={\ifcsname sseq@#1xoffset1/1\endcsname\else\sseq@error{unknown-class-pattern}\@xp\sseq@break\fi}{\sseq@breakpoint},
1494 class placement transform/.code={%
1495 \bgroup
1496 \let\tikz@transform\pgfutil@empty
1497 \pgfqkeys{/sseqpages/class placement}{#1}%
1498 \global\let\sseq@classplacementtransform\tikz@transform
1499 \egroup
1500 },
1501 class placement transform/.sseq default code={%
1502 \bgroup
1503 \let\tikz@transform\pgfutil@empty
1504 \pgfqkeys{/sseqpages/class placement}{#1}%
1505 \global\let\sseq@classplacementtransform@default\tikz@transform
1506 \egroup
1507 },
1508 class placement transform/.value required,
1509 add class placement transform/.code={%
1510 \bgroup
1511 \let\tikz@transform\pgfutil@empty
1512 \pgfqkeys{/sseqpages/class placement}{#1}%
1513 \sseq@x@addto@macro\sseq@classplacementtransform{\unexpanded\@xp\tikz@transform}
1514 \egroup
1515 },
1516 add class placement transform/.sseq default code={%
1517 \bgroup
1518 \let\tikz@transform\pgfutil@empty
1519 \pgfqkeys{/sseqpages/class placement}{#1}%
1520 \sseq@x@addto@macro\sseq@classplacementtransform@default{\unexpanded\@xp\tikz@transform}
1521 \egroup
1522 },
1523 add class placement transform/.value required,
1524 }
1525
1526
1527 \sseq@addiftostorelist@truedefault{rangecheck}
1528 \sseq@globalkeys{%
1529 range check on/.code={\sseq@rangechecktrue},
1530 range check default/.sseq default code={\def\sseq@rangecheck@default{\global\sseq@rangechecktrue}},
1531 range check standard/.code={%
1532 \ifsseq@ispageenv\else\sseq@error@n{only-for-sseqpages}{range check standard}\fi
1533 \SseqOrientationNormal
1534 \sseq@rangechecktrue
1535 },
1536 range check standard/.sseq default error,
1537 range check sideways/.code={%
1538 \ifsseq@ispageenv\else\sseq@error@n{only-for-sseqpages}{range check sideways}\fi
1539 \SseqOrientationSideways
1540 \sseq@rangechecktrue
1541 },
1542 range check sideways/.sseq default error,
1543 range check off/.code={\sseq@rangecheckfalse},
1544 range check off/.sseq default code={\def\sseq@rangecheck@default{\global\sseq@rangecheckfalse}},
1545 }
1546
1547 \sseq@mathnodestrue
1548
1549 \sseq@addtostorelist\sseq@targetx{}\sseq@addtostorelist\sseq@targety{}
1550 \sseq@addtostorelist\sseq@xtickstep{1}\sseq@addtostorelist\sseq@ytickstep{1}
1551 \sseq@addtostorelist\sseq@classplacementtransform{}
1552
1553
1554
1555 %%% Range keys and commands
1556 \sseq@globalkeys{%
1557 x range/.code 2 args={\sseq@xrange{#1}{#2}},
1558 x range/.sseq default code 2 args={\sseq@xrange@default{#1}{#2}},
1559 y range/.code 2 args={\sseq@yrange{#1}{#2}},
1560 y range/.sseq default code 2 args={\sseq@yrange@default{#1}{#2}},
1561 xrange/.forward to=/sseqpages/global/x range,
1562 yrange/.forward to=/sseqpages/global/y range
1563 }
1564
1565 % These are set up so that if the user specifies no \xrange, the minimum position of any node can be calculated on the fly.
1566 \@xp\sseq@addtostorelist\@xp\sseq@xmin\@xp{\sseq@infinity}
1567 \@xp\sseq@addtostorelist\@xp\sseq@ymin\@xp{\sseq@infinity}
1568 \@xp\sseq@addtostorelist\@xp\sseq@xmax\@xp{\@xp-\sseq@infinity}
1569 \@xp\sseq@addtostorelist\@xp\sseq@ymax\@xp{\@xp-\sseq@infinity}
1570 \sseq@addtostorelist\xmin{\protect\sseq@xmin}
1571 \sseq@addtostorelist\ymin{\protect\sseq@ymin}
1572 \sseq@addtostorelist\xmax{\protect\sseq@xmax}
1573 \sseq@addtostorelist\ymax{\protect\sseq@ymax}
1574 % These are used to decide whether to add a certain node to savedpaths.
1575 % In general the check is whether xmin<=xcoord<=xmax, but since Latex has no <=, set xminmm=xmin-1, xmaxpp=xmax+1.
1576 % If the user doesn't specify a range, all nodes should be rendered
1577 % To ensure that xminmm<xccord<xminpp in that case, set the default to xminmm=-\infty, xmaxpp=+\infty.
1578 \@xp\sseq@addtostorelist\@xp\sseq@xminmm\@xp{\@xp-\sseq@infinity}
1579 \@xp\sseq@addtostorelist\@xp\sseq@yminmm\@xp{\@xp-\sseq@infinity}
1580 \@xp\sseq@addtostorelist\@xp\sseq@xmaxpp\@xp{\sseq@infinity}
1581 \@xp\sseq@addtostorelist\@xp\sseq@ymaxpp\@xp{\sseq@infinity}
1582
1583 \sseq@addiftostorelist{specifiedxrange}
1584 \sseq@addiftostorelist{specifiedyrange}
1585 % We used to \let\xmin\sseq@xmin in here, but that's a bad idea. Hopefully things work now...
1586 \def\sseq@xrange#1#2{%
1587 \global\let\sseq@xminmax\@gobbletwo % Don't need to calculate range of nodes if user specifies it
1588 \global\sseq@specifiedxrangetrue
1589 \sseq@sanitize@intexpr{#1}{x range={#1}{#2}}
1590 \sseq@sanitize@intexpr{#2}{x range={#1}{#2}}
1591 \xdef\sseq@xmin{\the\numexpr#1}%
1592 \xdef\sseq@xmax{\the\numexpr#2}%
1593 % Need to know decremented \xmin and incremented \xmax to decide which nodes to print
1594 \sseq@tempcount=#1 \advance\sseq@tempcount-1\xdef\sseq@xminmm{\the\sseq@tempcount}%
1595 \sseq@tempcount=#2 \advance\sseq@tempcount1\xdef\sseq@xmaxpp{\the\sseq@tempcount}%
1596 \sseq@breakpoint
1597 }
1598
1599 \def\sseq@yrange#1#2{%
1600 \global\let\sseq@yminmax\@gobbletwo %
1601 \sseq@sanitize@intexpr{#1}{y range={#1}{#2}}
1602 \sseq@sanitize@intexpr{#2}{y range={#1}{#2}}
1603 \global\sseq@specifiedyrangetrue
1604 \xdef\sseq@ymin{\the\numexpr#1}%
1605 \xdef\sseq@ymax{\the\numexpr#2}%
1606 \sseq@tempcount=#1 \advance\sseq@tempcount-1\xdef\sseq@yminmm{\the\sseq@tempcount}%
1607 \sseq@tempcount=#2 \advance\sseq@tempcount1\xdef\sseq@ymaxpp{\the\sseq@tempcount}%
1608 }
1609
1610 \def\sseq@xrange@default#1#2{%
1611 \global\let\sseq@xminmax\@gobbletwo % Don't need to calculate range of nodes if user specifies it
1612 \gdef\sseq@xmin@default{#1}%
1613 \gdef\sseq@xmax@default{#2}%
1614 % Need to know decremented \xmin and incremented \xmax to decide which nodes to print
1615 \sseq@tempcount=#1 \advance\sseq@tempcount-1\xdef\sseq@xminmm@default{\the\sseq@tempcount}%
1616 \sseq@tempcount=#2 \advance\sseq@tempcount1\xdef\sseq@xmaxpp@default{\the\sseq@tempcount}%
1617 }
1618 \def\sseq@yrange@default#1#2{%
1619 \global\let\sseq@yminmax\@gobbletwo %
1620 \gdef\sseq@ymin@default{#1}%
1621 \gdef\sseq@ymax@default{#2}%
1622 \sseq@tempcount=#1 \advance\sseq@tempcount-1\xdef\sseq@yminmm@default{\the\sseq@tempcount}%
1623 \sseq@tempcount=#2 \advance\sseq@tempcount1\xdef\sseq@ymaxpp@default{\the\sseq@tempcount}%
1624 }
1625
1626 % If #1 is less than \xmin or greater than \xmax, update \xmin or \xmax appropriately
1627 % Gets set to \@gobble if user specifies range
1628 \def\sseq@xminmax@active#1#2{%
1629 \ifnum#1<\sseq@xmin\relax
1630 \ifx\sseq@yminmax\@gobbletwo
1631 \ifnum#2>\sseq@yminmm\relax
1632 \ifnum#2<\sseq@ymaxpp\relax
1633 \xdef\sseq@xmin{#1}%
1634 \fi
1635 \fi
1636 \else
1637 \xdef\sseq@xmin{#1}%
1638 \fi
1639 \fi
1640 \ifnum#1>\sseq@xmax\relax
1641 \ifx\sseq@yminmax\@gobbletwo
1642 \ifnum#2>\sseq@yminmm\relax
1643 \ifnum#2<\sseq@ymaxpp\relax
1644 \xdef\sseq@xmax{#1}%
1645 \fi
1646 \fi
1647 \else
1648 \xdef\sseq@xmax{#1}%
1649 \fi
1650 \fi
1651 }
1652
1653 \def\sseq@yminmax@active#1#2{%
1654 \ifnum#2<\sseq@ymin\relax
1655 \ifx\sseq@xminmax\@gobbletwo
1656 \ifnum#1>\sseq@xminmm\relax
1657 \ifnum#1<\sseq@xmaxpp\relax
1658 \xdef\sseq@ymin{#2}%
1659 \fi
1660 \fi
1661 \else
1662 \xdef\sseq@ymin{#2}%
1663 \fi
1664 \fi
1665 \ifnum#2>\sseq@ymax\relax
1666 \ifx\sseq@xminmax\@gobbletwo
1667 \ifnum#1>\sseq@xminmm\relax
1668 \ifnum#1<\sseq@xmaxpp\relax
1669 \xdef\sseq@ymax{#2}%
1670 \fi
1671 \fi
1672 \else
1673 \xdef\sseq@ymax{#2}%
1674 \fi
1675 \fi
1676 }
1677
1678 %%% Axes and Layout options
1679 \sseq@addtostorelist{\sseq@xtickfn}{} % These should initially be the identity macro, but addtostorelist doesn't accept functions as default
1680 \sseq@addtostorelist{\sseq@ytickfn}{} % so the default is instated in begin{sseqdata} / begin{sseqpicture}.
1681
1682 \let\sseq@printpageas\relax
1683 \sseq@globalkeys{%
1684 title/.sseq store in=\sseq@title{},
1685 title style/.sseq append to style={/sseqpages/global/every title}{at={(0.5*\xmin+0.5*\xmax,\ymax)}},
1686 draw title/.sseq is if=drawtitle,
1687 print page as/.sseq store in=\sseq@printpageas{\sseq@novalue},
1688 no title/.code=\sseq@drawtitlefalse,
1689 %
1690 x label/.sseq store in=\sseq@xaxislabel{},
1691 y label/.sseq store in=\sseq@yaxislabel{},
1692 x label style/.sseq append to style={/sseqpages/global/every x axis label}{at={(0.5*\xmin+0.5*\xmax,\ymin)}},
1693 y label style/.sseq append to style={/sseqpages/global/every y axis label}{at={(\xmin ,0.5*\ymax+0.5*\ymin)}},
1694 label style/.sseq x y alias,
1695 draw x label/.sseq is if=drawxaxislabel,
1696 draw y label/.sseq is if=drawyaxislabel,
1697 no x label/.sseq is if false={drawxaxislabel},
1698 no y label/.sseq is if false={drawyaxislabel},
1699 no labels/.sseq x y alias=no #1 label,
1700 draw labels/.sseq x y alias=draw #1 label,
1701 %
1702 no x axis/.style={x axis type=none},
1703 no y axis/.style={y axis type=none},
1704 no axes/.style={axes type=none},
1705 rotate labels/.sseq is if=rotatelabels,
1706 %
1707 draw x ticks/.sseq is if=drawxaxisticks,
1708 no x ticks/.sseq is if false=drawxaxisticks,
1709 draw y ticks/.sseq is if=drawyaxisticks,
1710 no y ticks/.sseq is if false=drawyaxisticks,
1711 no ticks/.sseq x y alias=no #1 ticks,
1712 no ticks/.value forbidden,
1713 draw ticks/.sseq x y alias=draw #1 ticks,
1714 draw ticks/.default=true,
1715 tick step/.sseq x y alias,
1716 tick step/.value required,
1717 x tick step/.sseq store positive int in=\sseq@xtickstep{1},
1718 y tick step/.sseq store positive int in=\sseq@ytickstep{1},
1719 tick offset/.sseq x y alias,
1720 tick offset/.value required,
1721 x tick offset/.sseq store int in=\sseq@xtickstepoffset{0},
1722 y tick offset/.sseq store int in=\sseq@ytickstepoffset{0},
1723 major tick step/.sseq x y alias,
1724 x major tick step/.sseq store int in=\sseq@xmajortickstep{0},
1725 y major tick step/.sseq store int in=\sseq@ymajortickstep{0},
1726 minor tick step/.sseq x y alias,
1727 x minor tick step/.sseq store int in=\sseq@xminortickstep{0},
1728 y minor tick step/.sseq store int in=\sseq@yminortickstep{0},
1729 x tick handler/.code={\def\sseq@xtickfn##1{#1}},
1730 x tick handler/.sseq default code={\def\sseq@xtickfn@default##1{#1}},
1731 y tick handler/.code={\def\sseq@ytickfn##1{#1}},
1732 y tick handler/.sseq default code={\def\sseq@ytickfn@default##1{#1}},
1733 class label handler/.code = { % \long so that \ifx\sseq@classname@handler\@gobble compares true if this is empty (\@gobble is long...)
1734 \long\def\sseq@classlabel@handler##1{#1}
1735 \ifx\sseq@classlabel@handler\@gobble
1736 \def\sseq@classlabel@handler##1{\def\result{##1}}
1737 \else
1738 \edef\sseq@tempa{\unexpanded\@xp{\sseq@classlabel@handler{}}}
1739 \edef\sseq@tempb{\unexpanded\@xp{\sseq@classlabel@handler{blah}}}
1740 \ifx\sseq@tempa\sseq@tempb
1741 \long\def\sseq@classlabel@handler##1{#1{##1}}
1742 \fi
1743 \fi
1744 },
1745 class label handler/.sseq default code={
1746 \long\def\sseq@classlabel@handler@default##1{#1}
1747 \ifx\sseq@classlabel@handler@default\@gobble
1748 \def\sseq@classlabel@handler@default##1{\def\result{##1}}
1749 \else
1750 \edef\sseq@tempa{\unexpanded\@xp{\sseq@classlabel@handler@default{}}}
1751 \edef\sseq@tempb{\unexpanded\@xp{\sseq@classlabel@handler@default{blah}}}
1752 \ifx\sseq@tempa\sseq@tempb
1753 \long\def\sseq@classlabel@handler@default##1{#1{##1}}
1754 \fi
1755 \fi
1756 },
1757 class name handler/.code = { % \long so that \ifx\sseq@classname@handler\@gobble compares true if this is empty (\@gobble is long...)
1758 \long\def\sseq@classname@handler##1{#1}
1759 \ifx\sseq@classname@handler\@gobble
1760 \def\sseq@classname@handler##1{\def\result{##1}}
1761 \else
1762 \edef\sseq@tempa{\unexpanded\@xp{\sseq@classname@handler{}}}
1763 \edef\sseq@tempb{\unexpanded\@xp{\sseq@classname@handler{blah}}}
1764 \ifx\sseq@tempa\sseq@tempb
1765 \long\def\sseq@classname@handler##1{#1{##1}}
1766 \fi
1767 \fi
1768 },
1769 class name handler/.sseq default code={
1770 \long\def\sseq@classname@handler@default##1{#1}
1771 \ifx\sseq@classname@handler@default\@gobble
1772 \def\sseq@classname@handler@default##1{\def\result{##1}}
1773 \else
1774 \edef\sseq@tempa{\unexpanded\@xp{\sseq@classname@handler@default{}}}
1775 \edef\sseq@tempb{\unexpanded\@xp{\sseq@classname@handler@default{blah}}}
1776 \ifx\sseq@tempa\sseq@tempb
1777 \long\def\sseq@classname@handler@default##1{#1{##1}}
1778 \fi
1779 \fi
1780 },
1781 x tick style/.sseq store in=\sseq@xtickstyle{},
1782 y tick style/.sseq store in=\sseq@ytickstyle{},
1783 tick style/.sseq x y alias,
1784 %
1785 axes type/.sseq x y alias=axis type,
1786 axes type/.add code={\let\sseq@axistypesanitizer\sseq@axistypesanitizerb}{\let\sseq@axistypesanitizer\sseq@axistypesanitizera},
1787 axes type/.value required,
1788 x axis type/.sseq store in sanitize=\sseq@xaxistype{border}\sseq@axistypesanitizer,
1789 x axis type/.value required,
1790 y axis type/.sseq store in sanitize=\sseq@yaxistype{border}\sseq@axistypesanitizer,
1791 y axis type/.value required,
1792 x axis origin/.sseq store int in=\sseq@xaxisorigin@center@{0},
1793 y axis origin/.sseq store int in=\sseq@yaxisorigin@center@{0},
1794 axes origin/.sseq x y alias=axis origin,
1795 }
1796
1797 \def\sseq@validaxestypesa{border, center, or none. The value frame only works with the 'axes type' key.}
1798 \def\sseq@validaxestypesb{border, center, frame, or none.}
1799 \let\sseq@validaxestypes\sseq@validaxestypesa
1800
1801 \let\sseq@axistypekeya\@firstofone
1802 \def\sseq@axistypekeyb#1{axes type}
1803 \let\sseq@axistypekey\sseq@axistypekeya
1804
1805 \def\sseq@uptoequal#1{\sseq@uptoequal@#1\sseq@nil}
1806 \def\sseq@uptoequal@#1=#2\sseq@nil{#1}
1807 \def\sseq@axistypesanitizerb#1#2{
1808 \let\sseq@validaxestypes\sseq@validaxestypesb
1809 \let\sseq@axistypekey\sseq@axistypekeyb
1810 \@xp\ifx\csname sseq@leftgridpadding@y#1\endcsname\relax
1811 \sseq@error@xx{invalid-axis-type}{#1}{\sseq@uptoequal{#2}}
1812 \sseq@breakfi
1813 \else
1814 \def\sseq@sanitize@output{#1}
1815 \fi
1816 \let\sseq@validaxestypes\sseq@validaxestypesa
1817 \let\sseq@axistypekey\sseq@axistypekeya
1818 }
1819
1820 \def\sseq@axistype@frame{frame}
1821 \def\sseq@axistypesanitizera#1#2{
1822 \def\temp{#1}
1823 \ifx\sseq@axistype@frame\temp
1824 \sseq@error@xx{invalid-axis-type}{#1}{\sseq@uptoequal{#2}}
1825 \sseq@breakfi
1826 \fi
1827 \sseq@axistypesanitizerb{#1}{#2}
1828 }
1829 \let\sseq@axistypesanitizer\sseq@axistypesanitizera
1830
1831 \pgfqkeys{/sseqpages}{%
1832 class label handler/.code = { % \long so that \ifx\sseq@classlabel@handler\@gobble compares true if this is empty (\@gobble is long...)
1833 \long\def\sseq@classlabel@handler##1{#1}
1834 \ifx\sseq@classlabel@handler\@gobble
1835 \def\sseq@classlabel@handler##1{\def\result{##1}}
1836 \else
1837 \edef\sseq@tempa{\unexpanded\@xp{\sseq@classlabel@handler{}}}
1838 \edef\sseq@tempb{\unexpanded\@xp{\sseq@classlabel@handler{blah}}}
1839 \ifx\sseq@tempa\sseq@tempb
1840 \long\def\sseq@classlabel@handler##1{#1{##1}}
1841 \fi
1842 \fi
1843 },
1844 class name handler/.code = { % \long so that \ifx\sseq@classname@handler\@gobble compares true if this is empty (\@gobble is long...)
1845 \long\def\sseq@classname@handler##1{#1}
1846 \ifx\sseq@classname@handler\@gobble
1847 \def\sseq@classname@handler##1{\def\result{##1}}
1848 \else
1849 \edef\sseq@tempa{\unexpanded\@xp{\sseq@classname@handler{}}}
1850 \edef\sseq@tempb{\unexpanded\@xp{\sseq@classname@handler{blah}}}
1851 \ifx\sseq@tempa\sseq@tempb
1852 \long\def\sseq@classname@handler##1{#1{##1}}
1853 \fi
1854 \fi
1855 }
1856 }
1857
1858 \sseq@globalkeys{
1859 axes gap/.sseq x y alias=axis gap,
1860 axes gap/.value required,
1861 x axis gap/.sseq store dimen in=\sseq@xaxisgap{0.5cm},
1862 y axis gap/.sseq store dimen in=\sseq@yaxisgap{0.5cm},
1863 tick gap/.sseq x y alias,
1864 tick gap/.value required,
1865 x tick gap/.sseq store dimen in=\sseq@xlabelgap{0.5cm},
1866 y tick gap/.sseq store dimen in=\sseq@ylabelgap{0.5cm},
1867 x axis tail/.sseq store dimen in=\sseq@xaxis@tail{0.9cm},
1868 y axis tail/.sseq store dimen in=\sseq@yaxis@tail{0.9cm},
1869 x axis extend start/.sseq store dimen in=\sseq@xaxis@start@extend{0.5cm},
1870 y axis extend start/.sseq store dimen in=\sseq@yaxis@start@extend{0.5cm},
1871 axes extend start/.sseq x y alias=axis extend start,
1872 x axis extend end/.sseq store dimen in=\sseq@xaxis@end@extend{0.5cm},
1873 y axis extend end/.sseq store dimen in=\sseq@yaxis@end@extend{0.5cm},
1874 axes extend end/.sseq x y alias=axis extend end,
1875 x axis clip padding/.sseq store dimen in=\sseq@xclip@axisgap{0.1cm},
1876 y axis clip padding/.sseq store dimen in=\sseq@yclip@axisgap{0.1cm},
1877 axes clip padding/.sseq x y alias=axis clip padding,
1878 right clip padding/.sseq store dimen in=\sseq@clip@padding@right{0.1cm},
1879 left clip padding/.sseq store dimen in=\sseq@clip@padding@left{0.1cm},
1880 top clip padding/.sseq store dimen in=\sseq@clip@padding@top{0.1cm},
1881 bottom clip padding/.sseq store dimen in=\sseq@clip@padding@bottom{0.1cm}
1882 }
1883
1884 %%%
1885 %%% Coordinate transformations
1886 %%%
1887
1888 %%% Global Coordinate Transformations
1889 \sseq@globaldetonetrue
1890 \sseq@addtostorelist\sseq@globaldetonetransform{}
1891 \sseq@addtostorelist\sseq@globalrotatetransform{}
1892 \sseq@addtostorelist\sseq@globalscaletransform{}
1893
1894 \sseq@addtostorelist\sseq@xscale{1}
1895 \sseq@addtostorelist\sseq@yscale{1}
1896
1897 \def\sseq@globaldetoneoption#1#2{%
1898 \ifsseq@globaldetone\else
1899 \sseq@error@n{det-one-after-scale}{#2}
1900 \fi
1901 \@xp\gdef\@xp\sseq@globaldetonetransform\@xp{\sseq@globaldetonetransform #1}%
1902 #1
1903 }
1904 \def\sseq@globalscaleoption#1{%
1905 \sseq@globaldetonefalse
1906 \@ifundefined{sseq@globalscaletransform}{
1907 \@xp\gdef\@xp\sseq@globalscaletransform@default\@xp{\sseq@globalscaletransform@default#1}%
1908 }{
1909 \@xp\gdef\@xp\sseq@globalscaletransform\@xp{\sseq@globalscaletransform#1}%
1910 }
1911 }
1912 \pgfqkeys{/sseqpages/global}{%
1913 x/.sseq @ illegal,
1914 y/.sseq @ illegal,
1915 z/.sseq @ illegal,
1916 xshift/.sseq @ illegal as global,
1917 yshift/.sseq @ illegal as global,
1918 shift/.sseq @ illegal as global,
1919 scale around/.sseq @ illegal as global,
1920 rotate around/.sseq @ illegal as global,
1921 rotate/.code={%
1922 \@xp\gdef\@xp\sseq@globalrotatetransform\@xp{\sseq@globalrotatetransform\pgftransformrotate{#1}}%
1923 \sseq@globaldetoneoption{\pgftransformrotate{#1}}{rotate}%
1924 },
1925 rotate/.value required,
1926 xslant/.code={\sseq@globaldetoneoption{\pgftransformxslant{#1}}{xslant}},
1927 xslant/.value required,
1928 yslant/.code={\sseq@globaldetoneoption{\pgftransformyslant{#1}}{yslant}},
1929 yslant/.value required,
1930 xmirror/.code={\sseq@globaldetoneoption{\pgftransformxscale{-1}}{xmirror}},
1931 xmirror/.value forbidden,
1932 ymirror/.code={\sseq@globaldetoneoption{\pgftransformyscale{-1}}{ymirror}},
1933 ymirror/.value forbidden,
1934 mirror/.forward to=/sseqpages/global/xmirror,
1935 mirror/.forward to=/sseqpages/global/ymirror,
1936 xscale/.code={%
1937 \sseq@ifpgfmathexpr{int(#1-1)}{}{
1938 \sseq@error@nn{invalid-scale}{x}{#1}%
1939 \sseq@break
1940 }
1941 \ifpgfmathunitsdeclared
1942 \sseq@error@nn{unit-scale}{x}{#1}%
1943 \sseq@break
1944 \fi
1945 \ifnum\sseq@mathresult<\z@
1946 \sseq@error@nn{negative-scale}{x}{#1}%
1947 \sseq@break
1948 \fi
1949 \sseq@globalscaleoption{\pgfsetxvec{\pgfpointxy{#1}{0}}}
1950 \@ifundefined{sseq@xscale}{
1951 \pgfmathparse{\sseq@xscale@default*#1}
1952 \edef\sseq@xscale@default{\pgfmathresult}
1953 }{
1954 \pgfmathparse{\sseq@xscale*#1}
1955 \edef\sseq@xscale{\pgfmathresult}
1956 }
1957 \sseq@breakpoint
1958 },
1959 xscale/.value required,
1960 yscale/.code={%
1961 \sseq@ifpgfmathexpr{int(#1-1)}{}{
1962 \sseq@error@nn{invalid-scale}{y}{#1}%
1963 \sseq@break
1964 }
1965 \ifpgfmathunitsdeclared
1966 \sseq@error@nn{unit-scale}{y}{#1}%
1967 \sseq@break
1968 \fi
1969 \ifnum\sseq@mathresult<\z@
1970 \sseq@error@nn{negative-scale}{y}{#1}%
1971 \sseq@break
1972 \fi
1973 \sseq@globalscaleoption{\pgfsetyvec{\pgfpointxy{0}{#1}}}
1974 \@ifundefined{sseq@yscale}{
1975 \pgfmathparse{\sseq@yscale@default*#1}
1976 \edef\sseq@yscale@default{\pgfmathresult}
1977 }{
1978 \pgfmathparse{\sseq@yscale*#1}
1979 \edef\sseq@yscale{\pgfmathresult}
1980 }
1981 \sseq@breakpoint
1982 },
1983 yscale/.value required,
1984 scale/.sseq x y alias=#1scale,
1985 scale/.value required
1986 }
1987
1988 %%% Local Coordinate transformations
1989
1990 \pgfqkeys{/sseqpages/class placement}{
1991 x shift/.code={\sseq@error@nn{class-placement-shift}{x shift}{#1}},
1992 y shift/.code={\sseq@error@nn{class-placement-shift}{y shift}{#1}},
1993 shift/.code={\sseq@error@nn{class-placement-shift}{shift}{#1}}
1994 }
1995
1996 %% setup for coordinate transformation keys
1997 \def\sseq@checktransform{\sseq@error@nn{illegal-transform}}
1998 \pgfqkeys{/sseqpages}{%
1999 x/.code={\sseq@error@n{option-illegal}{#1}},
2000 y/.code={\sseq@error@n{option-illegal}{#1}},
2001 z/.code={\sseq@error@n{option-illegal}{#1}},
2002 xshift/.sseq @ first pass code=\sseq@tikz@firstpass@checkshifttransform{x}{#1},
2003 yshift/.sseq @ first pass code=\sseq@tikz@firstpass@checkshifttransform{y}{#1},
2004 xshift/.append code=\sseq@options@scopeshiftsecondpass{\sseq@tikz@shifttransform{x}{#1}},%% Note special scopeshiftsecondpass command
2005 yshift/.append code=\sseq@options@scopeshiftsecondpass{\sseq@tikz@shifttransform{y}{#1}},%%
2006 xshift/.value required,
2007 yshift/.value required,
2008 shift/.sseq @ transform, shift/.value required,
2009 shift only/.sseq @ transform,
2010 xscale/.sseq @ transform, xscale/.value required,
2011 yscale/.sseq @ transform, yscale/.value required,
2012 scale/.sseq @ transform, scale/.value required,
2013 scale around/.sseq @ transform, scale around/.value required,
2014 xslant/.sseq @ transform, xslant/.value required,
2015 yslant/.sseq @ transform, yslant/.value required,
2016 rotate/.sseq @ transform, rotate/.value required,
2017 rotate around/.sseq @ transform, rotate around/.value required,
2018 cm/.sseq @ transform, cm/.value required,
2019 reset cm/.sseq @ transform, reset cm/.value forbidden,
2020 transform canvas/.sseq @ transform, transform canvas/.value required
2021 }
2022
2023 \def\sseq@shift@firstpassprocess#1{\sseq@shift@firstpassprocess@#1\sseq@nil}
2024 \def\sseq@shift@firstpassprocess@#1#2\sseq@nil{\ifx#1\pgfpointxy\sseq@shift@firstpassprocess@@#2\else\sseq@standardparse\fi}
2025 \def\sseq@shift@firstpassprocess@@#1#2{
2026 \sseq@tikz@firstpass@checkshifttransform{x}{#1}
2027 \sseq@tikz@firstpass@checkshifttransform{y}{#2}
2028 }
2029
2030 \def\sseq@shift@secondpassprocess#1{\sseq@shift@secondpassprocess@#1\sseq@nil}
2031 \def\sseq@shift@secondpassprocess@#1#2\sseq@nil{\ifx#1\pgfpointxy\sseq@shift@secondpassprocess@@#2\else\sseq@standardparse \pgftransformshift{#1#2}\fi}
2032 \def\sseq@shift@secondpassprocess@@#1#2{
2033 \sseq@tikz@shifttransform{x}{#1}
2034 \sseq@tikz@shifttransform{y}{#2}
2035 }
2036
2037 % special second pass handler for scopes to prevent shifts from causing out of memory style errors,
2038 % see the longer comment at the definition of sseq@scope in main.code.tex
2039 \def\sseq@options@scopeshiftsecondpass{\sseq@options@secondpass}
2040
2041 \sseq@pgfqkeysdirlist{/sseqpages/scope,/sseqpages/tikz primitives,/sseqpages,/sseqpages/label,/sseqpages/class/label}{
2042 align/.sseq @ second pass code=\tikzset{align/#1},
2043 align/.sseq @ first pass append code={\sseq@needstikztrue\def\sseq@classquotes@smugglehook@inner{\sseq@needstikztrue\tikzset{align/#1}}}
2044 }
2045
2046 \sseq@pgfqkeysdirlist{/sseqpages/scope,/sseqpages/tikz primitives}{
2047 shift/.code={
2048 \sseq@options@firstpass{\tikz@scan@one@point\sseq@shift@firstpassprocess#1\relax}
2049 \sseq@options@secondpass{\tikz@scan@one@point\sseq@shift@secondpassprocess#1\relax} % TODO: maybe try to save the work of processing the point twice?
2050 },
2051 xshift/.sseq @ first pass code=\sseq@tikz@firstpass@checkshifttransform{x}{#1},
2052 yshift/.sseq @ first pass code=\sseq@tikz@firstpass@checkshifttransform{y}{#1},
2053 xshift/.append code=\sseq@options@scopeshiftsecondpass{\sseq@tikz@shifttransform{x}{#1}},%% Note special scopeshiftsecondpass command
2054 yshift/.append code=\sseq@options@scopeshiftsecondpass{\sseq@tikz@shifttransform{y}{#1}},%%
2055 rotate around/.sseq @ second pass code={\sseq@standardparse\sseq@pgfkeysdocommand{rotate}{#1}},
2056 rotate/.sseq @ stdparse do transform, rotate/.value required,
2057 xslant/.sseq @ stdparse do transform, xslant/.value required,
2058 yslant/.sseq @ stdparse do transform, yslant/.value required,
2059 xmirror/.sseq @ stdparse do transform={-1}, xmirror/.value forbidden,
2060 ymirror/.sseq @ stdparse do transform={-1}, ymirror/.value forbidden,
2061 xscale/.sseq @ stdparse do transform, xscale/.value required,
2062 yscale/.sseq @ stdparse do transform, yscale/.value required,
2063 scale/.sseq @ stdparse do transform, scale/.value required,
2064 scale around/.sseq @ stdparse do transform, scale around/.value required
2065 }
2066
2067 %%% Error checking for nonglobal transformations:
2068
2069 \def\sseq@firstpass@checkshifttransform#1#2{%
2070 \pgfmathparse{#2}%
2071 \sseq@ifpgfmathresultisunitlessint{%
2072 \@xp\pgfmathint\@xp{\pgfmathresult}%
2073 \@xp\advance\csname sseq@#1\endcsname\pgfmathresult\relax
2074 }{\sseq@error@n{illegal-transform}{#1shift}}%
2075 }
2076 \let\sseq@firstpass@shifttransform\sseq@firstpass@checkshifttransform
2077
2078 \def\sseq@checkshifttransform#1#2{%
2079 \pgfmathparse{(#2)}%
2080 \sseq@ifpgfmathresultisunitlessint{%
2081 \@xp\pgfmathint\@xp{\pgfmathresult}%
2082 \@xp\advance\csname sseq@#1\endcsname\pgfmathresult\relax
2083 \sseq@pgfkeysdocommand{#1shift}{#2cm}
2084 }{\sseq@error@n{illegal-transform}{#1shift}}%
2085 }
2086
2087 \def\sseq@okayshifttransform#1#2{%
2088 \pgfmathparse{#2}
2089 \ifpgfmathunitsdeclared
2090 \sseq@pgfkeysdocommand{#1shift}{#2}
2091 \else
2092 \sseq@pgfkeysdocommand{#1shift}{#2cm}
2093 \fi
2094 }
2095
2096 \def\sseq@tikz@firstpass@checkshifttransform#1#2{%
2097 \pgfmathparse{#2}%
2098 \sseq@ifpgfmathresultisunitlessint{%
2099 \@xp\pgfmathint\@xp{\pgfmathresult}%
2100 \@xp\advance\csname sseq@\sseq@getfirstchar#1\sseq@nil\endcsname\pgfmathresult\relax
2101 }{\sseq@standardparse}%
2102 }
2103
2104 \def\sseq@tikz@shifttransform#1#2{%
2105 \pgfmathparse{#2}%
2106 \sseq@ifpgfmathresultisunitlessint{%
2107 \@xp\pgfmathint\@xp{\pgfmathresult}%
2108 \@xp\advance\csname sseq@\sseq@getfirstchar#1\sseq@nil\endcsname\pgfmathresult\relax
2109 \sseq@pgfkeysdocommand{#1shift}{#2cm*\csname sseq@#1scale\endcsname}
2110 }{
2111 \sseq@standardparse
2112 \ifpgfmathunitsdeclared
2113 \sseq@pgfkeysdocommand{#1shift}{#2}
2114 \else
2115 \sseq@pgfkeysdocommand{#1shift}{#2cm}
2116 \fi
2117 }%
2118 }
2119
2120 \def\sseq@ifpgfmathresultisunitlessint{\ifpgfmathunitsdeclared\@xp\@secondoftwo\else\sseq@ifpgfmathresultisint{\@xp\@firstoftwo}{\@xp\@secondoftwo}\fi}
2121 \def\sseq@ifpgfmathresultisint{\@xp\sseq@ifpgfmathresultisint@\pgfmathresult..\sseq@nil}
2122 \def\sseq@ifpgfmathresultisint@#1.#2.#3\sseq@nil{\ifx\sseq@nil#2\sseq@nil\@xp\@firstoftwo\else \ifnum#2=\z@ \@xp\@xp\@xp\@firstoftwo\else \@xp\@xp\@xp\@secondoftwo\fi\fi}
2123
2124 %%%% Options for Tikz primitives
2125
2126 \def\sseq@pageconstraint{1}
2127 \def\sseq@pageconstraint@true{1}
2128
2129 \sseq@pgfqkeysdirlist{/sseqpages/scope,/sseqpages/tikz primitives}{
2130 page constraint/.code={
2131 \sseq@updatepageconstraint{#1}{&&}
2132 },
2133 page constraint or/.code={
2134 \sseq@updatepageconstraint{#1}{||}
2135 },
2136 page/.code={\sseq@getnumrange@defaultupperboundinfty\temp{#1}\sseq@updatepageconstraintrange},
2137 set page constraint/.store in=\sseq@pageconstraint,
2138 background/.code={\sseq@standardparse\sseq@setsavedpaths{background}\pgfkeysalso{standard parse}},
2139 }
2140
2141 \sseq@pgfqkeysdirlist{/sseqpages/scope,/sseqpages/tikz primitives,/sseqpages/fit}{
2142 class style/.code={\sseq@d@addto@options{\sseq@thesseqstyle\sseq@theclassstyle\the\sseq@scope@toks}},
2143 cycle style/.forward to=/sseqpages/tikz primitives/class style,
2144 permanent class style/.code={\sseq@d@addto@options{\sseq@thesseqstyle\sseq@theclassstyle\sseq@thepermanentcyclestyle\the\sseq@scope@toks}},
2145 permanent cycle style/.forward to=/sseqpages/tikz primitives/permanent class style,
2146 transient class style/.code={\sseq@d@addto@options{\sseq@thesseqstyle\sseq@theclassstyle\sseq@thetransientcyclestyle\the\sseq@scope@toks}},
2147 transient cycle style/.forward to=/sseqpages/tikz primitives/transient class style,
2148 this page class style/.code={\sseq@d@addto@options{\sseq@thesseqstyle\sseq@theclassstyle\sseq@thetransientcyclestyle\sseq@thethispagecyclestyle\the\sseq@scope@toks}},
2149 this page cycle style/.forward to=/sseqpages/tikz primitives/this page class style,
2150 differential style/.code={\sseq@d@addto@options{\sseq@thesseqstyle\sseq@theedgestyle\sseq@thedifferentialstyle\the\sseq@scope@toks}},
2151 struct line style/.code={\sseq@d@addto@options{\sseq@thesseqstyle\sseq@theedgestyle\sseq@thestructlinestyle\the\sseq@scope@toks}},
2152 extension style/.code={\sseq@d@addto@options{\sseq@thesseqstyle\sseq@theedgestyle\sseq@theextensionstyle\the\sseq@scope@toks}},
2153 tikz primitive style/.code={\sseq@d@addto@options{\sseq@thesseqstyle\sseq@thetikzprimitivestyle\the\sseq@scope@toks}}
2154 %this page struct line style/.sseq @ first pass code={\sseq@d@addto@options{\sseq@thesseqstyle\sseq@theedgestyle\sseq@thestructlinestyle\the\sseq@scope@toks}}
2155 }