# Tikz library : command \draw ... to... with out and in specification

I would like to ask how the following command works:

\draw [] (0,0) to [out=20,in=120] (50,20) to [out=-60, in=110] (90,20);


I wonder what part .. to [out=20,in=120] .. makes. The result is a curve, but I don't know how to properly understand these parameters.

• This is explained in the manual, section titled "The To Path Operation" (14.14 in my version). It would help if you explained what you don't understand from that explanation. Nov 29, 2012 at 14:59
• Look at the pgfmanual version October 25, 2010 section 51.3 Curves (reached almost immediately searching "out="). Nov 29, 2012 at 15:00

From the pgfmanual :

If you write (a) to [out=135,in=45] (b) a curve is added to the path, which leaves at an angle of 135° at a and arrives at an angle of 45° at b. This is because the options in and out trigger a special path to be used instead of the straight line.

This actually allows you to bend paths between two points. The angles are specified with respect to the horizontal line, or, if the option relative is passed, with respect to the straight line between the two points.

Consider the simple example below : The red curve is the result of (a) to [out=20, in=120] (b) as in your example. The angles specified by the out and in parameters are described on the picture. An easy way to remember the parameters is that you specify the angle by which your curve is going out of the source node, and entering in the target node.

To understand the difference induced by the option relative, have a look at the following two examples : first without the option relative, so absolute angles : And now with relative angles : ## Code

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\node[circle,draw] (a) at (0,0) {a};
\node[circle,draw] (b) at (10,0) {b};
\draw[dashed] (a) -- (b);
\draw[dashed] (a) -- +(20:10cm);
\draw[dashed] (b) -- +(120:4cm);
\draw[dashed] (b) -- +(0:3cm);

\draw (a) +(4,0)  arc (0:20:4);
\draw (a) + (10:4.3) node {$20^{\circ}$};
\draw (b) + (2,0) arc (0:120:2);
\draw (b) + (60:2.3) node {$120^{\circ}$};

\draw[red] (a) to[out=20,in=120] (b);
\end{tikzpicture}

\clearpage

\begin{tikzpicture}
\node[circle,draw] (a) at (0,0) {a};
\node[circle,draw] (b) at (0,5) {b};
\draw[dashed] (a) -- +(0:5cm);
\draw[dashed] (a) -- +(20:10cm);
\draw[dashed] (b) -- +(120:4cm);
\draw[dashed] (b) -- +(0:3cm);

\draw (a) +(4,0)  arc (0:20:4);
\draw (a) + (10:4.3) node {$20^{\circ}$};
\draw (b) + (2,0) arc (0:120:2);
\draw (b) + (60:2.3) node {$120^{\circ}$};

\draw[red] (a) to[out=20,in=120] (b);
\end{tikzpicture}

\clearpage

\begin{tikzpicture}[relative]
\node[circle,draw] (a) at (0,0) {a};
\node[circle,draw] (b) at (0,5) {b};
\draw[dashed] (a) -- (b);
\draw[dashed] (a) -- +(110:10cm);
\draw[dashed] (b) -- +(210:4cm);
\draw[dashed] (b) -- +(90:3cm);

\draw (a) +(0,2)  arc (90:110:2);
\draw (a) + (100:2.3) node {$20^{\circ}$};
\draw (b) + (0,2) arc (90:210:2);
\draw (b) + (120:2.3) node {$120^{\circ}$};

\draw[red] (a) to[out=20,in=120] (b);
\end{tikzpicture}

\end{document}


## Acknowledgements

Thanks to Paul Gaborit for his remark regarding the option relative.

• Without the option relative, the angles are absolute... Nov 29, 2012 at 22:57
• @PaulGaborit : Thanks, I completely forgot about that detail, and my example didn't help. I editted. Nov 29, 2012 at 23:18
• Thank you. I suspected that somewhere in the manual will be, but I was frustrated that I can not find it. Once again, thank you all for your help. Nov 30, 2012 at 7:14