我的旧版 PSTricks 代码不再可编译

我的旧版 PSTricks 代码不再可编译

以下代码几年前可以运行,但现在不行了。我失去了意识,可能陷入了代沟。我尝试使用lualatexlatex->dvips->ps2pdf序列进行编译,但结果出现错误。

\documentclass{beamer}
\usepackage{pstricks}

\usepackage[active,tightpage]{preview}
\PreviewEnvironment{pspicture}
\PreviewBorder=1cm\relax

\usepackage{graphicx}

\def\RightPart
{
    \only<+->{\psline(0.5,2.7)(!6.5 3.5 82 eP2C)}
    \only<+->{\psbezier(1.2,1.3)(1.3,1.0)(2.0,1.0)}
    \only<+->{\psbezier(3.0,1.0)(3.0,2.2)(!6.5 3.5 73 eP2C)}
    \only<+->{\psellipticarcn(6.5,3.5){(!6.5 3.5 73 eP2C)}{(!6.5 3.5 73 neg eP2C)}}
    \only<+->{\psbezier(4,-2)(4,0)(2.2,-1.8)}
    \only<+->{\psbezier(1.5,-1)(1,-1)(!6.5 3.5 -90 eP2C)}
}

\def\LeftPart
{
        \only<+->{\psbezier(1,-1)(1.5,-1)(2.2,-1.8)}  
        \only<+->{\psbezier(4,0)(4,-2)(!6.5 3.5 73 neg eP2C)}    
        \only<+->{\psellipticarc(6.5,3.5){(!6.5 3.5 73 neg eP2C)}}{(!6.5 3.5 73 eP2C)} 
        \only<+->{\psbezier(3.0,2.2)(3.0,1.0)(2.0,1.0)}
        \only<+->{\psbezier(1.3,1.0)(1.2,1.3)(!6.5 3.5 82 eP2C)}
    \only<+->{\psline(0.5,2.7)}
        \only<+->{\closepath}
}

\begin{document}
\begin{frame}{Test}
\begin{pspicture}[showgrid=false](-7,-4)(7,4)
\pstVerb{/eP2C {PtoCab} def}%
%\psclip{%
\pscustom[dimen=m,linewidth=4\pslinewidth]
{
    \only<+->{\RightPart}
  \code{-1 1 scale}
  \LeftPart
    \only<+->{\fill[fillcolor=yellow,fillstyle=solid]}
}%}
\only<+->{\rput(0,0){\parbox{12cm}{\centering \bf\fontsize{15pt}{15pt}\selectfont Entity Framework Core  \\ Happy Coding}}}
%\only<+->{\rput(-2.5,-.75){\includegraphics[scale=2.2]{parents}}}%
%\endpsclip
\end{pspicture}
\end{frame}
\end{document}
  • 编译时出现错误latex-dvips-ps2pdf项目清单

  • 编译时出现错误lualatex在此处输入图片描述

注意:为了方便起见,我故意将错误以图像形式发送。

答案1

preview 尚未适配当前的 LaTeX,并且会阻塞一些钩子。您可以尝试清空钩子。对于 lualatex,您还应该加载图片中的 pro-file:

\documentclass{beamer}
\usepackage{pstricks}

\usepackage[active,tightpage]{preview}
\PreviewEnvironment{pspicture}
\PreviewBorder=1cm\relax

\RemoveFromHook{shipout/firstpage}[hyperref]
\RemoveFromHook{shipout/before}[hyperref]
\RemoveFromHook{shipout/before}[beamerbasenavigation]

\usepackage{graphicx}

\def\RightPart
{
    \only<+->{\psline(0.5,2.7)(!6.5 3.5 82 eP2C)}
    \only<+->{\psbezier(1.2,1.3)(1.3,1.0)(2.0,1.0)}
    \only<+->{\psbezier(3.0,1.0)(3.0,2.2)(!6.5 3.5 73 eP2C)}
    \only<+->{\psellipticarcn(6.5,3.5){(!6.5 3.5 73 eP2C)}{(!6.5 3.5 73 neg eP2C)}}
    \only<+->{\psbezier(4,-2)(4,0)(2.2,-1.8)}
    \only<+->{\psbezier(1.5,-1)(1,-1)(!6.5 3.5 -90 eP2C)}
}

\def\LeftPart
{
        \only<+->{\psbezier(1,-1)(1.5,-1)(2.2,-1.8)}
        \only<+->{\psbezier(4,0)(4,-2)(!6.5 3.5 73 neg eP2C)}
        \only<+->{\psellipticarc(6.5,3.5){(!6.5 3.5 73 neg eP2C)}}{(!6.5 3.5 73 eP2C)}
        \only<+->{\psbezier(3.0,2.2)(3.0,1.0)(2.0,1.0)}
        \only<+->{\psbezier(1.3,1.0)(1.2,1.3)(!6.5 3.5 82 eP2C)}
    \only<+->{\psline(0.5,2.7)}
        \only<+->{\closepath}
}

\begin{document}
\begin{frame}{Test}
\begin{pspicture}[showgrid=false](-7,-4)(7,4)
\pstheader{pstricks.pro} % for luatex
\pstVerb{/eP2C {PtoCab} def}%
%\psclip{%
\pscustom[dimen=m,linewidth=4\pslinewidth]
{
    \only<+->{\RightPart}
  \code{-1 1 scale}
  \LeftPart
    \only<+->{\fill[fillcolor=yellow,fillstyle=solid]}
}%}
\only<+->{\rput(0,0){\parbox{12cm}{\centering \bf\fontsize{15pt}{15pt}\selectfont Entity Framework Core  \\ Happy Coding}}}
%\only<+->{\rput(-2.5,-.75){\includegraphics[scale=2.2]{parents}}}%
%\endpsclip
\end{pspicture}
\end{frame}
\end{document}

相关内容