[pstricks] arrayjob and multiple array elements in one pstricks function does not worked as expected

Herbert Voss Herbert.Voss at FU-Berlin.DE
Wed Apr 9 10:21:52 CEST 2014


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,
> LineColor, LabelPos and LabelVal). I am not able to use the array
> elements for LineColor and Rmax. E.g., f I try to use the line
> \psline[linecolor=\LineColors(\iInd)](150,\cachedata)(160,\cachedata) ,
> xelatex complains about:
> ! Undefined control sequence.
> \in@ #1#2->\begingroup \def \in@@
>                                    ##1#1{}\toks@ \expandafter {\in@@
> #2{}{}#1...
> l.39     }
>
> 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




More information about the PSTricks mailing list