Debian Codegraph @

texmf-dist/doc/latex/sgame/sgame.tex

raw
1 %
2 % BaKoMa
3 %
4 \documentclass[12pt]{article}
5 \usepackage{mjoarti}
6 \usepackage{mathpazo}
7 \usepackage{pstricks}
8 \usepackage{pst-mjo,pst-node}
9 \usepackage{sgame}
10 \usepackage{url}
11
12 \oddsidemargin=0.38in
13 \topmargin0pt
14
15 \begin{document}
16
17 \renewcommand{\descriptionlabel}[1]{\hspace\labelsep
18 \normalfont #1\phantom{.}}
19
20 \begin{center}
21 {\bfseries Manual for {\tt sgame.sty} and {\tt sgamevar.sty}}\\
22 by\\
23 Martin J. Osborne\\
24 {\tt [email protected]}\\
25 For Version 2.15, 2013-6-24
26 \end{center}
27
28 {\sloppy
29 \section{Introduction}
30 {\tt sgame.sty} and {\tt sgamevar.sty} are \LaTeXe\ style files for drawing
31 strategic games. The latest versions are available at
32 \begin{verse}
33 \url{http://www.economics.utoronto.ca/osborne/latex}.
34 \end{verse} The style
35 \texttt{sgamevar.sty} (but not \texttt{sgame.sty}) is compatible with
36 \texttt{beamer}. Both styles are incompatible with the \texttt{memoir} class
37 and with \texttt{tablularx.sty} and \texttt{array.sty} (and hence any package,
38 like \texttt{jurabib.sty}, that loads \texttt{array.sty}). Please notify me
39 of bugs.
40 \section{sgame.sty versus sgamevar.sty}
41 \verb+sgame.sty+ and \verb+sgamevar.sty+ differ in two respects.
42 \begin{itemize}
43 \item The character that ``tabs'' to a new column is \verb+&+ in
44 \verb+sgame.sty+ and \verb+\>+ in \verb+sgamevar.sty+. In every other respect
45 the syntax is identical. This manual applies to \verb+sgame.sty+. If you are
46 using \verb+sgamevar.sty+, replace every subsequent occurrence of \verb+&+ with
47 \verb+\>+.
48 \item \verb+sgame.sty+ produces a \verb+game+ environment that cannot be
49 used as an argument of a macro, whereas \verb+sgamevar.sty+ does not have this
50 limitation. You need to use \verb+sgamevar.sty+, for example, to be able to
51 make a \verb+game+ environment an argument of TeXPower's \verb+\stepwise+
52 macro.
53 \end{itemize}
54
55 (I prefer the \verb+&+ syntax, but have been unable to find a way of
56 implementing it without changing the \verb+\catcode+ of \verb+&+, which
57 prevents a \verb+game+ environment from being the argument of a macro.)
58 \section{Installation}
59 \begin{itemize}
60 \item Put \texttt{sgame.sty} (and/or \texttt{sgamevar.sty}) in a directory
61 from which \TeX\ reads input files. (In MiKTeX the directory might be
62 something like \verb+\miktex\localtexmf\tex\latex\+ or a subdirectory
63 thereof.)
64 \item Let \TeX\ know that \texttt{sgame} and/or \texttt{sgamevar} have
65 arrived. (In MiKTeX, ``refresh the filename database''.)
66 \item To use the package in a document, put the line
67 \verb+\usepackage{sgame}+ or \verb+\usepackage{sgamevar}+ in the preamble.
68 \end{itemize}
69 \section{Compatibility with other packages}
70 \begin{itemize}
71 \item The style is incompatible with \verb+colortbl.sty+.
72 \item In \verb+beamer+, use \verb+sgamevar+ (or put a game in a\newline
73 \verb+\begin{frame}[fragile]...\end{frame}+ environment).
74 \item In the case of incompatibilities with other styles, try using
75 \verb+sgamevar+ rather than \verb+sgame+.
76 \end{itemize}
77 \section{Description}
78 The style defines two environments, \verb+game+ and \verb+game*+. Each
79 environment can be used in four ways, depending on the values of its optional
80 arguments. In each case, the starred version differs from the unstarred
81 version in that action labels are not accommodated.
82 \subsection{No optional argument}
83 Without any optional arguments, the syntax for a game is\vspace*{4mm}\newline
84 \verb+\begin{game}{+\emph{number-of-rows}%
85 \verb+}{+\emph{number-of-columns}\verb+}+\emph{game-body}%
86 \verb+\end{game}+\vspace*{4mm}\newline
87 where \emph{number-of-rows} is the number of rows in the game and
88 \emph{number-of-columns} is the number of columns. \emph{game-body} consists
89 of rows in the style of the rows in a \verb+tabular+ environment, \verb+&+
90 ``tabbing'' to a new cell, and \verb+\\+ ending a row.
91
92 The following example is illustrated in Figure~\ref{f:ex1}.
93
94 \begin{verbatim}
95 \def\sgtextcolor{blue}%
96 \def\sglinecolor{red}%
97 \begin{figure}[htb]\hspace*{\fill}%
98 \begin{game}{2}{2}
99 & $L$ & $R$ \\
100 $T$ & $2,2$ & $100,35$ \\
101 $B$ & $3,0$ & $350,16$
102 \end{game}\hspace*{\fill}%
103 \begin{game*}{2}{2}
104 $2,2$ & $100,35$ \\
105 $3,0$ & $350,16$
106 \end{game*}\hspace*{\fill}%
107 \caption[]{A two row, two column strategic game, with and without
108 action labels.}
109 \end{figure}
110 \end{verbatim}
111
112 \def\sgtextcolor{blue}%
113 \def\sglinecolor{red}%
114 \begin{figure}[htb]\hspace*{\fill}%
115 \begin{game}{2}{2}
116 &$L$&$R$\\
117 $T$&$2,2$&$100,35$\\
118 $B$&$3,0$&$350,16$
119 \end{game}\hspace*{\fill}%
120 \begin{game*}{2}{2}
121 $2,2$&$100,35$\\
122 $3,0$&$350,16$
123 \end{game*}\hspace*{\fill}%
124 \caption[]{A two row, two column strategic game, with and without action
125 labels.}\label{f:ex1}
126 \end{figure}
127 \begin{itemize}
128 \item Note that the width of every column is the same and the
129 content of each cell is centered vertically.
130 \item As of version 2.15, spaces on either side of
131 the text in each cell are ignored, so you can add spaces to your input file to make it easier to read (or just for the heck of it, for that matter).\footnote{The claim in previous versions of this manual that this behavior held for earlier versions of the style file is incorrect.}
132 \item The first \verb+&+ {\bfseries must} be preceded by a space token
133 (space or carriage return). (It may not immediately follow the closing brace
134 of the second argument.)
135 \item If all the text in every cell of the payoff matrix is in math mode,
136 you can avoid typing all the \verb+$+'s by setting \verb+\gamemathtrue+,
137 either by putting this command in your file, or by changing
138 \verb+\gamemathfalse+ to \verb+\gamemathtrue+ in the style file. Under this
139 setting, all text in every cell of the payoff matrix is automatically in math
140 mode. (Note that even if the text in the cells consists only of
141 comma-separated pairs of numbers, it should still be in math mode, else the
142 spacing is not correct.)
143 \end{itemize}
144 \subsection{One optional argument: game label}
145 With one optional argument, the syntax of the \verb+game+ environment
146 is\vspace*{4mm}\newline
147 \verb+\begin{game}{+\emph{number-of-rows}%
148 \verb+}{+\emph{number-of-columns}\verb+}[+\emph{game-label}%
149 \verb+]+\emph{game-body}\newline\verb+\end{game}+\vspace*{4mm}\newline
150 where \emph{number-of-rows} is the number of rows in the game,
151 \emph{number-of-columns} is the number of columns, and \emph{game-label} is a
152 label for the game that is centered beneath the game. (The sense in which it
153 is centered may be changed by setting \verb+\irpawcgltrue+ or
154 \verb+\irplwcgltrue+---see Section~\ref{s:param}.) This case is useful if two
155 or more games are positioned side-by-side, and each requires a label.
156
157 The following example is illustrative.
158
159 \begin{verbatim}
160 \begin{figure}[htb]\hspace*{\fill}%
161 \begin{game}{2}{2}[$A$]
162 & $L$ & $R$\\
163 $a$ &$2,2,1$ &$0,3,0$\\
164 $b$ &$3,0,2$ &$1,1,4$
165 \end{game}\hspace*{20mm}%
166 \begin{game}{2}{2}[$B$]
167 & $L$ & $R$\\
168 $a$ &$2,3,0$ &$0,4,1$\\
169 $b$ &$3,1,2$ &$1,2,0$
170 \end{game}\hspace*{\fill}%
171 \caption[]{A three player strategic game, in which
172 player~3 chooses $A$ or $B$.}
173 \end{figure}
174 \end{verbatim}
175
176 \begin{figure}[htb]\hspace*{\fill}%
177 \begin{game}{2}{2}[$A$]
178 & $L$ & $R$\\
179 $a$ &$2,2,1$ &$0,3,0$\\
180 $b$ &$3,0,2$ &$1,1,4$
181 \end{game}\hspace*{20mm}%
182 \begin{game}{2}{2}[$B$]
183 & $L$ & $R$\\
184 $a$ &$2,3,0$ &$0,4,1$\\
185 $b$ &$3,1,2$ &$1,2,0$
186 \end{game}\hspace*{\fill}%
187 \caption[]{A three player strategic game, in which player~3 chooses $A$ or
188 $B$.}\label{f:ex2}
189 \end{figure}
190 \subsection{Two optional arguments: player labels}
191 In the case of two optional arguments, the syntax of the \verb+game+
192 environment is\vspace*{4mm}\newline
193 \verb+\begin{game}{+\emph{number-of-rows}%
194 \verb+}{+\emph{number-of-columns}\verb+}[+\emph{row-player-label}%
195 \verb+]+\newline
196 \verb+[+\emph{column-player-label}%
197 \verb+]+\emph{game-body}\verb+\end{game}+\vspace*{4mm}\newline
198 where \emph{number-of-rows} is the number of rows in the game,
199 \emph{number-of-columns} is the number of columns, and \emph{row-player-label}
200 and \emph{column-player-label} are the names of the players.
201
202 The following example illustrates this case.
203
204 \begin{verbatim}
205 \begin{figure}[htb]\hspace*{\fill}%
206 \begin{game}{2}{3}[Player~1][Player~2]
207 & $L$ & $M$ & $R$\\
208 $T$ &$2,2$ &$2,0$ &$0,3$\\
209 $B$ &$3,0$ &$0,9$ &$1,1$
210 \end{game}\hspace*{\fill}%
211 \caption[]{A two row, three column strategic game with
212 player labels.}
213 \end{figure}
214 \end{verbatim}
215
216 \begin{figure}[htb]\hspace*{\fill}%
217 \begin{game}{2}{3}[Player~1][Player~2]
218 &$L$&$M$&$R$\\
219 $T$&$2,2$&$2,0$&$0,3$\\
220 $B$&$3,0$&$0,9$&$1,1$
221 \end{game}\hspace*{\fill}%
222 \caption[]{A two row, three column strategic game with player
223 labels.}\label{f:ex3}
224 \end{figure}
225 \subsection{Three optional arguments: player labels and game label}
226 The case of three optional arguments combines the two previous cases: the
227 syntax of the \verb+game+ environment is\vspace*{4mm}\newline
228 \verb+\begin{game}{+\emph{number-of-rows}%
229 \verb+}{+\emph{number-of-columns}\verb+}[+\emph{row-player-label}%
230 \verb+]+\newline
231 \verb+[+\emph{column-player-label}%
232 \verb+][+\emph{game-label}\verb+]+\emph{game-body}\verb+\end{game}+\vspace*{4m%
233 m}\newline
234 where \emph{number-of-rows} is the number of rows in the game,
235 \emph{number-of-columns} is the number of columns, \emph{row-player-label} and
236 \emph{column-player-label} are the names of the players, and \emph{game-label}
237 is a label for the game.
238
239 The following example illustrates this case.
240
241 \begin{verbatim}
242 \begin{figure}[htb]\hspace*{\fill}%
243 \begin{game}{2}{3}[Player~1][Player~2][$A$]
244 & $L$ & $M$ & $R$\\
245 $T$ &$2,2$ &$2,0$ &$0,3$\\
246 $B$ &$3,0$ &$0,9$ &$1,1$
247 \end{game}\hspace*{\fill}%
248 \caption[]{A two row, three column strategic game with
249 player labels and a label.}
250 \end{figure}
251 \end{verbatim}
252
253 \begin{figure}[htb]\hspace*{\fill}%
254 \begin{game}{2}{3}[Player~1][Player~2][$A$]
255 &$L$&$M$&$R$\\
256 $T$&$2,2$&$2,0$&$0,3$\\
257 $B$&$3,0$&$0,9$&$1,1$
258 \end{game}\hspace*{\fill}%
259 \caption[]{A two row, three column strategic game with player labels and a
260 label.}\label{f:ex4}
261 \end{figure}
262 \section{Cell formatting}
263 You may regard the format of the payoffs in the first column of the game in
264 Figure~\ref{f:ex5} as unsatisfactory, and the formatting in the left panel of
265 Figure~\ref{f:ex6} as superior. This latter formatting is implemented by
266 adding ``phantom'' minus signs before the ``2'' in the top left cell and
267 before the ``3'' in the bottom left cell. The top left cell, for example, is
268 entered as \verb+$-2,\phantom{-}2$+. (\verb+\phantom{<x>}+ leaves a space
269 whose size is equal to the size of the object \verb+<x>+.)
270 \begin{figure}[htb]\hspace*{\fill}%
271 \begin{game}{2}{2}
272 &$L$&$R$\\
273 $T$&$-2,2$&$0,3$\\
274 $B$&$3,-4$&$1,1$
275 \end{game}\hspace*{\fill}%
276 \caption[]{A strategic game.}\label{f:ex5}
277 \end{figure}
278
279 You may want to consider other formats. The right panel of Figure~\ref{f:ex6}
280 shows an alternative. This format is achieved be entering the element of each
281 cell as
282 \begin{quote}
283 \verb+\begin{array}{c}#1\\[1.6mm]#2\end{array}+,
284 \end{quote}
285 where \verb+#1+ is player~1's payoff and \verb+#2+ is player~2's payoff.
286 (Actually, I defined the macro
287 \begin{quotation}
288 \verb+\def\stackedpayoffs#1#2{%+
289
290 \verb+ \begin{array}{c}#1\\[1.6mm]#2\end{array}+
291
292 \verb+}+
293 \end{quotation}
294 and entered each element as \verb+\stackedpayoffs{#1}{#2}+. I set
295 \verb+\gamestretch+ to be 2.1 to improve the appearance of the game.)%
296 \def\stackedpayoffs#1#2{\begin{array}{c}#1\\[1.6mm]#2\end{array}}
297 \begin{figure}[htb]\hspace*{\fill}%
298 \begin{game}{2}{2}
299 &$L$&$R$\\
300 $T$&$-2,\phantom{-}2$&$0,3$\\
301 $B$&$\phantom{-}3,-4$&$1,1$
302 \end{game}\hspace*{\fill}%
303 \renewcommand{\gamestretch}{2.1}%
304 \begin{game}{2}{2}
305 &$L$&$R$\\
306 $T$&$\stackedpayoffs{-2}{2}$&$\stackedpayoffs{0}{3}$\\
307 $B$&$\stackedpayoffs{3}{-4}$&$\stackedpayoffs{1}{1}$
308 \end{game}\hspace*{\fill}%
309 \caption[]{Two alternative presentations of the game in
310 Figure~\protect\ref{f:ex5}.}\label{f:ex6}
311 \end{figure}
312
313 Figure~\ref{f:ex7} shows two more alternatives. The one on the left is
314 achieved by entering the element of each cell as
315 \begin{quote}
316 \verb+\begin{array}{rl}#1&\\[1.6mm]&#2\end{array}+,
317 \end{quote}
318 and the one on the left differs only in that there is a \verb+\phantom{-}+ in
319 front of player~2's payoff in the top left cell, player~1's payoff in the
320 bottom left cell, and player~2's payoffs in both of the right cells.%
321 \def\binmorepayoffs#1#2{\begin{array}{rl}#1&\\[1.6mm]&#2\end{array}}
322 \begin{figure}[htb]\hspace*{\fill}%
323 \renewcommand{\gamestretch}{2.1}%
324 \begin{game}{2}{2}
325 &$L$&$R$\\
326 $T$&$\binmorepayoffs{-2}{2}$&$\binmorepayoffs{0}{3}$\\
327 $B$&$\binmorepayoffs{3}{-4}$&$\binmorepayoffs{1}{1}$
328 \end{game}\hspace*{\fill}%
329
330 \vspace*{4mm}
331
332 \hspace*{\fill}%
333 \begin{game}{2}{2}
334 &$L$&$R$\\
335 $T$&$\binmorepayoffs{-2}{\phantom{-}2}$& $\binmorepayoffs{0}{\phantom{-}3}$\\
336 $B$&$\binmorepayoffs{\phantom{-}3}{-4}$& $\binmorepayoffs{1}{\phantom{-}1}$
337 \end{game}\hspace*{\fill}%
338 \caption[]{Two additional presentations of the game in
339 Figure~\protect\ref{f:ex5}.}\label{f:ex7}
340 \end{figure}
341 \section{Vertical position of text within cells}\label{s:VertPos}
342 The vertical distance between the lines at the top and bottom of a row in
343 \LaTeX's \verb+tabular+ environment is equal to \verb+\arraystretch+ times
344 \verb+\baselineskip+. The baseline of the text in each cell is placed 30\% of
345 the distance from the bottom line. Thus if \verb+\arraystretch+ is large
346 relative to the height of the text, the text is not near the middle of the
347 row. (See the left panel of Figure~\ref{f:VertPos}; or try setting
348 \verb+\arraystretch+ equal to 5 and process a document with a \verb+tabular+
349 environment.) (See the definitions of \verb+\strutbox+ and of \verb+\@array+
350 in \verb+latex.ltx+.)
351
352 \verb+sgame.sty+ makes the vertical distance between the lines at the top and
353 bottom of a row of a \verb+game+ the same (\verb+\arraystretch+ times
354 \verb+\baselineskip+), but places the baseline of the text in each cell so
355 that the distances above and below an upper case I placed on the baseline are
356 equal. (See the right panel of Figure~\ref{f:VertPos}.) (If you'd like to
357 use another character, define this character to be \verb+\sg@alignchar+.)
358 \begin{figure}[htb]
359 \hspace*{\fill}
360 \begin{pspicture}(80,55)
361 \psline(0,5)(30,5)
362 \psline(0,55)(30,55)
363 \psline[linecolor=lightgray](0,20)(30,20)
364 \rput[B](15,20){\fontsize{14mm}{10mm}\selectfont AygIx}
365 \psline[linecolor=lightgray]{<->}(15,5)(15,20)
366 \rput*(15,12.5){$0.3d$}
367 \psline[linecolor=lightgray]{<->}(15,20)(15,55)
368 \rput*(15,37.5){$0.7d$}
369 \rput[B](15,0){\texttt{tabular} environment}
370 %
371 \psline[linecolor=lightgray]{<->}(40,5)(40,55)
372 \rput*(40,30){$d$}
373 %
374 \psline(50,5)(80,5)
375 \psline(50,55)(80,55)
376 \psline[linecolor=lightgray](50,25)(80,25)
377 \psline[linecolor=lightgray](50,35)(80,35)
378 \rput[B](65,25){\fontsize{14mm}{10mm}\selectfont AygIx}
379 \psline[linecolor=lightgray]{<->}(65,5)(65,25)
380 \rput*(65,15){$x$}
381 \psline[linecolor=lightgray]{<->}(65,35)(65,55)
382 \rput*(65,45){$x$}
383 \rput[B](65,0){\texttt{game} environment}
384 \end{pspicture}
385 \hspace*{\fill}
386 \caption[]{Vertical positioning of text within cells in the \texttt{tabular}
387 and \texttt{game} environments.}\label{f:VertPos}
388 \end{figure}
389
390 If you want to use \verb+sgame+'s vertical positioning in your \verb+tabular+
391 environments, as well as your \verb+game+ environments, set
392 \verb+\gamevaligntrue+ before the environment. (If you want to switch back at
393 some point, you can do so by setting \verb+\gamevalignfalse+.)
394
395 If the height of the text in a cell exceeds \verb+\arraystretch+ times
396 \verb+\baselineskip+, then the height of the row is increased to accommodate
397 the text (just as the distance between lines of text is increased to
398 accommodate large text). The result is that the lines at the top and bottom
399 of the row touch the top and bottom of the text, and this row is taller than
400 the others. To improve the appearance of the table you may want to increase
401 \verb+\gamestretch+ (analogous to \verb+\arraystretch+), to put some white
402 space above and below your oversized text.
403
404 When \verb+\gamestretch+ is increased from 1, the height of \emph{every} row,
405 including the first row (the action labels), is increased. If you don't want
406 to increase the space under the action labels, declare \verb+\ssualfalse+.
407 (``ssual'' stands for ``stretch space under action labels''.) See
408 Figures~\ref{f:ssual1} and \ref{f:ssual2} for examples (for games with and
409 without player labels).%
410 \begin{figure}[htb]\hspace*{\fill}\renewcommand{\gamestretch}{3}%
411 \begin{game}{2}{2}
412 &$L$&$R$\\
413 $T$&$2,1$&$2,2$\\
414 $B$&$3,3$&$4,4$
415 \end{game}%
416 \hspace*{\fill}%
417 \ssualfalse%
418 \begin{game}{2}{2}
419 &$L$&$R$\\
420 $T$&$2,1$&$2,2$\\
421 $B$&$3,3$&$4,4$
422 \end{game}%
423 \hspace*{\fill}%
424 \caption[]{Positioning the action labels of the column player when
425 \texttt{gamestretch} is larger than 1, for a game without player labels. In
426 the left game we have \texttt{ssualtrue} (the default); in the right game
427 \texttt{ssualfalse} is declared.}\label{f:ssual2}
428 \end{figure}
429 \begin{figure}[htb]\hspace*{\fill}\renewcommand{\gamestretch}{3}%
430 \begin{game}{2}{2}[Player 1][Player 2]
431 &$L$&$R$\\
432 $T$&$2,1$&$2,2$\\
433 $B$&$3,3$&$4,4$
434 \end{game}%
435 \hspace*{\fill}%
436 \ssualfalse%
437 \begin{game}{2}{2}[Player 1][Player 2]
438 &$L$&$R$\\
439 $T$&$2,1$&$2,2$\\
440 $B$&$3,3$&$4,4$
441 \end{game}%
442 \hspace*{\fill}%
443 \caption[]{Positioning the action labels of the column player when
444 \texttt{gamestretch} is larger than 1, for a game with player labels. In the
445 left game we have \texttt{ssualtrue} (the default); in the right game
446 \texttt{ssualfalse} is declared.}\label{f:ssual1}
447 \end{figure}
448 \section{Thick lines}
449 To change the width of the cell boundaries, set \verb+\arrayrulewidth+ (by
450 writing something like \verb+\arrayrulewidth2mm+ or, if you prefer,
451 \verb+\setlength{\arrayrulewidth}{2mm}+). In addition, you may need to
452 stretch the game vertically to accommodate the thicker lines. To do so, set
453 \verb+\gamestretch+ (by writing something like
454 \verb+\renewcommand{\gamestretch}{2}+). Here's an example.
455
456 \begin{verbatim}
457 \def\sgtextcolor{blue}%
458 \def\sglinecolor{red}%
459 \renewcommand{\gamestretch}{2}
460 \arrayrulewidth2mm
461 \begin{figure}[htb]\hspace*{\fill}%
462 \begin{game}{2}{2}
463 & $L$ & $R$\\
464 $T$ &$2,2$ &$100,35$\\
465 $B$ &$3,0$ &$350,16$
466 \end{game}\hspace*{\fill}%
467 \caption[]{Thick lines.}
468 \end{figure}
469 \end{verbatim}
470
471 {
472 \def\sgtextcolor{blue}%
473 \def\sglinecolor{red}%
474 \renewcommand{\gamestretch}{2}
475 \arrayrulewidth2mm
476 \begin{figure}[htb]\hspace*{\fill}%
477 \begin{game}{2}{2}
478 & $L$ & $R$\\
479 $T$ &$2,2$ &$100,35$\\
480 $B$ &$3,0$ &$350,16$
481 \end{game}\hspace*{\fill}%
482 \caption[]{Thick lines.}
483 \end{figure}
484 }
485
486 \section{Crossing out actions}\label{s:crossingout}
487 If you know nothing about \LaTeX, you may think that creating
488 Figure~\ref{f:crossout} is easy. If you know a bit about \LaTeX, you may
489 think that creating it is impossible. Given PSTricks, the na\umlaut{\i}f is
490 right: all you need to do is add \verb+\usepackage{pstricks,pst-node}+ to the
491 preamble of your document, define a couple of macros specifying what the
492 strikeout lines should look like, add some node labels to the game, and
493 specify how the nodes should be connected. The only difficulty comes in
494 getting the lengths of the lines right. I have been unable to get the
495 parameters to work as they are described in Tim van Zandt's manual, but with
496 the help of BaKoMa Word it's easy to fiddle around with them until the lines
497 are the way you want them. The code for this game follows the figure.
498
499 \def\sgtextcolor{black}%
500 \def\sglinecolor{black}%
501 \newcommand\strike[2]{%
502 \ncline[linewidth=0.8pt,nodesep=8pt]{#1}{#2}}
503 \newcommand\redStrike[2]{%
504 \ncline[linewidth=0.8pt,nodesep=-14pt,linecolor=red]{#1}{#2}}
505
506 \begin{figure}[htb]\hspace*{\fill}%
507 \begin{game}{2}{2}
508 &\rnode[t]{a12}{$L$}&$R$\\
509 \Rnode[href=20]{a21}{$T$}&$1,1$&\Rnode{a23}{$2,2$}\\
510 $B$&\rnode[b]{a32}{$2,2$}&$3,3$
511 \end{game}%
512 \hspace*{\fill}%
513 \caption[]{Crossing out actions in a strategic game.}\label{f:crossout}
514 \end{figure}
515 \strike{a21}{a23}
516 \redStrike{a12}{a32}
517
518 \begin{verbatim}
519 \def\sgtextcolor{black}%
520 \def\sglinecolor{black}%
521 % define the strikeout lines
522 \newcommand\strike[2]{%
523 \ncline[linewidth=1.2pt,nodesep=8pt]{#1}{#2}}
524 \newcommand\redStrike[2]{%
525 \ncline[linewidth=1.2pt,nodesep=-14pt,linecolor=red]{#1}{#2}}
526
527 \begin{game}{2}{2}
528 &\rnode[t]{a12}{$L$} &$R$\\
529 \Rnode[href=20]{a21}{$T$} &$1,1$ &\Rnode{a23}{$2,2$}\\
530 $B$ &\rnode[b]{a32}{$2,2$} &$3,3$
531 \end{game}
532 % specify the nodes to be connected
533 \strike{a21}{a23}
534 \redStrike{a12}{a32}
535 \end{verbatim}
536
537 \section{Coloring cells}\label{s:coloredCell}
538 The package is incompatible with \texttt{colortbl.sty}. However, here's one
539 way to color cells. It is not elegant: you need to manually coordinate the
540 parameters (which is easy using BaKoMa, but not otherwise). But it works; the
541 output is in Figure~\ref{f:coloredCell}.
542
543 \begin{verbatim}
544 \sgcolsep=0.5pt
545 \renewcommand{\gamestretch}{1.5}
546 \def\highlight#1{\colorbox{yellow}{#1}}
547 \fboxsep=6pt
548
549 \begin{figure}[htb]\hspace*{\fill}%
550 \begin{game}{2}{2}
551 &$L$&$R$\\
552 $T$\hspace{\fboxsep}&\highlight{$1,1$}&$2,2$\\
553 $B$\hspace{\fboxsep}&$3,0$&$0,3$\\
554 \end{game}\hspace*{\fill}%
555 \caption[]{A game with a colored cell.}\label{f:coloredCell}
556 \end{figure}
557 \end{verbatim}
558
559 \sgcolsep=0.5pt
560 \renewcommand{\gamestretch}{1.5}
561 \def\highlight#1{\colorbox{yellow}{#1}}
562 \fboxsep=6pt
563
564 \begin{figure}[htb]\hspace*{\fill}%
565 \begin{game}{2}{2}
566 &$L$&$R$\\
567 $T$\hspace{\fboxsep}&\highlight{$1,1$}&$2,2$\\
568 $B$\hspace{\fboxsep}&$3,0$&$0,3$\\
569 \end{game}\hspace*{\fill}%
570 \caption[]{A game with a colored cell.}\label{f:coloredCell}
571 \end{figure}
572
573 \section{Extra columns and rows}\label{s:extraColumn}
574 Sometimes you may want to add a column to the right of a game, or a row below it, or both, as in
575 Figure~\ref{f:extraColumn}. You can do so using the trick of putting the extra text
576 in an \verb+\hbox+ of width zero. If you want to do this a lot, you probably should generate the sizes of the spaces and skips from the data of the table, rather than hard-coding them as I have done.
577
578 \begin{verbatim}
579 \def\hangUnder#1{%
580 \hbox to 0pt{\hspace{-11pt}\raisebox{-8mm}[0pt][0pt]{#1}}%
581 }
582 \sgcolsep=5pt
583 \begin{figure}[htb]\hspace*{\fill}%
584 \begin{game}{3}{3}
585 &$L$ (0)%
586 &$C$ (${\textstyle\frac{1}{3}}$)%
587 &$R$ (${\textstyle\frac{2}{3}}$)\\
588 $T$ (${\textstyle\frac{3}{4}}$)%
589 &$1,2$%
590 &$3,3$%
591 &$1,1$\hbox to 0pt{\hspace{20pt}${\textstyle\frac{5}{3}}$}\\
592 $M$ (0)%
593 &$1,2$%
594 &$0, 1$%
595 &$2, 2$\hbox to 0pt{\hspace{20pt}${\textstyle\frac{4}{3}}$}\\
596 $B$ (${\textstyle\frac{1}{4}}$)%
597 &$1,4$\hangUnder{$\frac{5}{2}$}%
598 &$5,1$\hangUnder{$\frac{5}{2}$}%
599 &$0,7$\hangUnder{$\frac{5}{2}$}%
600 \hbox to 0pt{\hspace{20pt}${\textstyle\frac{5}{3}}$}\\
601 \end{game}\hspace*{\fill}%
602 \vspace{8mm}
603 \caption[]{A game with an extra column and row.}\label{f:extraColumn}
604 \end{figure}
605 \end{verbatim}
606
607 \def\hangUnder#1{\hbox to 0pt{\hspace{-11pt}\raisebox{-8mm}[0pt][0pt]{#1}}}
608 \sgcolsep=5pt
609 \begin{figure}[htb]\hspace*{\fill}%
610 \begin{game}{3}{3}
611 &$L$ (0)&$C$ (${\textstyle\frac{1}{3}}$)&$R$ (${\textstyle\frac{2}{3}}$)\\
612 $T$ (${\textstyle\frac{3}{4}}$)&$1,2$&$3,3$&$1,1$\hbox to
613 0pt{\hspace{20pt}${\textstyle\frac{5}{3}}$}\\
614 $M$ (0)&$1,2$&$0, 1$&$2, 2$\hbox to
615 0pt{\hspace{20pt}${\textstyle\frac{4}{3}}$}\\
616 $B$ (${\textstyle\frac{1}{4}}$)%
617 &$1,4$\hangUnder{$\frac{5}{2}$}%
618 &$5,1$\hangUnder{$\frac{5}{2}$}%
619 &$0,7$\hangUnder{$\frac{5}{2}$}%
620 \hbox to
621 0pt{\hspace{20pt}${\textstyle\frac{5}{3}}$}\\
622 \end{game}\hspace*{\fill}%
623 \vspace{8mm}
624 \caption[]{A game with an extra column and row.}\label{f:extraColumn}
625 \end{figure}
626
627
628 \section{Parameters}\label{s:param}
629 \verb+\gamestretch+: a number that controls the spacing between rows,
630 analogous to \verb+\arraystretch+. Possible values: positive real numbers.
631 Default: value of \verb+\arraystretch+ when \verb+sgame.sty+ is loaded (1 in
632 standard styles). Example: \verb+\renewcommand{\gamestretch}{2}+.
633
634 \vspace{4mm}
635
636 \noindent\verb+\sgcolsep+: horizontal padding within cells. Possible values:
637 any dimension. Default: value of \verb+\tabcolsep+ when \verb+sgame.sty+ is
638 loaded. Example: \verb+\sgcolsep=10pt+.
639
640 \vspace{4mm}
641
642 \noindent\verb+\sglabelsep+: vertical space between game and label. Possible
643 values: any dimension. Default: 5pt. Example: \verb+\sglabelsep=10pt+.
644
645 \vspace{4mm}
646
647 \noindent\verb+\irpawcgltrue+ (``include row player actions when centering
648 game label''): causes game label to be centered under box consisting of row
649 player actions and payoff matrix. Default: \verb+\irpawcglfalse+ (i.e.\ game
650 label is centered under box consisting only of payoff matrix). Example:
651 \verb+\irpawcgltrue+.
652
653 \vspace{4mm}
654
655 \noindent\verb+\irplwcgltrue+ (``include row player label when centering game
656 label''): causes game label to be centered under box consisting of row player
657 label, row player actions, and payoff matrix. (Is overridden by
658 \verb+\irpawcgltrue+.) Default: \verb+\irplwcglfalse+ (i.e.\ game label is
659 centered under payoff matrix). Example: \verb+\irplwcgltrue+.
660
661 \vspace{4mm}
662
663 \noindent\verb+\gamemathtrue+: put all text in cells in payoff matrix in math
664 mode. Default: \verb+\gamemathfalse+. Example: \verb+\gamemathtrue+.
665
666 \vspace{4mm}
667
668 \noindent\verb+\gamevaligntrue+: vertically align the text within cells of a
669 \verb+tabular+ environment as they are aligned in a \verb+game+ environment.
670 Default: \verb+\gamevalignfalse+. Example: \verb+\gamevaligntrue+. (See
671 Section~\ref{s:VertPos}.)
672
673 \vspace{4mm}
674
675 \noindent\verb+\ssualtrue+: stretch space under action labels when
676 \verb+\gamestretch+ is greater than 1. Default: \verb+\ssualtrue+. Example:
677 \verb+\ssualfalse+. (See Section~\ref{s:VertPos}.)
678
679 \vspace{4mm}
680
681 \noindent\verb+\sglinecolor+: color of lines around payoffs. Default:
682 \verb+black+. Example: \verb+\def\sglinecolor{lightgray}+.
683
684 \vspace{4mm}
685
686 \noindent\verb+\sgtextcolor+: color of text in game (action labels, payoffs,
687 player labels). Default: \verb+black+. Example:
688 \verb+\def\sgtextcolor{blue}+.
689 \section{History}
690 \subsection*{Version 1}
691 \begin{description}
692 \item[1993-12] First version, following a suggestion of Michael Carter.
693 \end{description}
694 \subsection*{Version 2}
695 \begin{description}
696 \item[1997-10] Labels allowed (via additional optional argument). Parameters
697 added: \verb+\sglabelsep+, \verb+\sgcolsep+, \verb+\irplwcgltrue+,
698 \verb+\irpawcgltrue+, and \verb+\gamemathtrue+.
699 \item[2002-6 (version 2.1)] Modification of \LaTeX's \verb+\@array+ changed so
700 that it does not change spacing in \verb+tabular+ environment. Color
701 functionality added. Parameters added: \verb+\gamevaligntrue+,
702 \verb+\ssualtrue+ (allowing more control over vertical spacing when
703 \verb+\gamestretch+ is greater than 1), \verb+\sglinecolor+,
704 \verb+\sgtextcolor+.
705 \item[2004-5-13 (version 2.11)] Minor bug fix.
706 \item[2004-5-21 (version 2.12)] Minor bug fix.
707 \item[2005-7-8 (version 2.13)] Minor bug fix.
708 \item[2008-12-2 (version 2.14)] Minor bug fix: length of bottom line (bug
709 inherited from \verb+tabular+ environment; noticeable only when lines are
710 thick). Bug pointed out by Marcel Priebsch.
711 \item[2010-11-1] Section~\ref{s:crossingout} added to the manual, following a
712 query by a user.
713 \item[2011-1-14] Section~\ref{s:coloredCell} added to the manual.
714 \item[2013-2-9] Section~\ref{s:extraColumn} added to the manual.
715 \item[2013-6-24 (version 2.15)] 1.\ Longstanding (probably since 1993) bug fix: spaces before and after the text in any cell are ignored.
716 2.\ The \texttt{color} package is now loaded by the style, and does not need to be loaded explicitly. \end{description}
717
718 }
719
720 \end{document}
721
722 %
723