% Plain LuaTeX or Plain XeTeX
\input luaotfload.sty% comment this out for XeTeX
\input pst-circ

\pspicture(-1, 0)(3.5, 4.5)
\circledipole[labeloffset = 0](0, 3)(3, 3){V}
\coil[dipolestyle=curved](0, 1)(3, 1){}
\wire(0, 1)(0, 3)
\wire(3, 1)(3, 3)

This produces an error message in both (XeTeX and LuaTeX):

Undefined control sequence.

When I run this example with LuaTeX and without \input luaotfload.sty then there are even more errors and no picture is produced.

What is wrong here? According to the manual of PSTricks it should work with Plain TeX.

  • it is a bug. pstricks.tex tests with \ifdefined\@latexerr for the format, but as it uses \expandafter\ifx\csname @latexerr\endcsname\relax earlier, \@latexerr is defined and so the test is wrong. Report it to the maintainer. Nov 27, 2022 at 12:26
  • Oh I was a bit slower (but longer:-) @UlrikeFischer Nov 27, 2022 at 12:29
  • OK, I understand this bug. But why does it crash, when I use PSTricks in Plain LuaTeX without \input luaotfload.sty? Nov 27, 2022 at 12:41
  • 1
    It is no problem with an up-to-date TeXLive (ctan.org/tex-archive/graphics/pstricks/base/generic)
    – user187802
    Nov 29, 2022 at 8:09
  • 1
    The bug has been fixed. Dec 3, 2022 at 22:44

1 Answer 1


This is a bug in pstricks.tex which you should report.

It tests for LaTeX

\expandafter\ifx\csname @latexerr\endcsname\relax % do we have TeX? then @latexerr isn't defined
  \input pstricks-tex.def

but \csname defines \@latexerr to be \relax so a later test in the same file

  \ifdefined\@latexerr % format is latex
    \RequirePackage{pgffor} % pgffor depends on pgfkeys

takes the wrong branch

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .