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?

  • Have you tried to use \usetikzlibrary{decorations.text}? – moospit Jul 20 '15 at 12:42
  • Most of packages loaded in your preamble are superfluous for this MWE. You only need to include TiKZ. epsfig is obsolete, even more if you load graphicx. – Ignasi Jul 20 '15 at 12:45
  • @they it was a part of my report. I anyways included them. – Bhaskar Vashishth Jul 20 '15 at 12:51
  • Then it might be an idea to revise the report/template ;-) – daleif Jul 20 '15 at 13:02
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

  • 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

  • Thanks so much. It looks a lot better. I tried but could not get it right – Bhaskar Vashishth Jul 20 '15 at 13:05
  • 1
    You were a little bit faster than me. My update also solves this problem, but your solution is automatic. – Ignasi Jul 20 '15 at 13:06
  • @Ignasi "Talent imitates, genius steals" :-) Luckily, you got the accepted answer. I had no idea about that decorations.text before... – LaRiFaRi Jul 20 '15 at 13:07

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.