[pstricks] postscript calculation within pstricks arguments
Herbert Voss
Herbert.Voss at FU-Berlin.DE
Thu May 6 19:45:32 CEST 2010
Am 05.05.2010 22:21, schrieb Mathias Legrand:
> but I would like to perform postscript calculations as follows (for
> instance) :
>
> \mypsframe{\i}{\I\space \i add 10 mul}
>
> but it does not work. Is there a systematic method for such requests?
use the \numexpr macro from etex.
However *10 cannot work, because xcolor allows only black!100
\documentclass{article}
\usepackage{pstricks-add,etex}
\usepackage{multido}
\begin{document}
\thispagestyle{empty}
\def\mypsframe#1#2{%
\psframe[linearc=#1 pt,cornersize=absolute,%
fillstyle=solid,fillcolor=black!#2](0,0)(1,1)}
\psframe[fillstyle=solid,fillcolor=red!30](-8,-30)(21,30)
\multido{\i=0+1}{22}{%
\multido{\I=0+1}{30}{%
\rput[cc]{!4 \I\space mul 4 \i\space mul add}(!1 dup \i\space mul
5.2 sub exch \I\space sub 2.7 add){%
\mypsframe{\i}{\number\numexpr(\I+\i)*2}}
}%
}%
\end{document}
Herbert
More information about the PSTricks
mailing list