Explanation
It seems that nodes can be carefully placed on paths using pos=.25
(i.e. 25% from node BEGIN to node END) when using --
syntax (see Example A).
Problem
I cannot have the same precision as above with paths constructed using the to
syntax (see Example B.). Instead, I have resulted to using
postaction={decorate,decoration={text along path,text={|\ttfamily|TCP}}}
Example A. Note that I can do:
\draw [<->] (data.south east) -- (app.north west) node [pos=.5, above, sloped] (TextNode) {TCP};
Example B. Note that I cannot do:
\draw [icoarrow,<->] (data.south east) to[out=90,in=270] (app.north west) node [pos=.5, above, sloped] (TextNode) {TCP};
Example
\documentclass{article}
\usepackage{fontspec}
\usepackage{tikz}
\usetikzlibrary{positioning,decorations.text}
\begin{document}
\begin{tikzpicture}[node distance=2cm]
\node (data) {Data};
\node [right=of data] (app) {App};
% Lines
\draw [<->] (data) -- (app) node [pos=.5, above, sloped] (TextNode) {TCP}; % works fine
\draw [<->] (data) to[out=90,in=90] (app) node [pos=.5, above, sloped] (TextNode) {TCP}; % does not work
\draw [<->,postaction={decorate,decoration={text along path,text align=center,text={TCP}}}] (data) to[out=90,in=90] (app); % works fine
%\draw [<->,postaction={decorate,decoration={text along path,pos=.25,text={TCP}}}] (data) to[out=90,in=90] (app); % does not work (causes error)
\end{tikzpicture}
\end{document}
Best Answer
For A:
Put the
node
right afterto[out=90,in=90]
likeFor B, do this:
Full code: