Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using external EPS from TikZ figures following the suggestions found in "Export eps figures from TikZ". Images are correctly created but when I get the PS of the main document with dvips I can't see any pictures. It looks like a problem of size of the image or resolution, because the pages where I put pictures appears just all white with the caption of the figure. Also the text of the page is covered. I don't get any error message.

Is there any other option I have to give to dvips?

My code is:

\hyphenation{Post-Script}
\usepackage{epsfig,import,graphicx,tikz,pgfplots}
\usepgfplotslibrary{external}
\tikzexternalize[prefix=tikzFigures/,shell escape=-enable-write18]
\tikzset{external/system call={latex \tikzexternalcheckshellescape -halt-on-error
-interaction=batchmode -jobname "\image" "\texsource" &&
dvips -o "\image".ps "\image".dvi}} 

\begin{document}

    \begin{figure}[thb]
        \input{images/fig1.tikz}
        \caption{caption}
        \label{fig:label}
    \end{figure}

\end{document}

and run with

latex --src -interaction=nonstopmode -enable-write18

and then

dvips -P pdf

Here is the code of images/fig1.tikz:

\begin{tikzpicture}

    \begin{axis}[
        name=plot1,
        scale only axis,
        xlabel={$x [m]$},
        ylabel={$y [m]$},
        title={image},
        view={0}{90},
        colormap={bw}{gray(0cm)=(0);gray(1cm)=(1)},
        colorbar
        ]

        \addplot3[surf]file{images/matrix.dat} ;

    \end{axis}

\end{tikzpicture}

I'm using MikTeX 2.9 on a Windows XP system.

share|improve this question
    
Hi, welcome to tex.sx. A tip: you can and should use back-ticks ` to mark inline code and names of executables. I tidied up your post a little. I hope you don't mind. –  Martin Scharrer Feb 25 '11 at 12:04
    
Is the space in -halt- on-error intentional (because there shouldn't be one). Do you get any error message? –  Caramdir Feb 25 '11 at 17:37
    
@Martin Thank you Martin, of course you can modify my posts as you wish. Thanks for the tip. @Caramdir It was just a typewriting error, i updated the question, thanks for noting it. –  user3824 Feb 26 '11 at 11:58
    
Could you please add the contents of images/fig1.tikz. –  Caramdir Feb 26 '11 at 16:34
add comment

2 Answers

A simple workaround is to save your diagrams as .pdf and import them using graphicx. Answers to this question soundly recommend .pdf over .eps, however perhaps the most practical is that .pdf viewers and generators are fairly ubiquitous. Additionally, if you use pdflatex or xelatex you can compile directly to .pdf without the .dvi intermediate.

Unfortunately, as Hendrik points out, my initial suggestion was very obsolete.

share|improve this answer
    
Thanks eutactic, I tried to use graphics but got the same result. I use .eps because of the usefull .eps+Latex export function of InkScape. Anyway i will try also with .pdf in the future, thanks for the interesting links. In regard with my problem with external tikz, my idea is that there is some issue with the way libraries insert .eps generated from tikz pictures in my main file when they are up-to-date, but I don't know how to have control on that. –  user3824 Feb 26 '11 at 11:54
    
Ah ok. Obviously your usage scenario presents a compelling reason to use .eps that I overlooked. Regrettably that is beyond my experience however I will watch this topic as I am also curious about Inkscape TeX export. –  Richard Terrett Feb 26 '11 at 12:25
    
when you compile with latex, eps is the usual graphic format, when compiling with pdflatex, png and pdf are preferred. graphicx entirely supersedes graphics. –  Caramdir Feb 26 '11 at 16:31
    
@eutactic By the way, pushed by your observation about .pdf, I discovered that Inkscape has also a Pdf+Latex export function if you are interested. I think it should work the same way, but didn't had the time to try it yet. –  user3824 Feb 26 '11 at 17:09
    
@eutactic: It appears that it's not correct what you wrote about .eps, and that page of Wake you linked to is rather outdated. It would be great if you can update your answer to reflect that. Thanks! –  Hendrik Vogt Mar 2 '11 at 11:23
show 1 more comment

You said that "images are created correctly" ... does that include the correct bounding box? Perhaps the final graphics inclusion works like "Ah, its a .ps file -- that means it has no bounding box, so I don't check for it". If that is the problem, it might help to rename the generated image file to ".eps" (by updating the system call key).

If the generated image is correct, including its bounding box: Did you try to call \includegraphics{tikzFigures/<main>-figure0}?

From what I know, dvips -P pdf should produce a valid .ps file and then send it to the printer called pdf. Did you try to use dvips -o test.ps test.dvi followed by a manual conversion to pdf? Perhaps the dvips -P pdf in miktex does something smart beyond converting to ps and then to pdf?

The example as such appears to be valid; I could process it successfully on my Ubuntu Tex-Live distribution, using

latex -shell-escape P && dvips -o P.ps P.dvi && ps2pdf P.ps

Good luck...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.