diff options
author | Karl Berry <karl@freefriends.org> | 2006-09-24 13:24:59 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-09-24 13:24:59 +0000 |
commit | 52070124a281591790b169745b1d45844b513a91 (patch) | |
tree | 9a1efa33f2ed74f34f08156eec0209ddf753e7fe /Master/texmf-dist/doc | |
parent | e4243632c40826eeb4ceb96028e31c613b27acad (diff) |
egameps update (22sep06)
git-svn-id: svn://tug.org/texlive/trunk@2188 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc')
-rw-r--r-- | Master/texmf-dist/doc/latex/egameps/README | 6 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/egameps/egameps.pdf | bin | 130122 -> 144082 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/egameps/egameps.tex | 1549 |
3 files changed, 1555 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/egameps/README b/Master/texmf-dist/doc/latex/egameps/README new file mode 100644 index 00000000000..3e3362641dd --- /dev/null +++ b/Master/texmf-dist/doc/latex/egameps/README @@ -0,0 +1,6 @@ +The style is intended to have enough features to typeset any +extensive game with relative ease. The facilities of +PSTricks are used. +(An older version of the package, which uses the LaTeX picture +environment rather than PSTricks and consequently has many fewer +features is available on the package home page.)
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/egameps/egameps.pdf b/Master/texmf-dist/doc/latex/egameps/egameps.pdf Binary files differindex 1bf5e21d502..bb1065a843a 100644 --- a/Master/texmf-dist/doc/latex/egameps/egameps.pdf +++ b/Master/texmf-dist/doc/latex/egameps/egameps.pdf diff --git a/Master/texmf-dist/doc/latex/egameps/egameps.tex b/Master/texmf-dist/doc/latex/egameps/egameps.tex new file mode 100644 index 00000000000..20c902f954f --- /dev/null +++ b/Master/texmf-dist/doc/latex/egameps/egameps.tex @@ -0,0 +1,1549 @@ +% +% Changes relative to egame.sty: +% 1. No anomalous cases for \iib +%2. eginfods changed to eginfodotsep +%3. No small disks at ends of histories +% +%Allows any slope for branches, and any style. +% +\documentclass[12pt]{article} +\usepackage{mjoarti} +\usepackage{pstricks} +\usepackage{pstcol,pst-mjo,pst-3d} +\usepackage{url} +\usepackage{egameps} +\begin{document} + +\renewcommand{\descriptionlabel}[1]{\hspace\labelsep + \normalfont #1\phantom{.}} + +\begin{center} +{\bfseries Manual for {\tt egameps.sty}}\\ +by\\ +Martin J. Osborne\\ +{\tt martin.osborne@utoronto.ca}\\ +Version 1.1, June 2004\\ +(based on \texttt{egame.sty}, November 1997) +\end{center} + + +\section{Introduction} +{\tt egameps.sty} is a \LaTeX2e\ style file for drawing extensive games. It +is intended to have the capability of drawing any extensive game. It is not +very fast (probably because it is not written very efficiently, but possibly +simply because it needs to make a lot of computations). The latest version is +available at \url{http://www.economics.utoronto.ca/osborne/latex/}. + +The style requires the PSTricks package (available on CTAN; documented in +\emph{The \LaTeX\ Graphics Companion}) and a means of printing a Postscript +file (e.g.\ a Postscript printer, or a non-Postscript printer and the program +Ghostscript). Because the style uses the PSTricks macros, it is incompatible +with \verb+pdftex+. You may produce a pdf file by first creating a dvi file +normally, then using \verb+dvips+ to create a Postscript file, and finally +using Ghostscript to create a pdf file from the Postscript file. (If your +operating system is DOS or Windows, you can automate this process in a batch +file. If your text editor is sufficiently configurable, you will be able to +initiate the process with a single keystroke.) Alternatively, you use the +\verb+pdftricks+ package to finesse the limitation of \verb+pdftex+; see +Section~\ref{s:pdftricks}. +\section{Installation} +\begin{itemize} + \item Put \texttt{egameps.sty} in a directory from which \TeX\ reads input +files. (In MiKTeX the directory might be something like +\url{\miktex\localtexmf\tex\latex\} or a subdirectory thereof.) + \item Let \TeX\ know that \texttt{egameps} has arrived. (In MiKTeX, +``refresh the filename database''.) + \item Check that you have PSTricks. If you do not, get it from CTAN. + \item To use the package in a document, put the lines\newline +\indent\verb+\usepackage{pstricks}+\newline +\indent\verb+\usepackage{pstcol}+\newline +\indent\verb+\usepackage{egameps}+\newline +in the preamble. To use the macro \verb+\ctmbarc+ you need to include also +the line\newline +\indent\verb+\usepackage{pst-3d}+ +\end{itemize} +\section{Using the style} +To draw a game using the style, first break the game into components, each +consisting of a node together with the branches that emanate from it, the +names with which the actions are labeled, and the players' payoffs if the +nodes at the end of the branches are terminal. To draw each component, calls +to two macros are needed. First \verb+\putbranch+ is called, which sets the +position of the node and the slope and length of the branch(es), then either +\verb+\ib+, \verb+\iib+, or \verb+\iiib+. The macro \verb+\ib+ draws a single +branch, while \verb+\iib+ and \verb+\iiib+ draw two and three branches +respectively. If the node has more than three branches, calls to a +combination of these macros are needed. + +A game is begun by a call of the type\newline +\indent\verb+\begin{egame}400,500)+\newline +which starts a \verb+pspicture+, with dimensions $(400,500)$ and the +unitlength equal to the default of 0.1mm, or\newline +\indent\verb+\begin{egame}(400,500)[1mm]+\newline +which starts a \verb+pspicture+, with dimensions $(400,500)$ and sets the +unitlength at 1mm. + +The next section gives examples that illustrate many of the features of the +package. Precise descriptions of the macros are given in +Section~\ref{s:descr}. +\section{Examples} +The game in Figure~\ref{f:one} is produced by the following code. + +%%%%%%%%%%%%%% +%% EXAMPLE 1 % +%%%%%%%%%%%%%% +\begin{verbatim} +\begin{figure}[htb] +\hspace*{\fill} +\begin{egame}(600,280) +% +% put the initial branch at (300,240), with (x,y) direction +% (2,1), and horizontal length 200 +\putbranch(300,240)(2,1){200} +% +% give the branch two actions, label it for player 1, +% and label the actions $L$ and $R$ +\iib{1}{$L$}{$R$} +% +% put a branch at (100,140), with (x,y) direction +% (1,1) and horizontal length 100 +\putbranch(100,140)(1,1){100} +% +% give the branch two actions, omit a player label, +% label the actions $a$ and $b$, and assign the payoffs +% $1,0$ and $2,3$ to these actions +\iib{}{$a$}{$b$}[$1,0$][$2,3$] +% +% put a branch at (500,140), with (x,y) direction (1,1) +% and horizontal length 100 +\putbranch(500,140)(1,1){100} +% +% give the branch two actions, omit a player label, +% label the actions $c$ and $d$, and assign the payoffs +% $0,1$ and $-1,0$ to these actions +\iib{}{$c$}{$d$}[$0,1$][$-1,0$] +% +% draw an information set between the nodes at (100,140) +% and (500,140) +\infoset(100,140){400}{2} +% +\end{egame} +\hspace*{\fill} +\caption[]{An extensive game}\label{f:one} +\end{figure} +\end{verbatim} + +\begin{figure}[htb] +\hspace*{\fill} +\begin{egame}(600,280) +\putbranch(300,240)(2,1){200} +\iib{1}{$L$}{$R$} +\putbranch(100,140)(1,1){100} +\iib{}{$a$}{$b$}[$1,0$][$2,3$] +\putbranch(500,140)(1,1){100} +\iib{}{$c$}{$d$}[$0,1$][$-1,0$] +\infoset(100,140){400}{2} +\end{egame} +\hspace*{\fill} +\caption[]{An extensive game}\label{f:one} +\end{figure} + +Another example, illustrating more features, is produced by the following +code, and is shown in Figure~\ref{f:two}. + +%%%%%%%%%%%%%% +%% EXAMPLE 2 % +%%%%%%%%%%%%%% + +\begin{verbatim} +\begin{figure}[htb] +\hspace*{\fill} +% +% fill boxes containing payoffs with a solid red color +\renewcommand{\egpayboxfillstyle}{solid} +\renewcommand{\egpayboxfillcolor}{red} +% add a bit of separation around the payoffs +\egpayoffboxsep=1mm +% +% fill boxes containing action labels with a solid blue color +\renewcommand{\egalboxfillstyle}{solid} +\renewcommand{\egalboxfillcolor}{blue} +\egactionboxsep=1mm +% +% put player labels in green circles +\renewcommand{\egplbox}{c} +\renewcommand{\egplboxlinestyle}{solid} +\renewcommand{\egplboxlinecolor}{green} +\egplayerboxsep=1mm +% +\begin{egame}(500,280) +% +% put the initial branch at (300,240), with (x,y) direction +% (2,1), and horizontal length 200 +\putbranch(300,240)(2,1){200} +% +% give the branch three actions, label it for player 1, +% label the actions $L$, $M$, and $R$, and make the middle +% and right actions terminal, with payoffs $1,2$ and $0,1$ +\iiib{1}{$L$}{$M$}{$R$}[][$1,2$][$0,1$] +% +% put a branch at (100,140), with (x,y) direction +% (1,1) and horizontal length 100 +\putbranch(100,140)(1,1){100} +% +% give the branch two actions, make the left-hand one dashed, +% label the branch for player 2, putting +% the player label to the top left of the node, +% label the actions $a$ and $b$, and assign the payoffs +% $1,0$ and $2,3$ to these actions +\iib[linestyle=dashed][]{2}[l]{$a$}{$b$}[$1,0$][$2,3$] +% +\end{egame} +\hspace*{\fill} +\caption[]{Another extensive game}\label{f:two} +\end{figure} +\end{verbatim} + +\begin{figure}[htb] +\hspace*{\fill} +\renewcommand{\egpayboxfillstyle}{solid} +\renewcommand{\egpayboxfillcolor}{red} +\egpayoffboxsep=1mm +\renewcommand{\egalboxfillstyle}{solid} +\renewcommand{\egalboxfillcolor}{blue} +\egactionboxsep=1mm +\renewcommand{\egplbox}{c} +\renewcommand{\egplboxlinestyle}{solid} +\renewcommand{\egplboxlinecolor}{green} +\egplayerboxsep=1mm +\begin{egame}(500,280) +% +% put the initial branch at (300,240), with (x,y) direction +% (2,1), and horizontal length 200 +\putbranch(300,240)(2,1){200} +% +% give the branch three actions, label it for player 1, +% label the actions $L$, $M$, and $R$, and make the middle +% and right actions terminal, with payoffs $1,2$ and $0,1$ +\iiib{1}{$L$}{$M$}{$R$}[][$1,2$][$0,1$] +% +% put a branch at (100,140), with (x,y) direction +% (1,1) and horizontal length 100 +\putbranch(100,140)(1,1){100} +% +% give the branch two actions, label it for player 2, putting +% the player label to the top left of the node, +% label the actions $a$ and $b$, and assign the payoffs +% $1,0$ and $2,3$ to these actions +\iib[linestyle=dashed][]{2}[l]{$a$}{$b$}[$1,0$][$2,3$] +% +\end{egame} +\hspace*{\fill} +\caption[]{Another extensive game}\label{f:two} +\end{figure} + +Yet another example, illustrating still more features, is produced by the +following code, and is shown in Figure~\ref{f:three}. + +\begin{verbatim} +\begin{figure}[htb] +\hspace*{\fill} +% +\begin{egame}(600,480) +% +% put the initial branch at (300,240), with (x,y) direction +% (1,0), and horizontal length 200 +\putbranch(300,240)(1,0){200} +% +% give the branch two actions, label it for player $c$, +% and label the actions ${1\over 2}$ and ${1\over 2}$ +\iib{$c$}{${1\over 2}$}{${1\over 2}$} +% +% put a branch at (100,240), with (x,y) direction +% (0,1), going right, and vertical length 100. (Notes: If the +% branch were specified as going left, it would look the same, +% but the player label would be in the wrong place. The +% third mandatory argument of \putbranch is the horizontal +% distance unless the branch is vertical, in which case it is +% the vertical distance.) +\putbranch(100,240)(0,1)[r]{100} +% +% give the branch two actions, label it for player 1, +% and label the actions $a$ and $b$ +\iib{1}{$a$}{$b$} +% +% put a branch at (500,240), with (x,y) direction +% (0,1), going left, and vertical length 100. +\putbranch(500,240)(0,1)[l]{100} +% +% give the branch two actions, label it for player 1, +% and label the actions $b$ and $a$ +\iib{1}{$b$}{$a$} +% +% put an information set at (100,340), of length 400, +% assigned to player 2 +\infoset(100,340){400}{2} +% +% put an information set at (100,140), of length 400, +% assigned to player 2 +\infoset(100,140){400}{2} +% +% put a branch at (100,340), with (x,y) direction +% (1,1), going up, and horizontal length 100. +\putbranch(100,340)(1,1)[u]{100} +% +% specify a positive horizontal shift for the action labels, +% which slides the ones on the right-hand branches to the +% right along the branches and the ones on the left to the +% left, improving the label positions +\egalhshift=20 +% +% give the branch two actions, give it no player label, +% label the actions $L$ and $R$, and put payoffs of +% $-1,0$ and $0,-1$. +\iib{}{$L$}{$R$}[$-1,0$][$0,-1$] +% +% put a branch at (500,340), with (x,y) direction +% (1,1), going up, and horizontal length 100. +\putbranch(500,340)(1,1)[u]{100} +% +\egalhshift=20 +% +% give the branch two actions, give it no player label, +% label the actions $L$ and $R$, and put payoffs of +% $1,0$ and $0,1$. +\iib{}{$L$}{$R$}[$1,0$][$0,1$] +% +% put a branch at (100,140), with (x,y) direction +% (1,1), going down, and horizontal length 100. +\putbranch(100,140)(1,1)[d]{100} +% +\egalhshift=20 +% +% give the branch two actions, give it no player label, +% label the actions $L$ and $R$, and put payoffs of +% $2,0$ and $0,2$. +\iib{}{$L$}{$R$}[$1,0$][$0,1$] +% +% put a branch at (500,140), with (x,y) direction +% (1,1), going down, and horizontal length 100. +\putbranch(500,140)(1,1)[d]{100} +% +\egalhshift=20 +% +% give the branch two actions, give it no player label, +% label the actions $L$ and $R$, and put payoffs of +% $3,0$ and $0,3$. +\iib{}{$L$}{$R$}[$1,0$][$0,1$] +% +\end{egame} +\hspace*{\fill} +\caption[]{Yet another extensive game}\label{f:three} +\end{figure} +\end{verbatim} + +\begin{figure}[htb] +\hspace*{\fill} +\egpayoffboxsep=0mm +\begin{egame}(600,480) +\putbranch(300,240)(1,0){200} +\iib{$c$}{${1\over 2}$}{${1\over 2}$} +\putbranch(100,240)(0,1)[r]{100} +\iib{1}{$a$}{$b$} +\putbranch(500,240)(0,1)[l]{100} +\iib{1}{$b$}{$a$} +\infoset(100,340){400}{2} +\infoset(100,140){400}{2} +\putbranch(100,340)(1,1)[u]{100} +\egalhshift=20 +\iib{}{$L$}{$R$}[$-1,0$][$0,-1$] +\putbranch(500,340)(1,1)[u]{100} +\egalhshift=20 +\iib{}{$L$}{$R$}[$1,0$][$0,1$] +\putbranch(100,140)(1,1)[d]{100} +\egalhshift=20 +\iib{}{$L$}{$R$}[$2,0$][$0,2$] +\putbranch(500,140)(1,1)[d]{100} +\egalhshift=20 +\iib{}{$L$}{$R$}[$3,0$][$0,3$] +\end{egame} +\hspace*{\fill} +\caption[]{Yet another extensive game}\label{f:three} +\end{figure} + +The next example, shown in Figure~\ref{f:four}, shows how to combine calls to +\verb+\iib+ to draw nodes followed by four branches. + +\begin{verbatim} +\begin{figure}[htb] +\hspace*{\fill} +\begin{egame}(1200,380) +% +% put an initial node at (700,340), with (x,y) direction +% (3,1), and horizontal length 600 +\putbranch(700,340)(3,1){600} +% +% give the branch two actions, label it for player $1$, +% label the actions $A$ and $D$, and make the right- +% hand node terminal, with payoffs $0,1$. +\iib[linecolor=red][]{$1$}{$A$}{$D$}[][$0,1$] +% +% to add two more branches to the initial node, force +% the branch to be initial +\initialtrue +% and specify the direction (1,1) and the horizontal length 200 +\putbranch(700,340)(1,1){200} +% +% tighten the spacing between labels and branches, to improve +% appearance (given the other branches) +\egactionlabelsep=0.5mm +% give the branch two actions and label the actions $B$ and $C$ +\iib{}{$B$}{$C$} +% +% reset default spacing +\egactionlabelsep=1mm +% put a branch at (100,140), with direction (1,1) +% and horizontal length 100. +\putbranch(100,140)(1,1){100} +% +% give the branch two actions, omit a player label, +% label the actions $a$ and $b$, and put payoffs +\iib[][linecolor=red]{}{$a$}{$b$}[$2,1$][$4,0$] +% +% put a branch at (500,140), with direction (1,1) +% and horizontal length 100. +\putbranch(500,140)(1,1){100} +% +% give the branch two actions, omit a player label, +% label the actions $a$ and $b$, and put payoffs +\iib[][linecolor=red]{}{$a$}{$b$}[$1,3$][$-1,0$] +% +% put a branch at (900,140), with direction (1,1) +% and horizontal length 100. +\putbranch(900,140)(1,1){100} +% +% give the branch two actions, omit a player label, +% label the actions $a$ and $b$, and put payoffs +\iib[][linecolor=red]{}{$a$}{$b$}[$-1,0$][$2,1$] +% +% put an information set at (100,140), of length 800, +% assigned to player 2 +\infoset(100,140){800}{2} +% +\end{egame} +\hspace*{\fill} +\caption[]{Yet another extensive game}\label{f:four} +\end{figure} +\end{verbatim} + +\begin{figure}[htb] +\hspace*{\fill} +\begin{egame}(1300,380) +% +% put an initial node at (700,340), with (x,y) direction +% (6,1), and horizontal length 600 +\putbranch(700,340)(3,1){600} +% +% give the branch two actions, label it for player $1$, +% and label the actions $A$ and $D$, and make the right- +% hand node terminal, with payoffs $0,1$. +\iib[linecolor=red][]{$1$}{$A$}{$D$}[][$0,1$] +% +% to add two more branches to the initial node, force +% the branch to be initial +\initialtrue +% and specify the direction (2,1) and the horizontal length 200 +\putbranch(700,340)(1,1){200} +% +% tighten the spacing between labels and branches, to improve +% appearance (given the other branches) +\egactionlabelsep=0.2mm +% give the branch two actions and label the actions $B$ and $C$ +\iib{}{$B$}{$C$} +% +% reset default spacing +\egactionlabelsep=0.7mm +% put a branch at (100,140), with direction (1,1) +% and horizontal length 100. +\putbranch(100,140)(1,1){100} +% +% give the branch two actions, omit a player label, +% label the actions $a$ and $b$, and put payoffs +\iib[][linecolor=red]{}{$a$}{$b$}[$2,1$][$4,0$] +% +% put a branch at (500,140), with direction (1,1) +% and horizontal length 100. +\putbranch(500,140)(1,1){100} +% +% give the branch two actions, omit a player label, +% label the actions $a$ and $b$, and put payoffs +\iib[][linecolor=red]{}{$a$}{$b$}[$1,3$][$-1,0$] +% +% put a branch at (900,140), with direction (1,1) +% and horizontal length 100. +\putbranch(900,140)(1,1){100} +% +% give the branch two actions, omit a player label, +% label the actions $a$ and $b$, and put payoffs +\iib[][linecolor=red]{}{$a$}{$b$}[$-1,0$][$2,1$] +% +% put an information set at (100,140), of length 800, +% assigned to player 2 +\infoset(100,140){800}{2} +% +\end{egame} +\hspace*{\fill} +\caption[]{Yet another extensive game}\label{f:four} +\end{figure} + + +\section{Description of macros\label{s:descr}} +\verb+\begin{egame}(+\emph{width}\verb+,+\emph{height}% +{\tt )[}\emph{unitlength}\verb+]+\newline +\noindent begins an extensive game of width \emph{width} and height +\emph{height} and optionally sets the unitlength to be \emph{unitlength} +(default 0.1mm). In the game, all distances are given as integers, which are +interpreted as multiples of the unitlength. These integers should (probably) +be divisible by two, so that the integer arithmetic employed by \TeX\ doesn't +lose accuracy when numbers are divided by two. I have tested the macros +thoroughly only with the default unitlength of 0.1mm; unless there is a +compelling reason to use some different unitlength, I suggest sticking to +0.1mm. (\verb+\begin{egame}(w,h)+ starts a \verb+pspicture+ environment +(defined by PSTricks) of width {\tt w} and height {\tt h}.) + +Permissible values: +\begin{description} +\item[\emph{width}, \emph{height}] Any pair of integers. (You need to +calculate these numbers.) +\item[\emph{unitlength}] Any dimension. Default: 0.1mm. +\end{description} + +\vspace{4mm} + +\noindent\verb+\end{egame}+\newline +\noindent ends an extensive game. + +\vspace{4mm} + +\noindent\verb+\putbranch(+\emph{x-coord}\verb+,+\emph{y-coord}{\tt +)(}\emph{h-incr},\emph{v-incr}{\tt +)[}\emph{direction}\verb+]{+\emph{length}\verb+}+\newline +\noindent sets up the parameters for a branch at the point +$($\emph{x-coord}$,$\emph{y-coord}$)$, with direction parameter +$($\emph{h-incr}$,$\emph{v-incr}$)$, optional direction \emph{direction}, and +length \emph{length}. Note that this macro merely sets up the parameters for +a call to \verb+\ib+ (one branch), \verb+\iib+ (two branches), \verb+\iiib+ +(three branches), or \verb+\ctmb+ (continuum of branches); it does not draw +anything. The way in which the direction parameter +$($\emph{h-incr}$,$\emph{v-incr}$)$ is interpreted depends on whether +\verb+\ib+, \verb+\iib+, or \verb+\iiib+ is used to draw the branches. The +\emph{length} is the horizontal distance between the ends of one of the +branches to be drawn, unless \emph{h-incr} is 0, in which case \emph{length} +is the vertical distance between the ends of one of the branches. + +Permissible values: +\begin{description} +\item[$($\emph{x-coord}$,$\emph{y-coord}$)$] Any pair of integers. +\item[$($\emph{h-incr}$,$\emph{v-incr}$)$] Any pair of integers except +\verb+(0,0)+. +\item[\emph{direction}] {\tt d} (down), {\tt u} (up), {\tt r} (right), or {\tt +l} (left); default {\tt d}. (The direction can be changed also globally, by +specifying \verb+\egdirection{+\emph{direction}\verb+}+ before the call to +\verb+\putbranch+.) +\item[\emph{length}] Any positive integer. +\end{description} + +\vspace{4mm} + +\noindent\verb+\ib[+\emph{branchstyle}\verb+]{+\emph{player-name}\verb+}[+% +\emph{player-label-position}\verb+]{+\emph{action-label}\verb+}+\newline +\verb+[+\emph{action-label-position}\verb+][+\emph{payoffs}{\tt ]}\newline +\noindent puts a single branch with the parameters of the preceding call to +\verb+\putbranch+, optionally using the PSTricks style \emph{branchstyle}, +assigns it the player name \emph{player-name}, optionally positions the player +label relative to the node according to \emph{player-label-position}, labels +the action \emph{action-label}, optionally positions the label according to +\emph{player-label-position}, and optionally adds the payoffs \emph{payoffs}. +A single optional argument at the end is interpreted as follows: if its value +is \verb+o+ (outside), \verb+i+ (inside), or \verb+c+ (centered), it +determines the position of the action label; otherwise, it is a payoff label. +If there are two optional arguments, the first must be \verb+o+ (outside), +\verb+i+ (inside), or \verb+c+ (centered), determining the position of the +action label, and the second is a payoff label. (If you do not want an +optional positioning argument and you want your payoff label to be ``o'', +``i'', or ``c'', here's a workaround: put the label in an \verb+hbox+, as in +\verb+\hbox{o}+. (Note that you do not need to do this if your payoff label +is \verb+$o$+, etc.---only if it is just ``o''.) + +The first branch in any {\tt egame} is taken to be the initial branch of the +game; its beginning node is indicated by \verb+\eginode+, the default of which +is a small circle. Subsequent branches are taken to be noninitial, and are +indicated by \verb+\egnode+, the default value of which is a small disk. To +force a node to be initial, specify \verb+\initialtrue+ before it; to force a +node to be noninitial, specify \verb+\initialfalse+ before it. To change the +appearance of nodes, see Section~\ref{s:params}. + +Permissible values: +\begin{description} +\item[\emph{branchstyle}] Any PSTricks linestyle (e.g.\ \verb+linecolor=red+, +\verb+linestyle=dashed+, \verb+linewidth=2pt+, \verb+doubleline=true+). + +Default: \verb+linecolor=black+, \verb+linestyle=solid+, +\verb+linewidth=0.8pt+. +\item[\emph{player-name}] Any character string. +\item[\emph{player-label-position}] Either \verb+o+ (centered over the node), +or +\begin{itemize} + \item If the direction of the branch (as specified either by +\verb+\egdirection+ or by an optional argument of \verb+\putbranch+) is {\tt +d} or {\tt u}, either {\tt l} (above/below and to the left) and {\tt r} +(above/below and to the right). + \item If the direction of the branch is {\tt r} or {\tt l}, either {\tt u} +(to the left/right and up) and {\tt d} (to the left/right and down). +\end{itemize} +Default: is to center the label above for \verb+\egdirection+=\verb+d+, below +for \verb+\egdirection+=\verb+u+, to the left of the node for +\verb+\egdirection+=\verb+r+, or to the right of the node for +\verb+\egdirection+=\verb+l+. +\item[\emph{action-label}] Any character string. +\item[\emph{action-label-position}] \verb+o+ (outside), \verb+i+ (inside), or +\verb+c+ (centered on branch). + +Default: \verb+o+. (For more on action label positioning, see +Section~\ref{s:alp}.) +\item[\emph{payoffs}] Any character string. +\end{description} + +Examples: +\begin{verbatim} +\putbranch(0,100)(2,-1){200} +\ib{1}{$x$} +\end{verbatim} +$$\begin{egame}(200,180) +\putbranch(0,140)(2,-1){200} +\ib{1}{$x$} +\psline{<->}(0,0)(200,0) +\rput*(100,0){200} +\end{egame}$$ + +Note that in the following example the \verb+1+ in the direction pair +\verb+(0,1)+ is interpreted as sending the branch down, given that the +\verb+\egdirection+ is \verb+d+. (That is, once you specify the +\verb+\egdirection+ (or leave it at the default \verb+d+) you do not need to +worry about getting the sign of the \emph{v-incr} correct (if the direction is +\verb+d+ or \verb+u+) or the sign of the \emph{h-incr} correct (if the +direction is \verb+l+ or \verb+r+). + +\begin{verbatim} +\putbranch(0,100)(0,1){100} +\ib[linecolor=gray]{1}[l]{$x$}[c] +\end{verbatim} +$$\begin{egame}(100,140) +\putbranch(0,100)(0,1){100} +\ib[linecolor=gray]{1}[l]{$x$}[c] +\psline{<->}(80,0)(80,100) +\rput*(80,50){100} +\end{egame}$$ + +\begin{verbatim} +\initialfalse +\putbranch(0,40)(1,1)[u]{100} +\ib{1}{$x$}[$0,2$] +\end{verbatim} +$$\begin{egame}(100,180) +\initialfalse +\putbranch(0,40)(1,1)[u]{100} +\ib{1}{$x$}[$0,2$] +\end{egame}$$ + +Notice that the optional direction specifier {\tt u} in \verb+\putbranch+ +affects not only the direction of the branch (which is determined by the +argument {\tt (1,1)}), but also the placement of the player label relative to +the starting node. + +\begin{verbatim} +\initialfalse +\putbranch(0,100)(1,1){100} +\ib{1}[l]{$x$}[i][$0,2$] +\end{verbatim} +$$\begin{egame}(100,180) +\putbranch(0,140)(1,-1){100} +\ib{1}[l]{$x$}[i][$0,2$] +\end{egame}$$ + +\vspace{4mm} + +\noindent\verb+\iib[+\emph{style1}\verb+][+\emph{style2}\verb+]{+\emph{player-% +name}\verb+}[+% +\emph{player-label-position}\verb+]{+\emph{action-label1}\verb+}+\newline +\verb+{+\emph{action-label2}\verb+}[+\emph{action-label-position}\verb+][+% +\emph{payoffs1}% +\verb+][+\emph{payoffs2}{\tt ]}\newline +\noindent puts two branches with the parameters of the preceding call to +\verb+\putbranch+, optionally using the PSTricks style \emph{branchstyle1} for +the left or upper branch and the style \emph{branchstyle2} for the other +branch (or \emph{branchstyle1} for both branches, if there is only one +optional argument), assigns it the player name \emph{player-name}, optionally +positions the player label relative to the node according to +\emph{player-label-position}, labels the left/upper action with +\emph{action-label1} and the right/lower action with \emph{action-label2}, +optionally using the position \emph{action-label-position}, and optionally +adds payoffs \emph{payoffs1} and \emph{payoffs2}. The signs of the direction +parameters $($\emph{h-incr}$,$\emph{v-incr}$)$ in the preceding +\verb+\putbranch+ call are ignored; the directions of the branches is +determined by the direction of the branch (as specified either by +\verb+\egdirection+ or by the optional argument of \verb+\putbranch+). If, +for example, the direction is {\tt d}, then one branch goes down and to the +left and the other goes down and to the right. + +The first branch in any {\tt egame} is taken to be the initial branch of the +game; its beginning node is indicated by \verb+\eginode+. Subsequent branches +are taken to be non-initial, and are indicated by \verb+\egnode+. To force a +node to be initial, specify \verb+\initialtrue+ before it; to force a node to +be noninitial, specify \verb+\initialfalse+ before it. + +Permissible values: +\begin{description} +\item[\emph{style1}, \emph{style2}] Any PSTricks line styles; see \verb+\ib+. +If there is only one style present, it is applied to both branches. If there +are two styles, the first is applied to the right hand branch and the second +to the left hand branch if the game direction is up or down, and the first is +applied to the lower branch and the second to the upper branch if the game +direction is left or right. +\item[\emph{player-name}] Any character string. +\item[\emph{player-label-position}] Either \verb+o+ (centered over the node), +or +\begin{itemize} + \item If the direction of the branch (as specified either by +\verb+\egdirection+ or by an optional argument of \verb+\putbranch+) is {\tt +d} or {\tt u}, either {\tt l} (above/below and to the left) and {\tt r} +(above/below and to the right). + \item If the direction of the branch is {\tt r} or {\tt l}, either {\tt u} +(to the left/right and up) and {\tt d} (to the left/right and down). +\end{itemize} +Default: is to center the label above for \verb+\egdirection+=\verb+d+, below +for \verb+\egdirection+=\verb+u+, to the left of the node for +\verb+\egdirection+=\verb+r+, or to the right of the node for +\verb+\egdirection+=\verb+l+. +\item[\emph{action-label1} and \emph{action-label2}] Any character strings. +\item[\emph{action-label-position}] \verb+o+ (outside), \verb+i+ (inside), or +\verb+c+ (centered). Default: \verb+o+. +\item[\emph{payoffs1} and \emph{payoffs2}] Any character strings. +\end{description} + +Examples: + +Action labels ``outside'' (default): +\begin{verbatim} +\putbranch(100,140)(1,1){100} +\iib[linestyle=dashed]{1}{$L$}{$R$} +\end{verbatim} +$$\begin{egame}(200,180) +\putbranch(100,140)(1,1){100} +\iib[linestyle=dashed]{1}{$L$}{$R$} +\psline{<->}(100,0)(200,0) +\rput*(150,0){100} +\end{egame}$$ + +Action labels ``inside'': +\begin{verbatim} +\putbranch(100,140)(1,1){100} +\iib[linestyle=dashed]{1}{$L$}{$R$}[i] +\end{verbatim} +$$\begin{egame}(200,140) +\putbranch(100,100)(1,1){100} +\iib[linestyle=dashed]{1}{$L$}{$R$}[i] +\end{egame}$$ + +Action labels ``centered'': +\begin{verbatim} +\renewcommand{\egarrowstyle}{e} +\putbranch(0,140)(2,1)[r]{200} +\iib{1}{$L$}{$R$}[c] +\end{verbatim} +$$\begin{egame}(100,280) +\renewcommand{\egarrowstyle}{e} +\putbranch(0,140)(2,1)[r]{200} +\iib{1}{$L$}{$R$}[c] +\psline{<->}(0,0)(200,0) +\rput*(100,0){200} +\end{egame}$$ + +\begin{verbatim} +\renewcommand{\egarrowstyle}{e} +\putbranch(0,100)(1,1)[r]{100} +\iib[linecolor=gray][doubleline=true]{1}{$L$}{$R$}[$1,2$][$0,-1$] +\end{verbatim} +$$\begin{egame}(100,250) +\renewcommand{\egarrowstyle}{e} +\putbranch(0,100)(1,1)[r]{100} +\iib[linecolor=gray][doubleline=true]{1}{$L$}{$R$}[c][$1,2$][$0,-1$] +\end{egame}$$ + +\begin{verbatim} +\renewcommand{\egarrowstyle}{m} +\psset{arrowscale=2} +\putbranch(200,40)(1,0)[d]{200} +\iib{1}{$L$}{$R$}[$1,2$][$0,-1$] +\end{verbatim} +$$\begin{egame}(400,80) +\renewcommand{\egarrowstyle}{m} +\psset{arrowscale=2} +\putbranch(200,40)(1,0)[d]{200} +\iib{1}{$L$}{$R$}[$1,2$][$0,-1$] +\end{egame}$$ + +\vspace{4mm} + +\psset{arrowscale=1} + +\noindent\verb+\iiib[+\emph{style1}\verb+]{+\emph{player-name}\verb+}[+\emph{p% +layer-label-position}% +\verb+]{+\emph{action-label1}\verb+}+\newline +\verb+{+\emph{action-label2}\verb+}{+\emph{action-label3}\verb+}[+\emph{action% +-label-position}\verb+][+% +\emph{payoffs1}\verb+][+\emph{payoffs2}\verb+]+\newline +\verb+[+\emph{payoffs3}{\tt ]}\newline +\noindent puts three branches with the parameters of the preceding call to +\verb+\putbranch+, optionally all in the PSTricks style \emph{style}, assigns +it the player name \emph{player-name}, optionally positions the player label +relative to the node according to \emph{player-label-position}, and labels the +left/top action with \emph{action-label1}, the middle action with +\emph{action-label3}, and the right/bottom action with \emph{action-label2}, +optionally positioning the labels according to \emph{action-label-position} +and putting the \emph{payoffs1}, \emph{payoffs2}, and \emph{payoffs3}. The +signs of the direction parameters $($\emph{h-incr}$,$\emph{v-incr}$)$ in the +preceding \verb+\putbranch+ call are ignored; the directions of the branches +are determined by the direction of the branch (as specified either by +\verb+\egdirection+ or by the optional argument of \verb+\putbranch+). If, +for example, the direction is {\tt d}, then one branch goes down and to the +left, one goes straight down, and one goes down and to the right. + +The first branch in any {\tt egame} is taken to be the initial branch of the +game; its beginning node is indicated by a small circle. Subsequent branches +are taken to be non-initial, and are indicated by \verb+\egnode+, the default +value of which is a small disk. To force a node to be initial, specify +\verb+\initialtrue+ before it; to force a node to be noninitial, specify +\verb+\initialfalse+ before it. + +Permissible values: +\begin{description} +\item[\emph{style}] Any PSTricks line style. [Note that only one style is +allowed, which applies to all three branches. If you want the branches to +have different styles, you need to use a combination of \verb+\ib+ and +\verb+\iib+.] +\item[\emph{player-name}] Any character string. +\item[\emph{player-label-position}] Either \verb+o+ (centered over the node), +or +\begin{itemize} + \item If the direction of the branch (as specified either by +\verb+\egdirection+ or by an optional argument of \verb+\putbranch+) is {\tt +d} or {\tt u}, either {\tt l} (above/below and to the left) and {\tt r} +(above/below and to the right). + \item If the direction of the branch is {\tt r} or {\tt l}, either {\tt u} +(to the left/right and up) and {\tt d} (to the left/right and down). +\end{itemize} +Default: is to center the label above for \verb+\egdirection+=\verb+d+, below +for \verb+\egdirection+=\verb+u+, to the left of the node for +\verb+\egdirection+=\verb+r+, or to the right of the node for +\verb+\egdirection+=\verb+l+. +\item[\emph{action-label1}, \emph{action-label2}, and \emph{action-label3}] +Any character strings. +\item[\emph{action-label-position}] \verb+o+ (outside), \verb+i+ (inside), or +\verb+c+ (centered). Default: \verb+o+. +\item[\emph{payoffs1}, \emph{payoffs1}, and \emph{payoffs3}] Any character +strings. +\end{description} + +Examples: +\begin{verbatim} +\putbranch(200,240)(1,1){200} +\iiib{1}{$L$}{$M$}{$R$} +\end{verbatim} +$$\begin{egame}(400,280) +\putbranch(200,240)(1,1){200} +\iiib{1}{$L$}{$M$}{$R$} +\psline{<->}(200,0)(400,0) +\rput*(300,0){200} +\end{egame}$$ + +\begin{verbatim} +\putbranch(30,210)(1,1)[r]{200} +\iiib[linecolor=gray]{1}{$B$}{$M$}{$T$}[c][$1,2$][$0,-1$][$7,1$] +\end{verbatim} +$$\begin{egame}(340,460) +\putbranch(30,250)(1,1)[r]{200} +\iiib[linecolor=gray]{1}{$B$}{$M$}{$T$}[c][$1,2$][$0,-1$][$7,1$] +\psline{<->}(30,0)(230,0) +\rput*(130,0){200} +\end{egame}$$ + +\vspace{4mm} + +\noindent +\verb+\ctmb[+\emph{style}\verb+]{+\emph{player-name}\verb+}[+\emph{player-labe% +l-position}% +\verb+](+\emph{h-incr}\verb+,+\emph{v-incr}\verb+)+\newline +\verb+{+\emph{action-label}\verb+}[+\emph{action-label-position}\verb+][+\emph% +{payoffs}% +\verb+]+\newline +\noindent draws a continuum of branches starting with the parameters of the +previous call to \verb+\putbranch+, with a single branch drawn as a line with +PSTricks style \emph{style}, player \emph{player}, with the label optionally +positioned according to \emph{player-label-position}, and slope +\emph{h-incr,v-incr}, labeled with \emph{action-label}, which is optionally +positioned according to \emph{action-label-position}, and optionally with +payoffs \emph{payoffs}. + +\sloppy +The color of the triangle representing the continuum of branches is +\verb+\ctmfillcolor+ (default \verb+verylightgray+ (defined in the style)). + + +\fussy +Permissible values: +\begin{description} +\item[\emph{style}] Any PSTricks line style. [Note that this is the style of +the single branch, {\bfseries not} of the triangle.] +\item[\emph{player-name}] Any character string. +\item[\emph{player-label-position}] Either \verb+o+ (centered over the node), +or +\begin{itemize} + \item If the direction of the branch (as specified either by +\verb+\egdirection+ or by an optional argument of \verb+\putbranch+) is {\tt +d} or {\tt u}, either {\tt l} (above/below and to the left) and {\tt r} +(above/below and to the right). + \item If the direction of the branch is {\tt r} or {\tt l}, either {\tt u} +(to the left/right and up) and {\tt d} (to the left/right and down). +\end{itemize} +Default: is to center the label above for \verb+\egdirection+=\verb+d+, below +for \verb+\egdirection+=\verb+u+, to the left of the node for +\verb+\egdirection+=\verb+r+, or to the right of the node for +\verb+\egdirection+=\verb+l+. +\item[$($\emph{h-incr}$,$\emph{v-incr}$)$] Any pair of integers. +\item[\emph{action-label}] Any character string. +\item[\emph{action-label-position}] \verb+o+ (outside), \verb+i+ (inside), or +\verb+c+ (centered). Default: \verb+o+. +\item[\emph{payoffs}] Any character strings. +\end{description} + +Examples: + +\begin{verbatim}\putbranch(50,240)(2,-1)[d]{200} +\ctmb{1}(0,1){$A$}[i][$2,2$]:\end{verbatim} +$$\begin{egame}(100,280) +\putbranch(50,240)(2,-1)[d]{200} +\ctmb{1}(0,1){$A$}[i][$2,2$] +\end{egame}$$ + +\begin{verbatim}\renewcommand{\ctmfillcolor}{red} +\renewcommand{\egarrowstyle}{e} +\putbranch(50,240)(2,-1)[d]{200} +\ctmb[linecolor=blue]{1}(-1,1){$A$}[i][$2,2$]:\end{verbatim} +$$\begin{egame}(100,280) +\renewcommand{\ctmfillcolor}{red} +\renewcommand{\egarrowstyle}{e} +\putbranch(50,240)(2,-1)[d]{200} +\ctmb[linecolor=blue]{1}(-1,1){$A$}[i][$2,2$] +\end{egame}$$ + +\begin{verbatim}\putbranch(50,0)(2,1)[u]{200} +\ctmb{1}(1,1){$A$}[i][$2,2$]:\end{verbatim} +$$\begin{egame}(100,180) +\putbranch(50,0)(2,1)[u]{200} +\ctmb{1}(1,1){$A$}[i][$2,2$] +\end{egame}$$ + +\vspace{4mm} + +\noindent +\verb+\ctmbarc[+\emph{style}\verb+]{+\emph{player-name}\verb+}[+\emph{player-l% +abel-position}% +\verb+](+\emph{h-incr}\verb+,+\emph{v-incr}\verb+)+\newline +\verb+{+\emph{action-label}\verb+}[+\emph{action-label-position}\verb+][+\emph% +{payoffs}% +\verb+]+\newline +\noindent represents a continuum of branches by an arc. The branches start +with the parameters of the previous call to \verb+\putbranch+, with a single +branch and the arc drawn using the PSTricks style \emph{style}, player +\emph{player}, the label optionally positioned according to +\emph{player-label-position}, the line with slope \emph{h-incr,v-incr}, +labeled with \emph{action-label} optionally positioned according to +\emph{action-label-position}, and optionally with payoffs \emph{payoffs}. + +\emph{This macro requires the package} \verb+pst-3d+ \emph{to be loaded after} +\verb+pstricks+\emph{. In the preamble to your document, include the line} +\verb+\include{pst-3d}+. (\verb+\pstricks+ itself includes the needed macro, +but its definition appears to differ from the one in \verb+pst-3d+, which is +the definition \verb+\ctmbarc+ needs.) + +The line drawn by the macro is the intersection of (\emph{i})~a circle +centered at the start of the branch with radius equal to a half of the +distance to the following node and (\emph{ii})~the triangle defined by the +starting node and the two following nodes. For some parameter values, this +line is not a full arc---see the last example. + +The options are the same as those for \verb+\ctmb+. The style of the arc is +controlled by the parameters \verb+\egarclinestyle+ (possible values +\verb+solid+, \verb+dashed+, \verb+dotted+, and \verb+none+; default +\verb+solid+), \verb+\egarclinewidth+ (any dimension; default \verb+0.6pt+), +\verb+\egarclinecolor+ (any color; default \verb+black+). + +Examples: + +\begin{verbatim}\putbranch(50,240)(2,2)[d]{200} +\ctmbarc{1}(1,-2){$A$}[i][$2,2$]:\end{verbatim} +$$\begin{egame}(100,280) +\putbranch(50,240)(2,2)[d]{200} +\egalhshift=-12 +\ctmbarc{1}(1,-2){$A$}[i][$2,2$] +\end{egame}$$ + +\begin{verbatim}\def\egarclinestyle{dashed} +\def\egarclinewidth{2pt} +\def\egarclinecolor{blue} +\putbranch(0,150)(2,2)[r]{150} +\ctmbarc[linewidth=0.3pt,linecolor=red]{1}(1,0){$A$}[$2,2$]:\end{verbatim} +$$\begin{egame}(150,300) +\def\egarclinestyle{dashed}\def\egarclinewidth{2pt}\def\egarclinecolor{blue} +\putbranch(0,150)(2,2)[r]{150} +\ctmbarc[linewidth=0.3pt,linecolor=red]{1}(1,0){$A$}[$2,2$] +\end{egame}$$ + +In the next example part of the arc extends beyond the triangle defined by the +three nodes, and consequently does not appear. + +\begin{verbatim}\putbranch(50,0)(2,1)[u]{200} +\ctmbarc{1}(1,1){$A$}[i][$2,2$]:\end{verbatim} +$$\begin{egame}(100,180) +\putbranch(50,0)(2,1)[u]{200} +\ctmbarc{1}(1,1){$A$}[i][$2,2$] +\end{egame}$$ + +\vspace{4mm} + +\noindent\verb+\infoset(+\emph{x-coord}\verb+,+\emph{y-coord}% +\verb+)[+\emph{direction}\verb+]{+\emph{length}% +\verb+}{+\emph{player-name}\verb+}+\newline +\verb+[+\emph{player-label-position}\verb+]+\newline +\noindent draws an information set starting at +$($\emph{x-coord}$,$\emph{y-coord}$)$, optionally with direction +\emph{direction}, of length \emph{length}, with player label +\emph{player-name}. If the direction of the game is either down or up, the +information set is horizontal; if the direction of the game is either right or +left, the information set is vertical. The player label is positioned at the +middle of the information set, either above, below, to the left, or to the +right of it, depending on the direction of the game. (Its position can be +adjusted by adding some space before or after the player name. For +example,\newline \verb+\infoset(100,200){400}{1\hspace{10mm}}+\newline +centers the box containing \verb+1\hspace{10mm}+ relative to the information +set, thus moving the label by about 5mm. + +The dot character used in the information set is given by \verb+\infosetdot+, +the default value of which is \verb+\pscircle*{2.5}+; the spacing between the +dots is set by \verb+\infosetdotsep+, the default value of which is 20. (See +Section~\ref{s:params}.) + +Permissible values: +\begin{description} +\item[$($\emph{x-coord}$,$\emph{y-coord}$)$] Any pair of integers. +\item[\emph{direction}] {\tt h} (horizontal) or {\tt v} (vertical). If none +is specified, it is assumed to be \verb+h+ if the game direction is \verb+d+ +or \verb+u+, and \verb+v+ if the game direction is \verb+r+ or \verb+l+. +\item[\emph{length}] Any nonnegative integer. +\item[\emph{player-name}] Any character string. +\item[\emph{player-label-position}] \verb+o+ (over), \verb+u+ (up), or +\verb+d+ (down) if direction is \verb+h+, \verb+o+ (over), \verb+l+ (left), or +\verb+r+ (right) if direction is \verb+v+. +\end{description} + +Examples: +\begin{verbatim} +\egdirection{d} +\infoset(0,0){300}{1} +\end{verbatim} +$$\begin{egame}(300,4) +\egdirection{d} +\infoset(0,0){300}{1} +\end{egame}$$ + +\begin{verbatim} +\egdirection{d} +\infoset(0,0){300}{1}[o] +\end{verbatim} +$$\begin{egame}(300,4) +\egdirection{d} +\infoset(0,0){300}{1}[o] +\end{egame}$$ + +\begin{verbatim} +\egdirection{d} +\infoset(0,0)[u]{200}{1} +\end{verbatim} +$$\begin{egame}(0,200) +\egdirection{d} +\infoset(0,0)[v]{200}{1} +\end{egame}$$ + +\section{Positioning action labels}\label{s:alp} +The following algorithm is used to position an action label. The ``reference +point'' for a branch is its midpoint. An action label is surrounded by a box +(which may be colored and bordered by a line), from which it is separated by +\verb+\egactionboxsep+, then this box is surrounded by another box, from which +it is separated by \verb+\egactionlabelsep+. Then, for example, for a label +positioned above a downward-sloping branch, the bottom left-hand corner of the +outer box is placed at the reference point, as in Figure~\ref{f:al}. For a +label positioned above a horizontal branch, the bottom center of the outer box +is placed at the reference point. +\begin{figure}[htb] +\hspace*{\fill} +\begin{egame}(400,200)[0.2mm] +\putbranch(0,200)(1,1){200} +\ib{}{} +\pspolygon[linewidth=0.4pt](100,100)(100,200)(200,200)(200,100) +\pspolygon[linewidth=0.4pt](120,120)(120,180)(180,180)(180,120) +\pspolygon[linewidth=0.4pt](145,145)(145,155)(155,155)(155,145) +\rput(150,150){o} +\psline{<->}(150,100)(150,120) +\rput[l](160,110){$x$} +\psline{<->}(150,120)(150,145) +\rput[l](160,132.5){$y$} +\rput[l](220,160){$y=\setminus $egactionboxsep} +\rput[l](220,130){$x=\setminus $egactionlabelsep} +\end{egame} +\hspace*{\fill} +\caption[]{The position of an action label above a downward-sloping +branch.}\label{f:al} +\end{figure} + +This algorithm is not perfect. (Note that it is not continuous in the slope +of the branch.) The positions of labels may need fine tuning, which may be +achieved by setting either \verb+\egalhshift+ or \verb+\egalvshift+ or both to +be nonzero (each is an integer, interpreted as a multiple of the unitlength). + +\verb+\egalhshift+ and \verb+\egalvshift+ must be set between +\verb+\putbranch+ and \verb+\ib+, \verb+\iib+, \verb+\iiib+, or \verb+\ctmb+. +(They are set to zero by \verb+\putbranch+.) + +If \verb+\egalhshift+ is nonzero and \verb+\egalvshift+ is not, the reference +point for the action label on the single branch in \verb+\ib+, of the +\emph{right-hand} branch for directions \verb+d+ and \verb+u+ and of both +branches for directions \verb+r+ and \verb+l+ in \verb+\iib+, and for the +outer branches of \verb+\iiib+, is moved horizontally by this amount and is +moved vertically to maintain the same separation from the branch. (That is, +the action label slides parallel to the branch; it moves horizontally by the +amount \verb+\egalhshift+.) The reference point of the label on the symmetric +branch is moved symmetrically. (Note that the label on the middle branch of +\verb+\iiib+ is not moved. If you want to move it, you need to write separate +calls to \verb+\iib+ and \verb+\ib+.) + +Similarly, if \verb+\egalvshift+ is nonzero and \verb+\egalhshift+ is not, the +reference point for the action label is moved vertically by this amount and is +moved horizontally to maintain the same separation from the branch. After a +branch is drawn, \verb+\egalhshift+ and \verb+\egalvshift+ are reset to zero. + +Note that the same effect can be acheived with either \verb+\egalhshift+ or +\verb+\egalvshift+. The two methods are provided simply because in some cases + a vertical shift might be more natural to specify, whereas in other cases a +horizontal shift might be more natural to specify. + +If \emph{both} \verb+\egalhshift+ and \verb+\egalvshift+ are nonzero, the +reference point is moved horizontally by \verb+\egalhshift+ and vertically by +\verb+\egalvshift+. + +Examples: + +\verb+\egdirection{d}+ +\verb+\egalhshift=40+ +$$\begin{egame}(100,280) +\putbranch(50,240)(2,-1)[d]{200} +\egalhshift=40 +\iib{1}{$A$}{$B$}[$1,1$][$2,2$] +\end{egame}$$ + +\verb+\egalhshift=-40+ +$$\begin{egame}(100,280) +\putbranch(50,240)(2,-1)[d]{200} +\egalhshift=-40 +\iib{1}{$A$}{$B$}[$1,1$][$2,2$] +\end{egame}$$ + +\verb+\egalhshift=40\egalvshift=40+ +$$\begin{egame}(100,280) +\putbranch(50,240)(2,-1)[d]{200} +\egalhshift=40\egalvshift=40 +\iib{1}{$A$}{$B$}[$1,1$][$2,2$] +\end{egame}$$ + +\verb+\egdirection{u}\egalhshift=60+ +$$\begin{egame}(100,280) +\putbranch(40,140)(2,-1)[r]{200} +\egalhshift=60 +\iib{1}{$A$}{$B$}[$1,1$][$2,2$] +\end{egame}$$ +\section{Arrows} +Branches can have arrows either at the end or in the middle, by setting + +\verb+\renewcommand{\egarrowstyle}{e}+ + +\noindent (for arrows at the end), or + +\verb+\renewcommand{\egarrowstyle}{m}+ + +\noindent (for arrows in the middle). The positioning of arrows in the middle +is not ideal: the \emph{tip} of the arrow is placed in the middle of the +branch, while ideally the \emph{middle} of the arrow should be there. I can't +see any easy way to improve the placement. + +The style of the arrows can be controlled with PSTricks' various parameters +(as described, for example, in the \LaTeX\ Graphics Companion). +\section{Parameters}\label{s:params} +\noindent\verb+\egdirection+\newline +\noindent Direction of game. Possible values: {\tt d} (down), {\tt u} (up), +{\tt r} (right), or {\tt l} (left). Default: {\tt d}. Example: +\verb+\egdirection{u}+. + +\vspace{4mm} + +\noindent\verb+\initialtrue+, \verb+\initialfalse+\newline +\noindent Force a node other than the first one in an \verb+egame+ to be +initial, or force the first node to be noninitial. + +\vspace{4mm} + +\sloppy +\noindent\verb+\eginode+\newline +\noindent Object used for initial node. Possible values: any object. +Default: \verb+\pscircle+ \verb+[linewidth=0.4pt]{5}+. Example: +\verb+\renewcommand{\eginode}+ \verb+{\makebox(0,0){\rule{0.5mm}{0.5mm}}}+ +(the \verb+\makebox+ causes the object to be positioned correctly). + +\fussy +\vspace{4mm} + +\noindent\verb+\egnode+\newline +\noindent Object used for nodes. Possible values: any object. Default: +\verb+\pscircle*{5}+. Example: +\verb+\renewcommand{\egnode}{\makebox(0,0){\rule{0.5mm}{0.5mm}}}+ (the +\verb+\makebox+ causes the object to be positioned correctly). + +\vspace{4mm} + +\sloppy +\noindent\verb+\infosetdot+\newline +\noindent Object used for ``dots'' in information sets. Possible values: any +object. Default: \verb+\pscircle*{2.5}+. Example: +\verb+\renewcommand{\infosetdot}+ \verb+{\pscircle*{5}}+. + +\fussy +\vspace{4mm} + +\noindent\verb+\infosetdotsep+\newline +\noindent Spacing between dots in information set, as a multiple of the unit +length. Possible values: any positive integer. Default: 20. Example: +\verb+\renewcommand+ \verb+{\infosetdotsep}{40}+. + +\vspace{4mm} + +\noindent\verb+\egplayerlabelsep+\newline +\noindent Spacing used to position box containing player label relative to +center of initial node, and relative to center of information set. Possible +values: any dimension. Default: 1mm. Example: \verb+\egplayerlabelsep=2mm+. + +\vspace{4mm} + +\noindent\verb+\egplayerboxsep+\newline +\noindent Distance between edge of box around player label and player label. +Possible values: any dimension. Default: 0mm. Example: +\verb+\egplayerboxsep=1mm+. + +\vspace{4mm} + +\noindent\verb+\egactionlabelsep+\newline +\noindent Spacing used to position box containing action label relative to +branch. Possible values: any dimension. Default: 0.7mm. Example: +\verb+\egactionlabelsep=+ \verb+1mm+. + +\vspace{4mm} + +\noindent\verb+\egactionboxsep+\newline +\noindent Distance between edge of box around action label and action label. +Possible values: any dimension. Default: 0mm. Example: +\verb+\egactionboxsep=1mm+. + +\vspace{4mm} + +\sloppy +\noindent\verb+\egpayofflabelsep+\newline +\noindent Spacing used to position box containing action label relative to end +of branch. Possible values: any dimension. Default: 2mm. Example: +\verb+\egpayofflabelsep=1mm+. + +\fussy +\vspace{4mm} + +\noindent\verb+\egpayoffboxsep+\newline +\noindent Distance between edge of box around payoffs and payoffs. Possible +values: any dimension. Default: 0mm. Example: \verb+\egpayoffboxsep=1mm+. + +\vspace{4mm} + +\noindent\verb+\egalpos+\newline +\noindent Position of action labels. Possible values: \verb+o+ (outside), +\verb+i+ (inside), \verb+c+ (center). Default: \verb+o+. Example: +\verb+\renewcommand{\egalpos}{c}+. + +\vspace{4mm} + +\noindent\verb+\egalbox+\newline +\noindent Type of box for action labels. Possible values: \verb+f+ (frame), +\verb+c+ (circle). Default: \verb+f+. Example: +\verb+\renewcommand{\egalbox}{c}+. + +\vspace{4mm} + +\sloppy +\noindent\verb+\egalboxlinestyle+\newline +\noindent Style of lines around boxes containing action labels. Possible +values: \verb+none+, \verb+solid+, \verb+dashed+, \verb+dotted+. Default: +\verb+none+. Example: \verb+\renewcommand+ \verb+{\egalboxlinestyle}{solid}+. + +\fussy +\vspace{4mm} + +\noindent\verb+\egalboxlinecolor+\newline +\noindent Color of lines around boxes containing action labels. Possible +values: any defined color. Default: \verb+black+. Example: +\verb+\renewcommand{\egalboxlinecolor}+ \verb+{red}+. + +\vspace{4mm} + +\noindent\verb+\egalboxfillstyle+\newline +\noindent Style of fill of boxes containing action labels. Possible values: +\verb+none+, \verb+solid+, \verb+vlines+, \verb+vlines*+, \verb+hlines+, +\verb+hlines*+, \verb+crosshatch+, \verb+crosshatch*+. Default: \verb+none+. +Example: \verb+\renewcommand{\egalboxfillstyle}{solid}+. + +\vspace{4mm} + +\sloppy +\noindent\verb+\egalboxfillcolor+\newline +\noindent Color of fill of boxes containing action labels. Possible values: +any defined color. Default: \verb+white+. Example: +\verb+\renewcommand{\egalboxfillcolor}+ \verb+{blue}+. + +\fussy +\vspace{4mm} + +\noindent\verb+\egpaybox+\newline +\noindent Type of box for payoffs. Possible values: \verb+f+ (frame), +\verb+c+ (circle). Default: \verb+f+. Example: +\verb+\renewcommand{\egpaybox}{c}+. + +\vspace{4mm} + +\sloppy +\noindent\verb+\egpayboxlinestyle+\newline +\noindent Style of lines around boxes containing payoffs. Possible values: +\verb+none+, \verb+solid+, \verb+dashed+, \verb+dotted+. Default: +\verb+none+. Example: \verb+\renewcommand+ +\verb+{\egpayboxlinestyle}{solid}+. + +\fussy +\vspace{4mm} + +\noindent\verb+\egpayboxlinecolor+\newline +\noindent Color of lines around boxes containing payoffs. Possible values: +any defined color. Default: \verb+black+. Example: +\verb+\renewcommand{\egpayboxlinecolor}+ \verb+{gray}+. + +\vspace{4mm} + +\noindent\verb+\egpayboxfillstyle+\newline +\noindent Style of fill of boxes containing action payoffs. Possible values: +\verb+none+, \verb+solid+, \verb+vlines+, \verb+vlines*+, \verb+hlines+, +\verb+hlines*+, \verb+crosshatch+, \verb+crosshatch*+. Default: \verb+none+. +Example: \verb+\renewcommand{\egpayboxfillstyle}{solid}+. + +\vspace{4mm} + +\noindent\verb+\egpayboxfillcolor+\newline +\noindent Color of fill of boxes containing payoffs. Possible values: any +defined color. Default: \verb+white+. Example: +\verb+\renewcommand{\egpayboxfillcolor}{gray}+. + +\vspace{4mm} + +\noindent\verb+\egplbox+\newline +\noindent Type of box for player labels. Possible values: \verb+f+ (frame), +\verb+c+ (circle). Default: \verb+f+. Example: +\verb+\renewcommand{\egplbox}{c}+. + +\vspace{4mm} + +\sloppy +\noindent\verb+\egplboxlinestyle+\newline +\noindent Style of lines around boxes containing player labels. Possible +values: \verb+none+, \verb+solid+, \verb+dashed+, \verb+dotted+. Default: +\verb+none+. Example: \verb+\renewcommand+ \verb+{\egplboxlinestyle}{solid}+. + +\fussy +\vspace{4mm} + +\noindent\verb+\egplboxlinecolor+\newline +\noindent Color of lines around boxes containing player labels. Possible +values: any defined color. Default: \verb+black+. Example: +\verb+\renewcommand{\egplboxlinecolor}+ \verb+{gray}+. + +\vspace{4mm} + +\noindent\verb+\egplboxfillstyle+\newline +\noindent Style of fill of boxes containing player labels. Possible values: +\verb+none+, \verb+solid+, \verb+vlines+, \verb+vlines*+, \verb+hlines+, +\verb+hlines*+, \verb+crosshatch+, \verb+crosshatch*+. Default: \verb+none+. +Example: \verb+\renewcommand{\egplboxfillstyle}{solid}+. + +\vspace{4mm} + +\sloppy +\noindent\verb+\egplboxfillcolor+\newline +\noindent Color of fill of boxes containing player labels. Possible values: +any defined color. Default: \verb+white+. Example: +\verb+\renewcommand{\egplboxfillcolor}+ \verb+{gray}+. + +\fussy +\vspace{4mm} + +\noindent\verb+\egarrowstyle+\newline +\noindent Style of arrows on branches. Possible values: \verb+n+ (none), +\verb+e+ (end), \verb+m+ (mid). Default: \verb+n+ (none). Example: +\verb+\renewcommand{\egarrowstyle}{m}+ (mid). The size of the arrows can be +adjusted by using any of the PSTricks parameters---e.g.\ +\verb+\psset{arrowscale=1.5}+. + +\vspace{4mm} + +\sloppy +\noindent\verb+\ctmfillcolor+\newline +\noindent Color of triangle used to indicate continuum of branches. Possible +values: any defined color. Default: \verb+verylightgray+. Example: +\verb+\renewcommand+ \verb+{\ctmfillcolor}{red}+. + +\fussy +\section{Suggestions} +It seems hard to proceed without first drawing the game on a piece of paper, +at least roughly. Be sure to allow enough space under (in the case of a +downward-pointing game) the terminal nodes---put the nodes that precede the +terminal nodes high enough that the bottom of the payoffs will be at height 0. + Similarly, specify the height of the game so that the label for the initial +player does not poke out the top. If parts of your game poke out of the frame +defined by the size you specify for your \verb+egame+, \TeX\ will not warn +you, but the spacing above and/or below your game will not be right. (If you +specify the height to be too small, for example, the top of your game may +overlap the text above it.) + +You can float your game in a figure (as I have done in the examples above), or +you can put it in the text. (For example, you may use +\verb+$$\begin{egame}...+ \verb+\end{egame}$$+). Putting it in the text has +the disadvantage that if it's big and happens to start at the bottom of a page +then you may get a lot of white space if it doesn't fit on the page. +\section{Enhancements} +It would be nice to have a graphical interface, like that in \LaTeX CAD\@. +I'm not capable of writing one. + +It would be nice also if the macros could calculate the dimensions of the +whole game, so the the user does not have to specify them in the +\verb+\begin{game}+ call. To make this change looks like a tough project to +me. + +The label-positioning algorithm could be enhanced, as discussed in +Section~\ref{s:alp}. + +\section{History} +\begin{description} +\item[Version 1.0] 2001-4-9 (based on EGAME.STY, 1997-10-16) +\item[Version 1.1] 2004-6-19 (\verb+\egctmarc+ added, following suggestion of +Paul Schweinzer). +\end{description} + +\section{Appendix: using pdftricks with pdftex to create a pdf +file}\label{s:pdftricks} +If you want to create a pdf file from your \LaTeX\ file and do not want to +take the dvi $\rightarrow$ ps $\rightarrow$ pdf route, you may use +\verb+pdftricks+. Eric Gartzke reports that the following input produces the +expected output. (See his comments for the limitations of this method.) If +you find a better solution, please let me know. + +\begin{verbatim}\documentclass[12pt]{article} +\usepackage[shell]{pdftricks} + +\begin{psinputs} +\usepackage{pstricks} +\usepackage{color} +\usepackage{pstcol} +\usepackage{pst-plot} +\usepackage{pst-tree} +\usepackage{pst-eps} +\usepackage{multido} +\usepackage{pst-node} +\usepackage{pst-eps} +\usepackage{egameps} +\end{psinputs} + +\usepackage{amsfonts} +\usepackage{graphicx} +\usepackage{amsmath} +\usepackage{setspace} +\usepackage{fullpage} +\usepackage{harvard} +\usepackage{threeparttable} +\usepackage{amssymb} + +\newtheorem{hypothesis}{Hypothesis} + +Postscript commands need to be separated from other commands. +pdftricks literally stops the compiling of the TeX file to run +postscript/dvi in the background, generating separate small +TeX files and pdf files of each figure. Notice that egameps +is called last. This seems to make a considerable +difference. Here is an example of a simple egame tree. + +\begin{pdfpic} +\begin{figure}[htb] +\hspace*{\fill} +\begin{egame}(600,1250) +\renewcommand{\egarrowstyle}{e} +\renewcommand{\egnode}{\pscircle*{8}} +\putbranch(200,1200)(0,1){150} \ib{$N$}[r]{$~k_{i},~k_{j}$} +\renewcommand{\egarrowstyle}{} +\putbranch(200,1050)(1,1){200} \egdirection{d} +\iib{$i$}[l]{$\begin{array}{c}Status\\Quo\end{array}$}{$Challenge$}[$b_{ +i},~1+b_{j}$][] +\putbranch(400,850)(1,1){200} +\iib{$~j$}[r]{$Reject$}{$Accept$}[][$\begin{array}{c}1- +d+b_{i},\\d+b_{j}\end{array}$] +\putbranch(200,650)(1,1){200} +\iib{$i$}[l]{$\begin{array}{c}Back\\Down\end{array}$}{$Persist$}[$\begin +{array}{c}-a_{i},\\1\end{array}$][] +\putbranch(400,450)(1,1){200} +\iib{$j$}[r]{$Fight$}{$Acquiesce$}[$\begin{array}{c}p-k_{i},\\1-p- +k_{j}\end{array}$][$\begin{array}{c}1-d,\\d\end{array}$] +\end{egame} +\setcounter{figure}{1} +\hspace*{\fill} \caption[]{Selection Game +\label{figure:selection}} +\end{figure} +\end{pdfpic} + +Again, the figure is isolated from the rest of the TeX file by +pdftricks commands. Also, the regular LaTeX numbering of +figures is interfered with, so I adjust with a \setcounter +command. Finally, the \label and \reference commands do not +work, so one must simply number the figures in the text. +\end{verbatim} + + + +\end{document} + + + |