3

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}
  • 2
    Do you want \draw [<->, bend angle=45, bend left] (LV1) to node[below] {a} node[above] {b} (LV2);? – LaRiFaRi Sep 15 '15 at 13:59
  • 1
    Completely unrelated note: \title, \author and \maketitle are not mandatory (or rather, the first two are only mandatory if the third is used), so for examples such as these you may as well remove them altogether. Same for the empty \section. – Torbjørn T. Sep 15 '15 at 14:03
  • 1
    @LaRiFaRi Want to write up an answer? You could mention pos and sloped as well. – Torbjørn T. Sep 15 '15 at 14:12
3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.