summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pstricks/pst-news10.tex
blob: aaec792c227560e97af2327ee618e58bbe4afbae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
%% $Id: pst-news09.tex 62 2008-11-25 19:52:07Z herbert $
\documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false,smallheadings
    headexclude,footexclude,oneside]{pst-doc}
\listfiles
\let\Lfile\LFile
\usepackage[utf8]{inputenc}
\usepackage{pst-plot}
\let\pstplotFV\fileversion
\let\pstplotFD\filedate
\usepackage{pst-eucl,pst-func}
\renewcommand\bgImage{\psscalebox{15}{\color{blue!20}2010}}
\def\textat{\char064}
\lstset{explpreset={pos=l,width=-99pt,overhang=0pt,hsep=\columnsep,vsep=\bigskipamount,rframe={}},
    escapechar=?}
\begin{document}

%\psset{PstDebug=1}
\title{\texttt{News -- 2010}\\ \Large new macros and bugfixes for the
basic packages \nxLFile{pstricks}, \nxLFile{pst-plot}, and \nxLFile{pst-node}}
\author{Herbert Voß}
\date{\today}

\maketitle

\clearpage
\tableofcontents

\clearpage
\part{\texttt{pstricks} -- package}

\section{General}
There exists a new document class \LClass{pst-doc} for writing PSTricks documentations,
like this news document. It depends on the KOMA-Script document class \LClass{scrartcl}.
\LClass{pst-doc} defines a lot of special macros to create a good index. Take one of
the already existing package documentation and look into the source file. Then it will be
easy to understand, how all these macros have to be used.

When running \Lprog{pdflatex} the title page is created with boxes and inserted 
with the macro \Lcs{AddToShipoutPicture} from the package \LPack{eso-pic}. It
inserts the background title page image \Lfile{pst-doc-pdf} to use directly
\Lprog{pdflatex}.
When running \Lprog{latex} the title page
 is created with \PST\ macros.This allows to use the Perl script \Lprog{pst2pdf} or
the package \LPack{pst-pdf} or \LPack{auto-pst-pdf} or any other program/package which
supports \PS\ code in the document.


%--------------------------------------------------------------------------------------
\section{\texttt{pstricks.sty}}
%--------------------------------------------------------------------------------------
%\subsection{New optional argument}
No changes

%--------------------------------------------------------------------------------------
\section{\texttt{pstricks.tex} (\pstricksFV -- \pstricksFD)}
%--------------------------------------------------------------------------------------

\subsection{Macro \nxLcs{psellipse}}

To rotate an ellipse the already existing keyword \Lkeyword{rot} can be
used. This is easier than using the \Lcs{rput} command and its optional
argument for rotating.

\begin{LTXexample}[width=6cm,wide=true]
\psset{unit=0.25}
\begin{pspicture}(-1,5)(20,18)
\psclip{\psellipse[linecolor=red,
  rot=-12.606](5.821,10.04)(6.633,5.103)}
  \psellipse[linecolor=blue,fillstyle=vlines,
    rot=39.29](13.141,11.721)(6.8,5.4)
\endpsclip
\psellipse[linecolor=blue,rot=39.29](13.1,11.7)(6.8,5.4)
\end{pspicture}

\begin{pspicture}(-1,5)(20,18)
\psellipse[linecolor=blue,rot=-39.29,
  fillstyle=vlines](13.1,11.7)(6.8,5.4)
\psclip{\psellipse[linecolor=red,rot=12.6,
  fillstyle=vlines](5.8,10)(6.6,5.1)}
  \psellipse*[linecolor=white,rot=-39.29](13.1,11.7)(6.8,5.4)
\endpsclip
\psellipse[linecolor=blue,rot=-39.29](13.1,11.7)(6.8,5.4)
\psellipse[linecolor=red,rot=12.6](5.8,10)(6.6,5.1)
\end{pspicture}
\end{LTXexample}

\subsection{Macro \nxLcs{psellipticarc}}
In a circle the angle is proportional to the bow: $b=r\alpha$. In an
elliptic arc this is no more the case, which is the reason why angles are
internally corrected by PSTricks, to get the same arc lengthts for
different radii:

\xLcs{psellipticarc}
\begin{LTXexample}[width=6cm]
\psset{unit=0.5cm}
\begin{pspicture}(-5.5,-5.5)(5.5,5.5)%
\psset{linewidth=0.4pt,linejoin=1}
\psline(5,0)(0,0)(5,-5)
\psellipticarc(0,0)(3,3){0}{315}
\end{pspicture}%
\end{LTXexample}

\begin{LTXexample}[width=6cm]
\psset{unit=0.5cm}
\begin{pspicture}(-5.5,-5.5)(5.5,5.5)%
\psset{linewidth=0.4pt,linejoin=1}
\psline(5,0)(0,0)(5,-5)
\psellipticarc(0,0)(1,3){0}{315}%
\psset{linecolor=red}
\psellipticarc(0,0)(3,1){22}{222}%
\psline(3;22)\psline(3;222)
\end{pspicture}%
\end{LTXexample}

\begin{LTXexample}[width=6cm]
\psset{unit=0.5cm}
\begin{pspicture}(-5.5,-5.5)(5.5,5.5)%
\psset{linewidth=0.4pt,linejoin=1}
\psline(5,0)(0,0)(5,-5)
\psellipticarc*(0,0)(1,3){0}{315}%
\psset{linecolor=red}
\psellipticarc*(0,0)(3,1){22}{222}%
\psline(3;22)\psline(3;222)
\end{pspicture}%
\end{LTXexample}

\psset{unit=1cm}


If you do not want the angle correction, then use the keyword setting \Lkeyword{correctAngle}=\false:

\begin{LTXexample}[width=6cm]
\psset{unit=0.5cm}
\begin{pspicture}(-5.5,-5.5)(5.5,5.5)%
\psset{linewidth=0.4pt,linejoin=1,
  correctAngle=false}
\psline(5,0)(0,0)(5,-5)
\psellipticarc(0,0)(1,3){0}{315}%
\psset{linecolor=red}
\psellipticarc(0,0)(3,1){22}{222}%
\psline(3;22)\psline(3;222)
\end{pspicture}%
\end{LTXexample}

\begin{LTXexample}[width=6cm]
\psset{unit=0.5cm}
\begin{pspicture}(-5.5,-5.5)(5.5,5.5)%
\psset{linewidth=0.4pt,linejoin=1,
  correctAngle=false}
\psline(5,0)(0,0)(5,-5)
\psellipticarc*(0,0)(1,3){0}{315}%
\psset{linecolor=red}
\psellipticarc*(0,0)(3,1){22}{222}%
\psline(3;22)\psline(3;222)
\end{pspicture}%
\end{LTXexample}




\subsection{Option \nxLkeyword{algebraic}}
The option \Lkeyword{algebraic} moved from the other packages into
the main package \LPack{pstricks} to get rid of the dependencies.

By default the function in \Lcs{psplot} has to be described in
Reversed Polish Notation. The option \Lkeyword{algebraic} allows you
to do this in the common algebraic notation. E.g.:

\begin{tabular}{l|l}
RPN & algebraic\\\hline
\verb+x ln+ & \verb+ln(x)+\\
\verb+x cos 2.71 x neg 10 div exp mul+ & \verb+cos(x)*2.71^(-x/10)+\\
\verb+1 x div cos 4 mul+ & \verb+4*cos(1/x)+\\
\verb+t cos t sin+ & \verb+cos(t)|sin(t)+
\end{tabular}

Setting the option \Lkeyword{algebraic}, allow the user
to describe all expression to be written in the classical
algebraic notation (infix notation). The four arithmetic
operations are obviously defined \verb$+-*/$, and also the
exponential operator \verb$^$. The natural priorities are used :
$3+4\times 5^5=3+(4\times (5^5))$, and by default the computation
is done from left to right. The following functions are defined :

\medskip
\begin{tabular}{ll}
\verb$sin$, \verb$cos$, \verb$tan$, \verb$acos$, \verb$asin$ & in radians\\
\verb$log$, \verb$ln$\\
\verb$ceiling$, \verb$floor$, \verb$truncate$, \verb$round$\\
\verb$sqrt$ & square root\\
\verb$abs$ & absolute value\\
\verb$fact$ & for the factorial\\
\verb$Sum$ & for building sums\\
\verb$IfTE$ & for an easy case structure
\end{tabular}

\medskip
These options can be used with \textbf{all} plot macros.

{\bfseries Using the option \Lkeyword{algebraic} implies that all
angles have to be in radians! }

For the \Lcs{parametricplot} the two parts must be divided by the \Lnotation{|} character:

\begin{LTXexample}[width=2cm]
\begin{pspicture}(-0.5,-0.5)(0.5,0.5)
\parametricplot[algebraic,linecolor=red]{-3.14}{3.14}{cos(t)|sin(t)}
\end{pspicture}
\end{LTXexample}

\bigskip
\begingroup
\psset{lly=-0.5cm}
\psgraph[trigLabels,dx=\psPi,dy=0.5,Dy=0.5]{->}(0,0)(-10,-1)(10,1){\linewidth}{6cm}
  \psset{algebraic,plotpoints=1000}
  \psplot[linecolor=yellow,linewidth=2pt]{-10}{10}{0.75*sin(x)*cos(x/2)}
  \psplot[linecolor=red,showpoints=true,plotpoints=101]{-10}{10}{0.75*sin(x)*cos(x/2)}
\endpsgraph
\endgroup

\bigskip
\begin{lstlisting}
\psset{lly=-0.5cm}
\psgraph[trigLabels,dx=\psPi,dy=0.5,Dy=0.5]{->}(0,0)(-10,-1)(10,1){\linewidth}{6cm}
  \psset{algebraic,plotpoints=1000}
  \psplot[linecolor=yellow,linewidth=2pt]{-10}{10}{0.75*sin(x)*cos(x/2)}
  \psplot[linecolor=red,showpoints=true,plotpoints=101]{-10}{10}{0.75*sin(x)*cos(x/2)}
\endpsgraph
\end{lstlisting}


\bigskip
%\begin{LTXexample}[pos=t]
\bgroup
\psset{lly=-0.5cm,unit=1cm}
\psgraph(0,-5)(18,3){0.9\linewidth}{5cm}
  \psset{algebraic,plotpoints=501}
  \psplot[linecolor=yellow, linewidth=4\pslinewidth]{0.01}{18}{ln(x)}
  \psplot[linecolor=red]{0.01}{18}{ln(x)}
  \psplot[linecolor=green,linewidth=4\pslinewidth]{0}{18}{3*cos(x)*2.71^(-x/10)}
  \psplot[linecolor=blue,showpoints=true,plotpoints=51]{0}{18}{3*cos(x)*2.71^(-x/10)}
\endpsgraph
\egroup
%\end{LTXexample}


\bigskip
\begin{lstlisting}
\psset{lly=-0.5cm}
\psgraph(0,-5)(18,3){0.9\linewidth}{5cm}
  \psset{algebraic,plotpoints=501}
  \psplot[linecolor=yellow, linewidth=4\pslinewidth]{0.01}{18}{ln(x)}
  \psplot[linecolor=red]{0.01}{18}{ln(x)}
  \psplot[linecolor=yellow,linewidth=4\pslinewidth]{0}{18}{3*cos(x)*2.71^(-x/10)}
  \psplot[linecolor=blue,showpoints=true,plotpoints=51]{0}{18}{3*cos(x)*2.71^(-x/10)}
\endpsgraph
\end{lstlisting}

\section{New linestyle \nxLkeyval{symbol}}

Instead of drawing a continous line or curve for a series of coordinates, one
can now out a symbol in a given size, direction, and step. This works only
for the line style \Lkeyval{symbol}. It takes the symbol defined by the optional
argument \Lkeyword{symbol}, which can have a single character or a octal number
of three digits. The font is specified by the key \Lkeyword{symbolFont}, which can take
as argument one of the valid \PS fonts or the internal \Lkeyval{PSTricksDotFont}.
If the symbol is given by a single character then the equivilant character in
the given font is used. The difference between two symbols is set by \Lkeyword{symbolStep}
and the symbol rotation by \Lkeyword{rotateSymbol}. For the first symbol there
is an additional keyword \Lkeyword{startAngle}. 
The default values for these new
optional keywords are:

\begin{Xverbatim}{}
\psset[pstricks]{symbolStep=20pt}
\psset[pstricks]{symbolWidth=10pt}
\psset[pstricks]{symbolFont=Dingbats}
\psset[pstricks]{rotateSymbol=false}
\psset[pstricks]{startAngle=0}
\end{Xverbatim}

\begin{LTXexample}[pos=t,preset=\centering]
\pspicture(-1,-1)(8,6)
\psline[linestyle=symbol](0,0)(5,0)(8,4)
\psline[linestyle=symbol,symbol=T](0,1)(5,1)(8,4)
\psline[linestyle=symbol,symbol=u,symbolFont=PSTricksDotFont](0,2)(5,2)(8,4)
\psline[linestyle=symbol,symbol=u,symbolStep=25pt,linecolor=red](0,3)(5,3)(8,2)
\psline[linestyle=symbol,symbol=A,symbolStep=25pt,
  symbolWidth=20pt,linecolor=blue](0,4)(5,4)(8,1)
\psline[linestyle=symbol,symbol=342,rotateSymbol=true,symbolStep=12pt](0,5)(5,5)(8,0)
\endpspicture
\end{LTXexample}

\begin{LTXexample}[pos=t,preset=\centering]
\pspicture(-1,-1)(8,6)
\pscurve[linestyle=symbol](0,0)(5,0)(8,4)
\pscurve[linestyle=symbol](0,1)(5,1)(8,4)
\pscurve[linestyle=symbol,symbol=u,symbolFont=PSTricksDotFont](0,2)(5,2)(8,4)
\pscurve[linestyle=symbol,symbol=u,symbolStep=25pt,linecolor=red](0,3)(5,3)(8,2)
\pscurve[linestyle=symbol,symbol=A,symbolStep=25pt,
  symbolWidth=20pt,linecolor=blue](0,4)(5,4)(8,1)
\pscurve[linestyle=symbol,symbol=342,rotateSymbol=true,
  startAngle=190,symbolStep=12pt](0,5)(5,5)(8,0)
\endpspicture
\end{LTXexample}

\begin{LTXexample}[pos=t,preset=\centering]
\pspicture(-1,-1)(8,6)
\psccurve[linestyle=symbol](0,0)(5,0)(8,4)
\psccurve[linestyle=symbol](0,1)(5,1)(8,4)
\psccurve[linestyle=symbol,symbol=u,symbolFont=PSTricksDotFont](0,2)(5,2)(8,4)
\psccurve[linestyle=symbol,symbol=u,symbolStep=25pt,linecolor=red](0,3)(5,3)(8,2)
\psccurve[linestyle=symbol,symbol=A,symbolStep=25pt,
  symbolWidth=20pt,linecolor=blue](0,4)(5,4)(8,1)
\psccurve[linestyle=symbol,symbol=342,rotateSymbol=true,
  startAngle=190,symbolStep=12pt](0,5)(5,5)(8,0)
\endpspicture
\end{LTXexample}

\begin{LTXexample}[pos=t,preset=\centering]
\pspicture(-1,-1)(5,4)
\pscurve[rotateSymbol=true,linestyle=symbol,
  rot=180,startAngle=100,symbol=",
    symbolWidth=20pt](0,0)(1,4)(3,0)(5,2)
\endpspicture
\end{LTXexample}

\begin{LTXexample}[pos=t,preset=\centering]
\pspicture(-1,-1)(6,4)
\psbezier[rotateSymbol=true,linestyle=symbol,symbol=u,
 symbolFont=PSTricksDotFont,rot=-90,startAngle=0](0,0)(0,4)(6,4)(6,0)
\endpspicture
\end{LTXexample}

\begin{LTXexample}[pos=t,preset=\centering]
\psset{unit=0.5cm}
\pspicture(-1,-4)(6,4)
\pscbezier[rotateSymbol=true,linestyle=symbol,symbol=u,
 symbolFont=PSTricksDotFont](0,4)(4,4)(4,-4)(0,-4)
\pscbezier[linestyle=dashed](0,4)(4,4)(4,-4)(0,-4)
\endpspicture
\end{LTXexample}

\psset{unit=1cm}
\begin{LTXexample}[pos=t,preset=\centering]
\pspicture(-1,-1)(6,4)
\psbezier[rotateSymbol=true,linestyle=symbol,symbol=u,
 symbolFont=PSTricksDotFont](0,0)(0,4)(6,4)(6,0)
\endpspicture
\end{LTXexample}

\begin{LTXexample}[pos=t,preset=\centering]
\pspicture(-1,-1)(6,4)
\pspolygon[rotateSymbol=true,linestyle=symbol,symbol=u,
 symbolFont=PSTricksDotFont](0,0)(0,4)(6,4)(6,0)(1,3)
\endpspicture
\end{LTXexample}

\begin{LTXexample}[pos=t,preset=\centering]
\pspicture(-3,-1)(6,6)
\psccurve[linestyle=symbol,symbol=u, rot=-90,rotateSymbol,
   symbolFont=PSTricksDotFont, symbolWidth=5pt, symbolStep=10pt
](-3,-1)(0,0)(0,4)(6,4)(6,0)(0,4)(-1,5)
\endpspicture
\end{LTXexample}

\begin{LTXexample}[pos=t,preset=\centering]
\pspicture(-1,-1)(6,6)
\pscurve[linestyle=dashed,linecolor=black!30](0,0)(0,4)(6,4)(6,0)(0,4)
\pscurve[rotateSymbol=true,linestyle=symbol,symbol=k,
   symbolFont=PSTricksDotFont, symbolWidth=5pt, symbolStep=10pt,linecolor=blue
](0,0)(0,4)(6,4)(6,0)(0,4)
\endpspicture
\end{LTXexample}


%--------------------------------------------------------------------------------------
\section{Numeric functions}
%--------------------------------------------------------------------------------------

All macros have a \textat{} in their name, because they are
only for internal use, but it is no problem to use them like other
macros. One can define another name without a \textat{}:
\begin{lstlisting}[style=syntax]
\makeatletter
\let\pstdivide\pst@divide
\makeatother
\end{lstlisting}

or put the macro inside the \Lcs{makeatletter} -- \Lcs{makeatother} sequence.


%--------------------------------------------------------------------------------------
\section{Numeric functions}
%--------------------------------------------------------------------------------------

By default \PST\ loads the file \Lfile{pst-fp} which is derived from the
\LPack{fp} package. It supports the following macros:

%--------------------------------------------------------------------------------------
\subsection{\nxLcs{pstFPadd}, \nxLcs{pstFPsub}, \nxLcs{pstFPmul}, and \nxLcs{pstFPdiv}}
%--------------------------------------------------------------------------------------
Multiplication and division:

\begin{BDef}
\Lcs{pstFPadd}\Largb{result}\Largb{number}\Largb{number}\\
\Lcs{pstFPsub}\Largb{result}\Largb{number}\Largb{number}\\
\Lcs{pstFPmul}\Largb{result}\Largb{number}\Largb{number}\\
\Lcs{pstFPdiv}\Largb{result}\Largb{number}\Largb{number}
\end{BDef}

\begin{LTXexample}[width=5cm]
\pstFPmul\Result{-3.405}{0.02345} \Result\quad
\pstFPdiv\Result{-3.405}{0.02345} \Result\\
\pstFPmul\Result{0.02345}{-3.405} \Result\quad
\pstFPdiv\Result{0.02345}{-3.405} \Result\\
\pstFPmul\Result{234.123}{33} \Result\quad
\pstFPdiv\Result{234.123}{33} \Result\\
\pstFPadd\Result{234.123}{33} \Result\quad
\pstFPadd\Result{234.123}{-33} \Result\\
\pstFPsub\Result{234.123}{33} \Result\quad
\pstFPsub\Result{-234.123}{33} \Result
\end{LTXexample}

The zeros can be stripped with the macro \Lcs{pstFPstripZeros}. Expect 
always rounding errors, \TeX\ was not made for calculations \ldots
The value is converted into a length and then reconverted to a 
number by stripping the unit. Which also strips the zeros.

\begin{LTXexample}[width=5cm]
\pstFPmul\Result{-3.405}{0.02345} 
\pstFPstripZeros{\Result}{\Result}\Result\quad
\pstFPdiv\Result{-3.405}{0.02345} 
\pstFPstripZeros{\Result}{\Result}\Result\\
\pstFPmul\Result{0.02345}{-3.405} 
\pstFPstripZeros{\Result}{\Result}\Result\quad
\pstFPdiv\Result{0.02345}{-3.405} 
\pstFPstripZeros{\Result}{\Result}\Result
\end{LTXexample}

%--------------------------------------------------------------------------------------
\subsection{\nxLcs{pstFPMul} and \nxLcs{pstFPDiv}}
%--------------------------------------------------------------------------------------
Integer multiplication and division:

\begin{BDef}
\Lcs{pstFPMul}\Largb{result as a truncated integer}\Largb{number}\Largb{number}\\
\Lcs{pstFPDiv}\Largb{result as a truncated integer}\Largb{number}\Largb{number}
\end{BDef}

\begin{LTXexample}[width=5cm]
\makeatletter
\pstFPMul\Result{-34.05}{0.02345} \Result\quad
\pstFPDiv\Result{-3.405}{0.02345} \Result\\
\pstFPMul\Result{23.45}{-3.405} \Result\quad
\pstFPDiv\Result{0.2345}{-0.03405} \Result\\
\pstFPMul\Result{234.123}{33} \Result\quad
\pstFPDiv\Result{234.123}{33} \Result
\makeatother
\end{LTXexample}

%--------------------------------------------------------------------------------------
\section{The PostScript header files}
\subsection{\nxLFile{pstricks.pro}}
%--------------------------------------------------------------------------------------
It contains now most of the stuff from \LPack{pstricks-add} and the new routines
for plotting lines/curves with symbols.

%--------------------------------------------------------------------------------------
\subsection{\nxLFile{pst-algparser.pro}}
\subsubsection{Using the \nxLkeyword{Sum} function}
%--------------------------------------------------------------------------------------

\begin{BDef}
\Lcs{Sum}\Largr{<index name>,<start>,<step>,<end>,<function>}
\end{BDef}

Let's plot the first development of cosine with polynomials:
$\displaystyle\sum_{n=0}^{+\infty}\frac{(-1)^nx^{2n}}{n!}$.

\begin{center}
\bgroup
\psset{algebraic=true, plotpoints=501, yunit=3}
\def\getColor#1{\ifcase#1 black\or red\or magenta\or yellow\or green\or Orange\or blue\or
  DarkOrchid\or BrickRed\or Rhodamine\or OliveGreen\fi}
\begin{pspicture}(-7,-1.5)(7,1.5)
  \psclip{\psframe(-7,-1.5)(7,1.5)}
    \psplot{-7}{7}{cos(x)}
    \multido{\n=1+1}{10}{%
      \psplot[linewidth=1pt,linecolor=\getColor{\n}]{-7}{7}{%
         Sum(ijk,0,1,\n,(-1)^ijk*x^(2*ijk)/fact(2*ijk))}}
   \endpsclip
  \psaxes(0,0)(-7,-1.5)(7,1.5)
\end{pspicture}
\egroup
\end{center}
\begin{lstlisting}
\psset{algebraic=true, plotpoints=501, yunit=3}
\def\getColor#1{\ifcase#1 black\or red\or magenta\or yellow\or green\or Orange\or blue\or
  DarkOrchid\or BrickRed\or Rhodamine\or OliveGreen\fi}
\begin{pspicture}(-7,-1.5)(7,1.5)
  \psclip{\psframe(-7,-1.5)(7,1.5)}
    \psplot{-7}{7}{cos(x)}
    \multido{\n=1+1}{10}{%
      \psplot[linewidth=1pt,linecolor=\getColor{\n}]{-7}{7}{%
         Sum(ijk,0,1,\n,(-1)^ijk*x^(2*ijk)/fact(2*ijk))}}
   \endpsclip
  \psaxes(0,0)(-7,-1.5)(7,1.5)
\end{pspicture}
\end{lstlisting}

\clearpage
%--------------------------------------------------------------------------------------
\subsection[\nxLps{IfTE}]{The variable step algorithm together with the PostScript function \nxLps{IfTE}}
%--------------------------------------------------------------------------------------
\xLps{IfTE}\xLkeyword{VarStep}\xLkeyword{VarStepEpsilon}

\begin{BDef}
\Lps{IfTE}\Largr{<condition>,<true part>,<false part>}
\end{BDef}

Nesting of several \Lps{IfTE} is possible and seen in the
following examples. A classic example is a piece-wise linear
function.

\begin{center}
\psset{unit=0.7cm}
\begin{pspicture}(-7.5,-2.5)(7.5,6)
  \psaxes{->}(0,0)(-7,-2)(7.5,6)[x,-90][y,0]
  \psset{algebraic=true, plotpoints=21,linewidth=2pt}
  \psplot[linecolor=blue]{-7.5}{7.5}{IfTE(x<-6,8+x,IfTE(x<0,-x/3,IfTE(x<3,2*x,9-x)))}
  \psplot[linecolor=red, plotpoints=101]{-7.5}{7.5}{%
      IfTE(2*x<-2^2*sqrt(9),7+x,IfTE(x<0,x^2/18-1,IfTE(x<3,2*x^2/3-1,8-x)))}%
\end{pspicture}
\end{center}
\psset{unit=1cm}

\begin{lstlisting}
\psset{unit=1.5, algebraic, ?\ON?VarStep?\OFF?, showpoints, ?\ON?VarStepEpsilon?\OFF?=.001}
\begin{pspicture}[showgrid=true](-7,-2)(2,4)
  \psplot{-7}{2}{?\ON?IfTE?\OFF?(x<-5,-(x+5)^3/2,?\ON?IfTE?\OFF?(x<0,0,x^2))}
  \psplot{-7}{2}{5*x/9+26/9}
  \psplot[linecolor=blue]{-7}{2}{(x+7)^30/9^30*4.5-1/2}
  \psplot[linecolor=red]{-6.9}{2}
      {?\ON?IfTE?\OFF?(x<-6,ln(x+7),?\ON?IfTE?\OFF?(x<-3,x+6,?\ON?IfTE?\OFF?(x<0.1415926,sin(x+3)+3,3.1415926-x)))}
\end{pspicture}
\end{lstlisting}

When you program a piece-wise defined function you must take care
that a plotting point must be put at each point where the
description changes. Use \Lkeyword{showpoints}=true to see what's
going on when there is a problem. You are on the safe side when
you choose a big number for \Lkeyword{plotpoints}.


