2

I need to draw a diagram like in the picture below: enter image description here I have everything except this connected arrows. My code:

\documentclass[11pt]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=1]

\foreach \x in {0,1.1,2.2,3.3,5.5,6.6,8} {
     \draw [very thick] (\x,0.1cm) -- (\x,-0.1cm) node[above] {} ;
}

\draw [color=black,very thick](0.0,0*1)   -- (8,0*1);
\draw [color=black,very thick](1.1,1*1)   -- (3.3,1*1);
\draw [color=black,very thick](2.2,2*1)   -- (3.3,2*1);
\draw [color=black,very thick](5.5,1*1)   -- (6.6,1*1);
\draw [color=black,very thick](5.5,2*1)   -- (6.6,2*1);
\draw [color=black,very thick](5.5,3.8)   -- (6.6,3.8);

\draw [very thick] (1.1,0.9) -- (1.1,1.1) node[above] {} ;
\draw [very thick] (2.2,0.9) -- (2.2,1.1) node[above] {} ;
\draw [very thick] (3.3,0.9) -- (3.3,1.1) node[above] {} ;
\draw [very thick] (2.2,1.9) -- (2.2,2.1) node[above] {} ;
\draw [very thick] (3.3,1.9) -- (3.3,2.1) node[above] {} ;
\draw [very thick] (5.5,1.9) -- (5.5,2.1) node[above] {} ;
\draw [very thick] (6.6,1.9) -- (6.6,2.1) node[above] {} ;
\draw [very thick] (5.5,0.9) -- (5.5,1.1) node[above] {} ;
\draw [very thick] (6.6,0.9) -- (6.6,1.1) node[above] {} ;
\draw [very thick] (5.5,3.7) -- (5.5,3.9) node[above] {} ;
\draw [very thick] (6.6,3.7) -- (6.6,3.9) node[above] {} ;


\begin{scope}[every node/.style={ultra thick},scale=1]
    \node () at (1.1/2,-0.5) {\small $A_1$};
    \node () at (3.3/2,-0.5) {\small $A_2$};
    \node () at (5.5/2,-0.5) {\small $A_3$};
    \node () at (8.8/2,-0.5) {\Large $\cdots$};
    \node () at (12.1/2,-0.5) {\small $A_n$};
    \node () at (14.6/2,-0.5) {\Large $\cdots$};
\end{scope}

\begin{scope}[every node/.style={ultra thick},scale=1]
    \node () at (3.3/2,0.5) {$\uparrow$};
    \node () at (5.5/2,0.5) {$\uparrow$};
    \node () at (5.5/2,1*1+0.5) {$\uparrow$};       
    \node () at (12.1/2,0*1+0.5) {$\uparrow$};
    \node () at (12.1/2,1*1+0.5) {$\uparrow$};
    \node () at (12.1/2,2*1+0.65) {\Large $\vdots$};
    \node () at (12.1/2,3*1+0.3) {$\uparrow$};
\end{scope}

\end{tikzpicture}
\end{document}

How can I draw this arrows?

2

The basic syntax you probably want for drawing curved arrows is

\draw[->] (0,1) to[out=90, in=45] (0,0);

basic curved arrow

You also might be interested in getting the fancier style arrow, in the middle of the path. This can be achieved by using \usetikzlibrary{decorations.markings} and setting the style:

\tikzset{
  ->-/.style={decoration={markings, mark=at position #1 with {\arrow[scale=1.5, xshift=1.5pt]{stealth}}},postaction={decorate}},
  ->-/.default=.5}

Then you can say

\begin{tikzpicture}
  \draw[->-] (1,0) to[out=135, in=45] (0,0);
  \draw[->-=.65] (2,1) to[out=135, in=45] (1,1) to (0,0);
  \draw[->-] (3,2) to[out=135, in=45] (2,2) to (1,1);
\end{tikzpicture}

fancy curved arrows

This is probably enough for you to get the result you want on your own.

A few side tips which are not really related to your question but will vastly simplify your code:

  • You can add options like very thick to the tikzpicture environment itself, and they will be applied to everything inside it.
  • Putting node[above] {} in a path basically does nothing (unless you have designated a visible style for all nodes). It adds an empty node with no way to refer to its position later.
  • You can omit the empty node name declaration () if you don't want to label the nodes...
  • ... but you really should label your nodes. That way you can refer to their coordinates later, instead of entering them again manually.

Applying this advice, you might come up with something like the following:

\documentclass[tikz, border=5pt]{standalone}
\usetikzlibrary{decorations.markings, positioning}
\begin{document}

% Style for arrow in middle of path
\tikzset{->-/.style={decoration={markings, mark=at position #1 with {\arrow[scale=1.5, xshift=1.5pt]{stealth}}},postaction={decorate}}, ->-/.default=.5}

% Macro to draw a segment. The optional argument is a name so that you can refer to the node and its anchors later.
\newcommand{\segment}[2][]{
  \begin{scope}[shift={#2}]
    \draw (-.5,0) -- (.5,0) (-.5,.1) -- (-.5,-.1) (.5,.1) -- (.5,-.1);
    \node[rectangle, inner sep=0, outer sep=0, minimum width=1cm, minimum height=.6cm] (#1) {};
  \end{scope}
}


\begin{tikzpicture}[
  yscale=1.5, % Stretch the picture vertically to simplify internal coordinates
  very thick, % Make all lines in the picture very thick
  font=\small, % Make the default font small
]

\foreach \x/\label in {1/1,2/1,3/1,6/n} {
  \segment[x-1-\x]{(\x,0)}
  \path (x-1-\x) node[below] {$A_\label$};
}
\draw (8,.1) -- (8,-.1) (.5,0) -- (8,0) node[right] {$A$};
\path (4.5,0) node[below] {\vphantom{$A$}\Large$\cdots$}
      (7.25,0) node[below] {\vphantom{$A$}\Large$\cdots$};

\foreach \x in {2,3,6} {
  \segment[x-2-\x]{(\x, 1)}
  \draw[->-] (x-1-\x) -- node[right] {$T$} (x-2-\x);
}

\foreach \x in {3,6} {
  \segment[x-3-\x]{(\x, 2)}
  \draw[->-] (x-2-\x) -- node[right] {$T$} (x-3-\x);
}
\segment[x-6-6]{(6,3.5)}
\node (dots) at (6,2.5) {\Large$\vdots$};
\draw[->-] (dots) -- node[right] {$T$} (x-6-6);

% Label some coordinates for the curved arrows to go through
\foreach \x in {1,2,3,6} {
  \coordinate[left=1cm of x-\x-\x] (left-\x);
}

% Draw the curved arrows
\draw[->-=.999] (left-1) to [out=-135, in=-135] node[below] {$T$} (4.5,-.5);
\draw[->-] (x-1-1.north) to [out=135, in=45] (left-1);
\draw[->-=.6] (x-2-2.north) to [out=135, in=45] (left-2) to (left-1);
\draw[->-=.65] (x-3-3.north) to [out=135, in=45] (left-3) to (left-2);
\draw[->-] (x-6-6.north) to [out=135, in=45] (left-3);
\end{tikzpicture}

\end{document}

final picture

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.