3

I am looking for a double arrow that describes a complete 180 degree path. I found a wonderful example, but I have a little issue with one of the edges.

\documentclass{article}
\usepackage{tikz}

\usetikzlibrary{arrows, decorations.markings}
\usetikzlibrary{positioning}

% for double arrows a la chef
% adapt line thickness and line width, if needed
\tikzstyle{vecArrow} = [thick, decoration={markings,mark=at position
   1 with {\arrow[semithick]{open triangle 60}}},
   double distance=1.4pt, shorten >= 5.5pt,
   preaction = {decorate},
   postaction = {draw,line width=1.4pt, white,shorten >= 4.5pt}]
\tikzstyle{innerWhite} = [semithick, white,line width=1.4pt, shorten >= 4.5pt]

\begin{document}

%\begin{tikzpicture}[thick]
\begin{tikzpicture}[node distance=1cm]
   \node[inner sep=0pt] (pic3) {p3}; 
   %%%% WAS \node
   %\node[inner sep=0,minimum size=0,right= 0.5cm of pic3] (inv) {};
   % IS NOW \coordinate
   \coordinate[inner sep=0pt,minimum size=0,right= 0.5cm of pic3] (inv) {};
   \node[inner sep=0pt, below of=pic3] (pic4) {p4}; 

  % 1st pass: draw arrows
  %\draw[vecArrow] (a) to (b);
  \draw[vecArrow] (pic3) |- (inv) |- (pic4);

  % 2nd pass: copy all from 1st pass, and replace vecArrow with innerWhite
  %\draw[innerWhite] (a) to (b);
  \draw[innerWhite] (pic3) |- (inv) |- (pic4);
\end{tikzpicture}

\end{document}

The result [EDIT: if the old \node is used] was shown on the pic. The right top edge has a little gap. enter image description here

How to close this one? [SOLVED: Just use coordinate not node!]

Thx Chris

1 Answers1

6

I know that this question is already solved. I am posting this answer because I think this is a better alternative.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows, decorations.markings}
\usetikzlibrary{positioning}

\tikzstyle{vecArrow} = [thick, decoration={markings,mark=at position
   1 with {\arrow[semithick]{open triangle 60}}},
   double distance=1.4pt, shorten >= 5.5pt,
   preaction = {decorate},
   postaction = {draw,line width=1.4pt, white,shorten >= 4.5pt}]

\begin{document}
  \begin{tikzpicture}[node distance=1cm]
    \node[inner sep=0pt] (pic3) {p3}; 
    \node[inner sep=0pt, below of=pic3] (pic4) {p4}; 
    \draw[vecArrow] (pic3) -- +(1,0) |- (pic4);
  \end{tikzpicture}
\end{document}

enter image description here

nidhin
  • 7,932
  • 1
    You're welcome! The image of the output adds value to an answer. Find your own way for producing them. I do a screen shot in PNG format; if the screen resolution is good, the image will be good (for this one I used a Retina screen). – egreg Jan 12 '15 at 12:44
  • (+1) nice answer. Two small comments : you can replace the first |- by -- (importan for what follows) and add shorten <=-.1pt to the postaction to hide the visible anti-aliasing thin line in the beginig of the arrow. – Kpym Jan 12 '15 at 16:42
  • @Kpym thanks for the comments. But I don't get a visible thin line in the beginning of arrow when I compile it. – nidhin Jan 12 '15 at 17:06
  • @nidhin it depends on the viewer. You can see the answers to this question. – Kpym Jan 12 '15 at 20:55