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 now did it manually, but I'm interested in how I can do this with a loop:

\documentclass{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\tikzstyle{Punkt} = [coordinate]

\node[Punkt] (Center) at (0, 0) {};
\draw[-, thick, fill=black!30!white]{[rounded corners=1.5pt] ([shift={(30:1.2)}]Center)  arc (30:34:1.2) -- 
                                             ([shift={(36:1.5)}]Center)  arc (36:84:1.5) --  
                                             ([shift={(86:1.2)}]Center)  arc (86:94:1.2) --
                                             ([shift={(96:1.5)}]Center)  arc (96:144:1.5) --
                                             ([shift={(146:1.2)}]Center)  arc (146:154:1.2) --
                                             ([shift={(156:1.5)}]Center)  arc (156:204:1.5) --
                                             ([shift={(206:1.2)}]Center)  arc (206:214:1.2) --
                                             ([shift={(216:1.5)}]Center)  arc (216:264:1.5) --
                                             ([shift={(266:1.2)}]Center)  arc (266:274:1.2) --
                                             ([shift={(276:1.5)}]Center)  arc (276:324:1.5) --
                                             ([shift={(326:1.2)}]Center)  arc (326:334:1.2) --
                                             ([shift={(336:1.5)}]Center)  arc (336:384:1.5) --
                                             ([shift={(386:1.2)}]Center)  arc (386:390:1.2)                                     
                                            };
\draw [fill=white, opacity=1, thick] (Center) circle [radius=1];

\end{tikzpicture}

\end{document} 

pic1

If I try something like this:

\foreach \i in {1,2,...,6}{ 
\draw[-, fill=green][rotate=(\i-1)*360/6] 
{[rounded corners=1.5pt] ([shift={(29:1.2)}]Center)  arc (29:34:1.2) -- 
([shift={(36:1.5)}]Center)  arc (36:84:1.5) --  
([shift={(86:1.2)}]Center)  arc (86:91:1.2);
}

It is only filled between the start- and end-point of each segment:

pic2

Thank you for help. Konne

share|improve this question
    
Welcome to TeX.SX! –  Adam Liter Feb 21 at 16:00
add comment

1 Answer

up vote 7 down vote accepted

Put the \foreach inside the \draw. This makes it a single path and thus fully fillable.

\documentclass{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\tikzstyle{Punkt} = [coordinate]

\node[Punkt] (Center) at (0, 0) {};

\draw[-, fill=green]  ([shift={(29:1.2)}]Center)
\foreach \i in {1,2,...,6}{ 
  [rotate=(\i-1)*360/6]
  {[rounded corners=1.5pt]  arc (29:34:1.2)    -- 
([shift={(36:1.5)}]Center)  arc (36:84:1.5) --  
([shift={(86:1.2)}]Center)  arc (86:91:1.2) --   ([shift={(89:1.2)}]Center)
}
};

\draw [fill=white, opacity=1, thick] (Center) circle [radius=1];


\end{tikzpicture}

\end{document} 
share|improve this answer
    
Thanks! That's exactly what i needed to know. –  Konne Feb 21 at 16:37
add comment

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.