If I want to put a line between nodes 1-1 and 2-2:
\begin{tikzpicture}
\matrix (magic) [matrix of math nodes, left delimiter=\lvert, right delimiter=\rvert,column sep=4pt,row sep=4pt]
{
\draw (0,0) circle (5pt); & \fill (0,0) circle (2pt); & \fill (0,0) circle (2pt);\\
\fill (0,0) circle (2pt); & \draw (0,0) circle (5pt); & \fill (0,0) circle (2pt);\\
\fill (0,0) circle (2pt); & \fill (0,0) circle (2pt); & \draw (0,0) circle (5pt);\\
};
%\draw[thick,red,->] (magic-1-1) |- (magic-2-2);
\end{tikzpicture}
I get:
generic/fonts/otf/lmroman12-bold.luc)(load luc: /home/xan/.texlive/texmf-var/lua
tex-cache/generic/fonts/otf/lmroman12-bold.luc) [13] [14]
Capítol 1.
(compiling luc: /var/lib/texmf/luatex-cache/generic/fonts/otf/lmroman12-italic.l
uc)(load luc: /home/xan/.texlive/texmf-var/luatex-cache/generic/fonts/otf/lmroma
n12-italic.luc)(compiling luc: /var/lib/texmf/luatex-cache/generic/fonts/otf/lmr
oman10-bolditalic.luc)(load luc: /home/xan/.texlive/texmf-var/luatex-cache/gener
ic/fonts/otf/lmroman10-bolditalic.luc) [15](compiling luc: /var/lib/texmf/luatex
-cache/generic/fonts/otf/lmsans10-bold.luc)(load luc: /home/xan/.texlive/texmf-v
ar/luatex-cache/generic/fonts/otf/lmsans10-bold.luc)
! Package pgf Error: No shape named magic-1-1 is known.
See the pgf package documentation for explanation.
Type H <return> for immediate help.
...
l.100 \draw[thick,red,->] (magic-1-1)
|- (magic-2-2);
?
Why?
If I supress the \draw line everything is OK.

\draw,\node,\pathetc. in amatrix of math nodes, the automatic naming is deactivated. Same sort of problem as in Compilation problem with tikz diagram – Torbjørn T. Oct 05 '15 at 19:29