[pstricks] basic arithmetics in pstricks without defining nodes

Herbert Voss Herbert.Voss at fu-berlin.de
Fri Nov 9 08:25:12 CET 2007


Patrick Drechsler schrieb:

> how do I do simple arithmetics in tex and use them in pstricks?
> 
> I am thinking along the lines of:
> 
> \SpecialCoor%
> \def\MyRadius{0.7cm}%
> \def\MyDiameter{! \MyRadius 2 mul}%
> %
> \psline(\MyRadius,0)(\MyDiameter,0)
> 
> I know this will not work. I am wondering what the correct approach
> would look like...

\documentclass{minimal}
\usepackage{pstricks}
\SpecialCoor
\def\MyRadius{0.7cm}
\makeatletter
\pst at getlength{\MyRadius}\pstRadius % Radius in pt without unit
\def\MyDiameter{\pstRadius\space 2 mul }%
\makeatother

\begin{document}

\psline[unit=1pt,linecolor=red](!\pstRadius\space 0 )(!\MyDiameter 0)

\end{document}

Herbert



More information about the PSTricks mailing list