Roland's homepage

My random knot in the Web

Adding text or graphics to a PDF file (again)

In an earlier article I talked about using a picture environment in LaTeX to add lines and text over an image. In another article I showed how to draw with PostScript, including using Encapsulated PostScript to include arbitrary images.

In this article I want to cover the pros and cons of these methods and introduce a third method: TikZ.

Picture environment

The picture environment in LaTeX works with all back-end drivers. Because of this its drawing capabilities are limited; its functionality is the least common denominator of all possible drivers.

A definite plus is the fact that you can use all the LaTeX facilities for text.


Since PostScript is a full-blown programming language, its vector graphics capabilities are practically unlimited. It can also embed bitmaps.

The language is stack-based and uses reverse Polish notation, which is easy for computers but not so much for humans. Luckily modern PostScript interpreters like Ghostscript are not strapped for memory so you can define variables instead of spending your time juggling values on the stack.

De biggest downside is that the font handling of PostScript predates Unicode. So while you basically can show any character in a font, it is not trivial to say show a string consisting of unicode code points or UTF-8.


Although I’m just starting on my TikZ journey,I like it a lot already. It has taken some of the best features of pstricks, metapost and asymptote. And of course it uses TeX’s typesetting capabilities.

The documentation for TikZ is excellent. It comes with a extensive manual (currently 1161 pages). There are also a lot examples to find on and it is a frequent topic on

Next to its basic capabilities TikZ also comes with a lot of libraries for specialized tasks. For example electrical circuits and arrows.

←  Installing Pelican 4