[Tex/LaTex] TikZ – writing text above and below bent line

tikz-pgf

I want to add some text/numbers above and below the middle of a line. Somehow, I have troubles finding out how this is possible.

This source did not help, because I cannot transfer the solutions from there to my case.

\documentclass[]{article}

\usepackage{tikz}
\usetikzlibrary{positioning, shapes,arrows}

\begin{document}

\begin{tikzpicture}[auto,>=latex,align=center,
latent/.style={circle,draw, thick,inner sep=0pt,minimum size=10mm},
manifest/.style={rectangle,draw, thick,inner sep=2pt,minimum size=10mm},
mean/.style={regular polygon,regular polygon sides=3,draw,thick,inner sep=0pt,minimum
    size=10mm},
paths/.style={->, very thick, >=stealth'},
variance/.style={<->, thick, >=stealth', bend left=270, looseness=2},
arrow/.style={-latex, shorten >=1ex, shorten <=1ex, bend angle=45}
]

\node [latent] (LV1) at (0,0) {LV1};
\node [latent] (LV2) [right =10 cm of LV1]  {LV1};
\draw [<->, bend angle=45, bend left]  (LV1) to (LV2);

\end{tikzpicture}

\end{document}

Best Answer

You can use the very same approach of your linked post here as well. The only difference is the use of the to syntax instead of the -- form. In your example, this would look like this:

% arara: pdflatex

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}[%
    ,>=latex
    ,latent/.style={%
        ,circle
        ,draw
        ,thick
        ,minimum size=10mm
        }
    ]   
    \node [latent] (LV1) at (0,0) {LV1};
    \node [latent] (LV2) [right =10 cm of LV1]  {LV1};
    \draw [<->, bend angle=45, bend left]  (LV1) to node[below] {a} node[above] {b} (LV2);
\end{tikzpicture}   
\end{document}

enter image description here

If you want to place the label somewhere else along that path, you can add the option pos=.9 or near end (or other values) to your node[...]. If you want the label to follow the curvature of your arc, you may want to set the option sloped as well.