Debian Codegraph @

texmf-dist/source/latex/wargame/util/compound.dtx

raw
1 % \iffalse
2 % --------------------------------------------------------------------
3 %<*utils>
4 % \fi
5 %
6 % \subsubsection{Pictures in compound nodes}
7 %
8 % \begin{Macro}{\wg@pic}
9 % The macro \cs{wg@pic} will render a \texttt{pic}. This is used by
10 % the \texttt{natoapp6cs}, \texttt{chit}, and \texttt{hex} node
11 % shapes extensively.
12 %
13 % The arguments are
14 % \begin{enumerate}
15 % \item Prefix
16 % \item Position
17 % \item Fixed options
18 % \item User options
19 % \item Picture.
20 % \end{enumerate}
21 %
22 % That is, the macro expects calls like
23 % \begin{Syntax}
24 % \cs{wg@pic}\oarg{options}\meta{picture}\cs{@endwg@pic}\marg{prefix}\marg{position}\marg{options}
25 % \end{Syntax}
26 %
27 % Note the \cs{@endwg@pic} at the end of the call to swallow up
28 % \meta{picture}. Typically this macro is used as
29 %
30 % \begin{Syntax}
31 % \cs{edef}\cs{args}\{\meta{something}\}
32 % \cs{expandafter}\cs{wg@pic}\cs{args}\cs{@endwg@pic}\marg{prefix}\parg{position}\marg{options}
33 % \end{Syntax}
34 %
35 % where \meta{something} typically expands to \oarg{user
36 % option}\meta{picture}
37 %
38 % First, the top-level macro \cs{wg@pic} that looks for user
39 % options.
40 %
41 % \begin{macrocode}
42 \def\wg@pic{%
43 \@ifnextchar[{\wg@@pic}{\wg@@pic[]}%]
44 }
45 % \end{macrocode}
46 %
47 % This macro then forwards to \cs{wg@@pic} to gobble up
48 % \meta{picture}.
49 %
50 % \begin{enumerate}
51 % \item User options
52 % \item Arguments
53 % \end{enumerate}
54 %
55 % \begin{macrocode}
56 \def\wg@@pic[#1]#2\@endwg@pic{%
57 \wg@dbg{2}{Options: `#1', picture: `#2'}%
58 \wg@@@pic{#1}{#2}%
59 }
60 % \end{macrocode}
61 %
62 % \begin{enumerate}
63 % \item User options
64 % \item Arguments
65 % \item Prefix
66 % \item Coordinates
67 % \item Fixed options
68 % \end{enumerate}
69 %
70 % \begin{macrocode}
71 \def\wg@@@pic#1#2#3#4#5{%
72 \ifx|#2|\wg@dbg{3}{No picture given}%
73 \else%
74 \wg@dbg{3}{^^JWG Pic:
75 ^^J User options: #1
76 ^^J Picture: #2
77 ^^J Prefix: #3
78 ^^J Coordinates: #4
79 ^^J Fixed options: #5}%
80 % \wg@dbg{2}{\string\pic[#5,#1] at (#4) {#3#2}}%
81 \pic[#5,#1] at (#4) {#3#2};%
82 \ifwg@s@ve%
83 \pgf@relevantforpicturesizetrue%
84 \begin{getbbl}%
85 \pic[draw=none,fill=none,transform shape] at (#4) {#3#2};%
86 \end{getbbl}%
87 \wg@dbg{5}{Clipping to local bounding box}%
88 \clip (L.south west) rectangle (L.north east);%
89 \pgf@relevantforpicturesizefalse \global\wg@s@vefalse%
90 \fi
91 \fi%
92 \wg@dbg{3}{End of WG Pic}
93 }
94 % \end{macrocode}
95 % \end{Macro}
96 %
97 %
98 % \begin{Macro}{\wg@pic@all}
99 %
100 % This macro sets all pictures in a list.
101 %
102 % \begin{enumerate}
103 % \item List
104 % \item Prefix
105 % \item Position
106 % \item Styles
107 % \end{enumerate}
108 %
109 %
110 % \begin{macrocode}
111 \def\wg@pic@all#1#2#3#4{%
112 \wg@dbg{2}{WG picture loop
113 ^^J List: \meaning#1
114 ^^J Prefix: `#2'
115 ^^J Position: `#3'
116 ^^J Styles: `#4'}
117 \foreach \p in #1{%
118 \wg@dbg{2}{WG picture element: \meaning\p}%
119 \expandafter\wg@pic\p\@endwg@pic {#2}{#3}{#4}%
120 }%
121 }
122 % \end{macrocode}
123 % \end{Macro}
124 %
125 % \iffalse
126 % --------------------------------------------------------------------
127 % \fi
128 %
129 % \subsubsection{Nodes in compound nodes}
130 %
131 % \begin{Macro}{\wg@node}
132 % The macro \cs{wg@node} will render a \texttt{node}. This can be
133 % used by the \texttt{natoapp6cs}, \texttt{chit}, and \texttt{hex}
134 % node shapes.
135 %
136 % The arguments are
137 % \begin{enumerate}
138 % \item Prefix
139 % \item Position
140 % \item Fixed options
141 % \item User options
142 % \item Body.
143 % \end{enumerate}
144 %
145 % That is, the macro expects calls like
146 % \begin{Syntax}
147 % \cs{wg@node}\oarg{options}\meta{body}\cs{@endwg@node}\marg{prefix}\marg{position}\marg{options}
148 % \end{Syntax}
149 %
150 % Note the \cs{@endwg@node} at the end of the call to swallow up
151 % \meta{body}. Typically this macro is used as
152 %
153 % \begin{Syntax}
154 % \cs{edef}\cs{args}\{\meta{something}\}
155 % \cs{expandafter}\cs{wg@node}\cs{args}\cs{@endwg@node}\marg{prefix}\parg{position}\marg{options}
156 % \end{Syntax}
157 %
158 % where \meta{something} typically expands to \oarg{user
159 % option}\meta{body}
160 %
161 % First, the top-level macro \cs{wg@node} that looks for user
162 % options.
163 %
164 % \begin{macrocode}
165 \def\wg@node{%
166 \@ifnextchar[{\wg@@node}{\wg@@node[]}%]
167 }
168 % \end{macrocode}
169 %
170 % This macro then forwards to \cs{wg@@node} to gobble up
171 % \meta{body}.
172 %
173 % \begin{enumerate}
174 % \item User options
175 % \item Arguments
176 % \end{enumerate}
177 %
178 % \begin{macrocode}
179 \def\wg@@node[#1]#2\@endwg@node{%
180 \wg@dbg{2}{Options: `#1', body: `#2'}%
181 \wg@@@node{#1}{#2}%
182 }
183 % \end{macrocode}
184 %
185 % \begin{enumerate}
186 % \item User options
187 % \item Arguments
188 % \item Prefix
189 % \item Coordinates
190 % \item Fixed options
191 % \end{enumerate}
192 %
193 % \begin{macrocode}
194 \def\wg@@@node#1#2#3#4#5{%
195 \ifx|#2|\wg@dbg{3}{No body given}%
196 \else%
197 \wg@dbg{3}{^^JWG Pic:
198 ^^J User options: #1
199 ^^J Body: #2
200 ^^J Prefix: #3
201 ^^J Coordinates: #4
202 ^^J Fixed options: #5}%
203 % \wg@dbg{2}{\string\pic[#5,#1] at (#4) {#3#2}}%
204 \node[#5,#1] at (#4) {#3#2};%
205 \fi%
206 \wg@dbg{3}{End of WG Node}
207 }
208 % \end{macrocode}
209 % \end{Macro}
210 %
211 %
212 % \begin{Macro}{\wg@node@all}
213 %
214 % This macro sets all pictures in a list.
215 %
216 % \begin{enumerate}
217 % \item List
218 % \item Prefix
219 % \item Position
220 % \item Styles
221 % \end{enumerate}
222 %
223 %
224 % \begin{macrocode}
225 \def\wg@node@all#1#2#3#4{%
226 \wg@dbg{2}{WG picture loop
227 ^^J List: \meaning#1
228 ^^J Prefix: `#2'
229 ^^J Position: `#3'
230 ^^J Styles: `#4'}
231 \foreach \p in #1{%
232 \wg@dbg{2}{WG picture element: \meaning\p}%
233 \expandafter\wg@node\p\@endwg@node {#2}{#3}{#4}%
234 }%
235 }
236 % \end{macrocode}
237 % \end{Macro}
238 %
239 % \iffalse
240 % --------------------------------------------------------------------
241 %</utils>
242 %\fi