tikz doesn't work properly

(This answer builds on a number of the earlier comments, I decided to fill in the details since there is no answer currently.) When you compile (reasonably complex) pgf code with latex by default the generated file has all sorts of postscript code in it that dvipdfm(x) can't handle -- lots of errors happen if you look at stderr while converting. This is why dvips -> ps2pdf works, but dvipdfm does not work.

As I understand it pgf will choose what backend driver to use semi-automatically, and if you are running latex it will guess that you want to use dvips. With pdflatex, it will of course automatically use the pdftex driver. If you want to convert a dvi with pgf-generated code using dvipdfm(x), which has no intermediate .ps stage (unlike the similarly named dvipdf), you need to tell it to use the right driver. So, if you want to do latex -> dvipdfm, you need to add the following line before loading pgf/tikz:

\def\pgfsysdriver{pgfsys-dvipdfm.def}

With this line, for me at least, the original code compiles and converts fine with this sequence of commands. The driver system is documented in detail in \S 10.2 of the 2.1 manual. So, in summary, it seems most likely to me that the error is not running latex instead of pdflatex per se, but running latex with a mismatch of the pgf driver and the conversion path.

Tags:

Tikz Pgf