Archive for June 2006

PGF and TikZ — Wow!

Mikkel and I have been working on a poster for the Summer School in Game Theory next week. For a poster you obviously need some graphics, and at first we started out with using PSTricks. That worked quite well and I was surpriced how easy it was to generate good pictures.

But PSTricks doesn’t work in pdfLaTeX, and for some reason the PostScript output didn’t work as well for me as PDF output. I then found the amazing PGF and TikZ packages with which you can make beautiful graphics for both PostScript and PDF output. The TikZ syntax is very clever and easy on the eyes, it’s inspired by PSTricks and MetaPost, another favorite program of mine.

With TikZ you get a very nice highlevel programming language for producing graphics in (La)TeX. For example, this code (taken roughly from the frontpage of the PGF and TikZ manual):

\tikzstyle{level 1}=[sibling angle=120]
\tikzstyle{level 2}=[sibling angle=60]
\tikzstyle{level 3}=[sibling angle=30]
\tikzstyle{every node}=[fill]
\tikzstyle{edge from parent}=[snake=expanding waves, segment length=1mm, segment angle=10,draw]
\tikz [grow cyclic, shape=circle, thick, level distance=10mm, cap=round]
\node {} child [color=\A] foreach \A in {red,green,blue}
      { node {} child [color=\A!50!\B] foreach \B in {red,green,blue}
        { node {} child [color=\A!50!\B!50!\C] foreach \C in {black,gray,white}
          { node {} }
        }

gives you this:

Art by TikZ

and this little piece of code:

\begin{tikzpicture}[line width=3pt]
  \draw[->] ( 0,-1) — ( 0,20) node[above] {Expenses};
  \draw[->] (-1, 0) — (20, 0) node[below] {Income};
  \draw[->, >=latex, blue!20!white, line width=72pt]
    (4, 16) — node [black,sloped] {Optimization} +(-45:17cm);
  \draw[draw=blue, loosely dashed]
    (1.5,1.5) coordinate (C1) node[below=3pt]       {$C_1$} -
    (10, 3)   coordinate (C2) node[below=3pt]       {$C_2$} -
    (13.5, 5) coordinate (C3) node[below right=3pt] {$C_3$} -
    (17, 10)  coordinate (C4) node[right=3pt]       {$C_4$} -
    (19, 18)  coordinate (C5) node[right=3pt]       {$C_5$};
  \fill (C1) circle (5pt) (C2) circle (5pt) (C3) circle (5pt)
    (C4) circle (5pt) (C5) circle (5pt);
  \path (9,16) coordinate (C0);
  \path (intersection of C3-C4 and C0- 19,6) coordinate (opt);
  \draw[|->, red, shorten >= 5pt] (C0) — (opt);
  \filldraw[red] (C0) node[above left] {$C_0$}
    (opt) node[below right, text width=4.5cm] {Optimization Target} circle (5pt);
\end{tikzpicture}

gives you this graphic, which we used for our poster:

Benchmarking example made with TikZ

The graphic illustrates how company C0 ought to be more efficient by reaching the optimization target indicated. Notice how the target is found automatically as the intersection between the line segment from C3 to C4 and the line going downwards in a -45° angle from C0. Features like that used to belong only to MetaPost. Please also note now the color of the big arrow is specified as 20% blue mixed with 80% white. This easy and powerful way of selecting colors is possible thanks to the xxcolor package.

So if you’re into [LaTeX][] and need to include graphics in your documents, then look into PGF and TikZ. The installation is extremely easy: simply unpack the tarball and move some directories into your ~/texmf directory.

Neat and tidy

I’ve now changed Planet DAIMI so that it runs all content through HTML Tidy. That will clean up the strange stuff people post there… it is only the markup that is corrected, I cannot do anything about the content :-)

Any warnings given by Tidy will be displayed before the content of the post/comment, so you still have a chance of noticing. But there should be no more of the boring big red boxes saying “You didn’t write real XML, so I won’t display it, haha!” (or whatever it was it said).

New faces on the Planet, take II

It keeps growing! Giving in to our group pressure, Fitzi decided to start a blog…! Following that, we convinced Gabi that he should do so too. So Planet DAIMI now keeps track of no less than 11 blogs. That’s kind of cool :-)

CPT exam tomorrow

I have my exam in CPT tomorrow — Thomas and I have been practicing all day and it have really helped. So I now feel pretty confident that I know what I need to know about commitment schemes, zero-knowledge interactive proof systems and arguments, Σ-protocols, electronic voting, electronic cash, and secure multiparty computations. That was the six exam topics :-)

By the way, I believe Rune is still accepting bets in the Exam Game

Running out of Internet :-(

StofaNet at the limit! Mikkel is going to love this… :-)

It seems that Stéphanie and I will be running out of bandwidth in a week or so… We only have 10 GB/month, and we’ve already used up 6 GB in the first 11 days. When we hit the bandwidth cap we can buy extra capacity at the hefty price of 0.10 DKK/MB (about 1.5 €-cent or 2 $-cent). Ugh!

We’ll probably have to upgrade our subscription for next month to the 4 Mib line with 20 GB/month bandwidth. That would cost us 400 DKK/month compared to 350 DKK/month right now, so it’s actually quite a good deal. The problem is that it might not work — twice the bandwidth, but also twice the speed… We’ll see how it goes.