text around circle using tikz

    
\documentclass[preview]{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    \def \n {12}
    \def \radius {2}
    \def \startangle {-90}

    \foreach \s in {1,...,\n}{
        \pgfmathsetmacro{\angle}{\startangle + 360/\n*\s}
        \pgfmathsetmacro{\label}{int(mod(5 * (\s), \n))}
        \draw (\angle:-\radius) node {\huge $\label$};
    };

\end{tikzpicture}
\end{document}
    

Alternatively if you want to have custom text you can define an array like this:

    
\documentclass[preview]{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    
    \def \intervals {{0, 5, 10, 3, 8, 1, 6, 11, 4, 9, 2, 7}}
    
    \def \n {12}
    \def \radius {2}
    \def \startangle {-90}

    \foreach \s in {1,...,\n}{
        \pgfmathsetmacro{\angle}{\startangle + 360/\n*\s}
        \pgfmathsetmacro{\label}{\intervals[\s - 1]}
        \draw (\angle:-\radius) node {\huge $\label$};
    };

\end{tikzpicture}
\end{document}
    

Since I wanted this as an SVG all I did was replaced the first two lines with: \documentclass[tikz,convert={outfile=\jobname.svg}]{standalone} and then compiled it with pdflatex -shell-escape circle.tex I verified that it looked the way I wanted with display circle.svg which is available as long as you have imagemagick.

It probably wouldn't be that hard to extend this so that the text is rotated as well.


comments section