[pstricks] Optional {} argument as in \psline{->}()()

Christoph Bersch usenet at bersch.net
Tue Apr 15 11:45:53 CEST 2008

Hi,

for my package pst-optexp I want to allow an optional {} argument like
the arrow argument in \psline: \psline{->}(A)(B)

At the moment all my components are defined in the following way.

\def\lens{\@ifnextchar[{\pst at lens}{\pst at lens[]}}

\def\pst at lens[#1](#2)(#3)#4{{%
\pst at regNodes{#2}{#3}%
\pst at draw@component{#1}{#4}\pst at draw@lens%
}\ignorespaces}%

The components can then be called with

\lens(A)(B){lens}
or
\lens[options](A)(B)(lens}

I want to allow a supplementary optional argument before the nodes:

\lens{name}(A)(B){lens}

is there an easy way to incorporate this in the above code?

Thank you,
Christoph