summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/isorot/isorot.sty
blob: 0b66d11a91029a0debf4af6e4180ebbfde12e2de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
%%
%% This is file `isorot.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% isorot.dtx  (with options: `rot')
%% 
%%     This program has been partly developed under US government
%%  funding and is not subject to copyright.
%% 
%%     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
%% 
\ProvidesPackage{isorot}[2000/02/15 v2.1 ISO rotation package]
\newcount\PWRFc@tracing
\DeclareOption{errorshow}{\PWRFc@tracing\z@}
\DeclareOption{debugshow}{\PWRFc@tracing5\relax}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{graphics}}
\ProcessOptions
\newcommand\PWRF@trace[2]{%
  \ifnum\PWRFc@tracing>#1\relax
    \GenericWarning
      {(isorot)\@spaces\@spaces}
      {Package isorot: #2}%
  \fi
}
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{graphicx}
\RequirePackage{lscape}
\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}
\newif\if@rot@twoside
\def\Grot@setnegangle#1{%
  \dimen@#1\p@
  \dimen@-\dimen@
  \edef\Grot@angle{\strip@pt\dimen@}}
\newif\ifcl@ckwise
\newcommand{\figuresleft}{%
  \@rot@twosidefalse
  \def\rot@LR{0}%
}
\newcommand{\figuresright}{%
  \@rot@twosidefalse
  \def\rot@LR{-1}%
}
\newcommand{\clockwise}{%
  \cl@ckwisetrue
}
\newcommand{\counterclockwise}{%
  \cl@ckwisefalse
}
\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}
\newcounter{r@tfl@t}
\setcounter{r@tfl@t}{0}
\if@twoside
  \@rot@twosidetrue
\else
  \@rot@twosidefalse
\fi
\newcommand{\rotatedirection}[1]{%
  \def\@tempa{#1}\def\@tempb{clockwise}%
  \ifx\@temp\@tempb
    \cl@ckwisetrue
  \else
    \cl@ckwisefalse
  \fi}
\clockwise
\figuresright
\def\sideways{%
  \Grot@setangle{90}%
  \setbox\z@\hbox\bgroup\ignorespaces}
\def\endsideways{%
  \unskip\egroup
  \Grot@x\z@
  \Grot@y\z@
  \Grot@box
}
\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
}
\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
}
\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
}
\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]%
  \begin{lrbox}\rot@float@box
  \begin{minipage}\textheight
}
\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
}
\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
}
\@ifundefined{@initisofig}{%
  \newcommand{\@initisofig}{}
  \newcommand{\@initisotab}{}
  \newif\ifinfloat
  \newcommand{\rotcapfont}{}}{\newcommand{\rotcapfont}{\captionsize\bf}}
\def\sidewaysfigure{%
  \@initisofig
  \@rotfloat{figure}}
\def\endsidewaysfigure{\end@rotfloat\infloatfalse}
\def\sidewaystable{%
  \@initisotab
  \@rotfloat{table}}
\def\endsidewaystable{\end@rotfloat\infloatfalse}
\newenvironment{sidewaysfigure*}{%
  \@initisofig
  \@rotdblfloat{figure}}{%
  \end@rotdblfloat\infloatfalse}
\newenvironment{sidewaystable*}{%
  \@initisotab
  \@rotdblfloat{table}}{%
  \end@rotdblfloat\infloatfalse}
\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}
\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}
}
\newcommand{\controtcaption}{\@controtcaption\@captype}
\long\def\@controtcaption#1#2{%
  \begingroup
    \@parboxrestore
    \normalsize
    \@makerotcaption{\csname fnum@#1\endcsname}{\ignorespaces #2}\par
  \endgroup}
\endinput
%%
%% End of file `isorot.sty'.