按照此线程中的说明,粗而有图案的箭头,我设法复制了箭头,但指向下方。不过,我还使用了另一个非常相似的箭头,代码如下 -制作粗的、有图案的、圆角可调节的箭头- 我得到了不匹配的箭头。
有什么办法可以让左边的箭头与右边的箭头一样尖吗?
左箭头的代码:
\path let \p1=(a3.south), \p2=(a4.north), \n1={abs(\x2-\x1)} in node[
draw,
pattern=crosshatch,
single arrow,
rotate=-90,
minimum height=1.5cm,
anchor=south,
at=(a3.south),
outer xsep=-.5\pgflinewidth,
] {};
答案1
左侧箭头的箭头尖为 60 度,因此您可以将其用于single arrow tip angle=60
右侧箭头。single arrow head extend=<length>
如果需要,您还可以使用它来控制箭头尖的高度。
\documentclass[tikz]{standalone}
\usepackage{xparse}
\usetikzlibrary{
shapes.arrows,
positioning,
patterns,
calc,
}
\tikzset{
square/.style={
minimum width=15mm,
minimum height=15mm,
},
}
\newlength\LineWd
\newlength\ArrowWd
\newlength\ArrowHt
\newlength\tmp
\newlength\tmpi
\setlength\LineWd{8pt}
\NewDocumentCommand\HatchUpArrow{O{\LineWd}mO{\x2-\x1}m}{
\begingroup
\setlength\LineWd{#1}
\setlength\ArrowWd{2.5\LineWd}
\pgfmathsetlength{\ArrowHt}{(sqrt(3)*\ArrowWd)/2}
\filldraw[pattern=crosshatch]
let
\p1=(#4),
\p2=(#2)
in
\pgfextra{
\ifdim\x2>\x1\relax
\setlength\tmp{0.5\LineWd}
\setlength\tmpi{0.5\ArrowWd}
\else
\setlength\tmp{-0.5\LineWd}
\setlength\tmpi{-0.5\ArrowWd}
\fi
}
{[rounded corners=0.5\LineWd]
([xshift=\tmp]\p2) --
++(0pt,{abs(#3)}) coordinate (aux1) --
([xshift=-\tmp]\p1|-aux1)} coordinate (aux2) --
([shift={(-\tmp,\ArrowHt)}]\p1) --
++(\tmp-\tmpi,0pt) --
(\p1) --
([shift={(\tmpi,\ArrowHt)}]\p1) --
++(\tmp-\tmpi,0pt) --
([shift={(2\tmp,-\LineWd)}]aux2) --
++([xshift=-2\tmp]\x2-\x1,0pt) --
([xshift=-\tmp]\p2);
\endgroup
}
\begin{document}
\begin{tikzpicture}
\node[square,draw,text width=1.5cm,align=center]
(a1) {Map Tasks};
\node[square,draw,below=2cm of a1,text width=1.5cm,align=center]
(a2) {Mapper Input Cache};
\node[square,draw,right=of a2,text width=1.5cm,align=center]
(a3) {Test a};
\path let \p1=(a1.south), \p2=(a2.north), \n1={abs(\y2-\y1)} in node[
draw,
pattern=crosshatch,
single arrow,
rotate=270,
minimum height=\n1,
anchor=west,
at=(a1.250),
outer xsep=-.5\pgflinewidth,
single arrow tip angle=60,
single arrow head extend=4pt,
] {};
\HatchUpArrow[6pt]{a3.north}[30pt]{a2.60}
\end{tikzpicture}
\end{document}