# [pstricks] powerdot and pst-optexp

Luis Sequeira lfsequeira at gmail.com
Sat Nov 29 11:24:33 CET 2014

> Am 28.11.2014 um 17:48 schrieb Luis Sequeira:
>>>
>> On the other hand, the modification of the text color is something
>> that to my mind is a bug in pst-optexp.
>
> What change of text color? As I mentioned in an other message, the same
> error message comes up without using pst-optexp at all.
>
> If you have an example which shows a bug in pst-optexp, I'll try to fix it.
>

The first post on this topic mentioned two problems. The first problem was that after using pst-optextr in a pspicture environment, the following text in the powerdot slide came out black instead of the color it was supposed to be.
It looks like pst-optextr sets a color and forgets to save and restore

Below is a minimal example, without even using powerdot. Any of the commands \optbox, \optcoupler, \optfiber, \optdetector, \elecsynthesizer fails to do what I suppose is a simple gsave and grestore pair on the text color (I may be using the wrong terminology here, as I am only vaguely acquainted with postscript itself).

>> Herbert did explain that the package redefines \endpspicture. Maybe
>> this is justified, but regrettably it forces one to use the TeX
>> primitives directly rather than the more elegant LaTeX environment,
>> which by all indications is supposed to be functionally  equivalent,
>> but, as you found out accidentally, is not.
>
> No, using \begin{pspicture}...\end{pspicture} works fine with
> pst-optexp. \endpspicture is called from \end{pspicture}.
>

Maybe I misunderstood it, but as I read it, Herbert’s proposed solution was to use \pspicture … \endpspicture *instead* of \begin{pspicture} … \end{pspicture}. He also said that pst-optextr redefines \endpspicture. This lead me to believe - erroneously, I now think - that the two versions had become unequivalent when using pst-optextr.

Here is the minimal example, based in the OP’s, that shows the color problem.
Commenting out all the pst-optextr commands in a pspicture makes the problem go away, but leaving any one of them one, the text afterwards is black; so it is clear that using those commands changes the color and does not restore it.

\documentclass{article}

\usepackage{pstricks}
\usepackage{pst-node}
\usepackage{pst-optexp}

\begin{document}

\color{blue} Some text in blue

\begin{pspicture}(-1,-1)(6.5,2.8)
\psset{labelstyle=\scriptsize}
\pnode(0,1){NA}
\pnode(0.1,1){NBB}
\pnode(4,1){NB}
\pnode(0,0){NC}
\pnode(4,0){ND}
\pnode(6,1){NE}
\pnode(-0.35,1.8){NF}
\optbox[label=0,fiber,position=start,optboxwidth=0.7,compname=LD,extnode=t](NA)(NBB){TLS}
\optcoupler[coupleralign=top](NA)(NC)(NB)(ND){}
\optfiber[label=0.5](NB)(NE){FUT}
\optdetector[label=-0.7](ND)(NC){PD}
\elecsynthesizer[synthtype=sawtooth](NF)(\oenodeExt{LD}){}
\end{pspicture}

This text should be blue, but it is black.
\end{document}