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