2

I'm trying to have a text following an arc path. Instictively, I wrote

\draw (90:2) arc node{Some text} (90:210:2);

but this returned an error:

! Missing number, treated as zero.

I suppose I get this error because TikZ is expecting the second arc coordinates, but I can't figure out how to get it right.

Thanks for your help! :)

1
  • Welcome to TeX.SE. t would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that reproduces the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem. Oct 6, 2014 at 6:21

1 Answer 1

4

Use the decorations.text library, as documented in the manual, section 48.6, page 602.

The example given in the documentation is is a follows:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text}

\begin{document}
\begin{tikzpicture}[decoration={text along path,
    text={Some long text along a ridiculously long curve that}}]
  \draw [help lines] grid (3,2);
  \draw [decorate] (0,0) -- (3,1) arc (0:180:1.5 and 1) ;
\end{tikzpicture}
\end{document}

This produces the following output.

Output of example code.

In this case your code should be

\draw [decorate,decoration={text along path,text={Some text}}] (90:2) arc (90:120:2);
2
  • Thanks! So, this line only draws the text. I need another line to draw the actual arc, right? Oct 6, 2014 at 7:59
  • On page 603 of the manual is a demonstration of how to use the postaction option to draw the path and the text at the same time, but the path follows the baselines of the text. Drawing the arc and the text separately would probably be easier.
    – ChrisS
    Oct 6, 2014 at 8:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .