summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/sgame/sgame.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-06-26 22:53:35 +0000
committerKarl Berry <karl@freefriends.org>2013-06-26 22:53:35 +0000
commit96921825b194de6f86a0e9aade7fc399c0a7726d (patch)
treed476cf9986ea161240f19ce01b9dc543acbdf134 /Master/texmf-dist/doc/latex/sgame/sgame.tex
parentf91636f5e12ea90463ff4ba06bbcd1087afa0286 (diff)
sgame (26jun13)
git-svn-id: svn://tug.org/texlive/trunk@30959 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/sgame/sgame.tex')
-rw-r--r--Master/texmf-dist/doc/latex/sgame/sgame.tex230
1 files changed, 190 insertions, 40 deletions
diff --git a/Master/texmf-dist/doc/latex/sgame/sgame.tex b/Master/texmf-dist/doc/latex/sgame/sgame.tex
index 4165a76086c..f86e52139bb 100644
--- a/Master/texmf-dist/doc/latex/sgame/sgame.tex
+++ b/Master/texmf-dist/doc/latex/sgame/sgame.tex
@@ -1,13 +1,17 @@
%
-%
+% BaKoMa
%
\documentclass[12pt]{article}
\usepackage{mjoarti}
\usepackage{mathpazo}
\usepackage{pstricks}
-\usepackage{pst-mjo}
+\usepackage{pst-mjo,pst-node}
\usepackage{sgame}
\usepackage{url}
+
+\oddsidemargin=0.38in
+\topmargin0pt
+
\begin{document}
\renewcommand{\descriptionlabel}[1]{\hspace\labelsep
@@ -18,25 +22,28 @@
by\\
Martin J. Osborne\\
{\tt Martin.Osborne@utoronto.ca}\\
-For Version 2.14, 2008-12-2
+For Version 2.15, 2013-6-24
\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 style
+\begin{verse}
+\url{http://www.economics.utoronto.ca/osborne/latex}.
+\end{verse} The style
\texttt{sgamevar.sty} (but not \texttt{sgame.sty}) is compatible with
\texttt{beamer}. Both styles are incompatible with the \texttt{memoir} class
-and with \texttt{array.sty} (and hence any package, like \texttt{jurabib.sty},
-that loads \texttt{array.sty}). Please notify me of bugs.
+and with \texttt{tablularx.sty} and \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
+using \verb+sgamevar.sty+, replace every subsequent 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
@@ -56,19 +63,14 @@ 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 To use the package in a document, put the line
+\verb+\usepackage{sgame}+ or \verb+\usepackage{sgamevar}+ in the preamble.
\end{itemize}
\section{Compatibility with other packages}
\begin{itemize}
\item The style is incompatible with \verb+colortbl.sty+.
- \item To use in \verb+beamer+, put a game in a\newline
-\verb+\begin{frame}[fragile]...\end{frame}+ environment.
+ \item In \verb+beamer+, use \verb+sgamevar+ (or put a game in a\newline
+\verb+\begin{frame}[fragile]...\end{frame}+ environment).
\item In the case of incompatibilities with other styles, try using
\verb+sgamevar+ rather than \verb+sgame+.
\end{itemize}
@@ -76,9 +78,9 @@ which loads \verb+color+) in the preamble.
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.
+version in that action labels are not accommodated.
\subsection{No optional argument}
-Without any optional arguments, its syntax is\vspace*{4mm}\newline
+Without any optional arguments, the syntax for a game 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
@@ -94,13 +96,13 @@ The following example is illustrated in Figure~\ref{f:ex1}.
\def\sglinecolor{red}%
\begin{figure}[htb]\hspace*{\fill}%
\begin{game}{2}{2}
- & $L$ & $R$\\
-$T$ &$2,2$ &$100,35$\\
-$B$ &$3,0$ &$350,16$
+ & $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$
+$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.}
@@ -123,11 +125,10 @@ $3,0$&$350,16$
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 Note that the width of every column is the same and the
+content of each cell is centered vertically.
+ \item As of version 2.15, spaces on either side of
+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.}
\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.)
@@ -158,14 +159,14 @@ 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$
+ & $L$ & $R$\\
+$a$ &$2,2,1$ &$0,3,0$\\
+$b$ &$3,0,2$ &$1,1,4$
\end{game}\hspace*{20mm}%
\begin{game}{2}{2}[$B$]
- & $L$ & $R$\\
-$a$ &$2,3$ &$0,4$\\
-$b$ &$3,1$ &$1,2$
+ & $L$ & $R$\\
+$a$ &$2,3,0$ &$0,4,1$\\
+$b$ &$3,1,2$ &$1,2,0$
\end{game}\hspace*{\fill}%
\caption[]{A three player strategic game, in which
player~3 chooses $A$ or $B$.}
@@ -175,13 +176,13 @@ player~3 chooses $A$ or $B$.}
\begin{figure}[htb]\hspace*{\fill}%
\begin{game}{2}{2}[$A$]
& $L$ & $R$\\
-$a$ &$2,2$ &$0,3$\\
-$b$ &$3,0$ &$1,1$
+$a$ &$2,2,1$ &$0,3,0$\\
+$b$ &$3,0,2$ &$1,1,4$
\end{game}\hspace*{20mm}%
\begin{game}{2}{2}[$B$]
& $L$ & $R$\\
-$a$ &$2,3$ &$0,4$\\
-$b$ &$3,1$ &$1,2$
+$a$ &$2,3,0$ &$0,4,1$\\
+$b$ &$3,1,2$ &$1,2,0$
\end{game}\hspace*{\fill}%
\caption[]{A three player strategic game, in which player~3 chooses $A$ or
$B$.}\label{f:ex2}
@@ -467,6 +468,7 @@ $B$ &$3,0$ &$350,16$
\end{figure}
\end{verbatim}
+{
\def\sgtextcolor{blue}%
\def\sglinecolor{red}%
\renewcommand{\gamestretch}{2}
@@ -479,7 +481,148 @@ $B$ &$3,0$ &$350,16$
\end{game}\hspace*{\fill}%
\caption[]{Thick lines.}
\end{figure}
+}
+
+\section{Crossing out actions}\label{s:crossingout}
+If you know nothing about \LaTeX, you may think that creating
+Figure~\ref{f:crossout} is easy. If you know a bit about \LaTeX, you may
+think that creating it is impossible. Given PSTricks, the na\umlaut{\i}f is
+right: all you need to do is add \verb+\usepackage{pstricks,pst-node}+ to the
+preamble of your document, define a couple of macros specifying what the
+strikeout lines should look like, add some node labels to the game, and
+specify how the nodes should be connected. The only difficulty comes in
+getting the lengths of the lines right. I have been unable to get the
+parameters to work as they are described in Tim van Zandt's manual, but with
+the help of BaKoMa Word it's easy to fiddle around with them until the lines
+are the way you want them. The code for this game follows the figure.
+
+\def\sgtextcolor{black}%
+\def\sglinecolor{black}%
+\newcommand\strike[2]{%
+ \ncline[linewidth=0.8pt,nodesep=8pt]{#1}{#2}}
+\newcommand\redStrike[2]{%
+ \ncline[linewidth=0.8pt,nodesep=-14pt,linecolor=red]{#1}{#2}}
+
+\begin{figure}[htb]\hspace*{\fill}%
+\begin{game}{2}{2}
+&\rnode[t]{a12}{$L$}&$R$\\
+ \Rnode[href=20]{a21}{$T$}&$1,1$&\Rnode{a23}{$2,2$}\\
+ $B$&\rnode[b]{a32}{$2,2$}&$3,3$
+\end{game}%
+\hspace*{\fill}%
+\caption[]{Crossing out actions in a strategic game.}\label{f:crossout}
+\end{figure}
+\strike{a21}{a23}
+\redStrike{a12}{a32}
+
+\begin{verbatim}
+\def\sgtextcolor{black}%
+\def\sglinecolor{black}%
+% define the strikeout lines
+\newcommand\strike[2]{%
+ \ncline[linewidth=1.2pt,nodesep=8pt]{#1}{#2}}
+\newcommand\redStrike[2]{%
+ \ncline[linewidth=1.2pt,nodesep=-14pt,linecolor=red]{#1}{#2}}
+
+\begin{game}{2}{2}
+ &\rnode[t]{a12}{$L$} &$R$\\
+\Rnode[href=20]{a21}{$T$} &$1,1$ &\Rnode{a23}{$2,2$}\\
+$B$ &\rnode[b]{a32}{$2,2$} &$3,3$
+\end{game}
+% specify the nodes to be connected
+\strike{a21}{a23}
+\redStrike{a12}{a32}
+\end{verbatim}
+
+\section{Coloring cells}\label{s:coloredCell}
+The package is incompatible with \texttt{colortbl.sty}. However, here's one
+way to color cells. It is not elegant: you need to manually coordinate the
+parameters (which is easy using BaKoMa, but not otherwise). But it works; the
+output is in Figure~\ref{f:coloredCell}.
+
+\begin{verbatim}
+\sgcolsep=0.5pt
+\renewcommand{\gamestretch}{1.5}
+\def\highlight#1{\colorbox{yellow}{#1}}
+\fboxsep=6pt
+
+\begin{figure}[htb]\hspace*{\fill}%
+\begin{game}{2}{2}
+&$L$&$R$\\
+$T$\hspace{\fboxsep}&\highlight{$1,1$}&$2,2$\\
+$B$\hspace{\fboxsep}&$3,0$&$0,3$\\
+\end{game}\hspace*{\fill}%
+\caption[]{A game with a colored cell.}\label{f:coloredCell}
+\end{figure}
+\end{verbatim}
+
+\sgcolsep=0.5pt
+\renewcommand{\gamestretch}{1.5}
+\def\highlight#1{\colorbox{yellow}{#1}}
+\fboxsep=6pt
+
+\begin{figure}[htb]\hspace*{\fill}%
+\begin{game}{2}{2}
+&$L$&$R$\\
+$T$\hspace{\fboxsep}&\highlight{$1,1$}&$2,2$\\
+$B$\hspace{\fboxsep}&$3,0$&$0,3$\\
+\end{game}\hspace*{\fill}%
+\caption[]{A game with a colored cell.}\label{f:coloredCell}
+\end{figure}
+
+\section{Extra columns and rows}\label{s:extraColumn}
+Sometimes you may want to add a column to the right of a game, or a row below it, or both, as in
+Figure~\ref{f:extraColumn}. You can do so using the trick of putting the extra text
+ 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.
+
+\begin{verbatim}
+\def\hangUnder#1{%
+ \hbox to 0pt{\hspace{-11pt}\raisebox{-8mm}[0pt][0pt]{#1}}%
+}
+\sgcolsep=5pt
+\begin{figure}[htb]\hspace*{\fill}%
+\begin{game}{3}{3}
+&$L$ (0)%
+ &$C$ (${\textstyle\frac{1}{3}}$)%
+ &$R$ (${\textstyle\frac{2}{3}}$)\\
+$T$ (${\textstyle\frac{3}{4}}$)%
+ &$1,2$%
+ &$3,3$%
+ &$1,1$\hbox to 0pt{\hspace{20pt}${\textstyle\frac{5}{3}}$}\\
+$M$ (0)%
+ &$1,2$%
+ &$0, 1$%
+ &$2, 2$\hbox to 0pt{\hspace{20pt}${\textstyle\frac{4}{3}}$}\\
+$B$ (${\textstyle\frac{1}{4}}$)%
+ &$1,4$\hangUnder{$\frac{5}{2}$}%
+ &$5,1$\hangUnder{$\frac{5}{2}$}%
+ &$0,7$\hangUnder{$\frac{5}{2}$}%
+ \hbox to 0pt{\hspace{20pt}${\textstyle\frac{5}{3}}$}\\
+\end{game}\hspace*{\fill}%
+\vspace{8mm}
+\caption[]{A game with an extra column and row.}\label{f:extraColumn}
+\end{figure}
+\end{verbatim}
+\def\hangUnder#1{\hbox to 0pt{\hspace{-11pt}\raisebox{-8mm}[0pt][0pt]{#1}}}
+\sgcolsep=5pt
+\begin{figure}[htb]\hspace*{\fill}%
+\begin{game}{3}{3}
+&$L$ (0)&$C$ (${\textstyle\frac{1}{3}}$)&$R$ (${\textstyle\frac{2}{3}}$)\\
+$T$ (${\textstyle\frac{3}{4}}$)&$1,2$&$3,3$&$1,1$\hbox to
+0pt{\hspace{20pt}${\textstyle\frac{5}{3}}$}\\
+$M$ (0)&$1,2$&$0, 1$&$2, 2$\hbox to
+0pt{\hspace{20pt}${\textstyle\frac{4}{3}}$}\\
+$B$ (${\textstyle\frac{1}{4}}$)%
+ &$1,4$\hangUnder{$\frac{5}{2}$}%
+ &$5,1$\hangUnder{$\frac{5}{2}$}%
+ &$0,7$\hangUnder{$\frac{5}{2}$}%
+ \hbox to
+0pt{\hspace{20pt}${\textstyle\frac{5}{3}}$}\\
+\end{game}\hspace*{\fill}%
+\vspace{8mm}
+\caption[]{A game with an extra column and row.}\label{f:extraColumn}
+\end{figure}
\section{Parameters}\label{s:param}
@@ -546,7 +689,7 @@ player labels). Default: \verb+black+. Example:
\section{History}
\subsection*{Version 1}
\begin{description}
-\item[1993/12] First version.
+\item[1993-12] First version, following a suggestion of Michael Carter.
\end{description}
\subsection*{Version 2}
\begin{description}
@@ -565,9 +708,16 @@ functionality added. Parameters added: \verb+\gamevaligntrue+,
\item[2008-12-2 (version 2.14)] Minor bug fix: length of bottom line (bug
inherited from \verb+tabular+ environment; noticeable only when lines are
thick). Bug pointed out by Marcel Priebsch.
-\end{description}
+\item[2010-11-1] Section~\ref{s:crossingout} added to the manual, following a
+query by a user.
+\item[2011-1-14] Section~\ref{s:coloredCell} added to the manual.
+\item[2013-2-9] Section~\ref{s:extraColumn} added to the manual.
+\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.
+ 2.\ The \texttt{color} package is now loaded by the style, and does not need to be loaded explicitly. \end{description}
}
\end{document}
+%
+