blob: bc8f480e311056a800acd5516b01761e5096e1fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
% \iffalse
% <*chit>
% --------------------------------------------------------------------
% \fi
% \subsubsection{Stacking of chits}
%
% Stacking of chits. The key \spec{chit/stack direction} sets the
% default direction to make the stack in.
%
% \begin{macrocode}
% offset, location, direction, list
\tikzset{%
chit/stack direction/.store in=\chit@stack@dir,
chit/stack direction/.initial={(.3,.3)},
}
% \end{macrocode}
%
% Now the code
%
% \begin{macrocode}
\def\chit@stack@dir{(.3,.3)}
\def\stackchits(#1){%
\@ifnextchar({\st@ckchits{#1}}{\st@ckchits{#1}(.3,.3)}%)
}
\def\st@ckchits#1(#2)#3{%
\chit@dbg{2}{Stacking chits `#1', `#2', `#3'}%
\edef\xy{#1}%
\chit@dbg{4}{Stack start at \xy}%
\foreach[count=\i from 0] \c/\o in {#3} {%
\ifx\c\empty\else%
\edef\ccc{\c}%
\chit@dbg{2}{Adding \meaning\ccc\space to stack at (\xy)' `\o'}%
\expandafter\ccc(\xy)%
%%
\ifx\c\o\else%
%\chit@dbg{0}{Option: \o}
\edef\ccc{\o}%
\expandafter\ccc(\xy)%
\fi
\expandafter\ccc(\xy)%
\tikzmath{%
coordinate \cc;%
\cc = (\xy) + (#2);}
\xdef\xy{\cc}%
\fi%
}%
\@ifnextchar;{\@gobble}{}%
}
% \end{macrocode}
%
% \iffalse
% </chit>
% --------------------------------------------------------------------
% \fi
|