[pstricks] arrayjob and multiple array elements in one pstricks function does not worked as expected
Juergen Rose
rose at rz.uni-potsdam.de
Thu Apr 10 17:54:37 CEST 2014
Am Mittwoch, den 09.04.2014, 10:21 +0200 schrieb Herbert Voss:
> Am 09.04.2014 09:00, schrieb Juergen Rose:
>
> > I justed wrote my first latex file with array job. I tried to plot a
> > series of curves with five different parameters (Rprobe, Rmax,
...
> > The complete latex file is in the attachment. Any hint is deeply
> > appreciated.
>
> The expressions from arrayjob are not always expandable. Use always
> the cached value:
>
> \documentclass[]{article}
>
> \usepackage{pst-plot}
> \usepackage{arrayjob}
> \pagestyle{empty}
>
> \begin{document}
>
> \newarray\Rprobe
> \readarray{Rprobe}{0&5000&2160&640}
> \newarray\RMax
> \readarray{RMax}{0&200&200&130}
> \newarray{\LineColors}
> \readarray{LineColors}{red&green&magenta&blue}
> \newarray{\LabelPos}
> \readarray{LabelPos}{90&50&30&10}
> \newarray{\LabelVal}
> \readarray{LabelVal}{S_T^{VC}(r), r_p= 0 nm&S_T^{VC}(r), r_p= 0.3
> nm&S_T^{VC}(r), r_p=3 nm&S_T^{VC}(r), r_p=30 nm}
> \def\RatioFacZero{Pi 6 sqrt div 3 div }
> \begin{pspicture}(-2.0,-3.0)(17,7)
> \psset{xunit=0.06cm,yunit=0.1cm}
> \psaxes[Dx=10,Dy=10]{->}(0,0)(-1.0,-1.0)(220,105)
> \uput[-90](225,-0.5){$r[nm]$}
> \uput[180](-0.1,95){$S_{total}[\mu m^2]$}
> \psset{plotpoints=200}
> \multido{\iInd=2+1}{3}{%
> \checkLineColors(\iInd)\psset{linecolor=\cachedata}%
> \checkRMax(\iInd)\edef\POINTS{\cachedata}%
> \checkRprobe(\iInd)%
> \psparametricplot{2}{\POINTS}{
> t \RatioFacZero t 3 exp mul 2 div 0.225 t 2 0.5 exp div add
> 2 exp div 1 2 t 2 exp div 2 0.5 exp t div 3 mul sub 2
> add 3 mul
> t mul t \cachedata\space add div sub mul }
> \checkLabelPos(\iInd)%
> \psline(150,\cachedata)(160,\cachedata)
> \uput[r](160,\cachedata) {$\LabelVal(\iInd)$}%
> }
> \end{pspicture}
>
> \end{document}
>
> And, by the way, using an algebraic expression instead of the postfix
> notation makes it easier.
>
>
> Herbert
Thank you very much, Herbert, this works now perfectly. I really
appreciate your help.
I still have two further question connected with arrays. The first I
would like to add here, The second I will post with a separate subject,
I tried to calculate the values of an array \RMin from an array \Rprobe,
but I was not succesful. My code looks like:
\newarray\Rprobe
\readarray{Rprobe}{0&0.3&3&30&300}
\newarray\RMin
multido{\iInd=1+1}{4}{%
\checkRprobe(\iInd)%
\FPmul\aux\cachedata{\Rzero}
iInd=\iInd : aux=\aux
\RMin(\iInd)={\aux}
}
...
\multido{\iInd=2+1}{3} {%
...
\checkRMin(\iInd) \edef\RMIN{\cachedata}%
}
Xelatex fails with:
! Undefined control sequence.
\cachedata ->\aux
l.75 ^^I}
Again I am thankful for every hint.
More information about the PSTricks
mailing list