summaryrefslogtreecommitdiff
path: root/macros/generic/misc/rotate-textures.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/generic/misc/rotate-textures.sty')
-rw-r--r--macros/generic/misc/rotate-textures.sty111
1 files changed, 111 insertions, 0 deletions
diff --git a/macros/generic/misc/rotate-textures.sty b/macros/generic/misc/rotate-textures.sty
new file mode 100644
index 0000000000..89454382b6
--- /dev/null
+++ b/macros/generic/misc/rotate-textures.sty
@@ -0,0 +1,111 @@
+% Rotation of TeX output with TeXtures (and maybe? other PostScript drivers)
+
+% Written by
+% Charles Karney
+% Plasma Physics Laboratory Phone: +1 609 243 2607
+% Princeton University MFEnet: Karney@PPC.MFEnet
+% PO Box 451 ARPAnet: Karney%PPC.MFEnet@NMFECC.ARPA
+% Princeton, NJ 08543-0451 Bitnet: Karney%PPC.MFEnet@ANLVMS.Bitnet
+
+% User instructions:
+
+% If you use TeXtures (TeX on the Macintosh), you can rotate portions of TeX
+% output by arbitrary angles. In order to accomplish this you need to:
+
+% (1) Transfer the file TEX$INPUTS:ROTATE.STY to your Macintosh and it in the
+% "TeX inputs" folder.
+% (2) Specify rotate as an optional argument to \documentstyle, e.g.,
+% \documentstyle[11pt,rotate]{article}
+% (3) Use the construction
+% {\rotate{angle}Text-to-be-rotated}
+
+% Notes:
+
+% (1) The rotation is made only with TeXtures outputting to a PostScript
+% printer (e.g., a LaserWriter). The screen preview and the ImageWriter
+% output will show the text unrotated.
+
+% (2) The rotation angle is measured in degrees. It can be positive or
+% negative, real or integer. The best results are obtained when the angle is
+% a multiple of 90 degrees.
+
+% (3) The point about which the text is rotated is the location of the
+% \rotate command. In the example above it would be the bottom left corner
+% of the initial "T".
+
+% (4) Normal TeX grouping serves to delimit the scope of the rotation.
+% \rotate should always appear in a group. If you want to get all the TeX
+% output rotated by 90 degrees, select Landscape mode in the Print Setup
+% Dialog.
+
+% (5) \rotate is effectively a no-op with drivers other than TeXtures. Thus
+% you can include \rotate's in a file which you print on the QMS printers.
+% In order to get the rotation, however, you must transfer either the TeX
+% source or the DVI file to the Mac for printing with TeXtures.
+
+% (6) The position of the text outside the scope of the rotation is the same
+% as if the \rotate command were a no-op. Thus for example
+% abc{\rotate{-90}def}ghi
+% prints as
+% abc ghi
+% d
+% e
+% f
+
+% (7) Rotations can be stacked, e.g.,
+% abc{\rotate{-90}def\rotate{-90}ghi}jkl
+% would print as
+% abc jlk
+% d
+% e
+% f
+% ihg
+% except that the letters ``def'' would be sideways, and ``ghi'' would be
+% upside down. This is to be compared with
+% abc{\rotate{-90}def}{\rotate{-90}ghi}jkl
+% which prints as
+% abc jlk
+% d g
+% e h
+% f i
+
+% (8) \rotate can be useful in picture environments, e.g., when writing the y
+% axis label. E.g.,
+% \put(-50,100){\rotate{90}\makebox(0,0){$\tan\theta$}}
+% Here the \makebox centers the argument at the location of the \put. Thus
+% the text is rotated about the bottom-center of $\tan\theta$.
+
+% Technical details:
+
+% The following assumptions are made about the PostScript that TeXtures
+% generates:
+% (1) A single transform is used for all TeXtures output.
+% (2) The PostScript \special is bracketed by gsave ... grestore.
+% (3) Immediately after the gsave, the coordinate system is translated so the
+% origin is at the current point; and the y axis is flipped.
+% (4) TeXtures doesn't leave anything on the stack for long periods. (This
+% simplifies restoring the default coordinate system.)
+
+\def\rotate#1{\aftergroup\@unrotate
+\special
+{postscript
+ 0 0 transform % Current location in device coordinates.
+ grestore % Undoes TeXtures gsave.
+ matrix currentmatrix % Save default transform on stack
+ 3 1 roll % Put transform at back of current location.
+ itransform % Current location in TeXtures coords
+ dup 3 -1 roll % Duplicate the location
+ dup 4 1 roll exch % x y ==> x y x y
+ translate % Translate origin to current location.
+ #1\space neg % Negate angle because of flip of y axis.
+ rotate % Rotate.
+ neg exch neg exch translate % Translate origin back.
+ gsave}} % To match grestore.
+
+\def\@unrotate{\special
+{postscript
+ grestore % Undoes TeXtures gsave
+ setmatrix % Restore saved transform
+ gsave}} % To match grestore
+
+\endinput