I ran into a problem converting the ps to pdf in a latex file using vectors fields and have finally nailed down the problem. <br><br>The following problem is closely related to the vector field code on the pstricks web site.&nbsp; If I set the parameter unit using:
<br>\pset{unit=0.5cm}<br>where the unit is 0.5cm I get a error: &quot;/invalidrestore in --restore-- &quot; (see below).&nbsp; If I set the unit to 1cm or larger it is fine.&nbsp; A guess of the problem is the following:&nbsp; since the code uses raw postscript, there might be an issue in scaling.&nbsp; 
<br><br>I should also mention that there must be two pspicture environments for this to fail.&nbsp; If I run the code on just one pspicture environment, there is no error in converting the ps to pdf.&nbsp; <br><br>If anyone has any ideas on this, it would be quite helpful.
<br><br>Thanks in advance, <br>Peter Staab<br><br><br><br>I have included first the output of a run and then the code:<br><br>### This is /usr/local/teTeX/bin/powerpc-apple-darwin-current/altpdflatex, Version $Revision: 2.18
 $<br>### /usr/local/teTeX/bin/powerpc-apple-darwin-current/latex test2.tex<br>This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)<br>entering extended mode<br>(./test2.tex<br>LaTeX2e &lt;2003/12/01&gt;<br>Babel &lt;
