3
% Plain LuaTeX
\input luaotfload.sty
\input pstricks
\input pst-circ
\input color% destroys everything

\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)
\endpspicture

\bye

When I compile this MWE with Plain LuaTeX, \input color destroys the \pspicture. When I load color before pstricks, then it crashes.

How to use both packages in Plain TeX? Why are they interfering?

Edit: Same result with Plain XeTeX.

5
  • You can't use xcolor and color at the same time. OTOH, if xcolor is loaded, loading color is a giant leap backwards. Commented Dec 3, 2022 at 22:51
  • I don't understand. I don't use xcolor. Commented Dec 3, 2022 at 22:52
  • Apparently pstricks does. Commented Dec 3, 2022 at 22:53
  • Not in Plain TeX. Here, \color{........} leads to errors. Commented Dec 3, 2022 at 22:56
  • well with etex your example compiles if you undefine color before loading the package. With luatex something then still errors in luapstricks. Why are you using plain luatex instead of luaLaTeX? Commented Dec 3, 2022 at 23:17

2 Answers 2

2

this works:

% Plain LuaTeX
\input luaotfload.sty
%\input pstricks
\input pst-circ

\newrgbcolor{myCol}{0.2 0.5 0.8}

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

{\red foo} {\myCol bar} baz
\bye

enter image description here

However, you cannot be sure that luapstricks.lua will always work with luatex. Using lualatex instead makes more sense.

3
  • OK, so what do I have to do, when I would like to use pstricks and color together? I need colored text as well as pstricks. (There are reasons for using Plain TeX instead of LaTeX.) Commented Dec 4, 2022 at 11:33
  • See edited answer
    – user187802
    Commented Dec 4, 2022 at 14:02
  • Thank you. So, pstricks adds color support for Plain TeX on its own. I did not know that. :) Commented Dec 4, 2022 at 14:14
1

I found another solution that adds xcolor support to Plain TeX. The color package does something that destroys PSTrticks and I could not find the reason. But xcolor works after some modifications.

\input luaotfload.sty

\catcode`\@=11

\csname pgfkeysloaded\endcsname% `pgfkeys` loads the Plain TeX color
                               % support by TikZ which does not
                               % even work here and is incompatible!

%\input pstricks
\input pst-circ

\suppressoutererror = 1% \outer
\input miniltx
\let\+\@undefined% defined by `plain.tex`
\def\XC@tgt@mod#1{#1}% to get package option `natural` (default)
\input xcolor.sty

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

\color{violet}

Test

\bye
1
  • do not expect that to continue to work. xcolor is a latex package and is not tested against miniltx. Any new version can contain changes that break in plain. Commented Dec 4, 2022 at 15:04

You must log in to answer this question.

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