4

I want to generate a regular polygon with 6 sides in TikZ. But I can not compile the following:

\begin{figure}
\resizebox{8 cm}{8 cm}{

\begin{tikzpicture}[scale=2]

\node [draw, thick, minimum size=3cm, regular polygon, regular polygon sides=6] at (2,2) {center \ node};

\node [draw, thick, minimum size=3cm, regular polygon, regular polygon sides=6] at (2,3.74) {adjacent \ node};

\node [draw, thick, minimum size=3cm, regular polygon, regular polygon sides=6] at (2,0.26) {adjacent \ node};

\node [draw, thick, minimum size=3cm, regular polygon, regular polygon sides=6] at (0.5,2.87) {adjacent \ node};

\node [draw, thick, minimum size=3cm, regular polygon, regular polygon sides=6] at (0.5,1.13) {adjacent \ node};

\node [draw, thick, minimum size=3cm, regular polygon, regular polygon sides=6] at (3.5,2.87) {adjacent \ node}; 

\node [draw, thick, minimum size=3cm, regular polygon, regular polygon sides=6] at (3.5,1.13) {adjacent \ node};
\end{tikzpicture}
}
\caption{Nodes placed  in hexagonal grid when ROI partitioned in to regular hexagons}
\end{figure}
  • 3
    Works fine here. As long as I use the shapes.geometric library that is. Did you forget that by any chance? If not, check your version of TikZ. – Roelof Spijker Feb 4 '12 at 18:31
  • Exactly. I forgot to include that library. Thank you very much. – user12290 Feb 5 '12 at 8:48
5

You need to use the shapes.geometric library in order to use the regular polygon shape. After that your code should work just fine.

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.