[pstricks] Rendering modified arguments inside a macro (Jorge Nto)

Jorge Nto jorgento at gmail.com
Mon Dec 14 11:50:03 CET 2009


>sure, the syntax of \rput is
>\rput[pos]{angle}(x,y){text}

>Only x,y can be an calculated expression when a preceeding ! is
>detected. What do you want to do with the rput.
>Please provide a _full_ minimal example.

>Herbert

I just want to display the result of numerical calculations at the given
coordinates. Well, I have just seen that multiplication works.
So if I put  \rput(#2,#4){Radius: #6\pst at number\psyunit}% the argument #6 is
multiplied by yunit, but I don't know how to express the other operations
(addition, division, etc)
See (working) example below. What if I need the addition of #6 and
\pst at number\psyunit instead of multiplication:

\listfiles
\documentclass[12pt]{article}
\usepackage{filecontents}
\usepackage{pst-plot}

\begin{filecontents}{circle.data}
 0, 20, 25
 100, 150, 23
230, 20, 30
300, 100, 50
450, 50, 25
\end{filecontents}

\usepackage{pstricks-add}
\pagestyle{empty}
\parindent=0pt

\makeatletter
 \newcommand{\g}{! 10.0 6 mul}%
\def\psPrintfLikePlot{\pst at object{psPrintfLikePlot}}
\def\psPrintfLikePlot at i#1{\begin at SpecialObj\expandafter\psPrintfLikePlot at ii
#1}
\def\psPrintfLikePlot at ii #1{\psPrintfLikePlot at iii#1}
\def\psPrintfLikePlot at iii#1 #2 #3 #4 #5 #6 {%
 \pscircle(#2,#4){! #6 0.02 mul }%
 \rput(#2,#4){Radius: #6\pst at number\psyunit}%
   \@ifnextchar D{\psPrintfLikePlot at iii}{\end at SpecialObj}}
\makeatother

\begin{document}
%FIRST PLANNING INSTANT
\psset{xunit=0.02, yunit=0.02}% wirkt auch auf pspicture
\begin{pspicture}(-50, -150)(550,150)  %also 6 x 3 cm %%%%%%
\psgrid[unit=1cm,subgriddiv=0,griddots=10,gridlabels=0pt, gridwidth=0.3pt]
(-1,-3)(10,3)
\psaxes[linewidth=0.7pt,  Dx=100, Dy=100,%
    tickstyle=bottom]{->}(0,0)(-50,-150)(550,150)%
%PLOT THE CHOSEN PATH @1
%\readdata{\data}{c:/ADATA/DATA1/Patho.txt}
%\listplot[plotstyle=dots, linecolor=blue]{\data}
%SUBGOALS
\readdata{\data}{circle.data}
\psPrintfLikePlot{\data}
\end{pspicture}

\end{document


Thanks,

Jorge
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/pstricks/attachments/20091214/613de294/attachment.html>


More information about the PSTricks mailing list