TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

EDIT: I would like to use pdfLaTeX interpreter

share|improve this question

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.

share|improve this answer
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 '12 at 14:38
I have found solution by myself. I use \documentclass{article} instead of \documentclass{standalone} and it works! – Michael Z Jan 30 '12 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. – Roelof Spijker Jan 30 '12 at 14:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.