Ghostscript – Unrecoverable Error, Exit Code 1 When Drawing pspicture Inside Tabular Environment

auto-pst-pdferrorsghostscriptplot

Here is the code that is giving me this problem. Basically I'm trying to render inside a grid a couple of pictures plotting the beta probability density function for different values of the parameters .

\documentclass[12pt]{book}

\usepackage{pst-func, pst-plot}
\usepackage{auto-pst-pdf}

\begin{document}

\psset{xunit=6cm, yunit=2cm}
\begin{tabular}{c@{\hspace{1.5cm}}c}
    $\text{Figura 1}.\quad \alpha_t=\alpha_h = 0.5$ & $\text{Figura 2}.\quad \alpha_t=\alpha_h = 1$\\[-0.5em]
    \begin{pspicture*}(-1,-1)(1.1,3.1)
    \psaxes[linecolor=black, tickcolor=black, ticksize=3pt -3pt, ticks=all, tickstyle=bottom, Dx=0.1, Dy=0.5, labelFontSize=\scriptstyle]{-}(0,0)(1.005,3.005)
    \psBetaDist[linecolor=red, alpha=0.5, beta=0.5]{0.005}{0.995}
    \end{pspicture*} &
    \begin{pspicture*}(-1,-1)(1.1,3.1)
    \psaxes[linecolor=black, tickcolor=black, ticksize=3pt -3pt, ticks=all, tickstyle=bottom, Dx=0.1, Dy=0.5, labelFontSize=\scriptstyle]{-}(0,0)(1.005,3.005)
    \psBetaDist[linecolor=red, alpha=1, beta=1]{0.005}{0.995}
    \end{pspicture*}\\
    $\text{Figura 3}.\quad \alpha_t=\alpha_h = 4$ & $\text{Figura 4}.\quad \alpha_t=\alpha_h = 7.5$\\[-0.5em]
    \begin{pspicture*}(-1,-1)(1.1,3.1)
    \psaxes[linecolor=black, tickcolor=black, ticksize=3pt -3pt, ticks=all, tickstyle=bottom, Dx=0.1, Dy=0.5, labelFontSize=\scriptstyle]{-}(0,0)(1.005,3.005)
    \psBetaDist[linecolor=red, alpha=4, beta=4]{0.005}{0.995}
    \end{pspicture*} &
    \begin{pspicture*}(-1,-1)(1.1,3.1)
    \psaxes[linecolor=black, tickcolor=black, ticksize=3pt -3pt, ticks=all, tickstyle=bottom, Dx=0.1, Dy=0.5, labelFontSize=\scriptstyle]{-}(0,0)(1.005,3.005)
    \psBetaDist[linecolor=red, alpha=7.5, beta=7.5]{0.005}{0.995}
    \end{pspicture*} \\
    $\text{Figura 5}.\quad \alpha_h= 7, \alpha_t = 3$\\[-0.5em]
    \begin{pspicture*}(-1,-1)(1.1,3.1)
    \psaxes[linecolor=black, tickcolor=black, ticksize=3pt -3pt, ticks=all, tickstyle=bottom, Dx=0.1, Dy=0.5, labelFontSize=\scriptstyle]{-}(0,0)(1.005,3.005)
    \psBetaDist[linecolor=red, alpha=7, beta=3]{0.005}{0.995}
    \end{pspicture*}
\end{tabular}

\end{document} 

On my laptop it compiles correctly with pdflatex + auto-pst-pdf while on my desktop it doesn't work independently of what I'm running, I tried the same as I did on my laptop and to use XeLaTeX, I even tried running it with

pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex

but I'm still out of luck. Every time I compile now all I get is a bunch of errors like this:

GPL Ghostscript 9.53.3: Unrecoverable error, exit code 1

Any idea for possible fixes? TIA.

Best Answer

You corrected file (i.e., using the book document class) typesets fine if you first change the size to \psset{xunit=3cm, yunit=1cm} to fit on a page, and ii)typeset using latex rather than pdflatex so there is no need to use auto-pst-pdf AND MOST IMPORTANT iii)make sure to to run ps2pdf using the -dALLOWPSTRANSPARENCY option for Ghostscript 3.53.

Related Question