[Tex/LaTex] Text decoration below path

decorationstikz-pgf

This should be a very simple question.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}
   \draw[-stealth,postaction={decorate,decoration={text along path,text align=center,text={this way}}}](0,0)to[bend right=45] (2,0){};
\end{tikzpicture}

\end{document}

output

I want the text to be below the line, not above. Is it possible?

Best Answer

The placement of a decoration relative to the path can be controlled with the raise key. A positive value shifts the decoration to the left of the path direction, and a negative value shifts it to the right. Thus, for your example, a negative value is needed. In the example below I've added the key raise=-8pt to the decoration.

More information can be found in the TikZ/PGF manual on CTAN. Chapter 24 (pp. 351--357) covers decorations and the raise key is described on p. 356.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}
   \draw[-stealth,postaction={decorate,decoration={text along path,text align=center,text={this way},raise=-8pt}}](0,0)to[bend right=45] (2,0){};
\end{tikzpicture}

\end{document}

enter image description here