Change size of text in tikz decoration

decorationstikz-decorationstikz-pgf

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).

Best Answer

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

Related Question