16

I simplified this example from here, however what I am looking is an "L" shaped arrow that curves when it gets to the same height as A which can be seen in the below figure. The red curve is the one that I want.

enter image description here

Here is the code that I have right now for the black arrow.

\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}
27

Add rounded corners to the path properties. You can control this by setting a value.

enter image description here

\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}
  • 1
    And can I use this to make the line to fold more than once? – Naji Oct 31 '13 at 0:49
  • 2
    @Naji, sure you can. E.g., try \draw[rounded corners=10pt, ->] (description) |- ($(description)!.5!(text)$) |- (text); (and to not forget \usetikzlibrary{calc} in the preamble). – Piotr Wydrych Oct 31 '13 at 7:42
  • 1
    @Naji Sorry for my late answer, it was night time here when you asked me. I see someone else helped you though. :) – Alenanno Oct 31 '13 at 10:10
  • @Alenanno, also it was 2AM here but I am quite a night owl! :) Thanks anyways. – Naji Oct 31 '13 at 10:14
  • @Naji My pleasure! – Alenanno Oct 31 '13 at 11:55
8

You could use control points for this:

\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}

Take a look at the pgfmanual for more on control points. Basically: (s) .. controls (c1) and (c2) .. (e) draws a line starting at (s), ending at (e), with an initial tangent heading (c1) and a final tangent heading toward (c2).

Here how far (c1) was from (s) controlled how soon the path started to curve, and similarly for (c2) & (e).

enter image description here

  • What are control points for exactly? Plus, what I want is to be straight until the curved edge, and not to have the curve in the whole arrow. – Naji Oct 30 '13 at 15:57
  • 1
    @Naji I added a bit of an explanation. Control points are good for drawing curved paths with specified tangents / endpoints. You can control how soon the path curves by the position of the control points. That said, Alenanno's approach looks a lot easier. – Chris Chudzicki Oct 30 '13 at 16:03
6

The simplest solution with 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}

enter image description here

Animated version

\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}

enter image description here

  • @cmhughes: How do you know? Thanks. – kiss my armpit Oct 31 '13 at 2:46
  • Look at your profile, and check out how many votes you have by tikz- it's your highest tag :) – cmhughes Oct 31 '13 at 2:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.