LuaLatex에서 \psframe을 작동시키는 방법은 무엇입니까?

LuaLatex에서 \psframe을 작동시키는 방법은 무엇입니까?

Overlef에서 아래 코드를 컴파일하려고 할 때 로 설정하면 오류가 발생 LuaLaTeX하지만 LaTeX Engine로 설정하면 오류가 발생하지 않습니다 Choose Automatically.

\documentclass[a4paper,10pt]{book}

\usepackage{pst-electricfield,multido} % campos elétricos

\begin{document}

\begin{pspicture*}(-6,-6)(6,6)
 \psframe*[linecolor=lightgray!50](-6,-6)(6,6)
 \psgrid[subgriddiv=0,gridcolor=gray,griddots=10]
 \psElectricfield[Q={[-1 -2 2][1 2 2][-1 2 -2][1 -2 -2]},linecolor=red]
 \psEquipotential[Q={[-1 -2 2][1 2 2][-1 2 -2][1 -2 -2]},linecolor=blue](-6.1,-6.1)(6.1,6.1)
 \psEquipotential[Q={[-1 -2 2][1 2 2][-1 2 -2][1 -2 -2]}, linecolor=green, linewidth=2\pslinewidth, Vmax=0, Vmin=0](-6.1,-6.1)(6.1,6.1)
\end{pspicture*}

\end{document}

내가 얻는 오류는 다음과 같습니다.

./main.tex:8: Undefined control sequence.
<recently read> \c@lor@to@ps          
l.8  \psframe*[linecolor=lightgray!50](-6,-6)(6,6)
Here is how much of LuaTeX's memory you used:  8148 strings out of 494688 ...

답변1

다음으로 실행 lualatex --shell-escape <file>:

\documentclass[a4paper,10pt]{book}
\usepackage{auto-pst-pdf}
\ifpdf\else
  \usepackage{pst-electricfield}
\fi
\begin{document}

\begin{pspicture*}(-6,-6)(6,6)
    \psframe*[linecolor=lightgray!50](-6,-6)(6,6)
    \psgrid[subgriddiv=0,gridcolor=gray,griddots=10]
    \psElectricfield[Q={[-1 -2 2][1 2 2][-1 2 -2][1 -2 -2]},linecolor=red]
    \psEquipotential[Q={[-1 -2 2][1 2 2][-1 2 -2][1 -2 
    -2]},linecolor=blue](-6.1,-6.1)(6.1,6.1)
    \psEquipotential[Q={[-1 -2 2][1 2 2][-1 2 -2][1 -2 -2]}, linecolor=green, 
    linewidth=2\pslinewidth, Vmax=0, Vmin=0](-6.1,-6.1)(6.1,6.1)
\end{pspicture*}

\end{document}

여기에 이미지 설명을 입력하세요

관련 정보