I am writing a mathematics book that makes use of a huge number of PSTricks pictures.
For the sake of re-usability and maintaining separation of concern, I always put the self-contained PSTricks code in a separate .tex file. The following code shows an example of self-contained PSTricks input file:
% gridon.tex
\documentclass{minimal}
\usepackage{pstricks}
\pagestyle{empty}
\begin{document}
\begin{pspicture}[showgrid=true](4,3)
\end{pspicture}
\end{document}
Then I compile the gridon.tex using the following batch file to produce gridon.eps.
latex %1.tex
dvips -R %1.dvi
ps2pdf -dCompatibilityLevel#1.5 -dPDFSETTINGS#/prepress %1.ps %1-temp.pdf
pdfcrop --restricted --hires %1-temp.pdf %1.pdf
pdftops -eps %1.pdf %1.eps
From my main .tex file, I will then import the gridon.eps as follows
% main.tex
\documentclass{minimal}
\usepackage[hiresbb]{graphicx}
\usepackage{pst-node}
\begin{document}
\includegraphics[scale=2]{gridon}
\vspace{5mm}
I am \rnode[tl]{A}{xport} not \rnode[tr]{B}{xpert}.
\ncarc[angle=90,linecolor=blue,arrows=<->]{A}{B}
\end{document}
Note that in the main.tex file I also have inline PSTricks codes in between the text so I cannot put them in separate files. The main input file is then compiled using latex->dvips->ps2pdf.
How to manage a document with a huge number of PSTricks figures?
latex->dvips->ps2pdfsequence. I have more than 1000 PSTricks images in a book which I write out as external documents, run it vis a makefile and insert them all as a pdf.