3

I am trying to draw multiple outputs system with TiKz but I'm having several problems to get it right.I have searched for examples, but I could not find anything that looks like to what I want to draw. So far I had tried (code shown below), but the outcome doesn't satisfy me.

    \begin{tikzpicture}
     \tikzstyle{startstop} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=black, fill=red!30]
     \tikzstyle{startstop2} = [circle, minimum width=1.8cm,,text centered, draw=black, fill=blue!30]
     \tikzstyle{startstop3} = [rectangle, rounded corners, minimum width=3.5cm, minimum height=1cm,text centered, draw=black, fill=yellow!30]

      \tikzstyle{arrow} = [thick,->,>=stealth]

       \node (a) [startstop] {a};
        \node (b) [startstop2,xshift=5cm] {b};
        \node (c) [startstop,xshift=10cm] {c};
         \node (d) [startstop3,xshift=5cm,yshift=3cm] {d};

        \draw [arrow] (a) -- (b);
         \draw [arrow] (b) -- (c);
         \draw [arrow] (d) -- (b);
         \draw [arrow] (d.south west) -- (b.north west);
          \draw [arrow] (d.south east) -- (b.north east);

           \end{tikzpicture}

enter image description here

It would be something like the following: enter image description here

What should I write in Latex for the multiple arrows ??

2

You may use the TikZ library calc, with the appropriate coordinates:

\documentclass{article}
\usepackage[english]{babel}
\usepackage{tikz}
\usetikzlibrary{calc} % TikZ library calc

\begin{document}

    \begin{tikzpicture}

        \tikzstyle{startstop} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=black, fill=red!30]
        \tikzstyle{startstop2} = [circle, minimum width=1.8cm,,text centered, draw=black, fill=blue!30]
        \tikzstyle{startstop3} = [rectangle, rounded corners, minimum width=3.5cm, minimum height=1cm,text centered, draw=black, fill=yellow!30]

        \tikzstyle{arrow} = [thick,->,>=stealth]

        \node (a) [startstop] {a};
        \node (b) [startstop2,xshift=5cm] {b};
        \node (c) [startstop,xshift=10cm] {c};
        \node (d) [startstop3,xshift=5cm,yshift=3cm] {d};

        \draw [arrow] (a) -- (b);
        \draw [arrow] (b) -- (c);
        \draw [arrow] (d) -- (b);
        \draw [arrow] ($(d.south)-(0.5,0)$) -- ($(b.north)-(0.5,0.15)$); % lines modified with appropriate coordinates
        \draw [arrow] ($(d.south)+(0.5,0)$) -- ($(b.north)+(0.5,-0.15)$); % lines modified with appropriate coordinates

    \end{tikzpicture}

\end{document}
2

Here is an approach that doesn't require any libraries (not that there's anything wrong with using libraries).

\documentclass{article}
\usepackage[english]{babel}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[
  startstop/.style={rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=black, fill=red!30},
 startstop2/.style={circle, minimum width=1.8cm,,text centered, draw=black, fill=blue!30},
 startstop3/.style={rectangle, rounded corners, minimum width=3.5cm, minimum height=1cm,text centered, draw=black, fill=yellow!30},
 arrow/.style={thick,->,>=stealth}]

        \node (a) [startstop] {a};
        \node (b) [startstop2,xshift=5cm] {b};
        \node (c) [startstop,xshift=10cm] {c};
        \node (d) [startstop3,xshift=5cm,yshift=3cm] {d};

        \draw [arrow] (a) -- (b);
        \draw [arrow] (b) -- (c);
        \draw [arrow] (d) -- (b);

\draw [arrow,<-] (b.45) -- (d.south -| b.45);
\draw [arrow,<-] (b.135) -- (d.south -| b.135);

\end{tikzpicture}
\end{document}

enter image description here

  • Instead of b.45 I could have used b.north east, which perhaps is more easy to understand. In this case 45 indicates degrees, and you can use any number of degrees you like, to move the endpoint of the arrows. – Torbjørn T. Jul 26 '16 at 19:08

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.