![如何制作一条带有“开放”或“双面”箭头的路径?](https://linux22.com/image/301798/%E5%A6%82%E4%BD%95%E5%88%B6%E4%BD%9C%E4%B8%80%E6%9D%A1%E5%B8%A6%E6%9C%89%E2%80%9C%E5%BC%80%E6%94%BE%E2%80%9D%E6%88%96%E2%80%9C%E5%8F%8C%E9%9D%A2%E2%80%9D%E7%AE%AD%E5%A4%B4%E7%9A%84%E8%B7%AF%E5%BE%84%EF%BC%9F.png)
我画了这个箭头:
但希望它看起来像这样:
我该怎么做?这是第一个箭头的代码:
\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 的解决方案可以适应成为常规的style
。postaction
也shorten >
可以使用选项来避免使用calc
tikzlibrary。
\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}