summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/animate
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2008-09-04 13:56:48 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2008-09-04 13:56:48 +0000
commit4e235bf671868db530dfcff3f83c58f3a8389307 (patch)
tree8bc8f73eeaa5dfb8f8c56a242c8027857f1ea634 /Master/texmf-dist/tex/latex/animate
parent9f210e2dc170483a035d6c93e4130302c8f05d6f (diff)
animate update v2008/08/28
git-svn-id: svn://tug.org/texlive/trunk@10428 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/animate')
-rw-r--r--Master/texmf-dist/tex/latex/animate/animate.sty330
1 files changed, 150 insertions, 180 deletions
diff --git a/Master/texmf-dist/tex/latex/animate/animate.sty b/Master/texmf-dist/tex/latex/animate/animate.sty
index 74fb8a6563a..bac45621678 100644
--- a/Master/texmf-dist/tex/latex/animate/animate.sty
+++ b/Master/texmf-dist/tex/latex/animate/animate.sty
@@ -12,7 +12,7 @@
\NeedsTeXFormat{LaTeX2e}
-\def\@anim@version{2008/07/31}
+\def\@anim@version{2008/08/28}
\ProvidesPackage{animate}
[\@anim@version\space PDF animations from files and inline graphics]
@@ -272,27 +272,36 @@
\global\setbox\@anim@box=\hbox{\pdfrefximage\pdflastximage}%
\fi%
\else%
- \edef\@anim@curfile{[clip,page=#2\@anim@gropts]{#1}}%
+ \edef\@anim@curfile{[clip\@anim@gropts,page=#2]{#1}}%
\global\setbox\@anim@box=\hbox{%
\expandafter\includegraphics\@anim@curfile}%
\fi%
}
\else
- \def\@anim@filebox#1#2{% #1 filename, #2 ignored
- \edef\@anim@curfile{[clip\@anim@gropts]{#1}}%
- \global\setbox\@anim@box=\hbox{\expandafter\includegraphics\@anim@curfile}%
- }
+ \if@anim@xetex
+ \def\@anim@filebox#1#2{%
+ \edef\@anim@curfile{[clip\@anim@gropts,page=#2]{#1}}%
+ \global\setbox\@anim@box=\hbox{%
+ \expandafter\includegraphics\@anim@curfile}%
+ }
+ \else
+ \def\@anim@filebox#1#2{% #2 ignored
+ \edef\@anim@curfile{[clip\@anim@gropts]{#1}}%
+ \global\setbox\@anim@box=\hbox{%
+ \expandafter\includegraphics\@anim@curfile}%
+ }
+ \fi
\fi
%create Form XObject from graphics file
-\ifpdf
+\ifthenelse{\boolean{pdf}\OR\boolean{@anim@xetex}}{
\def\@anim@ximage#1#2#3#4{%#1:@anim@num, #2:@anim@curframe@zb, #3:filename,
%#4: page number of multipage file
\ifthenelse{\equal{\@anim@fileknown{#3}{#4}}{!}}{% new file to be embedded
\@anim@filebox{#3}{#4}% store file in a box
\@anim@getsize{\@anim@box}%
\ifnum#2=\z@%
- \@anim@scale% scale animation widget
+ \@anim@scale{\@anim@box}% scale animation widget
\fi%
\@anim@xinline{#1}{#2}{\@anim@box}{!}% delegate Form XObject creation
\ifx\@anim@gropts\@empty\if@anim@multipage\message{<#4>}\fi\fi%
@@ -301,19 +310,19 @@
\ifnum#2=\z@%
\@anim@filebox{#3}{#4}% for size determination of first frame
\@anim@getsize{\@anim@box}%
- \@anim@scale%
+ \@anim@scale{\@anim@box}%
\fi%
\@anim@xinline{#1}{#2}{}{\@anim@fileknown{#3}{#4}}%
}%
}
-\else
+}{
\if@anim@@dvipdfmx
\def\@anim@ximage#1#2#3#4{% #4: not used
- \ifthenelse{\equal{\@anim@fileknown{#3}{1}}{!}}{% new file to be embedded
+ \ifthenelse{\equal{\@anim@fileknown{#3}{1}}{!}}{%new file to be embedded
\@anim@filebox{#3}{}%
\@anim@getsize{\@anim@box}%
\ifnum#2=\z@%
- \@anim@scale%
+ \@anim@scale{\@anim@box}%
\fi%
\@anim@xinline{#1}{#2}{\@anim@box}{!}%
\@anim@makefileknown{#3}{1}{\@anim@lastxform}%
@@ -321,7 +330,7 @@
\ifnum#2=\z@%
\@anim@filebox{#3}{}%
\@anim@getsize{\@anim@box}%
- \@anim@scale%
+ \@anim@scale{\@anim@box}%
\fi%
\@anim@xinline{#1}{#2}{}{\@anim@fileknown{#3}{1}}%
}%
@@ -332,7 +341,7 @@
\@anim@filebox{#3}{}% animation
\@anim@getsize{\@anim@box}%
\ifnum#2=\z@%
- \@anim@scale%
+ \@anim@scale{\@anim@box}%
\fi%
\@anim@xinline{#1}{#2}{\@anim@box}{!}%
\@anim@makefileknown{#3}{#1}{\@anim@lastxform}%
@@ -340,13 +349,13 @@
\ifnum#2=\z@%
\@anim@filebox{#3}{}%
\@anim@getsize{\@anim@box}%
- \@anim@scale%
+ \@anim@scale{\@anim@box}%
\fi%
\@anim@xinline{#1}{#2}{}{\@anim@fileknown{#3}{#1}}%
}%
}
\fi
-\fi
+}
%creates Form XObject from box contents
\ifpdf%
@@ -1190,7 +1199,7 @@
}}}}}}}}}}%
}%
\else
- \if@anim@xetex
+ \if@anim@@dvipdfmx %XeLaTeX, dvipdfmx
\def\@anim@getext#1{%
\gdef\@anim@ext{.pdf}% we start with `pdf'
\IfFileExists{#1\@anim@ext}{}{%
@@ -1206,20 +1215,6 @@
\IfFileExists{#1\@anim@ext}{}{%
\gdef\@anim@ext{.jpeg}%
\IfFileExists{#1\@anim@ext}{}{%
- \gdef\@anim@ext{.tif}%
- \IfFileExists{#1\@anim@ext}{}{%
- \gdef\@anim@ext{.tga}%
- \IfFileExists{#1\@anim@ext}{}{%
- \gdef\@anim@ext{.sgi}%
- \IfFileExists{#1\@anim@ext}{}{%
- \gdef\@anim@ext{.psd}%
- \IfFileExists{#1\@anim@ext}{}{%
- \gdef\@anim@ext{.pict}%
- \IfFileExists{#1\@anim@ext}{}{%
- \gdef\@anim@ext{.mac}%
- \IfFileExists{#1\@anim@ext}{}{%
- \gdef\@anim@ext{.gif}%
- \IfFileExists{#1\@anim@ext}{}{%
\gdef\@anim@ext{.bmp}%
\IfFileExists{#1\@anim@ext}{}{%
\PackageError{animate}{%
@@ -1230,70 +1225,31 @@
`#1.ps',\MessageBreak%
`#1.png',\MessageBreak%
`#1.jpg',\MessageBreak%
- `#1.jpeg',\MessageBreak%
- `#1.tif',\MessageBreak%
- `#1.tga',\MessageBreak%
- `#1.sgi',\MessageBreak%
- `#1.psd',\MessageBreak%
- `#1.pict',\MessageBreak%
- `#1.mac',\MessageBreak%
- `#1.gif' or\MessageBreak%
+ `#1.jpeg' or\MessageBreak%
`#1.bmp'\MessageBreak%
could be found.\MessageBreak%
Wrong file type? Mis-spelled file name?%
}{}%
- }}}}}}}}}}}}}}}%
+ }}}}}}}}%
+ }%
+ \else %dvips
+ \def\@anim@getext#1{%
+ \gdef\@anim@ext{.eps}% we start with `eps'
+ \IfFileExists{#1\@anim@ext}{}{%
+ \gdef\@anim@ext{.mps}%
+ \IfFileExists{#1\@anim@ext}{}{%
+ \gdef\@anim@ext{.ps}%
+ \IfFileExists{#1\@anim@ext}{}{%
+ \PackageError{animate}{%
+ Neither of the files\MessageBreak%
+ `#1.eps',\MessageBreak%
+ `#1.mps' or\MessageBreak%
+ `#1.ps'\MessageBreak%
+ could be found.\MessageBreak%
+ Wrong file type? Mis-spelled file name?%
+ }{}%
+ }}}%
}%
- \else
- \if@anim@@dvipdfmx
- \def\@anim@getext#1{%
- \gdef\@anim@ext{.pdf}% we start with `pdf'
- \IfFileExists{#1\@anim@ext}{}{%
- \gdef\@anim@ext{.mps}%
- \IfFileExists{#1\@anim@ext}{}{%
- \gdef\@anim@ext{.eps}%
- \IfFileExists{#1\@anim@ext}{}{%
- \gdef\@anim@ext{.ps}%
- \IfFileExists{#1\@anim@ext}{}{%
- \gdef\@anim@ext{.png}%
- \IfFileExists{#1\@anim@ext}{}{%
- \gdef\@anim@ext{.jpg}%
- \IfFileExists{#1\@anim@ext}{}{%
- \gdef\@anim@ext{.jpeg}%
- \IfFileExists{#1\@anim@ext}{}{%
- \PackageError{animate}{%
- Neither of the files\MessageBreak%
- `#1.pdf',\MessageBreak%
- `#1.mps',\MessageBreak%
- `#1.eps',\MessageBreak%
- `#1.ps',\MessageBreak%
- `#1.png',\MessageBreak%
- `#1.jpg' or\MessageBreak%
- `#1.jpeg'\MessageBreak%
- could be found.\MessageBreak%
- Wrong file type? Mis-spelled file name?%
- }{}%
- }}}}}}}%
- }%
- \else
- \def\@anim@getext#1{%
- \gdef\@anim@ext{.eps}% we start with `eps'
- \IfFileExists{#1\@anim@ext}{}{%
- \gdef\@anim@ext{.mps}%
- \IfFileExists{#1\@anim@ext}{}{%
- \gdef\@anim@ext{.ps}%
- \IfFileExists{#1\@anim@ext}{}{%
- \PackageError{animate}{%
- Neither of the files\MessageBreak%
- `#1.eps',\MessageBreak%
- `#1.mps' or\MessageBreak%
- `#1.ps'\MessageBreak%
- could be found.\MessageBreak%
- Wrong file type? Mis-spelled file name?%
- }{}%
- }}}%
- }%
- \fi
\fi
\fi
@@ -1417,7 +1373,45 @@
\fi%
}%
\else
- \def\@anim@checkmultipage#1{}% no-op in dvips & dvipdfmx mode
+ \if@anim@xetex
+ \def\@anim@checkmultipage#1{% #1: file base name
+ \IfFileExists{#1.pdf}{%
+ \setboolean{@anim@multipage}{true}%
+ \gdef\@anim@ext{.pdf}%
+ }{}%
+ \if@anim@multipage%
+ \ifx\@anim@first\@empty%
+ \global\@anim@curframe=\@ne%
+ \else%
+ \ifnum\@anim@first<\z@\gdef\@anim@first{0}\fi%
+ \global\@anim@curframe=\@anim@first%
+ \global\advance\@anim@curframe by \@ne%\XeTeXpdfpagecount is 1-based
+ \ifnum\@anim@curframe>\XeTeXpdfpagecount "#1.pdf"\relax%
+ \global\@anim@curframe=\XeTeXpdfpagecount "#1.pdf"%
+ \fi%
+ \fi%
+ \xdef\@anim@first{\the\@anim@curframe}%
+ \ifx\@anim@last\@empty%
+ \global\@anim@curframe=\XeTeXpdfpagecount "#1.pdf"%
+ \else%
+ \ifnum\@anim@last<\z@\gdef\@anim@last{0}\fi%
+ \global\@anim@curframe=\@anim@last%
+ \global\advance\@anim@curframe by \@ne%
+ \ifnum\@anim@curframe>\XeTeXpdfpagecount "#1.pdf"\relax%
+ \global\@anim@curframe=\XeTeXpdfpagecount "#1.pdf"%
+ \fi%
+ \fi%
+ \ifnum\@anim@first>\@anim@curframe%
+ \xdef\@anim@last{\@anim@first}%
+ \xdef\@anim@first{\the\@anim@curframe}%
+ \else%
+ \xdef\@anim@last{\the\@anim@curframe}%
+ \fi%
+ \fi%
+ }%
+ \else
+ \def\@anim@checkmultipage#1{}% no-op in dvips & dvipdfmx mode
+ \fi
\fi
%user command for embedding animation sequence
@@ -1490,7 +1484,7 @@
\@anim@filebox{\@anim@base\@anim@first\@anim@ext}{1}%
\fi%
\@anim@getsize{\@anim@box}%
- \@anim@scale%
+ \@anim@scale{\@anim@box}%
%draw draftbox according to dimensions of the first frame
\@anim@draftbox{\@anim@box}%
\else%
@@ -1596,77 +1590,60 @@
%calculates widget dimensions from natural ones, taking resizing options
%into account
-\def\@anim@scale{%
- %initial widget dimensions
- \xdef\@anim@animwidth{\@anim@framewidth}%
- \xdef\@anim@animheight{\@anim@frameheight}%
- \xdef\@anim@animdepth{\@anim@framedepth}%
- \xdef\@anim@animtotalheight{\@anim@frametotalheight}%
- %rescale height & depth
- \ifthenelse{%
- \NOT\equal{\@anim@boxheight}{}\AND\NOT\equal{\@anim@boxdepth}{}%
- }{%
- \xdef\@anim@animheight{\@anim@boxheight}%
- \xdef\@anim@animdepth{\@anim@boxdepth}%
- }{%
- \ifthenelse{\NOT\equal{\@anim@boxheight}{}}{%
- \xdef\@anim@animheight{\@anim@boxheight}%
- }{%
- \ifthenelse{\NOT\equal{\@anim@boxdepth}{}}{%
- \xdef\@anim@animdepth{\@anim@boxdepth}%
- }{%if neither height nor depth are given but width is, rescale
- %ht & dp to keep aspect ratio
- \ifthenelse{\NOT\equal{\@anim@boxwidth}{}}{%
- \setlength{\@anim@tmpdima}{%
- \@anim@animheight\p@%
- *\ratio{\@anim@boxwidth\p@}{\@anim@animwidth\p@}%
- }\xdef\@anim@animheight{\strip@pt\@anim@tmpdima}%
- \setlength{\@anim@tmpdima}{%
- \@anim@animdepth\p@%
- *\ratio{\@anim@boxwidth\p@}{\@anim@animwidth\p@}%
- }\xdef\@anim@animdepth{\strip@pt\@anim@tmpdima}%
- }{}%
- }%
- }%
- }%
- \ifthenelse{\NOT\equal{\@anim@boxwidth}{}}{%rescale width
- \ifthenelse{% depth missing
- \NOT\equal{\@anim@boxheight}{}\AND\equal{\@anim@boxdepth}{}%
- }{%
+\newcount\@anim@resize% resizing flags according to options given
+\def\@anim@scale#1{%
+ %natural dimensions \width, \height, \depth, \totalheight
+ \def\width{\wd#1}%
+ \def\height{\ht#1}%
+ \def\depth{\dp#1}%
+ \let\totalheight\@anim@tmpdimb%
+ \setlength{\totalheight}{\height}%
+ \addtolength{\totalheight}{\depth}%
+ %evaluate resizing options
+ \setlength{\@anim@tmpdima}{\@anim@widtharg}%
+ \xdef\@anim@animwidth{\strip@pt\@anim@tmpdima}%
+ \setlength{\@anim@tmpdima}{\@anim@heightarg}%
+ \xdef\@anim@animheight{\strip@pt\@anim@tmpdima}%
+ \setlength{\@anim@tmpdima}{\@anim@deptharg}%
+ \xdef\@anim@animdepth{\strip@pt\@anim@tmpdima}%
+ \setlength{\@anim@tmpdima}{\@anim@heightarg}%
+ \addtolength{\@anim@tmpdima}{\@anim@deptharg}%
+ \xdef\@anim@animtotalheight{\strip@pt\@anim@tmpdima}%
+ %resize unspecified dimensions to keep aspect ratio
+ \ifcase\@anim@resize% bit 2^2=width, 2^1=height, 2^0=depth option given
+ \or% 1
+ \setlength{\@anim@tmpdima}{%
+ \width*\ratio{\@anim@animtotalheight\p@}{\height+\depth}%
+ }\xdef\@anim@animwidth{\strip@pt\@anim@tmpdima}%
+ \or% 2
+ \setlength{\@anim@tmpdima}{%
+ \width*\ratio{\@anim@animtotalheight\p@}{\height+\depth}%
+ }\xdef\@anim@animwidth{\strip@pt\@anim@tmpdima}%
+ \or% 3
+ \setlength{\@anim@tmpdima}{%
+ \width*\ratio{\@anim@animtotalheight\p@}{\height+\depth}%
+ }\xdef\@anim@animwidth{\strip@pt\@anim@tmpdima}%
+ \or% 4
+ \setlength{\@anim@tmpdima}{%
+ \height*\ratio{\@anim@animwidth\p@}{\width}%
+ }\xdef\@anim@animheight{\strip@pt\@anim@tmpdima}%
+ \setlength{\@anim@tmpdima}{%
+ \depth*\ratio{\@anim@animwidth\p@}{\width}%
+ }\xdef\@anim@animdepth{\strip@pt\@anim@tmpdima}%
+ \or% 5
+ \ifdim\height=\z@\else% resize height only if original height .ne. zero
\setlength{\@anim@tmpdima}{%
- \@anim@animtotalheight\p@%
- *\ratio{\@anim@boxwidth\p@}{\@anim@animwidth\p@}%
- }%
- \setlength{\@anim@tmpdimb}{\@anim@tmpdima-\@anim@boxheight\p@}%
- \xdef\@anim@animdepth{\strip@pt\@anim@tmpdimb}%
- }{%
- \ifthenelse{% height missing
- \equal{\@anim@boxheight}{}\AND\NOT\equal{\@anim@boxdepth}{}%
- }{%
- \setlength{\@anim@tmpdima}{%
- \@anim@animtotalheight\p@%
- *\ratio{\@anim@boxwidth\p@}{\@anim@animwidth\p@}%
- }%
- \setlength{\@anim@tmpdimb}{\@anim@tmpdima-\@anim@boxdepth\p@}%
- \xdef\@anim@animheight{\strip@pt\@anim@tmpdimb}%
- }{}%
- }%
- \xdef\@anim@animwidth{\@anim@boxwidth}%
- }{%
- %if width is not given, but either height or depth are, scale
- %width to keep aspect ratio
- \ifthenelse{%
- \NOT\equal{\@anim@boxheight}{}\OR\NOT\equal{\@anim@boxdepth}{}%
- }{%
+ \totalheight*\ratio{\@anim@animwidth\p@}{\width}-\@anim@animdepth\p@}%
+ \xdef\@anim@animheight{\strip@pt\@anim@tmpdima}%
+ \fi%
+ \or% 6
+ \ifdim\depth=\z@\else% resize depth only if original depth .ne. zero
\setlength{\@anim@tmpdima}{%
- \@anim@animwidth\p@%
- *\ratio{\@anim@animheight\p@+\@anim@animdepth\p@}{%
- \@anim@animtotalheight\p@}%
- }%
- \xdef\@anim@animwidth{\strip@pt\@anim@tmpdima}%
- }{}%
- }%
- %apply scaling factor
+ \totalheight*\ratio{\@anim@animwidth\p@}{\width}-\@anim@animheight\p@}%
+ \xdef\@anim@animdepth{\strip@pt\@anim@tmpdima}%
+ \fi%
+ \fi%
+ %apply scaling factor, totalheight
\setlength{\@anim@tmpdima}{\@anim@animwidth\p@}%
\setlength{\@anim@tmpdima}{\@anim@boxscale\@anim@tmpdima}%
\xdef\@anim@animwidth{\strip@pt\@anim@tmpdima}%
@@ -2094,7 +2071,7 @@
}{}%
\fi%
\fi%
- \@anim@scale%
+ \@anim@scale{\@anim@box}%
%draw draftbox according to dimensions of the first frame
\if@anim@draft\@anim@draftbox{\@anim@box}\fi%
\fi%
@@ -2544,16 +2521,16 @@
%command options
%setting the widget size
\define@key{anim@user}{width}{%
- \setlength{\@anim@tmpdima}{#1}%
- \xdef\@anim@boxwidth{\strip@pt\@anim@tmpdima}%
+ \gdef\@anim@widtharg{#1}%
+ \global\advance\@anim@resize by 4%
}
\define@key{anim@user}{height}{%
- \setlength{\@anim@tmpdima}{#1}%
- \xdef\@anim@boxheight{\strip@pt\@anim@tmpdima}%
+ \gdef\@anim@heightarg{#1}%
+ \global\advance\@anim@resize by 2%
}
\define@key{anim@user}{depth}{%
- \setlength{\@anim@tmpdima}{#1}%
- \xdef\@anim@boxdepth{\strip@pt\@anim@tmpdima}%
+ \gdef\@anim@deptharg{#1}%
+ \global\advance\@anim@resize by \@ne%
}
\define@key{anim@user}{scale}{%
\gdef\@anim@boxscale{#1}%
@@ -2651,17 +2628,14 @@
\fi%
}
\newboolean{@anim@controls}
-\setboolean{@anim@controls}{false}
\define@key{anim@user}{controls}[true]{%
\setboolean{@anim@controls}{#1}%
}
\newboolean{@anim@loop}
-\setboolean{@anim@loop}{false}
\define@key{anim@user}{loop}[true]{%
\setboolean{@anim@loop}{#1}%
}
\newboolean{@anim@autoplay}
-\setboolean{@anim@autoplay}{false}
\define@key{anim@user}{autoplay}[true]{%
\setboolean{@anim@autoplay}{#1}%
\if@anim@autoplay%
@@ -2669,7 +2643,6 @@
\fi%
}
\newboolean{@anim@autoresume}
-\setboolean{@anim@autoresume}{false}
\define@key{anim@user}{autoresume}[true]{%
\setboolean{@anim@autoresume}{#1}%
\if@anim@autoresume%
@@ -2677,12 +2650,10 @@
\fi%
}
\newboolean{@anim@autopause}
-\setboolean{@anim@autopause}{false}
\define@key{anim@user}{autopause}[true]{%
\setboolean{@anim@autopause}{#1}%
}
\newboolean{@anim@palindrome}
-\setboolean{@anim@palindrome}{false}
\define@key{anim@user}{palindrome}[true]{%
\setboolean{@anim@palindrome}{#1}%
}
@@ -2696,12 +2667,10 @@
}%
}
\newboolean{@anim@step}
-\setboolean{@anim@step}{false}
\define@key{anim@user}{step}[true]{%
\setboolean{@anim@step}{#1}%
}
\newboolean{@anim@draft}
-\setboolean{@anim@draft}{false}
\define@key{anim@user}{draft}[true]{%
\setboolean{@anim@draft}{#1}%
}
@@ -2731,7 +2700,7 @@
\define@key{anim@user}{end}{%
\@anim@end{#1}%
}
-\define@key{anim@user}{every}{% embed every #1 frames
+\define@key{anim@user}{every}{% embed every #1th frame
\ifnum#1<\@ne\gdef\@anim@every{1}\else\gdef\@anim@every{#1}\fi%
}
\define@key{anim@user}{bb}{%
@@ -2757,9 +2726,10 @@
%macro to reset macros and booleans
\def\@anim@reset{%
\gdef\@anim@boxscale{1.0}%
- \gdef\@anim@boxdepth{}%
- \gdef\@anim@boxheight{}%
- \gdef\@anim@boxwidth{}%
+ \global\@anim@resize\z@%
+ \gdef\@anim@widtharg{\width}%
+ \gdef\@anim@heightarg{\height}%
+ \gdef\@anim@deptharg{\depth}%
\xdef\@anim@bg{\@anim@@bg}%
\xdef\@anim@fg{\@anim@@fg}%
\if@anim@@dvips\else\xdef\@anim@@@fg{\@anim@@@@fg}\fi%