diff options
Diffstat (limited to 'macros/latex/contrib/wargame/source/chit/stack.dtx')
-rw-r--r-- | macros/latex/contrib/wargame/source/chit/stack.dtx | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/macros/latex/contrib/wargame/source/chit/stack.dtx b/macros/latex/contrib/wargame/source/chit/stack.dtx new file mode 100644 index 0000000000..bc8f480e31 --- /dev/null +++ b/macros/latex/contrib/wargame/source/chit/stack.dtx @@ -0,0 +1,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 |