Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to create a strategy matrix in LaTeX such as enter image description here

Any suggestion would be greatly appreciated. I would like there to be two values in each cell, aligned as in this diagram.

share|improve this question

migrated from stackoverflow.com Jul 17 '11 at 12:13

This question came from our site for professional and enthusiast programmers.

    
Welcome to TeX.sx! Your question was migrated here from another stackexchange site. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. –  Martin Scharrer Jul 17 '11 at 12:19

1 Answer 1

Here is a solution using tabular (a tikz solution follows).

\begin{tabular}{ccccc}
&&\multicolumn{2}{c}{Payoff Matrix}\\
&&\multicolumn{2}{c}{Firm B}\\
&&Low Price&High Price\\
\cline{3-4}
\raisebox{-0.25cm}{\rotatebox{90}{A}}&\multicolumn{1}{p{1cm}}{Low Price}&
\multicolumn{1}{|p{1.5cm}}{\hfill $10$\newline $10$\hfill}&
\multicolumn{1}{|p{1.5cm}|}{\hfill $5$\newline $25$\hfill}\\
\cline{3-4}
\raisebox{-0.25cm}{\rotatebox{90}{Firm}}&\multicolumn{1}{p{1cm}}{Low Price}&
\multicolumn{1}{|p{1.5cm}}{\hfill $5$\newline $25$\hfill}&
\multicolumn{1}{|p{1.5cm}|}{\hfill $20$\newline $20$\hfill}\\\cline{3-4}
\end{tabular}

Here is the result

enter image description here

Here is a tikz solution: (note: I fixed an alignment problem in the code, but I did not update the picture)

\documentclass{minimal}

\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{matrix}
\usetikzlibrary{positioning}

\begin{document}

\begin{tikzpicture}

\matrix[matrix of math nodes,every odd row/.style={align=right},every even row/.style={align=left},every node/.style={text width=1.5cm},row sep=0.2cm,column sep=0.2cm] (m) {
10&5\\
10&25\\
5&20\\
25&20\\
};
\draw (m.north east) rectangle (m.south west);
\draw (m.north) -- (m.south);
\draw (m.east) -- (m.west);

\coordinate (a) at ($(m.north west)!0.25!(m.north east)$);
\coordinate (b) at ($(m.north west)!0.75!(m.north east)$);
\node[above=5pt of a,anchor=base] {Low Price};
\node[above=5pt of b,anchor=base] {High Price};

\coordinate (c) at ($(m.north west)!0.25!(m.south west)$);
\coordinate (d) at ($(m.north west)!0.75!(m.south west)$);
\node[left=2pt of c,text width=1cm]  {Low Price};
\node[left=2pt of d,text width=1cm]  {High Price};

\node[above=18pt of m.north] (firm b) {Firm B};
\node[left=1.6cm of m.west,rotate=90,align=center,anchor=center] {Firm A};

\node[above=5pt of firm b]  {Payoff Matrix};
\end{tikzpicture}

\end{document}

The result is

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.