\begin{center}
\psset{unit=0.75}
\begin{pspicture}(-8,-8)(8,8)
  \psaxes{->}(0,0)(-8,-8)(8,8)[x,-90][y,0]
  \psset{plotpoints=1000,linewidth=1pt}
  \psplot[algebraic=true]{-8}{8}{ceiling(x)}
  \psplot[algebraic=true, linecolor=yellow]{-8}{8}{rand/(2^31-1)+x}
  \psplot[algebraic=true, linecolor=red]{-8}{8}{floor(x)}
  \psplot[algebraic=true, linecolor=blue]{-8}{8}{round(x)}
  \psplot[algebraic=true, linecolor=green]{-8}{8}{truncate(x)}
  \psplot[algebraic=true, linecolor=cyan]{-8}{8}{div(mul(4,x),7)}
  \psplot[algebraic=true, linecolor=gray]{-8}{8}{abs(x)+abs(x-3)-abs(5-5*x/7)}
  \psplot[algebraic=true, linecolor=gray]{-8}{8}{abs(3*cos(x)+1)}
  \psplot[algebraic=true, linecolor=magenta]{-8}{8}{floor(8*cos(x))}
\end{pspicture}
\end{center}

\begin{lstlisting}
\psset{unit=0.75}
\begin{pspicture}(-8,-8)(8,8)
  \psaxes{->}(0,0)(-8,-8)(8,8)[x,-90][y,0]
  \psset{plotpoints=1000,linewidth=1pt}
  \psplot[algebraic=true, linecolor=yellow]{-8}{8}{rand/(2^31-1)+x}
  \psplot[algebraic=true]{-8}{8}{ceiling(x)}
  \psplot[algebraic=true, linecolor=red]{-8}{8}{floor(x)}
  \psplot[algebraic=true, linecolor=blue]{-8}{8}{round(x)}
  \psplot[algebraic=true, linecolor=green]{-8}{8}{truncate(x)}
  \psplot[algebraic=true, linecolor=cyan]{-8}{8}{div(mul(4,x),7)}
  \psplot[algebraic=true, linecolor=gray]{-8}{8}{abs(x)+abs(x-3)-abs(5-5*x/7)}
  \psplot[algebraic=true, linecolor=gray]{-8}{8}{abs(3*cos(x)+1)}
  \psplot[algebraic=true, linecolor=magenta]{-8}{8}{floor(8*cos(x))}
\end{pspicture}
\end{lstlisting}


\subsection[\nxLps{Derive} function]{Successive derivatives of a polynomial with the PostScript function \nxLps{Derive}}

\begin{center}
\bgroup
\psset{unit=2, algebraic=true, VarStep=true, showpoints=true, VarStepEpsilon=.001}
\def\getColor#1{\ifcase#1 Tan\or RedOrange\or magenta\or yellow\or green\or Orange\or blue\or
  DarkOrchid\or BrickRed\or Rhodamine\or OliveGreen\or Goldenrod\or Mahogany\or
  OrangeRed\or CarnationPink\or RoyalPurple\or Lavender\fi}
\begin{pspicture}[showgrid=true](0,-1.2)(7,1.5)
  \psclip{\psframe[linestyle=none](0,-1.1)(7,1.1)}
  \multido{\in=0+1}{16}{%
    \psplot[algebraic=true, linecolor=\getColor{\in}]{0.1}{7}
    {Derive(\in,Sum(i,0,1,7,(-1)^i*x^(2*i)/Fact(2*i)))}}
  \endpsclip
\end{pspicture}
\egroup
\end{center}

\begin{lstlisting}
\psset{unit=2, algebraic=true, VarStep=true, showpoints=true, VarStepEpsilon=.001}
\def\getColor#1{\ifcase#1 Tan\or RedOrange\or magenta\or yellow\or green\or Orange\or blue\or
  DarkOrchid\or BrickRed\or Rhodamine\or OliveGreen\or Goldenrod\or Mahogany\or
  OrangeRed\or CarnationPink\or RoyalPurple\or Lavender\fi}
\begin{pspicture}[showgrid=true](0,-1.2)(7,1.5)
  \psclip{\psframe[linestyle=none](0,-1.1)(7,1.1)}
  \multido{\in=0+1}{16}{%
    \psplot[algebraic=true, linecolor=\getColor{\in}]{0.1}{7}
    {Derive(\in,Sum(i,0,1,7,(-1)^i*x^(2*i)/Fact(2*i)))}}
  \endpsclip
\end{pspicture}
\end{lstlisting}


\subsection{Special arrow option \texttt{arrowLW}}

Only for the arrowtype \Lnotation{o}, \Lnotation{oo}, \Lnotation{*}, and \Lnotation{**} it is possible to
set the arrowlinewidth with the optional keyword \Lkeyword{arrowLW}.
When scaling an arrow by the keyword \Lkeyword{arrowscale} the width
of the borderline is also scaled. With the optional argument
\Lkeyword{arrowLW} the line width can be set separately and is not
taken into account by the scaling value.

