[Tex/LaTex] Drawing hexagons


I have a case where I need to draw a hexagonal grid in LaTeX. I am considering just reading the grid from an eps file.

Is there an alternative way to do it completely within LaTeX?

Best Answer

Here's a quick option:

  \foreach \i in {0,...,3} 
  \foreach \j in {0,...,3} {
  \foreach \a in {0,120,-120} \draw (3*\i,2*sin{60}*\j) -- +(\a:1);
  \foreach \a in {0,120,-120} \draw (3*\i+3*cos{60},2*sin{60}*\j+sin{60}) -- +(\a:1);}

Which results in

alt text