| 1 |
%% $Id: movie.cls,v 3.7 2011/03/14 20:14:00 krisrose Exp $ -*-latex-*- |
| 2 |
%% |
| 3 |
%% ``LaTeX Movie'' document class for DVI animations. |
| 4 |
%% Copyright (c) 1994-1997 Kristoffer H. Rose <[email protected]> |
| 5 |
%% |
| 6 |
%% This file is part of the Xy-pic package for graphs and diagrams in TeX. |
| 7 |
%% Copyright (c) 1991-2011 Kristoffer H. Rose <[email protected]> |
| 8 |
%% |
| 9 |
%% The Xy-pic package is free software; you can redistribute it and/or modify |
| 10 |
%% it under the terms of the GNU General Public License as published by the |
| 11 |
%% Free Software Foundation; either version 2 of the License, or (at your |
| 12 |
%% option) any later version. |
| 13 |
%% |
| 14 |
%% The Xy-pic package is distributed in the hope that it will be useful, but |
| 15 |
%% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 16 |
%% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 17 |
%% for more details. |
| 18 |
%% |
| 19 |
%% You should have received a copy of the GNU General Public License along |
| 20 |
%% with this package; if not, see http://www.gnu.org/licenses/. |
| 21 |
%% |
| 22 |
\ifx\xyloaded\undefined \input xy \fi |
| 23 |
|
| 24 |
\NeedsTeXFormat{LaTeX2e} |
| 25 |
|
| 26 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 27 |
% Version. |
| 28 |
|
| 29 |
\def\next$#1: #2 #3${#2} |
| 30 |
\edef\next{\noexpand\ProvidesClass{movie}% |
| 31 |
[\next$Date: 2011/03/14 20:14:00 $ |
| 32 |
Movies in LaTeX v.\next$Revision: 3.7 $.]}\next |
| 33 |
|
| 34 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 35 |
% Options. |
| 36 |
|
| 37 |
% nocaption (omit caption at lower left; default) |
| 38 |
% caption (include caption) |
| 39 |
\newif\ifm@caption |
| 40 |
\DeclareOption{nocaption}{\m@captionfalse} |
| 41 |
\DeclareOption{caption}{\m@captiontrue} |
| 42 |
|
| 43 |
% nocount (omit count at lower left; default) |
| 44 |
% count (include count) |
| 45 |
\newif\ifm@count |
| 46 |
\DeclareOption{nocount}{\m@countfalse} |
| 47 |
\DeclareOption{count}{\m@counttrue} |
| 48 |
|
| 49 |
% notime (omit elapsed time in "seconds"; default) |
| 50 |
% time (include elapsed time) |
| 51 |
\newif\ifm@time |
| 52 |
\DeclareOption{notime}{\m@timefalse} |
| 53 |
\DeclareOption{time}{\m@timetrue} |
| 54 |
|
| 55 |
% loop (make the animation loop; default) |
| 56 |
% once (don't loop) |
| 57 |
\def\loop@@{-ns2} |
| 58 |
\DeclareOption{loop}{\def\loop@@{-ns2}} |
| 59 |
\DeclareOption{once}{\def\loop@@{-once}} |
| 60 |
|
| 61 |
% Paper size (ignored since result is never printed). |
| 62 |
\DeclareOption{a4paper}{} |
| 63 |
\DeclareOption{a5paper}{} |
| 64 |
\DeclareOption{b5paper}{} |
| 65 |
\DeclareOption{letterpaper}{} |
| 66 |
\DeclareOption{legalpaper}{} |
| 67 |
\DeclareOption{executivepaper}{} |
| 68 |
\DeclareOption{landscape}{} |
| 69 |
|
| 70 |
%\vsize=9in \voffset=0in |
| 71 |
%\hsize=7in \hoffset=0in % safe? :) |
| 72 |
|
| 73 |
\newdimen\textheight \textheight=\vsize |
| 74 |
\newdimen\textwidth \textwidth=\hsize |
| 75 |
|
| 76 |
% Font size. |
| 77 |
\renewcommand\normalsize{\fontsize{10}{12}\selectfont} |
| 78 |
\DeclareOption{10pt}{\renewcommand\normalsize{\fontsize{10}{12}\selectfont}} |
| 79 |
\DeclareOption{11pt}{\renewcommand\normalsize{\fontsize{11}{13}\selectfont}} |
| 80 |
\DeclareOption{12pt}{\renewcommand\normalsize{\fontsize{12}{14}\selectfont}} |
| 81 |
|
| 82 |
% Driver (passed on to packages). |
| 83 |
\DeclareOption{cmactex}{\OptionNotUsed} |
| 84 |
\DeclareOption{dvips}{\OptionNotUsed} |
| 85 |
\DeclareOption{dvitops}{\OptionNotUsed} |
| 86 |
\DeclareOption{emtex}{\OptionNotUsed} |
| 87 |
\DeclareOption{ln}{\OptionNotUsed} |
| 88 |
\DeclareOption{oztex}{\OptionNotUsed} |
| 89 |
\DeclareOption{textures}{\OptionNotUsed} |
| 90 |
\DeclareOption{xdvi}{\OptionNotUsed} |
| 91 |
|
| 92 |
% ...remaining options are numeric assignments... |
| 93 |
\def\m@keys{} |
| 94 |
\def\add@m@keys#1{\expandafter\def\expandafter\m@keys\expandafter{\m@keys,#1}} |
| 95 |
\DeclareOption*{\expandafter\add@m@keys\expandafter{\CurrentOption}} |
| 96 |
|
| 97 |
\ProcessOptions* |
| 98 |
|
| 99 |
\LoadClass{article} |
| 100 |
\pagestyle{empty} |
| 101 |
|
| 102 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 103 |
% Dependencies. |
| 104 |
|
| 105 |
\RequirePackage{keyval} % key=value pair support |
| 106 |
\input xy % Xy-pic kernel (not package to prevent clash) |
| 107 |
|
| 108 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 109 |
% Parameters (set via options or the setup). |
| 110 |
|
| 111 |
% pixel=<dimen> (makes \pixels{<number>} a valid <dimen>; default: 1in/300) |
| 112 |
% dpi=<number> (dots per inch ~ pixel=1in/number) |
| 113 |
\newdimen\m@pixel \m@pixel=0.0033333333in |
| 114 |
\define@key{movie}{pixel}{\m@pixel=#1\relax} |
| 115 |
\define@key{movie}{dpi}{\m@pixel=1in \divide \m@pixel by #1\relax} |
| 116 |
|
| 117 |
% height=<dimen> |
| 118 |
% width=<dimen> |
| 119 |
\newdimen\m@height \m@height=2in |
| 120 |
\newdimen\m@width \m@width=2in |
| 121 |
\define@key{movie}{height}{\m@height=#1\relax} |
| 122 |
\define@key{movie}{width}{\m@width=#1\relax} |
| 123 |
|
| 124 |
% tick=<fraction> (set the duration of each frame to <fraction> seconds) |
| 125 |
% fps=<number> (frames per second ~ tick=1/number) |
| 126 |
\newdimen\m@tick \m@tick=0.083333333pt |
| 127 |
\define@key{movie}{tick}{\m@tick=#1pt\relax} |
| 128 |
\define@key{movie}{fps}{\m@tick=1pt \divide \m@tick by #1\relax} |
| 129 |
|
| 130 |
\def\next#1{\setkeys{movie}{#1}} |
| 131 |
\expandafter\next\expandafter{\m@keys} |
| 132 |
\let\m@keys=\undefined |
| 133 |
|
| 134 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 135 |
% Setting parameters explicitly... |
| 136 |
|
| 137 |
\def\MovieSetup#1{\setkeys{movie}{#1}} |
| 138 |
|
| 139 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 140 |
% Internals. |
| 141 |
|
| 142 |
\def\m@caption{} |
| 143 |
|
| 144 |
\countdef\m@scene=1 % count1 = scene# |
| 145 |
\countdef\m@frame=2 % count2 = frame# (in scene) |
| 146 |
|
| 147 |
\font\fiverm=cmr5 % safe small font |
| 148 |
|
| 149 |
\newdimen\m@total \m@total=0pt % total elapsed time |
| 150 |
|
| 151 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 152 |
% User accessible progress macros: |
| 153 |
|
| 154 |
\def\theFrame{0} |
| 155 |
\def\theScene{0} |
| 156 |
|
| 157 |
\def\theF{0} |
| 158 |
\def\theFr{1} |
| 159 |
|
| 160 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 161 |
% User command: \scene [<fraction>] {...} |
| 162 |
% |
| 163 |
% Produce scene of <fraction> seconds (default: 1.0) with each frame produced |
| 164 |
% by ... centered in vertical mode. |
| 165 |
|
| 166 |
\newif\iflastframe@ |
| 167 |
\newdimen\m@length % duration of scene |
| 168 |
\newdimen\m@init % start of zoom |
| 169 |
|
| 170 |
\newcommand\scene{% |
| 171 |
\@ifnextchar*{\lastframe@true \DN@*{\scene@i}\next@}% |
| 172 |
{\lastframe@false \scene@i}} |
| 173 |
|
| 174 |
\newcommand\scene@i[1][1]{\scene@ii{#1}} |
| 175 |
|
| 176 |
\def\setm@caption#1{\xdef\m@caption{#1}} |
| 177 |
|
| 178 |
\long\def\scene@ii#1#2{{% |
| 179 |
\let\caption=\setm@caption |
| 180 |
\global\advance\m@scene\@ne \edef\theScene{\the\m@scene}% |
| 181 |
\global\m@frame=\z@ \m@length=#1pt \m@init=\z@ |
| 182 |
\loop |
| 183 |
\dimen@=\m@frame\m@tick |
| 184 |
\ifdim\dimen@<\m@length |
| 185 |
\scene@frame{#2}% |
| 186 |
\repeat |
| 187 |
\iflastframe@ \scene@frame{#2}\fi |
| 188 |
\dimen@=#1pt \advance\dimen@ by -\m@frame\m@tick |
| 189 |
\ifdim.1\m@tick<\ifdim\dimen@<\z@-\fi\dimen@ |
| 190 |
\dimen@=\m@frame\m@tick |
| 191 |
\@warning{scene \the\m@scene\space rounded from #1 to |
| 192 |
\expandafter\unPT@\the\dimen@\space seconds}% |
| 193 |
\fi}\ignorespaces} |
| 194 |
|
| 195 |
\def\scene@frame#1{\frame@compute |
| 196 |
\null |
| 197 |
\vfill |
| 198 |
\hrule width\m@width |
| 199 |
\hbox to\m@width{\hss |
| 200 |
\vbox to\m@height{\hsize=\m@width \null\vfil{#1}\vfil\null}% |
| 201 |
\hss}% |
| 202 |
\setbox0=\hbox{% |
| 203 |
\setbox0=\hbox to\m@width{\hss\fiverm\strut |
| 204 |
\ifm@caption \m@caption \fi |
| 205 |
\ifm@time \quad \m@nicetotal s \fi |
| 206 |
\ifm@count \quad \the\m@scene.% |
| 207 |
\ifnum\m@frame<100 0\ifnum\m@frame<10 0\fi\fi\the\m@frame\fi}% |
| 208 |
\dimen0=\dp0 \ht0=0pt \dp0=0pt \raise\dimen0\box0}% |
| 209 |
\ht0=0pt \dp0=0pt \box0\relax |
| 210 |
\hrule width\m@width |
| 211 |
\global\advance\m@frame\@ne |
| 212 |
\global\advance\m@total\m@tick |
| 213 |
\eject} |
| 214 |
|
| 215 |
\def\frame@compute{% |
| 216 |
\edef\theFrame{\the\m@frame}% |
| 217 |
\dimen@=\m@frame\m@tick \advance\dimen@-\m@init |
| 218 |
\ifdim\dimen@<\z@ \dimen@=\z@ \fi |
| 219 |
\ifdim\dimen@>\m@length \dimen@=\m@length \fi |
| 220 |
\quotient@\theF\dimen@\m@length |
| 221 |
\dimen@=-\dimen@ \advance\dimen@\m@length |
| 222 |
\quotient@\theFr\dimen@\m@length} |
| 223 |
|
| 224 |
\def\m@nicetotal{% |
| 225 |
\edef\tmp{\expandafter\removePT@\the\m@total}% |
| 226 |
\expandafter\twodecimals@\tmp 00@} |
| 227 |
\def\twodecimals@#1.#2#3#4@{#1.#2#3} |
| 228 |
|
| 229 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 230 |
% Triggers. |
| 231 |
% |
| 232 |
% Triggers are used to make the individual frames in a scene different! :) |
| 233 |
|
| 234 |
% \F{C} expands to C(F) where F = (#frames / frame#) ; 0.0 < F <= 1.0 . |
| 235 |
% \Fr{C} expands to C(Fr) where Fr = 1 - F . |
| 236 |
|
| 237 |
\def\F{\expandafter\F@\expandafter{\theF}} |
| 238 |
\def\Fr{\expandafter\F@\expandafter{\theFr}} |
| 239 |
|
| 240 |
\def\F@#1#2{#2(#1)} |
| 241 |
|
| 242 |
% \Zoom[A;B]{C} expands C zooming onto the interval [A;B], i.e., within C the |
| 243 |
% interval [0;1] really denotes the (current) interval [A;B] ... |
| 244 |
|
| 245 |
% Specifically: F F inside [A;B] |
| 246 |
% 0;A 0 |
| 247 |
% A;B F-A / B-A |
| 248 |
% B;1 1 |
| 249 |
|
| 250 |
\newcommand\Zoom[1][0;1]{\Zoom@#1;} |
| 251 |
\def\Zoom@#1;#2;#3{{% |
| 252 |
\dimen@=#1\m@length \advance\dimen@\m@init |
| 253 |
\m@length=#2\m@length \advance\m@length\m@init |
| 254 |
\advance\m@length-\dimen@ \m@init=\dimen@ |
| 255 |
\frame@compute #3}} |
| 256 |
|
| 257 |
|
| 258 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 259 |
% Preliminary FADING support... |
| 260 |
% |
| 261 |
% by Ross Moore; depends on Xy-pic `ps' backend... |
| 262 |
% |
| 263 |
% use as a <shape> modifier: \drop[<colour>][!\F\lighten]<object> |
| 264 |
% use as a <shape> modifier: \drop[<colour>][!\F\darken}]<object> |
| 265 |
% |
| 266 |
% \lighten(1) = white \lighten(0) = natural colour |
| 267 |
% \darken (1) = black \darken (0) = natural colour |
| 268 |
% |
| 269 |
\def\lighten@(#1){/@col #1 def{1 sub 1 @col sub mul 1 add}settransfer} |
| 270 |
\def\darken@(#1){/@col #1 def{1 @col sub mul}settransfer} |
| 271 |
|
| 272 |
\xywithoption{ps}{\let\lighten=\lighten@ \let\darken=\darken@} |
| 273 |
|
| 274 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 275 |
% Dump size file. |
| 276 |
% |
| 277 |
\AtEndDocument{\dumpsizefile} |
| 278 |
|
| 279 |
\newwrite\m@write |
| 280 |
|
| 281 |
{\catcode`p=12 \catcode`t=12 \gdef\unPT@#1pt{#1}} |
| 282 |
|
| 283 |
\def\dumpsizefile{\immediate\openout\m@write=\jobname.size |
| 284 |
% |
| 285 |
\dimen@=1in \divide\dimen@\m@pixel |
| 286 |
\immediate\write\m@write{dpi=\number\dimen@}% |
| 287 |
% |
| 288 |
\dimen@=\m@tick \multiply\dimen@ by 1000\advance\[email protected]\m@tick |
| 289 |
\divide\dimen@\p@ \immediate\write\m@write{delay=\number\dimen@}% |
| 290 |
% |
| 291 |
\immediate\write\m@write{loop=\loop@@}% |
| 292 |
% |
| 293 |
\immediate\closeout\m@write} |
| 294 |
|
| 295 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 296 |
% Misc. class-provided commands... |
| 297 |
|
| 298 |
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm} |
| 299 |
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf} |
| 300 |
\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt} |
| 301 |
\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf} |
| 302 |
\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit} |
| 303 |
\DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl} |
| 304 |
\DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc} |
| 305 |
|
| 306 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 307 |
% The End. |
| 308 |
|
| 309 |
\endinput |
| 310 |
|
| 311 |
% $Log: movie.cls,v $ |
| 312 |
% Revision 3.7 2011/03/14 20:14:00 krisrose |
| 313 |
% Preparing for release 3.8.6. |
| 314 |
% |
| 315 |
% Revision 3.6 2010/06/10 18:45:49 krisrose |
| 316 |
% Reference to GPL by URL. |
| 317 |
% |
| 318 |
% Revision 3.5 2010/04/16 06:06:51 krisrose |
| 319 |
% Preparing for a new release... |
| 320 |
% |
| 321 |
% Revision 3.4 1997/05/18 01:14:25 krisrose |
| 322 |
% Essential bugfixes. |
| 323 |
% |
| 324 |
% Revision 1.5 1997/05/13 12:36:26 krisrose |
| 325 |
% Intermediate version; factors function nicely. |
| 326 |
% |
| 327 |
% Revision 1.4 1997/05/01 21:55:44 krisrose |
| 328 |
% Works again. |
| 329 |
% |
| 330 |
% Revision 1.3 1997/02/11 04:20:19 krisrose |
| 331 |
% Fits new dvitogif89a 1.1 :) |
| 332 |
% |
| 333 |
% Moved to Xy-pic hierarchy. |