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

  • you don't need a node inv. try \draw[vecArrow] (pic3) |- +(1,0) |- (pic4); instead of \draw[vecArrow] (pic3) |- (inv) |- (pic4); – nidhin May 25 '14 at 8:45
  • you don't need an innerWhile line also. You are already defined vecArrow as double. – nidhin May 25 '14 at 8:56
  • @nidhin, could you write up an answer for this one? – Paul Gessler Jan 11 '15 at 3:45
  • @PaulGessler I think this question is already solved. The code given in OP is works fine. Anyway I will put my code here. – nidhin Jan 12 '15 at 5:51
5

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

  • 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

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.