summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/pspicture/pspicture.dtx
blob: 4bb464b4c14422f63c300f4c696212b73288b7ee (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
%
% \iffalse
%%
%% Source File `pspicture.dtx'.
%% Copyright (C) 1992 1999 David Carlisle
%% This file may be distributed under the terms of the LPPL.
%% See 00readme.txt for details.
%%
%
%<*dtx>
          \ProvidesFile{pspicture.dtx}
%</dtx>
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{pspicture}
%<driver>\ProvidesFile{pspicture.drv}
%<*package,driver>
% \fi
%         \ProvidesFile{pspicture.dtx}
          [1999/04/11/ v2.02 Picture mode via PS specials (DPC)]
%
% \iffalse
%</package,driver>
%<*driver>
\documentclass{ltxdoc}
\begin{document}
\DocInput{pspicture.dtx}
\end{document}
%</driver>
% \fi
%
% \GetFileInfo{pspicture.dtx}
% \CheckSum{110}
%
% \changes{1}   {1989/05/10}{(Not made widely available)}
% \changes{2}   {1992/01/02}{support for dvips added}
% \changes{2.01}{1992/06/16}{First public release}
% \changes{2.02}{1999/04/11}{Fix for `new' docstrip, and LPPL}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \title{The \textsf{pspicture} package\thanks{This file
%        has version number \fileversion, last
%        revised \filedate.}}
%
% \author{D. P. Carlisle}
% \date{16 June 1992}
% \maketitle
%
%
% \section{Introduction}
% {\tt pspicture} is a re-implementation, and extension of, \LaTeX's
% {\tt picture} environment, using PostScript |\special|'s. This has
% several advantages, mainly that lines of arbitrary slope and thickness
% may be specified, and there is no limit on the size of the circles
% that may be drawn\footnote{^^A
% There is a certain amount of overlap between this style option and the
% widely available {\tt eepic} option. However when I wrote the first
% version of this, in 1989, I was not aware of {\tt eepic}, and {\tt
% pspicture} has been reasonably popular in Manchester, even
% though {\tt epic} and {\tt eepic} have been installed.}.
%
% One disadvantage is that the picture can no longer be previewed on a
% |dvi| previewer, such as |xdvi|. To help with this problem, a
% companion style option, {\tt texpicture}, may be used while developing
% a document, this uses the standard picture commands as much as
% possible, and silently omits any picture objects that can not be drawn
% with standard \LaTeX.
%
% A second disadvantage, is that a {\tt dvi} file produced with {\tt
% pspicture} will contain embedded |\special| commands. These commands
% will only work with the driver program for which they were intended.
% This makes the {\tt dvi} file less portable. {\tt pspicture} will by
% default use |\special|'s set up for Rokicki's {\tt dvips} program,
% although it should be easy to modify the code to work with other
% PostScript drivers. A {\sc DocStrip} option for a version of {\tt
% dvi2ps} is included with this distribution.
%
% \subsection{Commands Available}{\parskip=\baselineskip\parindent=0pt
% \DescribeMacro{\circle}\DescribeMacro{\circle*}
%   Use as described in the \LaTeX\ book but with no maximum diameter.
%   The thickness of the circle is altered by the |\linethickness|
%   command. The size of the circle produced by |\circle*| is not
%   affected by |\linethickness|, so it is not the same as `filling in'
%   the circle drawn by |\circle|.
%
% \DescribeMacro{\oval}
%   Use as described in the \LaTeX\ book, but as there is no maximum
%   diameter for the circular arcs, the oval (in the absence of the
%   optional |[tr]| etc) always consists of two semi-circular arcs
%   joined by a pair of parallel lines. To obtain a `rectangle with
%   rounded corners' the oval command has a second optional argument
%   (given first !).\\
%   |\oval[20](100,200)[t]|\\
%   Produces the top half of an oval with quarter circles of radius
%   20*unitlength.
%   If unitlength = 1pt then this is equivalent to the standard oval
%   command. In general |\oval[R](x,y)| uses circular arcs of radius
%   $\min(R,x/2,y/2)$.
%
% \DescribeMacro{\line}\DescribeMacro{\vector}
%  Use as described in the \LaTeX\ book but with no restriction on the
%  available slopes. The thickness of a sloping line is altered by the
%  |\linethickness| command.
%
% \DescribeMacro{\Line}\DescribeMacro{\Vector}
%  New forms of the line and vector commands.\\
%   |\put(x1,y1){\Line(x2,y2)}|\\
%   produces a line from (x1,y1) to (x1+x2,y1+y2) and similarly for
%   |\Vector|.
%
% \DescribeMacro{\Curve}
%  Like |\Line| except that it produce a curve!\\
%   |\put(x1,y1){\Curve(x2,y2){m}}|\\
%   produces a curve from (x1,y1) to (x1+x2,y1+y2). the amount of
%   curvature is controlled by m but try $1$ or $-1$ first. m does not
%   have to be an integer. Negative numbers curve the opposite way to
%   positive numbers.
%
% \DescribeMacro{\thinlines}\DescribeMacro{\thicklines}%
% \DescribeMacro{\linethickness}
%  These commands alter the thickness of {\bf all} lines including
%  slanted lines and circular arcs.\vspace{\baselineskip}
%
% \DescribeMacro{\arrowlength}
%  A new command which specifies the size of the arrowhead drawn by the
%  |\vector| and |\Vector| commands. Like |\linethickness| it does not
%  get multiplied by |\unitlength|. At present the arrowhead is
%  triangular. If a head with curved sides more like the standard
%  \LaTeX\ head is required the definition of |!A| in pspicture.ps
%  should be altered.
%
% Other {\tt picture} mode commands are not altered by this style, and
% so may be used, just as described in the \LaTeX\ book. These include:
% |\put|, |\multiput|, |\makebox|, |\framebox|, |dashbox| and
% |\shortstack|.
%
% }\newpage\section{Examples}
%
% \noindent A picture built with \LaTeX's line and circle fonts.
%
% \noindent\begin{picture}(300,130)
% \put(0,0){\line(1,2){50}}
% \put(50,50){\vector(1,1){30}}
% \put(50,50){\circle{30}}
% \put(100,50){\circle*{10}}
% \put(150,50){\oval(50,20)[t]}
% \put(150,100){\oval(30,30)[bl]}
%
% ^^A LaTeX does not do these so well
% \put(250,60){\circle{60}}
% \put(250,60){\circle{50}}
%
% \end{picture}
%
% \bigskip
% \def\eatmodule#1>{}

