Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 8 down vote accepted

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

share|improve this answer
    
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 at 19:12
    
@saldenisov They are not what you want, but may be this or this can help you. –  Ignasi Jun 9 at 19:53
1  
@saldenisov I've updated my answer, is it better now? –  Ignasi Jun 10 at 10:13
    
It is much better^) –  saldenisov Jun 10 at 16:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.