带有两个边的双箭头表示有间隙

带有两个边的双箭头表示有间隙

我正在寻找一个描述完整 180 度路径的双箭头。我找到了一个很棒的示例,但我对其中一个边缘有点问题。

\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}

结果 [编辑:如果使用旧的 \node] 显示在图片上。右上边缘有一点缝隙。 在此处输入图片描述

如何关闭这个?[已解决:只使用坐标而不是节点!]

谢谢克里斯

答案1

我知道这个问题已经解决了。我发布这个答案是因为我认为这是一个更好的选择。

\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}

在此处输入图片描述

相关内容