%\eatmodule
%<*x>
 \ifcat a\noexpand @\else
 \MakePercentComment
 \def\ProvidesPackage#1[#2]{}
 \def\NeedsTeXFormat#1{}
 \makeatletter         ^^A This is NOT the usual way to access this
 \input{pspicture.sty} ^^A style. It is intended as a style option:
 \makeatother          ^^A \documentstyle[a4,pspicture]{article}
 \MakePercentIgnore
 \fi
%\eatmodule
%</x>
%
% \noindent The same picture built with PostScript |\special|'s.
%
% \noindent\begin{picture}(300,130)
% \put(0,0){\line(1,2){50}}
% \put(50,50){\vector(1,1){30}}
% \put(50,50){\circle{30}}
% \put(100,50){\circle*{10}}
% \put(150,50){\oval(50,20)[t]}
% \put(150,100){\oval(30,30)[bl]}
%
% ^^A LaTeX does not do these so well
% \put(250,60){\circle{60}}
% \put(250,60){\circle{50}}
%
% \end{picture}
%
% \bigskip
% \noindent Some extra features not available using the standard picture
% mode.
%
% \noindent\begin{picture}(300,150)
% \put(250,60){\vector(-8,1){50}} ^^A Vector of any slope.
% \put(200,0){\Line(100,100)}     ^^A Line command.
% \put(210,100){\Vector(90,10)}   ^^A Vector command.
% \put(70,90){\oval(100,70)}      ^^A Control over the radius of
% \put(70,90){\oval[10](100,70)}  ^^A   `corners' of an oval.
% \linethickness{3pt}
% \put(20,20){\circle{20}}        ^^A Circles of any thickness and size.
% \put(20,20){\line(10,1){30}}    ^^A Sloping lines of any thickness.
%
% \end{picture}
%
% \StopEventually{}
%
% \section{pspicture.sty}
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
%
% First we set up the code that is specific to the driver program that
% is being used. If the driver can incorporate a header file, define
% |\PS@header| appropriately, |\PS@special| should expand to the format
% for inline PostScript code. The driver should protect this code with a
% (g)save (g)restore pair. dvips is treated specially so that it will be
% the default driver if this file is used without being stripped. If you
% find definitions of these macros which work for the driver you use,
% email me, and I will include them in the next release.
% \begin{macro}{\PS@header}
% Code to include the PostScript header.
%    \begin{macrocode}
%<*dvips>
       \def\PS@header#1{\special{header=#1}}
%</dvips>
%<dvi2ps>\def\PS@header#1{\typeout{Print with the option -i #1}}
\PS@header{pspicture.ps}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PS@special}
% The format of the |\special| command for inline PostScript.
%    \begin{macrocode}
%<*dvips>
       \def\PS@special#1{\special{"#1}}
%</dvips>
%<dvi2ps>\def\PS@special#1{\special{pstext="#1"}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\strippt}
% Strip the final `pt' off the string returned by |\the|.
%    \begin{macrocode}
{\catcode`t=12\catcode`p=12\gdef\noPT#1pt{#1}}
\def\strippt#1{\expandafter\noPT\the#1\space}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@circle}
% Internal name for |\circle|.
%    \begin{macrocode}
\def\@circle#1{%
  \@tempdimb #1\unitlength
  \PS@special{%
       \strippt\@wholewidth
       \strippt\@tempdimb
       !C}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@dot}
