Rotating TEX material

generates highly efficient PostScript code but it does so at the expense of some \special functionality. Most DVI-to-PostScript translators allow you to do things like use one \special to start rotating TEX text and another to stop the rotation. The way interprets a DVI page makes this impossible. All the rules, fonts and \specials are collected in separate lists for later processing, so any sequential connection between these various page elements is lost. However, assuming you have a PostScript printer, there is a way you can rotate arbitrary TEX material using :
  1. Create a TEX file that produces a single page containing only the material to be rotated (it's a good idea to turn off page numbers by using \nopagenumbers in Plain TEX or \thispagestyle{empty} in LATEX).
  2. TEX this file, select ``Print DVI'' and save the PostScript output in a file called, say, rotate.ps.
  3. Edit rotate.ps and make these changes:
    1. If used low-level PostScript to create rotate.ps then delete all lines from the top down to and including ``1 @bop0''. If standard PostScript printing was used to create rotate.ps then delete all lines from the top down to and including the line ending with `` @setup'' (note the space before the @).
    2. If low-level PostScript printing was used, replace the single line ``1 @bop1'' with these lines:
         0 0 transform         % get \special location in device coords
         mtrx setmatrix        % set TeX coords (units = dpi, res = 1in)
         itransform translate  % make \special location the new origin
         res 2 mul             % move right by 2in; adjust if necessary
         res -0.2 mul          % move up by 0.2in; adjust if necessary
         translate             % shift the origin
         -90 rotate            % 90 degrees anticlockwise
      
      If standard PostScript printing was used, replace all lines from ``end % OzTeXdict'' to ``1 @bop1'' with the above lines.
    3. If you want the output to appear in a fixed position on the page (regardless of the location of the \special command) then remove the lines containing ``0 0 transform'' and ``itransform translate'' (but keep the ``mtrx setmatrix'' line).
    4. Delete all lines from the bottom of the file up to and including ``1 @eop''.
  4. Include \special{rotate.ps} in the TEX file in which you want the rotated material to appear. Leave an appropriate amount of vertical space before the \special.
  5. Run TEX and print the DVI file. Either low-level or standard PostScript printing will work at this stage. If you need to shift the location of the rotated material then adjust the translate parameters in rotate.ps (note that you don't need to run TEX again).
The TeX-docs folder contains two files, rotate.tex and table.tex, which illustrate how this works. The above method is not very practical if you have a lot of material that needs to be rotated. In such a situation you should consider using a macro package that generates \special commands targeted for dvips; see section [*].