TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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 have a little problem that I am sure is really trivial, but have no idea how to solve it. I have a very simple flowchart with one node that I want to split into two so that they converge in the same following node, and another node that I want to split into two so that the previous node diverges into them. Here is a MWE:


\mode<presentation> {


    every node/.style={
    drop shadow,
    text width=7cm,
    >=latex, %Make the arrow tips latex
    myline/.style={ultra thick,black!50},
    shorter/.style={shorten <=1mm,shorten >=0.5mm}]
    \node (A) at (0,0) {Normal dataset and Mutant dataset};
    \node[right=0.3cm of A,
        text width=1.5cm] (A2) {\fontsize{7}{7}\selectfont\textcolor{blue}{F5}};
    \node[below=0.5cm of A] (B) {Filter process 1};
    \node[below=0.5cm of B] (C) {Filter process 2};
    \node[below=0.5cm of C] (D) {Reduced model and Full model};
    \node[below=0.5cm of D] (E) {Identify gene set 1 and Identify gene set 2};
    \node[below=0.5cm of E] (F) {Analyze gene set 1 and Analyze gene set 2};
    \draw[myline,-,shorter] (A) -- (A2);
    \draw[myline,->,shorter] (A) -- (B);
    \draw[myline,->,shorter] (B) -- (C);
    \draw[myline,->,shorter] (C) -- (D);
    \draw[myline,->,shorter] (D) -- (E);
    \draw[myline,->,shorter] (E) -- (F);


I want the node "Normal dataset and Mutant dataset" in two nodes "Normal dataset" (with the node "F5" on the left) and "Mutant dataset" (with the node "F5 on the right") converging in the node "Filter process 1".

Then I want to split the node "Reduced model and Full model" into two nodes "Reduced model" and "Full model", so that "Filter process 2" diverges into them. From that point, the flowchart should continue separated, so that "Reduced model" connects with "Identify gene set 1" and "Full model" with "Identify gene set 2". Then "Identify gene set 1" should connect with "Analyze gene set 1" and "Identify gene set 2" with "Analyze gene set 2".

The objective is to be able to draw converging and diverging arrows (Though it is not the best example, but something similar to this).

I guess this should be easy to accomplish, but I really don't know how, and don't find any example on the net. Many thanks in advance!

share|improve this question
Do you want the F5 node twice or in the middle of the dataset nodes? – Qrrbrbirlbel Jun 29 '13 at 1:05
In the middle would be better now that you suggest it, thanks!! I'm just looking for converging and diverging arrows – DaniCee Jun 29 '13 at 13:11
up vote 7 down vote accepted

I created three node styles:

  • big node with text width=7cm,
  • small node with text width=2.5cm, and
  • F5 node for the single F5 node.

When we first place the biggest nodes we can then later use their anchors to place the smaller nodes aligned to them. This is what the introduced keys make. They work just like below=… of … and the like but only that they left- (west) and right-align (east) the nodes. Without these styles we had to write something like above=of B.north west, anchor=south west which is now equivalent to west above=of B.

The F5 node is placed with an invisble path between the two top nodes. The default midway setting for nodes along paths (right after --) makes sure that the F5 node lies directly between A1 and A2:

\path (A1) -- node[F5 node] {F5} (A2);

You could also do this with the calc library and the syntax:

\node [F5 node] at ($(A1)!.5!(A2)$) {F5};

For the arrows, I have introduced two auxiliary styles |* and *| (the names are debatable). Something like this has been previously discussed in Tikz: purely vertical arrow from nodeA.south to nodeB.north.

Converging and Diverging Arrows

When we set node distance=1cm (the default) we can use:

\path[myline,->,shorter] {[out=270,in=90] (A1) edge (B) 
                                          (A2) edge (B) }
                                          (B)  edge (C)
                         {[out=270,in=90] (C)  edge (D1)
                                               edge (D2)}
                                          (D1) edge (E1) (E1) edge (F1)
                                          (D2) edge (E2) (E2) edge (F2)

which looks like

enter image description here

With my paths.ortho library ([1], [2], Explanation) we can do

\path[myline,->,shorter] {[|-|] (A1) edge (B) 
                                (A2) edge (B) }
                                (B)  edge (C)
                         {[|-|] (C)  edge (D1)
                                     edge (D2)}
                                (D1) edge (E1) (E1) edge (F1)
                                (D2) edge (E2) (E2) edge (F2)

which will result in

enter image description here

A small node distance of .5cm makes it hard to place the arrows because of the arrow tip’s size.


\tikzset{west above/.code=\tikz@lib@place@handle@{#1}{south west}{0}{1}{north west}{1}}
\tikzset{west below/.code=\tikz@lib@place@handle@{#1}{north west}{0}{-1}{south west}{1}}
\tikzset{east above/.code=\tikz@lib@place@handle@{#1}{south east}{0}{1}{north east}{1}}
\tikzset{east below/.code=\tikz@lib@place@handle@{#1}{north east}{0}{-1}{south east}{1}}
  every node/.style={
    drop shadow,
  big node/.style={text width=7cm},
  small node/.style={text width=2.5cm},
  F5 node/.style={font=\fontsize{7}{7}\selectfont,text=blue},
  >=latex, %Make the arrow tips latex
  myline/.style={ultra thick,black!50},
  shorter/.style={shorten <=1mm,shorten >=0.5mm},
  node distance=.5cm,
  |*/.style={to path=(\tikztostart.south) -- (\tikztostart.south|-\tikztotarget.north)},
  *|/.style={to path=(\tikztostart.south-|\tikztotarget.north) -- (\tikztotarget.north)}
\begin{scope}[every node/.append style={big node}]
  \node (B) {Filter process 1};
  \node[below=of B] (C) {Filter process 2};
\begin{scope}[every node/.append style={small node}]
  \node[west above=of B] (A1) {Mutant dataset};
  \node[east above=of B] (A2) {Normal dataset};

  \node[west below=of C] (D1) {Reduced Model};
  \node[east below=of C] (D2) {Full Model};

  \node[below=of D1] (E1) {Identify gene set 1};
  \node[below=of E1] (F1) {Analyze gene set 1};

  \node[below=of D2] (E2) {Identify gene set 2};
  \node[below=of E2] (F2) {Analyze gene set 2};
\path (A1) -- node[F5 node] {F5} (A2);

\path[myline,->,shorter]  {[|*] (A1) edge (B) 
                                (A2) edge (B) }
                                (B)  edge (C)
                          {[*|] (C)  edge (D1)
                                     edge (D2)}
                                (D1) edge (E1) (E1) edge (F1)
                                (D2) edge (E2) (E2) edge (F2)


enter image description here

share|improve this answer
Thanks, it is getting closer to what I want, but I'm explicitly looking for converging and diverging arrows... is there a way the arrows from the "dataset" nodes can converge into one and the arrows from the "Filter process 2" node be just one that diverges into two? Thanks! – DaniCee Jun 29 '13 at 13:06
Take a look at my updated answer. Is this something you wanted achieve? – Qrrbrbirlbel Jun 29 '13 at 14:15
Many thanks! that looks exactly what I want! I'm really intrigued by the paths.ortho library, how should I use it? where do I place those files [1] and [2]? Many many thanks – DaniCee Jun 29 '13 at 15:30
besides, when trying the flowchart code I get the error: ! TeX capacity exceeded, sorry [input stack size=5000]. – DaniCee Jun 29 '13 at 16:01
@DaniCee These files are best placed in your local texmf folder, see Purpose of local texmf trees Although, you can simply place them in the same folder as your .tex file. If you follow the third link, you can find other ideas to implement this (calc + |-/-|). — I can’t reproduce your error with the code above. Do you have an up-to-date installation? – Qrrbrbirlbel Jun 29 '13 at 17:56

Your Answer


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

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