Results 1 to 2 of 2

Thread: LaTeX graphics

  1. #1
    MHF Contributor
    Opalg's Avatar
    Aug 2007
    Leeds, UK

    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).
    \def\pentagon{ -- ++(0,-2) -- ++(2,0) -- ++(60:2cm) -- 
      +(150:2cm) -- cycle}
    \filldraw [rotate around={90: (-2,0)}, fill=green!20!white]  
    \filldraw [rotate around={180: (1.268,2.732)}, fill=yellow!40!white]  
    \filldraw [rotate around={270: (3.268,4.732)}, fill=red!20!white]  
    \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);
    If you want to draw pictures in a TeX document, and you haven't come across TikZ, I strongly recommend it.
    Attached Thumbnails Attached Thumbnails LaTeX graphics-pent-hex.jpg   LaTeX graphics-pent-hex2.jpg  
    Follow Math Help Forum on Facebook and Google+

  2. #2
    May 2009


    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.

    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Help with graphics.
    Posted in the Algebra Forum
    Replies: 1
    Last Post: Dec 20th 2011, 09:57 AM
  2. Graphics
    Posted in the Trigonometry Forum
    Replies: 0
    Last Post: Nov 9th 2009, 06:25 AM
  3. Graphics of Latex
    Posted in the LaTeX Help Forum
    Replies: 0
    Last Post: Sep 15th 2008, 08:56 AM
  4. Multiple of graphics
    Posted in the Discrete Math Forum
    Replies: 1
    Last Post: Sep 25th 2007, 08:17 AM
  5. My graphics
    Posted in the LaTeX Help Forum
    Replies: 1
    Last Post: Dec 29th 2006, 01:03 AM

Search Tags

/mathhelpforum @mathhelpforum