14

I'm trying to get two arrows to be spaced equally from each other. Currently I'm drawing two separate arrows using \draw with [out=-180,in=-180,distance=3cm] where I play with the distance until the two arrows more or less line up.

Below is a screenshot of what I have but I can't seem easily have the two arrows line up perfectly. Also if I change one arrow I have to change the other arrow as well manually. Any tips would be appreciated

Image of two arrows not lining up

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,fit,calc,positioning}

\begin{document}
\begin{tikzpicture}[thick]
\node [minimum height=1cm] (a) at (0.2,-3.2) {};

\node [minimum height=1cm] (b) at(-1.5,-1) {};

\draw[thick, >=stealth , ->] ($(b.north west)!0.6!(b.south west)$) to [out=-180,in=-180,distance=2.5cm] ($(a.north west)!0.4!(a.south west)$){};
\draw[thick, >=stealth , <-] ($(b.north west)!0.4!(b.south west)$) to [out=-180,in=-180,distance=3cm] ($(a.north west)!0.6!(a.south west)$){};

\end{tikzpicture}
\end{document}

2 Answers2

12

I do not think that it is possible with just two to operations. The inner curve is smaller in height and width – that could be handled by a transformation. But the horizontal distance between the start and end point remains the same.

The following example therefore only draws one curve. First pretty thick to cover both lines. Then the same path is used to clear the space between the lines by drawing a white line with smaller line width.

My PDF viewer showed a small glitch, at the start and end points a pretty thin black vertical line remains. Therefore they are overwritten with white lines to the right.

At last the arrow tips are added. Depending on the kind of tip, the very end also needs some whitening before, because the tip might be thinner than the black line width.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}[thick]

\coordinate (a) at (0,0);
\coordinate (b) at (-1,2);

\edef\DoubleDistance{\the\dimexpr.2cm-\pgflinewidth}

% draw large black line including space inbetween
\draw[double distance=\DoubleDistance]
  (a) to [out=-180, in=-180, distance=3cm] (b)
;

% fix small glitch, the PDF viewer had showed a very thin vertical line
\draw[line width=\DoubleDistance, white]
  (a) -- +(.01,0)
  (b) -- +(.01,0)
;

% some whitening for the arrow tip
\draw[line width=1.1\pgflinewidth,white]
  (a) ++(0.1pt,.1) -- +(-.8pt,0)
  (b) ++(0.1pt,.1) -- +(-.8pt,0)
;

% draw arrow tips
\draw[<-] (a) ++(0,.1) -- +(-.01,0);
\draw[<-] (b) ++(0,.1) -- +(-.01,0);

\end{tikzpicture}
\end{document}

Result

Heiko Oberdiek
  • 271,626
  • 1
    Nice! Wouldn't perhaps a double line save some work here? – Gonzalo Medina May 07 '14 at 02:01
  • 1
    Something like \begin{tikzpicture}[thick] \coordinate (a) at (0,0); \coordinate (b) at (-1,2); \draw [double,double distance=2mm] (a) to [out=-180, in=-180, distance=3cm] (b) ; \draw[<-] (a) ++(0,-0.1) -- +(-.01,0); \draw[<-] (b) ++(0,-0.1) -- +(-.01,0); \end{tikzpicture} (with some corrections). – Gonzalo Medina May 07 '14 at 02:15
  • 1
    @GonzaloMedina: Yes, example updated. – Heiko Oberdiek May 07 '14 at 02:28
  • The "glitch" is most likely due to anti-aliasing in the PDF viewer whereby the edge of the overlaid white line is transparent and so shows a trace of the black line underneath. – Andrew Stacey Jun 11 '14 at 08:39
3

enter image description here

\documentclass[tikz,margin=5pt]{standalone}

\begin{document}

\begin{tikzpicture}

\begin{scope}[xslant=-.5]
\draw[shorten >=1.5pt,<-,>=stealth] (0,-2) arc (270:90:2 and 2.01) ;
\draw[shorten <=1.5pt,->,>=stealth] (0,-2.1) arc (270:90:2.11 and 2.1) ;
\end{scope}

\end{tikzpicture}

\end{document}
Tarass
  • 16,912