11

Using TikZ, I would like to write a text along a circle, as in the example: positive direction.

enter image description here

  • 2
    \usetikzlibrary{decorations.text}. If you need something more specific, it would be most helpful if you would please post some code! – cfr Sep 20 '15 at 23:18
21

You can use the decorations.text library:

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text}

\begin{document}

\begin{tikzpicture}
\draw[-latex,blue,postaction={decorate},decoration={text along path,
text={Positive direction},text align=center}]
(4,0) arc [start angle=-60,end angle=80,radius=4];
\end{tikzpicture}

\end{document}

enter image description here

And if you want the text in the middle of the path (though it decreases readability):

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text}

\begin{document}

\begin{tikzpicture}
\path[decorate,decoration={text along path,
text={Positive direction},text align=center}]
(4,0) arc [start angle=-60,end angle=80,radius=4];
\draw[-latex,blue]
(4cm,0.8ex) arc [start angle=-60,end angle=80,radius=4cm-0.8ex];
\end{tikzpicture}

\end{document}

enter image description here

  • 1
    What if I want the curved text but not the arrow? – skan Nov 22 '17 at 15:23
15

If the text is going to be over the path the text effects along path decoration allows a background fill for each character:

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{decorations.text}
\begin{document}
\tikz\path[draw=blue, -stealth,
  postaction={decorate,decoration={text effects along path,
    text={\ Positive direction\ }, text align=center,
    text effects/.cd, 
      text along path, 
      every character/.style={fill=white, yshift=-0.5ex}}}]
  (4, 0) arc [start angle=-60, end angle=80, radius=4];
\end{document}

enter image description here

  • It is worth to say that the PDF produced in this way can easily converted to various formats by using pstoedit (pstoedit.net) and reused in any graphics software lacking this functionality. – Jhor Jul 28 '17 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.