[Tex/LaTex] Bad math delimiter in tikz tree

math-moderubbertikz-pgftrees

I'm trying to diagram an extensive form game using TikZ trees. The following code generates errors at compile time. Specifically, it complains about missing $'s and a bad math delimiter. I've been over the brackets with a fine-tooth comb and I can't find where the error is being generated.

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{trees}
\begin{document}
   \begin{tikzpicture}[%
   %%% Styles
   player/.style={draw,circle},
   level 2/.style={sibling distance=10mm}
   %every node/.style={node distance=1cm}
   ]
   %%% Nodes
   \node [player] (root) {1}
     child { node [player] (2a) {2} 
       child { node (aa) {
         \[ \begin{array}{c}
           1 \\ 2
         \end{array} \]} 
         edge from parent
         node [left] {A} 
       }
       child { node (ab) {
         \[ \begin{array}{c}
           3 \\ 4
         \end{array} \]}
         edge from parent
         node [right] {B}
       }
       edge from parent
       node [left] {A}
     }
     child { node [player] (2b) {2}
       child { node (ba) {
         \[ \begin{array}{c}
           5 \\ 6
         \end{array} \]} 
         edge from parent
         node [left] {A} 
       }
       child { node (bb) {
         \[ \begin{array}{c}
           7 \\ 8
         \end{array} \]} 
         edge from parent
         node [right] {B}
       } 
       edge from parent
       node [right] {B}
     };
   \end{tikzpicture}
\end{document}

The relevant error log output looks like

! Missing $ inserted.
<inserted text>
$
l.48 };
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.
! Missing $ inserted.
<inserted text>
$
l.48 };
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.
! LaTeX Error: Bad math environment delimiter.

Can anyone explain what is causing these errors? It usually wouldn't be a problem, but I use rubber to compile from org-mode, and these errors are tripping it up. (These errors also trip up texi2dvi, for those interested.)

Best Answer

Use $...$ instead of \[ ... \] and it can be compiled.

Displayed math, even if done by $$ ... $$, doesn't directly work in TikZ tree nodes. You probably dont't need it. Regarding the font size, you could use \displaystyle if necessary.

Related Question