1

Here is the code that I want to use in Tex Maker.

\documentclass[12pt]{report}

\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{pgf}
\usetikzlibrary{decorations}



\begin{document}

\begin{tikzpicture}[
    black,
    ultra thick,
    planet/.style = {draw,fill,circle,inner,inner },
    circle label/.style = {
        postaction={
            decoration={
                text along path,
                text = {#1},
                text align=center,
                text color=black,
                reverse path,
            },
        decorate,
    }
    }
]
\filldraw[white] (-7,-7) rectangle (9,7);
 {\path[circle label={Abelian}] (0,-2.1) arc (-90:360-90:1.2);
\draw[circle] (0,0) circle (1);}
{\path[circle label={Nilpotent}] (0,-1.2) arc (-90:360-90:1.2);
\draw[circle] (0,0) circle (2);}
{\path[circle label={O-group}] (0,-0.1) arc (-90:360-90:1.2);
\draw[circle] (0,0) circle (3);}
{\path[circle label={RO-group}] (0,+0.9) arc (-90:360-90:1.2);
\draw[circle] (0,0) circle (4);}
{\path[circle label={u.p.-group}] (0,+1.85) arc (-90:360-90:1.2);
\draw[circle] (0,0) circle (5);}

\end{tikzpicture}
\end{document}

But it shows me errors that

pgfkeys do not know the key decorations.

What else will I need to do?

2 Answers2

3

I don't remember when, but decorations library was divided in several libraries, text along path belongs to decorations.text library

\documentclass[12pt]{report}
\usepackage{tikz}
\usetikzlibrary{decorations.text}

\begin{document}

\begin{tikzpicture}[
    black,
    ultra thick,
    planet/.style = {draw,fill,circle,inner,inner },
    circle label/.style = {
        postaction={
            decoration={
                text along path,
                text = {#1},
                text align=center,
                text color=black,
                reverse path,
            },
        decorate,
    }
    }
]
\filldraw[white] (-7,-7) rectangle (9,7);
 {\path[circle label={Abelian}] (0,-2.1) arc (-90:360-90:1.2);
\draw[circle] (0,0) circle (1);}
{\path[circle label={Nilpotent}] (0,-1.2) arc (-90:360-90:1.2);
\draw[circle] (0,0) circle (2);}
{\path[circle label={O-group}] (0,-0.1) arc (-90:360-90:1.2);
\draw[circle] (0,0) circle (3);}
{\path[circle label={RO-group}] (0,+0.9) arc (-90:360-90:1.2);
\draw[circle] (0,0) circle (4);}
{\path[circle label={u.p.-group}] (0,+1.85) arc (-90:360-90:1.2);
\draw[circle] (0,0) circle (5);}

\end{tikzpicture}
\end{document}

enter image description here

EDIT: If you want that labels follow inner circles, I propose to change the code to

\documentclass[12pt]{report}
\usepackage{tikz}
\usetikzlibrary{decorations.text}

\begin{document}

\begin{tikzpicture}[
    black,
    ultra thick,
    planet/.style = {draw,fill,circle,inner,inner },
    circle label/.style = {
        postaction={
            decoration={
                text along path,
                text = {#1},
                text align=center,
                text color=black,
                reverse path,
            },
        decorate,
    }
    }
]

\path[circle label={Abelian}] (0:1.1) arc (0:180:1.1);
\draw[circle] (0,0) circle (1);

\path[circle label={Nilpotent}] (0:2.1) arc (0:180:2.1);
\draw[circle] (0,0) circle (2);

\path[circle label={O-group}] (0:3.1) arc (0:180:3.1);
\draw[circle] (0,0) circle (3);

\path[circle label={RO-group}] (0:4.1) arc (0:180:4.1);
\draw[circle] (0,0) circle (4);

\path[circle label={u.p.-group}] (0:5.1) arc (0:180:5.1);
\draw[circle] (0,0) circle (5);

\end{tikzpicture}
\end{document}

enter image description here

Ignasi
  • 136,588
  • Any idea why the text labels are not really following the curvature of the circles? – daleif Jul 20 '15 at 12:43
  • @daleif Yes, I just copied original code and replaced decorations by decorations.text. OP's code defined all labels over arcs with similar radius and not adjusted to corresponding circle. Now I've changed it. – Ignasi Jul 20 '15 at 13:03
2

Just as addition to Ignasi I made a version which sets the labels on real arc-parts of the intermediate circles. Credits go to cmhughes and Tom Bombadil!

% arara: pdflatex

\documentclass[12pt]{report}
\usepackage{tikz}
\usetikzlibrary{decorations.text,calc}
\def\centerarc[#1](#2)(#3:#4:#5){ \path[#1] ($(#2)+({#5*cos(#3)},{#5*sin(#3)})$) arc (#3:#4:#5); }

\begin{document}    
    \begin{tikzpicture}[%
        ,ultra thick
        ,circle label/.style = {%
            postaction={%
                ,decoration={%
                    ,text along path,
                    ,text = {#1},
                    ,text align=center,
                    ,reverse path,
                    }
                ,decorate
                }
            }
        ]
    \filldraw[white] (-7,-7) rectangle (9,7);
    {\centerarc[circle label={Abelian}](0,0)(0:180:.5)
        \draw[circle] (0,0) circle (1);}
    {\centerarc[circle label={Nilpotent}](0,0)(0:180:1.5)
        \draw[circle] (0,0) circle (2);}
    {\centerarc[circle label={O-group}](0,0)(0:180:2.5)
        \draw[circle] (0,0) circle (3);}
    {\centerarc[circle label={RO-group}](0,0)(0:180:3.5)
        \draw[circle] (0,0) circle (4);}
    {\centerarc[circle label={u.p.-group}](0,0)(0:180:4.5)
        \draw[circle] (0,0) circle (5);}    
    \end{tikzpicture}
\end{document}

enter image description here

LaRiFaRi
  • 43,807