PSTricks 绘图:LuaLaTeX 给出意外的输出

PSTricks 绘图:LuaLaTeX 给出意外的输出

代码

请考虑以下示例:

\documentclass{article}

\usepackage{multido}
\usepackage{pstricks}

\begin{document}

\begin{figure}
% https://tex.stackexchange.com/questions/114278/isometric-paper-and-drawing-on-it-with-pstricks
\centering
 \psset{
   linejoin = 2
 }
 \SpecialCoor
  \begin{pspicture*}(-0.5,-2)(10,8.5)
    \pstVerb{gsave [\fpeval{sqrt(3)/2} 0.5 0 1 0 -400] concat}
   {\psset{
      linewidth = 0.3pt,
      linecolor = black!50
    }
     \multido
       {\i = 0+1}
       {25}
       {\psline(\i,-4)(\i,20)
        \psline(!-5 \i\space 10 sub)(!20 \i\space 10 sub)
        \rput(!0 \i\space 15 sub){\psline(0,0)(!\i\space abs dup add dup)}}
   }
   {\psset{
      linewidth = 2pt
    }
    \pspolygon(8,2)(8,6)(11,9)(11,5)
    \pspolygon(1,2)(1,6)(8,6)(8,2)
    \pspolygon(1,6)(2.5,9.5)(9.5,9.5)(8,6)
    \psline(11,9)(9.5,9.5)
   {\psset{
      linestyle = dashed
    }
    \pspolygon(4,5)(4,9)(11,9)(11,5)
    \pspolygon(1,6)(4,9)(4,5)(1,2)
    \psline(4,9)(2.5,9.5)
    \pstVerb{grestore}
   }
   }
  \end{pspicture*}
\end{figure}

\end{document}

输出

当我使用进行编译时,lualatex我收到以下错误输出:

错误的

但是,当我使用latex--> dvips-->进行编译时ps2pdf -dALLOWPSTRANSPARENCY,我得到以下正确输出:

正确的

问题

我如何使用进行编译lualatex并获得正确的输出?

答案1

在我们找到更好的(自动)解决方案之前,请按以下方式使用:

\DocumentMetadata{}
\documentclass{article}
\usepackage{multido}
\usepackage{pstricks}

\begin{document}
    
\begin{pspicture*}[showgrid](-2,-4)(10,12)
\ifPSTlualatex
  \pstVerb{ gsave [60 sin -0.5 0 1 0 100] concat }%
\else
  \pstVerb{ gsave [60 sin 0.5 0 1 0 -400] concat }%
\fi
{\psset{linewidth = 0.3pt,linecolor = black!50}%
    \multido{\i = 0+1}{25}{%
        \psline(\i,-4)(\i,20)
        \psline(!-5 \i\space 10 sub)(!20 \i\space 10 sub)
        \rput(!0 \i\space 15 sub){\psline(0,0)(!\i\space abs dup add dup)}}
}%
\psset{linewidth = 2pt}
\pspolygon(8,2)(8,6)(11,9)(11,5)
\pspolygon(1,2)(1,6)(8,6)(8,2)
\pspolygon(1,6)(2.5,9.5)(9.5,9.5)(8,6)
\psline(11,9)(9.5,9.5)
\psset{linestyle = dashed}
\pspolygon(4,5)(4,9)(11,9)(11,5)
\pspolygon(1,6)(4,9)(4,5)(1,2)
\psline(4,9)(2.5,9.5)
\psdot[dotscale=3](5,5)
\pspolygon[linecolor=red](1,1)(10,10)(10,0)(0,10)(0,0)
\pstVerb{grestore}
\end{pspicture*}

\end{document}

在此处输入图片描述

相关内容