I have two arrows going from a node on the left to a node on the right. Both arrows are slightly bent. I want to label the arrows with text that is bent just like the arrows. This is as far as I've got:
\begin{tikzpicture}
\node (One) at (-3,0) [shape=circle,draw] {One};
\node (Two) at (3,0) [shape=circle,draw] {Two};
\draw [->, thick] (One) to [bend right=45] (Two);
\draw [->, thick] (One) to [bend left=45] (Two);
\node (mental) at (0,1.75) {Some bent text};
\node (non-mental) at (0,-1.75) {Some more bent text};
\end{tikzpicture}
Best Answer
This can be done by the
decorations.text
library gives you atext along path
decoration. See the PGF/TikZ manual (v2.10) on page 337, section 30.6 Text decorations for more details. You can't draw and decorate the path at the same time directly, but can usepostaction={..}
to decorate the path after you have drawn it (Thanks goes to Alan Munn for this tip).To format the text place the style macros between
|
in thetext
argument. Non-English characters need to be included in braces, e.g.text={|\itshape|Some Text {รถ} more text}
. One issue is to raise the font (it is just placed really on the path!). I looked into the source code and found out that the font macros are placed before each single processed character but with an\relax
between it, i.e.<your style>\relax<character>
. You could define a macro which takes two arguments, the first is the\relax
and the second the character, then use\raisebox{<length>}{<content>}
to raise or lower the character.