1

I am trying to create a diagram where one node connects to two nodes horizontally. I have attached the image of the diagram I want. However, I am having trouble moving the d node upward so that the arrow to e can flow through. Also, I can't seem to put e node a bit further to the right. In addition, I can't manually position the start point of the arrow as well. Right now, the two arrows coming out from node c are overlapped with each other.

This is my current minimal working example:

\documentclass[12pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{arrows, chains, quotes}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{calc, positioning}

\tikzstyle{startstop} = [rectangle, rounded corners, minimum width=2cm, text centered, minimum height=1.5cm, text width=3cm, very thick, draw=black, fill=white]
\tikzstyle{arrow} = [thick,->,>=stealth]
\begin{document}
    \begin{tikzpicture}
    \node (a) [startstop] {\textsf{{\normalsize A}}};
    \node (b) [startstop, right=1cm of a] {\textsf{b}};
    \node (c) [startstop, right= 1cm of b] {\textsf{c}};
    \node (d) [startstop, right = 1cm of c]  {\textsf{d}};
    \node (e) [startstop, right = 1cm of d] {\textsf{e}};

    \draw [arrow] (a) -- (b);
    \draw [arrow] (b) -- (c);
    \draw [arrow] (c) -- (d);
    \draw [arrow] (c) -- (e);
    \end{tikzpicture}
\end{document}

This is the diagram I want to draw:

This is the diagram I want to draw

I would greatly appreciate it if anyone can help me on this!!!!

  • I think you need above right = 1cm of c for the node d. – Sigur Apr 30 at 0:47
1

Something like this?

\documentclass[tikz,12pt]{standalone}
\usetikzlibrary{positioning}

\tikzset{startstop/.style={rectangle, rounded corners, minimum width=2cm, text
centered, minimum height=1.5cm, text width=3cm, very thick, draw=black,
fill=white},
arrow/.style={thick,->,>=stealth}}
\begin{document}
    \begin{tikzpicture}[font=\sffamily,]
    \node (a) [startstop] {A};
    \node (b) [startstop, right=1cm of a] {b};
    \node (c) [startstop, right= 1cm of b] {c};
    \node (d) [startstop, right = 1cm of c,yshift=1.25em]  {d};
    \node (e) [startstop, right = 1cm of d,yshift=-2.5em] {e};

    \draw [arrow] (a) -- (b);
    \draw [arrow] (b) -- (c);
    \draw [arrow] (c.east|-d) -- (d);
    \draw [arrow] (c.east|-e) -- (e);
    \end{tikzpicture}
\end{document}

enter image description here

Comments:

  • to move the nodes vertically, just use yshift;
  • \tikzstyle is deprecated, so I replaced it by the corresponding \tikzset command;
  • if you want all texts sans serif, it is easier to add font=\sffamily;
  • if you add tikz to the options of standalone this will load tikz and make it a standalone environment;
  • the syntax |- and -| is nicely explained in this answer and is used to make sure the connections are horizontal;
  • I removed all libraries you do not use;
  • it might make sense here to use chains, or not.
  • You won for some seconds... lol – Sigur Apr 30 at 0:51
  • @Sigur Sorry, didn't know... (my crystal ball got stolen...) ;-) – user121799 Apr 30 at 0:53
  • but my solution wild not be so good as yours. – Sigur Apr 30 at 0:56
  • @marmot Thank you so so much!!!! This is exactly what I want! – Shao Apr 30 at 0:57
  • @Sigur I guess judgement is up to the voters... – user121799 Apr 30 at 0:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.