1

I am in the midst of making a flow chart.

Currently, I have:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,arrows,amsmath}

\tikzstyle{process}=[rectangle,minimum width=3cm,minimum height=1cm, text centered, draw=black, fill=orange!30]
\tikzstyle{decision}=[diamond,minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30]

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

    \begin{document}

    \begin{tikzpicture}[node distance=2cm]
        \node (start) [process] {
        $\text{A}_{it}$
        };

        \node (in1) [process, below of=start] {$\text{B}_{it}$};
        \node (in2) [process, below of=in1] {$\text{C}_{it}$};
        \node (pro2) [decision, right of=in1, xshift=2cm] {$\text{ D}_{it}$};
        \draw [arrow] (start)--(pro2);
        \draw [arrow] (in1)--(pro2);
        \draw [arrow] (in2)--(pro2);
    \end{tikzpicture}
    \end{document}

This connects three nodes A, B, C to D.

Now, I wish to create another node, E, to the right of D, but instead of an arrow, I want to add the plus symbol.

Is there any way to do this?

  • 1
    your code is not compileable ! – AndréC Mar 5 at 17:13
  • Hey. You'll significantly increase your chances of someone helping you by posting a code snippet that can be compiled (=includes a \documentclass, \begin{document}, etc.). It's just so much easier if we can just copy an paste the code. – sheß Mar 5 at 17:14
  • @JouleV I updated the code to include the definitions. Instead of an arrow to the next node to the right, I wish to use an addition symbol instead. This is because I wish to show how a variable is calculated. – ChinG Mar 5 at 17:22
  • 1
    your code is still not compileable – AndréC Mar 5 at 17:37
  • @ChinG Have a look at decorations.markings. – JouleV Mar 5 at 17:38
3

Like this ?

screenshot

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz,amsmath}
\usetikzlibrary{shapes.geometric,arrows.meta,positioning}

\tikzstyle{process}=[rectangle,minimum width=3cm,minimum height=1cm, text centered, draw=black, fill=orange!30]
\tikzstyle{decision}=[diamond,minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30]

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

    \begin{document}

    \begin{tikzpicture}[node distance=2cm]
        \node (start) [process] {
        $\text{A}_{it}$
        };

        \node (in1) [process, below of=start] {$\text{B}_{it}$};
        \node (in2) [process, below of=in1] {$\text{C}_{it}$};
        \node (pro2) [decision, right= 2cm of in1] {$\text{ D}_{it}$};
        \node (pro3) [decision, right= 2cm of pro2] {$\text{ E}_{it}$};
        \draw [arrow] (start)--(pro2);
        \draw [arrow] (in1)--(pro2);
        \draw [arrow] (in2)--(pro2);
        \draw (pro2) edge node[draw,fill=white,circle]{+} (pro3);
    \end{tikzpicture}
    \end{document}

addendum

\tikzstyle is deprecated since the version 2.10 of tikz, you must use \tikzset which give :

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz,amsmath}
\usetikzlibrary{shapes.geometric,arrows.meta,positioning}

%\tikzstyle{process}=[rectangle,minimum width=3cm,minimum height=1cm, text centered, draw=black, fill=orange!30]
%\tikzstyle{decision}=[diamond,minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30]
%
%\tikzstyle{arrow}=[thick,->,>=stealth]

\tikzset{
    process/.style={rectangle,minimum width=3cm,minimum height=1cm, text centered, draw=black, fill=orange!30},
    decision/.style={diamond,minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30},
        }
    \begin{document}

    \begin{tikzpicture}[node distance=2cm,arrows={-stealth},thick]
        \node (start) [process] { $\text{A}_{it}$ };

        \node (in1) [process, below of=start] {$\text{B}_{it}$};
        \node (in2) [process, below of=in1] {$\text{C}_{it}$};
        \node (pro2) [decision, right= 2cm of in1] {$\text{ D}_{it}$};
        \node (pro3) [decision, right= 2cm of pro2] {$\text{ E}_{it}$};
        \draw [->] (start)--(pro2);
        \draw [->] (in1)--(pro2);
        \draw [->] (in2)--(pro2);
        \draw (pro2) edge node[fill=white]{+} (pro3);
    \end{tikzpicture}
    \end{document}
  • 2
    Please consider stopping to propagate \tikzstyle further. – marmot Mar 5 at 18:06
  • Yes Andre! Thanks a lot. COuld the plus sign be displayed without the circle? – ChinG Mar 5 at 18:15
  • 1
    @ChinG simply write \draw (pro2) edge node[fill=white]{+} (pro3) – AndréC Mar 5 at 18:26
  • Many thanks, youre a life saver. – ChinG Mar 5 at 18:37
  • @marmot Till Tantau doesn't think it's that important, why do you think it's crucial? – AndréC Mar 5 at 19:09

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.