I am successfully using tikz in combination with externalization and pdflatex for some time now. But now I need to switch to latex->dvi->ps. I followed the instructions from the tikz documentation and read a lot of user posts.
I can compile the minimal example (see below) without any errors, but the external image (ps) generated by dvi2ps has the size of an a4-paper. Therefore latex places the figure after "Text before image" and "Text after image".
Is it possible that the bounding box is not determined correctly?
I've tried a similar scenario a couple of months ago on a Mac OS X system and it worked. Now, I am running a Windows system with the most recent MikTeX version (I updated all packages).
Does anybody know, if it is a bug in dvips or in tikz? Or maybe I did something wrong. Thank you for your help!
PS: I also tried a lot of other system calls (pdflatex -> pdftops) and everything from here: Export eps figures from TikZ without any success.
\documentclass[a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzset{external/system call={latex \tikzexternalcheckshellescape -halt-on-error
-interaction=batchmode -jobname "\image" "\texsource" &&
dvips -o "\image".ps "\image".dvi }}
\tikzexternalize
\begin{document}
Text before image.
\begin{figure}[h]
\centering
\begin{tikzpicture}
\clip (0,0) rectangle (1,1);
\draw[red] (0,0) -- (1,1);
\draw[red] (1,0) -- (0,1);
\draw[blue] (0,0) rectangle (1,1);
\end{tikzpicture}
\end{figure}
Text after image.
\end{document}
Edit: I tried the minimal example on another windows system and got the same a4paper box. Calling
dvips -E* -o "\image".ps "\image".dvi
instead of the code above leads to a figure without any bounding box. Therefore latex inserts the image on top of the text. It is also possible to change the format as an argument of dvips, but I do not intended, to specifiy a fixed bounding box as a general case.