Conflict between packages auto-pst-pdf and minted?

I have tried to create a document using the pdfLaTeX engine which includes graphics generated by PSTricks and resorts to the package auto-pst-pdf. Everything went right until I used the package minted; as soon as this was included, auto-pst-pdf could not create the -autopp.dvi file and the ensuing -pics.pdf file. Everything about the package minted seems to go right either with or without including auto-pst-pdf, so it seems to me that the latter has some conflict with the former. Anyone knows what is going on here?

Thanks so much for your attention and assistance.

I am appending an MWE right below as suggested by texlearner:

\documentclass[12pt]{memoir}

\usepackage{pstricks}
\usepackage{auto-pst-pdf}
%\usepackage{minted}

\pagestyle{empty}

\begin{document}

\begin{postscript}
\psset{fillstyle=solid}
\psscalebox{0.75}{%
\begin{pspicture}(-5.25,-5.25)(5.25,5.25)%
\pscircle*[linecolor=cyan]{5}
\psgrid[subgriddiv=0,gridcolor=lightgray,gridlabels=0pt]
\Huge\sffamily\bfseries
\rput(-4.5,4.5){A} \rput(4.5,4.5){B}
\rput(-4.5,-4.5){C}\rput(4.5,-4.5){D}
\rput(0,0){auto-pst-pdf}
\rmfamily
\rput(0,-3.8){PSTricks}
\rput(0,3.8){\LaTeX}
\end{pspicture}}
\end{postscript}

\end{document}


With WinEdt 6.0 and on MikTeX 2.9, as long as the inclusion of minted is commented, pdflatex with -shell-escape generates the corresponding one-page long PDF. As soon as minted is effectively included, no PDF is created.

Herbert has provided an answer (to be found below) which solves the problem in what minted is concerned. Nonetheless, I have found a strange behavior when some PSTricks-based packages are included jointly with the base package pstricks. As an MWE let me suggest the following code:

    \documentclass[12pt]{memoir}

\usepackage{ifpdf}
\ifpdf
\usepackage{minted}
\usemintedstyle{friendly}
\newminted{latex}{linenos=true,mathescape}
\else
pst-gantt,pst-eucl,pst-3d,pst-solides3d,pst-lens,
pst-coxeterp,pst-coxcoor,pst-rubans,pst-eps,
pst-dbicons,pst-light3d,pst-tree,pst-sigsys,
pst-text,pst-slpe}
\fi

\usepackage{auto-pst-pdf}

\newcommand{\pstricksplot}{%
\begin{postscript}
\psset{fillstyle=solid}
\psscalebox{0.75}{%
\begin{pspicture}(-5.25,-5.25)(5.25,5.25)%
\pscircle*[linecolor=cyan]{5}
\psgrid[subgriddiv=0,gridcolor=lightgray,gridlabels=0pt]
\Huge\sffamily\bfseries
\rput(-4.5,4.5){A} \rput(4.5,4.5){B}
\rput(-4.5,-4.5){C}\rput(4.5,-4.5){D}
\rput(0,0){auto-pst-pdf}
\rmfamily
\rput(0,-3.8){PSTricks}
\rput(0,3.8){\LaTeX}
\end{pspicture}}
\end{postscript}
}

\pagestyle{empty}

\begin{document}

\pstricksplot

A few lines with minted:

\begin{latexcode}
\psplot[linecolor=#1,plotstyle=curve,
linewidth=1.25\pslinewidth,linestyle=#2,
plotpoints=10000]{#3}{#4}{1 div x #5\space mul #6\space add}
% Parameter 5 is the resonance frequency  $\omega_0=\frac{1}{\sqrt{LC}}\,\cdot$
% Parameter 6 is the time constant $\tau=RC\,.$
\end{latexcode}

The same PSTricks code as above the minted'' lines.

\pstricksplot

\end{document}


Now, the strange behavior is related to the inclusion of any of the packages pstricks-add, pst-optexp, pst-optic, pst-plot, pst-3dplot. I have included the PSTricks-based packages in two different bunches in order to emphasize this point: if I comment the corresponding line, everything goes fine; but if they are effectively included, the command \pstricksplot right above the end of the document does not lead to a graphic in the PDF. I use graphics intensively and PSTricks has proved most convenient for my needs, hence my including all those pst- packages.

Thanks so much for your assistance and attention.

-
As such there is no known issues regarding the auto-pst-pdf mentioned in the package userguide at ctan.org ctan.org/tex-archive/macros/latex/contrib/auto-pst-pdf May be report the bug to the author of the package Will Robertson. Also post a minimum working example(MWE) to make sure its due to auto-pst-pdf and minted conflict. –  texenthusiast Jun 26 '12 at 2:16
Dear texlearner, thanks so much for your reply. I am appending a MWE. On WinEdt 6.0 and with MikTeX 2.9 it generates a 1 page pdf if minted is not included, but none if it is. The inclusion of minted is commmented in the LaTeX code below. –  Marcos Jun 26 '12 at 2:27
can you please mark herbert's reply as answer if it satisfies your original question. you can always get more answers as many people visit –  texenthusiast Jun 26 '12 at 11:12
Done. Thanks for letting me know about this. It is my first "active" time around... –  Marcos Jun 26 '12 at 11:38

use it this way:

\documentclass[12pt]{memoir}
\usepackage{ifpdf}
\usepackage{auto-pst-pdf}
\ifpdf
\usepackage{minted}
\usemintedstyle{friendly}
\newminted{latex}{linenos=true,mathescape}
\else
\fi
\pagestyle{empty}

\begin{document}
\begin{postscript}
\psset{fillstyle=solid}
\psscalebox{0.75}{%
\begin{pspicture}(-5.25,-5.25)(5.25,5.25)%
\pscircle*[linecolor=cyan]{5}
\psgrid[subgriddiv=0,gridcolor=lightgray,gridlabels=0pt]
\Huge\sffamily\bfseries
\rput(-4.5,4.5){A} \rput(4.5,4.5){B}
\rput(-4.5,-4.5){C}\rput(4.5,-4.5){D}
\rput(0,0){auto-pst-pdf}
\rmfamily
\rput(0,-3.8){PSTricks}
\rput(0,3.8){\LaTeX}
\end{pspicture}}
\end{postscript}

and now the minted part:

\ifpdf
\begin{latexcode}
\psplot[linecolor=#1,plotstyle=curve,
linewidth=1.25\pslinewidth,linestyle=#2,
plotpoints=10000]{#3}{#4}{1 div x #5\space mul #6\space add}
% Parameter 5 is the resonance frequency  $\omega_0=\frac{1}{\sqrt{LC}}\,\cdot$
% Parameter 6 is the time constant $\tau=RC\,.$
\end{latexcode}
\fi

\end{document}

-
Dear Herbert, thanks so much for your reply. This seemed to solve the problem in what minted was concerned, but then I found out that there was a problem when I tried to include more PSTricks-based packages. Simply including pstricks-add together with pstricks makes that a LaTeX command that has been defined in the preamble and that includes only a pspicture environment is obliterated after a minted environment has been compiled. That is, there is no corresponding picture in the pdf. I could append a MWE, but I'm not sure about how to do it otherwise than by editing my original question. –  Marcos Jun 26 '12 at 9:14
@Marcos: edit your original question or extend it. –  Herbert Jun 26 '12 at 9:29
@Marcos: see my edit. And by the way: it is totally nonsense to load all packages you are knowing. And, of course, pstricks-add should always be the last PSTricks related package. –  Herbert Jun 26 '12 at 11:07
@Marcos: loading all of your listed packages, my example will also work. –  Herbert Jun 26 '12 at 11:13
Thanks so much again. I have checked and, sure, it is the answer. I am still trying to see what is going on with hyperref. I am loading all those pst- packages because, except for two of those included, I really need them for the document I am working on. –  Marcos Jun 26 '12 at 11:40