% \iffalse meta-comment
%
% isorot.dtx
%
%
%    This program is provided under the terms of the
% LaTeX Project Public License distributed from CTAN
% archives in directory macros/latex/base/lppl.txt.
%
% Author: Peter Wilson (CUA) 
%         now at: peter.r.wilson@boeing.com
% 
% \fi
% \CheckSum{1619}
%
%
% \def\fileversion{v2.1}
% \def\filedate{2000/02/15}
% \title{\LaTeX{} files for typesetting ISO Standards: \\
%        Source code: The isorot package\thanks{This
%        file has version number \fileversion, last revised
%        \filedate.}}
%
% \author{%
% Peter Wilson\\
% Catholic University of America\thanks{This work was originally
% performed at Rensselaer Polytechnic Institute.} \\
% Now at \texttt{peter.r.wilson@boeing.com}
% }
% \date{\filedate}
% \maketitle
% \tableofcontents
%
% \StopEventually{}
%
% 
%
% \section{Introduction}
%
% This document provides the commented source for \LaTeX{}
% package files designed for the typesetting of
% documents according to the rules for ISO international standards.
% A seperate document provides the user manual~\cite{PRW96i}.
% This manual is typeset according to the conventions of the
% \LaTeX{} \textsc{docstrip} utility which enables the automatic
% extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}.
%
%    ISO (the International Organization for Standardisation) specify
% their document layout requirements in ISO Directives~\cite{ISOD397}.
% Unfortunately these Directives do not completely define the document
% layout, leaving several aspects open to interpretation by the
% document editor and re-interpretation by the ISO editorial board.
% The following specifications are a re-implementation of the \LaTeX{}
% macros that have been used for the production of camera ready copy
% for the ISO~10303 standard {\em Product data representation and
% exchange}. The initial release of ISO~10303:1994 consisted of twelve
% parts and over 2400 pages. The editorial board of the ISO Central
% Secretariat in Geneva accepted the typographic conventions embodied
% in these macros.
%
%    This manual is provided as a service for future developers
% and maintainers of the
% class and packages for ISO standards. It is assumed that any 
% any such person is \LaTeX{} literate and accustomed to supporting
% complex class and package files~\cite{GOOSSENS94}.
%
%
%    Section~\ref{sec:docstrip} describes some
% administrative elements and code for general use later in the specification.
% Section~\ref{sec:rot} specifies
% the macros for rotation of textual and tabular elements.
% 
% \section{The {\sc docstrip} modules} \label{sec:docstrip}
%
% The following modules are used in the implementation to direct
% {\sc docstrip} in generating the external files:
% \begin{center}
% \begin{tabular}{ll}
%   rot     & produce the isorot package\\
%   rotne   & produce the isorotne style file\\
%   driver  & produce a documentation driver file \\
% \end{tabular}
% \end{center}
%
% \subsection{A driver for this document}
%
% The next series of code contains the documentation driver file for
% \LaTeX, i.e., the file that will produce the documentation you are
% currently reading. This will be extracted from this file by the 
% {\sc docstrip} program.
%
%    \begin{macrocode}
%<*driver>
\documentclass{ltxdoc}
%    \end{macrocode}
%
%    We do not want the following basic elements to appear in the index.
%    \begin{macrocode}
\DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath}
\DoNotIndex{\@centercr,\@cite}
\DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue}
\DoNotIndex{\@input,\@ixpt,\@m}
\DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint}
\DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb}
\DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt}
\DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt}
\DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace}
\DoNotIndex{\advance,\Alph,\alph}
\DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box}
\DoNotIndex{\bullet}
\DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption}
\DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass}
\DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist}
\DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup}
\DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter}
\DoNotIndex{\fbox}
\DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef}
\DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule}
\DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi}
\DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi}
\DoNotIndex{\input}
\DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark}
\DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright}
\DoNotIndex{\month,\newcommand,\newcounter,\newenvironment}
\DoNotIndex{\NeedsTeXFormat,\newdimen}
\DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number}
\DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@}
\DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip}
\DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions}
\DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright}
\DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font}
\DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman}
\DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength}
\DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space}
\DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase}
\DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt}
\DoNotIndex{\viipt,\vipt,\vskip,\vspace}
\DoNotIndex{\wd,\xiipt,\year,\z@}
%    \end{macrocode}
%    We do want an index, using linenumbers, but not update information.
%    \begin{macrocode}
\EnableCrossrefs
\CodelineIndex
%%%% \RecordChanges
%    \end{macrocode}
%    We may use so many \file{docstrip} modules that we set the
%    \texttt{StandardModuleDepth} counter to 1.
%    \begin{macrocode}
\setcounter{StandardModuleDepth}{1}
%    \end{macrocode}
%    Some commonly used abbreviations
%    \begin{macrocode}
\newcommand*{\Lopt}[1]{\textsf {#1}}            % typeset an option
\newcommand*{\file}[1]{\texttt {#1}}            % typeset a file
\newcommand*{\Lcount}[1]{\textsl {\small#1}}    % typeset a counter
\newcommand*{\pstyle}[1]{\textsl {#1}}          % typeset a pagestyle
\newcommand*{\Lenv}[1]{\texttt {#1}}            % typeset an environment
%    \end{macrocode}
%    We want the full details printed.
%    \begin{macrocode}
\begin{document}
\DocInput{isorot.dtx}
\end{document}
%</driver>
%    \end{macrocode}
%
%
% \section{Identification} \label{sec:id}
%
%    Announce the name, option files and version for \LaTeX 2e files:
%    \begin{macrocode}
%<rot>\ProvidesPackage{isorot}[2000/02/15 v2.1 ISO rotation package]
%    \end{macrocode}
%
%    These files are for use with \LaTeX\ v2.09 or a disadvantaged \LaTeX 2e
% distribution.
%    \begin{macrocode}
%<rotne>\typeout{isorotne.sty [1997/12/02 v2 LaTeX 2.09 ISO rotation package]}
%    \end{macrocode}
%
%
% \section{The \file{isorot} package and \file{isorotne} style} \label{sec:rot}
%
%    The \file{isorot} package provides a specialization of the \file{rotating} 
%    package
%    for use within ISO standard documents. The principal modifications
%    relate to the table and figure environments. The original \file{rotating}
%    package was developed by 
%    Sebastian Rahtz and Leonor Barroca\footnote{Sebastian Rahtz and Leonor
%    Barroca, {\em A style option for rotated objects in TeX,} TUGboat, 13, 2,
%    pp 156--180, July 1992.}.
%
%    Apparently not all distributions of \LaTeX{} contain the necessary
%    packages for a simple implementation. The \file{isorotne} style provides 
%    the same capabilities for these users.
%    This essentially replaces all \LaTeX 2e facilities from \file{rotating}
%    by generic ones, and includes the relevent package sources within the one
%    file.
%
% \changes{v11}{1997/09/30}{Added new dvi drivers to isrotne package}
% \changes{v2}{1997/12/02}{Updated rotations to rotating v2.12}
% \changes{v2.1}{2000/02/15}{Updated to latest ISO class, and generalised for any class}
%    \begin{macrocode}
%<*rot|rotne>
%    \end{macrocode}
%
%    The package takes one option which prints debugging information.
%
% \begin{macro}{\PWRFc@tracing}
%    A counter controlling debug printing.
%    \begin{macrocode}
\newcount\PWRFc@tracing
\DeclareOption{errorshow}{\PWRFc@tracing\z@}
\DeclareOption{debugshow}{\PWRFc@tracing5\relax}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{graphics}}
\ProcessOptions
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\PWRF@trace}
%    A macro that gets the trace message as its argument.
%    \begin{macrocode}
\newcommand\PWRF@trace[2]{%
  \ifnum\PWRFc@tracing>#1\relax
    \GenericWarning
      {(isorot)\@spaces\@spaces}
      {Package isorot: #2}%
  \fi
}
%    \end{macrocode}
% \end{macro}
%
%    For the \file{isorot} package most of the work is done by the 
%    \file{graphicx} package, so make sure it is loaded. Also, David
%    Carlisle's \file{lscape} package is required for landscaping some
%    pages or long wide tables.
%    \begin{macrocode}
%<*rot>
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{graphicx}
\RequirePackage{lscape}
%</rot>
%    \end{macrocode}
%
%    For the disadvantaged user, the required basic facilities are
%    a portion of the \file{graphics} package, which in turn requires
%    the \file{trig} package. We also need the code from the
%    \file{lscape} package.
%
%    \begin{macrocode}
%<*rotne>
%    \end{macrocode}
%    Firstly, here is the code from the \file{trig} package.
%
% \subsection{Trigonometry functions}
%
%    \emph{The following is the contents of the \file{trig} package written by
%    David Carlisle. The code and explanations are from \file{trig.dtx}
%    version 1.08, dated 1994/10/16. The original file should be consulted
%    for a full explanation.} 
%
%
% These macros implement the trigonometric functions, sin, cos and tan.
% In each case two commands are defined. For instance the command
% |\CalculateSin{33}| may be isued at some point, and then anywhere
% later in the document, the command |\UseSin{33}| will return the
% decimal expansion of $\sin(33^\circ)$.
%
% The arguments to these macros do not have to be whole numbers,
% although in the case of whole numbers, \LaTeX\ or plain \TeX\ counters
% may be used. In \TeX{}Book syntax, arguments must be  of type:
% \meta{optional signs}\meta{factor}
%
% Some other examples are:\\
% |\CalculateSin{22.5}|, |\UseTan{\value{mycounter}}|,
% |\UseCos{\count@}|.
%
% Note that unlike the psfig macros, these save all previously
% computed values. This could easily be changed, but I thought that in
% many applications one would want many instances of the
% same value. (eg rotating all the headings of a table by the
% \emph{same} amount).
%
% Some useful constants for converting between degrees and radians.
% $$\frac{\pi}{180}\simeq\frac{355}{113\times180}=\frac{71}{4068}$$
%    \begin{macrocode}
\chardef\nin@ty=90
\chardef\@clxx=180
\chardef\@lxxi=71
\mathchardef\@mmmmlxviii=4068
%    \end{macrocode}
%
% The approximation to $\sin$.
% \begin{eqnarray*}
%  \sin(x)& \simeq& x - (1/3!)x^3 + (1/5!)x^5 - (1/7!)x^7 + (1/9!)x^9\\
%  &\simeq&\frac{((((7!/9!x^2-7!/7!)x^2+7!/5!)x^2 +7!/3!)x^2+7!/1!)x}
% {7!}\\
%  &=&\frac{((((1/72x^2-1)x^2+42)x^2 +840)x^2+5040)x}
% {5040}
% \end{eqnarray*}
%
%    \begin{macrocode}
\chardef\@coeffz=72
%\chardef\@coefa=1
\chardef\@coefb=42
\mathchardef\@coefc=840
\mathchardef\@coefd=5040
%    \end{macrocode}
%
%    \begin{macrocode}
{\catcode`t=12\catcode`p=12\gdef\noPT#1pt{#1}}
\def\TG@rem@pt#1{\expandafter\noPT\the#1\space}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\TG@term#1{%
 \dimen@\@tempb\dimen@
 \advance\dimen@ #1\p@}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\TG@series{%
 \dimen@\@lxxi\dimen@
 \divide \dimen@ \@mmmmlxviii
 \edef\@tempa{\TG@rem@pt\dimen@}%
 \dimen@\@tempa\dimen@
 \edef\@tempb{\TG@rem@pt\dimen@}%
 \divide\dimen@\@coeffz
 \advance\dimen@\m@ne\p@
 \TG@term\@coefb
 \TG@term{-\@coefc}%
 \TG@term\@coefd
 \dimen@\@tempa\dimen@
 \divide\dimen@ \@coefd}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\CalculateSin#1{{%
  \expandafter\ifx\csname sin(\number#1)\endcsname\relax
    \dimen@=#1\p@\TG@@sin
    \expandafter\xdef\csname sin(\number#1)\endcsname
                                    {\TG@rem@pt\dimen@}%
  \fi}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\CalculateCos#1{{%
  \expandafter\ifx\csname cos(\number#1)\endcsname\relax
    \dimen@=\nin@ty\p@
    \advance\dimen@-#1\p@
    \TG@@sin
    \expandafter\xdef\csname cos(\number#1)\endcsname
                                     {\TG@rem@pt\dimen@}%
  \fi}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\TG@reduce#1#2{%
\dimen@#1#2\nin@ty\p@
  \advance\dimen@#2-\@clxx\p@
  \dimen@-\dimen@
  \TG@@sin}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\TG@@sin{%
  \ifdim\TG@reduce>+%
  \else\ifdim\TG@reduce<-%
  \else\TG@series\fi\fi}%
%    \end{macrocode}
%
%    \begin{macrocode}
\def\UseSin#1{\csname sin(\number#1)\endcsname}
\def\UseCos#1{\csname cos(\number#1)\endcsname}
%    \end{macrocode}
%
%    \begin{macrocode}
\chardef\z@num\z@
\expandafter\let\csname sin(0)\endcsname\z@num
\expandafter\let\csname cos(0)\endcsname\@ne
\expandafter\let\csname sin(90)\endcsname\@ne
\expandafter\let\csname cos(90)\endcsname\z@num
\expandafter\let\csname sin(-90)\endcsname\m@ne
\expandafter\let\csname cos(-90)\endcsname\z@num
\expandafter\let\csname sin(180)\endcsname\z@num
\expandafter\let\csname cos(180)\endcsname\m@ne
%    \end{macrocode}
%
% This is accurate to 4 decimal places for angles up to
% $50^\circ$, after that the accuracy tails off, giving
% 57.47894 instead of 57.2900 for $89^\circ$.
%    \begin{macrocode}
\def\CalculateTan#1{{%
  \expandafter\ifx\csname tan(\number#1)\endcsname\relax
    \CalculateSin{#1}%
    \CalculateCos{#1}%
    \@tempdima\UseCos{#1}\p@
    \divide\@tempdima\@iv
    \@tempdimb\UseSin{#1}\p@
    \@tempdimb\two@fourteen\@tempdimb
    \divide\@tempdimb\@tempdima
    \expandafter\xdef\csname tan(\number#1)\endcsname
                                        {\TG@rem@pt\@tempdimb}%
  \fi}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\UseTan#1{\csname tan(\number#1)\endcsname}
%    \end{macrocode}
%
%    \begin{macrocode}
\mathchardef\two@fourteen=16384
\chardef\@iv=4
%    \end{macrocode}
%
%    \begin{macrocode}
\expandafter\def\csname tan(90)\endcsname{\errmessage{Infinite tan !}}
\expandafter\let\csname tan(-90)\expandafter\endcsname
                                       \csname tan(90)\endcsname
%    \end{macrocode}
%
% \subsection{Landscape environment}
%
%    The \file{lscape} package by David Carlisle provides a landscape
%    environment which prints the enclosed pages in landscape rather
%    than portrait. For 2.09 this package does not work, so we provide
%    for the functionality here. The following code is taken from
%    the \file{lscape} package.\footnote{Version 3.0, last revised
%    1994/10/05.}
%
% \begin{environment}{landscape}
%    \begin{macrocode}
\let\LS@makecol=\@makecol
\let\LS@makefcolumn=\@makefcolumn
\def\LS@rot{%
  \setbox\@outputbox\vbox{\hbox{\rotatebox{90}{\box\@outputbox}}}}
\def\landscape{%
  \clearpage
  \begingroup
  \vsize=\textwidth
  \hsize=\textheight
  \linewidth=\hsize
  \columnwidth=\hsize
  \@colroom=\vsize
  \textheight=\vsize
  \@colht=\vsize
  \def\@makecol{\LS@makecol\LS@rot}%
  \def\@makefcolumn##1{\LS@makefcolumn{##1}\LS@rot}}
\def\endlandscape{%
  \clearpage
  \endgroup
  \global\@colht=\textheight
  \global\vsize=\textheight
  \global\@colroom=\textheight}
%    \end{macrocode}
% \end{environment}
%
%    \begin{macrocode}
%</rotne>
%    \end{macrocode}
%
% \subsection{Drivers}
%
%    Rotation is not done within \TeX\ but by the device drivers via |\special|
%    commands appropriate for each driver.
%
%    \begin{macrocode}
%<*rot>
\def\rotdriver#1{%
  \message{The .dvi file is to be processed by the #1 driver.}
  \typeout{Change rotdriver in the source accordingly if you do not have this.}
  \makeatletter\input{#1.def}\makeatother}
%</rot>
%    \end{macrocode}
%
%    \begin{macrocode}
%<*rotne>
%    \end{macrocode}
%
%    Life is much more difficult for the \file{isorotne} style as we have to
% include source (runnable under 2.09) that the \file{isorot} package 
% gets for free.
%
% \begin{macro}{\Grot@start}
% \begin{macro}{\Grot@end}
%    The commands |\Grot@start| and |\Grot@end| are defined which assume
%    that the macro |\Grot@angle| contains the rotation angle. First
%    set these to do nothing, just in case the user calls for an unsupported
%    driver.
%    \begin{macrocode}
  \def\Grot@start{}
  \def\Grot@end{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\Dvitops@count}
%    A counter for the DVITOPS driver.
%    \begin{macrocode}
\newcount\Dvitops@count
\Dvitops@count=\@ne
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\listrotdrivers}
%    Writes out the list of currently available rotdrivers.
%    \begin{macrocode}
\newcommand{\listrotdrivers}{%
  \typeout{If you do not have this driver then change rotdriver in your source.}
  \typeout{Available rotdrivers are:}
  \typeout{ \space\space dvipdf, dvips, dvipsone, dvitops, dviwindo,}
  \typeout{ \space\space pctex32, pctexps, pubps, textures}
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\rotdriver}
%    The command |\rotdriver{|\meta{driver}|}| must be put in the preamble,
%    where \meta{driver} is the identification of one of the drivers that
%    support rotation.
%    \begin{macrocode}
\newcommand{\rotdriver}[1]{%
%    \end{macrocode}
%    Put the argument into an uppercase string
%    \begin{macrocode}
  \bgroup\edef\next{\def\noexpand\tempa{#1}}%
    \uppercase\expandafter{\next}%
%    \end{macrocode}
% \begin{macro}{\ISOROTSTD}
% \begin{macro}{\DVIPS}
% \begin{macro}{\DVIPSONE}
% \begin{macro}{\DVITOPS}
% \begin{macro}{\PCTEXPS}
% \begin{macro}{\PUBPS}
% \begin{macro}{\TEXTURES}
% \begin{macro}{\DVIPDF}
% \begin{macro}{\DVIWINDO}
% \begin{macro}{\PCTEX32}
%    These are the currently supported drivers that can cope with rotations.
%    The code for the drivers has been taken from 
%    \file{drivers.dtx}\footnote{Version v3.0d, revised 1996/12/12.} by
%    Sebastian Rahtz and David Carlisle.
%
%    The |isorotstd| driver is included against the (improbable) time
%    when there might be one `standard' driver, or at least all the
%    |\special| code for rotations might be common.
%    \begin{macrocode}
  \def\ISOROTSTD{ISOROTSTD}
  \def\DVIPS{DVIPS}
  \def\DVIPSONE{DVIPSONE}
  \def\DVITOPS{DVITOPS}
  \def\PCTEXPS{PCTEXPS}
  \def\PUBPS{PUBPS}
  \def\TEXTURES{TEXTURES}
  \def\DVIPDF{DVIPDF}
  \def\DVIWINDO{DVIWINDO}
  \def\PCTEXxxxii{PCTEX32}
%    \end{macrocode}
%    Later we will use a case statement for picking the proper code. Define
%    a numeric code for each driver.
%    \begin{macrocode}
  \global\chardef\rot@driver=0
  \ifx\tempa\ISOROTSTD
     \global\chardef\rot@driver=1\fi
  \ifx\tempa\DVIPS
     \global\chardef\rot@driver=2\fi
  \ifx\tempa\DVIPSONE
     \global\chardef\rot@driver=3\fi
  \ifx\tempa\DVITOPS
     \global\chardef\rot@driver=4\fi
  \ifx\tempa\PCTEXPS
     \global\chardef\rot@driver=5\fi
  \ifx\tempa\PUBPS
     \global\chardef\rot@driver=6\fi
  \ifx\tempa\TEXTURES
     \global\chardef\rot@driver=7\fi
  \ifx\tempa\DVIPDF
     \global\chardef\rot@driver=8\fi
  \ifx\tempa\DVIWINDO
     \global\chardef\rot@driver=9\fi
  \ifx\tempa\PCTEXxxxii
     \global\chardef\rot@driver=10\fi
  \egroup
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%    Now define the particulars for each driver. \\
%    {\bf Case 0:} We should not be here!
%    \begin{macrocode}
  \ifcase\rot@driver  % case 0
    \message{WARNING *** unknown driver --- no rotation.} \listrotdrivers
%    \end{macrocode}
%    {\bf Case 1: ISOROTSTD} Not yet available.
%    \begin{macrocode}
  \or                 % case 1: ISOROTSTD
    \message{WARNING *** isorotstd driver not available yet --- no rotation.}
    \listrotdrivers
%    \end{macrocode}
%    {\bf Case 2: DVIPS} For Tom Rokicki's {\em dvips} driver. Has been tested
%    with version 5.518 of July 1993.
%    \begin{macrocode}
  \or                 % case 2: DVIPS
    \typeout{Rotdriver set to dvips.} \listrotdrivers
    \def\Grot@start{%
       \special{ps: gsave currentpoint
                currentpoint translate \Grot@angle\space neg
                rotate neg exch neg exch translate}}
    \def\Grot@end{%
       \special{ps: currentpoint grestore moveto}}
%    \end{macrocode}
%    {\bf Case 3: DVIPSONE} For Y\&Y's {\em dvipsone}.
%    \begin{macrocode}
  \or                 % case 3: DVIPSONE
    \typeout{Rotdriver set to dvipsone.} \listrotdrivers
    \def\Grot@start{%
       \special{ps: gsave currentpoint
                currentpoint translate \Grot@angle\space
                rotate neg exch neg exch translate}}
    \def\Grot@end{%
       \special{ps: currentpoint grestore moveto}}
%    \end{macrocode}
%    {\bf Case 4: DVITOPS} For James Clark's {\em dvitops}.
%    \begin{macrocode}
  \or                % case 4: DVITOPS
    \typeout{Rotdriver set to dvitops.} \listrotdrivers
    \def\Grot@start{%
       \special{dvitops: origin
                rot\the\@tempdima}%
       \special{dvitops: begin rot\the\Dvitops@count}}%
    \def\Grot@end{%
       \special{dvitops: end}%
       \special{dvitops: rotate rot\the\Dvips@count \space
                \Grot@angle}%
       \global\advance\Dvitops@count by\@ne}
%    \end{macrocode}
%    {\bf Case 5: PCTEXPS} For Personal TeX's PC PTI Laser/PS. Information
%    supplied by Lance Carnes and Tao Wang |<pti@crl.com>|.
%    \begin{macrocode}
  \or                % case 5: PCTEXPS
    \typeout{Rotdriver set to pctexps.} \listrotdrivers
    \def\Grot@start{%
       \special{ps:: gsave currentpoint
                currentpoint translate \Grot@angle\space
                rotate neg exch neg exch translate}}
    \def\Grot@end{%
       \special{ps:: currentpoint grestore moveto}}
%    \end{macrocode}
%    {\bf Case 6: PUBPS} For Arbortext's {\em pubps}. 
%    (Interestingly, I (PRW) note
%    that my original (circa 1991) code for this used |ps::| but the code
%    has since been modified to |ps:|.)
%    \begin{macrocode}
  \or                % case 6: PUBPS
    \typeout{Rotdriver set to pubps.} \listrotdrivers
    \def\Grot@start{%
       \special{ps: gsave currentpoint
                currentpoint translate \Grot@angle\space
                rotate neg exch neg exch translate}}
    \def\Grot@end{%
       \special{ps: currentpoint grestore moveto}}
%    \end{macrocode}
%    {\bf Case 7: TEXTURES} For Blue Sky's {\em Textures}. This code is liable
%    to change as there is ongoing work to produce a new version of Textures.
%    \begin{macrocode}
  \or               % case 7: TEXTURES
    \typeout{Rotdriver set to textures.} \listrotdrivers
    \def\Grot@start{%
      \special{postscript
        0 0 transform
        grestore
        matrix currentmatrix
        3 1 roll
        itransform
        dup 3 -1 roll
        dup 4 1 roll exch
        translate
        \Grot@angle\space neg rotate
        neg exch neg exch translate
        gsave}}
    \def\Grot@end{\special{postscript grestore setmatrix gsave}}
%    \end{macrocode}
%    {\bf Case 8: DVIPDF} For the {\em dvipdf} driver.
%    \begin{macrocode}
  \or               % case 8: DVIPDF
    \typeout{Rotdriver set to dvipdf.} \listofdrivers
    \def\Grot@start{%
      \special{pdf: /ROT \Grot@angle\space << }}
    \def\Grot@end{\special{pdf: /ROT >> }}
%    \end{macrocode}
%    {\bf Case 9: DVIWINDO} For Y\&Y's {\em dviwindo} driver.
%    \begin{macrocode}
  \or               % case 9: DVIWINDO (same as DVIPSONE)
    \typeout{Rotdriver set to dviwindo.} \listofdrivers
    \def\Grot@start{%
       \special{ps: gsave currentpoint
                currentpoint translate \Grot@angle\space
                rotate neg exch neg exch translate}}
    \def\Grot@end{%
       \special{ps: currentpoint grestore moveto}}
%    \end{macrocode}
%    {\bf Case 10: PCTEX32} For Personal TeX's PC TeX for 32 bit Windows.
%    (Code supplied by Tao Wang |<pti@crl.com>|).
%    \begin{macrocode}
  \or               % case 10: PCTEX32
    \typeout{Rotdriver set to pctex32.} \listofdrivers
    \def\Grot@start{%
       \special{ps:: gsave currentpoint
         currentpoint translate \Grot@angle\space neg
         rotate neg exch neg exch translate}}
     \def\Grot@end{\special{ps:: currentpoint grestore moveto}}
%    \end{macrocode}
%
%    {\bf Case unknown:} We should not have got here!
%    \begin{macrocode}
  \else
    \message{WARNING *** unknown driver --- no rotation.} \listrotdrivers
  \fi
}
%    \end{macrocode}
% \end{macro}
%    Set up a default driver (use DVIPS as it appears the most popular).
%    \begin{macrocode}
\rotdriver{DVIPS}
%    \end{macrocode}
%    The default driver has been set to DVIPS for both \file{isorot} and
% \file{isorotne}.
%
%    \begin{macrocode}
%</rotne>
%    \end{macrocode}
%
% \subsection{Box rotation}
%
%    The \file{isorotne} package needs some code that is part of the
% \file{graphics} package.
%
%    The following code has been mainly taken from the graphics package 
%    \file{graphics.dtx}\footnote{Version v1.0d, last revised 1997/06/07.}
%    by D.P. Carlisle and S.P.Q. Rahtz.
%
%
%    The \file{isorotne} package requires some macros that are in the
%    2e kernel but not the 2.09 kernel.
%    The following macros are defined in the 2e kernel but
%    not in all v2.09 kernels. We need them. We use \verb|\def| instead 
%    of \verb|\newcommand|
%    just in case a v2.09 document is processed in compatibility
%    mode, but additionally check if 2e is being used.
%
%    \begin{macrocode}
%<*rotne>
\ifx\usepackage\undefined
%    \end{macrocode}
%
% \begin{macro}{\@plus}
% \begin{macro}{\@minus}
%    Save some string space.
%    \begin{macrocode}
  \def\@plus{plus}
  \def\@minus{minus}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\on@line}
%    \begin{macrocode}
  \ifnum\inputlineno=\m@ne
    \let\on@line\empty
  \else
    \def\on@line{ on input line \the\inputlineno}
  \fi
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\rem@pt}
%    Utility macro to assist in removing the string `pt' from a dimension. 
%    It is complicated but appears to work.
%    \begin{macrocode}
  \begingroup
    \catcode`P=12
    \catcode`T=12
    \lowercase{
      \def\x{\def\rem@pt##1.##2PT{##1\ifnum##2>\z@.##2\fi}}}
    \expandafter\endgroup\x
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\strip@pt}
%     Call this to strip `pt' from a dimension like |\strip@pt\dim|.
%    \begin{macrocode}
  \def\strip@pt{\expandafter\rem@pt\the}
%    \end{macrocode}
% \end{macro}
%    The end of \LaTeX 2e kernel macros.
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
% \begin{macro}{\color@begingroup}
% \begin{macro}{\color@endgroup}
% \begin{macro}{\color@setgroup}
% \begin{macro}{\normalcolor}
% \begin{macro}{\color@hbox}
% \begin{macro}{\color@vbox}
% \begin{macro}{\color@endbox}
%     These are normally no-ops (but are redefined by the \file{color} package).
%    \begin{macrocode}
\let\color@begingroup\relax
\let\color@endgroup\relax
\let\color@setgroup\relax
\let\normalcolor\relax
\let\color@hbox\relax
\let\color@vbox\relax
\let\color@endbox\relax
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{environment}{lrbox}
%    A new 2e environment form of |\sbox|. (This is why the color stuff is
%    needed.)
%    \begin{macrocode}
\def\lrbox#1{%
  \edef\reserved@a{%
    \endgroup
    \setbox#1\hbox{%
      \begingroup\aftergroup}%
        \def\noexpand\@currenvir{\@currenvir}%
        \def\noexpand\@currenvline{\on@line}}%
  \reserved@a
    \@endpefalse
    \color@setgroup
      \ignorespaces}
\def\endlrbox{\unskip\color@endgroup}
%    \end{macrocode}
% \end{environment}
%
%    We are now basically back to the \file{graphics} package code.
%
%    Some registers are needed to store some sizes and angles. 
%    Local registers are re-used (see the Graphics package documentation).
% \begin{macro}{\Grot@height}
% \begin{macro}{\Grot@depth}
% \begin{macro}{\Grot@right}
% \begin{macro}{\Grot@left}
%    Final rotated box dimensions.
% \changes{v2}{1997/12/02}{Graphics updated to version v1.0d}
%    \begin{macrocode}
\let\Grot@height\@ovxx
\let\Grot@depth\@ovdy
\let\Grot@right\@ovdx
\let\Grot@left\@ovyy
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\Grot@h}
% \begin{macro}{\Grot@d}
% \begin{macro}{\Grot@r}
% \begin{macro}{\Grot@l}
%    The original box dimensions.
%    \begin{macrocode}
\let\Grot@h\@xdim
\let\Grot@d\@ydim
\let\Grot@r\@ovri
\let\Grot@l\@ovro
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\Grot@x}
% \begin{macro}{\Grot@y}
%    Coordinates of the centre of rotation.
%    \begin{macrocode}
\let\Grot@x\@linelen
\let\Grot@y\@dashdim
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\rotatebox}
%    The rotation angle is specified by parameter |#1| and the box to be
%    rotated by |#2|. In the standard interface the center of rotation
%    is $(0,0)$. Finally |\Grot@box| is called to rotate the box.
% 
%    |\rotatebox{|\meta{degrees}|}{|\meta{text}|}| rotates \meta{text}
%    by \meta{degrees} anticlockwise. The rotation is about the left hand
%    end of the baseline of \meta{text}.
% \changes{v2}{1997/12/02}{Added call to \cs{leavevmode}}
%    \begin{macrocode}
\def\rotatebox#1#2{%
  \leavevmode
  \Grot@setangle{#1}%
  \setbox\z@\hbox{{#2}}%
  \Grot@x\z@
  \Grot@y\z@
  \Grot@box}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Grot@setangle}
% \begin{macro}{\Grot@angle}
%    These set the internal macro |\Grot@angle| used by |\Grot@box|.
%    |\Grot@setangle| is the `standard' definition from the \file{graphics}
%    package.
%    \begin{macrocode}
\def\Grot@setangle#1{\edef\Grot@angle{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    We need to know the size of the enclosing rectangle of a rotated box.
%    Two macros are used for calculating coordinate positions. (See Graphics
%    documentation for details.)
%
% \begin{macro}{\Grot@Px}
%    Calculate the x coordinate of a point after rotation. The new x
%    coordinate is parameter |#1| and the original point coordinates
%    are parameters |#2| and |#3|.
%    \begin{macrocode}
\def\Grot@Px#1#2#3{%
    #1\Grot@cos#2%
    \advance#1-\Grot@sin#3}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Grot@Py}
%    Similarly for the y coordinate.
%    \begin{macrocode}
\def\Grot@Py#1#2#3{%
    #1\Grot@sin#2%
    \advance#1\Grot@cos#3}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Grot@box}
%    Rotates |\box0| through |\Grot@angle| degrees anticlockwise.
%
%    For details, consult the Graphics documentation.
%
%    \begin{macrocode}
\def\Grot@box{%
  \begingroup
    \CalculateSin\Grot@angle
    \CalculateCos\Grot@angle
    \edef\Grot@sin{\UseSin\Grot@angle}%
    \edef\Grot@cos{\UseCos\Grot@angle}%
    \Grot@r\wd\z@  \advance\Grot@r-\Grot@x
    \Grot@l\z@     \advance\Grot@l-\Grot@x
    \Grot@h\ht\z@  \advance\Grot@h-\Grot@y
    \Grot@d-\dp\z@ \advance\Grot@d-\Grot@y
    \ifdim\Grot@sin\p@>\z@
      \ifdim\Grot@cos\p@>\z@
         \Grot@Py\Grot@height \Grot@r\Grot@h
         \Grot@Px\Grot@right  \Grot@r\Grot@d
         \Grot@Px\Grot@left   \Grot@l\Grot@h
         \Grot@Py\Grot@depth  \Grot@l\Grot@d
      \else
         \Grot@Py\Grot@height \Grot@r\Grot@d
         \Grot@Px\Grot@right  \Grot@l\Grot@d
         \Grot@Px\Grot@left   \Grot@r\Grot@h
         \Grot@Py\Grot@depth  \Grot@l\Grot@h
      \fi
    \else
      \ifdim\Grot@cos\p@<\z@  
         \Grot@Py\Grot@height \Grot@l\Grot@d
         \Grot@Px\Grot@right  \Grot@l\Grot@h
         \Grot@Px\Grot@left   \Grot@r\Grot@d
         \Grot@Py\Grot@depth  \Grot@r\Grot@h
       \else
         \Grot@Py\Grot@height \Grot@l\Grot@h
         \Grot@Px\Grot@right  \Grot@r\Grot@h
         \Grot@Px\Grot@left   \Grot@l\Grot@d
         \Grot@Py\Grot@depth  \Grot@r\Grot@d
       \fi
     \fi
     \advance\Grot@height\Grot@y
     \advance\Grot@depth\Grot@y
     \Grot@Px\dimen@   \Grot@x\Grot@y
     \Grot@Py\dimen@ii \Grot@x\Grot@y
     \dimen@-\dimen@     \advance\dimen@-\Grot@left
     \dimen@ii-\dimen@ii \advance\dimen@ii\Grot@y
     \setbox\z@\hbox{%
       \kern\dimen@
       \raise\dimen@ii\hbox{\Grot@start\box\z@\Grot@end}}%
     \ht\z@\Grot@height
     \dp\z@-\Grot@depth
     \advance\Grot@right-\Grot@left\wd\z@\Grot@right
     \leavevmode\box\z@
  \endgroup}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
%</rotne>
%    \end{macrocode}
%
% \subsection{The rotating code}
%
%    Much of the code from here on is taken from the 
%    \file{rotating.dtx}\footnote{Version v2.9, last revised 1995/04/07.} 
%    package file by Leonor Barroca, but some is hacked for 2.09 users.
% Extensions are made to accomodate the special requirements for ISO
% typesetting.
%
% \subsubsection{Initial macros}
%
%    Define some general helper macros.
%
% \begin{macro}{\if@rot@twoside}
%    A flag for one or two sided.
%    \begin{macrocode}
\newif\if@rot@twoside
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Grot@setnegangle}
%  \emph{Extension:}  |\Grot@setnegangle| sets |\Grot@angle| to be the 
%     negative of its input
%     parameter. We use this for changing rotation direction.
%    \begin{macrocode}
\def\Grot@setnegangle#1{%
  \dimen@#1\p@
  \dimen@-\dimen@
  \edef\Grot@angle{\strip@pt\dimen@}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifcl@ckwise}
% \begin{macro}{\figuresleft}
% \begin{macro}{\figuresright}
% \begin{macro}{\clockwise}
% \begin{macro}{\counterclockwise}
% \emph{Extension:} The \file{rotating} package has some options. 
%  Our packages instead define some additional
%    macros to enable these to be expressed as commands.
%
%    A flag for the desired rotational direction.
%    \begin{macrocode}
\newif\ifcl@ckwise
%    \end{macrocode}
%    The extension commands:
%    \begin{macrocode}
\newcommand{\figuresleft}{%
  \@rot@twosidefalse
  \def\rot@LR{0}%
}
\newcommand{\figuresright}{%
  \@rot@twosidefalse
  \def\rot@LR{-1}%
}
\newcommand{\clockwise}{%
  \cl@ckwisetrue
}
\newcommand{\counterclockwise}{%
  \cl@ckwisefalse
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\r@protected@write}
% \begin{macro}{\therpage}
% \begin{macro}{\rot@label}
%
%    The \file{rotating} package used to use the |\label| command. It now
% uses a special |\rot@label| version. This variant writes the \emph{true}
% page number, not the value of |\thepage|. It also involves a variant
% |\protected@write|\footnote{The original author states `\ldots for reasons 
% which I do not fully understand.'}.
%
% \changes{v2}{1997/12/03}{Added \cs{r@protected@write}, \cs{therpage} and \cs{rot@label}}
%    \begin{macrocode}
\long\def\r@protected@write#1#2#3{%
  \begingroup
    \let\therpage\relax
    #2%
    \let\protect\@unexpandable@protect
    \edef\reserved@a{\write#1{#3}}%
    \reserved@a
  \endgroup
  \if@nobreak\ifvmode\nobreak\fi\fi
}
\def\therpage{\arabic{page}}
\def\rot@label#1{\@bsphack
  \r@protected@write\@auxout{}%
    {\string\newlabel{#1}{{\@currentlabel}{\therpage}}}%
  \@esphack}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\r@tfl@t}
%    A counter for use later in matching rotations to page numbers.
% \changes{v2}{1997/12/02}{Changed \cs{r@tfl@t} to a \cs{newcounter}}
%    \begin{macrocode}
\newcounter{r@tfl@t}
\setcounter{r@tfl@t}{0}
%    \end{macrocode}
% \end{macro}
%
%    Sideways floats take up the whole page. They can be rotated so that
%    the bottom of the float is on the left or the right; the default
%    is to always turn to the right. If the main document uses the
%    \Lopt{twoside} option then the floats are rotated according to the
%    page number (requiring at least two passes through \LaTeX). The
%    \Lopt{figuresleft} and \Lopt{figuresright} `options' will ensure
%    a constant rotation direction when \Lopt{twoside} is in effect.
%
%    \begin{macrocode}
\if@twoside
  \@rot@twosidetrue
\else
  \@rot@twosidefalse
\fi
%    \end{macrocode}
%
% \begin{macro}{\rotatedirection}
%    For setting rotation direction for positive angle. The |\rotatedirection|
%    command is provided for backwards compatibility.
%    \begin{macrocode}
\newcommand{\rotatedirection}[1]{%
  \def\@tempa{#1}\def\@tempb{clockwise}%
  \ifx\@temp\@tempb
    \cl@ckwisetrue
  \else
    \cl@ckwisefalse
  \fi}
%    \end{macrocode}
% \end{macro}
%
%    Set default to be \Lopt{clockwise} rotation for positive angles,
%    and \Lopt{figuresright} to make all bottoms of sideways floats
%    to be at the righthand edge of the paper.
%    \begin{macrocode}
\clockwise
\figuresright
%    \end{macrocode}
%
% \subsubsection{Turn and rotation environments}
%
%    These are general rotational environments.
%
% \begin{environment}{sideways}
%    The \Lenv{sideways} environment rotates its contents through the fixed
%    angle of 90 degrees counterclockwise.
%    \begin{macrocode}
\def\sideways{%
  \Grot@setangle{90}%
  \setbox\z@\hbox\bgroup\ignorespaces}
\def\endsideways{%
  \unskip\egroup
  \Grot@x\z@
  \Grot@y\z@
  \Grot@box
}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{turn}
%    The \Lenv{turn} environment rotates its contents through the given
%    angle, leaving the appropriate space.
%
% \emph{Extension:} We take account of the specified rotational direction.
%    \begin{macrocode}
\def\turn#1{%
  \ifcl@ckwise
    \Grot@setnegangle{#1}
  \else
    \Grot@setangle{#1}
  \fi
  \setbox\z@\hbox\bgroup\ignorespaces}
\def\endturn{%
  \unskip\egroup
  \Grot@x\z@
  \Grot@y\z@
  \Grot@box
}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{rotate}
%    The \Lenv{rotate} environment rotates its contents through the given
%    angle, leaving no space.
%
% \emph{Extension:} We take account of the specified rotational direction.
%    \begin{macrocode}
\def\rotate#1{%
  \ifcl@ckwise
    \Grot@setnegangle{#1}
  \else
    \Grot@setangle{#1}
  \fi
  \setbox\z@\hbox\bgroup\ignorespaces}
\def\endrotate{%
  \unskip\egroup
  \Grot@x\z@
  \Grot@y\z@
  \wd0\z@\dp0\z@\ht0\z@
  \Grot@box
}
%    \end{macrocode}
% \end{environment}
%
% \begin{macro}{\turnbox}
%    A macro version of the \Lenv{rotate} environment.
%
%    |\turnbox{|\meta{degrees}|}{|\meta{text}|}|
%    \begin{macrocode}
\def\turnbox#1#2{%
  \ifcl@ckwise
    \Grot@setnegangle{#1}
  \else
    \Grot@setangle{#1}
  \fi
  \setbox\z@\hbox{{#2}}%
  \Grot@x\z@
  \Grot@y\z@
  \wd0\z@\dp0\z@\ht0\z@
  \Grot@box
}  
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Sideways figures and tables}
%
%    Rotation of floats through a fixed angle of 90 degrees.
%
%    First, a generalized |rotfloat| environment.
% \begin{macro}{\rot@float@box}
% \begin{macro}{\@rotfloat}
% \begin{macro}{\@xrotfloat}
%    \begin{macrocode}
\newsavebox\rot@float@box
\def\@rotfloat#1{%
  \@ifnextchar[%
    {\@xrotfloat{#1}}%
    {\edef\@tempa{\noexpand\@xrotfloat{#1}[\csname fps@#1\endcsname]}\@tempa}%
}
\def\@xrotfloat#1[#2]{%
  \@float{#1}[#2]%
%    \end{macrocode}
%    Set the float contents in a box of |\textheight| instead of
% |\columnwidth|.
%    \begin{macrocode}
  \begin{lrbox}\rot@float@box
  \begin{minipage}\textheight
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\end@rotfloat}
%
%    We call |\end@float| having previously rotated the box |\@currbox|.
% The rotation is either clockwise or counterclockwise, depending on
% whether the page is odd or even. In |oneside| mode it is always odd.
% See the \file{rotating} package documentation for further details.
%
% \emph{Extension:} Generalised the output messages.
% \changes{v2}{1997/12/02}{Using \cs{rot@label} instead of \cs{label}}
%    \begin{macrocode}
\def\end@rotfloat{%
  \end{minipage}\end{lrbox}%
  \global\addtocounter{r@tfl@t}{1}%
  \rot@label{RF\ther@tfl@t}%
  \def\R@@page{\pageref{RF\ther@fl@t}}%
  \wd\rot@float@box\z@
  \ht\rot@float@box\z@
  \dp\rot@float@box\z@
  \vbox to \textheight{%
    \if@rot@twoside
      \def\R@@page{\pageref{RF\ther@tfl@t}}%
    \else
      \let\R@@page\rot@LR
    \fi
    \ifodd\R@@page
       \PWRF@trace\tw@{Adding sideways float on right hand page}%
       \vfill
       \centerline{\rotatebox{90}{\box\rot@float@box}}%
    \else
       \PWRF@trace\tw@{Adding sideways float on left hand page}%
       \centerline{\rotatebox{-90}{\box\rot@float@box}}%
       \vfill
    \fi
  }%
  \end@float
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@rotdblfloat}
% \begin{macro}{\@rotdblflt}
% \begin{macro}{\@rotxdblfloat}
%     General macros for double column floats.
% \changes{v2}{1997/12/03}{Added code for double column floats}
%    \begin{macrocode}
\def\@rotdblfloat{%
  \if@twocolumn\let\reserved@a\@rotdblflt\else\let\reserved@a\@rotfloat\fi
  \reserved@a}
\def\@rotdblflt#1{\@ifnextchar[{\@rotxdblfloat{#1}}{\@rotxdblfloat{#1}[tp]}}
\def\@rotxdblfloat#1[#2]{%
  \hsize\textwidth\linewidth\textwidth
  \@float{#1}[#2]%
  \begin{lrbox}\rot@float@box
  \begin{minipage}\textheight
}
\def\end@rotdblfloat{%
  \end{minipage}\end{lrbox}%
  \global\addtocounter{r@tfl@t}{1}%
  \rot@label{RF\ther@tfl@t}%
  \def\R@@page{\pageref{RF\ther@tfl@t}}%
  \@tempdima\ht\rot@float@box
  \advance\@tempdima by \dp\rot@float@box
  \PWRF@trace\thr@@{BOX wd: \the\wd\rot@float@box, ht: \the\ht\rot@float@box, dp: \the\dp\rot@float@box: so shift by .5 of \the\@tempdima}%
  \wd\rot@float@box\z@
  \ht\rot@float@box\z@
  \dp\rot@float@box\z@
  \vbox to \textheight{%
    \if@rot@twoside
      \def\R@@page{\pageref{RF\ther@tfl@t}}%
    \else
      \let\R@@page\rot@LR
    \fi
    \ifodd\R@@page
      \PWRF@trace\tw@{Adding sideways float on right hand page}%
      \vfill
      \hbox to \textwidth{\hfill\rotatebox{90}{\box\rot@float@box}\hfill}%
    \else
      \PWRF@trace\tw@{Adding sideways float on left hand page}%
      \hbox to \textwidth{\hfill\rotatebox{-90}{\box\rot@float@box}\hfill}%
      \vfill
    \fi
  }
  \end@dblfloat
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\@initisofig}
% \begin{macro}{\@initisotab}
% \begin{macro}{\rotcapfont}
%  \emph{Extension:} The following definitions implement some of
% the ISO-specific stuff. They basically provide for the setting up of
% the \file{lof} and \file{lot} files. |\rotcapfont| is the font for
% typesetting any captions. For ISO it is bold and may be larger than normal.
%
% \changes{v2}{1997/12/03}{Added \cs{PWRF@initfig} and \cs{PWRF@inittab}}
% \changes{v2.1}{2000/02/15}{Added check for iso class}
% \changes{v2.1}{2000/02/15}{Used \cs{@initisofig} instead of 
%                 \cs{PWRF@initfig} and same for tables}
%    \begin{macrocode}
\@ifundefined{@initisofig}{%
  \newcommand{\@initisofig}{}
  \newcommand{\@initisotab}{}
  \newif\ifinfloat
  \newcommand{\rotcapfont}{}}{\newcommand{\rotcapfont}{\captionsize\bf}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{environment}{sidewaysfigure}
%    Use |\def| instead of |\...environment| in order to be OK for both
%    redefining the \file{rotating} environment and creating a new 2.09
%    environment.
%    \begin{macrocode}
\def\sidewaysfigure{%
  \@initisofig
  \@rotfloat{figure}}
\def\endsidewaysfigure{\end@rotfloat\infloatfalse}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{sidewaystable}
%    The \Lenv{sidewaystable} environment is similar.
%    It also requires redefinition to take account of the ISO peculiarities.
%    \begin{macrocode}
\def\sidewaystable{%
  \@initisotab
  \@rotfloat{table}}
\def\endsidewaystable{\end@rotfloat\infloatfalse}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{sidewaysfigure*}
% \begin{environment}{sidewaystable*}
%    These are for rotations in a two column setting. The definitions
% are similar to the previous ones for single column.
% \changes{v2}{1997/12/03}{Added sidewaysfigure and sidewaystable for double columns}
%    \begin{macrocode}
\newenvironment{sidewaysfigure*}{%
  \@initisofig
  \@rotdblfloat{figure}}{%
  \end@rotdblfloat\infloatfalse}
\newenvironment{sidewaystable*}{%
  \@initisotab
  \@rotdblfloat{table}}{%
  \end@rotdblfloat\infloatfalse}
%    \end{macrocode}
% \end{environment}
% \end{environment}
%
% \subsubsection{Rotated captions}
%
% \begin{macro}{\rotcaption}
% \begin{macro}{\@rotcaption}
%    This inserts a caption rotated through 90 degrees. The code, which is
%    essentially a copy of the normal |\caption| code, is defined
%    in the \file{rotation} package.
%    \begin{macrocode}
\def\rotcaption{\refstepcounter\@captype\@dblarg{\@rotcaption\@captype}}
\long\def\@rotcaption#1[#2]#3{%
  \addcontentsline{\csname ext@#1\endcsname}{#1}{%
     \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
  \par
  \begingroup
    \@parboxrestore
    \normalsize
    \@makerotcaption{\csname fnum@#1\endcsname}{#3}%
  \endgroup}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@makerotcaption}
%    The workhorse for rotated captions.
%    \begin{macrocode}
\long\def\@makerotcaption#1#2{%
  \hspace{\abovecaptionskip}
  \setbox\@tempboxa\hbox{{\rotcapfont #1 -- #2}}%
  \ifdim \wd\@tempboxa > .8\vsize
      \rotatebox{90}{%
      \begin{minipage}{.8\textheight}{\centering{\rotcapfont #1 -- #2}\par}\end{minipage}%
      }\par
  \else%
    \rotatebox{90}{\box\@tempboxa}%
  \fi
  \hspace{\belowcaptionskip}
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\controtcaption}
%    A rotated continuation caption.
%    \begin{macrocode}
\newcommand{\controtcaption}{\@controtcaption\@captype}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@controtcaption}
%    The worker for a rotated continuation caption.
%    \begin{macrocode}
\long\def\@controtcaption#1#2{%
  \begingroup
    \@parboxrestore
    \normalsize
    \@makerotcaption{\csname fnum@#1\endcsname}{\ignorespaces #2}\par
  \endgroup}
%    \end{macrocode}
% \end{macro}
%
%    The end of the package code.
%    \begin{macrocode}
%</rot|rotne>
%    \end{macrocode}
%
%
%
% \bibliographystyle{alpha}
%
% \begin{thebibliography}{GMS94}
%
% \bibitem[GMS94]{GOOSSENS94}
% Michel Goossens, Frank Mittelbach, and Alexander Samarin.
% \newblock {\em The LaTeX Companion}.
% \newblock Addison-Wesley Publishing Company, 1994.
%
% \bibitem[ISO97]{ISOD397}
% {\em {ISO/IEC Directives Part 3 --- Drafting and presentation of International
%   Standards}}, third edition, 1997.
%
% \bibitem[Wil96]{PRW96i}
% Peter~R. Wilson.
% \newblock {\em {LaTeX for standards: The LaTeX package files user manual}}.
% \newblock NIST Report NISTIR, June 1996.
%
% \end{thebibliography}
%
% 
% \Finale
% \PrintIndex
%
\endinput

%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}


