7

enter image description here

The following code is taken from Gonzalo Medina' answer here (click). At the time he posted the answer the code was compilable.

\documentclass{beamer}
\usepackage{pstricks-add}
\usepackage[active,tightpage]{preview}
\PreviewBorder=0pt
\PreviewEnvironment{pspicture}

\begin{document}

\begin{frame}
    \begin{pspicture}(6,6)
        \pnode(0,0){A}
        \pnode(6,0){B}
        \pnode(6,6){C}
        \pnode(0,6){D}
        \pnode(1,1){P}
        \pnode(5,1){Q}
        \pnode(3,5){R}
        \only<5>{\psclip{\pscircle[linestyle=none,dimen=middle](3,3){3}}}
        \only<1->{\pspolygon*[linecolor=red](A)(B)(Q)(P)}
        \only<2->{\pspolygon*[linecolor=green](B)(C)(R)(Q)}
        \only<3->{\pspolygon*[linecolor=blue](C)(D)(R)}
        \only<4->{\pspolygon*[linecolor=yellow](D)(A)(P)(R)}
       \only<5>{\endpsclip}
     \end{pspicture}
\end{frame}

\end{document}

enter image description here

But now, the same code is no longer compilable with error /typecheck in --div--.

Actually, I want to compile the following code but the same error also occurs. What is wrong?

\documentclass{beamer}
\usepackage{pstricks}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{pspicture}
\PreviewBorder=12pt\relax


\begin{document}

\begin{frame}{Test}
\psset{unit=.5cm,runit=.5cm}
\begin{pspicture}[showgrid=top](-7.5,-7.5)(7.5,7.5)
\pstVerb
{   
    %true setglobal
    %globaldict begin
    /c40 {40 cos} bind def
    /s40 {40 sin} bind def
    /s65 {6 5 s40 mul add} bind def
    %end
    %false setglobal
}
\pscircle[linecolor=blue]{8}
\pscustom[fillstyle=solid,fillcolor=black!20]{%
  \only<1->{\psarc(0,0){5}{40}{! 180 0.3 ATAN1 sub }}
  \only<2->{\psline(! 37.5 c40 mul s65 div 1.5)(! 32.5 c40 mul s65 div 0.5)}
  \only<3->{\psarc(0,0){5}{!180 0.1 ATAN1 sub}{!180 0.1 ATAN1 add}}
  \only<4->{\psline(! 27.5 c40 mul s65 div -0.5)(! 22.5 c40 mul s65 div -1.5)}
  \only<5->{\psarc(0,0){5}{!180 0.3 ATAN1 add}{320}}
  \only<6->{\psarcn(0,0){6}{! 270 5 c40 mul 36 25 c40 dup mul mul sub sqrt div ATAN1 add }{! 270 0.25 Acos sub }}
  \only<7->{\psline(-7.5,-1.5)(!5 c40 mul s65 div 7.5 sub -0.5)}
  \only<8->{\psarcn(0,0){6}{!180 1 12 atan add}{!180 1 12 atan sub}}
  \only<9->{\psline(-7.5,0.5)(! 5 c40 mul s65 div 7.5 sub 1.5)}
  \only<10->{\psarcn(0,0){6}{!180 1.5 6 atan sub}{! 1 c40 div 10 div 36 25 10 sin mul sub 60 s40 mul add mul s65 div ATAN1}}
  \only<11->{\closepath}
}
\end{pspicture}
\end{frame}
\end{document}

Forensic trace record

The last success of compiling the code was on July 29, 2012 and the last update of preview is in 2010. So preview can be removed from the list of candidates causing this problem. pstricks and beamer are left, but which one is the source of problem?

  • You may take a look at an older question of mine. Maybe it can help you. – Adam B. Jul 23 '14 at 7:41
  • From what I remember when I had this problem (in May), I compared the postscript files produced with the texlive2013 iso version (working) and the updated version (not working). There was much more code in the not working postscript file, and an undefined a variable causing the --div-- error also appeared. – Adam B. Jul 24 '14 at 7:52
  • 1
    older version of pgf/TikZ ... – user2478 Jul 29 '14 at 6:52
  • 1
    see my extended answer ... – user2478 Jul 29 '14 at 11:29
