8

I am trying to label two curved paths connecting two nodes with labels placed at their centres using the node[midway] option. This is something that should be very simple but I have not been able to come up with something that works. Here is my MWE with my question as two comments:

\documentclass[crop,border=0]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[>=latex]
    \node [draw,rectangle] (Start) {Start};
    \node [draw,rectangle] (Finish) [right=2cm] {Finish};
    \draw [->,out=90,in=90,looseness=0.75] (Start.north) to (Finish.north);
    % I want to label this path using [midway,below] as {forward}
    \draw [->,out=-90,in=-90,looseness=0.75] (Finish.south) to (Start.south);
    % I want to label this path using [midway,above] as {reverse}
\end{tikzpicture}
\end{document}

Can someone please point me in the right direction.

I also appreciate comments to improve code elegance or simplicity.

Thank you.

15

You must put the node direct after to

\documentclass[crop,border=0]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture} [>=latex]
    \node [draw,rectangle] (Start) {Start};
    \node [draw,rectangle] (Finish) [right=2cm] {Finish};
    \draw [->,out=90,in=90,looseness=0.75] (Start.north) to node[above]{above}  (Finish.north);
    \draw [->,out=-90,in=-90,looseness=0.75] (Finish.south) to node[below]{below} (Start.south)
      ;
\end{tikzpicture}
\end{document

enter image description here

  • Thank you. I did not know that [midway] was not needed and that the syntax was simpler. – chandra Jan 1 '12 at 17:58
  • I am also a beginner^+ in tikz ;-) But I used this combination some days before – Marco Daniel Jan 1 '12 at 18:04
  • @chandra: I believe that midway (or pos=0.5) is the default so does not need to be specified. See moving a label along the path for more options for label placement. – Peter Grill Jan 1 '12 at 18:11
  • @Peter Grill: Thank you for the explanation and link to a very helpful example. – chandra Jan 1 '12 at 19:10

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.