Is there any good tutorial/approach in LaTeX for drawing polygons filled with color?

EDIT: I would like to use pdfLaTeX interpreter

1 Answer 1


Sure, you can use TikZ for instance. There is a node shape regular polygon, it can be used like this:

  \foreach \a in {3,...,8}{
    \node[regular polygon, regular polygon sides=\a, minimum size=2cm, anchor=south, fill=blue!40] at (\a*4,0) {};

With the following result:

Regular polygons in TikZ

Note that you can determine the color by changing fill=blue!40 to any color definition you like. If you want to add a border to the polygon, you can use the draw option on the node. You can change the color of that by using draw=color. You don't need to use a node, you can of course contruct a regular polygon path, but a node is the easiest way to directly get a regular polygon.

  • Sorry I didn't mention - I would like to use pdfLaTeX interpreter. Now I see ! LaTeX Error: File `standalone.cls' not found. for you example.
    – Michael Z
    Jan 30, 2012 at 14:38
  • I have found solution by myself. I use \documentclass{article} instead of \documentclass{standalone} and it works!
    – Michael Z
    Jan 30, 2012 at 14:42
  • That just means you don't have the standalone class. You can just as easily use article as the documentclass. I just used standalone in order to get a nice pdf to upload as an example. Jan 30, 2012 at 14:43

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.