Tikz:有没有办法创建无头箭头宽度边缘(有角度)?

Tikz:有没有办法创建无头箭头宽度边缘(有角度)?

我有这个箭头,如果它与节点一起使用,它可以正常工作:

\node[draw, single arrow,
        minimum height=9mm, minimum width=1mm,
        single arrow head extend=0mm,
        anchor=west]

\draw但是我怎样才能得到像 这样的“有角度”版本的带有 和 的相同箭头(a) |- (b)呢?

答案1

如果我正确理解了 OP,这是我的尝试:

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\newcommand{\angledArrowDown}[3]{
\coordinate (A) at #2;
\coordinate (B) at #3;
\node[anchor=south west,inner sep=#1/4] (StPoint-1)at (A){};
\node[anchor=north west,inner sep=#1/4] (StPoint-2) at (A){};
\node[anchor=south west,inner sep=#1/2] (EndPoint-1)at (B){};
\node[anchor=south east,inner sep=#1/2] (EndPoint-2) at (B){};
\draw (StPoint-1.north west) -| (EndPoint-1.north) -- (EndPoint-1.north east) -- (B) 
-- (EndPoint-2.north west) -- (EndPoint-2.north) |- (StPoint-2.south west) -- cycle;}

\newcommand{\angledArrowUp}[3]{
\coordinate (A) at #2;
\coordinate (B) at #3;
\node[anchor=south west,inner sep=#1/4] (StPoint-1)at (A){};
\node[anchor=north west,inner sep=#1/4] (StPoint-2) at (A){};
\node[anchor=north east,inner sep=#1/2] (EndPoint-1)at (B){};
\node[anchor=north west,inner sep=#1/2] (EndPoint-2) at (B){};
\draw (StPoint-1.north west) -| (EndPoint-1.south) -- (EndPoint-1.south west) -- (B) 
-- (EndPoint-2.south east) -- (EndPoint-2.south) |- (StPoint-2.south west) -- cycle;}
\begin{document}
\begin{tikzpicture}
%\angledArrowDown{thick}{star point}{end point below start point}
\angledArrowDown{5mm}{(0,1)}{(1,-1)}

%\angledArrowUp{thick}{star point}{end point above start point}
\angledArrowUp{5mm}{(0,-3)}{(1,-1)}
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

只是为了好玩:一些箭头样式。优点是您可以使用简单的命令绘制箭头,例如

\draw[outlined arrow] (-1,3) -| (0,0);  

缺点是,与vi pa 的回答很好或者这个答案,它会将内部涂成白色。外观由各种 pgf 键控制(请参阅移位范围内的示例)。

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[outlined arrow/.code={\tikzset{oarrow/.cd,#1},
    \def\pv##1{\pgfkeysvalueof{/tikz/oarrow/##1}}%
    \edef\locallw{\the\pgflinewidth}%
    \tikzset{-{Triangle[open,fill=white,line width=\locallw,
        length=\pv{head length},width=\pv{head width}]},
    line width=\pv{line width},
    postaction={-,draw=white,line width=\pv{line width}-2*\locallw,
        shorten <=\locallw,shorten >=\pv{head length}-1.5*\locallw}%
    }},oarrow/.cd,line width/.initial=0.6cm,head width/.initial=1.2cm,
    head length/.initial=1cm]
 \draw[outlined arrow] (-1,3) -| (0,0); 
 \draw[outlined arrow] (-1,-3) -| (0,0);
 \begin{scope}[xshift=5cm]
  \draw[blue,thick,outlined arrow={line width=0.7cm,head width=1.4cm}] (-1,3) -| (0,0); 
  \draw[red,outlined arrow={line width=0.5cm,head length=0.8cm}] (-1,-3) -| (0,0);
 \end{scope}
\end{tikzpicture}
\end{document}

在此处输入图片描述

弯曲的箭头不适合这种风格,你可能需要看看这里寻找制作弯曲箭头的可能方法。

相关内容