\begin{LTXexample}[width=4cm]
\begin{pspicture}(4,6)
\psline[arrowscale=3,arrows=*-o](0,5)(4,5)
\psline[arrowscale=3,arrows=*-o,
  arrowLW=0.5pt](0,3)(4,3)
\psline[arrowscale=3,arrows=*-o,
  arrowLW=0.3333\pslinewidth](0,1)(4,1)
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[width=4cm]
\begin{pspicture}(4,6)
\psline[arrowscale=3,arrows=**-oo](0,5)(4,5)
\psline[arrowscale=3,arrows=**-oo,
  arrowLW=0.5pt](0,3)(4,3)
\psline[arrowscale=3,arrows=**-oo,
  arrowLW=0.3333\pslinewidth](0,1)(4,1)
\end{pspicture}
\end{LTXexample}



%--------------------------------------------------------------------------------------
\clearpage
\section{\nxLcs{psforeach} and \nxLcs{psForeach}}
%--------------------------------------------------------------------------------------

The macro \Lcs{psforeach} allows a loop with an individual increment.

\begin{BDef}
\Lcs{psforeach}\Largb{variable}\Largb{value list}\Largb{action}\\
\Lcs{psForeach}\Largb{variable}\Largb{value list}\Largb{action}
\end{BDef}

With \Lcs{psforeach} the \Larg{action} is done inside a group and for \Lcs{psForeach} not.
This maybe useful when using the macro to create tabular cells, which are
alread grouped itself.

\begin{LTXexample}[width=6cm]
\begin{pspicture}[showgrid=true](5,5)
  \psforeach{\nA}{0, 1, 1.5, 3, 5}{%
    \psdot[dotscale=3](\nA,\nA)}
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[pos=t]
%\usepackage{pst-func}
\makeatletter
\newcommand*\InitToks{\toks@={}}
\newcommand\AddToks[1]{\toks@=\expandafter{\the\toks@ #1}}
\newcommand*\PrintToks{\the\toks@}
\newcommand*{\makeTable}[4][5mm]{%
  \begingroup
    \InitToks%
    \AddToks{\begin{tabular}{|*{#2}{>{\RaggedLeft}p{#1}|}@{}l@{}}\cline{1-#2}}
    \psForeach{\iA}{#3}{\expandafter\AddToks\expandafter{\iA & }}
    \AddToks{\\\cline{1-#2}}%
    \psForeach{\iA}{#3}{\expandafter\AddToks\expandafter{\expandafter%
      \psPrintValue\expandafter{\iA\space /x ED #4} & }}
    \AddToks{\\\cline{1-#2}\end{tabular}}%
    \PrintToks
  \endgroup
}
\makeatother

\sffamily
\psset{decimals=2,valuewidth=7,xShift=-20}
$y=2^x$\\
\makeTable[1cm]{6}{2,4,6,8,10,12}{2 x exp}
\end{LTXexample}

The value List can also be given by the first two and the last value, e.\,g. \verb=1,4,..,31=,
then \PST calculates all values with the distance given by the first two values.

\begin{LTXexample}[pos=t]
\psset{xunit=0.55cm,yunit=2cm}
\begin{pspicture}[showgrid](0,-5mm)(25,1)
  \psforeach{\nA}{0, 3.14,..,25}{\psline(\nA,0)(\nA,1)}
\end{pspicture}
\end{LTXexample}

The internal counter for the steps is named \LCtr{psLoopIndex} and can be used for own purposes.

\begin{LTXexample}[pos=l,width=6cm]
\begin{pspicture}[showgrid=true](5,5)
\psforeach{\nA}{0, 1, 1.5, 2.25, 5}{%
  \psdot[dotscale=3](\the\psLoopIndex,\nA)}
\end{pspicture}
\end{LTXexample}




\part{\nxLPack{pst-node} -- package}

\section{\nxLFile{pst-node.tex}}

The package \LPack{pst-node} now uses the advanced key handling from \LPack{xkeyval}. The reason
why it moved from the base into the contrib sections, where all packages uses \LPack{xkeyval}.

\part{\nxLPack{pst-plot} -- package}

\section{\nxLFile{pst-plot.tex}}

The package \LPack{pst-plot} now uses the advanced key handling from \LPack{xkeyval}. The reason
why it moved from the base into the contrib sections, where all packages uses \LPack{xkeyval}.

\nocite{*}
\bibliographystyle{plain}
\bibliography{PSTricks}

\printindex


\end{document}