summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/wargame/source/chit
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/wargame/source/chit')
-rw-r--r--macros/latex/contrib/wargame/source/chit/battle.dtx77
-rw-r--r--macros/latex/contrib/wargame/source/chit/core.dtx8
-rw-r--r--macros/latex/contrib/wargame/source/chit/dice.dtx286
-rw-r--r--macros/latex/contrib/wargame/source/chit/elements.dtx33
-rw-r--r--macros/latex/contrib/wargame/source/chit/misc.dtx429
-rw-r--r--macros/latex/contrib/wargame/source/chit/modifiers.dtx42
-rw-r--r--macros/latex/contrib/wargame/source/chit/oob.dtx172
-rw-r--r--macros/latex/contrib/wargame/source/chit/shape.dtx220
-rw-r--r--macros/latex/contrib/wargame/source/chit/stack.dtx54
-rw-r--r--macros/latex/contrib/wargame/source/chit/table.dtx176
10 files changed, 1050 insertions, 447 deletions
diff --git a/macros/latex/contrib/wargame/source/chit/battle.dtx b/macros/latex/contrib/wargame/source/chit/battle.dtx
new file mode 100644
index 0000000000..5057d620a5
--- /dev/null
+++ b/macros/latex/contrib/wargame/source/chit/battle.dtx
@@ -0,0 +1,77 @@
+% \iffalse
+% <*chit>
+% --------------------------------------------------------------------
+% \fi
+% \subsubsection{Battle markers}
+%
+% Takes 1 arguments - the identifier.
+%
+% Define \spec{every battle marker} to change the style.
+%
+% \begin{macrocode}
+\tikzset{%
+ battle marker/.pic={
+ \node[shape=circle,
+ font=\sffamily\bfseries,
+ inner sep=0pt,
+ minimum size=5mm,
+ draw=black,
+ fill=yellow!85!black,
+ every battle marker/.try] at (-.3,.3) {%
+ \ifnum#1>0\relax #1\fi%
+ };
+ },
+ battle marker/.style={
+ chit={full={battle marker=#1},frame={draw=none}}},
+}
+% \end{macrocode}
+%
+% Takes two arguments - the odds and the fill colour. The latter is
+% useful to differentiate the severity of an attack.
+%
+% Define \spec{every odds marker} to change the style.
+%
+% \begin{macrocode}
+\tikzset{%
+ pics/odds marker/.style args={#1,#2}{
+ code={
+ \node[shape=circle,
+ font=\sffamily\bfseries\large,
+ inner sep=0pt,
+ minimum size=8mm,
+ draw=black,
+ fill=#2,
+ every odds marker/.try] at (.2,-.2) {#1};
+ }
+ },
+ odds marker/.style args={#1,#2}{
+ chit={full={odds marker={#1,#2}},frame={draw=none}}},
+}
+% \end{macrocode}
+%
+% Takes two arguments - the result and the fill colour. The latter is
+% useful to differentiate the severity of an attack.
+%
+% Define \spec{every result marker} to change the style.
+%
+% \begin{macrocode}
+\tikzset{
+ pics/result marker/.style args={#1,#2}{
+ code={
+ \message{^^JResults marker #1 (#2)}
+ \node[shape=circle,
+ font=\sffamily\bfseries\large,
+ inner sep=0pt,
+ minimum size=8mm,
+ draw=black,
+ fill=#2,
+ every result marker/.try] at (0,0) {#1};}},
+ result marker/.style args={#1,#2}{
+ chit={full={result marker={#1,#2}},frame={draw=none}}}
+}
+% \end{macrocode}
+%
+% \iffalse
+% </chit>
+% --------------------------------------------------------------------
+% \fi
diff --git a/macros/latex/contrib/wargame/source/chit/core.dtx b/macros/latex/contrib/wargame/source/chit/core.dtx
index 7a0189074e..9181e6ede7 100644
--- a/macros/latex/contrib/wargame/source/chit/core.dtx
+++ b/macros/latex/contrib/wargame/source/chit/core.dtx
@@ -39,8 +39,14 @@
%
% \input{chit/shape.dtx}
% \input{chit/elements.dtx}
+% \input{chit/modifiers.dtx}
+% \input{chit/stack.dtx}
+% \input{chit/oob.dtx}
+% \input{chit/table.dtx}
+% \input{chit/battle.dtx}
+% \input{chit/dice.dtx}
% \input{chit/misc.dtx}
-%
+%
% \iffalse
%</chit>
% --------------------------------------------------------------------
diff --git a/macros/latex/contrib/wargame/source/chit/dice.dtx b/macros/latex/contrib/wargame/source/chit/dice.dtx
new file mode 100644
index 0000000000..0c07c91d4f
--- /dev/null
+++ b/macros/latex/contrib/wargame/source/chit/dice.dtx
@@ -0,0 +1,286 @@
+% \iffalse
+% <*chit>
+% --------------------------------------------------------------------
+% \fi
+% \subsubsection{Dice}
+%
+% First, a regular 6-sided dice with configurable number of dots. Use
+% like
+%
+% \begin{Syntax}
+% \cs{pic}\oarg{pic options}\{dice=\meta{eyes}\}
+% \end{Syntax}
+%
+% For example:
+%
+% \begin{enumerate}
+% \item \tikz{\pic[transform shape]{dice=1};}
+% \item \tikz{\pic[transform shape]{dice=2};}
+% \item \tikz{\pic[transform shape]{dice=3};}
+% \item \tikz{\pic[transform shape]{dice=4};}
+% \item \tikz{\pic[transform shape]{dice=5};}
+% \item \tikz{\pic[transform shape]{dice=6};}
+% \end{enumerate}
+%
+% \begin{macrocode}
+\tikzset{
+ dice bg/.style={
+ % /utils/exec={
+ % \pgfgettransformentries{%
+ % \wg@jaca}{%
+ % \wg@jacb}{%
+ % \wg@jacc}{%
+ % \wg@jacd}{%
+ % \wg@tmp}{%
+ % \wg@tmp}%
+ % \pgfmathsetmacro{\wg@tmp}{%
+ % sqrt(abs(\wg@jaca*\wg@jacd-\wg@jacb*\wg@jacc))}
+ % \xdef\wg@tmp{\wg@tmp}},%
+ fill=black,
+ draw=none,
+ minimum width=1cm,
+ minimum height=1cm,
+ scale rounded corners,
+ rounded corners=.1cm,
+ inner sep=0pt,
+ transform shape},
+ dice fg/.style={
+ fill=white,
+ shape=circle,
+ inner sep=0pt,
+ minimum size=.2cm,
+ transform shape},
+ pics/dice/.style={
+ code={
+ \node[dice bg] (dice bg) {};
+ \ifodd#1\node[dice fg] at (dice bg) {};\fi
+ \ifnum#1>1%
+ \node[dice fg] at ($(dice bg)+(-45:.4)$){};%
+ \node[dice fg] at ($(dice bg)+(135:.4)$){};%
+ \fi%
+ \ifnum#1>3%
+ \node[dice fg] at ($(dice bg)+( 45:.4)$){};%
+ \node[dice fg] at ($(dice bg)+(-135:.4)$){};%
+ \fi%
+ \ifnum#1=6%
+ \node[dice fg] at ($(dice bg)+(-.282,0)$){};
+ \node[dice fg] at ($(dice bg)+( .282,0)$){};
+ \fi
+ }
+ },
+ pics/dice/.default=3
+}
+\newcommand\dicemark[2][scale=.5]{%
+ \tikz[baseline={($(dice bg.south east)!.25!(dice bg.north east)$)},#1]{
+ \pic[transform shape]{dice=3};}}
+% \end{macrocode}
+%
+% Now some shapes of different dice. This was originally done by
+% \href{https://tex.stackexchange.com/questions/144193/how-do-i-put-a-die-roll-at-the-top-of-each-page#answer-144474}{David
+% Carlisle}. Usage is for example
+%
+% \begin{Syntax}
+% \cs{node}[shape=\meta{dice},\meta{node options}] \marg{value};
+% \end{Syntax}
+%
+% where \meta{dice} is one of \texttt{d4}, \texttt{d6}, \texttt{d8},
+% \texttt{d10}, \texttt{d12}, or \texttt{d20}.
+%
+% \def\DiceExample#1{%
+% \begin{tikzpicture}[
+% die/.style={
+% shape=#1,
+% scale line widths,
+% line width=1pt,
+% transform shape,
+% scale=.7
+% },
+% fg die/.style={
+% die,
+% fill=##1,
+% draw=gray!25!white,
+% text=white},
+% die shadow/.style={
+% die,
+% fill=black,
+% draw=none,
+% opacity=.5}]
+% \node[die shadow,rotate=10] at (.20,.07){};
+% \node[fg die=red,rotate=10] at (.15,.10){};
+% \node[die shadow,rotate=-10] at (-.08,-.11){};
+% \node[fg die=blue,rotate=-10] at (-.15,-.1){};
+% \draw(-.5,-.5)rectangle(.6,.5);
+% \end{tikzpicture}
+% }
+%
+% \paragraph{Tetrahedron}
+%
+% \DiceExample{d4}
+%
+% \begin{macrocode}
+\pgfdeclareshape{d4}{
+ \anchor{center}{\pgfpointorigin} % within the node, (0,0) is the center
+ \anchor{text}{
+ % this is used to center the text in the node
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{-.5\ht\pgfnodeparttextbox}}
+ \backgroundpath{ % draw border
+ \pgfpathmoveto{\pgfpoint{0cm}{.4cm}}
+ \pgfpathlineto{\pgfpoint{.433cm}{-.35cm}}
+ \pgfpathlineto{\pgfpoint{-.433cm}{-.35cm}}
+ \pgfpathlineto{\pgfpoint{0cm}{.4cm}}
+ % \pgfusepath{draw} %draw border
+ % \pgfusepath{draw} %draw rectangle
+ }}
+% \end{macrocode}
+%
+% \paragraph{Cubic}
+%
+% \DiceExample{d6}
+%
+% \begin{macrocode}
+\pgfdeclareshape{d6}{
+ \anchor{center}{\pgfpointorigin} % within the node, (0,0) is the center
+ \anchor{text}{
+ % this is used to center the text in the node
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{-.5\ht\pgfnodeparttextbox}}
+ \backgroundpath{ % draw border
+ \pgfpathrectanglecorners{\pgfpoint{.4cm}{.4cm}}{\pgfpoint{-.4cm}{-.4cm}}
+ % \pgfusepath{draw} %draw rectangle
+ }}
+% \end{macrocode}
+%
+% \paragraph{Octahedron}
+%
+% \DiceExample{d8}
+%
+% \begin{macrocode}
+\pgfdeclareshape{d8}{
+ \anchor{center}{\pgfpointorigin} % within the node, (0,0) is the center
+ \anchor{text}{
+ % this is used to center the text in the node
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{-.5\ht\pgfnodeparttextbox}}
+ \backgroundpath{ % draw border
+ \pgfpathmoveto{\pgfpoint{0cm}{.5cm}}
+ \pgfpathlineto{\pgfpoint{.433cm}{.25cm}}
+ \pgfpathlineto{\pgfpoint{.433cm}{-.25cm}}
+ \pgfpathlineto{\pgfpoint{0cm}{-.5cm}}
+ \pgfpathlineto{\pgfpoint{-.433cm}{-.25cm}}
+ \pgfpathlineto{\pgfpoint{-.433cm}{.25cm}}
+ \pgfpathlineto{\pgfpoint{0cm}{.5cm}}
+ \pgfpathlineto{\pgfpoint{.433cm}{-.25cm}}
+ \pgfpathlineto{\pgfpoint{-.433cm}{-.25cm}}
+ \pgfpathlineto{\pgfpoint{0cm}{.5cm}}
+ % \pgfusepath{draw} %draw interiaor
+ }}
+% \end{macrocode}
+%
+% \paragraph{Decahedron}
+%
+% \DiceExample{d10}
+%
+% \begin{macrocode}
+\pgfdeclareshape{d10}{
+ \anchor{center}{\pgfpointorigin} % within the node, (0,0) is the center
+ \anchor{text}{
+ % this is used to center the text in the node
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{-.5\ht\pgfnodeparttextbox}}
+ \backgroundpath{ % draw border
+ \pgfpathmoveto{\pgfpoint{0cm}{.5cm}}
+ \pgfpathlineto{\pgfpoint{.294cm}{-.154cm}}
+ \pgfpathlineto{\pgfpoint{0cm}{-.3cm}}
+ \pgfpathlineto{\pgfpoint{-.294cm}{-.154cm}}
+ \pgfpathlineto{\pgfpoint{0cm}{.5cm}}
+ \pgfpathlineto{\pgfpoint{.475cm}{.1cm}}
+ \pgfpathlineto{\pgfpoint{.475cm}{-.1cm}}
+ \pgfpathlineto{\pgfpoint{0cm}{-.5cm}}
+ \pgfpathlineto{\pgfpoint{-.475cm}{-.1cm}}
+ \pgfpathlineto{\pgfpoint{-.475cm}{.1cm}}
+ \pgfpathlineto{\pgfpoint{0cm}{.5cm}}
+ \pgfpathmoveto{\pgfpoint{.294cm}{-.154cm}}
+ \pgfpathlineto{\pgfpoint{.475cm}{-.1cm}}
+ \pgfpathmoveto{\pgfpoint{-.475cm}{-.1cm}}
+ \pgfpathlineto{\pgfpoint{-.294cm}{-.154cm}}
+ \pgfpathmoveto{\pgfpoint{0cm}{-.5cm}}
+ \pgfpathlineto{\pgfpoint{0cm}{-.3cm}}
+ % \pgfusepath{draw} %draw interiaor
+ }}
+% \end{macrocode}
+%
+% \paragraph{Dodecahedron}
+%
+% \DiceExample{d12}
+%
+% \begin{macrocode}
+\pgfdeclareshape{d12}{
+ \anchor{center}{\pgfpointorigin} % within the node, (0,0) is the center
+ \anchor{text}{ % this is used to center the text in the node
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{-.5\ht\pgfnodeparttextbox}}
+ \backgroundpath{ % draw border
+ \pgfpathmoveto{\pgfpoint{0cm}{.5cm}}
+ \pgfpathlineto{\pgfpoint{0.294cm}{.405cm}}
+ \pgfpathlineto{\pgfpoint{.475cm}{.173cm}}
+ \pgfpathlineto{\pgfpoint{.475cm}{-.173cm}}
+ \pgfpathlineto{\pgfpoint{.294cm}{-.405cm}}
+ \pgfpathlineto{\pgfpoint{0cm}{-.5cm}}
+ \pgfpathlineto{\pgfpoint{-.294cm}{-.405cm}}
+ \pgfpathlineto{\pgfpoint{-.475cm}{-.173cm}}
+ \pgfpathlineto{\pgfpoint{-.475cm}{.173cm}}
+ \pgfpathlineto{\pgfpoint{-.294cm}{.405cm}}
+ \pgfpathlineto{\pgfpoint{0cm}{.5cm}}
+ \pgfpathlineto{\pgfpoint{0cm}{.349cm}}
+ \pgfpathlineto{\pgfpoint{.332cm}{.108cm}}
+ \pgfpathlineto{\pgfpoint{.205cm}{-.282cm}}
+ \pgfpathlineto{\pgfpoint{-.205cm}{-.282cm}}
+ \pgfpathlineto{\pgfpoint{-.332cm}{.108cm}}
+ \pgfpathlineto{\pgfpoint{0cm}{.349cm}}
+ \pgfpathmoveto{\pgfpoint{.475cm}{.173cm}}
+ \pgfpathlineto{\pgfpoint{.332cm}{.108cm}}
+ \pgfpathmoveto{\pgfpoint{.294cm}{-.405cm}}
+ \pgfpathlineto{\pgfpoint{.205cm}{-.282cm}}
+ \pgfpathmoveto{\pgfpoint{-.294cm}{-.405cm}}
+ \pgfpathlineto{\pgfpoint{-.205cm}{-.282cm}}
+ \pgfpathmoveto{\pgfpoint{-.475cm}{.173cm}}
+ \pgfpathlineto{\pgfpoint{-.332cm}{.108cm}}
+ % \pgfusepath{draw} %draw interiaor
+ }}
+% \end{macrocode}
+%
+% \paragraph{Icosohedron}
+%
+% \DiceExample{d20}
+%
+% \begin{macrocode}
+\pgfdeclareshape{d20}{
+ \anchor{center}{\pgfpointorigin} % within the node, (0,0) is the center
+ \anchor{text}{ % this is used to center the text in the node
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{-.5\ht\pgfnodeparttextbox}}
+ \backgroundpath{ % draw border
+ \pgfpathmoveto{\pgfpoint{0cm}{.5cm}}
+ \pgfpathlineto{\pgfpoint{.454cm}{.262cm}}
+ \pgfpathlineto{\pgfpoint{.454cm}{-.262cm}}
+ \pgfpathlineto{\pgfpoint{0cm}{-.5cm}}
+ \pgfpathlineto{\pgfpoint{-.454cm}{-.262cm}}
+ \pgfpathlineto{\pgfpoint{-.454cm}{.262cm}}
+ \pgfpathlineto{\pgfpoint{0cm}{.5cm}}
+ \pgfpathlineto{\pgfpoint{0cm}{.292cm}}
+ \pgfpathlineto{\pgfpoint{.253cm}{-.146cm}}
+ \pgfpathlineto{\pgfpoint{-.253cm}{-.146cm}}
+ \pgfpathlineto{\pgfpoint{0cm}{.292cm}}
+ \pgfpathlineto{\pgfpoint{.454cm}{.262cm}}
+ \pgfpathlineto{\pgfpoint{.253cm}{-.146cm}}
+ \pgfpathlineto{\pgfpoint{0cm}{-.5cm}}
+ \pgfpathlineto{\pgfpoint{-.253cm}{-.146cm}}
+ \pgfpathlineto{\pgfpoint{-.454cm}{.262cm}}
+ \pgfpathlineto{\pgfpoint{0cm}{.292cm}}
+ \pgfpathmoveto{\pgfpoint{.454cm}{-.262cm}}
+ \pgfpathlineto{\pgfpoint{.253cm}{-.146cm}}
+ \pgfpathmoveto{\pgfpoint{-.454cm}{-.262cm}}
+ \pgfpathlineto{\pgfpoint{-.253cm}{-.146cm}}
+ % \pgfusepath{draw} %draw interiaor
+ }}
+% \end{macrocode}
+%
+% \iffalse
+% </chit>
+% --------------------------------------------------------------------
+% \fi
diff --git a/macros/latex/contrib/wargame/source/chit/elements.dtx b/macros/latex/contrib/wargame/source/chit/elements.dtx
index 8708ca2a15..6585c94064 100644
--- a/macros/latex/contrib/wargame/source/chit/elements.dtx
+++ b/macros/latex/contrib/wargame/source/chit/elements.dtx
@@ -5,6 +5,12 @@
%
% \subsubsection{Predefined \texttt{chit} element pictures}
%
+% \begin{macrocode}
+\DeclareRobustCommand\chit@sep[2][/]{%
+ \foreach[count=\is] \s in {#2}{%
+ \ifnum\is>1\relax#1\fi%
+ \s}}
+% \end{macrocode}
% \begin{TikzKey}{/tikz/pics/chit/1 factor,
% /tikz/pics/chit/2 factors,
% /tikz/pics/chit/2 factors artillery,
@@ -28,24 +34,32 @@
pics/chit/2 factors artillery/.style args={#1,#2,#3}{%
code={
\chit@dbg{4}{ Chit 2 factors w/artillery: `#1' `#2' `#3'}%
- \node[chit/factor,chit/2 factors,pic actions]{%
- #1$\overset{\text{\scriptsize #3}}{\text{--}}$#2};}},
+ \node[chit/factor,chit/2 factors]{%
+ {#1}$\overset{\text{\scriptsize #3}}{\text{--}}${#2}};}},
pics/chit/3 factors/.style args={#1,#2,#3}{%
code={
\chit@dbg{4}{ Chit 3 factors: `#1' `#2' `#3'}%
- \node[chit/factor,chit/3 factors,pic actions]{#1-#2-#3};}},
+ \node[chit/factor,chit/3 factors]{#1-#2-#3};}},
pics/chit/4 factors/.style args={#1,#2,#3,#4}{%
code={
\chit@dbg{4}{ Chit 3 factors: `#1' `#2' `#3' `#4'}%
- \node[chit/factor,chit/4 factors,pic actions]{#1-#2-#3-#4};}},
+ \node[chit/factor,chit/4 factors]{#1-#2-#3-#4};}},
chit/identifier/.pic={
\chit@dbg{4}{ Chit identifier: `#1'}%
\node[chit/identifier,pic actions]{#1};
},
+ chit/identifiers/.pic={
+ \chit@dbg{4}{ Chit identifiers: `#1'}%
+ \node[chit/identifier,pic actions]{\chit@sep{#1}};
+ },
chit/small identifier/.pic={
\chit@dbg{4}{ Chit small identifier: `#1'}%
\node[chit/small identifier,pic actions]{#1};
},
+ chit/small identifiers/.pic={
+ \chit@dbg{4}{ Chit small identifiers: `#1'}%
+ \node[chit/small identifier,pic actions]{\chit@sep{#1}};
+ },
chit/identifier macro/.pic={%
\chit@dbg{4}{ Chit identifier macro: \meaning#1}
\edef\chit@i@tmp{#1}
@@ -69,32 +83,35 @@
\tikzset{%
chit/factor/.style={
shape=rectangle,
- font=\sffamily\bfseries\large,
+ font=\sffamily\bfseries\fontsize{12}{14}\selectfont,
anchor=base,
inner sep=0,
%text=pgfstrokecolor,
draw=none,
fill=none,
+ transform shape,
},
chit/1 factor/.style={},
chit/2 factors/.style={},
chit/3 factors/.style={},
- chit/4 factors/.style={text/.append style=\small},
+ chit/4 factors/.style={text/.append style=\fontsize{10}{12}\selectfont},
chit/identifier/.style={
shape=rectangle,
- font=\sffamily\bfseries\scriptsize,
+ font=\sffamily\bfseries\fontsize{8}{9}\selectfont,
inner sep=0,
% text=pgfstrokecolor,
draw=none,
fill=none,
+ transform shape,
},
chit/small identifier/.style={
shape=rectangle,
- font=\sffamily\bfseries\tiny,
+ font=\sffamily\bfseries\fontsize{6}{7}\selectfont,
inner sep=0,
% text=pgfstrokecolor,
draw=none,
fill=none,
+ transform shape,
},
}
% \end{macrocode}
diff --git a/macros/latex/contrib/wargame/source/chit/misc.dtx b/macros/latex/contrib/wargame/source/chit/misc.dtx
index de373864e6..a5b9a79b24 100644
--- a/macros/latex/contrib/wargame/source/chit/misc.dtx
+++ b/macros/latex/contrib/wargame/source/chit/misc.dtx
@@ -1,391 +1,5 @@
% \iffalse
-% --------------------------------------------------------------------
-%<*chit>
-% \fi
-% \subsubsection{Other pictures}
-% Pictures for frame, factors, left, right, and below.
-% \begin{macrocode}
-\tikzset{
- pics/chit/shade/.style={
- code={%
- \path[fill=white,opacity=#1,pic actions] (-.6,-.6) rectangle(.6,.6);}},
- pics/chit/eliminate/.style={
- code={%
- \path[fill=red,opacity=#1,pic actions] (-.6,-.6) rectangle(.6,.6);}},
- pics/chit/shade/.default=0.5,
- pics/chit/eliminate/.default=0.25,
-}
-\def\shadechit(#1){%
- \pic at (#1) {chit/shade};}
-\def\eliminatechit(#1){%
- \pic at (#1) {chit/eliminate};}
-% \end{macrocode}
-%
-%
-% \iffalse
-% --------------------------------------------------------------------
-% \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
- }
-}
-% \end{macrocode}
-%
-% \iffalse
-% --------------------------------------------------------------------
-% \fi
-% \subsubsection{Making order of battle charts}
-%
-%
-% Macros for making OOBs
-%
-% Style for turns
-%
-% \begin{macrocode}
-\tikzset{
- chit/oob turn/.pic={\node[pic actions]{#1};}}
-% \end{macrocode}
-%
-%
-% current c, current r, n-columns, cell size, y
-%
-% \begin{macrocode}
-\def\chit@oob@cellupdate(#1,#2)#3#4#5{%
- \edef\f{\ifwg@oob@inv-1\else1\fi}%
- \chit@dbg{1}{ \space Cell update `c=|#1|' vs `#4'*(`#3'-1)}
- \pgfmathparse{int(ifthenelse(abs(#1)>=#4*(#3-1),#5-1,#5))}%
- \xdef#5{\pgfmathresult}
- \pgfmathparse{ifthenelse(abs(#1)>=#4*(#3-1),#2-#4,#2)}%
- \xdef#2{\pgfmathresult}%
- \pgfmathparse{ifthenelse(abs(#1)>=#4*(#3-1),0,#1+\f*#4)}%
- \xdef#1{\pgfmathresult}%
- \chit@dbg{1}{ \space\space-> `\string#5'=#5 `\string#2'=#2 `\string#1'=#1}
-}
-% \end{macrocode}
-%
-% current c, current r, cell size, extra vertical spacing
-%
-% \begin{macrocode}
-\def\chit@oob@rowupdate(#1,#2)#3#4{%
- \chit@dbg{2}{ Row update c=`#1',r=`#2',s=`#3',e=`#4'}
- %\pgfmathparse{ifthenelse(#1>0,#2-#3,#2)}%
- \pgfmathparse{#2-#3)}%
- \xdef#2{\pgfmathresult}%
- %\xdef#1{0}
- \chit@dbg{2}{ \space\space-> update `\string#2'=#2}
-}
-% \end{macrocode}
-% current c, current r, cell size, extra spacing
-%
-% \begin{macrocode}
-\def\chit@oob@turnupdate(#1,#2)#3#4{%
- \chit@dbg{2}{ Turn update c=`#1',r=`#2',s=`#3',e=`#4'}
- % \pgfmathparse{#2-ifthenelse(#1>0,#3,0)-#4}%
- \pgfmathparse{#2-#4-ifthenelse(abs(#1)>0.0001,#3,0)}
- \xdef#2{\pgfmathresult}%
- \xdef#1{0}%
- \chit@dbg{2}{ \space\space-> update `\string#1'=#1,`\string#2'=#2}
-}
-% \end{macrocode}
-% chit list, n-colls, cell size, extra vertical spacing
-%
-% This expects a list of lists of chits, one list per turn; the
-% maximum number of columns; the size of cells, extra spacing between
-% turns.
-%
-% Note, the list of lists leaf elements should be styles for the
-% chits.
-%
-% This depends on the Tikz pic \texttt{chit/oob~turn} which takes the
-% number as argument.
-%
-%
-% \begin{macrocode}
-\newif\ifwg@oob@inv\wg@oob@invfalse
-\def\wg@star@oob{\wg@oob@invtrue\wg@oob}
-\def\wg@nostar@oob{\wg@oob@invfalse\wg@oob}
-\def\oob{%
- \@ifstar{\wg@star@oob%
- }{\wg@nostar@oob%
- }%
-}
-\def\wg@oob#1#2#3#4{
- \def\r{0}
- \chit@dbg{1}{OOB: `#1'}
- \foreach[count=\ti from 0] \t/\y in #1{
- \xdef\o{\r}
- \def\c{0}
- \ifx\t\y\def\y{0}\fi
- \chit@dbg{1}{Turn \ti\space(\r,\t,y=\y):'}
- \ifwg@oob@inv%
- \pic at ( .5,\r) {chit/oob turn=\ti};%
- \else
- \pic at (-.5,\r) {chit/oob turn=\ti};%
- \fi%
- \ifx\t\empty\else%
- \foreach \u/\m in \t{
- %% \chit@dbg{2}{ `\u'=`\m'}
- \ifx\u\empty\else
- \ifx\m\@empty\def\m{1}\fi
- \ifx\u\m\def\m{1}\fi
- \foreach \n in {1,...,\m}{%
- \ifx\u\chit@blank\else
- \chit[\u=\ti,zone oob point={\u}{\c}{\r}](\c,\r);
- \fi
- \chit@oob@cellupdate(\c,\r){#2}{#3}{\y}
- }
- \fi
- }
- \fi
- \chit@dbg{1}{ End of chits in turn
- \ti\space(c=`\c',r=`\r',o='\o',y='\y')}
- % IF no units where given, then we force \c to be non-zero so that
- % \chit@oob@turnupdate increments the row
- \ifx\t\@empty
- \def\c{#3}
- \chit@dbg{2}{ Turn is empty, set c=`\c'}
- \fi
- %\ifnum\y<0% No explicit number of rows given
- % \def\c{#3}
- % \chit@dbg{2}{ No explicit number of rows given, set c=`\c'}
- %\fi
- % In case the user gave and explicit number of rows, add the rows
- % that are missing. \y is initially set to the number of
- % requested rows, and then decremented every time we go down one
- % row. So if the number of rows we did so far is N, and the
- % requested number of rows is M, then the loop below adds M-N
- % rows.
- \ifnum\y>0%
- \chit@dbg{2}{ Looping rows from 2 to \y, break when row > \y}%
- \foreach \rr in {2,...,\y}{
- %\ifnum\rr>\y% A little funny, but \y can be negative!
- % \chit@dbg{2}{ \space Breaking loop \rr\space > \y}%
- % \breakforeach%
- %\else%
- \chit@oob@rowupdate(\c,\r){#3}{#4}
- %\fi
- }
- \fi
- % This will zero \c. However, if on entry |\c|>0, then we also
- % increment the row
- \chit@oob@turnupdate(\c,\r){#3}{#4}
- \chit@dbg{1}{End of turn \ti\space(c=`\c',r=`\r',o='\o',y='\y')}
- }
- \chit@dbg{2}{End of OOB (c=`\c',r=`\r',y=`\y')}
-}
-% \end{macrocode}
-%
-% \iffalse
-% --------------------------------------------------------------------
-% \fi
-% \subsubsection{Table of chits}
-%
-% \begin{macrocode}
-\tikzset{
- chit/cell background/.style={fill=black},
- blank chit/.style={/chit/frame={draw=none,fill=none}},
-}
-% \end{macrocode}
-%
-% These macros are used when we set tables of chits. This allows us
-% to define blank spaces in the table by giving the element
-% \texttt{blank~chit}.
-%
-% \begin{macrocode}
-\def\chit@blank{blank chit}
-\def\chit@cellbg(#1,#2)#3{%
- \draw[chit/cell background](#1-#3/2,#2-#3/2) rectangle++(#3,#3);
-}
-% \end{macrocode}
-%
-% \begin{Macro}{\ifchits@reset}
-%
-% This `if' controls whether to reset the coordinates to the origin
-% when \cs{chits} is called. If true, then reset for a new table.
-%
-% \begin{macrocode}
-\newif\ifchits@reset\chits@resettrue
-% \end{macrocode}
-% \end{Macro}
-%
-% \begin{Macro}{\chits,\@chits,\chit@sng@cellupdate}
-% \begin{macrocode}
-\def\chit@sng@cellupdate(#1,#2)#3#4{%
- \chit@dbg{2}{Current `#1' vs `#4'*(`#3'+1)}
- \pgfmathparse{ifthenelse(#1>=#4*(#3-1),#2-#4,#2)}%
- \xdef#2{\pgfmathresult}%
- \pgfmathparse{ifthenelse(#1>=#4*(#3-1),0,#1+#4)}%
- \xdef#1{\pgfmathresult}%
-}
-% \end{macrocode}
-%
-% The stared version (\cs{chits*}) of this macro continues the
-% previously set chit table.
-%
-% \begin{macrocode}
-\def\chits{%
- \@ifstar{\chits@resetfalse\@chits}{\chits@resettrue\@chits}}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\def\@chits#1#2#3{
- \ifchits@reset
- \def\r{0}%
- \def\c{0}%
- \fi
- \chit@dbg{1}{Chits to make: #1}%
- \foreach[count=\ti from 0] \t/\x in #1{%
- \chit@dbg{2}{Turn `\t' with option `\x'}
- \ifx\t\empty\else%
- \foreach \u/\m in \t{%
- \ifx\u\empty\else%
- \chit@dbg{2}{Next chit `\u' with possible multiplicity `\m'}%
- \ifx\m\@empty\def\m{1}\fi%
- \ifx\u\m\def\m{1}\fi%
- \chit@dbg{2}{Next chit `\u' multiplicity `\m'}%
- \foreach \n in {1,...,\m}{%
- \ifx\u\chit@blank%
- \chit@dbg{3}{Ignoring blank chit:\u}%
- \else%
- \chit@cellbg(\c,\r){#3}%
- \chit[\u=\ti](\c,\r)%
- \chit@sng@cellupdate(\c,\r){#2}{#3}%
- \fi%
- }%
- \fi%
- }%
- \fi%
- }%
-}
-% \end{macrocode}
-% \end{Macro}
-%
-% \begin{Macro}{\doublechits,
-% \@doublechits,
-% \chit@dbl@cellupdate,
-% \chit@dbl@flip}
-% \begin{enumerate}
-% \item coordinates
-% \item coordinates
-% \item cell-size
-% \end{enumerate}
-%
-% \begin{macrocode}
-\def\chit@dbl@flip(#1,#2)#3{%
- \pgfmathparse{-#1}%
- \xdef\mc{\pgfmathresult}%
-}
-% \end{macrocode}
-%
-% \begin{enumerate}
-% \item coordinates
-% \item coordinates
-% \item Number of columns
-% \item cell-size
-% \end{enumerate}
-%
-% \begin{macrocode}
-\def\chit@dbl@cellupdate(#1,#2)#3#4{%
- \pgfmathparse{ifthenelse(#1<-#4/2,#2,#4+#2)}%
- \xdef#2{\pgfmathresult}%
- \pgfmathparse{ifthenelse(#1<-#4/2,#4+#1,-(#3-.5)*#4)}%
- \xdef#1{\pgfmathresult}%
-}
-% \end{macrocode}
-%
-% \begin{enumerate}
-% \item List of list of keys
-% \item Number of columns
-% \item size of each cell
-% \end{enumerate}
-%
-% The stared version (\cs{doublechits*}) of this macro continues the
-% previously set chit table.
-%
-% \begin{macrocode}
-\def\doublechits{%
- \@ifstar{\chits@resetfalse\@doublechits}{\chits@resettrue\@doublechits}}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\def\@doublechits#1#2#3{%
- \chit@dbg{1}{Setting double-sided chits: #1}
- \ifchits@reset
- \pgfmathparse{-(#2-.5)*#3}
- \xdef\c{\pgfmathresult}
- \def\r{0}
- \fi
-
- \foreach[count=\ti from 0] \t/\x in #1{
- \ifx\t\empty\else%
- \foreach \u/\m in \t{
- \ifx\u\empty\else
- \ifx\m\@empty\def\m{1}\else%
- \ifx\u\m\def\m{1}\fi\fi
- \chit@dbg{2}{`\u'=`\m' (\c,\r)}
- \foreach \n in {1,...,\m}{%
- \ifx\u\chit@blank
- \chit@dbg{3}{Ignoring blank chit:\u}
- \else
- \chit@cellbg(\c,\r){#3}
- \chit[\u=\ti](\c,\r)
- \chit@dbl@flip(\c,\r){#3}
- \chit@cellbg(\mc,\r){#3}
- \chit[\u\space flipped=\ti,zone turn=\t,zone mult=\n](\mc,\r)
- \chit@dbl@cellupdate(\c,\r){#2}{#3}
- \fi
- }
- \fi
- }
- \fi
- }
- \draw[dashed](0,-3*#3/4)--(0,\r-#3/4);
- \draw[dashed,<-] (#3/5,-2*#3/3)--(#3/2,-2*#3/3) node[anchor=west]{Back};
- \draw[dashed,<-] (-#3/5,-2*#3/3)--(-#3/2,-2*#3/3) node[anchor=east]{Front};
-}
-% \end{macrocode}
-% \end{Macro}
-%
-% \iffalse
+% <*chit>
% --------------------------------------------------------------------
% \fi
% \subsubsection{Some utilities}
@@ -395,17 +9,32 @@
%
% \begin{macrocode}
\tikzset{
- number chit/.pic={
- \node[shape=rectangle,font=\sffamily\bfseries\LARGE]{%
- \begin{tabular}{c} #1\end{tabular}};},
- game turn/.pic={
- \node[shape=rectangle,font=\sffamily\bfseries]{%
- \begin{tabular}{c} Game\\Turn\end{tabular}};},
- game turn/.style={
- /chit/full={game turn},
+ chit/text base/.style={
+ shape=rectangle,
+ inner sep=0pt,
+ align=center,
+ text width=1.1cm},
+ chit/number/.style={
+ chit/text base,
+ font=\sffamily\bfseries\fontsize{12}{14}\selectfont},
+ chit/game turn/.style={
+ chit/text base,
+ font=\sffamily\bfseries},
+ chit/text/.style={
+ chit/text base,
+ font=\sffamily\bfseries},
+ chit/small text/.style={
+ chit/text base,
+ font=\sffamily\bfseries\fontsize{9}{10}\selectfont},
+ chit/number/.pic={\node[chit/number]{#1};},
+ chit/game turn/.pic={\node[chit/game turn]{Game\\Turn};},
+ chit/text/.pic={\node[chit/text]{#1};},
+ chit/small text/.pic={\node[chit/small text]{#1};},
+ game turn chit/.style={
+ /chit/full={chit/game turn},
color=black,
fill=white},
- game turn flipped/.style={game turn},
+ game turn chit flipped/.style={game turn chit},
dummy chit/.style={fill=white},
}
% \end{macrocode}
@@ -435,7 +64,7 @@
%
% \begin{macrocode}
\DeclareRobustCommand\zocmark[1][]{%
- \tikz[baseline=(current bounding box.center),scale=.1,#1]{%
+ \tikz[baseline=($(current bounding box.center)!.5!(current bounding box.south)$),scale=.1,#1]{%
\begin{scope}[hex/first row and column are=0,
hex/row direction is=normal,
hex/column direction is=normal,
@@ -450,6 +79,10 @@
\end{scope}}}
% \end{macrocode}
%
+% Dummy implementations of zones hooks when exporting. Here, these do
+% nothing, but in the \textsf{wgexport} class these are
+% re-implemented.
+%
% \begin{macrocode}
\tikzset{
zone point/.code n args={3}{},
@@ -457,5 +90,5 @@
% \end{macrocode}
%
% \iffalse
-%</chit>
+% </chit>
% \fi
diff --git a/macros/latex/contrib/wargame/source/chit/modifiers.dtx b/macros/latex/contrib/wargame/source/chit/modifiers.dtx
new file mode 100644
index 0000000000..b42ee5790f
--- /dev/null
+++ b/macros/latex/contrib/wargame/source/chit/modifiers.dtx
@@ -0,0 +1,42 @@
+% \iffalse
+% --------------------------------------------------------------------
+% <*chit>
+% \fi
+% \subsubsection{Modifications to chits}
+%
+% These defines overlays one can add on top of chits, for example to
+% shade a chit, put a semi-transparent red cover to indicate
+% elimination, and similar.
+%
+% \begin{macrocode}
+\tikzset{
+ pics/chit/shade/.style={
+ code={%
+ \path[fill=white,opacity=#1,pic actions] (-.6,-.6) rectangle(.6,.6);}},
+ pics/chit/eliminate/.style={
+ code={%
+ \path[fill=red,opacity=#1,pic actions] (-.6,-.6) rectangle(.6,.6);}},
+ pics/chit/shade/.default=0.5,
+ pics/chit/eliminate/.default=0.25,
+ dummy chit/.style={draw=none,fill=none,chit={}},
+}
+\def\shadechit{%
+ \@ifnextchar[{\sh@dechit}{\sh@dechit[.5]}%]
+}
+\def\eliminatechit{%
+ \@ifnextchar[{\elimin@techit}{\elimin@techit[.25]}%]
+}
+\def\sh@dechit[#1](#2){%
+ % \message{^^JShading chit with opacity `#1'}%
+ \pic[transform shape] at (#2) {chit/shade=#1};%
+ \@ifnextchar;{\@gobble}{}}
+\def\elimin@techit[#1](#2){%
+ \pic[transform shape] at (#2) {chit/eliminate=#1};%
+ \@ifnextchar;{\@gobble}{}}
+% \end{macrocode}
+%
+%
+% \iffalse
+% --------------------------------------------------------------------
+% </chit>
+% \fi
diff --git a/macros/latex/contrib/wargame/source/chit/oob.dtx b/macros/latex/contrib/wargame/source/chit/oob.dtx
new file mode 100644
index 0000000000..d640dadebf
--- /dev/null
+++ b/macros/latex/contrib/wargame/source/chit/oob.dtx
@@ -0,0 +1,172 @@
+% \iffalse
+% <*chit>
+% --------------------------------------------------------------------
+% \fi
+% \subsubsection{Making order of battle charts}
+%
+%
+% Macros for making OOBs
+%
+% Style for turns
+%
+% \begin{macrocode}
+\tikzset{
+ chit/oob turn/.pic={\node[pic actions]{#1};}}
+% \end{macrocode}
+%
+%
+% current c, current r, n-columns, cell size, y
+%
+% \begin{macrocode}
+\def\chit@oob@cellupdate(#1,#2)#3#4#5{%
+ \edef\f{\ifwg@oob@inv-1\else1\fi}%
+ \chit@dbg{1}{ \space Cell update `c=|#1|' vs `#4'*(`#3'-1)}
+ \pgfmathparse{int(ifthenelse(abs(#1)>=#4*(#3-1),#5-1,#5))}%
+ \xdef#5{\pgfmathresult}
+ \pgfmathparse{ifthenelse(abs(#1)>=#4*(#3-1),#2-#4,#2)}%
+ \xdef#2{\pgfmathresult}%
+ \pgfmathparse{ifthenelse(abs(#1)>=#4*(#3-1),0,#1+\f*#4)}%
+ \xdef#1{\pgfmathresult}%
+ \chit@dbg{1}{ \space\space-> `\string#5'=#5 `\string#2'=#2 `\string#1'=#1}
+}
+% \end{macrocode}
+%
+% current c, current r, cell size, extra vertical spacing
+%
+% \begin{macrocode}
+\def\chit@oob@rowupdate(#1,#2)#3#4{%
+ \chit@dbg{2}{ Row update c=`#1',r=`#2',s=`#3',e=`#4'}
+ %\pgfmathparse{ifthenelse(#1>0,#2-#3,#2)}%
+ \pgfmathparse{#2-#3)}%
+ \xdef#2{\pgfmathresult}%
+ %\xdef#1{0}
+ \chit@dbg{2}{ \space\space-> update `\string#2'=#2}
+}
+% \end{macrocode}
+% current c, current r, cell size, extra spacing
+%
+% \begin{macrocode}
+\def\chit@oob@turnupdate(#1,#2)#3#4{%
+ \chit@dbg{2}{ Turn update c=`#1',r=`#2',s=`#3',e=`#4'}
+ % \pgfmathparse{#2-ifthenelse(#1>0,#3,0)-#4}%
+ \pgfmathparse{#2-#4-ifthenelse(abs(#1)>0.0001,#3,0)}
+ \xdef#2{\pgfmathresult}%
+ \xdef#1{0}%
+ \chit@dbg{2}{ \space\space-> update `\string#1'=#1,`\string#2'=#2}
+}
+% \end{macrocode}
+% chit list, n-colls, cell size, extra vertical spacing
+%
+% This expects a list of lists of chits, one list per turn; the
+% maximum number of columns; the size of cells, extra spacing between
+% turns.
+%
+% Note, the list of lists leaf elements should be styles for the
+% chits.
+%
+% This depends on the Tikz pic \texttt{chit/oob~turn} which takes the
+% number as argument.
+%
+%
+% \begin{macrocode}
+\newif\ifwg@oob@inv\wg@oob@invfalse
+\def\chit@oob@spacer{hspace}
+\def\wg@star@oob{\wg@oob@invtrue\wg@oob}
+\def\wg@nostar@oob{\wg@oob@invfalse\wg@oob}
+\def\oob{%
+ \@ifstar{\wg@star@oob%
+ }{\wg@nostar@oob%
+ }%
+}
+% \end{macrocode}
+%
+% The inner macro of \cs{oob}. The arguments are
+% \begin{enumerate}
+% \item The list of lists of chits styles
+% \item The maximum number of columns
+% \item The width of each cell
+% \item Additional row spacing between turns
+% \end{enumerate}
+%
+% \begin{macrocode}
+\def\wg@oob#1#2#3#4{
+ \def\r{0}
+ \chit@dbg{2}{OOB: `#1'}
+ \foreach[count=\ti from 0] \t/\y in #1{
+ \xdef\o{\r}
+ \def\c{0}
+ \ifx\t\y\def\y{0}\fi
+ \chit@dbg{2}{Turn \ti\space(\r,\t,y=\y):'}
+ \ifwg@oob@inv%
+ \pic[transform shape] at ( .5*#3,\r) {chit/oob turn=\ti};% was dx=0.5
+ \else
+ \pic[transform shape] at (-.5*#3,\r) {chit/oob turn=\ti};% was dx=-0.5
+ \fi%
+ \ifx\t\empty\else%
+ \foreach \u/\m in \t{
+ %% \chit@dbg{2}{ `\u'=`\m'}
+ \ifx\u\empty\else
+ \ifx\m\@empty\def\m{1}\fi
+ \ifx\u\m\def\m{1}\fi
+ \foreach \n in {1,...,\m}{%
+ \chit@dbg{2}{OOB Chit is `\u'}%
+ \ifx\u\chit@oob@spacer%
+ \chit@dbg{3}{Chit `\u' is spacer `\chit@oob@spacer'}
+ \pgfmathparse{\c+#4}%
+ \xdef\c{\pgfmathresult}%
+ \else
+ \ifnum\chitdbglvl>2%
+ \node[minimum width=#3cm,minimum height=#3cm,
+ draw,transform shape] at (\c,\r) {};
+ \fi
+ \ifx\u\chit@blank\else%
+ \chit[\u=\ti,zone oob point={\u}{\c}{\r}](\c,\r);%
+ \fi%
+ \chit@oob@cellupdate(\c,\r){#2}{#3}{\y}
+ \fi
+ }
+ \fi
+ }
+ \fi
+ \chit@dbg{1}{ End of chits in turn
+ \ti\space(c=`\c',r=`\r',o='\o',y='\y')}
+ % IF no units where given, then we force \c to be non-zero so that
+ % \chit@oob@turnupdate increments the row
+ \ifx\t\@empty
+ \def\c{#3}
+ \chit@dbg{2}{ Turn is empty, set c=`\c'}
+ \fi
+ %\ifnum\y<0% No explicit number of rows given
+ % \def\c{#3}
+ % \chit@dbg{2}{ No explicit number of rows given, set c=`\c'}
+ %\fi
+ % In case the user gave and explicit number of rows, add the rows
+ % that are missing. \y is initially set to the number of
+ % requested rows, and then decremented every time we go down one
+ % row. So if the number of rows we did so far is N, and the
+ % requested number of rows is M, then the loop below adds M-N
+ % rows.
+ \ifnum\y>0%
+ \chit@dbg{2}{ Looping rows from 2 to \y, break when row > \y}%
+ \foreach \rr in {2,...,\y}{
+ %\ifnum\rr>\y% A little funny, but \y can be negative!
+ % \chit@dbg{2}{ \space Breaking loop \rr\space > \y}%
+ % \breakforeach%
+ %\else%
+ \chit@oob@rowupdate(\c,\r){#3}{#4}
+ %\fi
+ }
+ \fi
+ % This will zero \c. However, if on entry |\c|>0, then we also
+ % increment the row
+ \chit@oob@turnupdate(\c,\r){#3}{#4}
+ \chit@dbg{2}{End of turn \ti\space(c=`\c',r=`\r',o='\o',y='\y')}
+ }
+ \chit@dbg{3}{End of OOB (c=`\c',r=`\r',y=`\y')}
+ \@ifnextchar;{\@gobble}{}}
+% \end{macrocode}
+%
+% \iffalse
+% </chit>
+% --------------------------------------------------------------------
+% \fi
diff --git a/macros/latex/contrib/wargame/source/chit/shape.dtx b/macros/latex/contrib/wargame/source/chit/shape.dtx
index 8ad0614cb8..8a3d70fbd0 100644
--- a/macros/latex/contrib/wargame/source/chit/shape.dtx
+++ b/macros/latex/contrib/wargame/source/chit/shape.dtx
@@ -4,6 +4,19 @@
% \fi
%
% \subsubsection{The \texttt{chit} key namespace}
+%
+% Some stuff to consider wrt.~line widths. Setting the line width in
+% the \texttt{chit} scope overrides frame settings. The frame stroke
+% can be larger but not smaller. Setting the stroke width in the
+% symbol scope sets it for the symbol only. Thus, to get a thin
+% border, we need to
+% \begin{itemize}
+% \item Set a small line width in the top chit scope.
+% \item Possible set a larger line width in the frame sub-scope.
+% \item Set a larger line width in the symbol sub-scope.
+% \end{itemize}
+% I do not know why this is.
+%
% \begin{TikzKey}{/chit/full,
% /chit/symbol,
% /chit/left,
@@ -13,12 +26,15 @@
% /chit/lower left,
% /chit/lower right,
% /chit/factors,
+% /chit/extra,
% /chit/setup,
+% /chit/bevel,
% /chit/id}
%
% The parts of a chit
%
% \begin{macrocode}
+\newif\ifchit@clip\chit@cliptrue
\tikzset{%
/chit/.search also={/tikz},
/chit/.cd,
@@ -36,6 +52,21 @@
setup/.store in=\chit@setup, setup/.initial=,%
id/.store in=\chit@id, id/.initial=,%
frame/.store in=\chit@frame, frame/.initial=,%
+ extra/.store in=\chit@extra, extra/.initial=,%
+ bev/.store in=\chit@bevel, bev/.initial=,
+ bevel fraction/.store in=\chit@bevel@frac,bevel fraction/.initial=10,
+ bevel/.is choice,
+ bevel/none/.style = {/chit/bev=},
+ bevel/north west/.style = {/chit/bev=1},
+ bevel/north east/.style = {/chit/bev=2},
+ bevel/south west/.style = {/chit/bev=3},
+ bevel/south east/.style = {/chit/bev=4},
+ bevel/NW/.style = {/chit/bev=1},
+ bevel/NE/.style = {/chit/bev=2},
+ bevel/SW/.style = {/chit/bev=3},
+ bevel/SE/.style = {/chit/bev=4},
+ bevel/.default = north west,
+ clip/.is if=chit@clip%
}
% \end{macrocode}
% \end{TikzKey}
@@ -69,7 +100,28 @@
chit/lower right/.style={chit/parts,anchor=south east},
chit/setup/.style={chit/parts},
chit/full/.style={chit/parts},
+ chit/frame/.try={draw=pgfstrokecolor},
+ chit/bevel highlight/.style={fill=white,opacity=.25},
+ chit/bevel shadow/.style={fill=black,opacity=.25},
}
+\def\chit@bevel@frac{10}
+\newif\ifchit@draw@frame\chit@draw@frametrue
+\tikzset{
+ chit/frame style/.search also={/tikz},
+ chit/frame style/.cd,
+ none/.code={\chit@draw@framefalse},
+ draw/.code={%
+ \chit@dbg{2}{Frame draw option `#1'}
+ \edef\tikz@temp{#1}%
+ \ifx\tikz@temp\tikz@nonetext%
+ \chit@draw@framefalse%
+ \else%
+ \chit@draw@frametrue%
+ \tikzset{/tikz/draw=#1}
+ \fi
+ }
+}
+
% \end{macrocode}
% \end{TikzKey}
%
@@ -116,7 +168,7 @@
% \begin{macrocode}
\def\chit@n@to#1#2{%
%% Without a following start square bracket '[' by-pass to final
- \chit@dbg{4}{Chit NATO App6(c) first step `#1' `#2'}
+ \chit@dbg{1}{Chit NATO App6(c) first step `#1' `#2'}
\@ifnextchar[{%
%\message{^^JStart square bracket}%
\@chit@n@to{#1}{#2}}{%
@@ -129,7 +181,7 @@
%
% \begin{macrocode}
\def\@chit@n@to@#1#2#3\@end@chit@n@to{%
- \chit@dbg{4}{Chit NATO App6(c) w/o offset:
+ \chit@dbg{1}{Chit NATO App6(c) w/o offset:
^^J Options: #3
^^J ID: #1
^^J Position: #2}
@@ -143,7 +195,7 @@
%
% \begin{macrocode}
\def\@chit@n@to#1#2[#3]{%
- \chit@dbg{4}{Chit NATO App6(c) second step `#1' `#2' `#3'}
+ \chit@dbg{1}{Chit NATO App6(c) second step `#1' `#2' `#3'}
\@ifnextchar({\@@chit@n@to{#1}{#2}{#3}}{\@@chit@n@to{#1}{#2}{#3}(0,0)}%)
}
% \end{macrocode}
@@ -152,7 +204,7 @@
%
% \begin{macrocode}
\def\@@chit@n@to#1#2#3(#4)\@end@chit@n@to{%
- \chit@dbg{4}{Chit NATO App6(c) w/offset:
+ \chit@dbg{1}{Chit NATO App6(c) w/offset:
^^J Options: #3
^^J ID: #1
^^J Position: #2
@@ -186,8 +238,39 @@
%
% Now follows the actual \text{chit} shape. This is rather long, so
% we will break it up a bit
-%
-%
+% \begin{macrocode}
+\def\chit@bevel@path#1{
+ \scope[#1]
+ \wg@tmpc=\wg@tmpa\multiply\wg@tmpc by \chit@bevel@frac
+ \wg@tmpd=\wg@tmpb\multiply\wg@tmpd by \chit@bevel@frac
+ \divide\wg@tmpc100
+ \divide\wg@tmpd100
+ \pgfpathmoveto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
+ % Move down along edge
+ \wg@tmpb=-\wg@tmpb
+ \pgfpathlineto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
+ % Move left along edge
+ \wg@tmpa=-\wg@tmpa
+ \pgfpathlineto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
+ % Move in and up
+ \advance\wg@tmpa\wg@tmpc%
+ \advance\wg@tmpb\wg@tmpd%
+ \pgfpathlineto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
+ % Move right, but in
+ \advance\wg@tmpa-\wg@tmpc\wg@tmpa=-\wg@tmpa%
+ \advance\wg@tmpa-\wg@tmpc%
+ \pgfpathlineto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
+ % Move up but down
+ \advance\wg@tmpb-\wg@tmpd\wg@tmpb=-\wg@tmpb%
+ \advance\wg@tmpb-\wg@tmpd%
+ \pgfpathlineto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
+ \pgfclosepath%
+ \pgfusepath{fill}
+ \endscope
+}
+
+% \end{macrocode}
+%
% The first thing is we declare some saved anchors. These are
% computed (and defined as internal macros) when the shape is
% instantised. The anchors give the centre and north east corner of
@@ -224,7 +307,7 @@
\let\chitframeopt\pgfutil@empty%
\@ifundefined{chit@frame}{}{%
\edef\chitframeopt{\chit@frame}}
- \n@to@pp@dbg{3}{Chit Frame options: \meaning\chitframeopt}%
+ \chit@dbg{3}{Chit Frame options: \meaning\chitframeopt}%
}
% \end{macrocode}
%
@@ -296,6 +379,7 @@
\backgroundpath{%
%% This is the outline of the chit only. The rest of the chit is
%% made on the foreground "path".
+ \chit@dbg{1}{Chit drawing background path}
\northeast%
\wg@tmpa=\pgf@x\wg@tmpb=\pgf@y%
\pgfpathmoveto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
@@ -314,29 +398,38 @@
%
% \begin{macrocode}
\behindforegroundpath{%
- \chit@dbg{4}{%
- Chit foreground: \meaning\id
- ^^J ID (set): \meaning\chit@id
- ^^J Symbol: \meaning\chit@symbol
- ^^J Full: \meaning\chit@full
- ^^J Factors: \meaning\chit@factors
- ^^J Left: \meaning\chit@left
- ^^J Right: \meaning\chit@right
- ^^J Upper left: \meaning\chit@upper@left
- ^^J Lower left: \meaning\chit@lower@left
- ^^J Upper right: \meaning\chit@upper@right
- ^^J Lower right: \meaning\chit@lower@right}
+ \chit@dbg{1}{Chit drawing foreground path}
+ % \chit@dbg{4}{%
+ % Chit foreground: \meaning\id
+ % ^^J ID (set): \meaning\chit@id
+ % ^^J Symbol: \meaning\chit@symbol
+ % ^^J Full: \meaning\chit@full
+ % ^^J Factors: \meaning\chit@factors
+ % ^^J Left: \meaning\chit@left
+ % ^^J Right: \meaning\chit@right
+ % ^^J Upper left: \meaning\chit@upper@left
+ % ^^J Lower left: \meaning\chit@lower@left
+ % ^^J Upper right: \meaning\chit@upper@right
+ % ^^J Lower right: \meaning\chit@lower@right
+ % ^^J Extra: \meaning\chit@extra
+ % ^^J Bevel: \meaning\chit@bevel
+ % ^^J Frame: \meaning\chit@frame}
+ \chit@dbg{1}{Chit report}
\chit@report{}
+ \chit@dbg{1}{Chit start scope}
\pgfscope
%
- \northeast%
- \wg@tmpa=\pgf@x\wg@tmpb=\pgf@y%
- \pgfpathmoveto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
- \wg@tmpa=-\wg@tmpa \pgfpathlineto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
- \wg@tmpb=-\wg@tmpb \pgfpathlineto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
- \wg@tmpa=-\wg@tmpa \pgfpathlineto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
- \pgfclosepath
- \pgfusepath{clip}
+ \ifchit@clip%
+ \chit@dbg{1}{Chit clip path}
+ \northeast%
+ \wg@tmpa=\pgf@x\wg@tmpb=\pgf@y%
+ \pgfpathmoveto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
+ \wg@tmpa=-\wg@tmpa \pgfpathlineto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
+ \wg@tmpb=-\wg@tmpb \pgfpathlineto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
+ \wg@tmpa=-\wg@tmpa \pgfpathlineto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
+ \pgfclosepath%
+ \pgfusepath{clip}%
+ \fi%
% \end{macrocode}
%
% If we do not have the \texttt{symbol} key set, then we set the
@@ -346,19 +439,22 @@
\@ifundefined{chit@symbol}{%
%% Draw full stuff
\@ifundefined{chit@full}{}{%
+ \chit@dbg{1}{Chit draw full image: `\meaning\chit@full'}
\center\wg@tmpa=\pgf@x\wg@tmpb=\pgf@y%
\wg@pic@all{\chit@full}{}{\the\wg@tmpa,\the\wg@tmpb}{chit/full}}%
- }{%
+ }{% With NATO symbol
% \end{macrocode}
%
% Otherwise, we put in a node with shape \texttt{natoapp6c} and pass
% the \texttt{symbol} key--value pairs as options.
%
% \begin{macrocode}
+ \chit@dbg{1}{Chit draw symbol image}
\edef\symid{\id symbol}%
\symbol%
\edef\args{{\symid}{\the\pgf@x,\the\pgf@y}\chit@symbol}%
\chit@dbg{6}{Arguments to chit NATO symbol: \meaning\args}%
+ \chit@dbg{1}{Chit draw nato image}
\expandafter\chit@n@to\args\@end@chit@n@to%
\chit@dbg{6}{After making NATO symbol in chit}%
% \end{macrocode}
@@ -378,6 +474,7 @@
% \begin{macrocode}
% Put in left of symbol
\@ifundefined{chit@left}{}{%
+ \chit@dbg{1}{Chit draw left: `\meaning\chit@left'}
\begin{scope}[]
\pgfpointanchor{\symid}{west}%
\wg@tmpa=\pgf@x\advance\wg@tmpa-\margin%
@@ -386,6 +483,7 @@
\end{scope}}%
% Put in right of symbol
\@ifundefined{chit@right}{}{%
+ \chit@dbg{1}{Chit draw left: `\meaning\chit@right'}
\begin{scope}[]
\pgfpointanchor{\symid}{east}%
\wg@tmpa=\pgf@x\advance\wg@tmpa+\margin%
@@ -416,24 +514,28 @@
% \begin{macrocode}
% Put in upper left corner
\@ifundefined{chit@upper@left}{}{%
+ \chit@dbg{1}{Chit draw upper left: `\meaning\chit@upper@left'}
\begin{scope}[]
\wg@pic@all{\chit@upper@left}{}{-\the\wg@tmpa,\the\wg@tmpb}{%
chit/upper left}%
\end{scope}}
% Put in upper right corner
\@ifundefined{chit@upper@right}{}{%
+ \chit@dbg{1}{Chit draw upper right: `\meaning\chit@upper@right'}
\begin{scope}[]
\wg@pic@all{\chit@upper@right}{}{\the\wg@tmpa,\the\wg@tmpb}{%
chit/upper right}%
\end{scope}}
% Put in lower left corner
\@ifundefined{chit@lower@left}{}{%
+ \chit@dbg{1}{Chit draw lower left: `\meaning\chit@lower@left'}
\begin{scope}[]
\wg@pic@all{\chit@lower@left}{}{-\the\wg@tmpa,-\the\wg@tmpb}{%
chit/lower left}%
\end{scope}}
% Put in lower right corner
\@ifundefined{chit@lower@right}{}{%
+ \chit@dbg{1}{Chit draw lower right: `\meaning\chit@lower@right'}
\begin{scope}[]
\wg@pic@all{\chit@lower@right}{}{\the\wg@tmpa,-\the\wg@tmpb}{%
chit/lower right}%
@@ -448,24 +550,62 @@
% \begin{macrocode}
% Put in factors
\@ifundefined{chit@factors}{}{%
+ \chit@dbg{1}{Chit draw factors: `\meaning\chit@factors'}
\advance\wg@tmpb-\margin%
\begin{scope}[]
\wg@pic@all{\chit@factors}{}{0,-\the\wg@tmpb}{chit/factors}%
\end{scope}}%
- }%
+ % Put in extra
+ \@ifundefined{chit@extra}{}{%
+ \chit@dbg{1}{Chit draw extra: `\meaning\chit@extra'}
+ \begin{scope}[]
+ \wg@pic@all{\chit@extra}{}{0,0}{chit/factors}%
+ \end{scope}}%
+ }% End of full or symbol
\endpgfscope%
+ % Make bevel?
+ \@ifundefined{chit@bevel}{\let\chit@bevel\empty}{}
+ \ifx\chit@bevel\empty\else%
+ \chit@dbg{1}{Chit draw bevel}
+ %% South east bevel
+ \northeast%
+ \wg@tmpa=-\pgf@x\wg@tmpb=-\pgf@y%
+ \ifcase\chit@bevel\relax%
+ \or% 1
+ \or\wg@tmpa=-\wg@tmpa% 2
+ \or\wg@tmpb=-\wg@tmpb% 3
+ \or\wg@tmpa=-\wg@tmpa\wg@tmpb=-\wg@tmpb%4
+ \fi
+ \chit@bevel@path{chit/bevel highlight}
+ %% North west bevel
+ \northeast%
+ \wg@tmpa=\pgf@x\wg@tmpb=\pgf@y%
+ \ifcase\chit@bevel\relax%
+ \or% 1
+ \or\wg@tmpa=-\wg@tmpa% 2
+ \or\wg@tmpb=-\wg@tmpb% 3
+ \or\wg@tmpa=-\wg@tmpa\wg@tmpb=-\wg@tmpb%4
+ \fi
+ \chit@bevel@path{chit/bevel shadow}
+ \fi
% Draw frame?
- \edef\tmp@opt{[\chitframeopt]}
+ \chit@dbg{1}{Chit draw frame: `\meaning\chitframeopt'}
+ \edef\tmp@opt{[chit/frame style/.cd,chit/frame/.try,\chitframeopt]}
+ \chit@dbg{1}{Chit draw frame: `\meaning\tmp@opt}
\expandafter\scope\tmp@opt
- \northeast%
- \wg@tmpa=\pgf@x\wg@tmpb=\pgf@y%
- \pgfpathmoveto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
- \wg@tmpa=-\wg@tmpa \pgfpathlineto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
- \wg@tmpb=-\wg@tmpb \pgfpathlineto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
- \wg@tmpa=-\wg@tmpa \pgfpathlineto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
- \pgfclosepath
- \pgfusepath{stroke}
- \endscope
+ \northeast%
+ \wg@tmpa=\pgf@x\wg@tmpb=\pgf@y%
+ \pgfpathmoveto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
+ \wg@tmpa=-\wg@tmpa \pgfpathlineto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
+ \wg@tmpb=-\wg@tmpb \pgfpathlineto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
+ \wg@tmpa=-\wg@tmpa \pgfpathlineto{\pgfqpoint{\wg@tmpa}{\wg@tmpb}}%
+ \pgfclosepath%
+ \chit@dbg{3}{Line width for frame: `\the\pgflinewidth'}
+ \ifchit@draw@frame\pgfusepath{stroke}\fi%
+ \chit@draw@frametrue%
+ %\iftikz@mode@fill\pgfusepath{fill}\fi%
+ \endscope%
+ \chit@dbg{1}{Chit end of shape}
}
}
% \end{macrocode}
@@ -527,7 +667,7 @@
^^J Name: `#3'}
\let\name\pgfutil@empty%
\chit@dbg{1}{=== Before chit node}%
- \node[draw,chit={every chit/.try,id=#3,#1}] (tmp) at (#2) {};
+ \node[chit={every chit/.try,id=#3,#1}] (tmp) at (#2) {};
\chit@dbg{2}{=== After chit node}%
\ifx|#3|\relax%
\else%
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
diff --git a/macros/latex/contrib/wargame/source/chit/table.dtx b/macros/latex/contrib/wargame/source/chit/table.dtx
new file mode 100644
index 0000000000..7094e436ed
--- /dev/null
+++ b/macros/latex/contrib/wargame/source/chit/table.dtx
@@ -0,0 +1,176 @@
+% \iffalse
+% <*chit>
+% --------------------------------------------------------------------
+% \fi
+% \subsubsection{Table of chits}
+%
+% \begin{macrocode}
+\tikzset{
+ chit/cell background/.style={fill=black},
+ blank chit/.style={/chit/frame={draw=none,fill=none}},
+}
+% \end{macrocode}
+%
+% These macros are used when we set tables of chits. This allows us
+% to define blank spaces in the table by giving the element
+% \texttt{blank~chit}.
+%
+% \begin{macrocode}
+\def\chit@blank{blank chit}
+\def\chit@cellbg(#1,#2)#3{%
+ \draw[chit/cell background](#1-#3/2,#2-#3/2) rectangle++(#3,#3);
+}
+% \end{macrocode}
+%
+% \begin{Macro}{\ifchits@reset}
+%
+% This `if' controls whether to reset the coordinates to the origin
+% when \cs{chits} is called. If true, then reset for a new table.
+%
+% \begin{macrocode}
+\newif\ifchits@reset\chits@resettrue
+% \end{macrocode}
+% \end{Macro}
+%
+% \begin{Macro}{\chits,\@chits,\chit@sng@cellupdate}
+% \begin{macrocode}
+\def\chit@sng@cellupdate(#1,#2)#3#4{%
+ \chit@dbg{2}{Current `#1' vs `#4'*(`#3'+1)}
+ \pgfmathparse{ifthenelse(#1>=#4*(#3-1),#2-#4,#2)}%
+ \xdef#2{\pgfmathresult}%
+ \pgfmathparse{ifthenelse(#1>=#4*(#3-1),0,#1+#4)}%
+ \xdef#1{\pgfmathresult}%
+}
+% \end{macrocode}
+%
+% The stared version (\cs{chits*}) of this macro continues the
+% previously set chit table.
+%
+% \begin{macrocode}
+\def\chits{%
+ \@ifstar{\chits@resetfalse\@chits}{\chits@resettrue\@chits}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\def\@chits#1#2#3{
+ \ifchits@reset
+ \def\r{0}%
+ \def\c{0}%
+ \fi
+ \chit@dbg{1}{Chits to make: #1}%
+ \foreach[count=\ti from 0] \t/\x in #1{%
+ \chit@dbg{2}{Turn `\t' with option `\x'}
+ \ifx\t\empty\else%
+ \foreach \u/\m in \t{%
+ \ifx\u\empty\else%
+ \chit@dbg{2}{Next chit `\u' with possible multiplicity `\m'}%
+ \ifx\m\@empty\def\m{1}\fi%
+ \ifx\u\m\def\m{1}\fi%
+ \chit@dbg{2}{Next chit `\u' multiplicity `\m'}%
+ \foreach \n in {1,...,\m}{%
+ \ifx\u\chit@blank%
+ \chit@dbg{3}{Ignoring blank chit:\u}%
+ \else%
+ \chit@cellbg(\c,\r){#3}%
+ \chit[\u=\ti](\c,\r)%
+ \chit@sng@cellupdate(\c,\r){#2}{#3}%
+ \fi%
+ }%
+ \fi%
+ }%
+ \fi%
+ }%
+ \@ifnextchar;{\@gobble}{}}
+% \end{macrocode}
+% \end{Macro}
+%
+% \begin{Macro}{\doublechits,
+% \@doublechits,
+% \chit@dbl@cellupdate,
+% \chit@dbl@flip}
+% \begin{enumerate}
+% \item coordinates
+% \item coordinates
+% \item cell-size
+% \end{enumerate}
+%
+% \begin{macrocode}
+\def\chit@dbl@flip(#1,#2)#3{%
+ \pgfmathparse{-#1}%
+ \xdef\mc{\pgfmathresult}%
+}
+% \end{macrocode}
+%
+% \begin{enumerate}
+% \item coordinates
+% \item coordinates
+% \item Number of columns
+% \item cell-size
+% \end{enumerate}
+%
+% \begin{macrocode}
+\def\chit@dbl@cellupdate(#1,#2)#3#4{%
+ \pgfmathparse{ifthenelse(#1<-#4/2,#2,#4+#2)}%
+ \xdef#2{\pgfmathresult}%
+ \pgfmathparse{ifthenelse(#1<-#4/2,#4+#1,-(#3-.5)*#4)}%
+ \xdef#1{\pgfmathresult}%
+}
+% \end{macrocode}
+%
+% \begin{enumerate}
+% \item List of list of keys
+% \item Number of columns
+% \item size of each cell
+% \end{enumerate}
+%
+% The stared version (\cs{doublechits*}) of this macro continues the
+% previously set chit table.
+%
+% \begin{macrocode}
+\def\doublechits{%
+ \@ifstar{\chits@resetfalse\@doublechits}{\chits@resettrue\@doublechits}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\def\@doublechits#1#2#3{%
+ \chit@dbg{1}{Setting double-sided chits: #1}
+ \ifchits@reset
+ \pgfmathparse{-(#2-.5)*#3}
+ \xdef\c{\pgfmathresult}
+ \def\r{0}
+ \fi
+
+ \foreach[count=\ti from 0] \t/\x in #1{
+ \ifx\t\empty\else%
+ \foreach \u/\m in \t{
+ \ifx\u\empty\else
+ \ifx\m\@empty\def\m{1}\else%
+ \ifx\u\m\def\m{1}\fi\fi
+ \chit@dbg{2}{`\u'=`\m' (\c,\r)}
+ \foreach \n in {1,...,\m}{%
+ \ifx\u\chit@blank
+ \chit@dbg{3}{Ignoring blank chit:\u}
+ \else
+ \chit@cellbg(\c,\r){#3}
+ \chit[\u=\ti](\c,\r)
+ \chit@dbl@flip(\c,\r){#3}
+ \chit@cellbg(\mc,\r){#3}
+ \chit[\u\space flipped=\ti,zone turn=\t,zone mult=\n](\mc,\r)
+ \chit@dbl@cellupdate(\c,\r){#2}{#3}
+ \fi
+ }
+ \fi
+ }
+ \fi
+ }
+ \draw[dashed](0,-3*#3/4)--(0,\r-#3/4);%
+ \draw[dashed,<-] (#3/5,-2*#3/3)--(#3/2,-2*#3/3) node[transform shape,anchor=west]{Back};%
+ \draw[dashed,<-] (-#3/5,-2*#3/3)--(-#3/2,-2*#3/3) node[transform shape,anchor=east]{Front};%
+ \@ifnextchar;{\@gobble}{}}
+% \end{macrocode}
+% \end{Macro}
+%
+% \iffalse
+% </chit>
+% --------------------------------------------------------------------
+% \fi