# Cannot use custom styled nodes with matrix using Pgf 3.0.0

I've been doing some diagrams using TikZ with matrix as the layout.

While using Pgf version 2.10, everything went well, but now I'm using Pgf version 3.0.0 (TexLive2013) and there's a problem I'm almost sure is related to using custom styled nodes as elements of the table. The problem is that I cannot use the normal reference ((matrixName)-(rowNum)-(colNum)), because it's not available.

I've reduced my document to a MWE:

\documentclass[12pt]{standalone}

\usepackage{tikz}
\usetikzlibrary{shapes.geometric, matrix}

\tikzset{newIdea/.style={rectangle, fill=blue!90},
newPlan/.style={rectangle, rounded corners=2mm, text=white, fill=blue!90}
}

\begin{document}

\begin{tikzpicture}
\matrix (magic) [matrix of nodes, column sep=10mm]
{
\node[newIdea] {8}; & \node[newPlan] {1}; & \node[newIdea] {6}; \\
};
\draw[thick,red,->] (magic-1-1) |- (magic-1-2);
\end{tikzpicture}

\end{document}


Using Pgf 2.10, everything works; using Pgf 3.0.0 I get the following error message:

Package pgf Error: No shape named magic-1-1 is known.

Since version 3.0.0 when you use a matrix of nodes it seems that \node is not allowed inside cells (I initially didn't like this feature (I hope it's a feature and not a bug), but after thinking about it, it kind of makes perfect sense); however, you can still use the |[<options>]| syntax to modify the nodes:

\documentclass[12pt]{standalone}

\usepackage{tikz}
\usetikzlibrary{shapes.geometric, matrix}

\tikzset{newIdea/.style={rectangle, fill=blue!90},
newPlan/.style={rectangle, rounded corners=2mm, text=white, fill=blue!90}
}

\begin{document}

\begin{tikzpicture}
\matrix (magic) [matrix of nodes, column sep=10mm]
{
|[newIdea]|8 &  |[newPlan]|1 & |[newIdea]|6 \\
};
\draw[thick,red,->] (magic-1-1) |- (magic-1-2);
\end{tikzpicture}

\end{document}


• Interesting, but (tell me if I'm wrong) here we have two syntaxes that are incompatible between each version... – Nicolás Ozimica Mar 22 '14 at 2:26
• @Nicolás Indeed; it's a shame, since some 2.10 codes will not work, but, on the other hand (as I mentioned in my answer), the change makes sense to me (it should have been included earlier). Till Tantau is the only one who can say what motivated him to this. – Gonzalo Medina Mar 22 '14 at 2:30
• @Nicolás: I answered just yesterday a similar question on the italian forum. I also don't like this behaviour; another way to get rid of the problem is to specifically give the correct names (i.e. magic-1-1 to the nodes). However, this is a valid workaround if you have few \nodes within the matrix. For your case, Gonzalo's solution is perfect. – Claudio Fiandrino Mar 22 '14 at 8:11
• Extending Nicolás' comment: This would be a patch for your MWE. \node[newIdea](magic-1-1){8}; & \node[newPlan](magic-1-2){1}; – Malipivo Mar 22 '14 at 9:07
• @Nicolás: I know, that's exactly the potentiality of matrix; however, if you wish to keep your syntax you have to give name to the nodes, otherwise you have to use Gonzalo's way. – Claudio Fiandrino Mar 23 '14 at 15:56