2

I'm trying to draw some text along an arc, but I can't see how I can change the font size of the text I'm drawing.

\foreach \j/\k/\p in {1/30/December,31/61/November}{
    \draw [decoration={text along path, text={\p}, text align={center}, reverse path},decorate]
    (360/365*\j+90:5.2) arc (360/365*\j+90:360/365*\k+90:5.2);
}

I've tried text={\tiny{\p}} and text={{\tiny \p}} and in {1/30/{\tiny December},...}, but they didn't work.

I've tried putting scale=0.5 in the draw command, but that just changes the radius of the arc not the size of the text.

The examples in the manual use characters={scale=0.4} in the decoration options but I get a compilation error when I try that (I do not know the key to which you passed scale=0.5).

3

1 Answer 1

3

See section 50.7 “Text Decorations” of the TikZ/PGF manual, where it is explained that the default text format delimiters are pipes (|). There are also some examples in this section that nicely show how to style text along path.

In your case, you can use text={|\tiny|\p}, like in the following example:

\documentclass[tikz, border=1mm]{standalone}
\usetikzlibrary{decorations.text}

\begin{document}
\begin{tikzpicture}

\foreach \j/\k/\p in {1/30/December,31/61/November}{
    \draw [decoration={text along path, text={|\tiny|\p}, text align={center}, reverse path}, decorate]
    (360/365*\j+90:5.2) arc (360/365*\j+90:360/365*\k+90:5.2);
}

\end{tikzpicture}
\end{document}

enter image description here

2
  • Thanks, sorry I didn't see that bit in the manual. I still don't really understand why characters={} doesn't work.
    – thosphor
    Dec 1, 2021 at 14:21
  • It seems like characters can only be used with text effects and text effects along path. But I am not sure and didn't try this. Dec 1, 2021 at 15:06

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.