TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am creating pictures in TikZ.

Now, I have a certain C component, which consists of 4 nodes ( (a), (b), (c), (d) ).

I want to create 5 copies of this component, call them (A, B, C, D, E).

Then, I want to be able to draw lines between nodes of components. I.e.:

draw (A.a) (B.c); etc ...

My question: how do I create a "component" or a "grouping" in Tikz?

share|improve this question
Can you give us a compilable code of one component with nodes so that we can play around with it and don't work on something that you might not interested in? – percusse May 4 '12 at 8:52
up vote 8 down vote accepted

I think you can achieve what you want by just naming the nodes accordingly, although you can't use a dot in a node's name. Could you settle for A_b, e.g an underscore instead of a dot, at least internally? If yes, then you could do something like this:



\foreach \nodegroup/\x in {A/1,B/2,C/3,D/4}
{   \foreach \groupelement/\y in {a/1,b/2,c/3,d/4}
    { \pgfmathsetmacro{\positionhelper}{(\x*4+\y)*22.5}
        \node[draw,circle] (\nodegroup_\groupelement) at (\positionhelper:5) {\nodegroup.\groupelement};
\draw[bend left=30,-latex] (A_a) edge (B_b);
\draw[bend left=30,-latex] (A_d) edge (C_a);
\draw[bend left=30,-latex] (C_c) edge (D_d);
\draw[bend right=90,latex-] (C_c) edge (D_d);


enter image description here

share|improve this answer
Haha, this is too cool. – user13546 May 4 '12 at 18:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.