I'm trying to draw block diagrams with tikz.
For that I'd like to use matrices to align the nodes and then connect the nodes with the tikzlibrary chains
, as described in the pgfmanual page 601 (chapter 48).
However, within some blocks I'd like to place custom pictograms. Once I do that, I cannot chain blocks containing custom pictograms together.
I've got the idea from this texample, which I cannot get to compile either.
Consider the following MWE:
\usetikzlibrary{chains, scopes, matrix}
\begin{tikzpicture}
% I'd like to have a block with two circles within
\def\circles{
\node{};
\draw (-1mm,0) circle(2mm) (2mm,0) circle(2mm);
}
\matrix (m) [matrix of nodes,
nodes={draw,
minimum size=1cm,
align=center,
anchor=center},
column sep=1cm,
row sep=1cm,
]
{
A & B & C & \circles \\
};
{ [start chain, every on chain/.style={join=by ->}]
\chainin (m-1-1);
\chainin (m-1-2);
\chainin (m-1-3);
% \chainin (m-1-4); % once uncommented, it doesn't compile
};
\end{tikzpicture}
With the code as is I get the following result:
Once I uncomment the last \chainin (m-1-4);
statement though, I get the error message
[LaTeX] Line 87: Package pgf Error: No shape named `chain-1' is known.
[LaTeX] Line 87: See the pgf package documentation for explanation. ...
l.80 \chainin (m-1-4);
Any idea how I could connect a node with such a pictogram within a chaining sequence?
Best Answer
If understood you correctly than you are after the following:
MWE, which produce above images, use only
arrows.meta
,chains
andpositioning
libraries. Arrows between nodes are drawn by macrojoin
defined inchains
library.,