# 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...

• You need to place node .. immediately after to. May 22 '18 at 20:28
• May 22 '18 at 20:34