[pstricks] including PostScript code in pstricks

Herbert Voss LaTeX at zedat.fu-berlin.de
Fri Mar 24 20:16:14 CET 2006

Germi Camps wrote:
> I have to draw a serie of arcs, but first I have to calculate the center 
> point, the radius and the beginning and ending angle depending on a 
> parameter
> I do not have any problem when calculating the center, because it is 
> delimited by ( ). but for the other arguments, delimited by { }, 
> pstricks doesn't accepts PostScript code... how can I do it?
> \def\rad{3}
> \def\radb{5}
> \psarc(!\rad\space 1 \rad\space add div 10 mul 0){! \radb\space 2 div 1 
> add}{0}{360}
> ! \radb\space 2 div 1 add -->> this doesn't work inside { }

this needs a redefinition of the \psarc macro



\def\psarc at iii(#1)#2#3#4{%
   \begin at OpenObj
     \pst at getangle{#3}\pst at tempa
     \pst at getangle{#4}\pst at tempb
     \def\pst at tempA{#2}%
     \addto at pscode{\psarc at iv \psarc at v}%
     \gdef\psarc at type{0}%
   \end at OpenObj%
\def\psarc at iv{%
   \pst at coor /y ED /x ED
   /r \pst at tempA def
   /c 57.2957 r \tx at Div def
     \pst at tempa
     \psk at arcsepA c mul 2 div
     \ifcase \psarc at type add \or sub \fi
     \pst at tempb
     \psk at arcsepB c mul 2 div
     \ifcase \psarc at type sub \or add \fi
   \ifshowpoints\psarc at showpoints\fi
   \ifx\psk at arrowA\@empty
     \ifnum\psk at liftpen=2
       r angleA \tx at PtoC
       y add exch x add exch moveto

\psarc(!\rad\space 1 \rad\space add div 10 mul 0)%
	{ \radb\space 2 div 1 add }{0}{360}


More information about the PSTricks mailing list