# node above tikz path does not works with “--” but not “to” [duplicate]

I am struggling with the positioning of a node above a tikz path. The path is curved and connects two nodes with "to". Here is a MVE:

\documentclass[a4paper,twoside,11pt]{book}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=1,transform shape]
\draw[->,thick,out=0,in=180] (1,0) to (5,1) node[above,pos=0.5,sloped] {text};
\draw[->,thick] (1,3) -- (5,4) node[above,pos=0.5,sloped] {text};
\end{tikzpicture}
\end{document}


The node is above the line in the case with "--" but not with the "to". What I am missing here? I am pretty sure I had something similar working in the past...

## marked as duplicate by Torbjørn T. tikz-pgf StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); May 23 '18 at 16:56

• You need to place node .. immediately after to. – Torbjørn T. May 22 '18 at 20:28