3

I'm trying to draw something like this using TikZ:

enter image description here

It could be one ring which is broken or it could be different parts of different rings. The text should be also bent (not as shown on the paint picture:)

I want to do it with some TikZ built in functions, objects.

Is there a way to do it?

13

Something to start with

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

\begin{document}

\begin{tikzpicture} 
\draw (120:2cm) arc [start angle = 120, end angle=60, radius=2cm] --++(60:1cm) arc [start angle=60, end angle=120, radius=3cm] --++(120:-1cm)--cycle;
\draw[decorate,decoration={text along path, text=this is a text, text align={align=center}}] (120:2.5cm) arc(120:60:2.5cm);

\draw (269:2cm) arc [start angle = 269, end angle=133, radius=2cm] --++(133:1cm) arc [start angle=133, end angle=269, radius=3cm] --++(269:-1cm)--cycle;
\draw[decorate,decoration={text along path, text=this is a text, text align={align=center}}] (269:2.5cm) arc(269:133:2.5cm);

\draw (55:2cm) arc [start angle = 55, end angle=-80, radius=2cm] --++(-80:1cm) arc [start angle=-80, end angle=55, radius=3cm] --++(55:-1cm)--cycle;
\draw[decorate,decoration={text along path, text=this is a text, text align={align=center}}] (55:2.5cm) arc(55:-80:2.5cm);
\end{tikzpicture}
\end{document}

enter image description here

Update Command \drawsector

I'm not sure to understand your comment but you can always define a command to simplify typping.

Command \drawsector has 5 parameters plus 1 optional.

\drawsector[draw options]{text radius}{width}{start angle}{delta angle}{text}

text radius is supose to be text baseline radius and because sector border is shifted around text center, I've (negative) raised the text. May be some other decoration can place text verticaly aligned to its center, but I don't know how to do it.

delta angle means angular widthness (does exist this word?)

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

%\drawsector[]{text radius}{width}{start angle}{delta angle}{text}
\newcommand{\drawsector}[6][]{
    \draw[#1] (#4:{#2-.5*#3}) arc [start angle = #4, delta angle=-#5, radius={#2-.5*#3}]--++({#4-#5}:#3) arc [start angle = {#4- #5}, delta angle=#5, radius={#2+.5*#3}] --cycle;
\draw[decorate,decoration={raise=-3pt, text along path, text=#6, text align={align=center}}] (#4:#2) arc(#4:(#4-#5):#2);
}
\begin{document}
\begin{tikzpicture}   
\drawsector{2}{1}{130}{100}{this is my text}

\drawsector[draw=green, thick, fill=green!20]{3.2}{.8}{60}{120}{this is another text}

\drawsector[draw=none, fill=blue!30]{2.5}{2}{180}{40}{text}
\end{tikzpicture}
\end{document}

enter image description here

If your question was how to draw a circular sector around a certain circular text, you can try to use Frédéric's answer to How to Intersect an arc with a line without calculating the angle

4
  • I used it, it is what I need. But really there is no package to do it without calulating all angles maually?
    – saldenisov
    Jun 9 '14 at 19:12
  • @saldenisov They are not what you want, but may be this or this can help you.
    – Ignasi
    Jun 9 '14 at 19:53
  • 1
    @saldenisov I've updated my answer, is it better now?
    – Ignasi
    Jun 10 '14 at 10:13
  • It is much better^)
    – saldenisov
    Jun 10 '14 at 16:20

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.