如何制作带有弯曲边缘的“L”形箭头

如何制作带有弯曲边缘的“L”形箭头

我简化了这个例子这里,但我看到的是“L”形箭头,当它达到与 A 相同的高度时会弯曲,如下图所示。红色曲线就是我想要的。

在此处输入图片描述

这是我现在拥有的黑色箭头的代码。

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
  \node[anchor=east] at (0,0) (text) {A};
  \node[anchor=west] at (5,5) (description) {B};
  \draw (description) edge[out=180,in=0,->] (text);
\end{tikzpicture}
\end{document}

答案1

添加rounded corners到路径属性。您可以通过设置值来控制这一点。

在此处输入图片描述

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
  \node[anchor=east] at (0,0) (text) {A};
  \node[anchor=west] at (5,5) (description) {B};
  \draw[rounded corners=10pt](description) |- (text);
  \draw[red, rounded corners=25pt](description) |- (text);
  \draw[green, rounded corners=50pt](description) |- (text);
\end{tikzpicture}
\end{document}

答案2

您可以为此使用控制点:

\begin{tikzpicture}[thick]
\draw[<-] (0,0) .. controls (4,0) and (5,1) .. (5,5);
\draw[<-,dashed] (0,0) .. controls (4.5,0) and (5,0.5) .. (5,5);
\draw[<-,dotted] (0,0) .. controls (4.9,0) and (5,0.1) .. (5,5);
  \node[anchor=east] at (0,0) (text) {A};
  \node[anchor=west] at (5,5) (description) {B};
\end{tikzpicture}

有关控制点的更多信息,请参阅 pgfmanual。基本上:(s) .. controls (c1) and (c2) .. (e)绘制一条从 (s) 开始、在 (e) 结束的线,初始切线朝向 (c1),最终切线朝向 (c2)。

这里,(c1) 与 (s) 的距离控制着路径开始弯曲的速度,(c2) 和 (e) 也是如此。

在此处输入图片描述

答案3

最简单的解决方案是使用 PSTricks。

\documentclass[pstricks,border=24pt]{standalone}
\usepackage{pst-eucl}
\begin{document}
\begin{pspicture}(4,3)
    \pstGeonode[PosAngle={180,90},PointSymbol=none](0,0){A}(4,3){B}
    \ncangle[angleB=-90,linearc=2]{<-}{A}{B}
\end{pspicture}
\end{document}

在此处输入图片描述

动画版

\documentclass[pstricks,border=24pt]{standalone}
\usepackage{pst-eucl}
\begin{document}
\multido{\n=.0+.5}{7}{%
\begin{pspicture}(4,3)
    \pstGeonode[PosAngle={180,90},PointSymbol=none](0,0){A}(4,3){B}
    \ncangle[angleB=-90,linearc=\n]{<-}{A}{B}
\end{pspicture}}
\end{document}

在此处输入图片描述

相关内容