I am having difficulties in adjusting the TikZ code to get a symmetrical output matrix; I guess the * is the reason the right block is somehow higher?




\caption{Collective action problem in the Prisoners' Dilemma}
\label{Collective action problem in the Prisoners' Dilemma}
\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,]{
         & Cooperate & Defect  \\
Cooperate & |[draw]|3,3 & |[draw]|1,4 \\
Defect & |[draw]|4,1 & |[draw]|2,2* \\
\node[above=0.25cm] at ($(m-1-2)!0.5!(m-1-3)$){\textbf{Actor A}};
\node[rotate=90] at ($(m-2-1)!0.5!(m-3-1)+(-1.25,0)$){\textbf{Actor B}};
 \node [below=1.5cm, align=flush center,text width=8cm]
            Number left (right) of comma refers to A's (B's) preference ordering (1 = worst outcome; 4 = best outcome). * indicates the equilibrium.         
  • Since you have received some answers to your question, please consider, for each one of your questions, marking the answer that you consider best solved your problem by clicking the checkmark to its left; this is the way in which you thank people around here :). In case of doubts, please see How do you accept an answer?. – Gonzalo Medina Jul 22 '14 at 14:36

You can "pretend" that the * is not here (i.e: it takes no space) by putting \smash{\rlap{*}} instead of simply *. This way not only all cells will have the same size, but also the 2.2 will be vertically aligned with 1.4:


  • The space between 'boxes' does not comply with 'standard' game-theory matrix styles. I'm not very comfortable with tikz-node positioning, but I whipped up the following, with the very tweakish row sep=-3*\pgflinewidth. See pastebin.com/Tfcy7F8y. This is just a comment in passing. – PatrickT May 27 '16 at 4:01

Consider reading this, simply specify text height=1em in element/.style and you'll get:

enter image description here


You could try setting the node's anchors element/.style={ anchor=north east, or element/.style={ anchor=center,.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.