1

I'd like to do a drawing for a recursive sequence :

\documentclass{article}

\usepackage{tikz}

\begin{document}
\begin{center}
  \begin{tikzpicture}[rectangle, rounded corners=2pt, minimum
    width=1cm, minimum height=0.6cm, >=latex]
    \node[draw] (u0) at (0,0) {$u_0$};
    \node[draw] (u1) at (3,0) {$u_1=f(u_0)$};
    \draw[->] (u0) to[bend right=50] (u1) node[midway, below]{$f$};
    \node[draw] (u2) at (6,0) {$u_2=f(u_1)$};
    \draw[->] (u1) to[bend right=40] (u2) node[midway, below]{$f$};
  \end{tikzpicture}
\end{center}
\end{document}

But I get all the "$f$" labels below the (u0) node.

Can someone explain what I am doing wrong ?

Thanks.

  • 3
    Move node... to immediately after to[...]. I'm fairly sure similar questions have been asked before, I'll see if I can find one with more explanations. – Torbjørn T. Sep 07 '19 at 12:24
  • Couldn't find any answers with more background, but a couple of similar questions: https://tex.stackexchange.com/questions/64252/ https://tex.stackexchange.com/questions/39793/ https://tex.stackexchange.com/a/428924/ – Torbjørn T. Sep 07 '19 at 12:35
  • Thanks. On the "Tikz for the impatient" book, the syntax above worked. It seems the syntax has changed since... – Nicolas FRANCOIS Sep 07 '19 at 15:46
  • Really? I couldn't find that syntax anywhere in http://math.et.info.free.fr/TikZ/bdd/TikZ-Impatient.pdf I think there were quite a few changes from v2 to v3 of TikZ though, so it's possible that this was one of them, and that you were looking in an older version of the book, directed at v2 of TikZ. – Torbjørn T. Sep 07 '19 at 16:09
  • @TorbjørnT. You are right. My version of "Tikz for the impatient" is very old (2009), it's time I download the last version ;-) But on page 91, you can see on the first example of "Étiquetage des arcs" an example I think doesn't work. Anyway, sorry for the noise and the duplicate. I tried to search for it, but failed, obviously :-( – Nicolas FRANCOIS Sep 08 '19 at 11:42
  • No worries, searching can be hard. – Torbjørn T. Sep 08 '19 at 11:45

0 Answers0