source: trunk/VUT/doc/SciReport/rotating.sty @ 243

Revision 243, 5.5 KB checked in by bittner, 19 years ago (diff)

SciReport? template

Line 
1%%
2%% This is file `rotating.sty',
3%% generated with the docstrip utility.
4%%
5%% The original source files were:
6%%
7%% rotating.dtx  (with options: `package')
8%% Copyright (C) 1994 Sebastian Rahtz and Leonor Barroca. All
9%% rights reserved.  Permission is granted to to customize the
10%% declarations in this file to serve the needs of your installation.
11%% However, no permission is granted to distribute a modified version of
12%% this file under its original name.
13%%
14\def\RInfo{1997/09/26, v2.13}
15%% File: rotating.dtx Copyright (C) 1995--1999
16\ProvidesPackage{rotating}[\RInfo\space Rotation package]
17\NeedsTeXFormat{LaTeX2e}
18\newif\if@rot@twoside
19\DeclareOption{clockwise}{% this is for compatibility
20 \AtBeginDocument{\setkeys{Grot}{units=360}}%
21}
22\DeclareOption{counterclockwise}{%
23 \AtBeginDocument{\setkeys{Grot}{units=-360}}%
24}
25\DeclareOption{figuresleft}{%
26  \@rot@twosidefalse
27  \def\rot@LR{0}%
28}
29\DeclareOption{figuresright}{%
30 \@rot@twosidefalse
31 \def\rot@LR{-1}%
32}
33\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{graphics}}
34\ExecuteOptions{clockwise}
35\if@twoside
36  \@rot@twosidetrue
37\else
38  \@rot@twosidefalse
39\fi
40\def\rot@LR{-1}
41\ProcessOptions
42\RequirePackage{graphicx}
43\RequirePackage{ifthen}
44\def\rotdriver#1{\makeatletter\input{#1.def}\makeatother}
45\newcounter{r@tfl@t}
46\setcounter{r@tfl@t}{0}
47\def\sideways{%
48  \Grot@setangle{90}%
49  \setbox\z@\hbox\bgroup\ignorespaces}
50\def\endsideways{%
51  \unskip\egroup
52  \Grot@x\z@
53  \Grot@y\z@
54  \Grot@box
55}
56\def\turn#1{%
57  \Grot@setangle{#1}%
58  \setbox\z@\hbox\bgroup\ignorespaces}
59\def\endturn{%
60  \unskip\egroup
61  \Grot@x\z@
62  \Grot@y\z@
63  \Grot@box
64}
65\def\rotate#1{%
66  \Grot@setangle{#1}%
67  \setbox\z@\hbox\bgroup\ignorespaces}
68\def\endrotate{%
69  \unskip\egroup
70  \Grot@x\z@
71  \Grot@y\z@
72  \wd0\z@\dp0\z@\ht0\z@
73  \Grot@box
74}
75\def\turnbox#1#2{%
76  \Grot@setangle{#1}%
77  \setbox\z@\hbox{{#2}}%
78  \Grot@x\z@\Grot@y\z@
79  \wd0\z@\dp0\z@\ht0\z@
80  \Grot@box
81}
82\newsavebox\rot@float@box
83\def\@rotfloat#1{%
84  \@ifnextchar[%
85    {\@xrotfloat{#1}}%
86    {\edef\@tempa{\noexpand\@xrotfloat{#1}[\csname fps@#1\endcsname]}\@tempa}%
87}
88\def\@xrotfloat#1[#2]{%
89  \@float{#1}[#2]%
90  \begin{lrbox}\rot@float@box
91  \begin{minipage}\textheight
92 }
93\def\end@rotfloat{%
94   \end{minipage}\end{lrbox}%
95   \global\addtocounter{r@tfl@t}{1}%
96   \rot@label{RF\ther@tfl@t}%
97   \message{Adding sideways figure on }%
98   \def\R@@page{\pageref{RF\ther@tfl@t}}%
99   \wd\rot@float@box\z@
100   \ht\rot@float@box\z@
101   \dp\rot@float@box\z@
102   \vbox to \textheight{%
103    \setkeys{Grot}{units=360}%
104    \if@rot@twoside
105      \def\R@@page{\pageref{RF\ther@tfl@t}}%
106    \else
107      \let\R@@page\rot@LR
108    \fi
109    \ifthenelse{\isodd{\R@@page}}{%
110    \message{right hand page}%
111    \vfill
112    \centerline{\rotatebox{90}{\box\rot@float@box}}%
113         }{%
114    \message{left hand page}%
115    \centerline{\rotatebox{-90}{\box\rot@float@box}}%
116     \vfill
117         }%
118 }%
119   \end@float
120}
121\def\sidewaysfigure{\@rotfloat{figure}}
122\let\endsidewaysfigure\end@rotfloat
123\def\sidewaystable{\@rotfloat{table}}
124\let\endsidewaystable\end@rotfloat
125\def\@rotdblfloat{%
126  \if@twocolumn\let\reserved@a\@rotdbflt\else\let\reserved@a\@rotfloat\fi
127  \reserved@a}
128\def\@rotdbflt#1{\@ifnextchar[{\@rotxdblfloat{#1}}{\@rotxdblfloat{#1}[tp]}}
129\def\@rotxdblfloat#1[#2]{%
130  \hsize\textwidth\linewidth\textwidth
131  \@float{#1}[#2]%
132  \begin{lrbox}\rot@float@box
133  \begin{minipage}\textheight
134}
135\def\end@rotdblfloat{%
136   \end{minipage}\end{lrbox}%
137   \global\addtocounter{r@tfl@t}{1}%
138   \rot@label{RF\ther@tfl@t}%
139   \message{Adding sideways figure on }%
140   \def\R@@page{\pageref{RF\ther@tfl@t}}%
141   \@tempdima\ht\rot@float@box
142   \advance\@tempdima by \dp\rot@float@box
143\typeout{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}%
144   \wd\rot@float@box\z@
145   \ht\rot@float@box\z@
146   \dp\rot@float@box\z@
147   \vbox to \textheight{%
148    \setkeys{Grot}{units=360}%
149    \if@rot@twoside
150      \def\R@@page{\pageref{RF\ther@tfl@t}}%
151    \else
152      \let\R@@page\rot@LR
153    \fi
154    \ifthenelse{\isodd{\R@@page}}{%
155    \message{right hand page}%
156    \vfill
157    \hbox to\textwidth{\hfill\rotatebox{90}{\box\rot@float@box}\hfill}%
158         }{%
159    \message{left hand page}%
160    \hbox to \textwidth{\hfill\rotatebox{-90}{\box\rot@float@box}\hfill}%
161     \vfill
162         }%
163 }%
164   \end@dblfloat
165}
166\newenvironment{sidewaystable*}
167               {\@rotdblfloat{table}}
168               {\end@rotdblfloat}
169\newenvironment{sidewaysfigure*}
170               {\@rotdblfloat{figure}}
171               {\end@rotdblfloat}
172
173\long\def \r@protected@write#1#2#3{%
174      \begingroup
175       \let\therpage\relax
176       #2%
177       \let\protect\@unexpandable@protect
178       \edef\reserved@a{\write#1{#3}}%
179       \reserved@a
180      \endgroup
181      \if@nobreak\ifvmode\nobreak\fi\fi
182}
183\def\therpage{\arabic{page}}
184\def\rot@label#1{\@bsphack
185  \r@protected@write\@auxout{}%
186         {\string\newlabel{#1}{{\@currentlabel}{\therpage}}}%
187  \@esphack}
188\def\rotcaption{\refstepcounter\@captype\@dblarg{\@rotcaption\@captype}}
189\long\def\@rotcaption#1[#2]#3{%
190\addcontentsline{\csname ext@#1\endcsname}{#1}{%
191 \protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
192  \par
193  \begingroup
194    \@parboxrestore
195    \normalsize
196    \@makerotcaption{\csname fnum@#1\endcsname}{#3}%
197  \endgroup}
198\long\def\@makerotcaption#1#2{%
199 \setbox\@tempboxa\hbox{#1: #2}%
200 \ifdim \wd\@tempboxa > .8\vsize
201    \rotatebox{90}{%
202    \begin{minipage}{.8\textheight}#1: #2\end{minipage}%
203    }\par
204 \else%
205    \rotatebox{90}{\box\@tempboxa}%
206 \fi
207 \hspace{12pt}%
208}
209\endinput
210%%
211%% End of file `rotating.sty'.
Note: See TracBrowser for help on using the repository browser.