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}


% I'd like to have a block with two circles within
    \draw (-1mm,0) circle(2mm) (2mm,0) circle(2mm);

\matrix (m) [matrix of nodes, 
        minimum size=1cm,
    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


With the code as is I get the following result: so far so good

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?

1 Answer 1


If understood you correctly than you are after the following:

enter image description here

MWE, which produce above images, use only arrows.meta, chains and positioning libraries. Arrows between nodes are drawn by macro join defined in chains library.,

\newcommand\dcircle{\tikz{\draw (-0.1,0) circle[radius=2mm] (0.1,0) circle[radius=2mm]}}

node distance = 1cm and 1cm,
  start chain = going right,
     N/.style = {draw, minimum size=1cm, semithick,
                 on chain, join=by ->}
\foreach \i [count=\x] in {A, B , C, \dcircle}
\node [N] {\i};
  • Thank you. Seems like the problem with my example was how I defined the dual circles.
    – tb711
    Sep 2, 2021 at 17:24
  • @bsng, frankly said. I didn't understood your definition of circles, so I write another (to my opinion) simpler solution. I'm glad that it help you!
    – Zarko
    Sep 2, 2021 at 17:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .