When looking for different packages of creating timelines, I came across the following one:




\begin{tikzpicture}[snake=zigzag, line before snake = 5mm, line after snake = 5mm]
%draw horizontal line   
\draw (0,0) -- (2,0);
\draw[snake] (2,0) -- (4,0);
\draw (4,0) -- (5,0);
\draw[snake] (5,0) -- (7,0);

%draw vertical lines
\foreach \x in {0,1,2,4,5,7}
   \draw (\x cm,3pt) -- (\x cm,-3pt);

%draw nodes
\draw (0,0) node[below=3pt] {$ 0 $} node[above=3pt] {$   $};
\draw (1,0) node[below=3pt] {$ 1 $} node[above=3pt] {$ 10 $};
\draw (2,0) node[below=3pt] {$ 2 $} node[above=3pt] {$ 20 $};
\draw (3,0) node[below=3pt] {$  $} node[above=3pt] {$  $};
\draw (4,0) node[below=3pt] {$ 5 $} node[above=3pt] {$ 50 $};
\draw (5,0) node[below=3pt] {$ 6 $} node[above=3pt] {$ 60 $};
\draw (6,0) node[below=3pt] {$  $} node[above=3pt] {$  $};
\draw (7,0) node[below=3pt] {$ n $} node[above=3pt] {$ 10n $};


When typesetting, we get this:

enter image description here

But although the code says \usepackage{tikz}, there is not a package with this name. According to the CTAN site, there is a macro package called pgf that «comes with a user-friendly syntax layer called TikZ.»

I have checked the pgf documentation, of course, but there doesn't seem to be a section related to the code I posted above. There are many options (some are very nice too), but nothing like what I'm searching. Am I missing something? I'd like to know what can I do beyond what that code offers (if there is something, of course).

Also: what is TikZPicture? Is this what I should be looking for? I'm quite confused at the moment.

  • You are on the right track: TikZ is (basically) syntactic sugar on top of pgf. It is described in the first few chapters of the pgfmanual. In particular, the tutorials are very helpful to get you started.
    – Caramdir
    Commented Apr 1, 2012 at 18:18
  • 1
    A simple Google search for "tikz" shows you en.wikipedia.org/wiki/PGF/TikZ and ctan.org/pkg/pgf, both explain that TikZ is part of PGF. See the pgfmanual for the documentation. Commented Apr 1, 2012 at 18:21
  • I saw that it's part of PGF. What I was asking, apart from confirmation of that, was what part of the manual I should check to understand better the code I posted in my question.
    – Alenanno
    Commented Apr 1, 2012 at 18:22

2 Answers 2

  1. pgf is a huge toolbox for graphics in TeX.

  2. tikz is something built on top of that, with much user-friendlier syntax. Most people use tikz and not pgf; the manual for tikz (and pgf at the same time) is called pgfmanual, which might be confusing.

  3. tikzpicture is a LaTeX environment defined by tikz.

The code you mentioned uses tikz; I'd recommend you to read chapters/sections 1 (basic ideas), 2 (the first tutorial, with examples of (among others) lines and nodes), 15.10 (decorations) and 56 (\foreach) of pgfmanual. Notice also that "snakes" were replaced by "decorations" in newer versions of tikz.

  • Oops, you have already mentioned the obsolete version info. Do you mind copying the message in my answer to yours and I delete mine? Maybe I can add the new way of drawing the image given above if you don't mind.
    – percusse
    Commented Apr 1, 2012 at 18:42
  • @percusse: Well, I'd leave it as it is. This way anyone reading this has some info from my answer and more info on drawing particular things in yours.
    – mbork
    Commented Apr 1, 2012 at 18:53
  • Thank you! :) I already had a look. It's not going to be easy, but well... :D
    – Alenanno
    Commented Apr 1, 2012 at 22:30
  • 1
    @Alenanno: it's easier than you might think, unless you want to do really strange things. Don't forget to take a look at texample.net/tikz !
    – mbork
    Commented Apr 1, 2012 at 22:37

Since you have the TikZ/PGF relation in the comments and answers, here is another reason for the absence of a documentation. If you look at the definition file under PGF package you would see the following lines

\PackageWarning{pgf}{Snakes have been superseded by decorations. Use
the decoration libraries instead of the snakes library}


So that particular usage of snakes is now obsolete and replaced by the libraries given above. For a particular example of the difference between TikZ and pgf, please have a look at my previous answer here which shows two identical ways of higher and lower levels of drawing. I hope you appreciate that TikZ is pretty much easier to use since it uses a pretty fluent english command style.

  • Thanks! I decided to accept the other one, but I upvoted yours because of good additional info. :)
    – Alenanno
    Commented Apr 1, 2012 at 22:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .