From the very first example of a matrix presented in the "Matrix Library" section 57.1 of the TikZ & PGF manual, I expected the following to result in an arrow connecting the "Signatures" cell to the "Transition" cell in the picture.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix,fit,positioning,arrows}
\begin{document}
\begin{tikzpicture}[every node/.style={draw, anchor=west}] % added anchor=west
\matrix [matrix of nodes,draw=red,column sep=1cm,name=m]
{
\node [xshift=1mm] {\textbf {Transition Record}};\\ % added xshift=1mm
\node [align=left]
{\textbf{Signatures} \\
signed by Ted};\\
\node [align=left] {\textbf{Transition} \\ \(\tau\)};\\
\node [align=left]
{\textbf{End State} \\
\(\mathtt{Alice2}\mid\mathtt{Carol2}\mid\mathtt{Ted}\)};\\
};
\draw[-latex,bend right] (m-2-1.north west) to (m-4-1.south west);
\end{tikzpicture}
\end{document}
This results in the errors:
- Package pgf Error: No shape named m-4-1 is known. ...] (m-2-1.north west) to (m-4-1.south west)
- Package pgf Error: No shape named m-2-1 is known. ...draw[-latex,bend right] (m-2-1.north west)
On the other hand, if I replace the \draw command with
\draw[-latex,bend right] (m.north west) to (m.south west);
I get exactly the arrow I would expect.
Given that the name "m" is known, it is not clear to me why derived names, "m-1-1", "m-2-1", etc. would not be. This is especially the case given the above cited example from the manual. Apart from getting some insight as to why I am unable to reference the "unknown" shape names, I would like to understand the rules regarding the introduction of names and the scopes within which they are available to reference.
Thank you in advance.
matrix of nodes
withmatrix
. In your case, a plain matrix would be more appropriate, or to keepmatrix of nodes
but then remove the\node
commands from the matrix (and deal with the line breaks and styles in a different way).\node
command, the derived names aren't generated from that point onward. (Seems like a bug to me.) You can, however, name the node in the matrix yourself.\node
somewhere, you expect to be able to give it a name. Of course, it would be nice if these nodes had automatically an alias of the type you imply, but even that is not really doable because you could put two nodes into that cell.\node
command.