如何制作一条带有“开放”或“双面”箭头的路径?

如何制作一条带有“开放”或“双面”箭头的路径?

我画了这个箭头:

在此处输入图片描述

但希望它看起来像这样:

在此处输入图片描述

我该怎么做?这是第一个箭头的代码:

\documentclass[tikz]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}
    \node (n1) at (0,0) {n1};
    \node (n2) at (4,0) {n2};
    \draw[-{Latex[length=1.2cm,open]}, blue, line width=0.1cm] (n1.east) to (n2.west);
\end{tikzpicture}
\end{document}

答案1

您可以尝试一些相当简单的方法,例如:

\documentclass[border=10pt,tikz]{standalone}
\usetikzlibrary{arrows.meta,calc}
\begin{document}
\begin{tikzpicture}
    \node (n1) at (0,0) {n1};
    \node (n2) at (4,0) {n2};
    \draw [double distance=2.5mm, -{Latex[length=1.2cm,open]}, blue, line width=1mm] (n1.east) to (n2.west);
    \draw [double distance=.5mm, white, line width=1mm] (n1.east) to ($(n2.west) - (11mm,0)$);
\end{tikzpicture}
\end{document}

如果需要绘制多个,使用以下pic语法可能是可行的方法:

\documentclass[border=10pt,tikz]{standalone}
\usetikzlibrary{arrows.meta,calc}
\begin{document}
\begin{tikzpicture}
  [
    pics/my arrow/.style n args=2{
      code={
        \draw [double distance=2.5mm, -{Latex[length=12mm,open]}, line width=1mm, pic actions] (#1) to (#2);
        \draw [double distance=.5mm, white, line width=1mm] (#1) to ($(#2) - (11mm,0)$);
      },
    },
  ]
    \node (n3) at (0,-1) {n3};
    \node (n4) at (4,-1) {n4};
    \pic [red] {my arrow={n3}{n4}};
\end{tikzpicture}
\end{document}

图片箭头

答案2

cfr 的解决方案可以适应成为常规的stylepostactionshorten >可以使用选项来避免使用calctikzlibrary。

\documentclass[border=10pt,tikz]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}
  [
    my double arrow/.style={double distance=2.5mm, -{Latex[length=12mm,open]}, line width=1mm,green,
        postaction={draw,double distance=.5mm,line width=1mm, white,-, shorten >=10mm}},
  ]

    \draw[my double arrow] (0,1) to (4,1);

    \draw[my double arrow, red] (0,0) to (4,0);

\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容