| 1 |
% |
| 2 |
% \iffalse |
| 3 |
% |
| 4 |
% |
| 5 |
% File: rotating.dtx |
| 6 |
%% Copyright (C) 1995-1999 Sebastian Rahtz and Leonor Barroca |
| 7 |
%% Copyright (C) 2001-2003,2007-2009 Robin Fairbairns |
| 8 |
%% Copyright (C) 2016-2025 LaTeX Project |
| 9 |
%% The LaTeX Project and any individual authors listed elsewhere |
| 10 |
%% in this file. |
| 11 |
% |
| 12 |
% This work may be distributed and/or modified under the |
| 13 |
% conditions of the LaTeX Project Public License, either version 1.3c |
| 14 |
% of this license or (at your option) any later version. |
| 15 |
% The latest version of this license is in |
| 16 |
% https://www.latex-project.org/lppl.txt |
| 17 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 18 |
% version 2005/12/01 or later. |
| 19 |
% |
| 20 |
% This work has the LPPL maintenance status `maintained'. |
| 21 |
% |
| 22 |
% |
| 23 |
% This work consists of the file rotating.dtx |
| 24 |
% and the derived file rotating.sty, and testing material |
| 25 |
% rotex.tex and cat.eps |
| 26 |
% |
| 27 |
% \begin{macrocode} |
| 28 |
\NeedsTeXFormat{LaTeX2e} |
| 29 |
%<*dtx> |
| 30 |
\ProvidesFile{rotating.dtx}% |
| 31 |
%</dtx> |
| 32 |
%<package>\ProvidesPackage{rotating}% |
| 33 |
[2025/01/14 v2.16e |
| 34 |
%<package> rotated objects in LaTeX% |
| 35 |
%<*dtx> |
| 36 |
rotating package source file% |
| 37 |
%</dtx> |
| 38 |
] |
| 39 |
%<*dtx> |
| 40 |
\documentclass{ltxdoc} |
| 41 |
\GetFileInfo{rotating.dtx} |
| 42 |
\begin{document} |
| 43 |
\title{A package for rotated objects in \LaTeX\thanks{This file has |
| 44 |
version number \fileversion, last revised \filedate}} |
| 45 |
\author{Robin Fairbairns |
| 46 |
\and Sebastian Rahtz \and Leonor Barroca} |
| 47 |
\date{printed \today} |
| 48 |
\MaintainedByLaTeXTeam{graphics} |
| 49 |
\maketitle |
| 50 |
\tableofcontents |
| 51 |
% \listoffigures |
| 52 |
% \listoftables |
| 53 |
\DocInput{rotating.dtx} |
| 54 |
\end{document} |
| 55 |
%</dtx> |
| 56 |
% \fi |
| 57 |
% |
| 58 |
% \begin{abstract} |
| 59 |
% This article documents a \LaTeX\ package, `rotating.sty', |
| 60 |
% which performs most sorts of |
| 61 |
% rotation one might like, including rotation of complete floating |
| 62 |
% figures and tables. |
| 63 |
% \end{abstract} |
| 64 |
% |
| 65 |
% \section{Introduction} |
| 66 |
% |
| 67 |
% The package provides: |
| 68 |
% \begin{itemize} |
| 69 |
% \item two new environments, \texttt{sidewaystable} and |
| 70 |
% \texttt{sidewaysfigure}, each of which produces a single page-size |
| 71 |
% float with contents rotated $\pm90$\,degrees; and |
| 72 |
% \item a variety of other rotation-related commands and environments. |
| 73 |
% \end{itemize} |
| 74 |
% |
| 75 |
% Note that the package uses rotation facilities from the |
| 76 |
% \textsf{graphicx} package. When generating DVI output, users should |
| 77 |
% note that rotation is typically \emph{not} visible in a DVI viewer: |
| 78 |
% conversion to, and viewing, PostScript or PDF is necessary. |
| 79 |
% |
| 80 |
% \section{Usage} |
| 81 |
% |
| 82 |
% \subsection{Package options} |
| 83 |
% |
| 84 |
% Sideways figures and tables always take up the whole page. In |
| 85 |
% single-sided documents, they may be rotated so that the bottom of |
| 86 |
% the figures is on the left (package option |
| 87 |
% `\texttt{counterclockwise}') or the right (package option |
| 88 |
% `\texttt{clockwise}'). The default is to turn so that the bottom is |
| 89 |
% on the right (option `\texttt{clockwise}'). |
| 90 |
% |
| 91 |
% Option `\texttt{anticlockwise}' is an alias for |
| 92 |
% `\texttt{counterclockwise}'. |
| 93 |
% |
| 94 |
% If the `\texttt{twoside}' option has been given to the main document |
| 95 |
% class (either explicitly, or implicitly as in the default for book |
| 96 |
% class), the package will rotate sideways figures according to the |
| 97 |
% page number (this requires at least two passes through \LaTeX{}). |
| 98 |
% If you want the `\texttt{twoside}' option, but want the figures |
| 99 |
% always in one direction, use the `\texttt{figuresright}' or |
| 100 |
% `\texttt{figuresleft}' options to the package. |
| 101 |
% |
| 102 |
% The package can produce a lot of logging information; the |
| 103 |
% amount of information is controlled by the package options |
| 104 |
% `\texttt{quiet}' (fewest messages; default), `\texttt{log}' and |
| 105 |
% `\texttt{chatter}' (most messages). |
| 106 |
% |
| 107 |
% All other options are passed to the \textsf{graphicx} package when |
| 108 |
% it is loaded to provide rotation functions. |
| 109 |
% |
| 110 |
% \subsection{Float environments} |
| 111 |
% |
| 112 |
% The environments \texttt{sidewaystable} and \texttt{sidewaysfigure} |
| 113 |
% introduce landscape-form floating tables and figures, respectively. |
| 114 |
% (Each of the environments has a ``starred'' version, such as |
| 115 |
% \texttt{sidewaystable*}, for a single-column float in a double-column |
| 116 |
% area of the document.) |
| 117 |
% |
| 118 |
% New rotated environments may be declared using the combined |
| 119 |
% facilities of the float and rotfloat packages. |
| 120 |
% |
| 121 |
% \subsection{Other environments and commands} |
| 122 |
% The package provides other \LaTeX\ environments: |
| 123 |
% \begin{description} |
| 124 |
% \item[\mdseries\ttfamily sideways] prints the contents of the |
| 125 |
% environment turned through 90 degrees counterclockwise; |
| 126 |
% \item[\mdseries\ttfamily turn] prints the contents turned through an |
| 127 |
% arbitrary angle (the argument to the environment); |
| 128 |
% \item[\mdseries\ttfamily rotate] prints the contents turned through |
| 129 |
% an arbitrary angle but does \emph{not} leave any space for the result |
| 130 |
% \end{description} |
| 131 |
% |
| 132 |
% The command \cs{turnbox}\marg{angle}\marg{matter to turn} is a macro |
| 133 |
% version of the \texttt{rotate} environment. |
| 134 |
% |
| 135 |
% A set of examples is given in the file \texttt{rotex.tex} |
| 136 |
% |
| 137 |
% \subsection{Positioning} |
| 138 |
% |
| 139 |
% Floats appear one to a page, and are positioned by spacer skips that |
| 140 |
% appear (logically) above and below the floating object. The skips, |
| 141 |
% \cs{rotFPtop} and \cs{rotFPbot}, are initialised from the standard |
| 142 |
% \LaTeX{} (internal) \cs{@fptop} and \cs{@fpbot} skips. As a result, |
| 143 |
% by default, rotated floats appear horizontally centred on their |
| 144 |
% float pages. |
| 145 |
% |
| 146 |
% Some sensible values for the registers are: |
| 147 |
% \par\noindent |
| 148 |
% \begin{tabular}{@{}llp{3in}@{}} |
| 149 |
% \cs{rotFPtop} & \cs{rotFPbot} & Effect \\ |
| 150 |
% \hline |
| 151 |
% 0pt plus 1fil & 0pt plus 1fil & figure/table appears in middle |
| 152 |
% (default value) \\ |
| 153 |
% 0pt & 0pt plus 1fil & figure/table appears with its top |
| 154 |
% nearest the edge of the page \\ |
| 155 |
% 0pt plus 1fil & 0pt plus 2fil & figure/table's bottom appears |
| 156 |
% twice as far from the edge as the |
| 157 |
% top does |
| 158 |
% \end{tabular} |
| 159 |
% |
| 160 |
% \MaybeStop{} |
| 161 |
% |
| 162 |
% \section{Setup} |
| 163 |
% Now we present the documented code. First, package options. |
| 164 |
% |
| 165 |
% Note that the \texttt{clockwise} and \texttt{counterclockwise} |
| 166 |
% options are present for compatibility only. |
| 167 |
% \begin{macrocode} |
| 168 |
%<*package> |
| 169 |
\DeclareOption{clockwise}{% |
| 170 |
\AtBeginDocument{\setkeys{Grot}{units=360}}% |
| 171 |
} |
| 172 |
\DeclareOption{counterclockwise}{% |
| 173 |
\AtBeginDocument{\setkeys{Grot}{units=-360}}% |
| 174 |
} |
| 175 |
\DeclareOption{anticlockwise}{\ds@counterclockwise} |
| 176 |
% \end{macrocode} |
| 177 |
% Control figure orientation |
| 178 |
% \begin{macrocode} |
| 179 |
\DeclareOption{figuresleft}{% |
| 180 |
\@rot@twosidefalse |
| 181 |
\def\rot@LR{0}% |
| 182 |
} |
| 183 |
\DeclareOption{figuresright}{% |
| 184 |
\@rot@twosidefalse |
| 185 |
\def\rot@LR{-1}% |
| 186 |
} |
| 187 |
% \end{macrocode} |
| 188 |
% |
| 189 |
% control messages: |
| 190 |
% \begin{macrocode} |
| 191 |
\newif\ifrot@messages |
| 192 |
\DeclareOption{quiet}{% |
| 193 |
\rot@messagesfalse |
| 194 |
\let\rot@message\@gobble % pro tem -- should suppress altogether |
| 195 |
} |
| 196 |
\DeclareOption{log}{% |
| 197 |
\rot@messagestrue |
| 198 |
\def\rot@message{\PackageInfo{rotating}}% |
| 199 |
} |
| 200 |
\DeclareOption{chatter}{% |
| 201 |
\rot@messagestrue |
| 202 |
\def\rot@message{\PackageWarning{rotating}}% |
| 203 |
} |
| 204 |
% \end{macrocode} |
| 205 |
% |
| 206 |
% \begin{macro}{\if@rot@twoside} |
| 207 |
% \begin{macro}{\rot@LR} |
| 208 |
% A couple of commands for passing rotation direction around |
| 209 |
% \begin{macrocode} |
| 210 |
\newif\if@rot@twoside |
| 211 |
\if@twoside |
| 212 |
\@rot@twosidetrue |
| 213 |
\else |
| 214 |
\@rot@twosidefalse |
| 215 |
\fi |
| 216 |
\def\rot@LR{-1} |
| 217 |
% \end{macrocode} |
| 218 |
% \end{macro} |
| 219 |
% \end{macro} |
| 220 |
% |
| 221 |
% Pass any unknown options to the \textsf{graphicx} package, and |
| 222 |
% set up defaults and process the options. |
| 223 |
% \begin{macrocode} |
| 224 |
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{graphicx}} |
| 225 |
\ExecuteOptions{clockwise,quiet} |
| 226 |
\ProcessOptions |
| 227 |
% \end{macrocode} |
| 228 |
% |
| 229 |
% Other initialisation |
| 230 |
% \begin{macrocode} |
| 231 |
\RequirePackage{graphicx} |
| 232 |
\RequirePackage{ifthen} |
| 233 |
% \end{macrocode} |
| 234 |
% |
| 235 |
% \begin{macro}{\rotdriver} |
| 236 |
% The command \cs{rotdriver} allows a user to specify an initialisation file, |
| 237 |
% a sort of non-automatically-loaded driver (in the graphics, hyperref |
| 238 |
% sense). |
| 239 |
% \begin{macrocode} |
| 240 |
\def\rotdriver#1{\makeatletter\input{#1.def}\makeatother} |
| 241 |
% \end{macrocode} |
| 242 |
% \end{macro} |
| 243 |
% |
| 244 |
% The \texttt{r@tfl@t} counter is used when generating `labels' for |
| 245 |
% determining what side of the page the float is on, in twoside mode. |
| 246 |
% \begin{macrocode} |
| 247 |
\newcounter{r@tfl@t} |
| 248 |
\setcounter{r@tfl@t}{0} |
| 249 |
% \end{macrocode} |
| 250 |
% |
| 251 |
% Positioning skips (see above). |
| 252 |
% \begin{macrocode} |
| 253 |
\newskip\rotFPtop \rotFPtop=\@fptop |
| 254 |
\newskip\rotFPbot \rotFPbot=\@fpbot |
| 255 |
% \end{macrocode} |
| 256 |
% |
| 257 |
% \section{Turning and rotation environments} |
| 258 |
% \begin{macro}{sideways} |
| 259 |
% Environment to turn the contents through 90 degrees. |
| 260 |
% \changes{v2.16e}{2025/01/14}{add \cs{leavevmode} for tagging support} |
| 261 |
% \cs{Grot@box} issues a \cs{leavevmode} but for tagging (when using lualatex) |
| 262 |
% this is too late, it should happen before the box is set. |
| 263 |
% \begin{macrocode} |
| 264 |
\def\sideways{% |
| 265 |
\leavevmode |
| 266 |
\Grot@setangle{90}% |
| 267 |
\setbox\z@\color@hbox\ignorespaces} |
| 268 |
\def\endsideways{% |
| 269 |
\unskip\color@endbox |
| 270 |
\Grot@x\z@ |
| 271 |
\Grot@y\z@ |
| 272 |
\Grot@box |
| 273 |
} |
| 274 |
% \end{macrocode} |
| 275 |
% \end{macro} |
| 276 |
% |
| 277 |
% \begin{macro}{turn} |
| 278 |
% Rotate the contents of the environment, leaving the appropriate space |
| 279 |
% \changes{v2.16e}{2025/01/14}{add \cs{leavevmode} for tagging support} |
| 280 |
% \begin{macrocode} |
| 281 |
\def\turn#1{% |
| 282 |
\leavevmode |
| 283 |
\Grot@setangle{#1}% |
| 284 |
\setbox\z@\color@hbox\ignorespaces} |
| 285 |
\def\endturn{% |
| 286 |
\unskip\color@endbox |
| 287 |
\Grot@x\z@ |
| 288 |
\Grot@y\z@ |
| 289 |
\Grot@box |
| 290 |
} |
| 291 |
% \end{macrocode} |
| 292 |
% \end{macro} |
| 293 |
% \begin{macro}{rotate} |
| 294 |
% Rotate the contents of the environment, leaving \emph{no space}. |
| 295 |
% \changes{v2.16e}{2025/01/14}{add \cs{leavevmode} for tagging support} |
| 296 |
% \begin{macrocode} |
| 297 |
\def\rotate#1{% |
| 298 |
\leavevmode |
| 299 |
\Grot@setangle{#1}% |
| 300 |
\setbox\z@\color@hbox\ignorespaces} |
| 301 |
\def\endrotate{% |
| 302 |
\unskip\color@endbox |
| 303 |
\Grot@x\z@ |
| 304 |
\Grot@y\z@ |
| 305 |
\wd0\z@\dp0\z@\ht0\z@ |
| 306 |
\Grot@box |
| 307 |
} |
| 308 |
% \end{macrocode} |
| 309 |
% \end{macro} |
| 310 |
% \begin{macro}{\turnbox} |
| 311 |
% A macro version of the `rotate' environment. |
| 312 |
% \changes{v2.16e}{2025/01/14}{add \cs{leavevmode} for tagging support} |
| 313 |
% \begin{macrocode} |
| 314 |
\def\turnbox#1#2{% |
| 315 |
\leavevmode |
| 316 |
\Grot@setangle{#1}% |
| 317 |
% \end{macrocode} |
| 318 |
% Note: grouping within the box makes \cs{color@hbox} unnecessary, I think. |
| 319 |
% \begin{macrocode} |
| 320 |
\setbox\z@\hbox{{#2}}% |
| 321 |
\Grot@x\z@\Grot@y\z@ |
| 322 |
\wd0\z@\dp0\z@\ht0\z@ |
| 323 |
\Grot@box |
| 324 |
} |
| 325 |
% \end{macrocode} |
| 326 |
% \end{macro} |
| 327 |
% \section{Sideways figures and tables} |
| 328 |
% Now for the macros to provide a complete |
| 329 |
% environment for sideways figures and tables. |
| 330 |
% We define two environments |sidewaysfigure| and |
| 331 |
% |sidewaystable| that |
| 332 |
% fit in with the normal table and figure floats. These are `fixed' |
| 333 |
% environments that just do 90 degree rotation, but it would be easy |
| 334 |
% to parameterize this to do other rotations if needed (the mind |
| 335 |
% boggles\ldots) |
| 336 |
% |
| 337 |
% \begin{macro}{\@rotfloat} |
| 338 |
% \begin{macro}{\@xrotfloat} |
| 339 |
% \begin{macro}{\rot@float@box} |
| 340 |
% First a generalised `rotfloat' environment. We need to intercept |
| 341 |
% \LaTeX's float macros, in order to change the assumed width of a |
| 342 |
% float being |\columnwidth|. We want it to work on a width of |
| 343 |
% |\textheight| so that when we rotate the float, it comes out |
| 344 |
% the right height. This is not actually very satisfactory, since what |
| 345 |
% we \emph{really} want is for rotated floats to occupy the space they |
| 346 |
% actually \emph{use}. The captions are a problem --- since they can |
| 347 |
% precede the figure or table, we cannot set them in a box of the |
| 348 |
% right width (ie the \emph{height} of the forthcoming object), because |
| 349 |
% it has not happened yet. The result of these difficulties is that |
| 350 |
% rotated figures always end up as full page figures. |
| 351 |
% \begin{macrocode} |
| 352 |
\newsavebox\rot@float@box |
| 353 |
\def\@rotfloat#1{% |
| 354 |
\@ifnextchar[% |
| 355 |
{\@xrotfloat{#1}}% |
| 356 |
{\edef\@tempa{\noexpand\@xrotfloat{#1}[\csname fps@#1\endcsname]}\@tempa}% |
| 357 |
} |
| 358 |
\def\@xrotfloat#1[#2]{% |
| 359 |
\@float{#1}[#2]% |
| 360 |
% \end{macrocode} |
| 361 |
% Set the float contents in |
| 362 |
% a box of width \cs{textheight} instead of \cs{columnwidth}. |
| 363 |
% \changes{v2.16e}{2025/01/14}{correct tagging of the minipage} |
| 364 |
% \begin{macrocode} |
| 365 |
\begin{lrbox}\rot@float@box |
| 366 |
\SuspendTagging{\minipage}% |
| 367 |
\begin{minipage}\textheight |
| 368 |
\ResumeTagging{\minipage}% |
| 369 |
\UseTaggingSocket{para/restore}% |
| 370 |
} |
| 371 |
% \end{macrocode} |
| 372 |
% \end{macro} |
| 373 |
% \end{macro} |
| 374 |
% \end{macro} |
| 375 |
% |
| 376 |
% \begin{macro}{\end@rotfloat} |
| 377 |
% We call \LaTeX's \cs{end@float} macro having previously rotated |
| 378 |
% the box \cs{@currbox}. |
| 379 |
% The rotation is either clockwise or |
| 380 |
% anti-clockwise, depending on whether the page is odd or even; |
| 381 |
% in oneside mode it is always odd. |
| 382 |
% \begin{macrocode} |
| 383 |
\def\end@rotfloat{% |
| 384 |
% \end{macrocode} |
| 385 |
% If we are going to know whether pages are odd or even, |
| 386 |
% we need to use the a variant \cs{pageref} mechanism and our own |
| 387 |
% specialised labels. |
| 388 |
% \begin{macrocode} |
| 389 |
\par\SuspendTagging{\minipage}% |
| 390 |
\end{minipage}% |
| 391 |
\ResumeTagging{\minipage}% |
| 392 |
\end{lrbox}% |
| 393 |
\stepcounter{r@tfl@t}% |
| 394 |
\rot@label{RF\ther@tfl@t}% |
| 395 |
\rot@pageref{RF\ther@tfl@t}{\R@@page}% |
| 396 |
\edef\@tempa{Adding sideways \@captype\space on page \R@@page\space} |
| 397 |
\rot@mess@toks\expandafter{\@tempa} |
| 398 |
\wd\rot@float@box\z@ |
| 399 |
\ht\rot@float@box\z@ |
| 400 |
\dp\rot@float@box\z@ |
| 401 |
\vbox to \textheight{% |
| 402 |
% \end{macrocode} |
| 403 |
% We need to know for sure which direction rotation is going to |
| 404 |
% be in, so locally reset the graphics units. |
| 405 |
% \begin{macrocode} |
| 406 |
\setkeys{Grot}{units=360}% |
| 407 |
\if@rot@twoside |
| 408 |
\else |
| 409 |
\let\R@@page\rot@LR |
| 410 |
\fi |
| 411 |
\ifthenelse{\isodd{\R@@page}}{% |
| 412 |
\if@rot@twoside |
| 413 |
\rot@mess@toks\expandafter{\the\rot@mess@toks (right hand page)}% |
| 414 |
\fi |
| 415 |
\vfill |
| 416 |
\@@line{% |
| 417 |
\hskip\rotFPtop |
| 418 |
\rotatebox{90}{\box\rot@float@box}% |
| 419 |
\hskip\rotFPbot |
| 420 |
}% |
| 421 |
}{% |
| 422 |
\if@rot@twoside |
| 423 |
\rot@mess@toks\expandafter{\the\rot@mess@toks (left hand page)}% |
| 424 |
\fi |
| 425 |
\@@line{% |
| 426 |
\hskip\rotFPbot |
| 427 |
\rotatebox{-90}{\box\rot@float@box}% |
| 428 |
\hskip\rotFPtop |
| 429 |
}% |
| 430 |
\vfill |
| 431 |
}% |
| 432 |
\rot@message{\the\rot@mess@toks} |
| 433 |
}% |
| 434 |
\end@float |
| 435 |
} |
| 436 |
% \end{macrocode} |
| 437 |
% \end{macro} |
| 438 |
% |
| 439 |
% \begin{macro}{\sidewaysfigure} |
| 440 |
% \begin{macro}{\endsidewaysfigure} |
| 441 |
% \begin{macro}{\sidewaystable} |
| 442 |
% \begin{macro}{\endsidewaystable} |
| 443 |
% The following definitions set up two environments, |
| 444 |
% \texttt{sidewaystable} and \texttt{sidewaysfigure}, which uses this |
| 445 |
% type of float. Naturally, users may need to change these to suit |
| 446 |
% their local style. Both contribute to the normal lists of figures |
| 447 |
% and tables. |
| 448 |
% \begin{macrocode} |
| 449 |
\def\sidewaysfigure{\@rotfloat{figure}} |
| 450 |
% |
| 451 |
\let\endsidewaysfigure\end@rotfloat |
| 452 |
% |
| 453 |
\def\sidewaystable{\@rotfloat{table}} |
| 454 |
\let\endsidewaystable\end@rotfloat |
| 455 |
% \end{macrocode} |
| 456 |
% \end{macro} |
| 457 |
% \end{macro} |
| 458 |
% \end{macro} |
| 459 |
% \end{macro} |
| 460 |
% |
| 461 |
% \begin{macro}{\@rotdblfloat} |
| 462 |
% \begin{macro}{\end@rotdblfloat} |
| 463 |
% Handling double column floats |
| 464 |
% \begin{macrocode} |
| 465 |
\def\@rotdblfloat{% |
| 466 |
\if@twocolumn\expandafter\@rotdbflt\else\expandafter\@rotfloat\fi |
| 467 |
} |
| 468 |
\def\@rotdbflt#1{\@ifnextchar[{\@rotxdblfloat{#1}}{\@rotxdblfloat{#1}[tp]}} |
| 469 |
\def\@rotxdblfloat#1[#2]{% |
| 470 |
\@float{#1}[#2]% |
| 471 |
\hsize\textwidth\linewidth\textwidth |
| 472 |
\begin{lrbox}\rot@float@box |
| 473 |
\begin{minipage}\textheight |
| 474 |
} |
| 475 |
\def\end@rotdblfloat{% |
| 476 |
% \end{macrocode} |
| 477 |
% If we are going to know whether pages are odd or even, |
| 478 |
% we need to use the \cs{pageref} mechanism, and labels. But |
| 479 |
% Labels won't work \emph{unless} the user has put in a |
| 480 |
% caption. Beware! |
| 481 |
% \begin{macrocode} |
| 482 |
\end{minipage}\end{lrbox}% |
| 483 |
\stepcounter{r@tfl@t}% |
| 484 |
\rot@label{RF\ther@tfl@t}% |
| 485 |
\rot@pageref{RF\ther@tfl@t}{\R@@page}% |
| 486 |
\edef\@tempa{Adding sideways \@captype\space on page \R@@page\space} |
| 487 |
\rot@mess@toks\expandafter{\@tempa} |
| 488 |
\@tempdima\ht\rot@float@box |
| 489 |
\advance\@tempdima by \dp\rot@float@box |
| 490 |
% \ifrot@messages |
| 491 |
% \rot@message{BOX wd: \the\wd\rot@float@box, |
| 492 |
% ht: \the\ht\rot@float@box, dp: \the\dp\rot@float@box: |
| 493 |
% so shift by .5 of \the\@tempdima}% |
| 494 |
% \fi |
| 495 |
\wd\rot@float@box\z@ |
| 496 |
\ht\rot@float@box\z@ |
| 497 |
\dp\rot@float@box\z@ |
| 498 |
\vbox to \textheight{% |
| 499 |
% \end{macrocode} |
| 500 |
% We need to know for sure which direction rotation is going to |
| 501 |
% be in, so locally reset the graphics units. |
| 502 |
% \begin{macrocode} |
| 503 |
\setkeys{Grot}{units=360}% |
| 504 |
\if@rot@twoside |
| 505 |
\else |
| 506 |
\let\R@@page\rot@LR |
| 507 |
\fi |
| 508 |
\ifthenelse{\isodd{\R@@page}}{% |
| 509 |
\ifrot@messages |
| 510 |
\if@rot@twoside |
| 511 |
\rot@mess@toks\expandafter{\the\rot@mess@toks (right hand page)}% |
| 512 |
\fi |
| 513 |
\fi |
| 514 |
\vfill |
| 515 |
\@@line{% |
| 516 |
\hskip\rotFPtop |
| 517 |
\rotatebox{90}{\box\rot@float@box}% |
| 518 |
\hskip\rotFPbot |
| 519 |
}% |
| 520 |
}{% |
| 521 |
\ifrot@messages |
| 522 |
\if@rot@twoside |
| 523 |
\rot@mess@toks\expandafter{\the\rot@mess@toks (left hand page)}% |
| 524 |
\fi |
| 525 |
\fi% |
| 526 |
\@@line{% |
| 527 |
\hskip\rotFPbot |
| 528 |
\rotatebox{-90}{\box\rot@float@box}% |
| 529 |
\hskip\rotFPtop |
| 530 |
}% |
| 531 |
\vfill |
| 532 |
}% |
| 533 |
\rot@message{\the\rot@mess@toks}% |
| 534 |
}% |
| 535 |
\end@dblfloat |
| 536 |
} |
| 537 |
% \end{macrocode} |
| 538 |
% \end{macro} |
| 539 |
% \end{macro} |
| 540 |
% |
| 541 |
% \begin{environment}{sidewaysfigure*} |
| 542 |
% \begin{environment}{sidewaystable*} |
| 543 |
% \begin{macrocode} |
| 544 |
\newenvironment{sidewaystable*} |
| 545 |
{\@rotdblfloat{table}} |
| 546 |
{\end@rotdblfloat} |
| 547 |
\newenvironment{sidewaysfigure*} |
| 548 |
{\@rotdblfloat{figure}} |
| 549 |
{\end@rotdblfloat} |
| 550 |
|
| 551 |
% \end{macrocode} |
| 552 |
% \end{environment} |
| 553 |
% \end{environment} |
| 554 |
% |
| 555 |
% \begin{macro}{\rot@label} |
| 556 |
% \begin{macro}{\rot@thepage} |
| 557 |
% \begin{macro}{\rot@pageref} |
| 558 |
% \begin{macro}{\rot@protected@write} |
| 559 |
% \begin{macro}{\if@rot@refundefined} |
| 560 |
% Note that we used \cs{rot@label}, not \cs{label}; this |
| 561 |
% variant writes (just) the \emph{true} page number, not the |
| 562 |
% value of \cs{thepage}; this ``true'' value then needs special |
| 563 |
% treatment in \cs{protected@write}, just as |
| 564 |
% \cs{thepage} already has. |
| 565 |
% \cs{rot@pageref}\marg{generated label name}\marg{cs to set to |
| 566 |
% pageno} then returns the labelled page's number (or 0 if label not |
| 567 |
% yet defined). If label not defined, flags using |
| 568 |
% \cs{rot@refundefinedtrue} for end-document to pick up. (later...) |
| 569 |
% \begin{macrocode} |
| 570 |
\def\rot@thepage{\@arabic\c@page} |
| 571 |
\def\rot@label#1{\@bsphack |
| 572 |
\rot@protected@write{\@auxout}{}% |
| 573 |
{\string\newlabel{#1}{\rot@thepage}}% |
| 574 |
\@esphack} |
| 575 |
\def\rot@pageref#1#2{% |
| 576 |
\expandafter\ifx\csname r@#1\endcsname\relax |
| 577 |
\global\@rot@refundefinedtrue |
| 578 |
\def#2{0}% |
| 579 |
\else |
| 580 |
\edef#2{\csname r@#1\endcsname}% |
| 581 |
\fi |
| 582 |
} |
| 583 |
\long\def\rot@protected@write#1#2#3{% |
| 584 |
\begingroup |
| 585 |
\let\rot@thepage\relax |
| 586 |
#2% |
| 587 |
\let\protect\@unexpandable@protect |
| 588 |
\edef\reserved@a{\write#1{#3}}% |
| 589 |
\reserved@a |
| 590 |
\endgroup |
| 591 |
\if@nobreak\ifvmode\nobreak\fi\fi |
| 592 |
} |
| 593 |
\newif\if@rot@refundefined |
| 594 |
\global\@rot@refundefinedfalse |
| 595 |
% \end{macrocode} |
| 596 |
% \end{macro} |
| 597 |
% \end{macro} |
| 598 |
% \end{macro} |
| 599 |
% \end{macro} |
| 600 |
% \end{macro} |
| 601 |
% |
| 602 |
% \begin{macro}{\rot@mess@toks} |
| 603 |
% A token register to build up debugging messages |
| 604 |
% \begin{macrocode} |
| 605 |
\newtoks\rot@mess@toks |
| 606 |
% \end{macrocode} |
| 607 |
% \end{macro} |
| 608 |
% |
| 609 |
% \subsection{Rotated captions only} |
| 610 |
% |
| 611 |
% \begin{macro}{\rotcaption} |
| 612 |
% \begin{macro}{\@makerotcaption} |
| 613 |
% Sometimes you may find that the rotation of complete figures does |
| 614 |
% not give quite the right result, since they always take up the whole |
| 615 |
% page. You may prefer to rotate the caption and the float contents |
| 616 |
% separately within a conventional figure. Here we offer a suggestion |
| 617 |
% for a \cs{rotcaption} command, which inserts the caption rotated |
| 618 |
% by 90 degrees. It is essentially a copy of the normal captioning |
| 619 |
% code. |
| 620 |
% Packages which define the \cs{@makecaption} command may also need |
| 621 |
% to define \cs{@makerotcaption}. |
| 622 |
% \begin{macrocode} |
| 623 |
\def\rotcaption{\refstepcounter\@captype\@dblarg{\@rotcaption\@captype}} |
| 624 |
\long\def\@rotcaption#1[#2]#3{% |
| 625 |
\addcontentsline{\csname ext@#1\endcsname}{#1}{% |
| 626 |
\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}% |
| 627 |
\par |
| 628 |
\begingroup |
| 629 |
\@parboxrestore |
| 630 |
\normalsize |
| 631 |
\@makerotcaption{\csname fnum@#1\endcsname}{#3}% |
| 632 |
\endgroup} |
| 633 |
\long\def\@makerotcaption#1#2{% |
| 634 |
\setbox\@tempboxa\color@hbox#1: #2\color@endbox |
| 635 |
\ifdim \wd\@tempboxa > .8\vsize |
| 636 |
\rotatebox{90}{% |
| 637 |
\begin{minipage}{.8\textheight}#1: #2\end{minipage}% |
| 638 |
}% |
| 639 |
\else% |
| 640 |
\rotatebox{90}{\box\@tempboxa}% |
| 641 |
\fi |
| 642 |
\nobreak |
| 643 |
\hspace{12pt}% |
| 644 |
} |
| 645 |
%</package> |
| 646 |
% \end{macrocode} |
| 647 |
% \end{macro} |
| 648 |
% \end{macro} |
| 649 |
% |
| 650 |
% \section{Last-minute infrastructure} |
| 651 |
% |
| 652 |
% \begin{macro}{\color@hbox} |
| 653 |
% \begin{macro}{\color@endbox} |
| 654 |
% These macros aren't provided in \LaTeX{}, by default (I seem to have |
| 655 |
% assumed that they were\dots) |
| 656 |
% \begin{macrocode} |
| 657 |
\AtBeginDocument{% |
| 658 |
\providecommand\color@hbox{\hbox\bgroup}% |
| 659 |
\providecommand\color@vbox{\vbox\bgroup}% |
| 660 |
\providecommand\color@endbox{\egroup}% |
| 661 |
} |
| 662 |
% \end{macrocode} |
| 663 |
% \end{macro} |
| 664 |
% \end{macro} |
| 665 |
% |
| 666 |
% \section{History} |
| 667 |
% |
| 668 |
% Version 2.0 is a complete re-write, with most of the work now |
| 669 |
% being done by the \LaTeXe\ graphics package. |
| 670 |
% |
| 671 |
% Version 2.1 provides a `clockwise' option to reinstate the behaviour |
| 672 |
% described in the `\LaTeX\ Companion' |
| 673 |
% |
| 674 |
% Version 2.2 just intercepts the standard float macros instead |
| 675 |
% of copying and changing the. The `twoside' option is obeyed. |
| 676 |
% |
| 677 |
% Version 2.5 corrects problems in sideways figures. |
| 678 |
% |
| 679 |
% Version 2.6 is a rewrite of the sideways floats via Frank Mittelbach |
| 680 |
% (to whom many thanks for looking at the mangy code). |
| 681 |
% |
| 682 |
% Version 2.7 is checked for \LaTeX\ of December 94, and adds the option |
| 683 |
% of twoside behaviour independent of the general twoside. |
| 684 |
% |
| 685 |
% Version 2.8 cleans up some mistakes pointed out by Harald Axel |
| 686 |
% Sommerfeldt. |
| 687 |
% |
| 688 |
% Version 2.9 cleans up some (more) mistakes pointed out by Harald |
| 689 |
% Axel Sommerfeldt. |
| 690 |
% |
| 691 |
% Version 2.13a permits positioning of rotated floats in the same way |
| 692 |
% as they are positioned in `normal' floats. |
| 693 |
% |
| 694 |
% Version 2.14 is the first to be published anywhere as the outcome of |
| 695 |
% maintenance by Robin Fairbairns. |
| 696 |
% |
| 697 |
% Version 2.15 deals with page-numbering bug for auto-float-rotation, |
| 698 |
% and tidying of messages; published to ctan |
| 699 |
% |
| 700 |
% Version 2.16 uses colour boxes as necessary; published to ctan. |
| 701 |
% Version 2.16a provides the colour box commands \cs{AtBeginDocument}. |
| 702 |
% |
| 703 |
% \Finale |
| 704 |
\endinput |
| 705 |
% |