TeX - LaTeX Asked on July 26, 2021
Connecting 2 nodes with each other is easy. I have this one cyan node connected with a round node X.
Now I have a chain consisting of circle nodes and I want to connect the magenta node box with for example circle 7 in the chain.
Has anyone an idea how I can address the nodes in the chain?
MWE:
documentclass[tikz,border=3mm]{standalone}
usetikzlibrary {chains}
begin{document}
begin{tikzpicture}[growth dir/.store in=tikzgrowthdir,
growth dist/.store in=tikzgrowthdist,growth dir=-90,growth dist=0.1]
begin{scope}[start chain=going {at=(tikzchainprevious.tikzgrowthdir),
shift=(tikzgrowthdir:tikzgrowthdist),anchor=180+tikzgrowthdir},
nodes={on chain,circle,draw,draw,minimum size=1cm}]
foreach X [count=Y] in {1,2,3,4,5,6,7,8,9,10,11,12,13,14}
{ifnumnumexprY>3relax
tikzset{growth dir=-135}
fi
ifnumnumexprY>5relax
tikzset{growth dir=-90}
fi
ifnumnumexprY>10relax
tikzset{growth dir=-135}
fi
node {X};}
end{scope}
% node connection
node(A) [draw=cyan!20,fill=cyan!20,text width=3cm, rounded corners] at (-4,0) {Description};
node(X) [draw,circle] at (-2,-2) {X};
draw[color=cyan!20, line width=1mm] (A.south) |- (X.west);
node(A) [draw=magenta!20,fill=magenta!20,text width=3cm, rounded corners] at (-4,-3) {Description};
end{tikzpicture}
end{document}
documentclass[tikz,border=3mm]{standalone}
usetikzlibrary {chains}
begin{document}
begin{tikzpicture}[growth dir/.store in=tikzgrowthdir,
growth dist/.store in=tikzgrowthdist,growth dir=-90,growth dist=0.1]
begin{scope}[start chain=going {at=(tikzchainprevious.tikzgrowthdir),
shift=(tikzgrowthdir:tikzgrowthdist),anchor=180+tikzgrowthdir},
nodes={on chain,circle,draw,draw,minimum size=1cm}]
foreach X [count=Y] in {1,2,3,4,5,6,7,8,9,10,11,12,13,14}
{ifnumnumexprY>3relax
tikzset{growth dir=-135}
fi
ifnumnumexprY>5relax
tikzset{growth dir=-90}
fi
ifnumnumexprY>10relax
tikzset{growth dir=-135}
fi
node (nX){X};}
end{scope}
% node connection
node(A) [draw=cyan!20,fill=cyan!20,text width=3cm, rounded corners] at (-4,0) {Description};
node(X) [draw,circle] at (-2,-2) {X};
draw[color=cyan!20, line width=1mm] (A.south) |- (X.west);
node(A) [draw=magenta!20,fill=magenta!20,text width=3cm, rounded corners] at (-4,-3) {Description};
draw[color=red!70, line width=1mm] (A.south) |- (n7.west);
end{tikzpicture}
end{document}
Correct answer by js bibra on July 26, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP