summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/wargame/source/chit/elements.dtx
blob: 8708ca2a15dc2e646fcfe33062611430be0f7d1b (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
% \iffalse
% --------------------------------------------------------------------
%<*chit>
% \fi
% 
% \subsubsection{Predefined \texttt{chit} element pictures}
%
% \begin{TikzKey}{/tikz/pics/chit/1 factor,
%   /tikz/pics/chit/2 factors,
%   /tikz/pics/chit/2 factors artillery,
%   /tikz/pics/chit/3 factors,
%   /tikz/pics/chit/4 factors,
%   /tikz/pics/chit/identifier,
%   /tikz/pics/chit/small identifier,
%   /tikz/pics/chit/identifier macro}
%
%   These pictures can be used as the value of \texttt{chit} keys.
%
%    \begin{macrocode}
\tikzset{%
  chit/1 factor/.pic={
    \chit@dbg{4}{ Chit 1 factor: #1}%
    \node[chit/factor,chit/1 factor,pic actions]{#1};},
  pics/chit/2 factors/.style args={#1,#2}{%
    code={%
      \chit@dbg{4}{ Chit 2 factors: #1 and #2}%
      \node[chit/factor,chit/2 factors,pic actions]{#1--#2};}},
  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};}},
  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};}},
  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};}},
  chit/identifier/.pic={
    \chit@dbg{4}{  Chit identifier: `#1'}% 
    \node[chit/identifier,pic actions]{#1};
  },
  chit/small identifier/.pic={
    \chit@dbg{4}{  Chit small identifier: `#1'}% 
    \node[chit/small identifier,pic actions]{#1};
  },
  chit/identifier macro/.pic={%
    \chit@dbg{4}{ Chit identifier macro: \meaning#1}
    \edef\chit@i@tmp{#1}
    \node[chit/identifier,pic actions]{\chit@i@tmp};},
}
%    \end{macrocode}
% \end{TikzKey}
% 
% \begin{TikzKey}{/tikz/chit/factor,
%   /tikz/chit/1 factor,
%   /tikz/chit/2 factors,
%   /tikz/chit/3 factors,
%   /tikz/chit/4 factors,
%   /tikz/chit/identifier,
%   /tikz/chit/small identifier}
%
%   Styles used by the above pictures.  Users can change these as they
%   see fit. 
%   
%    \begin{macrocode}
\tikzset{%
  chit/factor/.style={
    shape=rectangle,
    font=\sffamily\bfseries\large,
    anchor=base,
    inner sep=0,
    %text=pgfstrokecolor,
    draw=none,
    fill=none,
  },
  chit/1 factor/.style={},
  chit/2 factors/.style={},
  chit/3 factors/.style={},
  chit/4 factors/.style={text/.append style=\small},
  chit/identifier/.style={
    shape=rectangle,
    font=\sffamily\bfseries\scriptsize,
    inner sep=0,
    % text=pgfstrokecolor,
    draw=none,
    fill=none,
  },
  chit/small identifier/.style={
    shape=rectangle,
    font=\sffamily\bfseries\tiny,
    inner sep=0,
    % text=pgfstrokecolor,
    draw=none,
    fill=none,
  },
}
%    \end{macrocode}
% \end{TikzKey}
% \iffalse
%</chit>
% --------------------------------------------------------------------
% \fi