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. – Stefan Pinnow Jun 16 '19 at 17:41
  • Welcome! Maybe this question is related? – user121799 Jun 16 '19 at 19:37

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

| improve this answer | |
  • @KJO Please keep your answer, I very much prefer the compact syntax with the loops – Dynamite Jun 16 '19 at 20:00
  • @Dynamite Excellent :-) also the answer of KJO. Many sincere compliments. – Sebastiano Jun 16 '19 at 20:14
  • 1
    Beautiful and elegant, very nicely done – cmhughes Jun 16 '19 at 20:49
  • 1
    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 Jun 16 '19 at 21:20
  • Perfect thank you very much ! – Wokwok Jun 17 '19 at 8:13

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.