summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/generic/xypic/xyline.doc
blob: 40fa19abedba45cfdf276959b804c1582df66e43 (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
%% $Id: xyline.doc,v 3.6 1998/03/06 01:28:05 krisrose Exp $
%%
%% Xy-pic ``Line Width'' extension.
%% Copyright (c) 1993-1996	Ross Moore	<ross@mpce.mq.edu.au>
%%
%% This file is part of the Xy-pic package for graphs and diagrams in TeX.
%% See the companion README and INSTALL files for further information.
%% Copyright (c) 1991-1996	Kristoffer H. Rose  <krisrose@ens-lyon.fr>
%%
%% The Xy-pic package is free software; you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by the
%% Free Software Foundation; either version 2 of the License, or (at your
%% option) any later version.
%%
%% The Xy-pic package is distributed in the hope that it will be useful, but
%% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
%% or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
%% for more details.
%%
%% You should have received a copy of the GNU General Public License along
%% with this package; if not, write to the Free Software Foundation, Inc.,
%% 675 Mass Ave, Cambridge, MA 02139, USA.
%%
\ifx\xyloaded\undefined \input xy \fi

\xyprovide{line}{Line styles extension}{\stripRCS$Revision: 3.6 $}%
 {Ross Moore}{ross@mpce.mq.edu.au}%
 {Mathematics Department, Macquarie University, NSW~2109, Australia}

\DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 This extension provides the ability to request various effects related
 to the appearance of straight lines; \eg. thickness, non-standard dashing,
 and colour.

\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph*{Header:}\leavevmode
\DOCHEADER

\DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

These are effects which are not normally available within \TeX.
Instead they require a suitable `back-end' option to provide the necessary
|\special| commands, or extra fonts, together with appropriate 
commands to implement the effects.  Thus
$$
\xy
 *+\txt<.8\hsize>{Using this extension will have no effect on the output
	unless used with a backend that explicitly supports it.}
 *\frm{-}
\endxy
$$

The extension provides special effects that can be used with any \Xy-pic
<object>, by defining |[|<shape>|]| modifiers.
The modification is local to the <object> currently being built,
so will have no effect if this object is never actually used.

\DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph*{Adjusting line thickness}


The following table lists the modifiers primarily to alter the thickness
of lines used by \Xy-pic. They come in two types --- either a single keyword, 
or using the key-character |||| with the following text parsed.
%
\begin{defs}%
 |[thicker]| & double line thickness \cr
 |[thinner]| & halve line thickness \cr
 |[||(|<num>|)]| & multiple of usual thickness\cr
 |[||<|<dimen>|>]| & set thickness to <dimen>\cr
 |[|||<dimen>|]| & also sets to <dimen>\cr
 |[||=|<word>|]| & make |[|<word>|]| set current style settings\cr
 |[||*]| & reuse previous style\cr
 |[butt]| & butt cap at ends\cr
 |[roundcap]| & round cap at ends\cr
 |[projcap]| & projecting square cap.\cr
\end{defs}
%
\noindent
Later settings of the linewidth override earlier settings; 
multiple calls to |[thicker]| and |[thinner]| compound,
but the other variants set an absolute thickness.
The line-thickness specification affects arrow-tips as well as the
thickness of straight lines and curves. 
Three kinds of line-caps are available; they are discussed below
in the section on `poly-lines'.
%
\begin{code}
\xy/r8pc/:*++\txt\huge{C}="c"
,0*++\txt\huge{P}="p",
,"p",{\ar@*{[|(1)]}"p";"c"<20pt>}
,"p",{\ar@*{[|(4)]}"p";"c"<14pt>}
,"p",{\ar@*{[|(10)]}"p";"c"<4pt>}
,"p",{\ar@*{[|(20)]}"p";"c"<-16pt>}
\endxy
\end{code}
$$\docode$$
\medskip
\displaycode
%
Using the \PS\ back-end, the size of the arrow-head grows 
aesthetically with the thickness of the line used to draw it. 
This growth varies as the square-root of the thickness; 
thus for very thick lines (20+ times normal) the arrowhead 
begins to merge with the stem. 

\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Load the |style| extension to establish the necessary infra-structure.

\DOCMODE(
%\xydefcsname@{shape [|...]}#1{\xyFN@\xywidthchar@#1@@}%
\xydefcsname@{*stylechar@|@}#1{\xyFN@\xywidthchar@#1@@}%

%\xydefcsname@{shape [thinner]}{\xyshape@thinner@}
%\xydefcsname@{shape [thicker]}{\xyshape@thicker@}
\xydefcsname@{style [thinner]}{\xyshape@thinner@}
\xydefcsname@{style [thicker]}{\xyshape@thicker@}
\DOCMODE)

\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph*{Implementation}

Record the line thickness locally in a dimen register.
The initial value is read from the |xydash10| font.
Each time |\xylinethick@| is changed, its previous value is stored
as the expansion of |\xyprevwidth@@|, in case this is needed by
a specific back-end.

\DOCMODE(
\xynew@{dimen}\xylinethick@ \xylinethick@=\xydashw@

\xydef@\xyshape@thicker@{\xylinewidth@i{\multiply\xylinethick@\tw@}}
\xydef@\xyshape@thinner@{\xylinewidth@i{\divide\xylinethick@\tw@}}

\xydef@\xylinewidth@i#1{\edef\xyprevwidth@@{\the\xylinethick@}%
 #1\edef\next@{\xylinethick@=\the\xylinethick@}%
 \edef\next@ii{\noexpand\addtotoks@{%
  \noexpand\xylinewidth@@{\next@}{\xyprevwidth@@}}}%
 \next@ii }


\xydef@\xywidthchar@{%
 \ifx \space@\next \expandafter\DN@\space{\xyFN@\xywidthchar@}%gobble spaces
% \else\ifx @\next \DN@ @@{\addtotoks@{\checkXyStyle@}}%
 \else\ifx @\next \DN@ @@{\checkXyStyle@}%
 \else\ifx (\next \DN@ (##1)##2@@{%
  \xylinewidth@i{\xylinethick@=##1\xydashw@}}%
 \else\addLT@\ifx \next \addGT@{\addLT@\DN@ ##1}##2@@{%
  \xylinewidth@i{\xylinethick@=##1\relax}}%
% \else\ifx *\next \DN@ *@@{\addtotoks@{\checkXyStyle@}}%
% \else\ifx *\next \DN@ *@@{\checkXyStyle@}%
 \else\ifx *\next \DN@ *@@{\recoverXyStyle@}%
% \else\addEQ@\ifx \next \addEQ@\DN@##1@@{%
%  \addtotoks@{\checkXyStyle@\xynamestyle@{##1}}}%
 \else\addEQ@\ifx \next \addEQ@\DN@##1@@{\checkXyStyle@
  \addtotoks@{\xynamestyle@{##1}}}%
 \else\ifx C\next \DN@ C##1@@{\xysetlinecap@{##1}@}%
 \else\ifx J\next \DN@ J##1@@{\xysetlinejoin@{##1}@}%
 \else\ifx M\next \DN@ M(##1)@@{\xymiterlimit@{##1}@}%
 \else \DN@##1@@{\xylinewidth@i{\xylinethick@=##1\relax}}%
 \fi\fi\fi\fi\fi\fi\fi\fi\fi \next@}
\DOCMODE)

\DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The diagram in figure~??g[xyrotate.doc:rotate and flips],
page~??gp[xyrotate.doc:rotate and flips], uses different line-thicknesses 
and colours.

\DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\paragraph*{Poly-lines}

By a `poly-line' we mean a path built from straight line segments having no
gaps where each segment abuts the next. The poly-line could be the edges of 
a polygon, either closed or open if the end-points are different. 

The reason for considering a poly-line as a separate <object>, rather than 
simply as a <path> built from straight lines, becomes apparent only when
the lines have appreciable thickness. Then there are several standard ways 
to fashion the `joins' (where segments meet). Also the shape of the `caps'
at either end of the poly-line can be altered. 

The following modifiers are used to determine the shapes of the line `caps'
and `joins': 
%
\begin{defs}%
 |[||J|<val>|]| & join style, <val> = 0, 1 or 2\cr
 |[mitre]| & mitre-join, same as |[||J0]|\cr
 |[roundjoin]| & round join, same as |[||J1]|\cr
 |[bevel]| & bevel-join, same as |[||J2]|\cr
 |[||C|<val>|]| & end-cap, <val> = 0, 1 or 2\cr
 |[butt]| & ``butt'' cap, same as |[||C0]|\cr
 |[roundcap]| & round cap, same as |[||C1]|\cr
 |[projcap]| & ``projecting square'' cap,\hfil\break same as |[||C2]|\cr
 |[||M(|<num>|)]| & set mitrelimit to <num>$\ge1$\cr
\end{defs}
%
\noindent
These effects are currently implemented only with the \PS\ back-end
or when using |\xypolyline| (described below) with a \PS\ <driver>.
In this case the `cap' setting can be applied to any segment, straight  
or curved, whether part of a poly-line or not; however the `join' setting 
applies only to poly-lines. Arrow-tips are not affected. 
The defaults are to use round joins and round-cap ends. 

Adjusting the miter-limit affects how far miters are allowed to protrude 
when two wide lines meet at small angles. The <num> is in units of the 
line-thickness. Higher values mean using bevels only at smaller angles, 
while the value of 1 is equivalent to using bevels at all angles. 
The default miter-limit is 10.

\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Current values are stored in case these are needed within nested portions 
of diagrams.

\DOCMODE(
\xydef@\xylinecap@{2}
\xydef@\xylinejoin@{2}
\xydef@\xylinemiter@{10}
\DOCMODE)

%These are simple methods that alter the stored values.
%
%\DOCMODE(
%\xydef@\xysetlinecap@@#1{\xylinestyle@{C}{#1}{\def\xylinecap@{#1}}}
%\xydef@\xysetlinejoin@@#1{\xylinestyle@{J}{#1}{\def\xylinejoin@{#1}}}
%\xydef@\xysetmiterlimit@@#1{\xylinestyle@{M}{#1}{\def\xylinemiter@{#1}}}
%\DOCMODE)
%
%Finally we need the interface to pass the new values to a <driver>.
%
%\DOCMODE(
%\xydef@\xynolinestyle@@#1#2#3{\let\next=#1\relax #3%
% \ifx\next C\DN@{\xyundefinedLine@{linecap}{#2}@@}%
% \else\ifx\next J\DN@{\xyundefinedLine@{linejoin}{#2}@@}%
% \else\ifx\next M\DN@{\xyundefinedLine@{miterlimit}{#2}@@}%
% \fi\fi\fi \next@ }
%
%\xylet@\xylinestyle@\xynolinestyle@@
%\DOCMODE)

\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Recognise keywords for `line-caps' and `line-joins':

\DOCMODE(
\xydefcsname@{style [bevel]}{\xyshape@bevel@}
\xydefcsname@{style [roundjoin]}{\xyshape@rdjoin@}
\xydefcsname@{style [miter]}{\xyshape@miter@}
%
\xydefcsname@{style [butt]}{\xyshape@butt@}
\xydefcsname@{style [roundcap]}{\xyshape@rdcap@}
\xydefcsname@{style [projcap]}{\xyshape@projcap@}
\DOCMODE)

\DOCMODE(
\xydef@\xyshape@butt@{\xysetlinecap@@0}
\xydef@\xyshape@rdcap@{\xysetlinecap@@1}
\xydef@\xyshape@projcap@{\xysetlinecap@@2}

\xydef@\xyshape@miter@{\xysetlinejoin@@0}
\xydef@\xyshape@rdjoin@{\xysetlinejoin@@1}
\xydef@\xyshape@bevel@{\xysetlinejoin@@2}

\xydef@\xysetlinecap@#1@{\DN@ii{#1}\count@=#1\relax
 \expandafter\DN@\expandafter{\the\count@}%
 \ifx\next@\next@ii\else
  \xywarning@{ignoring extra tokens in line-cap: \next@}\fi
 \expandafter\xysetlinecap@@\expandafter{\next@}}

\xydef@\xysetlinejoin@#1@{\DN@ii{#1}\count@=#1\relax
 \expandafter\DN@\expandafter{\the\count@}%
 \ifx\next@\next@ii\else
  \xywarning@{ignoring extra tokens in line-join: \next@}\fi
 \expandafter\xysetlinejoin@@\expandafter{\next@}}

\xydef@\xysetmiterlimit@#1@{\DN@ii{#1}\dimen@=#1\p@\relax
 \edef\next@{\expandafter\removePT@\the\dimen@}%
 \ifx\next@\next@ii\else
  \xywarning@{ignoring extra tokens in miter-limit: \next@}\fi
 \expandafter\xysetmiterlimit@@\expandafter{\next@}}
\DOCMODE)

\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

These use the more sophisticated approach that is easier to adjust for
different <driver>s.

\DOCMODE(
\xydef@\xysetlinecap@@#1{\xy@linecap@i{\def\xylinecap@{#1}}}
\xydef@\xysetlinejoin@@#1{\xy@linejoin@i{\def\xylinejoin@{#1}}}
\xydef@\xysetmiterlimit@@#1{%
 \xy@linemiter@i{\def\xylinemiter@{#1}}}

\xydef@\xy@linecap@i#1{#1\addtotoks@{\xy@linecap@@{#1}}}
\xydef@\xy@linejoin@i#1{#1\addtotoks@{\xy@linejoin@{#1}}}
\xydef@\xy@linemiter@i#1{#1\addtotoks@{\xy@linemiter@{#1}}}
\DOCMODE)

Implementation of line-caps:

\DOCMODE(
\xydef@\xy@linecap@#1{\checkXyStyle@ \edef\xyprevcap@@{\xylinecap@}%
 #1\let\prexylinecap@=\prexylinecap@@ \let\postxylinecap@=\postxylinecap@@
 \applyLIFOstyle@\prexylinecap@{\xylinecap@}%
  \postxylinecap@{\xyprevcap@@}}

\xydef@\prexylinecap@@{\let\prexylinecap@=\eat@    
 \let\postxylinecap@=\postxylinecap@@ \outputxylinecap@ }
\xydef@\postxylinecap@@{\let\postxylinecap@=\eat@  
 \let\prexylinecap@=\prexylinecap@@ \resetxylinecap@@ }
\xylet@\prexylinecap@=\prexylinecap@@
\xylet@\postxylinecap@=\postxylinecap@@

\xydef@\outputxylinecap@#1{\xycapSpecial@@{#1}}
\xydef@\resetxylinecap@#1{\resetxylinecap@i{#1}\outputxylinecap@{#1}}
\xydef@\resetxylinecap@i#1{\def\xylinecap@{#1}}
\xylet@\resetxylinecap@@=\resetxylinecap@

\xylet@\xycapSpecial@@=\eat@
\DOCMODE)

Implementation of line-joins:

\DOCMODE(
\xydef@\xy@linejoin@#1{\checkXyStyle@
 \edef\xyprevjoin@@{\xylinejoin@}#1%
 \let\prexylinejoin@=\prexylinejoin@@
 \let\postxylinejoin@=\postxylinejoin@@
 \applyLIFOstyle@\prexylinejoin@{\xylinejoin@}%
  \postxylinecap@{\xyprevjoin@@}}

\xydef@\prexylinejoin@@{\let\prexylinejoin@=\eat@    
 \let\postxylinejoin@=\postxylinejoin@@ \outputxylinejoin@ }
\xydef@\postxylinejoin@@{\let\postxylinejoin@=\eat@  
 \let\prexylinejoin@=\prexylinejoin@@ \resetxylinejoin@@ }
\xylet@\prexylinejoin@=\prexylinejoin@@
\xylet@\postxylinejoin@=\postxylinejoin@@

\xydef@\outputxylinejoin@#1{\xyjoinSpecial@@{#1}}
\xydef@\resetxylinejoin@#1{\resetxylinejoin@i{#1}\outputxylinejoin@{#1}}
\xydef@\resetxylinejoin@i#1{\def\xylinejoin@{#1}}
\xylet@\resetxylinejoin@@=\resetxylinejoin@

\xylet@\xyjoinSpecial@@=\eat@
\DOCMODE)

Implementation of miter-limit:

\DOCMODE(
\xydef@\xy@linemiter@#1{\checkXyStyle@
 \edef\xyprevmiter@@{\xylinemiter@}#1%
 \let\prexylinemiter@=\prexylinemiter@@
 \let\postxylinemiter@=\postxylinemiter@@
 \applyLIFOstyle@\prexylinemiter@{\xylinemiter@}%
  \postxylinecap@{\xyprevmiter@@}}

\xydef@\prexylinemiter@@{\let\prexylinemiter@=\eat@    
 \let\postxylinemiter@=\postxylinemiter@@ \outputxylinemiter@ }
\xydef@\postxylinemiter@@{\let\postxylinemiter@=\eat@  
 \let\prexylinemiter@=\prexylinemiter@@ \resetxylinemiter@@ }
\xylet@\prexylinemiter@=\prexylinemiter@@
\xylet@\postxylinemiter@=\postxylinemiter@@

\xydef@\outputxylinemiter@#1{\xymiterSpecial@@{#1}}
\xydef@\resetxylinemiter@#1{\resetxylinemiter@i{#1}\outputxylinemiter@{#1}}
\xydef@\resetxylinemiter@i#1{\def\xylinemiter@{#1}}
\xylet@\resetxylinemiter@@=\resetxylinemiter@

\xylet@\xymiterSpecial@@=\eat@
\DOCMODE)

\DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The path taken by the `poly-line' this is read as the list of <pos>itions 
in the current `stack', ignoring size extents. 
The macro |\xypolyline| is used as a <decor>; it reads the <pos>itions from 
the stack, but leaves the stack intact for later use. 

\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Implementation of `poly-lines'.

\DOCMODE(
\xydef@\xypolyline#1{\xypolyline@{#1}}

\xydef@\xypolyline@#1{\hbox\bgroup
 \enter@{\pfromthep@ \basefromthebase@ \cfromthec@}%
  \def\xyps@list{}\edef\smapp@@{\s@bot}%
  \smapxy@i{\enter@{\pfromthep@ \basefromthebase@ }%
   \edef\xyps@list{\expandafter\removePT@\the\X@c\space
    \expandafter\removePT@\the\Y@c\space \xyps@list}\leave@}%
 \leave@ \xy@polystyle@@{#1}\xydopoly@style\egroup
 \def\Drop@@{\styledboxz@}\def\Connect@@{\styledboxz@}}%
\DOCMODE)

\DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The following diagram illustrates the use of line-thickness, line-joins
and line-caps with poly-lines. It contains an example of each of the styles.

\begin{code} 
\xycompileto{poly}%
{/r4pc/:,*[|<5pt>][thicker]\xybox{%
 *+(3,2){}="X"
;@={p+CU,p+LU,p+LD,p+RD,p+RU,p+CU}
 ,{0*[miter]\xypolyline{}}
 ,{\xypolyline{*}},@i@)
,"X",*+(2.5,1.5){}="X"
,@={!CU,!LU,!LD,!RD,!RU,!CU}
 ,{0*[gray][roundjoin]\xypolyline{}}
 ,{0*[gray]\xypolyline{*}},@i@)
,"X",*+(2,1){}="X"
,@={!CU,!LU,!LD,!RD,!RU,!CU}
 ,{0*[white]\xypolyline{*}}
 ,{0*[bevel]\xypolyline{}},@i@)
,"X"-(.7,0)*++\txt\LARGE{A}="a"
,"X"+(.7,0)*++\txt\LARGE{B}="b" 
,{\ar@{-}@*{[butt][thinner]}"a";"b"<1pc>}
,{\ar@{-}@*{[roundcap][thinner]}"a";"b"}
,{\ar@{-}@*{[projcap][thinner]}"a";"b"<-1pc>}
}}
\end{code} 
$$\docode$$
\displaycode
\noindent
Note the use of |{0*[...]\xypolyline{..}}| to apply style-modifiers 
to a polyline. The |@={!..}| method for loading the stack gives 
equivalent results to using |;@={p+..}|, since |\xypolyline| 
ignores the edge extents of each <pos> in the stack. 

Note also that the argument |#1| to |\xypolyline| affects what
is typeset. Allowable arguments are:
%
\begin{defs}
|\xypolyline{}| & solid line\cr
|\xypolyline{.}| & dotted line\cr
|\xypolyline{-}| & dashed line\cr
|\xypolyline{*}| & fill enclosed polygon\cr
|\xypolyline{?}| & fill enclosed polygon using even-odd rule\cr
|\xypolyline{{*}}| & use |\dir{*}| for lines\cr
|\xypolyline{<toks>}|\kern-20pt & \kern20pt using |\dir{<toks>}| \cr
\end{defs}
\noindent
The latter cases one has |**\dir{...}| being used to connect the vertices 
of the polyline, with |{{*}}| being needed to get |**\dir{*}|. 
Similarly |**\dir| is used when a <driver> is not available to specifically
support polylines; in particular the two `fill' options |*| and |?| will
result in a dotted polygon outline the region intended to be filled. 

In all cases it is up to the user to load the stack before calling 
|\xypolyline{|\dots|}|. A particularly common case is the outline of
an existing \Xy-pic <object>, as in the example above. Future extensions
to |\frm| will provide a simplified mechanism whereby the user need not
call |\xypolyline| explicitly for such effects.

\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\DOCMODE(
\xylet@\xypolyline@Special=\eat@
\xylet@\xypolyfill@Special=\eat@
\xylet@\xypolyeofill@Special=\eat@
\xylet@\xypolydot@Special=\eat@
\xylet@\xypolydash@Special=\eat@

\xydef@\UnloadpolySpecials@{%
 \let\xypolyline@Special=\eat@
 \let\xypolyfill@Special=\eat@
 \let\xypolyeofill@Special=\eat@
 \let\xypolydot@Special=\eat@
 \let\xypolydash@Special=\eat@
}

\xydef@\xy@polystyle@#1{%
 \let\poly@style@@=\xypolyline@Special
 \DNii@{#1}\ifx\nextii@\empty 
 \else\DN@{*}\ifx\next@\nextii@ \let\poly@style@@=\xypolyfill@Special
 \else\DN@{?}\ifx\next@\nextii@ \let\poly@style@@=\xypolyeofill@Special
 \else\expandafter\DN@\expandafter{\addDOT@{}}\ifx\next@\nextii@
  \let\poly@style@@=\xypolydot@Special
 \else\expandafter\DN@\expandafter{\addDASH@{}}\ifx\next@\nextii@
  \let\poly@style@@=\xypolydash@Special
 \else\DN@{{*}}\ifx\next@\nextii@ \def\poly@style@@{\xypolystraight@{*}}%
 \else \def\poly@style@@{\xypolystraight@{#1}}%
 \fi\fi\fi\fi\fi\fi }

\xydef@\xydopoly@style{\expandafter\poly@style@@\expandafter{\xyps@list}}
\xydef@\xynopolystyle@#1#2{\xyundefinedLine@{polyline}{{#1}}@@}
\DOCMODE)

\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

When there is no special support this handles the various cases using 
ordinary thin line types.

\DOCMODE(
\xydef@\xypolynospec@#1{\DNii@{#1}%
 \ifx\nextii@\empty\def\poly@style@@{\xypolystraight@{-}}%
 \else\DN@{.}\ifx\next@\nextii@ \def\poly@style@@{\xypolystraight@{.}}%
 \else\DN@{-}\ifx\next@\nextii@ \def\poly@style@@{\xypolystraight@{--}}%
 \else\DN@{*}\ifx\next@\nextii@ \def\poly@style@@{\xypolystraight@{.}}%
 \else\DN@{?}\ifx\next@\nextii@ \def\poly@style@@{\xypolystraight@{.}}%
 \else\DN@{{*}}\ifx\next@\nextii@ \def\poly@style@@{\xypolystraight@{*}}%
 \else \def\poly@style@@{\xypolystraight@{#1}}%
 \fi\fi\fi\fi\fi\fi }
\DOCMODE)

Gobble the collected positions in |{\xyps@list}|; recover the vertices
from the stack, then set straight lines in the appropriate style.

\DOCMODE(
\xydef@\xypolystraight@#1#2{%
 \enter@{\pfromthep@ \basefromthebase@ \cfromthec@}%
 \edef\smapp@@{\s@bot}\csname S@0\endcsname\czeroEdge@\pfromc@\def\smapp@@{0}%
 \smapxy@i{\czeroEdge@\enter@{\pfromthec@}{\connect@\dir{#1}}\leave@}\leave@ }
\DOCMODE)

\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Initially poly-lines are uninstalled, until loaded by a <driver>.

\DOCMODE(
\xylet@\xy@polystyle@@=\xypolynospec@

\xydef@\UninstallPolylines@{%
 \UnloadpolySpecials@
 \let\xy@polystyle@@=\xypolynospec@ }
\UninstallPolylines@
\DOCMODE)

\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph*{Installation}

Initially there is no support for the actual effects. 

\DOCMODE(
\xydef@\xyundefinedLine@#1#2@@{%
 \xywarning@{The #1 #2 effect is not implemented with the current driver.}}%

\xydef@\xynolinewidth@#1#2{%
 \xyundefinedLine@{linewidth}{\the\xylinethick@}@@}%
\xydef@\xynolinecap@#1{\xyundefinedLine@{linecap}{\xylinecap@}@@}%
\xydef@\xynolinejoin@#1{\xyundefinedLine@{linejoin}{\xylinejoin@}@@}%
\xydef@\xynolinemiter@#1{\xyundefinedLine@{miterlimit}{\xylinemiter@}@@}%
\DOCMODE)

Nothing further can be done unless allowed by a specific <driver>, which 
must establish an alternative expansions to be bound to |\xylinewidth@@|
and the other hooks.

\DOCMODE(
\xylet@\xylinewidth@@=\xynolinewidth@
\xylet@\xy@linecap@@=\xynolinecap@
\xylet@\xy@linejoin@@=\xynolinejoin@
\xylet@\xy@linemiter@@=\xynolinemiter@

\xydef@\UnloadLine@#1{%
 \ifx#1\relax\else\xyunload@{line width extension}\fi
 \let\resetxyline@@=\resetxyline@
 \let\resetxylinecap@@=\resetxylinecap@
 \let\resetxylinejoin@@=\resetxylinejoin@
 \let\resetxylinemiter@@=\resetxylinemiter@
 \let\transxyline@@=\DN@
 \let\xylineSpecial@@=\eat@
 \let\xycapSpecial@@=\eat@
 \let\xyjoinSpecial@@=\eat@
 \let\xymiterSpecial@@=\eat@
 \let\xylinewidth@@=\xynolinewidth@
 \let\xy@linecap@@=\xynolinecap@
 \let\xy@linejoin@@=\xynolinejoin@
 \let\xy@linemiter@@=\xynolinemiter@
 \UninstallPolylines@ }

\xyaddunsupport{line}{\UnloadLine@\relax}
\DOCMODE)

\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

This is a possible alternative for |\xylinewidth@@|. Indeed it is used
with the \PS\ support, which then redefines just |\xylineSpecial@@|.

\DOCMODE(
\xydef@\xylinewidth@#1#2{\checkXyStyle@
 #1\let\prexyline@=\prexyline@@ \let\postxyline@=\postxyline@@
 \applyLIFOstyle@\prexyline@{\the\xylinethick@}\postxyline@{#2}}
\xydef@\prexyline@@{\let\prexyline@=\eat@    
 \let\postxyline@=\postxyline@@ \outputxyline@ }
\xydef@\postxyline@@{\let\postxyline@=\eat@  
 \let\prexyline@=\prexyline@@ \resetxyline@@ }
\xylet@\prexyline@=\prexyline@@
\xylet@\postxyline@=\postxyline@@

\xydef@\resetxyline@#1{\resetxyline@i{#1}\outputxyline@{#1}}
\xydef@\resetxyline@i#1{\xylinethick@=#1\relax}
\xydef@\outputxyline@#1{\transxyline@@{#1}%
 \expandafter\xylineSpecial@@\expandafter{\next@}}
\xylet@\resetxyline@@=\resetxyline@
\DOCMODE)

These need to be rebound by a back-end which supports variation in the
line-thickness.

\DOCMODE(
\xydef@\transxyline@#1{\edef\next@{\removePT@#1}}

\xylet@\transxyline@@=\DN@
\xylet@\xylineSpecial@@=\eat@
\DOCMODE)

\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\paragraph*{The end \& Log}\leavevmode
 
\DOCMODE(
\xyendinput

% $Log: xyline.doc,v $
% Revision 3.6  1998/03/06 01:28:05  krisrose
% Releasing (with Y&Y fonts).
%
% Revision 3.3  1996/12/18  09:22:29  ross
% adjustments for styles now within the kernel code
% fixed problem with line-widths
%
% Revision 3.2  1995/09/19  18:21:41  ross
% Bug fix release.
%
% Revision 3.1  1995/09/05  20:36:33  ross
% Release!
%
% Revision 3.0  1995/07/07  20:13:19  ross
% Major release w/new User's Guide!
%
% Revision 2.13  1995/07/04  15:04:51  ross
% Ready for release of v3.
%
% Revision 2.12  1994/10/25  03:01:14  ross
% Final 3beta release [bug fixes & AMS-LaTeX fitting].
%
% Revision 2.11  1994/07/05  09:27:49  ross
% fixed documentation bug
%
% Revision 2.10  1994/06/15  12:46:03  ross
% Second release 3beta.
% Colour and line style saving works; label colouring bug fixed.
%
% Revision 2.9  1994/06/09  14:39:49  ross
% Release 3beta.
%
% NEW for version 2.9 by Ross Moore.
\DOCMODE)

\DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Tell Emacs that this is a LaTeX document and how it is formatted:
% Local Variables:
% mode:latex
% fill-column:77
% fill-prefix:""
% End: