# Math Help - LaTeX graphics

1. ## LaTeX graphics

After ten years of toiling with the LaTeX picture environment, I have just discovered the PGF-TikZ package for creating graphics in a TeX file. Maybe everyone else knows about it? For me, it was a new discovery, and I think it's totally amazing, like moving instantly from the steam age to the space age. It's completely free, easy to install on my home computer, where it integrates seamlessly with TeXShop, and it has a 500+-page user manual that is beautifully written and easy to follow.

A couple of days ago, I wanted to draw a picure of four pentagons fitting together to form a hexagon, in answer to a question in the Geometry section of this forum. The only way I could do it was to draw it freehand in Photoshop (first attachment below). If I had known about TikZ at that time, I could have produced a much better graphic, in a fraction of the time, using just a few lines of TeX code (second attachment).
Code:
\begin{tikzpicture}
\def\pentagon{ -- ++(0,-2) -- ++(2,0) -- ++(60:2cm) --
+(150:2cm) -- cycle}
\filldraw [rotate around={90: (-2,0)}, fill=green!20!white]
(-2,0)\pentagon;
\filldraw [rotate around={180: (1.268,2.732)}, fill=yellow!40!white]
(1.268,2.732)\pentagon;
\filldraw [rotate around={270: (3.268,4.732)}, fill=red!20!white]
(3.268,4.732)\pentagon;
\filldraw[draw=black,very thick, fill=blue!40!white] (0,2)
node[above=1pt]{$C$} -- ++(0,-2) node[below=1pt]{$B$} -- ++(2,0)
node[below=1pt]{$A$} -- ++(60:2cm) node[right]{$E$} -- +(150:2cm)
node[above right]{$D$} -- cycle;
\draw (0,.4) -- (.4,.4) -- (.4,0);
\draw (2,0) ++ (60:1.6cm) -- ++(150:.4) -- +(60:.4);
\end{tikzpicture}
If you want to draw pictures in a TeX document, and you haven't come across TikZ, I strongly recommend it.

2. ## pgf/TikZ

That's a very good recommendation! There's a great example gallery collected and maintained by Kjell Magne Fauske: TikZ and PGF examples. Have a look to get an impression of this versatile graphics package.

I'm using pgf/TikZ too, for instance do draw commutative diagrams for math texts, some examples are in these pgf/TikZ posts.

Stefan