[pstricks] variables and pstricks.

Alan Ristow ristow at ece.gatech.edu
Mon Nov 27 21:12:47 CET 2006


Eduardo wrote:
> Hi, 
> 
> Is it possible to define variables using pstricks? 
> 
> The following commands work fine:
> \def\R{2}
> \pscircle(0,0){\R} 
> 
> but I'd like to have, for example: 
> \SpecialCoor
> !/R 2 sqrt def 
> \pscircle(0,0){R} 

This isn't very transparent, but it seems to do the job. It wouldn't 
surprise me if Herbert has a much better solution.

\makeatletter
\begin at ClosedObj
\addto at pscode{%
   /R 2 sqrt def
   0 0 \pst at number\psunit R mul \psk at dimen sqrt CLW mul sub 0 360 arc 
closepath
}%
\end at ClosedObj
\makeatother


Alan



More information about the PSTricks mailing list