From 50149508a85f6d47cc39aeb2be753609042a35f5 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 24 Sep 2006 13:21:51 +0000 Subject: sgame update (22sep06) git-svn-id: svn://tug.org/texlive/trunk@2183 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/sgame/README | 14 + Master/texmf-dist/doc/latex/sgame/sgame.pdf | Bin 70270 -> 77582 bytes Master/texmf-dist/doc/latex/sgame/sgame.tex | 524 +++++++++++++++++++++++++ Master/texmf-dist/tex/latex/sgame/sgame.sty | 9 +- Master/texmf-dist/tex/latex/sgame/sgamevar.sty | 500 +++++++++++++++++++++++ Master/texmf-dist/tpm/sgame.tpm | 11 +- Master/texmf/lists/sgame | 3 + 7 files changed, 1055 insertions(+), 6 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/sgame/README create mode 100644 Master/texmf-dist/doc/latex/sgame/sgame.tex create mode 100644 Master/texmf-dist/tex/latex/sgame/sgamevar.sty (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/sgame/README b/Master/texmf-dist/doc/latex/sgame/README new file mode 100644 index 00000000000..dd59063e11a --- /dev/null +++ b/Master/texmf-dist/doc/latex/sgame/README @@ -0,0 +1,14 @@ +This package typesets strategic games. For a 2 x 2 game, for example, +the input + + \begin{game}{2}{2} + &$L$ &$M$\\ + $T$ &$2,2$ &$2,0$\\ + $B$ &$3,0$ &$0,9$ + \end{game} + +produces output with (a) boxes around the payoffs, (b) payoff +columns of equal width, and (c) payoffs vertically centered +within the boxes. + +The style is incompatible with array.sty. \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/sgame/sgame.pdf b/Master/texmf-dist/doc/latex/sgame/sgame.pdf index 00bddfc5f03..a29eb64d536 100644 Binary files a/Master/texmf-dist/doc/latex/sgame/sgame.pdf and b/Master/texmf-dist/doc/latex/sgame/sgame.pdf differ diff --git a/Master/texmf-dist/doc/latex/sgame/sgame.tex b/Master/texmf-dist/doc/latex/sgame/sgame.tex new file mode 100644 index 00000000000..dfed299276a --- /dev/null +++ b/Master/texmf-dist/doc/latex/sgame/sgame.tex @@ -0,0 +1,524 @@ +% +% +% +\documentclass[12pt]{article} +\usepackage{mjoarti} +\usepackage{mathpazo} +\usepackage{pstricks} +\usepackage{pstcol,pst-mjo} +\usepackage{sgame} +\usepackage{url} +\begin{document} + +\renewcommand{\descriptionlabel}[1]{\hspace\labelsep + \normalfont #1\phantom{.}} + +\begin{center} +{\bfseries Manual for {\tt sgame.sty} and {\tt sgamevar.sty}}\\ +by\\ +Martin J. Osborne\\ +{\tt Martin.Osborne@utoronto.ca}\\ +For Version 2.13, 2005/7/8 +\end{center} + +{\sloppy +\section{Introduction} +{\tt sgame.sty} and {\tt sgamevar.sty} are \LaTeXe\ style files for drawing +strategic games. The latest versions are available at +\url{http://www.economics.utoronto.ca/osborne/latex}. The styles are +incompatible with \texttt{array.sty} (and hence any package, like +\texttt{jurabib.sty}, that loads \texttt{array.sty}). Please notify me of +bugs. +\section{sgame.sty versus sgamevar.sty} +\verb+sgame.sty+ and \verb+sgamevar.sty+ differ in two respects. +\begin{itemize} + \item The character that ``tabs'' to a new column is \verb+&+ in +\verb+sgame.sty+ and \verb+\>+ in \verb+sgamevar.sty+. In every other respect +the syntax is identical. This manual applies to \verb+sgame.sty+. If you are +using \verb+sgamevar.sty+, replace every occurrence of \verb+&+ with +\verb+\>+. + \item \verb+sgame.sty+ produces a \verb+game+ environment that cannot be +used as an argument of a macro, whereas \verb+sgamevar.sty+ does not have this +limitation. You need to use \verb+sgamevar.sty+, for example, to be able to +make a \verb+game+ environment an argument of TeXPower's \verb+\stepwise+ +macro. +\end{itemize} + +(I prefer the \verb+&+ syntax, but have been unable to find a way of +implementing it without changing the \verb+\catcode+ of \verb+&+, which +prevents a \verb+game+ environment from being the argument of a macro.) +\section{Installation} +\begin{itemize} + \item Put \texttt{sgame.sty} (and/or \texttt{sgamevar.sty}) in a directory +from which \TeX\ reads input files. (In MiKTeX the directory might be +something like \verb+\miktex\localtexmf\tex\latex\+ or a subdirectory +thereof.) + \item Let \TeX\ know that \texttt{sgame} and/or \texttt{sgamevar} have +arrived. (In MiKTeX, ``refresh the filename database''.) + \item Check that you have the \verb+color+ package. One way to check is to +put \verb+\usepackage{color}+ in the preamble of a document and see if you get +an error. If you don't have the package, get it from CTAN. + \item To use the package in a document, put the lines +\verb+\usepackage{sgame}+ (or \verb+\usepackage{sgamevar}+) and +\verb+\usepackage{color}+ (or \verb+\usepackage{pstcol}+, part of PSTricks, +which loads \verb+color+) in the preamble. + \item The style is incompatible with \verb+colortbl.sty+. +\end{itemize} +\section{Description} +The style defines two environments, \verb+game+ and \verb+game*+. Each +environment can be used in four ways, depending on the values of its optional +arguments. In each case, the starred version differs from the unstarred +versionin that action labels are not accommodated. +\subsection{No optional argument} +Without any optional arguments, its syntax is\vspace*{4mm}\newline +\verb+\begin{game}{+\emph{number-of-rows}% +\verb+}{+\emph{number-of-columns}\verb+}+\emph{game-body}% +\verb+\end{game}+\vspace*{4mm}\newline +where \emph{number-of-rows} is the number of rows in the game and +\emph{number-of-columns} is the number of columns. \emph{game-body} consists +of rows in the style of the rows in a \verb+tabular+ environment, \verb+&+ +``tabbing'' to a new cell, and \verb+\\+ ending a row. + +The following example is illustrated in Figure~\ref{f:ex1}. + +\begin{verbatim} +\def\sgtextcolor{blue}% +\def\sglinecolor{red}% +\begin{figure}[htb]\hspace*{\fill}% +\begin{game}{2}{2} + & $L$ & $R$\\ +$T$ &$2,2$ &$100,35$\\ +$B$ &$3,0$ &$350,16$ +\end{game}\hspace*{\fill}% +\begin{game*}{2}{2} +$2,2$ &$100,35$\\ +$3,0$ &$350,16$ +\end{game*}\hspace*{\fill}% +\caption[]{A two row, two column strategic game, with and without +action labels.} +\end{figure} +\end{verbatim} + +\def\sgtextcolor{blue}% +\def\sglinecolor{red}% +\begin{figure}[htb]\hspace*{\fill}% +\begin{game}{2}{2} +&$L$&$R$\\ +$T$&$2,2$&$100,35$\\ +$B$&$3,0$&$350,16$ +\end{game}\hspace*{\fill}% +\begin{game*}{2}{2} +$2,2$&$100,35$\\ +$3,0$&$350,16$ +\end{game*}\hspace*{\fill}% +\caption[]{A two row, two column strategic game, with and without action +labels.}\label{f:ex1} +\end{figure} +\begin{itemize} + \item Note that the width of every column is the same. Further, the +content of each cell of the table is centered vertically. + \item As in a \LaTeXe\ \verb+tabular+ environment, spaces on either side of +the text in each cell is ignored. (Thus in the \verb+tex+ file you can, if +you wish, align the columns using spaces or tabs.) + \item The first \verb+&+ {\bfseries must} be preceded by a space token +(space or carriage return). (It may not immediately follow the closing brace +of the second argument.) + \item If all the text in every cell of the payoff matrix is in math mode, +you can avoid typing all the \verb+$+'s by setting \verb+\gamemathtrue+, +either by putting this command in your file, or by changing +\verb+\gamemathfalse+ to \verb+\gamemathtrue+ in the style file. Under this +setting, all text in every cell of the payoff matrix is automatically in math +mode. (Note that even if the text in the cells consists only of +comma-separated pairs of numbers, it should still be in math mode, else the +spacing is not correct.) +\end{itemize} +\subsection{One optional argument: game label} +With one optional argument, the syntax of the \verb+game+ environment +is\vspace*{4mm}\newline +\verb+\begin{game}{+\emph{number-of-rows}% +\verb+}{+\emph{number-of-columns}\verb+}[+\emph{game-label}% +\verb+]+\emph{game-body}\newline\verb+\end{game}+\vspace*{4mm}\newline +where \emph{number-of-rows} is the number of rows in the game, +\emph{number-of-columns} is the number of columns, and \emph{game-label} is a +label for the game that is centered beneath the game. (The sense in which it +is centered may be changed by setting \verb+\irpawcgltrue+ or +\verb+\irplwcgltrue+---see Section~\ref{s:param}.) This case is useful if two +or more games are positioned side-by-side, and each requires a label. + +The following example is illustrative. + +\begin{verbatim} +\begin{figure}[htb]\hspace*{\fill}% +\begin{game}{2}{2}[$A$] + & $L$ & $R$\\ +$a$ &$2,2$ &$0,3$\\ +$b$ &$3,0$ &$1,1$ +\end{game}\hspace*{20mm}% +\begin{game}{2}{2}[$B$] + & $L$ & $R$\\ +$a$ &$2,3$ &$0,4$\\ +$b$ &$3,1$ &$1,2$ +\end{game}\hspace*{\fill}% +\caption[]{A three player strategic game, in which +player~3 chooses $A$ or $B$.} +\end{figure} +\end{verbatim} + +\begin{figure}[htb]\hspace*{\fill}% +\begin{game}{2}{2}[$A$] + & $L$ & $R$\\ +$a$ &$2,2$ &$0,3$\\ +$b$ &$3,0$ &$1,1$ +\end{game}\hspace*{20mm}% +\begin{game}{2}{2}[$B$] + & $L$ & $R$\\ +$a$ &$2,3$ &$0,4$\\ +$b$ &$3,1$ &$1,2$ +\end{game}\hspace*{\fill}% +\caption[]{A three player strategic game, in which player~3 chooses $A$ or +$B$.}\label{f:ex2} +\end{figure} +\subsection{Two optional arguments: player labels} +In the case of two optional arguments, the syntax of the \verb+game+ +environment is\vspace*{4mm}\newline +\verb+\begin{game}{+\emph{number-of-rows}% +\verb+}{+\emph{number-of-columns}\verb+}[+\emph{row-player-label}% +\verb+]+\newline +\verb+[+\emph{column-player-label}% +\verb+]+\emph{game-body}\verb+\end{game}+\vspace*{4mm}\newline +where \emph{number-of-rows} is the number of rows in the game, +\emph{number-of-columns} is the number of columns, and \emph{row-player-label} +and \emph{column-player-label} are the names of the players. + +The following example illustrates this case. + +\begin{verbatim} +\begin{figure}[htb]\hspace*{\fill}% +\begin{game}{2}{3}[Player~1][Player~2] + & $L$ & $M$ & $R$\\ +$T$ &$2,2$ &$2,0$ &$0,3$\\ +$B$ &$3,0$ &$0,9$ &$1,1$ +\end{game}\hspace*{\fill}% +\caption[]{A two row, three column strategic game with +player labels.} +\end{figure} +\end{verbatim} + +\begin{figure}[htb]\hspace*{\fill}% +\begin{game}{2}{3}[Player~1][Player~2] +&$L$&$M$&$R$\\ +$T$&$2,2$&$2,0$&$0,3$\\ +$B$&$3,0$&$0,9$&$1,1$ +\end{game}\hspace*{\fill}% +\caption[]{A two row, three column strategic game with player +labels.}\label{f:ex3} +\end{figure} +\subsection{Three optional arguments: player labels and game label} +The case of three optional arguments combines the two previous cases: the +syntax of the \verb+game+ environment is\vspace*{4mm}\newline +\verb+\begin{game}{+\emph{number-of-rows}% +\verb+}{+\emph{number-of-columns}\verb+}[+\emph{row-player-label}% +\verb+]+\newline +\verb+[+\emph{column-player-label}% +\verb+][+\emph{game-label}\verb+]+\emph{game-body}\verb+\end{game}+\vspace*{4m% +m}\newline +where \emph{number-of-rows} is the number of rows in the game, +\emph{number-of-columns} is the number of columns, \emph{row-player-label} and +\emph{column-player-label} are the names of the players, and \emph{game-label} +is a label for the game. + +The following example illustrates this case. + +\begin{verbatim} +\begin{figure}[htb]\hspace*{\fill}% +\begin{game}{2}{3}[Player~1][Player~2][$A$] + & $L$ & $M$ & $R$\\ +$T$ &$2,2$ &$2,0$ &$0,3$\\ +$B$ &$3,0$ &$0,9$ &$1,1$ +\end{game}\hspace*{\fill}% +\caption[]{A two row, three column strategic game with +player labels and a label.} +\end{figure} +\end{verbatim} + +\begin{figure}[htb]\hspace*{\fill}% +\begin{game}{2}{3}[Player~1][Player~2][$A$] +&$L$&$M$&$R$\\ +$T$&$2,2$&$2,0$&$0,3$\\ +$B$&$3,0$&$0,9$&$1,1$ +\end{game}\hspace*{\fill}% +\caption[]{A two row, three column strategic game with player labels and a +label.}\label{f:ex4} +\end{figure} +\section{Cell formatting} +You may regard the format of the payoffs in the first column of the game in +Figure~\ref{f:ex5} as unsatisfactory, and the formatting in the left panel of +Figure~\ref{f:ex6} as superior. This latter formatting is implemented by +adding ``phantom'' minus signs before the ``2'' in the top left cell and +before the ``3'' in the bottom left cell. The top left cell, for example, is +entered as \verb+$-2,\phantom{-}2$+. (\verb+\phantom{}+ leaves a space +whose size is equal to the size of the object \verb++.) +\begin{figure}[htb]\hspace*{\fill}% +\begin{game}{2}{2} +&$L$&$R$\\ +$T$&$-2,2$&$0,3$\\ +$B$&$3,-4$&$1,1$ +\end{game}\hspace*{\fill}% +\caption[]{A strategic game.}\label{f:ex5} +\end{figure} + +You may want to consider other formats. The right panel of Figure~\ref{f:ex6} +shows an alternative. This format is achieved be entering the element of each +cell as +\begin{quote} +\verb+\begin{array}{c}#1\\[1.6mm]#2\end{array}+, +\end{quote} +where \verb+#1+ is player~1's payoff and \verb+#2+ is player~2's payoff. +(Actually, I defined the macro +\begin{quotation} +\verb+\def\stackedpayoffs#1#2{%+ + +\verb+ \begin{array}{c}#1\\[1.6mm]#2\end{array}+ + +\verb+}+ +\end{quotation} +and entered each element as \verb+\stackedpayoffs{#1}{#2}+. I set +\verb+\gamestretch+ to be 2.1 to improve the appearance of the game.)% +\def\stackedpayoffs#1#2{\begin{array}{c}#1\\[1.6mm]#2\end{array}} +\begin{figure}[htb]\hspace*{\fill}% +\begin{game}{2}{2} +&$L$&$R$\\ +$T$&$-2,\phantom{-}2$&$0,3$\\ +$B$&$\phantom{-}3,-4$&$1,1$ +\end{game}\hspace*{\fill}% +\renewcommand{\gamestretch}{2.1}% +\begin{game}{2}{2} +&$L$&$R$\\ +$T$&$\stackedpayoffs{-2}{2}$&$\stackedpayoffs{0}{3}$\\ +$B$&$\stackedpayoffs{3}{-4}$&$\stackedpayoffs{1}{1}$ +\end{game}\hspace*{\fill}% +\caption[]{Two alternative presentations of the game in +Figure~\protect\ref{f:ex5}.}\label{f:ex6} +\end{figure} + +Figure~\ref{f:ex7} shows two more alternatives. The one on the left is +achieved by entering the element of each cell as +\begin{quote} +\verb+\begin{array}{rl}#1&\\[1.6mm]\end{array}+, +\end{quote} +and the one on the left differs only in that there is a \verb+\phantom{-}+ in +front of player~2's payoff in the top left cell, player~1's payoff in the +bottom left cell, and player~2's payoffs in both of the right cells.% +\def\binmorepayoffs#1#2{\begin{array}{rl}#1&\\[1.6mm]\end{array}} +\begin{figure}[htb]\hspace*{\fill}% +\renewcommand{\gamestretch}{2.1}% +\begin{game}{2}{2} +&$L$&$R$\\ +$T$&$\binmorepayoffs{-2}{2}$&$\binmorepayoffs{0}{3}$\\ +$B$&$\binmorepayoffs{3}{-4}$&$\binmorepayoffs{1}{1}$ +\end{game}\hspace*{\fill}% + +\vspace*{4mm} + +\hspace*{\fill}% +\begin{game}{2}{2} +&$L$&$R$\\ +$T$&$\binmorepayoffs{-2}{\phantom{-}2}$& $\binmorepayoffs{0}{\phantom{-}3}$\\ +$B$&$\binmorepayoffs{\phantom{-}3}{-4}$& $\binmorepayoffs{1}{\phantom{-}1}$ +\end{game}\hspace*{\fill}% +\caption[]{Two additional presentations of the game in +Figure~\protect\ref{f:ex5}.}\label{f:ex7} +\end{figure} +\section{Vertical position of text within cells}\label{s:VertPos} +The vertical distance between the lines at the top and bottom of a row in +\LaTeX's \verb+tabular+ environment is equal to \verb+\arraystretch+ times +\verb+\baselineskip+. The baseline of the text in each cell is placed 30\% of +the distance from the bottom line. Thus if \verb+\arraystretch+ is large +relative to the height of the text, the text is not near the middle of the +row. (See the left panel of Figure~\ref{f:VertPos}; or try setting +\verb+\arraystretch+ equal to 5 and process a document with a \verb+tabular+ +environment.) (See the definitions of \verb+\strutbox+ and of \verb+\@array+ +in \verb+latex.ltx+.) + +\verb+sgame.sty+ makes the vertical distance between the lines at the top and +bottom of a row of a \verb+game+ the same (\verb+\arraystretch+ times +\verb+\baselineskip+), but places the baseline of the text in each cell so +that the distances above and below an upper case I placed on the baseline are +equal. (See the right panel of Figure~\ref{f:VertPos}.) (If you'd like to +use another character, define this character to be \verb+\sg@alignchar+.) +\begin{figure}[htb] +\hspace*{\fill} +\begin{pspicture}(80,55) +\psline(0,5)(30,5) +\psline(0,55)(30,55) +\psline[linecolor=lightgray](0,20)(30,20) +\rput[B](15,20){\fontsize{14mm}{10mm}\selectfont AygIx} +\psline[linecolor=lightgray]{<->}(15,5)(15,20) +\rput*(15,12.5){$0.3d$} +\psline[linecolor=lightgray]{<->}(15,20)(15,55) +\rput*(15,37.5){$0.7d$} +\rput[B](15,0){\texttt{tabular} environment} +% +\psline[linecolor=lightgray]{<->}(40,5)(40,55) +\rput*(40,30){$d$} +% +\psline(50,5)(80,5) +\psline(50,55)(80,55) +\psline[linecolor=lightgray](50,25)(80,25) +\psline[linecolor=lightgray](50,35)(80,35) +\rput[B](65,25){\fontsize{14mm}{10mm}\selectfont AygIx} +\psline[linecolor=lightgray]{<->}(65,5)(65,25) +\rput*(65,15){$x$} +\psline[linecolor=lightgray]{<->}(65,35)(65,55) +\rput*(65,45){$x$} +\rput[B](65,0){\texttt{game} environment} +\end{pspicture} +\hspace*{\fill} +\caption[]{Vertical positioning of text within cells in the \texttt{tabular} +and \texttt{game} environments.}\label{f:VertPos} +\end{figure} + +If you want to use \verb+sgame+'s vertical positioning in your \verb+tabular+ +environments, as well as your \verb+game+ environments, set +\verb+\gamevaligntrue+ before the environment. (If you want to switch back at +some point, you can do so by setting \verb+\gamevalignfalse+.) + +If the height of the text in a cell exceeds \verb+\arraystretch+ times +\verb+\baselineskip+, then the height of the row is increased to accommodate +the text (just as the distance between lines of text is increased to +accommodate large text). The result is that the lines at the top and bottom +of the row touch the top and bottom of the text, and this row is taller than +the others. To improve the appearance of the table you may want to increase +\verb+\gamestretch+ (analogous to \verb+\arraystretch+), to put some white +space above and below your oversized text. + +When \verb+\gamestretch+ is increased from 1, the height of \emph{every} row, +including the first row (the action labels), is increased. If you don't want +to increase the space under the action labels, declare \verb+\ssualfalse+. +(``ssual'' stands for ``stretch space under action labels''.) See +Figures~\ref{f:ssual1} and \ref{f:ssual2} for examples (for games with and +without player labels).% +\begin{figure}[htb]\hspace*{\fill}\renewcommand{\gamestretch}{3}% +\begin{game}{2}{2} +&$L$&$R$\\ +$T$&$2,1$&$2,2$\\ +$B$&$3,3$&$4,4$ +\end{game}% +\hspace*{\fill}% +\ssualfalse% +\begin{game}{2}{2} +&$L$&$R$\\ +$T$&$2,1$&$2,2$\\ +$B$&$3,3$&$4,4$ +\end{game}% +\hspace*{\fill}% +\caption[]{Positioning the action labels of the column player when +\texttt{gamestretch} is larger than 1, for a game without player labels. In +the left game we have \texttt{ssualtrue} (the default); in the right game +\texttt{ssualfalse} is declared.}\label{f:ssual2} +\end{figure} +\begin{figure}[htb]\hspace*{\fill}\renewcommand{\gamestretch}{3}% +\begin{game}{2}{2}[Player 1][Player 2] +&$L$&$R$\\ +$T$&$2,1$&$2,2$\\ +$B$&$3,3$&$4,4$ +\end{game}% +\hspace*{\fill}% +\ssualfalse% +\begin{game}{2}{2}[Player 1][Player 2] +&$L$&$R$\\ +$T$&$2,1$&$2,2$\\ +$B$&$3,3$&$4,4$ +\end{game}% +\hspace*{\fill}% +\caption[]{Positioning the action labels of the column player when +\texttt{gamestretch} is larger than 1, for a game with player labels. In the +left game we have \texttt{ssualtrue} (the default); in the right game +\texttt{ssualfalse} is declared.}\label{f:ssual1} +\end{figure} +\section{Parameters}\label{s:param} +\verb+\gamestretch+: a number that controls the spacing between rows, +analogous to \verb+\arraystretch+. Possible values: positive real numbers. +Default: value of \verb+\arraystretch+ when \verb+sgame.sty+ is loaded (1 in +standard styles). Example: \verb+\renewcommand{\gamestretch}{2}+. + +\vspace{4mm} + +\noindent\verb+\sgcolsep+: horizontal padding within cells. Possible values: +any dimension. Default: value of \verb+\tabcolsep+ when \verb+sgame.sty+ is +loaded. Example: \verb+\sgcolsep=10pt+. + +\vspace{4mm} + +\noindent\verb+\sglabelsep+: vertical space between game and label. Possible +values: any dimension. Default: 5pt. Example: \verb+\sglabelsep=10pt+. + +\vspace{4mm} + +\noindent\verb+\irpawcgltrue+ (``include row player actions when centering +game label''): causes game label to be centered under box consisting of row +player actions and payoff matrix. Default: \verb+\irpawcglfalse+ (i.e.\ game +label is centered under box consisting only of payoff matrix). Example: +\verb+\irpawcgltrue+. + +\vspace{4mm} + +\noindent\verb+\irplwcgltrue+ (``include row player label when centering game +label''): causes game label to be centered under box consisting of row player +label, row player actions, and payoff matrix. (Is overridden by +\verb+\irpawcgltrue+.) Default: \verb+\irplwcglfalse+ (i.e.\ game label is +centered under payoff matrix). Example: \verb+\irplwcgltrue+. + +\vspace{4mm} + +\noindent\verb+\gamemathtrue+: put all text in cells in payoff matrix in math +mode. Default: \verb+\gamemathfalse+. Example: \verb+\gamemathtrue+. + +\vspace{4mm} + +\noindent\verb+\gamevaligntrue+: vertically align the text within cells of a +\verb+tabular+ environment as they are aligned in a \verb+game+ environment. +Default: \verb+\gamevalignfalse+. Example: \verb+\gamevaligntrue+. (See +Section~\ref{s:VertPos}.) + +\vspace{4mm} + +\noindent\verb+\ssualtrue+: stretch space under action labels when +\verb+\gamestretch+ is greater than 1. Default: \verb+\ssualtrue+. Example: +\verb+\ssualfalse+. (See Section~\ref{s:VertPos}.) + +\vspace{4mm} + +\noindent\verb+\sglinecolor+: color of lines around payoffs. Default: +\verb+black+. Example: \verb+\def\sglinecolor{lightgray}+. + +\vspace{4mm} + +\noindent\verb+\sgtextcolor+: color of text in game (action labels, payoffs, +player labels). Default: \verb+black+. Example: +\verb+\def\sgtextcolor{blue}+. +\section{History} +\subsection*{Version 1} +\begin{description} +\item[1993/12] First version. +\end{description} +\subsection*{Version 2} +\begin{description} +\item[1997/10] Labels allowed (via additional optional argument). Parameters +added: \verb+\sglabelsep+, \verb+\sgcolsep+, \verb+\irplwcgltrue+, +\verb+\irpawcgltrue+, and \verb+\gamemathtrue+. +\item[2002/6 (version 2.1)] Modification of \LaTeX's \verb+\@array+ changed so +that it does not change spacing in \verb+tabular+ environment. Color +functionality added. Parameters added: \verb+\gamevaligntrue+, +\verb+\ssualtrue+ (allowing more control over vertical spacing when +\verb+\gamestretch+ is greater than 1), \verb+\sglinecolor+, +\verb+\sgtextcolor+. +\item[2004/5/13 (version 2.11)] Minor bug fix. +\item[2004/5/21 (version 2.12)] Minor bug fix. +\item[2005/7/8 (version 2.13)] Minor bug fix. +\end{description} + +} + +\end{document} + diff --git a/Master/texmf-dist/tex/latex/sgame/sgame.sty b/Master/texmf-dist/tex/latex/sgame/sgame.sty index 75c1bb3803e..f776f4fcbb1 100644 --- a/Master/texmf-dist/tex/latex/sgame/sgame.sty +++ b/Master/texmf-dist/tex/latex/sgame/sgame.sty @@ -1,7 +1,7 @@ % sgame.sty (for formatting strategic games) % LaTeX style file for typesetting strategic games % Martin J. Osborne (based on suggestions of Michael Carter) -% Version 2.11, 2004/5/13 +% Version 2.13, 2005/7/8 % Please report bugs to: martin.osborne@utoronto.ca % The latest version may be found at % http://www.economics.utoronto.ca/osborne/latex @@ -241,7 +241,10 @@ \setbox0=\hbox\bgroup\ignorespaces% \ifgamemath$\fi% \ifnum\sg@rowindex=\sg@numrows% - \gdef\\{\unskip}% +% 2005-7-8: next line replaced by following one (to avoid losing definition +% of \\ permanently) +% \gdef\\{\unskip}% + \let\\=\unskip% \else\fi\ignorespaces% }% \color{\sglinecolor}% @@ -369,6 +372,7 @@ \ifgamemath$\fi% \ifnum\sg@rowindex=\sg@numrows% \gdef\\{\unskip}% + \let\\=\unskip% \else\fi\ignorespaces% }% \sg@numrows=#1\sg@numcols=#2% @@ -493,4 +497,3 @@ \def\@gifnch{\ifx\@tempc\@sptoken\let\@tempd\@tempb% \else\ifx\@tempc\@tempe\let\@tempd\@tempa\else\let\@tempd\@tempb\fi\fi\@tempd} - \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/sgame/sgamevar.sty b/Master/texmf-dist/tex/latex/sgame/sgamevar.sty new file mode 100644 index 00000000000..491fc30c2c8 --- /dev/null +++ b/Master/texmf-dist/tex/latex/sgame/sgamevar.sty @@ -0,0 +1,500 @@ +% sgamevar.sty (variant of sgame.sty that uses \> for tabs instead of & and +% avoids \catcode changes) +% LaTeX style file for typesetting strategic games +% Martin J. Osborne (based on suggestions of Michael Carter) +% Version 2.12, 2004/5/21 +% Please report bugs to: martin.osborne@utoronto.ca +% The latest version may be found at +% http://www.economics.utoronto.ca/osborne/latex +% +% This material is subject to the LaTeX Project Public License. See +% http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html +% for details. + +\def\sglinecolor{black} +\def\sgtextcolor{black} + +% The character to be centrally vertically aligned in a cell. +\def\sg@alignchar{I} + +\newskip\sglabelsep +\sglabelsep=5pt + +\newdimen\sgcolsep +\sgcolsep=\tabcolsep + +\let\gamestretch=\arraystretch + +\newdimen\sg@colwd +\newdimen\sg@xcolwd + +\newcount\sg@colnum +\newcount\sg@colindex +\newcount\sg@numcols +\newcount\sg@xnumcols +\newcount\sg@rowindex +\newcount\sg@numrows + +\newbox\sg@strutbox +\def\sg@strut{\relax\ifmmode\copy\sg@strutbox\else\unhcopy\sg@strutbox\fi} + +\newif\ifsg@label +\newif\ifgamemath\gamemathfalse +\newif\ifgamevalign\gamevalignfalse +\newif\ifssual\ssualtrue +\newif\ifirpawcgl +\newif\ifirplwcgl + +\newdimen\sg@tempsep + +% Redefine @array from LATEX.LTX so that when \gamevaligntrue (as within a +% game environment), \@arstrutbox has correct depth and height to position +% rows in tabular environment so that distance from bottom of row to baseline +% of text is equal to distance from top of text to top of row. (Note that +% characters with positive "depth" (like y, g, and commas) hang below the +% baseline.) + +\def\@array[#1]#2{% + \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi + \bgroup + \ifgamevalign + \setbox0=\hbox{\sg@alignchar}% + \@tempdima\arraystretch\baselineskip + \advance\@tempdima -\ht0 + \@tempdimb .5\@tempdima + \@tempdima \@tempdimb + \advance\@tempdima \ht0 + \setbox\@arstrutbox=\hbox{% + \vrule\@height\@tempdima + \@depth\@tempdimb + \@width\z@}% + \else + \setbox\@arstrutbox\hbox{% + \vrule\@height\arraystretch\ht\strutbox + \@depth\arraystretch \dp\strutbox + \@width\z@}% + \fi% + \@mkpream{#2}% + \edef\@preamble{% + \ialign \noexpand\@halignto + \bgroup \@arstrut \@preamble \tabskip\z@skip \cr}% + \let\@startpbox\@@startpbox \let\@endpbox\@@endpbox + \let\tabularnewline\\% + \let\par\@empty + \let\@sharp##% + \set@typeset@protect + \lineskip\z@skip\baselineskip\z@skip + \ifhmode \@preamerr\z@ \@@par\fi + \@preamble} + +% The \sg@strut in the following is needed to put some space between the first +% row (which contains no verticals) and the following row. It differs from +% \@arstrut (used in the second and following rows) in that its height +% is the height of an u.c. letter in the current font plus half the +% difference between the \baselineskip (*not* \arraystretch times +% \baselineskip) and that height (so that extra white space is not +% added above the labels in the top row beyond that normally above a row of +% text on a page). (Definition of \@gifnextchar is at end of this file.) + +\let\@@amp=& + +\def\sg@initgame{% + \global\gamevaligntrue% + \color{\sgtextcolor}% + \sg@colwd 0pt% + \sg@colnum 1% + \sg@rowindex 0% + \let\tempstretch=\arraystretch% + \let\arraystretch=\gamestretch% + \let\sg@tempsep=\tabcolsep% + \let\tabcolsep=\sgcolsep% +} + +%------------------% +% game environment % +%------------------% + +\def\game#1#2{% + \sg@initgame% + \sg@xcolwd 0pt% + \@gifnextchar[{\@gameo{#1}{#2}}{\sg@labelfalse\@game{#1}{#2}}% +} + +\def\@gameo#1#2[#3]{% + \@gifnextchar[{\@gameoo{#1}{#2}[#3]}{\sg@labeltrue\@gamelabel{#1}{#2}[#3]}% +} + +\def\@gameoo#1#2[#3][#4]{% + \@gifnextchar[{\sg@labeltrue\@gameplslabel{#1}{#2}[#3][#4]}% + {\sg@labelfalse\@gamepls{#1}{#2}[#3][#4]}% +} + +\gdef\@gamelab{} + +\def\sg@makegstrutbox#1{% + \setbox0=\hbox{#1}% + \@tempdima\arraystretch\baselineskip% + \advance\@tempdima -\ht0% + \@tempdima .5\@tempdima% + \@tempdimb\baselineskip% + \advance\@tempdimb-\ht0% + \@tempdimb .5\@tempdimb% + \ifssual\else\@tempdima\@tempdimb\fi% + \advance\@tempdimb \ht0% + \setbox\sg@strutbox=\hbox{\vrule height\@tempdimb depth\@tempdima width\z@}% +} + +{%\catcode`\&=\active +% + \gdef\@gamelabel#1#2[#3]{\gdef\@gamelab{#3}\@game{#1}{#2}} +% + \gdef\@game#1#2{% +% \catcode`\&=\active% + \sg@makegstrutbox{\sg@alignchar}% + \def\>{% + \unskip\egroup% + \ifdim\sg@colwd<\wd0% + \global\sg@colwd\wd0% + \else\fi% + \hfil\box0\hfil\sg@strut\@@amp\omit% +% \color setting on next line can be removed if it causes problems + \setbox0=\hbox\bgroup\color{\sgtextcolor}\ignorespaces% + }% + \sg@numrows=#1\sg@numcols=#2\sg@xnumcols=#2\advance\sg@numcols by 1% +% setting on next line reestablishes black as text color after sgame is done +% (in case of a float to the top of the page(?)) + \color{black}% + \begin{gtabular}{@{}r|*{#2}{c|}}\omit\setbox0=\hbox\bgroup\ignorespaces% + } + + \gdef\@gameplslabel#1#2[#3][#4][#5]{% +\gdef\@gamelab{#5}\@gamepls{#1}{#2}[#3][#4]} + + \gdef\@gamepls#1#2[#3][#4]{% +% \catcode`\&=\active% + \sg@makegstrutbox{\sg@alignchar}% + \gdef\@rowpllabel{#3}% + \def\>{\unskip\egroup% + \ifdim\sg@colwd<\wd0% + \global\sg@colwd\wd0% + \else\fi% + \hfil\box0\hfil\sg@strut\@@amp\omit% +% \color setting on next line can be removed if it causes problems + \setbox0=\hbox\bgroup\color{\sgtextcolor}\ignorespaces% + }% + \sg@numrows=#1\sg@numcols=#2\sg@xnumcols=#2\advance\sg@numcols by 1% +% Row player label is not part of alignment. To get its vertical position +% right, need to compensate for rows of action labels at top of game, column +% player label, and, if it exists, game label at bottom plus \sglabelsep. + \@tempdima\ht\sg@strutbox% + \advance\@tempdima\dp\sg@strutbox% + \multiply\@tempdima by -1% + \ifsg@label% + \@tempdimb\sglabelsep% + \divide\@tempdimb by 2% + \advance\@tempdima by \@tempdimb% + \@tempdimb\ht\sg@strutbox% + \advance\@tempdimb by\dp\sg@strutbox% + \divide\@tempdimb by 2% + \advance\@tempdima by \@tempdimb% + \fi% + \raisebox{\@tempdima}{#3}\nobreak\hskip\sgcolsep\nobreak% +% setting on next line reestablishes black as text color after sgame is done +% (in case of a float to the top of the page(?)) + \color{black}% + \begin{gtabular}{@{}r|*{#2}{c|}}\omit\@@amp% +% \color command on next line can be omitted if it causes problems + \multispan{#2}\hfil\makebox[0pt]{\color{\sgtextcolor}#4}\sg@strut\hfil% + \@tabularcr\omit\setbox0=\hbox\bgroup% + \ignorespaces% + }% +} + +\def\gtabular{\def\@halignto{}\@gtabular} + +% In the following, \\ redefines & the first time it is executed (so that +% the second and subsequent rows can be set differently from the first one); +% & redefines \\ to be null on the bottom row, so that the final row can +% end in \\. [Other less convoluted ways of achieving the same effect fail +% because parts of \if can't contains \cr and \omit has to immediately follow +% \cr.] + +{%\catcode`\&=\active + \gdef\@gtabular{% + \leavevmode \hbox \bgroup $\let\@acol\@tabacol% + \let\@classz\@tabclassz% + \let\@classiv\@tabclassiv% + \def\\{% + \gdef\>{\color{\sglinecolor}% + \ifgamemath% + \ifnum\sg@colindex=1% + \else$\fi% + \fi% + \unskip\egroup% + \ifdim\sg@colwd<\wd0% + \global\sg@colwd\wd0% + \else\fi% + \hfil\box0% + \ifnum\sg@colindex=1% + {\global\sg@colwd\sg@xcolwd\global\sg@colindex2}% + \else\hfil\fi% + \sg@strut\@@amp% + \setbox0=\hbox\bgroup\ignorespaces% + \ifgamemath$\fi% + \ifnum\sg@rowindex=\sg@numrows% +% \gdef\\{\unskip}% + \let\\=\unskip% + \else\fi\ignorespaces% + }% + \color{\sglinecolor}% + \ifgamemath% + \ifnum\sg@rowindex=0% + \else$% + \fi% + \fi% + \unskip\egroup% + \ifdim\sg@colwd<\wd0% + \global\sg@colwd\wd0% + \else\fi% + \hfil\box0\hfil\global\sg@colindex 1\relax% + \sg@strut\cr\cline{2-\sg@numcols}% + {\global\advance\sg@rowindex by 1}% + {\global\sg@xcolwd\sg@colwd}% + {\global\sg@colwd 0pt}% + \setbox0=\hbox\bgroup\ignorespaces% + }% + \@tabarray% + } +} + +\def\endgame{% + \end{gtabular}% + \global\gamevalignfalse% + \let\arraystretch=\tempstretch% + \let\tabcolsep=\sg@tempsep% +% \catcode`\&=4% +\relax% +} + +\def\sg@putlabel#1{% + \ifirpawcgl% + \noalign{\vspace\sglabelsep}% + \multispan\sg@numcols\hfil% + \hbox to 0pt{\color{\sgtextcolor}\hss\@gamelab\hss}\hfil\sg@strut\cr% + \else\ifirplwcgl% + \noalign{\vspace\sglabelsep}% + \multispan\sg@numcols\hfil\hbox to 0pt{% + \setbox1=\hbox{\@rowpllabel}% + \@tempdima\wd1% + \advance\@tempdima by \sgcolsep% + \color{\sgtextcolor}\hss\@gamelab\hss\hspace*{\@tempdima}}% + \hfil\sg@strut\cr% + \else% + \noalign{\vspace\sglabelsep}% + \if#1u + \omit&\multispan\sg@xnumcols\hfil% + \else + \multispan\sg@numcols\hfil% + \fi + \hbox to 0pt{\color{\sgtextcolor}\hss\@gamelab\hss}\hfil\sg@strut\cr + \fi\fi +} + +% The following sets a "phantom" line below the table in which each +% entry under the payoff matrix has the width of the widest entry in +% the payoff matrix (so that all columns of the matrix have the same width). + +\def\endgtabular{% + \unskip\color{\sglinecolor}% + \ifgamemath$\fi% + \egroup% + \ifdim\sg@colwd<\wd0 + \global\sg@colwd\wd0 + \fi + \hfil\box0\hfil\sg@strut% + \cr% + \cline{2-\sg@numcols}% +% If game has a label, add a row with the label + \ifsg@label% + \sg@putlabel{u}% + \fi +% + \omit +% Set a phantom row to make all the columns have the same width + \xdef\enoughcols{}% see p. 373 of TeXbook re. next few lines + \loop + \ifnum\sg@colnum<\sg@numcols + \xdef\enoughcols{% + \enoughcols\@@amp% + \omit\hskip\sgcolsep\hbox to\sg@colwd{\hfil}\hskip\sgcolsep% + } + \advance\sg@colnum by1% + \repeat% + \enoughcols\crcr\egroup\egroup $\egroup% +} + +%---------------------% +% game* environment % +%---------------------% + +\expandafter \def\csname game*\endcsname #1#2{% + \sg@initgame% + \advance\sg@rowindex by1 + \@gifnextchar[{\@gamestaro{#1}{#2}}{\sg@labelfalse\@gamestar{#1}{#2}}% +} + +\def\@gamestaro#1#2[#3]{% + \@gifnextchar[{\@gamestaroo{#1}{#2}[#3]}% +{\sg@labeltrue\@gamestarlabel{#1}{#2}[#3]}% +} + +\def\@gamestaroo#1#2[#3][#4]{% + \@gifnextchar[{\sg@labeltrue\@gamestarplslabel{#1}{#2}[#3][#4]}% + {\sg@labelfalse\@gamestarpls{#1}{#2}[#3][#4]}% +} + +{%\catcode`\&=\active +% + \gdef\@gamestarlabel#1#2[#3]{\gdef\@gamelab{#3}\@gamestar{#1}{#2}} +% + \gdef\@gamestar#1#2{% +% \catcode`\&=\active% + \sg@makegstrutbox{\sg@alignchar}% + \gdef\>{\color{\sglinecolor}% + \ifgamemath$\fi% + \unskip\egroup% + \ifdim\sg@colwd<\wd0 + \global\sg@colwd\wd0 + \else\fi% + \hfil\box0\hfil% + \sg@strut\@@amp% + \setbox0=\hbox\bgroup\ignorespaces% + \ifgamemath$\fi% + \ifnum\sg@rowindex=\sg@numrows% +% \gdef\\{\unskip}% + \let\\=\unskip% + \else\fi\ignorespaces% + }% + \sg@numrows=#1\sg@numcols=#2% + \color{\sglinecolor}% + \begin{gstartabular}{@{}|*{#2}{c|}}% +\hline\setbox0=\hbox\bgroup\ignorespaces% + } + + \gdef\@gamestarplslabel#1#2[#3][#4][#5]{% +\gdef\@gamelab{#5}\@gamestarpls{#1}{#2}[#3][#4]} + + \gdef\@gamestarpls#1#2[#3][#4]{% +% \catcode`\&=\active% + \sg@makegstrutbox{\sg@alignchar}% + \gdef\@rowpllabel{#3}% + \def\>{\unskip\egroup% + \ifdim\sg@colwd<\wd0% + \global\sg@colwd\wd0% + \else\fi% + \hfil\color{\sgtextcolor}\box0\hfil\sg@strut\@@amp% + \setbox0=\hbox\bgroup\ignorespaces% + }% + \sg@numrows=#1\sg@numcols=#2% +% Row player label is not part of alignment. To get its vertical position +% right, need to compensate for rows of action labels at top of game, column +% player label, and, if it exists, game label at bottom plus \sglabelsep. + \@tempdima\ht\sg@strutbox% + \advance\@tempdima\dp\sg@strutbox% + \multiply\@tempdima by -1% + \divide\@tempdima by2% + \ifsg@label% + \@tempdimb\sglabelsep% + \divide\@tempdimb by 2% + \advance\@tempdima by \@tempdimb% + \@tempdimb\ht\sg@strutbox% + \advance\@tempdimb by\dp\sg@strutbox% + \divide\@tempdimb by 2% + \advance\@tempdima by\@tempdimb% + \fi% + \raisebox{\@tempdima}{#3}\nobreak\hskip\sgcolsep\nobreak% + \color{\sglinecolor}% + \begin{gstartabular}{@{}|*{#2}{c|}}% + \multispan#2\hfil\makebox[0pt]{\color{\sgtextcolor}#4}\sg@strut\hfil% + \@tabularcr\hline\setbox0=\hbox\bgroup% + \ignorespaces% + } +} + +\def\gstartabular{\def\@halignto{}\@gstartabular} + +{%\catcode`\&=\active% + \gdef\@gstartabular{% + \leavevmode \hbox \bgroup $\let\@acol\@tabacol% + \let\@classz\@tabclassz% + \let\@classiv\@tabclassiv% + \def\\{% + \color{\sglinecolor}% + \ifgamemath$\fi% + \unskip\egroup% + \ifdim\sg@colwd<\wd0% + \global\sg@colwd\wd0% + \else\fi% + \hfil\box0\hfil% + \sg@strut\cr\hline% + {\global\advance\sg@rowindex by 1}% + \setbox0=\hbox\bgroup\ignorespaces% + }% + \@tabarray% + }% +} + +\expandafter \def \csname endgame*\endcsname{% + \end{gstartabular}% + \global\gamevalignfalse% + \let\arraystretch=\tempstretch% + \let\tabcolsep=\sg@tempsep% +% \catcode`\&=4% +\relax% +} + +% The following sets a "phantom" line below the matrix in which each +% entry has the width of the widest entry in the matrix (so that all +% columns have the same width). + +\def\endgstartabular{% + \unskip\color{\sglinecolor}% + \ifgamemath$\fi% + \egroup% + \ifdim\sg@colwd<\wd0% + \global\sg@colwd\wd0% + \fi% + \hfil\box0\hfil\sg@strut% + \cr% + \hline% +% If game has a label, add a row with the label + \ifsg@label% + \sg@putlabel{s}% + \fi% +% + \omit\hskip\sgcolsep\hbox to\sg@colwd{\hfil}\hskip\sgcolsep% +% Set a phantom row to make all the columns have the same width + \xdef\enoughcols{}% see p. 373 of TeXbook re. next few lines + \loop + \ifnum\sg@colnum<\sg@numcols% + \xdef\enoughcols{% + \enoughcols\@@amp% + \omit\hskip\sgcolsep\hbox to\sg@colwd{\hfil}\hskip\sgcolsep% + }% + \advance\sg@colnum by1% + \repeat% + \enoughcols\crcr\egroup\egroup $\egroup% +} + +%--------------------------------------------------------------------% +% Define \@gifnextchar along the lines of LATEX's \@ifnextchar, % +% except do not gobble spaces: if next token is a space then execute % +% #3. (\@ifnextchar doesn't work for some reason: if & is the next % +% token then something goes wrong.) % +%--------------------------------------------------------------------% +\def\@gifnextchar#1#2#3{\let\@tempe#1\def\@tempa{#2}\def\@tempb{#3}% +\futurelet\@tempc\@gifnch} + +\def\@gifnch{\ifx\@tempc\@sptoken\let\@tempd\@tempb% +\else\ifx\@tempc\@tempe\let\@tempd\@tempa\else\let\@tempd\@tempb\fi\fi\@tempd} + diff --git a/Master/texmf-dist/tpm/sgame.tpm b/Master/texmf-dist/tpm/sgame.tpm index 9b0f99c9349..b4a0273949f 100644 --- a/Master/texmf-dist/tpm/sgame.tpm +++ b/Master/texmf-dist/tpm/sgame.tpm @@ -3,7 +3,7 @@ sgame Package - 2006/01/09 00:49:07 + 2006/02/13 00:00:00 1.0 rahtz LaTeX style for typesetting strategic games @@ -23,11 +23,16 @@ within the boxes. Martin J. Osborne 86316 - + texmf-dist/tex/latex/sgame/sgame.sty +texmf-dist/tex/latex/sgame/sgamevar.sty texmf-dist/tpm/sgame.tpm - texmf-dist/doc/latex/sgame/sgame.pdf + +texmf-dist/doc/latex/sgame/README +texmf-dist/doc/latex/sgame/sgame.pdf +texmf-dist/doc/latex/sgame/sgame.tex + Package/sgame diff --git a/Master/texmf/lists/sgame b/Master/texmf/lists/sgame index 1c29029ce0b..9413bb3fa20 100644 --- a/Master/texmf/lists/sgame +++ b/Master/texmf/lists/sgame @@ -1,6 +1,9 @@ +texmf-dist/doc/latex/sgame/README texmf-dist/doc/latex/sgame/sgame.pdf +texmf-dist/doc/latex/sgame/sgame.tex texmf-dist/tex/latex/sgame/sgame.sty +texmf-dist/tex/latex/sgame/sgamevar.sty texmf-dist/tpm/sgame.tpm texmf/lists/sgame -- cgit v1.2.3