summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/wargame/source/chit/elements.dtx
blob: 6585c94064ccfac222b320a46016f3980b7d889e (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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
% \iffalse
% --------------------------------------------------------------------
%<*chit>
% \fi
% 
% \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,
%   /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]{%
        {#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]{#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]{#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}
    \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\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=\fontsize{10}{12}\selectfont},
  chit/identifier/.style={
    shape=rectangle,
    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\fontsize{6}{7}\selectfont,
    inner sep=0,
    % text=pgfstrokecolor,
    draw=none,
    fill=none,
    transform shape,
  },
}
%    \end{macrocode}
% \end{TikzKey}
% \iffalse
%</chit>
% --------------------------------------------------------------------
% \fi