[pstricks] arrows no longer colored in \code blocks

Hensh, Richard hensh at msu.edu
Wed Oct 12 10:33:37 CEST 2022


Dear Herbert,

Thank you so much.

regards
rick
________________________________
From: PSTricks <pstricks-bounces+hensh=math.msu.edu at tug.org> on behalf of Herbert Voss <Herbert.Voss at fu-berlin.de>
Sent: Wednesday, October 12, 2022 2:42 AM
To: pstricks at tug.org <pstricks at tug.org>
Subject: Re: [pstricks] arrows no longer colored in \code blocks



Am 12.10.22 um 08:19 schrieb Herbert Voss:
>
>
> Am 11.10.22 um 22:04 schrieb Hensh, Richard:
>> Please see attached.
>
> there is something wrong, because vec at norm is not defined!


I used the already existing Pyth command and added only the with
%%% <===  marked code line.

\documentclass{article}
\usepackage{xspace,xparse}
\usepackage{mathtools}
\usepackage{pstricks-add}
\begin{document}

     The radial field $ \textbf{rF} = x\textbf{i} + y\textbf{j} $

     \bigskip

     \psset{unit=30mm}
     \makeatletter
     \def\unitsPT{\strip at pt\psunit}
     \def\scaleFactor{\strip at pt\psunit\space 2 mul 3 div}
     \def\ps at check@tipcolor{}%%%%%%   <=======
     \makeatother

     \def\xInc{0.25}\def\xCnt{16}
     \def\yInc{0.25}\def\yCnt{16}
     \def\xmin{-2}\def\xmax{2}
     \def\ymin{-2}\def\ymax{2}
     \begin{pspicture*}(\xmin,\ymin)(\xmax,\ymax)%\showgrid
     \pstVerb{%
         /dist at len {max at len div dist@} def %
         /get at col {dist at len dup low at int lt {1 low at int div mul 1} {dup
         high at int lt {high at int sub low at int high at int sub div 1 exch}
         {1 sub high at int 1 sub div 1 add 2 div 0} ifelse} ifelse 0} def %
         /nstr 10 string def %
         /showLength {/Times-Bold findfont 10 scalefont setfont nstr cvs
show} def
         /k@ {0.5} bind def %
         /a@ {k@ med@ sub med@ dup 1 sub mul div} def %
         /b@ {1 a@ sub} def %
         /dist@ {dup a@ mul b@ add mul} def % ax^2 + bx
         /max at thk {4} bind def %
         /get at thk {dist at len 0.5 add 1.5 mul} def %
%        /get at thk {dist at len 1 sub max at thk 1 sub mul 1 add} def %
         %%
         /M at xy {pop 1.25 div} def %
         /N at xy {exch pop 1.25 div} def %
         /max at len {2 sqrt} bind def % function of the vector field and
Viewing Window
         /med@ {1 2 sqrt div} def %
         /low at int {0.35} bind def %
         /high at int {0.75} bind def %
         /s at f {\unitsPT\space 2 mul 3 div} def % scalefactor
         }%
         \psaxes{<->}(0,0)(\xmin,\ymin)(\xmax,\ymax)%
         \multido{\ry=\ymin+\yInc}{\yCnt}{%
         \multido{\rx=\xmin+\xInc}{\xCnt}{%
             \pscustom[linewidth=1.5pt,arrowscale=1.0675]{%
             \translate(\rx,\ry)
             \arrows{->}
             \code{%
             /p@ {4 mul} def %
             /xCoord {\rx\space} bind def %
             /yCoord {\ry\space} bind def %
             /vec at Len {xCoord yCoord 2 copy M at xy 3 1 roll N at xy %
             Pyth % vec at norm
             dup 0 eq {pop 0.01} if} bind def %
             vec at Len get at thk setlinewidth vec at Len get at col setrgbcolor %
             0 0 moveto
             currentpoint
             xCoord yCoord 2 copy M at xy s at f mul 3 1 roll N at xy s at f mul %
             vec at Len 3 mul dup 4 1 roll div 3 1 roll exch div exch %
             ArrowB % get at thk setlinewidth %
             lineto stroke %
             }
             }
         }
         }
     \end{pspicture*}

\end{document}
You do not need al the % at the line ends for PostScript. It is only
important
for TeX.

Herbert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/pstricks/attachments/20221012/c3855a97/attachment.html>


More information about the PSTricks mailing list.