# Tikz: text containing formulas and symbols following a given curve

I have already been searching for this some time, but unfortunately I cannot find an answer. I am trying to write some text that is following a given curve. As long as I do not use math mode that works out fine. However, I need some formulas resp. symbols in that text too, so, is there a way to obtain that? It should be something like this:

\begin{tikzpicture}
\path [decorate,decoration={text along path,
text={$t\rightarrow t_0$}}]
(0,0) sin (1,1) cos (2,0) sin (3,-1) cos (4,0) sin (7,-1);
\end{tikzpicture}


There is of course some more text coming, but just to give an idea...

• text along path works by placing every character piece-by-piece. In your case, it tries to place the $, t, \rightarrow, t, _, 0 and $ on their own. This won’t work. You need to split it up manually like I did in How do I make my path node follow the path from a certain position? Try something like text={$t$} {$\rightarrow$} {$t_0$}. – Qrrbrbirlbel Oct 2 '13 at 20:16

The text along path decorations works by placing the text character for character. In your case, it tries to place the characters $, t, \rightarrow, t, _, 0 and $ on their own. This will lead to many errors ($ without a closing $, math-mode stuff in text-mode).

You will need to split the “text” up in its contents (the spacing provided by math-mode will be lost but this decoration isn’t made for that anyway).

## Code

\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{decorations.text}
\tikzset{
text deco/.style={
postaction={decorate, decoration={text along path, #1}}}}
\begin{document}
\begin{tikzpicture}
\draw[
text deco={raise=5pt, text align={align=left, left indent=11em},
text={$t$} {$\rightarrow$} {$t_0$}},
text deco={raise=5pt, text align={align=left, left indent=15.5em},
text={$t$} {$\rightarrow$} {$t_0$}},
text deco={raise=-5pt,
text=|\color{gray}|........................%
|+\bfseries|........................%
|\color{blue!50}|.............................................}
]
(0,0) sin (1,1) cos (2,0) sin (3,-1) cos (4,0) sin (7,-1);
\end{tikzpicture}
\end{document}


## Output

• I think we need curved \to here. (I have no backticks on my iPad) – kiss my armpit Oct 14 '13 at 5:55