[pstricks] how to convert pstricks to eps?

Herbert Voss Herbert.Voss at alumni.TU-Berlin.DE
Tue Dec 14 18:05:01 CET 2004


bear wrote:

>     Pstricks is nice but I have a problem
>     I dont want to run latex every time to generate a figure written with pstricks
> in my document, but to save it to a eps file. How to let the the geometry fit well
> in document?
> Below is my pstricks. The problem is that it is a4paper in size and cannot too
> large to embed in my document. can I save it just in the size of the figure
> alone?

you can save it on the fly, but it is a bit difficult to
get the right bounding box. Another way is to use ps4pdf
and save all images as eps.

You have to delete the images by hand  when you want to create
new ones.

Herbert



\documentclass[10pt,a4paper]{article}
\usepackage{graphicx}
\usepackage{multido,pstricks}
\usepackage{pst-eps}
\def\particle#1#2{%
   \pscircle[fillstyle=solid,fillcolor=black](#1,#2){2pt} %particle
 
\pscircle[linestyle=dotted,dotsep=1.5pt,linewidth=0.5pt,linecolor=gray](#1,#2){6pt}}
\psset{linewidth=2pt}
\begin{document}
\PSTtoEPS[bbllx=-1cm,bblly=-1cm,bburx=7cm,bbury=7cm]{image1.eps}{%
   \begin{pspicture}(-1,-0.5)(7,7)
     \psframe[linecolor=white](-1,-0.5)(7,7)
 
\psgrid[subgriddiv=0,griddots=10,gridlabels=0,gridcolor=lightgray](0,0)(6,6)%grid
     \psline[linewidth=1.5pt]{-}(-1,6)(7,6) %boundary
     \psdots[dotscale=1,dotstyle=o,fillstyle=solid,fillcolor=red](3,6.5) 
  %photon
     \psline[linewidth=0.5pt]{->}(3,6.5)(3,5.5) %direction
     \multido{\ia=0+1}{7}{%
       \multido{\ib=0+1}{7}{\particle{\ia}{\ib}}}
   \end{pspicture}
}
\hspace{30pt}%
\PSTtoEPS[bbllx=-1cm,bblly=-1cm,bburx=7cm,bbury=7cm]{image2.eps}{%
   \begin{pspicture}(7,7)
 
\psgrid[subgriddiv=0,griddots=10,gridlabels=0,gridcolor=lightgray](0,0)(6,6)%grid
     \psline[linewidth=1.5pt]{-}(-1,6)(7,6) %boundary
     \psdots[dotscale=1,dotstyle=o,fillstyle=solid,fillcolor=red](3,6.5) 
  %photon
     \psline[linewidth=0.5pt]{->}(3,6.5)(3,5.5) %direction
%    \input{rs.data}
   \end{pspicture}
}

\fbox{\includegraphics{image1}}
\fbox{\includegraphics{image2}}

\end{document}



-- 
http://TeXnik.de/
http://PSTricks.de/
ftp://ftp.dante.de/tex-archive/info/math/voss/Voss-Mathmode.pdf
http://www.dante.de/faq/de-tex-faq/
http://www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes




More information about the PSTricks mailing list