summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/generic/xypic/xyrotate.doc
blob: 0500208b3436cd5073c524d36c53705d8b9fa0ba (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
%% $Id: xyrotate.doc,v 3.3 1996/12/18 09:40:16 ross Exp $
%%
%% Xy-pic ``Rotate and Scale extension'' option.
%% 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@brics.dk>
%%
%% 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{rotate}{Rotate and Scale extension}{\stripRCS$Revision: 3.3 $}%
 {Ross Moore}{ross@mpce.mq.edu.au}%
 {Mathematics Department, Macquarie University, NSW~2109, Australia}

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

This extension provides the ability to request that any object be displayed
rotated at any angle as well as scaled in various ways.

\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
$$

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

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.

The following table lists the modifiers that have so far been
defined. They come in two types -- either
a single keyword, or a key-character with the following text treated
as a single argument.
%
\begin{defs}
 |[@]| & align with current direction\cr
 |[@|<direction>|]| & align to <direction>\cr
 |[@!|<number>|]| & rotate <number> degrees\cr
% |[@=|<word>|]| & make |[|<word>|]| repeat the current transformations\cr
% |[@*]| & use previous transformations \cr
\noalign{\smallskip}
 |[*|<number>|]| & scale by <number> \cr
 |[*|<num>$_x$,<num>$_y$|]| & scale $x$ and $y$ separately \cr
%\noalign{\smallskip}
% |[<|<direction>|]| & shear y-axis to <direction> \cr
\noalign{\smallskip}
 |[left]| & rotate anticlockwise by 90$^\circ$ \cr
 |[right]| & rotate (clockwise) by 90$^\circ$ \cr
 |[flip]|  & rotate by 180$^\circ$; same as |[*-1,-1]| \cr
 |[dblsize]| & scale to double size \cr
 |[halfsize]| & scale to half size \cr
\end{defs}
%
These |[|<shape>|]| modifiers specify transformations of the <object>
currently being built. If the object has a rectangle edge then the size of
the rectangle is transformed to enclose the transformed object; with
a circle edge the radius is altered appropriately.

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

\TODO:
There should be an
 |[@*]| form which repeats the set of transformations applied to the last
object which has been transformed, possibly in an earlier diagram.
Also an |[@=|<word>|]| form allowing a set of transformations to be saved 
and used later, simply by specifying |[|<word>|]|.

\DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\medskip

Each successive transformation acts upon the result of all previous.  One
consequence of this is that the order of the shape modifiers can make a
significant difference in appearance---in general, transformations do not
commute. Even successive rotations can give different sized rectangles if
taken in the reverse order.

Sometimes this change of size is not desirable. The following commands are 
provided to modify this behaviour.
%
\begin{defs}
 |\NoResizing|   & prevents size adjustment \cr
 |\UseResizing|  & restores size adjustments \cr
\end{defs}
%
\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\DOCMODE(
\xydef@\NoResizing{\xyNoResizing@}
\xydef@\UseResizing{\xyUseResizing@}

\xydef@\xyNoResizing@{%
 \global\let\origxyrescale@=\xyrescale@
 \global\let\origxyrotSizeMod@=\xyrotateSizeMod@
 \global\let\xyNoResizing@=\xyNoResizing@@
 \global\let\xyUseResizing@=\xyUseResizing@@
 \xyNoResizing@@ }
 
\xydef@\xyNoResizing@@{%
 \global\let\xyrescale@=\xyignorescale@
 \global\let\xyrotateSizeMod@=\xyignoreSizeMod@
 }
 
\xylet@\xyUseResizing@=\relax
\xydef@\xyUseResizing@@{%
 \global\let\xyrescale@=\origxyrescale@
 \global\let\xyrotateSizeMod@=\origxyrotSizeMod@
 }
\DOCMODE)

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

\noindent
The |\NoResizing| command is also useful to have at the beginning of a 
document being typeset using a driver that cannot support scaling effects,
in particular when applied to whole diagrams. In any case an unscaled
version will result, but now the spacing and positioning will be appropriate
to the unscaled rather than the scaled size.    

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

\paragraph*{Interface}

Recognize the <shape> characters and keywords.

\DOCMODE(
\xydefcsname@{shape [@...]}#1{\xyrotatechar@#1@@}%
\xydefcsname@{shape [<...]}#1{\xyshearchar@{#1}@@}%
\xydefcsname@{shape [*...]}#1{\xyscalechar@{#1}@@}%

\xydefcsname@{shape [left]}{\xyshape@left@}
\xydefcsname@{shape [right]}{\xyshape@right@}
\xydefcsname@{shape [flip]}{\xyshape@flip@}
\xydefcsname@{shape [halfsize]}{\xyshape@halfsize@}
\xydefcsname@{shape [dblsize]}{\xyshape@dblsize@}
\xydefcsname@{shape [vflip]}{\xyshape@vflip@}
\xydefcsname@{shape [hflip]}{\xyshape@hflip@}
\DOCMODE)

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

Each style modifier adds code to one, or both, of two global lists.
These contents of these lists, called |\preXYtransform@@| 
and |\postXYtransform@@|.
An implementation must define macros which are to be bound
to the control sequence names |\preXYtransform@| and |\postXYtransform@|,
which are prepended and appended to the |\Drop@@| and |Connect@@| methods 
for the current <object>.

Also |\Drop@@| and |\Connect@@| must be modified, if this has not already
been done as indicated by |\xy@transform@| having expansion |\relax|.

\DOCMODE(
\xydef@\preXYtransform@{}
\xydef@\postXYtransform@{}

\xywarnifdefined\preXYtransform@@
\xywarnifdefined\postXYtransform@@
 \gdef\preXYtransform@@{}
 \gdef\postXYtransform@@{}
\xydef@\xy@transform@{}
\xydef@\preShape@@{}
\xydef@\postShape@@{}
\DOCMODE)

The transformations must be implemented by emulating the adjoint coordinate
transformations. This requires that code be added to |preXYtransform@@| 
in reverse order to the order of occurrence of the <shape> modifiers.
The code is added to |\postXYtransform@@| in natural order, so that each
addition to |\preXYtransform@@| can be closed off, if necessary, 
in a correctly nested sequence.

\DOCMODE(
\xydef@\modXYtransform@{%
 \ifx\xy@transform@\empty
  \transformDrop@\transformConnect@\resetTransform@\fi
%\show\preShape@@
 \DN@##1{\expandafter\def\expandafter\tmp@\expandafter{##1}}%
  \expandafter\next@\expandafter{\preShape@@}%
  \DN@##1{\expandafter\gdef\expandafter\preXYtransform@@\expandafter{%
   \tmp@ ##1}}\expandafter\next@\expandafter{\preXYtransform@@}%
 \DN@##1{\expandafter\def\expandafter\tmp@\expandafter{##1}}%
  \expandafter\next@\expandafter{\postShape@@}%
  \DN@##1{\expandafter\gdef\expandafter\postXYtransform@@\expandafter{%
   \postXYtransform@@ ##1}}\expandafter\next@\expandafter{\tmp@}}%

\xydef@\transformDrop@{\let\xy@transform@=\relax
 \expandafter\def\expandafter\Drop@@\expandafter{%
 \expandafter\preXYtransform@\Drop@@\postXYtransform@}}

\xydef@\transformConnect@{\let\xy@transform@=\relax
 \expandafter\def\expandafter\Connect@@\expandafter{%
 \expandafter\preXYtransform@\Connect@@\postXYtransform@}}

\xydef@\resetTransform@{\gdef\preXYtransform@@{}\gdef\postXYtransform@@{}}
\DOCMODE)

\BUG: The reference point does not move correctly in \PS\ when a shift
modifier has been applied before a rotation. The object prints outside
of its bounding |\rectangleEdge|. Fix this!!

Global macros are used, so that the same styles can be reused by
successive objects without having to re-interpret <shape> modifiers,
as described next.

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

\paragraph*{Saving transformations}

Once specified for an <object>, the collection of transformations can be 
assigned a name, via |[>|<name>|]|. 
The <name> here is any collection of letters
or other characters up to the closing |]|.
Subsequent use of |[>|<name>|]|, with the same or other <objects>s, 
will re-establish the saved transformations, acting on the new <object>
with initial reference point appropriate to this <object>. 

\NOTE: Such namings are global and permanent. 
They are intended to allow a particular set of transformations to be 
easily repeated for different objects inside various pictures and diagrams 
within the same document. 

\DOCMODE(
\xydef@\xynametransform@#1{%
 \DN@{\expandafter\gdef\expandafter#1\expandafter{\the\toks@}}\next@ }
\DOCMODE)

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

\paragraph*{Scaling and Scaled Text}

The <shape> modifier can contain either a single scale factor, or a pair
indicating different factors in the $x$- and $y$-directions. 
Negative values are allowed, to obtain reflections in the
coordinate axes, but not zero.

\DOCMODE(
\xydef@\xyscalechar@#1@@{\xyscalechars@#1,#1,@@}

\xydef@\xyscalechars@#1,#2,#3@@{%
 \DN@{\xyrescale@(#1,#2)}%
 \dimen@=#1\p@
 \ifdim\dimen@>\z@ \else \ifdim\dimen@<\z@ \else
  \DN@{\xywarning@{invalid scaling factors #1, #2}}%
 \fi\fi  \dimen@=#2\p@
 \ifdim\dimen@>\z@ \else \ifdim\dimen@<\z@ \else
  \DN@{\xywarning@{invalid scaling factors #1, #2 }}%
 \fi\fi \next@ }

\xydef@\xyrescale@(#1,#2){%
 \setboxz@h{\xyscale@@{#1}{#2}%
  \dimen@=\ifx-#1\R@c\advance\dimen@-\R@c \dimen@=-\dimen@
  \else#1\L@c \advance\dimen@-\L@c\fi
 \kern\dimen@\boxz@\kern-\dimen@}%
 \R@c=\if-#1\L@c\else#1\R@c\fi
 \L@c=\if-#1\R@c\else#1\L@c\fi
 \U@c=\if-#2\D@c\else#2\U@c\fi
 \D@c=\if-#2\U@c\else#2\D@c\fi }

\xydef@\xyignorescale@(#1,#2){\xywarning@{Ignoring rescale: #1,#2}%
 \setboxz@h{\xyscale@@{#1}{#2}\boxz@}}%
\DOCMODE)

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

Some particular scalings.

\DOCMODE(
\xydef@\xyshape@halfsize@{\xyrescale@(.5,.5)}
\xydef@\xyshape@dblsize@{\xyrescale@(2,2)}
\xydef@\xyshape@flip@{\xyrescale@(-1,-1)}
\xydef@\xyshape@vflip@{\xyrescale@(1,-1)}
\xydef@\xyshape@hflip@{\xyrescale@(-1,1)}
\DOCMODE)

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

\paragraph*{Rotation and Rotated Text}

Within |[@...]| the |...| are parsed as a <direction> locally, based on the
current direction. The value of count register |\Direction| contains the
information to determine the requested direction. 
When no <direction> is parsed then |[@]| requests a rotation to align with 
the current direction. 

The special sequence |[@!...]| is provided to pass an angle directly to
the back-end. The \Xy-pic size and shape of the <object> with |\rectangleEdge| 
is unchanged, even though the printed form may appear rotated. 
This is a feature that must be implemented specially by the back-end.
For example, using the \PS\ back-end, |[@!45]| will show the object rotated
by 45$^\circ$ inside a box of the size of the unrotated object.

\DOCMODE(
\xydef@\xyrotatechar@{\bgroup
 \afterDIRECTIONorEMPTY{\xyrotateSizeMod@}{\xyFN@\xySpecialRotate@i}}

\xydef@\xySpecialRotate@i{%
 \ifx \space@\next \expandafter\DN@\space{\xyFN@\xySpecialRotate@i}%
 \else\ifx @\next \let\next@=\xyrotateSizeMod@
 \else\addEQ@\ifx \next
  \addEQ@\DN@##1@@{%\transformDrop@
   \expandafter\xynametransform@\csname shape [##1]\endcsname\egroup}%
 \else\ifx !\next \DN@!{\egroup\getSpecialRotate@}%
 \else\ifx *\next \DN@*@@{\egroup\transformDrop@}%
 \else \DN@{\xySpecialRotate@@}%
 \fi\fi\fi\fi\fi \next@ }

\xydef@\getSpecialRotate@{\doSpecialRotate@@}
\DOCMODE)

\TODO: Provide example of repeated, named transformation.

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

\paragraph*{Installation}

Initially there is no support for the actual effects. 
They will be processed according to size/shape requirements,
but the actual rotation or re-sizing is ommitted.
A <driver> file is required to implement the effects.
It need to define alternative expansions to which
|\xyRotate@@#1|, |\xySpecialRotate@@#1@@|, |\doSpecialRotate@@#1@@| 
and |\xyscale@@#1#2| can be bound.

\DOCMODE(
\xydef@\xyRotate@#1{\xyundefinedRotate@{rotate}{#1}@@}
\xydef@\xySpecialRotate@#1@@{\xyundefinedRotate@{rotate}{#1}@@\egroup}
\xydef@\doSpecialRotate@#1@@{\xyundefinedRotate@{special rotate}{#1}@@}
\xydef@\xyscale@#1#2{\xyundefinedRotate@{scale}{#1,#2}@@}

\xydef@\UnloadRotate@#1{%
 \ifx#1\relax\else\xyunload@{rotation extension}\fi
 \let\xyRotate@@=\xyRotate@
 \let\xySpecialRotate@@=\xySpecialRotate@
 \let\doSpecialRotate@@=\doSpecialRotate@
 \let\xyscale@@=\xyscale@ }

\UnloadRotate@\relax

\xyaddunsupport{rotate}{\UnloadRotate@\relax}
\DOCMODE)

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

This adjusts the sizes of |\L@c|, |\R@c|, |\U@c| and |\D@c| appropriately. 

\DOCMODE(
\xydef@\xyrotateSizeMod@ @@{%
 \L@p=\L@c \R@p=\R@c \U@p=\U@c \D@p=\D@c   
 \ifdim\cosDirection\p@>\z@ 
  \R@c=\cosDirection\R@p  \L@c=\cosDirection\L@p
  \U@c=\cosDirection\U@p  \D@c=\cosDirection\D@p 
 \else
  \R@c=\cosDirection\L@p  \L@c=\cosDirection\R@p
  \U@c=\cosDirection\D@p  \D@c=\cosDirection\U@p 
 \fi
  \advance\L@c \if-\sinDirection\D@p\else\sinDirection\U@p\fi
  \advance\R@c \if-\sinDirection\U@p\else\sinDirection\D@p\fi
  \advance\U@c \if-\sinDirection\L@p\else\sinDirection\R@p\fi
  \advance\D@c \if-\sinDirection\R@p\else\sinDirection\L@p\fi
  \dimen@ii=\L@c \advance\dimen@ii-\L@p
 \edef\tmp@{\egroup \L@c=\the\L@c \R@c=\the\R@c \U@c=\the\U@c \D@c=\the\D@c
  \dimen@ii=\the\dimen@ii \noexpand\setboxz@h\bgroup
  \noexpand\xyRotate@@{\the\Direction}}\tmp@
  \xydropRotated@ }

\xydef@\xydropRotated@@{%
 \kern\dimen@ii \boxz@ \kern-\dimen@ii \modXYtransform@ \egroup }
\xylet@\xydropRotated@=\xydropRotated@@

\xydef@\xyignoreSizeMod@ @@{\xywarning@{Ignoring rotation}}
\DOCMODE)

Some particular rotations.

\DOCMODE(
\xydef@\xyshape@left@{\xyrotatechar@ v(0,1)@@}
\xydef@\xyshape@right@{\xyrotatechar@ v(0,-1)@@}
\DOCMODE)

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

\paragraph*{Reflections}

Reflections can be specified by a combination of rotation and a flip ---
either |[hflip]| or |[vflip]|.

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

\paragraph*{Shear transformations}

\DOCMODE(
\xydef@\xyshearchar@{\xyundefinedRotate@{shearing}}
\DOCMODE)

\TODO: Provide the structure to support these; then implement it in \PS.

\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The following diagram requires various options to be loaded and installed.
\DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\xyrequire{rotate}\xyrequire{color}\xyrequire{crayon}\xyrequire{line}%
\xyuncatcodes 

\paragraph*{Example}

The diagram in figure~??[rotate and flips] illustrates many of the effects
described above as well as some additional ones defined by the |color| and
|rotate| extensions.

\begin{figure*}[t]
\begin{code}
\UseCrayolaColors
\xy\drop[*1.25]\xybox{\POS
(0,0)*{A};(100,40)*{B}**{}
 ?<<*[@_][red][o]=<5pt>{\heartsuit};
 ?>>>*[@_][Plum][o]=<3pt>{\clubsuit}
 **[|*][|.5pt][thicker]\dir{-},
?(.1)*[left]!RD\txt{label 1}*[red]\frm{.}
?(.2)*[!gsave newpath
  xyXpos xyYpos moveto 50 dup rlineto
  20 setlinewidth 0 0 1 setrgbcolor stroke
  grestore][psxy]{.},
?(.2)*[@]\txt{label 2}*[red]\frm{.},
?(.2)*[BurntOrange]{*},
?(.3)*[halfsize]\txt{label 3}*[red]\frm{.}
?(.375)*[flip]\txt{label 4}*[red]\frm{.}
?(.5)*[dblsize]\txt{label 5}*[red]\frm{.}
?(.5)*[WildStrawberry]{*},
?(.7)*[hflip]\txt{label 6}*[red]\frm{.}
?(.8)*[vflip]\txt{label 7}*[red]\frm{.}
?(.9)*[right]!LD\txt{label 8}*[red]\frm{.}
?(.5)*[@][*.66667]!/^30pt/
 \txt{special effect: aligned text}
 *[red]\frm{.}
}\endxy
\end{code}
$$\docode$$
\caption{Rotations, scalings and flips}
??=[rotate and flips]
\end{figure*}

\begin{exercise}
Suggest the code used by the author to typeset ??[rotate and flips].
\answercode
\answertext{This is how the author specified the diagram:}
\answertext\displaycode
\end{exercise}

The actual code is given in the solution to the exercise.
Use it as a test of the capabilities of your DVI-driver. 
The labels should fit snugly inside the accompanying rectangles,
rotated and flipped appropriately.

\BUG: This figure also uses colours, alters line-thickness and includes
some \PS\ drawing.  
The colours may print as shades of gray, 
with the line from $A$ to $B$ being thicker than normal.
The wider band sloping downwards may have different width and length
according to the DVI-driver used; this depends on the coordinate system
used by the driver, when `raw' \PS\ code is included.  

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

% $Log: xyrotate.doc,v $
% Revision 3.3  1996/12/18  09:40:16  ross
% no changes
%
% 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  06:38:37  ross
% some documentation was left out previously
%
% 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 file to go in 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: