[Tex/LaTex] PSTricks and LaTeX vs. pdfLaTeX

pdftexpstricksshell-escape

I'm trying to convert my thesis to pdfLaTeX, as latex + dvips behaves ugly when it comes to break (really long) URLs… I'm using up-to-date TeXLive 2012 on Linux.

The only problem is (so far), that I heavily used pstricks and the related packages and I am not able to get them working nicely on pdfLaTeX (see my pictures) when interacting between different pspicture-environments (also using this sometime to have text directly related to pictures underneath):


latex + dvips + ps2pdf (gs)

latex


pdflatex (arrow is missing)

pdflatex


Code for the example above:

\documentclass[12pt]{scrbook}   
\PassOptionsToPackage{pdf}{pstricks} %used for pdflatex
\usepackage{pstricks,pst-plot,pst-node,pst-func}

\begin{document}

\begin{pspicture}(-1.5,0)(1.5,4)
    \psTextFrame[ref=c,linestyle=none](-1.5,3)(1.5,4){First Plot}
    \psplot[fillcolor=blue!30,fillstyle=solid,opacity=0.5]{-1.5}{1.5}{x 0 0.3 GAUSS}
    \psaxes[labels=none,ticks=none]{->}(-1.5,0)(1.5,3)
    \pnode(1.5,0.5){A}
\end{pspicture}
\vspace{5mm}
\begin{pspicture}(-1.5,0)(1.5,4)
    \psTextFrame[ref=c,linestyle=none](-1.5,3)(1.5,4){Second Plot}
    \psplot[fillcolor=blue!30,fillstyle=solid,opacity=0.5]{-1.5}{1.5}{x 0 0.6 GAUSS}
    \psaxes[labels=none,ticks=none]{->}(-1.5,0)(1.5,3)
    \pnode(1.5,0.5){B}
    \nccurve{->}{A}{B}
\end{pspicture}

\end{document}

Best Answer

Several pspictureenvironments as paragraphs can be encapsulated by the postscript environment:

\documentclass[12pt]{scrbook}   
\PassOptionsToPackage{pdf}{pstricks} %used for pdflatex
\usepackage{pstricks,pst-plot,pst-node,pst-func}

\begin{document}

\begin{postscript}%%%%%%%%%%%%%%
\begin{pspicture}(-1.5,0)(1.5,4)
    \psTextFrame[ref=c,linestyle=none](-1.5,3)(1.5,4){First Plot}
    \psplot[fillcolor=blue!30,fillstyle=solid,opacity=0.5]{-1.5}{1.5}{x 0 0.3 GAUSS}
    \psaxes[labels=none,ticks=none]{->}(-1.5,0)(1.5,3)
    \pnode(1.5,0.5){A}
\end{pspicture}

\begin{pspicture}(-1.5,0)(1.5,4)
    \psTextFrame[ref=c,linestyle=none](-1.5,3)(1.5,4){Second Plot}
    \psplot[fillcolor=blue!30,fillstyle=solid,opacity=0.5]{-1.5}{1.5}{x 0 0.6 GAUSS}
    \psaxes[labels=none,ticks=none]{->}(-1.5,0)(1.5,3)
    \pnode(1.5,0.5){B}
    \nccurve{->}{A}{B}
\end{pspicture}
\end{postscript}%%%%%%%%%%%%%%

\end{document}

that will be handled as a single image. My pdflatex output:

enter image description here

Inside the postscript environment can be anything, except a pagebreak. It will always be handled as a graphic which is saved in <file>-pics.pdf, one page per image (if you have more environments).