% \iffalse meta-comment % % Copyright (c) 1995-2002 Axel Sommerfeldt (rotfloat@sommerfeldt.net) % % This file is part of the rotfloat package. % ------------------------------------------ % % It may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.2 % of this license or (at your option) any later version. % The latest version of this license is in % http://www.latex-project.org/lppl.txt % and version 1.2 or later is part of all distributions of LaTeX % version 1999/12/01 or later. % % \fi % % \iffalse %<*driver> \NeedsTeXFormat{LaTeX2e}[1994/12/01] \documentclass{ltxdoc} \setlength{\parindent}{0pt} \setlength{\parskip}{\smallskipamount} \begin{document} \DocInput{rotfloat.dtx} \end{document} % % \fi % % \newcommand*{\purerm}[1]{{\upshape\mdseries\rmfamily #1}} % \newcommand*{\puresf}[1]{{\upshape\mdseries\sffamily #1}} % \newcommand*{\purett}[1]{{\upshape\mdseries\ttfamily #1}} % % \def\packageversion{1.1} % \def\packagedate{2002/02/02} % \changes{v1.0}{30 Mar 95}{First release} % \changes{v1.1}{ 2 Feb 02}{Revised and adapted to new versions of float and rotating} % % \title{The \puresf{rotfloat} package\thanks{This package has version number % \packageversion, last revised \packagedate.}} % \author{Axel Sommerfeldt\\\texttt{rotfloat@sommerfeldt.net}} % \date{2002/02/02} % \maketitle % % \begin{abstract} % The \textsf{float} package~\cite{float} provides commands to define new floats % of various styles (|plain|, |boxed|, |ruled|, and userdefined ones); % 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, because all options will be passed to % the \textsf{rotating} package. % (The \textsf{rotfloat} 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*|, % |sidewaysprogram|, and |sidewaysprogram*| % which behave equivalent to |figure|, |figure*|, % |sidewaysfigure|, and |sidewaysfigure*|. % (Note that |sidewaysfigure*| has been introduced to version $2.10$ of the \puresf{rotating} % package, therefore you only get a |sidewaysprogram*| environment if you use this or a newer % version of the \puresf{rotating} package.) % \end{minipage} % % \begin{minipage}[t]\textwidth % The code % \begin{quote}\nopagebreak% % |\floatstyle{boxed}|\\ % |\restylefloat{table}| % \end{quote} % will restyle the environments |table|, |table*|, |sidewaystable|, 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{What has changed since version {1.0}?} % Version $1.0$ of this package was a quick \& dirty but working hack. This version takes it all % more serious, it tries to patch as less code from the float package as possible and % especially it lets the |[H]| code for the not-sideways floats intact. % (Version $1.0$ had just patched |[H]| to |[!ht]| to make thinks easier to handle.) % % Furthermore it was adapted to the new versions 1.3 of the float and % 2.10 of the rotating package. % % \section{A final note} % This package was tested with the versions $1.2$, $1.2c$, $1.2d$, $1.2e$, $1.3c$, % and $1.3d$ of the \textsf{float} package and version $2.6$, $2.9$, $2.10$, $2.12$, % and $2.13$ 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. % If they do please don't hesitate to send me a bug report including a simple non-working % example and the logfile produced by TeX. % % \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 % \end{thebibliography} % } % \setlength{\parskip}{0pt plus 1pt} % % \CheckSum{195} % \DoNotIndex{\@ifnextchar,\@ifundefined,\@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} % % \iffalse %<*package> % \fi % % \section{The code} % % Note: % 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! % % \subsection{The identification part} % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] \ProvidesPackage{rotfloat}[2002/02/02 v1.1 rotfloat package (AS)] \typeout{Package: rotfloat v1.1 <2002/02/02> (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 both here. % % \begin{macrocode} \RequirePackage{float}[1994/06/20] % >= version 1.2 \RequirePackage{rotating}%[1995/01/06] % >= version 2.6 % \end{macrocode} % % \subsection{Adaption of the float package} % \changes{v1.0a}{1 Apr 95}{Blew {\tt\protect\bslash float@end} up} % % \begin{macro}{\rotfloat@xoftwo} % % If the float is a normal one, |\rotfloat@xoftwo| is defined to |\@firstoftwo|. % If it is a sideways one, it will be (locally) defined to |\@secondoftwo|. % % \begin{macrocode} \let\rotfloat@xoftwo\@firstoftwo % \end{macrocode} % \end{macro} % % From now on we have different code for version $1.2$ and version $1.3$ of % the \textsf{float} package. If |\@float@HH| is not defined we assume % version $1.2$, otherwise version $1.3$. % % \begin{macrocode} \ifx\@float@HH\undefined \wlog{rotfloat package: v1.2 of float detected} % \end{macrocode} % % First the code for version $1.2$ of the float package: % % \begin{macro}{\rotfloat@HH} % \begin{macro}{\rotfloat@restyle} % % We save the old definitions of |\@HHfloat| and |\restylefloat| % because we need them later on. % % \begin{macrocode} \let\rotfloat@HH\@HHfloat \let\rotfloat@restyle\restylefloat % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@HHfloat} % \changes{v1.1}{1 Feb 02}{Leave H-code intact for normal floats} % % We do not support the placement specifier |[H]| for sideways floats, % therefore we have to patch it to |[!ht]| if it is a sideways one. % % \begin{macrocode} \def\@HHfloat#1[H]{% \rotfloat@xoftwo{\rotfloat@HH{#1}[H]}{\@Hxfloat{#1}[!ht]}} % \end{macrocode} % \end{macro} % % \begin{macro}{\restylefloat} % \changes{v1.0a}{1 Apr 95}{Senseless {\tt\protect\bslash bgroup} removed} % \changes{v1.1}{1 Feb 02}{We define a *-sideways float as well} % % The new code for |\restylefloat| behaves like the old one, but it defines % a sideways float as well. What differs sideways floats from the `normal' ones? % \begin{enumerate} % \item |\rotfloat@xoftwo| is defined to |\@secondoftwo|. % (|\rotfloat@xoftwo| will be used in |\@HHfloat|.) % \item |\columnwidth| ist set to |\textheight| before calling |\@float|. % (|\@float| itself set |\hsize| to |\columnwidth|.) % \item |\rotfloat@end| is used instead of |\float@end|. % \end{enumerate} % % If |\@rotdblfloat| is defined we have included \textsf{rotating} version $2.10$ % or newer. In this case we can define a star form as well. Otherwise we define % a star form, too, but this causes an error and will do the non-star form instead. % % \begin{macrocode} \renewcommand*\restylefloat[1]{% \rotfloat@restyle{#1}% \@namedef{sideways#1}{% \let\rotfloat@xoftwo\@secondoftwo\columnwidth\textheight \@nameuse{fst@#1}\@float{#1}}% \expandafter\let\csname endsideways#1\endcsname\rotfloat@end \ifx\@rotdblfloat\undefined \@namedef{sideways#1*}{% \PackageError{rotfloat}{% You need rotating version 2.10 or newer to do this}{\@ehd}% \@nameuse{sideways#1}}% \expandafter\let\csname endsideways#1*\endcsname\rotfloat@end \else \@namedef{sideways#1*}{% \let\rotfloat@xoftwo\@secondoftwo\columnwidth\textheight \@nameuse{fst@#1}\@dblfloat{#1}}% \expandafter\let\csname endsideways#1*\endcsname\rotfloat@dblend \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\rotfloat@end} % \begin{macro}{\rotfloat@dblend} % \changes{v1.0a}{1 Apr 95}{Senseless {\tt\protect\bslash egroup} removed} % % To understand the following code we first have to understand what is % going on inside |\float@end|. Well, mainly it looks like this: % \begin{quote} % |\newcommand\float@end{%|\\ % | \egroup|\\ % | \global\setbox\@currbox\vbox\bgroup|\\ % | \float@makebox\end@float\egroup}| % \end{quote} % The |\egroup| will finish the current definition of the float inside the % vbox |\@currbox|. % Afterwards the float is redefined to |\float@makebox| (which will build up a % new float contents) plus |\end@float| (which will mainly finish the % definition of the new float with |\egroup|). The |\egroup| finally closes % the group which started at the beginning of the environment (see |\restylefloat|). % % These macros now do the same, but instead of using |\float@makebox| plus % |\end@float| we set the new float contents to % \begin{enumerate} % \item |\@rotfloat| (but without the contents of the |\@float| itself) % \item |\float@makebox| (which includes the contents of the float) % \item |\end@rotfloat| (which includes |\egroup|) % \end{enumerate} % % Note that we do not need the final |\egroup| here, because we do not start % our sideways environments with an extra |\bgroup|. % % \begin{macrocode} \newcommand*\rotfloat@end{% \egroup% \global\setbox\@currbox\vbox\bgroup% \def\@float##1[##2]{}\let\@xfloat\@float\@rotfloat{}% \float@makebox\end@rotfloat} \newcommand*\rotfloat@dblend{% \egroup% \global\setbox\@currbox\vbox\bgroup% \def\@float##1[##2]{}\let\@xfloat\@float\@rotdblfloat{}% \float@makebox\end@rotdblfloat} % \end{macrocode} % \end{macro} % \end{macro} % % So far the code for the version $1.2$ of the float package. % % \begin{macrocode} \else % \end{macrocode} % % Now the code for the float package version $1.3$: % % \begin{macrocode} \wlog{rotfloat package: v1.3 of float detected} % \end{macrocode} % % \begin{macro}{\rotfloat@HH} % \begin{macro}{\rotfloat@restyle} % % |\@HHfloat| has changed to |\float@HH| here. % Furthermore we need to redefine |\float@restyle| instead of |\restylefloat| % so |\restylefloat*| will still work. % % \begin{macrocode} \let\rotfloat@HH\@float@HH \let\rotfloat@restyle\float@restyle % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@float@HH} % % |\@Hxfloat| has changed to |\float@Hx| here. % % \begin{macrocode} \def\@float@HH#1[H]{% \rotfloat@xoftwo{\rotfloat@HH{#1}[H]}{\@float@Hx{#1}[!ht]}} % \end{macrocode} % \end{macro} % % \begin{macro}{\float@restyle} % % A |\@float@setevery{#1}| had to be added here. % % \begin{macrocode} \renewcommand*\float@restyle[1]{% \rotfloat@restyle{#1}% \@namedef{sideways#1}{% \let\rotfloat@xoftwo\@secondoftwo\columnwidth\textheight \@nameuse{fst@#1}\@float@setevery{#1}\@float{#1}}% \expandafter\let\csname endsideways#1\endcsname\rotfloat@end \ifx\@rotdblfloat\undefined \@namedef{sideways#1*}{% \PackageError{rotfloat}{% You need rotating version 2.10 or newer to do this}{\@ehd}% \@nameuse{sideways#1}}% \expandafter\let\csname endsideways#1*\endcsname\rotfloat@end \else \@namedef{sideways#1*}{% \let\rotfloat@xoftwo\@secondoftwo\columnwidth\textheight \@nameuse{fst@#1}\@float@setevery{#1}\@dblfloat{#1}}% \expandafter\let\csname endsideways#1*\endcsname\rotfloat@dblend \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\rotfloat@end} % \begin{macro}{\rotfloat@dblend} % % Version $1.3$ of float has a revised code of |\float@end|, % mainly two things have changed here: % \begin{itemize} % \item |\@endfloatbox| is called to finish the current float instead of |\egroup|. % Later on it is set to |\relax| so it don't get called within |\end@float| again. % \item |\float@makebox| has a parameter now, which will be set to |\columnwidth| or % |\textwidth|. % (In float $1.2$ the |\columnwidth| was hard wired into |\float@makebox|.) % \end{itemize} % % Note that the rotating package has is own code to handle the end of the float, % so we call |\@endfloatbox| to finish the (empty) float, too, but we don't need % to copy the trick of setting |\@endfloatbox| to |\relax| and we don't have to % finish the |\vbox| ourself. % % \begin{macrocode} \newcommand*\rotfloat@end{\@endfloatbox \global\setbox\@currbox\vbox\bgroup% \def\@float##1[##2]{}\let\@xfloat\@float\@rotfloat{}% \float@makebox\columnwidth\end@rotfloat} \newcommand*\rotfloat@dblend{\@endfloatbox \global\setbox\@currbox\vbox\bgroup% \def\@float##1[##2]{}\let\@xfloat\@float\@rotdblfloat{}% \float@makebox\textwidth\end@rotdblfloat} % \end{macrocode} % \end{macro} % \end{macro} % % That's all folks. % % \begin{macrocode} \fi % \end{macrocode} % % \iffalse % % \fi % % \Finale % \endinput