# How to use controls and the +, ++ notation with Tikz?

I want to draw a curved path using Bezier control points, with the notation

 <a> .. controls <b> and <c> ... <d>;


I also want to specify coordinates b and c relatively from each other (b relatively from a, and c relatively from b). For that, I'd like to use the "+" and/or "++" notation. I thought I understood it (reading the manual and another similar (old) post here), but I obviously miss something.

Here is what I do:

\draw[->, thin] (alpha.east) .. controls ++(2.5cm,0) and ++(0,1cm) .. (beta.west);
\draw [red] (alpha.east) -- ++(2.5cm,0) -- ++(0,1cm) -- (beta.west);


The second line of code is just to help me understand what I'm doing. This is what it gives: So, it starts from alpha.east and obviously heads towards the point located at 2.5cm on its right, that's ok. But then, from Tikz manual: "Then the curve will, indeed, end at beta.west and the tangent of the curve at point beta.west will go through the second control point."

Here my arrow near beta points downwards, which obviously shows that the tangent of the curve at beta.west does not point to my second control point!

What did I understand wrong?

Thanks a lot!

EDIT:

Thank you daleif for your answer. So, in order to give a working example, I adapted the code given by daleif in the answer below. Here it is:

\documentclass[tikz]{standalone}

\usetikzlibrary{decorations.pathreplacing}
\tikzset{%
show curve controls/.style={
postaction={
decoration={
show path construction,
curveto code={
\draw [blue]
(\tikzinputsegmentfirst) -- (\tikzinputsegmentsupporta)
(\tikzinputsegmentlast) -- (\tikzinputsegmentsupportb);
\fill [red, opacity=0.5]
}
},
decorate
}}}

\begin{document}

\begin{tikzpicture}
\node (alpha) at (0,-2) {\includegraphics[width=.17\textwidth]{alpha.png}};
\node (beta) at (7,0) {\includegraphics[width=.25\textwidth]{beta.png}};
\draw [show curve controls]
(alpha.east)
.. controls ++(2.5cm,0) and ++ (0,1cm) ..
(beta.west);
\end{tikzpicture}

\end{document}


And here is what it gives: So, I see my second control point isn't located as I would like, but I still don't understand why. Why isn't it located 1cm above the 1st control point?

Thanks a lot again!

• Because they are not relative to each other, they are each relative to the start and end of the bezier curve. I'm not sure that there is an interface that would make the second control point relative to the first. As tikz can do many things there probably are, I have just never needed it. – daleif Aug 27 at 10:37

Ok, found it.

I wasn't looking at the right place in the manual. Here is the explanation (section 13.4.1 of the manual):

"There is a special situation, where relative coordinates are interpreted differently. If you use a relative coordinate as a control point of a Bézier curve, the following rule applies: First, a relative first control point is taken relative to the beginning of the curve. Second, a relative second control point is taken relative to the end of the curve. Third, a relative end point of a curve is taken relative to the start of the curve."

• You should probably mention controls in the title for your question (might help others in the future) – daleif Aug 27 at 10:43

Too long for a comment

BTW: please always provide self contained full minimal examples, not sniplets like this. Self contained examples are easier to test with.

Here is an example showing there the relative control points are. I'm using polar coords here.

\documentclass[tikz]{standalone}

\usetikzlibrary{decorations.pathreplacing}
\tikzset{%
show curve controls/.style={
postaction={
decoration={
show path construction,
curveto code={
\draw [blue]
(\tikzinputsegmentfirst) -- (\tikzinputsegmentsupporta)
(\tikzinputsegmentlast) -- (\tikzinputsegmentsupportb);
\fill [red, opacity=0.5]
}
},
decorate
}}}

\begin{document}

\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (5,5);
\draw [show curve controls]
(A)
.. controls ++(0:5) and ++ (0:5) ..
(B)
;
\end{tikzpicture}

\end{document}

• This is the code found in the Tikz manual in the "Path Replacing Decorations" section (p 637 of manual 3.1.4b) – AndréC Aug 27 at 8:48
• @AndréC thanks, I got it from an answers on the site, I sadly lost the reference. I find it super useful, so ought to be defined by default. – daleif Aug 27 at 9:04
• Yes, this code is very useful, as are the 1302 pages of the TikZ 3.1.4b manual which, it is true, make learning TikZ a cross-country race. :-) – AndréC Aug 27 at 9:36
• Thank you! I edited my question, could you please check and explain further? Thanks a lot. – Arnaud Aug 27 at 10:09
• Obviously the "++" in front of the second control point is relative to the end point. But why, I don't know.. – Arnaud Aug 27 at 10:16