# auto-pst-pdf produces a confusing error message

Actually I don't want to use auto-pst-pdf forever. But Harish Kumar (in his comment) requested to use it for the sake of simplicity. I tried it several decades ago and it did not work. The MWE below is the example I tried and failed.

\documentclass[pstricks]{standalone}
\usepackage{pst-plot}
\usepackage{auto-pst-pdf}
\psset
{
unit=\psrunit,
polarplot,
algebraic=true,
plotpoints=1000,
}

\begin{document}
\multido{\i=1+1}{25}{%
\begin{pspicture}(-3,-3)(3,3)
\pscircle[linestyle=dashed](0,0){2}
\psplot[linecolor=red]{0}{TwoPi}{2+.5*cos(\i*x)}
\end{pspicture}}
\end{document}
• it compiles fine if you change standalone to article; as such, perhaps add the standalone tag to your question – cmhughes Nov 18 '12 at 1:51
• several decades ago... Just how old are you really? ;) – hpesoj626 Nov 19 '12 at 8:42
• What error message do you actually get? (I got The program 'pdflatex' is currently not installed. but that's a different reason ;-) ) – Martin Scharrer Nov 19 '12 at 21:37
• One workaround to use pstricks in pdflatex mode is to \usepackage[pdf]{pstricks}. So,auto-pst-pdf is automatically included, thereby pstricks in the standalone document class options can be removed. Finally preamble looks like \usepackage[pdf]{pstricks} would come first, then add ons \usepackage{pst-plot} and no need for \usepackage{auto-pst-pdf}. This works well for me.BTW if you kindly post 'confusing error message' in the question it would help others. – texenthusiast Dec 30 '12 at 4:32
• You always should add the error message you get to the question. Also please state what exactly you want to achieve. You want to get a multi-page PDF where every page contains a single step of the animation, right? – Martin Scharrer Jan 1 '13 at 11:15

the documentclass standalone cannot work together with the auto-pst-pdf package and the [pstricks] option for standalone. Use

\documentclass{standalone}
\usepackage{pst-plot}
\usepackage{auto-pst-pdf}
\psset{%
polarplot,
algebraic,
plotpoints=1000}

\begin{document}
\multido{\i=1+1}{25}{%
\begin{pspicture}(-3,-3)(3,3)
\pscircle[linestyle=dashed](0,0){2}
\psplot[linecolor=red]{0}{TwoPi}{2+.5*cos(\i*x)}
\end{pspicture}}
\end{document}

However, it makes no sense to use standalone and auto-pst-pdf together.

As Herbert already mentions in his answer, the pstricks option of standalone doesn't work with auto-pst-pdf. Both seem to redefine the pspicture environment in an incompatible way. This makes perfectly sense because both try to due basically the same thing: create one page for every pspicture.

In order to make both work together remove the pstricks option (which loads pstricks and sets pspicture as a "multi environment") and add an additional environment to let standalone create multiple pages:

\documentclass[multi=multipage]{standalone}
\usepackage{pst-plot}
\usepackage{auto-pst-pdf}
\psset{%
polarplot,
algebraic,
plotpoints=1000}

\begin{document}
\multido{\i=1+1}{25}{%
\begin{multipage}
\begin{pspicture}(-3,-3)(3,3)
\pscircle[linestyle=dashed](0,0){2}
\psplot[linecolor=red]{0}{TwoPi}{2+.5*cos(\i*x)}
\end{pspicture}
\end{multipage}
}
\end{document}

However, in this case file.pdf is basically identical to file-pics.pdf anyway and therefore you don't need to use standalone at all. Simply use a document like this and use file-pics.pdf directly. I assume here that what you want it a multi-page PDF which contains one step at every page.

\documentclass{article}
\usepackage{pst-plot}
\usepackage{auto-pst-pdf}
\psset{%
polarplot,
algebraic,
plotpoints=1000}

\begin{document}
\multido{\i=1+1}{25}{%
\begin{pspicture}(-3,-3)(3,3)
\pscircle[linestyle=dashed](0,0){2}
\psplot[linecolor=red]{0}{TwoPi}{2+.5*cos(\i*x)}
\end{pspicture}
}
\end{document}