0

I am trying to draw a double 90 degree rotating arrow that connect two nodes in a tikz matrix

Here is what I would like to do:

enter image description here

However I am not sure how to approach a problem like this.

I tried creating a matrix of nodes which contain nodes that are not drawn.

Thus in the example above the node called A would need to be connected to an invisible node called a. Then a line would need to be drawn between the two invisible nodes. Thus a to b. Lastly a line would be drawn from b to B.

Here is my question:

What is the best and simplest way to create a double rotating arrow?

From my understanding there is three ways to create a double rotating arrow between two nodes in a tikz matrix

  1. Create a matrix with a row with invisible nodes. Then connect the nodes with lines.

  2. Use the calc package to find the right coordinates to connect. (not sure how to do this).

  3. Use a scope with chains. (Also don't know how to do this.)

Here is my code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                backgrounds,
                fit,
                matrix,
                positioning,
                shadows}

% My tikz picture

\begin{tikzpicture}

\matrix(a)[matrix of nodes , nodes in empty cells, nodes = {font = \small , rectangle , align = center , text width = 2cm , minimum size = 1cm}, row sep = {2cm , between origins} , column sep = {4cm , between origins}]{ % Matrix begins here. & |[draw]|Documents & & \ & & & \ |[draw]| Directory document & |[draw]| Water document & |[draw]| Data document\ };

%%%%%Draw arrow lines;

\draw[-{Stealth[length=4mm]}] (a-1-2) -- (a-3-2);

\draw (a-2-2) -- (a-2-3);

\draw -{Stealth[length=4mm]} -- (a-3-3);

\end{tikzpicture}

My output is:

enter image description here

1 Answers1

2

If you would like to repair your code, you could draw the arrows from the centre of the node instead of the edge:

\draw (a-2-2.center) -- (a-2-3.center);
\draw [-{Stealth[length=4mm]}](a-2-3.center) -- (a-3-3);

To make things easier, you could use the |-| path operator from the ext.paths.ortho library:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{ext.paths.ortho}

\begin{document}

\begin{tikzpicture} \node[draw] (a) at (0,0) {Documents}; \node[draw,below right=of a] (b) {Data};

\draw[->] (a) |-| (b); \end{tikzpicture} \end{document}

enter image description here