[pstricks] pst-pdf and readdata: long compilation time

Antoine Pairet antoine at pairet.be
Sat Apr 25 09:31:03 CEST 2009

Hello!

I use pst-pdf in order to mix PStricks code and jpegs in the same
document. In this document great amount of data is plotted. What I mean
is that large files are read with readdata and then plotted with
PStricks. What I would like to achieve is that data are only read once.

I use a Makefile to handle this compilation scheme:
latex MAIN.tex
dvips -o MAIN-pics.ps MAIN.dvi
ps2pdf MAIN-pics.ps
pdflatex MAIN.tex

This work pretty well but... data are read twice while only used once!
They are read once when doing latex MAIN.tex and a second time with
pdflatex MAIN.tex

The reason for this is that the readdata commands are placed outsite
pspicture environment, they are therefore not ignored when processing
the file with pdflatex. The reason for putting them outside pspicture is
simple: the same data is plotted several times.

\usepackage{pst-pdf}

\begin{document}

\begin{figure}
\begin{pspicture}
\listplot{\dataOne}
\listplot{\dataTwo}
\end{pspicture}
\caption{...}
\end{figure}

\begin{figure}
\begin{pspicture}
\listplot{\dataThree}
\listplot{\dataTwo}
\end{pspicture}
\caption{...}
\end{figure}
\end{document}

In my real life project, I have a file containing all the readdata
commands which is included in the main document with the \input command.
I have tried to use this:
\ifpdf

\else
\fi
Data are only read once, but the second run fails because LaTeX
! Undefined control sequence.
<argument> \dataOne

I also tried to this:

but then, all the begin{figure} env. rise errors.

Is there a proper manner to handle this problem?
Any help is appreciated.

regards,

Antoine Pairet
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://tug.org/pipermail/pstricks/attachments/20090425/fff37545/attachment.bin