1

I am trying to build the following diagram in latex with tikz:

enter image description here

However I only could find the following template to do a similar diagram:

    \documentclass{minimal}
     \usepackage{tikz}
      \usetikzlibrary{arrows,positioning} 
      \tikzset{
       %Define standard arrow tip
                >=stealth',
         %Define style for boxes
        punkt/.style={
       rectangle,
       rounded corners,
       draw=black, very thick,
       text width=6.5em,
       minimum height=2em,
       text centered},
     % Define arrow style
    pil/.style={
       ->,
       thick,
       shorten <=2pt,
       shorten >=2pt,}
        }

    \begin{document}
    \begin{tikzpicture}[node distance=1cm, auto,]
 %nodes
 \node[punkt] (market) {A};
  \node[punkt, inner sep=5pt,below=0.5cm of market]
 (formidler) {B};
  \node[punkt, inner sep=5pt,below=0.5cm of formidler]
  (forbottom) {C};
  % We make a dummy figure to make everything look nice.
  \node[above=of market] (dummy) {};
  \node[right=of dummy] (t) {2}
   edge[pil,bend left=45] (market.east) % edges are used to connect two nodes
    edge[pil, bend left=45] (formidler.east); % .east since we want
                                         % consistent style
    \node[left=of dummy] (g) {1}
     edge[pil, bend right=45] (market.west)
     edge[pil, bend right=45] (formidler.west)
     edge[pil, bend right=45] (forbottom.west)
     edge[pil,<->, bend left=45] node[auto] {0} (t);
     \end{tikzpicture}
      \end{document}

Which results the following:

enter image description here

Any idea on how to build the diagram horizontally rather than vertically?

Thanks in advance for your time.

2
  • Welcome to TeX.SX! Can you please expand the code snippet that you have posted to a full minimal working example. A MWE should compile and be as small as possible to demonstrate your problem. it's much easier to help you if we have full working code to start from. – user30471 Mar 9 '18 at 9:04
  • Done! Hope it helps – José Mar 9 '18 at 9:15
7

Something like this:

enter image description here

Here's the code:

\documentclass[border=5mm,tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\begin{document}

  \begin{tikzpicture}[
      box/.style={rectangle, draw, minimum width=14mm},
      double arrow/.style={double, -{Stealth[length=3mm, open]}}
     ]
     \foreach \alp [count=\c] in {A,...,F}{
         \node (\alp) at (2*\c,0)[box]{\alp};
     }
     \foreach \alp in {B,...,F} {
         \draw[double arrow](A.south) to [out=330, in=210] (\alp.south);
     }
  \end{tikzpicture}

\end{document}

EDIT

You can use the same idea with more complicated text and with labels under the arrows. Of course, you would have to change the width of the boxes if either the text or labels under the arrows were too wide. The slightly more complicated picture

enter image description here

was produced with the following small variation on the code above:

\documentclass[border=5mm,tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\begin{document}

  \begin{tikzpicture}[
      box/.style={rectangle, draw, minimum width=14mm},
      double arrow/.style={double, -{Stealth[length=3mm, open]}}
     ]
     \foreach \alp [count=\c] in {text 1, text 2, text 3, text 4, text 5, text 6}{
         \node (\c) at (2*\c,0)[box]{\alp};
     }
     \foreach \alp [count=\c (from 2)] in {label a,label b,label c,label d,label e} {
     \draw[double arrow](1.south) to [out=330, in=210]  
          (\c.south)node[below,anchor=north west]{\alp};
     }
  \end{tikzpicture}

\end{document}

Just for completeness, here's how I'd do the diagram in the OP:

\documentclass[border=5mm,tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\begin{document}

  \begin{tikzpicture}[
      box/.style={rectangle, rounded corners, thick, draw, minimum width=14mm},
     ]
     \node (1) at (-1,0){1};
     \node (2) at (1,0){2};
     \draw[<->](1) to [out=45, in=135] node[above]{0}(2);
     \foreach \alp [count=\c] in {A,B,C}{
         \node (\alp) at (0, -\c)[box]{\alp};
     }
     \foreach \alp in {A,B,C} {
         \draw[->](1.south west) to [out=225, in=135] (\alp.west);
         \if\alp C\else
           \draw[->](2.south east) to [out=315, in=45] (\alp.east);
         \fi
     }
  \end{tikzpicture}

\end{document}

to produce:

enter image description here

6
  • Very beautiful the arrows and all the picture.+1 – Sebastiano Mar 9 '18 at 9:50
  • 1
    Great diagram and very useful but what if I want to put inside the boxes any other text instead of letters and make a box under the arrows just to explain the arrows? Seems to be more difficult this part. Thanks anyway!!! – José Mar 9 '18 at 11:07
  • @José, yur comment is new question :-). ask it as question not as comment. what you like to obtain is not difficult to do, however there probably will not be enough space around the arrows for adding some comments at it. – Zarko Mar 9 '18 at 12:15
  • 1
    @José You can replace {A,...,F} with {Text1,Text2,Text3,Text4,Text5,Text6} and the code will work fine, although I'd probably change the labels in this case. The number of labels is also arbitrary. If you want labels on the arrows that's also not too hard. As Zarko suggests, ask a question saying what you actually want! Although, I'd also suggest reading the tikz manual and trying things yourself as TeX.SX is not meant to be a "do this for me" site:) – user30471 Mar 9 '18 at 12:44
  • 1
    @José See my edit – user30471 Mar 9 '18 at 12:56

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.