v3.8d&gt; and hyphenation patterns for american, french, german, ngerman, d<br>utch, italian, norsk, portuges, spanish, swedish, nohyphenation, loaded.<br>(/usr/local/teTeX/share/texmf.tetex/tex/latex/base/article.cls<br>
Document Class: article 2004/02/16 v1.4f Standard LaTeX document class<br>(/usr/local/teTeX/share/texmf.tetex/tex/latex/base/size10.clo))<br>(/Users/peter/Library/texmf/tex/latex/pst-plot.sty<br>(/Users/peter/Library/texmf/tex/latex/pstricks.sty
<br>(/Users/peter/Library/texmf/tex/latex/pstricks.tex<br>`PSTricks' v1.10&nbsp; &lt;2005/08/13&gt; (tvz)<br>(/usr/local/teTeX/share/texmf.tetex/tex/generic/pstricks/pstricks.con))<br>(/usr/local/teTeX/share/texmf.tetex/tex/latex/xcolor/xcolor.sty
<br>(/usr/local/teTeX/share/texmf.tetex/tex/latex/graphics/color.cfg)<br>(/usr/local/teTeX/share/texmf.tetex/tex/latex/graphics/dvips.def)))<br>(/Users/peter/Library/texmf/tex/latex/pst-plot.tex&nbsp; v97 patch 2, 1999/12/12<br>
(/usr/local/teTeX/share/texmf.tetex/tex/generic/multido/multido.tex<br>&nbsp;v1.41, 2004/05/18 &lt;tvz&gt;))) (./test2.aux) [1] (./test2.aux)<br><br>&nbsp;*File List*<br>&nbsp;article.cls&nbsp;&nbsp;&nbsp; 2004/02/16 v1.4f Standard LaTeX document class
<br>&nbsp; size10.clo&nbsp;&nbsp;&nbsp; 2004/02/16 v1.4f Standard LaTeX file (size option)<br>pst-plot.sty&nbsp;&nbsp;&nbsp; 2004/07/15 package wrapper for pst-plot.tex<br>pstricks.sty&nbsp;&nbsp;&nbsp; 2004/05/12 v0.2l LaTeX wrapper for `PSTricks' (RN,HV)<br>pstricks.tex
&nbsp;&nbsp;&nbsp; 2005/08/13 v1.10 `PSTricks' (tvz)<br>&nbsp; xcolor.sty&nbsp;&nbsp;&nbsp; 2004/07/04 v2.00 LaTeX color extensions (UK)<br>&nbsp;&nbsp; color.cfg&nbsp;&nbsp;&nbsp; 2005/02/03 v1.3 color configuration of teTeX/TeXLive<br>&nbsp;&nbsp; dvips.def&nbsp;&nbsp;&nbsp; 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
<br>pst-plot.tex&nbsp;&nbsp;&nbsp; 2004/05/18 1.41 `pst-plot' (tvz)<br>&nbsp;***********<br><br>&nbsp;)<br>Output written on test2.dvi (1 page, 146756 bytes).<br>Transcript written on test2.log.<br>### /usr/local/teTeX/bin/powerpc-apple-darwin-current/dvips -R -Poutline&nbsp; -o /tmp/altpdflatex.4451-1129320130/test2.ps 
test2.dvi<br>This is dvips(k) 5.95a Copyright 2005 Radical Eye Software (<a href="http://www.radicaleye.com">www.radicaleye.com</a>)<br>' TeX output 2005.10.14:1602' -&gt; /tmp/altpdflatex.4451-1129320130/test2.ps<br>&lt;
<a href="http://tex.pro">tex.pro</a>&gt;&lt;<a href="http://pstricks.pro">pstricks.pro</a>&gt;&lt;<a href="http://pst-dots.pro">pst-dots.pro</a>&gt;&lt;<a href="http://texps.pro">texps.pro</a>&gt;&lt;<a href="http://special.pro">
special.pro</a>&gt;&lt;<a href="http://color.pro">color.pro</a>&gt;. <br>&lt;cmsy10.pfb&gt;&lt;cmr10.pfb&gt;[1] <br>### ps2pdf13 /tmp/altpdflatex.4451-1129320130/test2.ps /tmp/altpdflatex.4451-1129320130/test2.pdf<br>Error: /invalidrestore in --restore--
<br>Operand stack:<br>&nbsp;&nbsp; 1426&nbsp;&nbsp; 5&nbsp;&nbsp; (5)&nbsp;&nbsp; 1329&nbsp;&nbsp; 2583&nbsp;&nbsp; 5&nbsp;&nbsp; (5)&nbsp;&nbsp; 1329&nbsp;&nbsp; 2583&nbsp;&nbsp; 5&nbsp;&nbsp; (1)&nbsp;&nbsp; 1217&nbsp;&nbsp; 2373&nbsp;&nbsp; 5&nbsp;&nbsp; (2)&nbsp;&nbsp; 1217&nbsp;&nbsp; 2255&nbsp;&nbsp; 5&nbsp;&nbsp; (3)&nbsp;&nbsp; 1217&nbsp;&nbsp; 2137&nbsp;&nbsp; 5&nbsp;&nbsp; (4)&nbsp;&nbsp; 1217&nbsp;&nbsp; 2019&nbsp;&nbsp; 5&nbsp;&nbsp; (5)&nbsp;&nbsp; 1329&nbsp;&nbsp; 2583&nbsp;&nbsp; 5&nbsp;&nbsp; (1)&nbsp;&nbsp; 1153&nbsp;&nbsp; 2842&nbsp;&nbsp; 5&nbsp;&nbsp; (2)&nbsp;&nbsp; 1153&nbsp;&nbsp; 2960&nbsp;&nbsp; 5&nbsp;&nbsp; (3)&nbsp;&nbsp; 1153&nbsp;&nbsp; 3078&nbsp;&nbsp; 5&nbsp;&nbsp; (4)&nbsp;&nbsp; 1153&nbsp;&nbsp; 3196&nbsp;&nbsp; 5&nbsp;&nbsp; (5)&nbsp;&nbsp; 1329&nbsp;&nbsp; 2583&nbsp;&nbsp; 5&nbsp;&nbsp; --nostringval--&nbsp;&nbsp; --nostringval--
<br>Execution stack:<br>&nbsp;&nbsp; %interp_exit&nbsp;&nbsp; .runexec2&nbsp;&nbsp; --nostringval--&nbsp;&nbsp; --nostringval--&nbsp;&nbsp; --nostringval--&nbsp;&nbsp; 2&nbsp;&nbsp; %stopped_push&nbsp;&nbsp; --nostringval--&nbsp;&nbsp; --nostringval--&nbsp;&nbsp; --nostringval--&nbsp;&nbsp; false&nbsp;&nbsp; 1&nbsp;&nbsp; %stopped_push&nbsp;&nbsp; 1&nbsp;&nbsp; 3&nbsp;&nbsp; %oparray_pop&nbsp;&nbsp; 1&nbsp;&nbsp; 3&nbsp;&nbsp; %oparray_pop&nbsp;&nbsp; 1&nbsp;&nbsp; 3&nbsp;&nbsp; %oparray_pop&nbsp;&nbsp; 1&nbsp;&nbsp; 3&nbsp;&nbsp; %oparray_pop&nbsp;&nbsp; .runexec2&nbsp;&nbsp; --nostringval--&nbsp;&nbsp; --nostringval--&nbsp;&nbsp; --nostringval--&nbsp;&nbsp; 2&nbsp;&nbsp; %stopped_push&nbsp;&nbsp; --nostringval--&nbsp;&nbsp; --nostringval--&nbsp;&nbsp; 51&nbsp;&nbsp; 4&nbsp;&nbsp; %oparray_pop&nbsp;&nbsp; --nostringval--&nbsp;&nbsp; 51&nbsp;&nbsp; 4&nbsp;&nbsp; %oparray_pop&nbsp;&nbsp; --nostringval--
<br>Dictionary stack:<br>&nbsp;&nbsp; --dict:1120/1686(ro)(G)--&nbsp;&nbsp; --dict:0/20(G)--&nbsp;&nbsp; --dict:72/200(L)--&nbsp;&nbsp; --dict:179/300(L)--<br>Current allocation mode is local<br>Last OS error: 2<br>Current file position is 198584<br>AFPL Ghostscript 
8.51: Unrecoverable error, exit code 1<br>### FAILED to generate /tmp/altpdflatex.4451-1129320130/test2.pdf ()<br><br><br>-----------CODE BELOW--------<br><br>&nbsp;%!TEX TS-program = latex<br>\listfiles<br>\documentclass[a4paper]{article}
<br>\usepackage{pst-plot}<br>&nbsp;<br><br><br>\begin{document}<br>%% if this is above 1cm no problems:<br>\psset{unit=0.5cm}<br><br>\SpecialCoor% importanmt for all examples<br>\begin{pspicture}(-6,-6)(6,6)<br>&nbsp; \psaxes{&lt;-&gt;}(0,0)(-6,-6)(6,6)
<br>&nbsp; \psset{arrows=-&gt;}<br>&nbsp; \multido{\ia=-5+1}{11}{%<br>&nbsp;&nbsp;&nbsp; \multido{\ib=-5+1}{11}{%<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \pstVerb{/x \ia\space def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /y \ib\space def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; y 0 eq<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {/ValueTempA 0 def
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /ValueTempB 0.5 def}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {/ValueTempZ 10 def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /ValueTempA y ValueTempZ div def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /ValueTempB x neg ValueTempZ div def}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ifelse}
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \psline(! x ValueTempA sub y ValueTempB sub)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (! x ValueTempA add y ValueTempB add)}}<br>\end{pspicture}<br>\begin{pspicture}(-6,-6)(6,6)<br>&nbsp; \psaxes{&lt;-&gt;}(0,0)(-6,-6)(6,6)<br>&nbsp; \psset{arrows=-&gt;}
<br>&nbsp; \multido{\ia=-5+1}{11}{%<br>&nbsp;&nbsp;&nbsp; \multido{\ib=-5+1}{11}{%<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \pstVerb{/x \ia\space def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /y \ib\space def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; y 0 eq<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {/ValueTempA 0 def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /ValueTempB 
0.5 def}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {/ValueTempZ 2 1 x x mul y y mul div add sqrt mul def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /ValueTempA 1 ValueTempZ div def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /ValueTempB x neg y ValueTempZ mul div def}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ifelse}
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \psline(! x ValueTempA sub y ValueTempB sub)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (! x ValueTempA add y ValueTempB add)}}<br>\end{pspicture}<br><br><br><br>\end{document}<br><br><br><br>