I would like to represent the densest sphere packing in dimension 3 as the following picture, for a beamer presentation.

Sphere packing

Is Tikz the way to go for it? It is not a real 3D drawing since I only want a fixed representation of the picture, right?

Thank you for your help.

  • 3
    Welcome to TeX.SX. Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. Commented Jun 16, 2019 at 17:41
  • Welcome! Maybe this question is related?
    – user121799
    Commented Jun 16, 2019 at 19:37

1 Answer 1


By nesting 2 for-loops one could do something like this:


\foreach \x in {4,...,0}{
    \foreach \y in {\x,...,4}{    
        \draw[fill=white] (0.6*\x,-\y+0.3*\x) circle (0.55) (-0.6*\x,-\y+0.3*\x) circle (0.55);

enter image description here

  • @KJO Please keep your answer, I very much prefer the compact syntax with the loops
    – Dynamite
    Commented Jun 16, 2019 at 20:00
  • @Dynamite Excellent :-) also the answer of KJO. Many sincere compliments.
    – Sebastiano
    Commented Jun 16, 2019 at 20:14
  • 1
    Beautiful and elegant, very nicely done
    – cmhughes
    Commented Jun 16, 2019 at 20:49
  • 2
    Nice! (You could replace the inner loop by \foreach \y [evaluate=\y as \z using {int(mod(\x+\y,2)+mod(\y,2))}] in {\x,...,4}{ \draw[fill=white] \ifnum\z=0 [fill=blue!10] \fi (0.6*\x,-\y+0.3*\x) circle (0.55) (-0.6*\x,-\y+0.3*\x) circle (0.55); }...)
    – user121799
    Commented Jun 16, 2019 at 21:20
  • Perfect thank you very much !
    – Wokwok
    Commented Jun 17, 2019 at 8:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .