Problem typesetting a Prisoner's Dilemma table

With TikZ it is far simpler:

enter image description here

The code:

\documentclass[tikz,border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,matrix}

\begin{document}

\begin{tikzpicture}[element/.style={minimum width=1.75cm,minimum height=0.85cm}]
\matrix (m) [matrix of nodes,nodes={element},column sep=-\pgflinewidth, row sep=-\pgflinewidth,]{
         & Factor 1  & Factor 2  \\
Factor 1 & |[draw]|5 & |[draw]|4 \\
Factor 2 & |[draw]|2 & |[draw]|2 \\    };

\node[draw,element, anchor=west,label={above:\textbf{Name 3}}] at ($(m-2-3)!0.5!(m-3-3)+(1.25,0)$) {5}; % setting the node midway to cell 4 and cell 2 with a horizontal shift of 1.25cm

\node[above=0.25cm] at ($(m-1-2)!0.5!(m-1-3)$){\textbf{Name 1}};
\node[rotate=90] at ($(m-2-1)!0.5!(m-3-1)+(-1.25,0)$){\textbf{Name 2}};
\end{tikzpicture}

\end{document}

The version within article

\documentclass[11pt,a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{calc,matrix}

\usepackage{lipsum}

\begin{document}
\lipsum[1]

\begin{table}[h]
\centering
\caption{bla bla bla}
\label{bla}
\begin{tikzpicture}[element/.style={minimum width=1.75cm,minimum height=0.85cm}]
\matrix (m) [matrix of nodes,nodes={element},column sep=-\pgflinewidth, row sep=-\pgflinewidth,]{
         & Factor 1  & Factor 2  \\
Factor 1 & |[draw]|5 & |[draw]|4 \\
Factor 2 & |[draw]|2 & |[draw]|2 \\    };

\node[draw,element, anchor=west,label={above:\textbf{Name 3}}] at ($(m-2-3)!0.5!(m-3-3)+(1.25,0)$) {5}; % setting the node midway to cell 4 and cell 2 with a horizontal shift of 1.25cm

\node[above=0.25cm] at ($(m-1-2)!0.5!(m-1-3)$){\textbf{Name 1}};
\node[rotate=90] at ($(m-2-1)!0.5!(m-3-1)+(-1.25,0)$){\textbf{Name 2}};
\end{tikzpicture}
\end{table}

\lipsum[2]

\end{document}

The result:

enter image description here

Explanation

A TikZ matrix is simply a node and as every node some anchors become available: incidentally this helps a lot in positioning other elements in the picture.

The first step is to give a name to the matrix: it is done through the syntax \matrix (m) where m is the name. Using the option matrix of nodes then also each cell has a name in the form <matrix name>-<row>-<column>.

Since we have a name we can access anchors as <matrix name>.<anchor>. But we have to know where these anchors are located. For debugging purposes we can add this code right after the previous \matrix definition:

% debugging purposes
\draw[red](m.south west)rectangle(m.north east);

\foreach \anchor/\placement in
    {north/above,  south/below, east/right, west/left,
     north west/above, north east/above,
     south west/below, south east/below}
     \draw[shift=(m.\anchor)] plot[mark=x] coordinates{(0,0)} node[\placement=0.15cm]{\scriptsize\texttt{(m.\anchor)}};

Now the table looks like:

enter image description here

In the picture there are two notes: they are added with

% Where to put the notes according to what we learnt about matrices
\node[below=0.5cm] at (m.south west) {Note};
\node[below=0.5cm, align=center,text width=5cm] at (m.south) {Another Note which is supposed to be longer};

You could use \cline instructions and use \multicolumn{1}{c}{...} in the header row to suppress vertical lines. I've provided some visual formatting hooks (such as \quad and \lower in the MWE below; I trust you'll manage to figure out how to move the elements around some more using these hooks.

enter image description here

\documentclass[a4paper,12pt]{article}
\usepackage{graphicx,multirow}
\begin{document}
\begin{table}[h]
\renewcommand\arraystretch{2.5} % provide a bit taller rows
\centering
\caption{The Prisoner's Dilemma}
\begin{tabular}{ll | c | c |}
&\multicolumn{1}{c}{}&\multicolumn{2}{c}{\textbf{Name1}}\\[-2ex]
&\multicolumn{1}{c}{}
&\multicolumn{1}{c}{Factor1}&\multicolumn{1}{c}{Factor2}\\
\cline{3-4}
\multirow{2}{*}{\rotatebox{90}{\textbf{Name2}}}
&Factor1&5&4\\
\cline{3-4}
&Factor2&2&2\\
\cline{3-4}
\end{tabular}
\qquad
\lower3ex\hbox{\begin{tabular}{|c|}
\multicolumn{1}{c}{\textbf{Name3}}\\
\hline
5\\
\hline
\end{tabular}}
\end{table}
\end{document}

Addendum: If you have two column headers of different widths -- say, ExtremelyLongHeader and LilHeader-- and if the widths of these headers determine the overall column widths, you could equalize the column widths as follows:

  • In the preamble, insert the following instructions:

    \newcommand\LongestHeader{ExtremelyLongHeader} % replace "ExtremelyLongHeader" with actual header...
    \newlength\mylen
    \settowidth\mylen{\LongestHeader} % \mylen measures width of \LongestHeader
    
  • ITo set up the tabular environment's header, you'd type:

    \begin{tabular}{ll | c | c |}
    & \multicolumn{1}{c}{} &\multicolumn{2}{c}{\textbf{Name1}}\\[-2ex]
    & \multicolumn{1}{c}{}
    & \multicolumn{1}{c}{\LongestHeader}
    & \multicolumn{1}{c}{\parbox{\mylen}{\centering LilHeader}}\\ % replace "LilHeader" with real column header
    \cline{3-4}
    ...
    

    instead of just

    \begin{tabular}{ll | c | c |}
    & \multicolumn{1}{c}{}&\multicolumn{2}{c}{\textbf{Name1}}\\[-2ex]
    & \multicolumn{1}{c}{}
    & \multicolumn{1}{c}{ExtremelyLongHeader}
    & \multicolumn{1}{c}{LilHeader}\\
    \cline{3-4}
    ...
    

    The \parbox command serves to typeset a "paragraph box" of a prespecified width.


There is a package for typesetting strategic form games: sgame, by Martin Osborne.

Code

\documentclass{article}
\usepackage{sgame}

% \renewcommand\gamestretch{2} % double row height

\begin{document}
\begin{game}{2}{2}[\textbf{Name 2}][\textbf{Name 1}]
           & Factor 1 & Factor 2 \\
  Factor 1 & 5        & 4        \\
  Factor 2 & 2        & 2        
\end{game}
\quad
\begin{game}{1}{1}
    & \textbf{Name 3}  \\
    & 1 
\end{game}
\end{document}

Output

enter image description here