# Curved text (on multiple lines) within curved arrow using tikz

I have a curved arrow and want to put text inside of it (having the same curve as the arrow, of course). If the text is longer than the arrow, the text should be put on multiple lines (optimally with the arrow automatically getting thicker appropriately). See figure below.

(How) can I do this?

Update:

I now use

  \coordinate (specRoot) at (-10,0);
\coordinate (testTreeRoot) at (0,0);
\draw[->, >=latex, blue!20!white, line width=15pt, bend left]
(specRoot) to (testTreeRoot);
\path [decorate,decoration={text along path, text={traverse part of
the STS and heuristically choose the best test tree}}]
[out=30] (specRoot) to [in=130] (testTreeRoot);


But how can I combine the decorated text along the path and the actual arrow?

How can I do a carriage return, i.e. decorate two lines of text along a single path?

Update:

And now I use the following, in the file lazyOTFoverviewSmall.tex:

\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2.2cm, semithick, mypostaction/.style 2 args={
decoration={
text align={
left indent=#1},
text along path,
text={#2}
},
decorate
}
]

\begin{scope}[shift={(-10cm,0cm)}]
\node[state] (specq0) {$q_0$};
\end{scope}
\begin{scope}
\node[state] (q0) {$q_0$};
\end{scope}

\coordinate (specRoot) at (-10,0);
\coordinate (testTreeRoot) at (0,0);

\draw[-latex, blue!20!white, line width=5ex, bend left]
(specRoot) ++(1cm,1cm)
to (testTreeRoot) ++(-1cm,1cm);
\path [postaction={mypostaction={1cm}{traverse part of the STS}},
postaction={mypostaction={1cm}{and heuristically choose the best test
tree}, /pgf/decoration/raise=-3mm}]
[out=30] (specRoot) ++(1cm,1cm) to [in=130] (testTreeRoot) ++(-1cm,1cm);
\end{tikzpicture}


and in master.tex I have:

\usepackage{tikz}
\usetikzlibrary{decorations.text}
\usetikzlibrary{backgrounds,shapes} %pictures
\usetikzlibrary{arrows,automata}

....

\begin{document}

...

\begin{figure}[hbt]
\centering
\scalebox{.7}{\input{gfx/MBT/lazyOTFoverviewSmall.tex}}
\caption{Overview of Lazy On-the-fly MBT}\label{fig:lazyOTFoverview}
\end{figure}

....

-
I have tried tex.stackexchange.com/questions/58510/…, but the text will not be curved in those cases :( – DaveBall aka user750378 Oct 5 '12 at 14:34
You can use Torbjørn's answer with a text decoration instead of a node. – percusse Oct 5 '12 at 14:37
There's some offset parameter for the text along path decoration. You could probably shift the first half of the text up, and the second half down via a postaction – Tom Bombadil Oct 6 '12 at 21:55

TikZ is trying hard but text decorations are not really perfect as the text is decomposed into individual letters and spaces then boxed and rotated. So in general it needs further tweaks to make it look good. The main obstacle is the large arrowhead that changes the bending of the path to fit the arrowhead so the path needs to be adjusted manually. Here is a quick demo but I would recommend different paths for each line to be placed.

\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}[mypostaction/.style 2 args={
decoration={
text align={
left indent=#1},
text along path,
text={#2}
},
decorate
}
]
\coordinate (specRoot) at (-10,0);
\coordinate (testTreeRoot) at (0,0);
\draw[-latex, blue!20!white, line width=5ex]  (specRoot) to[in=135,out=45] (testTreeRoot);

\path [postaction={mypostaction={1cm}{traverse part of the STS}},
postaction={mypostaction={1cm}{and heuristically choose the best test tree},
/pgf/decoration/raise=-3mm}]
(specRoot) to [in=120,out=45] (testTreeRoot);
\end{tikzpicture}
\end{document}


-
Looks great. Unfortunately, I get the pdflatex error ERROR: Package pgfkeys Error: I do not know the key '/pgf/decoration/text align' and I am going to ignore it. Perhaps you misspelled it. I did use \usetikzlibrary{decorations.text} and he seems to find that library, since that line doesn't give errors. – DaveBall aka user750378 Nov 20 '12 at 16:50
@DaveBallakauser750378 Can you include your own MWE by editing your question? This is working without any problems on my computer. I'm using TikZ version 2.10. – percusse Nov 20 '12 at 17:13
MWE = Minimal Working Environment? I have included an SFE (small failing environment), hope my bug jumps right into your eye ;) – DaveBall aka user750378 Nov 20 '12 at 17:27
@DaveBallakauser750378 Your code also works (though the result is a little skewed). You can put \listfiles command somewhere in your preamble and check the log file for the TikZ. – percusse Nov 20 '12 at 17:34
@DaveBallakauser750378 Your TikZ is outdated. You need to upgrade to v2.10. – percusse Nov 20 '12 at 18:47