Math Help Forum

Math Help Forum Feed Site Feed

Go Back   Math Help Forum > Math Resources > LaTex Help
Reply
 
Thread Tools Display Modes
  #1  
Old May 7th, 2009, 08:24 AM
Opalg's Avatar
MHF Contributor

 
Join Date: Aug 2007
Location: Leeds, UK
Posts: 2,424
Country:
Thanks: 149
Thanked 1,475 Times in 1,234 Posts
Opalg has a brilliant futureOpalg has a brilliant futureOpalg has a brilliant futureOpalg has a brilliant futureOpalg has a brilliant futureOpalg has a brilliant futureOpalg has a brilliant futureOpalg has a brilliant futureOpalg has a brilliant futureOpalg has a brilliant futureOpalg has a brilliant future
Default 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.
Attached Thumbnails
latex-graphics-pent-hex.jpg  latex-graphics-pent-hex2.jpg  
Reply With Quote
The Following 7 Users Say Thank You to Opalg For This Useful Post:
Donate to MHF
Advertisement
 
  #2  
Old May 7th, 2009, 03:45 PM
Newbie
 
Join Date: May 2009
Posts: 13
Country:
Thanks: 0
Thanked 6 Times in 6 Posts
Stefan_K is on a distinguished road
Default 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
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Reply With Quote
The following users thank Stefan_K for this useful post:
Donate to MHF
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -7. The time now is 02:44 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.
©2005 - 2009 Math Help Forum


Math Help Forum is a community of maths forums with an emphasis on maths help in all levels of mathematics.
Register to post your math questions or just hang out and try some of our math games or visit the arcade.