策略/收益矩阵

策略/收益矩阵

我正在尝试在 LaTeX 中创建一个策略矩阵,例如 在此处输入图片描述

任何建议都将不胜感激。我希望每个单元格中有两个值,如本图所示对齐。

答案1

这是一个使用表格的解决方案(接下来是 tikz 解决方案)。

\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}

结果如下

在此处输入图片描述

这是一个 tikz 解决方案:(注意:我修复了代码中的对齐问题,但没有更新图片)

\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}

结果是

在此处输入图片描述

相关内容