Create a chain of circle around a large circle using TikZ (and how I could learn to create this)

tikz-pgf

So I have two questions. First, how could I create the following image in TikZ? Secondly, what resources could I use to learn the TikZ to make this on my own and also how can I understand your code (if you could explain it that would be so much appreciated 🙂 )
enter image description here

Also how do I input an image into this. I tried and it said it was too big but this doesn't make sense as it's a simple image of a piece of graph paper. It also said failed when I tried to insert the imgur link into the box.

Any help appreciated thanks so much!

Best Answer

For the first answer, the TikZ documentation could be a good starting point, specially the Tutorials section. The link in the comments provides a lot of interesting resources too. And there are lots of examples across this site, varying from the very simple to the very difficult.

The second: the picture. You can do it with this simple code:

\documentclass[border=2mm,tikz]{standalone}

\begin{document}
\begin{tikzpicture}
\def\R{3}   % Table radius
\def\r{0.5} % Seat radius
% Title
\node at (0,\R+1) {\Large Seats in a round table};
% Table
\draw[thick,fill=brown!30] (0,0) circle (\R);
% Seats (change the number 180 to rotate the seats)
\foreach\i in {1,...,12}  
  \draw[fill=white] (180-30*\i:\R) circle (\r) node {$\i$};
% Center (comment it or remove it if you don't want the center shown)
\fill (0,0) circle (0.5mm);
\end{tikzpicture}
\end{document}

I think that it's self-explanatory but just in case:

  • I made two variables \R and \r, for the radii. This way if you want to change them you don't need to look for then across all the code (not much in this case, but sometimes could be longer).
  • The \foreach statement repeats the next instruction as its name suggests, for each value of the variable \i in the range (1,...,12). So it draws 12 circles at the polar points which angle is function of \i: 180-30*\i (if you change the value 180 for another angle you can rotate the seats). As it is, the angles will be
180-30*1=150,  180-30*2=120,  ...  ,  180-30*12=-180

And finally this is the table: enter image description here

Related Question