6
+1000

The problem is in pgf (file pgfutil-latex) with the redefinition of preview's shipout which causes a problem in the created dvi/ps file. It creates always two pages instead of one. However, here is a workaround:

\listfiles
\documentclass{minimal}
\usepackage{auto-pst-pdf}
\makeatletter
\let\Test@pr@shipout\pr@shipout%% save the original definition
\let\Test@shipout\shipout
\makeatother
\usepackage{tikz}
\makeatletter
\AtBeginDocument{%
  \let\pr@shipout\Test@pr@shipout%% restore it 
  \let\shipout\Test@shipout
}
\makeatother
\usepackage{pstricks}

\begin{document}
X
\begin{pspicture}[showgrid=false](6,6)
\psline(6,6)
\rput*(3,3){foo}
\end{pspicture}
X
\end{document}

See also https://sourceforge.net/p/pgf/bugs/315/

3

Based on my answer to my question, the following code does what you want (at least with texlive2013 last updated in may or so)

\documentclass[beamer,pstricks]{standalone}
\usepackage{etex}

\def\myxmin{-7.5}%
\def\myymin{-7.5}%
\def\myxmax{7.5}%
\def\myymax{7.5}%

\newlength{\pspicwidth}
\newlength{\pspicheight}
\newlength{\border}
\setlength{\border}{12pt}%


\psset{unit=.5cm,runit=.5cm}
\setlength{\pspicwidth}{\dimexpr \myxmax\psxunit -\myxmin\psxunit + 2\border\relax}
\setlength{\pspicheight}{\dimexpr \myymax\psxunit -\myymin\psxunit +2\border\relax}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Set the frame size to the pspicture size %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\geometry{%
  paperheight=\pspicheight,%
  paperwidth=\pspicwidth,
  left=0cm,right=0cm,%
  bottom=0cm,top=0cm}


\begin{document}
\begin{standaloneframe}
  \hspace{\border}%
  \vspace{-\border}%
  \begin{pspicture}[showgrid=top](\myxmin,\myymin)(\myxmax,\myymax)
    \pstVerb
        {   
          %true setglobal
          %globaldict begin
          /c40 {40 cos} bind def
          /s40 {40 sin} bind def
          /s65 {6 5 s40 mul add} bind def
          %end
          %false setglobal
        }
        \pscircle[linecolor=blue]{8}
        \pscustom[fillstyle=solid,fillcolor=black!20]{%
          \only<1->{\psarc(0,0){5}{40}{! 180 0.3 ATAN1 sub }}
          \only<2->{\psline(! 37.5 c40 mul s65 div 1.5)(! 32.5 c40 mul s65 div 0.5)}
          \only<3->{\psarc(0,0){5}{!180 0.1 ATAN1 sub}{!180 0.1 ATAN1 add}}
          \only<4->{\psline(! 27.5 c40 mul s65 div -0.5)(! 22.5 c40 mul s65 div -1.5)}
          \only<5->{\psarc(0,0){5}{!180 0.3 ATAN1 add}{320}}
          \only<6->{\psarcn(0,0){6}{! 270 5 c40 mul 36 25 c40 dup mul mul sub sqrt div ATAN1 add }{! 270 0.25 Acos sub }}
          \only<7->{\psline(-7.5,-1.5)(!5 c40 mul s65 div 7.5 sub -0.5)}
          \only<8->{\psarcn(0,0){6}{!180 1 12 atan add}{!180 1 12 atan sub}}
          \only<9->{\psline(-7.5,0.5)(! 5 c40 mul s65 div 7.5 sub 1.5)}
          \only<10->{\psarcn(0,0){6}{!180 1.5 6 atan sub}{! 1 c40 div 10 div 36 25 10 sin mul sub 60 s40 mul add mul s65 div ATAN1}}
          \only<11->{\closepath}
        }
  \end{pspicture}
\end{standaloneframe}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.