% Internal name for |\circle*|.
%    \begin{macrocode}
\def\@dot#1{%
  \@tempdimb #1\unitlength
  \PS@special{%
       \strippt\@tempdimb
       !D}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\line}
% Line with a \LaTeX\ style slope specification.
%    \begin{macrocode}
\def\line(#1,#2)#3{%
  \@linelen=#3\unitlength
  \PS@special{%
       \strippt\@wholewidth
       #1
       #2
       \strippt\@linelen
       !L}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\vector}
% Line and arrow head with a \LaTeX\ style slope specification.
%    \begin{macrocode}
\def\vector(#1,#2)#3{%
  \@linelen=#3\unitlength
  \PS@special{%
       \strippt\@arrowlength
       \strippt\@wholewidth
       #1
       #2
       \strippt\@linelen
       !V}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\oval}
% If no optional argument appears, use a default of maximum radius of
% \TeX's maximum length.
%    \begin{macrocode}
\def\oval{%
  \@ifnextchar[%
   {\@ov@l}%
   {\count@=\maxdimen \divide\count@ by \unitlength \@ov@l[\count@]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@ov@l}
% Look for an optional |tlbr| argument.
%    \begin{macrocode}
\def\@ov@l[#1](#2,#3){%
  \@ifnextchar[{\@oval[#1](#2,#3)}{\@oval[#1](#2,#3)[]}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@oval}
% The PostScript version of the |\oval| command will print each quarter
% of the oval separately, each quarter will only be printed if the
% appropriate argument is $1$. An optional argument of |t| causes the
% arguments for the two bottom quarters to be set to $0$, similarly, |r|
% causes the two left quarters to be set to $0$. Thus an argument [tr]
% will set the bottom and left quarters to $0$, resulting in only the
% top right quarter being printed.
%    \begin{macrocode}
\def\@oval[#1](#2,#3)[#4]{\begingroup
  \@tempdimb #1\unitlength
  \@ovxx #2\unitlength
  \@ovyy #3\unitlength
  \def\r{\def\TL{0 }\def\BL{0 }}%
  \def\l{\def\TR{0 }\def\BR{0 }}%
  \def\t{\def\BL{0 }\def\BR{0 }}%
  \def\b{\def\TL{0 }\def\TR{0 }}%
  \def\TL{1 }\def\BL{1 }\def\TR{1 }\def\BR{1 }%
  \@tfor\@tempa :=#4\do{\csname\@tempa\endcsname}%
  \PS@special{%
       \BR\BL\TR\TL
       \strippt\@wholewidth
       \strippt\@tempdimb
       \strippt\@ovxx
       \strippt\@ovyy
       !O}%
  \endgroup}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Line}
% New style |\Line| command.
%    \begin{macrocode}
\def\Line(#1,#2){%
  \@ovxx #1\unitlength
  \@ovyy #2\unitlength
  \PS@special{%
       \strippt\@wholewidth
       \strippt\@ovxx
       \strippt\@ovyy
       !L2}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Curve}
% Not particularly good, but it will do for now.
%    \begin{macrocode}
\def\Curve(#1,#2)#3{%
  \@ovxx #1\unitlength
  \@ovyy #2\unitlength
  \PS@special{%
       \strippt\@wholewidth
       \strippt\@ovxx
       \strippt\@ovyy
       #3
       !C2}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Vector}
% New style |\Vector| command.
%    \begin{macrocode}
\def\Vector(#1,#2){%
  \@ovxx #1\unitlength
  \@ovyy #2\unitlength
  \PS@special{%
       \strippt\@arrowlength
       \strippt\@wholewidth
       \strippt\@ovxx
       \strippt\@ovyy
       !V2}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@arrowlength}
% Length of an arrow head.
%    \begin{macrocode}
\newdimen\@arrowlength
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\arrowlength}
% Set the length of an arrow head.
%    \begin{macrocode}
\def\arrowlength#1{\@arrowlength #1}
\arrowlength{8pt}
%    \end{macrocode}
% \end{macro}
% If this file is used as a {\tt .sty} file without being stripped, we
% want to stop here. The |\endinput| must not be at the beginning of the
% line, or {\sf DocStrip} will stop here as well!.
%    \begin{macrocode}
     \endinput
%    \end{macrocode}
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}

% \section{texpicture.sty}
% A dummy style file so that documents using {\tt pspicture.sty}
% can be previewed or printed (as much as possible) using a
% dvi (not PostScript) previewer or printer driver.

% Just change `{\tt pspicture}' to `{\tt texpicture}' in the
% |\documentstyle| options list.

%    \begin{macrocode}
%<*texsty>
%    \end{macrocode}

%    \begin{macrocode}
\@warning{texpicture.sty in operation:^^J\@spaces
LaTeX document with pspicture.sty before printing}
%    \end{macrocode}
% \begin{macro}{\Line}
% \begin{macro}{\Vector}
% \begin{macro}{\arrowlength}
% \begin{macro}{\Curve}
% Define all these new commands to silently gobble their arguments.
%    \begin{macrocode}
\def\Line(#1,#2){}
\def\Vector(#1,#2){}
\def\arrowlength#1{}
\def\Curve(#1,#2)#3{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@badlinearg}
% If a vector or line is called with a slope specification that is not
% allowed by standard \LaTeX, |\@badlinearg| is called to produce the
% error message. We do not want to see these errors, so:
%    \begin{macrocode}
\def\@badlinearg{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\oval}
% \begin{macro}{\@@v@l}
% \begin{macro}{\@@vv@l}
% Give the standard |\oval| command another optional argument (which
% will be ignored), to match the extra argument defined in {\tt
% pspicture.sty}.
%    \begin{macrocode}
\let\@@v@l\oval
\def\@@@v@l[#1]{\@@v@l}
\def\oval{\@ifnextchar[{\@@@v@l}{\@@v@l}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
%</texsty>
%    \end{macrocode}
%
% \section{pspicture.ps}
% The PostScript header file for use with {\tt pspicture.sty}.
% Probably this should use the PostScript dictionary mechanism, to keep
% identifiers local to this package, but for now, just give them names
% begining with {\tt!}.
%    \begin{macrocode}
%<*ps>
%    \end{macrocode}
%
% \begin{macro}{!BP}
% PostScript uses \TeX's |bp|, that is $1/72$ of an inch, not \TeX's
% |pt|, $1/72.27$ of an inch, but it is inconvenient to get \TeX\ to
% output in |bp|, so we need to scale the PostScript.
%    \begin{macrocode}
/!BP{
  72 72.27 div dup scale
  }def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{!A}
% Arrow head:\\
% \meta{arrow length} |!A|
%    \begin{macrocode}
/!A{
  newpath
  0 0 moveto
  dup neg dup .4 mul rlineto
  .8 mul 0 exch  rlineto
  closepath
  fill
  } def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{!V}
% |\vector(|\meta{x}|,|\meta{y}|)| \\
% \meta{arrow length} \meta{line width} \meta{x} \meta{y}
%             \meta{len*unitlength} |!V|
%    \begin{macrocode}
/!V{
  !BP
  /!X exch def
  /!y exch def
  /!x exch def
  newpath
  0 0 moveto
  !x 0 eq {0  !y 0 lt {!X neg}{!X} ifelse}
         {!x 0 lt {!X neg}{!X}ifelse  !X !y mul !x abs div} ifelse
  lineto
  setlinewidth  % @wholewidth
  currentpoint
  stroke
  translate
  !y !x atan
  rotate
  !A            % @arrowlength
  }def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{!L}
% |\line(|\meta{x}|,|\meta{y}|)| \\
% \meta{arrow length} \meta{line width} \meta{x} \meta{y}
%             \meta{len*unitlength} |!L|
%    \begin{macrocode}
/!L{
  !BP
  /!X exch def
  /!y exch def
  /!x exch def
  newpath
  0 0 moveto
  !x 0 eq {0  !y 0 lt {!X neg}{!X} ifelse}
         {!x 0 lt {!X neg}{!X}ifelse  !X !y mul !x abs div} ifelse
  lineto
  setlinewidth  % @wholewidth
  stroke
  }def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{!C}
% |\circle{|\meta{diam}|}| \\
% \meta{line width} \meta{diam*unitlength} |!C|
%    \begin{macrocode}
/!C{
  !BP
  0 0 3 2 roll
  2 div 0 360 arc
  setlinewidth  % @wholewidth
  stroke
  }def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{!D}
% |\circle*{|\meta{diam}|}| \\
% \meta{diam*unitlength} |!D|
%    \begin{macrocode}
/!D{
  !BP
  0 0 3 2 roll
  2 div 0 360 arc fill
  }def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{!O}
% |\oval[|\meta{max-radius}|](|\meta{x}|,|\meta{y}|)[|\meta{tlbr}|]| \\
% \meta{br}\meta{bl}\meta{tr}\meta{tl}\\
%       \meta{line width} \meta{max-radius*unitlength}
%          \meta{x*unitlength} \meta{y*unitlength} |!O|\\
% The first four arguments should be either $0$, denoting that that
% quarter should not be drawn, or $1$, to draw a quarter oval.
%    \begin{macrocode}
/!O{
  !BP
  /!y exch 2 div def
  /!x exch 2 div def
  /!r exch !x !y
%    \end{macrocode}
% Ghostscript appears to have a {\tt min} operator, so the following 2
% lines could be coded as {\tt min min}, but it's not in the
% Ref.~Manual, and it doesn't work on my printer!
%    \begin{macrocode}
    2 copy gt {exch} if pop
    2 copy gt {exch} if pop
      def
  setlinewidth  % @wholewidth
  1 eq
  {newpath
   !x neg 0 moveto
   !x neg !y 0 !y !r arcto 4 {pop} repeat
   0 !y lineto
   stroke}if
  1 eq
  {newpath
   !x  0 moveto
   !x  !y 0 !y !r arcto 4 {pop} repeat
   0 !y lineto
   stroke}if
  1 eq
  {newpath
   !x neg 0 moveto
   !x neg !y neg 0 !y neg  !r arcto 4 {pop} repeat
   0 !y neg lineto
   stroke}if
  1 eq
  {newpath
   !x  0 moveto
   !x  !y neg 0 !y neg !r arcto 4 {pop} repeat
   0 !y neg lineto
   stroke}if
  }def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{!V2}
% |\Vector(|\meta{x}|,|\meta{y}|)| \\
% \meta{arrow length} \meta{line width} \meta{x*unitlength}
% \meta{y*unitlength} |!V2|
%    \begin{macrocode}
/!V2{
  !BP
  2 copy exch
  atan
  /a exch def
  2 copy
  newpath
  0 0 moveto
  lineto          % <x*unitlength> <y*unitlength>
  3 2 roll
  setlinewidth  % @wholewidth
  stroke
  translate       % <x*unitlength> <y*unitlength>
  a rotate
  !A                    % @arrowlength
  }def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{!L2}
% |\Line(|\meta{x}|,|\meta{y}|)| \\
% \meta{line width} \meta{x*unitlength} \meta{y*unitlength} |!L2|
%    \begin{macrocode}
/!L2{
  !BP
  newpath
  0 0 moveto
  lineto          % <x*unitlength> <y*unitlength>
  setlinewidth  % @wholewidth
  stroke
  }def
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{!C2}
% |\Curve(|\meta{x}|,|\meta{y}|){|\meta{$\pm$}|}| \\
% \meta{line width} \meta{x*unitlength} \meta{y*unitlength} \meta{$\pm$}
%             |!C2|
%    \begin{macrocode}
/!C2{
  !BP
  /!s exch def
  /!y exch def
  /!x exch def
  newpath
  0 0 moveto
  0 0
  !x 2 div !y 10 div !s mul add
  !y 2 div  !x 10 div  !s mul sub
  !x !y
  curveto
  setlinewidth  % @wholewidth
  stroke
  }def
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
%</ps>
%    \end{macrocode}
%
% \end{document}
% \Finale