% \iffalse
% rotfloat.dtx - The rotfloat package
% (c) 1995 Harald Axel Sommerfeldt (axel@hp1.ang-physik.uni-kiel.de)
%
%<*driver>
\documentclass{ltxdoc}
\setlength{\parindent}{0pt}
\setlength{\parskip}{\smallskipamount}
\IfFileExists{ltxdoc.cfg}{}{\OnlyDescription\RecordChanges\CodelineIndex}
\begin{document}
  \DocInput{rotfloat.dtx}
  \IfFileExists{ltxdoc.cfg}{}{\PrintChanges\PrintIndex}
\end{document}
%</driver>
% \fi
%
% \providecommand{\LaTeXcomp}{The \LaTeX{} Companion}
% \newcommand{\purerm}[1]{{\upshape\mdseries\rmfamily #1}}
% \newcommand{\puresf}[1]{{\upshape\mdseries\sffamily #1}}
% \newcommand{\purett}[1]{{\upshape\mdseries\ttfamily #1}}
% \newenvironment{Options}[1]%
%  {\begin{list}{}{\renewcommand{\makelabel}[1]{\texttt{##1}\hfil}%
%     \settowidth{\labelwidth}{\texttt{#1\space}}%
%     \setlength{\leftmargin}{\labelwidth}%
%     \addtolength{\leftmargin}{\labelsep}}}%
%  {\end{list}}
%
% \def\packageversion{1.0}
% \def\packagedate{1995/03/30}
% \changes{v1.0}{30 Mar 94}{First release}
%
% \title{The \puresf{rotfloat} package\thanks{This package has version number
%        \packageversion, last revised \packagedate.}}
% \author{Harald Axel Sommerfeldt\\axel@hp1.ang-physik.uni-kiel.de}
% \date{1995/03/30}
% \maketitle
%
% \begin{abstract}
% The \textsf{float} package~\cite{float} provides commands to define new floats
% of various styles (|plain|, |boxed|, |ruled|, and userdefined ones%
% \iffalse%
% \footnote{BTW: The new \textsf{caption} package~\cite{caption2} provides
% user-commands to define your own float styles.}%
% \fi%
% );
% the \textsf{rotating} package~\cite{rotating} provides new environments (|sidewaysfigure|
% and |sidewaystable|) which are rotated by $90^\circ$ or $270^\circ$.
% But what about new rotated floats, e.g.\ a rotated ruled one?
% This package makes this possible; it builds a bridge between both packages
% and extend the commands from the \textsf{float} package to define rotated
% versions of the new floats, too.
% \end{abstract}
%
%
% \section{The user interface}
% To use this package just type
% \begin{quote}
%   |\usepackage|\oarg{options}|{rotfloat}|
% \end{quote}
% in the preamble of your document. The options are exactly the same as
% for the \textsf{rotating} package, in fact this package hasn't got any
% own options at all.
%
% \DescribeMacro{\newfloat}
% \DescribeMacro{\restylefloat}
% The commands |\newfloat| and |\restylefloat| from the \textsf{float} package
% (re)define the float type \meta{type} and now additionally a rotated one called
% \meta{\purett{sideways}type}:
% \begin{quote}
%   |\newrotfloat|\marg{type}\marg{placement}\marg{ext}\oarg{within}\\
%   |\restylerotfloat|\marg{type}
% \end{quote}
%
% \begin{minipage}[t]\textwidth
% E.g.\ the code
% \begin{quote}
%   |\floatstyle{ruled}|\\
%   |\floatname{program}{Program}|\\
%   |\newfloat{program}{tbp}{lop}[section]|
% \end{quote}
% defines the new floating environments |program|, |program*|, and |sidewaysprogram|
% which behave equivalent to |figure|, |figure*|, and |sidewaysfigure|.
% \end{minipage}
%
% \begin{minipage}[t]\textwidth
% The code
% \begin{quote}\nopagebreak%
%   |\floatstyle{boxed}|\\
%   |\restylefloat{table}|
% \end{quote}
% will restyle the environments |table|, |table*|, and |sidewaystable|.
% \end{minipage}
%
% Please take a look at the \textsf{float} package for a complete description
% of these commands.
% Additionally an example file is provided with this package.
%
% \section{A final note}
% This package was written and tested with the version 1.2 of the \textsf{float}
% package and version 2.6 of the \textsf{rotating} package.
% You should \textbf{not} use this package together with older versions of them!
%
% Future versions of these packages may make some trouble, but I hope they will not.
%
% \StopEventually{
%   \begin{thebibliography}{9}
%   \bibitem{float}
%   Anselm Lingnau:
%   \textsl{An Improved Environment for Floats},
%   1994/06/20
%   \bibitem{rotating}
%   Sebastian Rahtz and Leonor Barroca:
%   \textsl{A style option for rotated objects in \LaTeX},
%   1994/08/26
% \iffalse
%   \bibitem{caption2}
%   Harald Axel Sommerfeldt:
%   \textsl{The enhanced caption package},
%   not yet released (about April 1995)
% \fi
%   \end{thebibliography}
% }
% \setlength{\parskip}{0pt plus 1pt}
%
% \CheckSum{60}
% \DoNotIndex{\@ifnextchar,\@namedef,\@nameuse}
% \DoNotIndex{\bgroup,\columnwidth,\csname,\def,\edef,\egroup,\else,\endcsname}
% \DoNotIndex{\empty,\expandafter,\fi,\global,\ifx,\let,\newcommand,\noexpand}
% \DoNotIndex{\renewcommand,\setbox,\textheight,\typeout,\undefined,\vbox}
% \DoNotIndex{\CurrentOption,\DeclareOption,\ExecuteOptions,\NeedsTeXFormat}
% \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage,\RequirePackage}
%
% \section{The code}
% \iffalse
%<*package>
% \fi
%
% \subsection{The identification part}
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{rotfloat}[1995/03/30 v1.0 rotfloat package (AS)]
\typeout{Package: rotfloat v1.0 <1995/03/30> (Axel Sommerfeldt)}
%    \end{macrocode}
%
% \subsection{The declaration and execution of options}
% The \textsf{rotfloat} package hasn't got any own options, so we just pass
% everything we get to the \textsf{rotating} package.
%    \begin{macrocode}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{rotating}}
\ProcessOptions
%    \end{macrocode}
%
% \subsection{The package loading part}
% Of course this package needs the \textsf{float} and the \textsf{rotating}
% package, so we load them here.
%    \begin{macrocode}
\RequirePackage{float}[1994/06/20]
\RequirePackage{rotating}%[1995/01/06]
%    \end{macrocode}
%
% \subsection{Adaption of the float package}
% \begin{macro}{\float@end}
% First of all one improvement of the \textsf{float} package:
% |\float@end| now calls |\end@float| from the \LaTeXe\ kernel.
% This code is more independent of what's really going on in the \LaTeXe\ macros
% |\@float| and |\end@float| than the original code of the float package is.
%    \begin{macrocode}
\renewcommand*\float@end{%
  \egroup%
  \global\setbox\@currbox\vbox\bgroup%
  \float@makebox\end@float\egroup}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@HHfloat}
% \begin{macro}{\float@endH}
% This patch has two functions:
% First of all, an error of the float package is fixed that causes floats with the
% placement specifier |[H]| to look differ from floats with other float placements.
% Additionaly this patch is required to make the sideways floats work with
% the placement |[H]|.
%    \begin{macrocode}
\def\@HHfloat#1[H]{\@Hxfloat{#1}[!ht]}
\let\float@endH\undefined
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{The main code part}
% If you really want to know what's exactly going on here, you have to study the
% code from the packages \textsf{float} and \textsf{rotating} first!
%
% \begin{macro}{\rotfloat@restyle}
% First, we save the old definition of |\restylefloat| because we need it
% later on.
%    \begin{macrocode}
\let\rotfloat@restyle\restylefloat
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\restylefloat}
% The new code for |\restylefloat| behaves quite like the old one, but it defines
% a sideways float as well. What differs sideways floats from the `normal' ones?
% \begin{enumerate}
% \item |\columnwidth| ist set to |\textheight| before calling |\@float|
%    (|\@float| itself set |\hsize| to |\columnwidth|).
% \item |\rotfloat@end| is used instead of |\float@end|.
% \item We define no |*|-form of the environment because a rotated float
%    always fills the whole page.
% \end{enumerate}
%    \begin{macrocode}
\renewcommand*\restylefloat[1]{%
  \rotfloat@restyle{#1}%
  \@namedef{sideways#1}{%
    \bgroup\@nameuse{fst@#1}\columnwidth\textheight\@float{#1}}%
  \expandafter\let\csname endsideways#1\endcsname\rotfloat@end}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\rotfloat@end}
% This macro does all the stuff that |\float@end| does and of course more:
%
% First of all, we finish the definition of |\@currbox| with |\egroup|.
% Then we set |\@currbox| to the new contents:
% \begin{enumerate}
%   \item |\@rotfloat| (but without the contents of |\@float|)
%   \item |\float@makebox| (which includes the contents of |\@float| = |\@currbox|)
%   \item |\end@rotfloat| (which includes |\end@float|)
% \end{enumerate}
% Finally we finish the whole group (started in |\@namedef{sideways#1}| within
% |\restylefloat|) with |\egroup|.
%    \begin{macrocode}
\newcommand*\rotfloat@end{%
  \egroup%
  \global\setbox\@currbox\vbox\bgroup%
  \def\@float##1[##2]{}\let\@xfloat\@float\@rotfloat{}%
  \float@makebox\end@rotfloat\egroup}
%    \end{macrocode}
% \end{macro}
%
% \iffalse
%</package>
% \fi
%
% \Finale
%
\endinput

