diff options
author | Karl Berry <karl@freefriends.org> | 2020-03-24 20:52:05 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-03-24 20:52:05 +0000 |
commit | c8dfcd868f200f4fb7108d5711287235eefe1c38 (patch) | |
tree | 3e9535af6e64651ea20f075194db00e6e924ca84 /Master/texmf-dist/tex/latex/animate/animate.sty | |
parent | 6805d56b61e94ec576faaa78ef55e75557e7eb10 (diff) |
animate (24mar20)
git-svn-id: svn://tug.org/texlive/trunk@54520 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/animate/animate.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/animate/animate.sty | 247 |
1 files changed, 70 insertions, 177 deletions
diff --git a/Master/texmf-dist/tex/latex/animate/animate.sty b/Master/texmf-dist/tex/latex/animate/animate.sty index 47c4d19d6fa..a5c45e8316f 100644 --- a/Master/texmf-dist/tex/latex/animate/animate.sty +++ b/Master/texmf-dist/tex/latex/animate/animate.sty @@ -13,7 +13,7 @@ \NeedsTeXFormat{LaTeX2e} -\def\@anim@version{2019/12/03} +\def\@anim@version{2020/03/23} \ProvidesPackage{animate} [\@anim@version\space PDF & SVG animations from files and inline graphics] @@ -144,177 +144,6 @@ \if@anim@dvisvgm \setboolean{@anim@export}{false} - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - \AtBeginDocument{% - % Add PS and PDF file inclusion (PDF files as of dvisvgm-2.6.3) and - % fix some scaling issues in the dvisvgm.def graphics driver - \def\GPT@space{ } - \def\Gin@extensions{.svg,.eps,.png,.jpg,.jpeg} - \def\Ginclude@pdf#1{\Ginclude@psorpdf{#1}{pdffile}} - \def\Ginclude@eps#1{\let\Gin@page\@empty\Ginclude@psorpdf{#1}{PSfile}} - \def\Ginclude@psorpdf#1#2{% - \message{<#1>}% - \bgroup - \def\@tempa{!}% - \dimen@\Gin@req@width - \dimen@ii.1bp% - \divide\dimen@\dimen@ii - \@tempdima\Gin@req@height - \divide\@tempdima\dimen@ii - \Gin@req@width0.99626\Gin@req@width% - \Gin@req@height0.99626\Gin@req@height% - \ifGin@clip\special{dvisvgm:raw - <g><clipPath id="GinClip\Gin@clip@id">% - <path d="M{?x},{?y}l\strip@pt\Gin@req@width,0l0,-\strip@pt\Gin@req@height - l-\strip@pt\Gin@req@width,0Z"/>% - </clipPath>% - <g clip-path="url(\Gin@hash@tag GinClip\Gin@clip@id)">}% - \fi% - \special{#2="#1"\GPT@space - \ifx\Gin@page\@empty\else page=\Gin@page\GPT@space\fi - llx=\Gin@llx\GPT@space - lly=\Gin@lly\GPT@space - urx=\Gin@urx\GPT@space - ury=\Gin@ury\GPT@space - \ifx\Gin@scalex\@tempa\else rwi=\number\dimen@\GPT@space\fi - \ifx\Gin@scaley\@tempa\else rhi=\number\@tempdima\GPT@space\fi - }% - \ifGin@clip% - \special{dvisvgm:raw </g></g>}% - \begingroup% - \count@\Gin@clip@id\advance\count@ by\@ne\xdef\Gin@clip@id{\the\count@}% - \endgroup% - \fi% - \egroup} - \@namedef{Gin@rule@.ps}#1{{eps}{.ps}{#1}} - \@namedef{Gin@rule@.eps}#1{{eps}{.eps}{#1}} - \@namedef{Gin@rule@.mps}#1{{eps}{.mps}{#1}} - \@namedef{Gin@rule@.pdf}#1{{pdf}{.xbb}{#1}} - \def\Gread@pdf#1{% - \Gread@generic{#1}\Gread@extractbb@aux% - }% - \def\Gread@extractbb@aux#1{% - \ifeof\@inputcheck% - \immediate\openin\@inputcheck=% - "|extractbb % - \ifx\Gin@page\@empty\else -p \Gin@page\GPT@space\fi - \ifx\Gin@pagebox\@empty\else -B \Gin@pagebox\GPT@space\fi - -O \Gin@base\Gin@ext"% - \fi% - \Gread@true% - \let\@tempb\Gread@false% - \ifeof\@inputcheck% - \@latex@error% - {Cannot run pipe command. Try --shell-escape\MessageBreak% - (--enable-pipes in MikTeX) option}% - {Alternatively, execute\MessageBreak\space\space - extractbb - \ifx\Gin@page\@empty\else -p \Gin@page\GPT@space\fi - \ifx\Gin@pagebox\@empty\else -B \Gin@pagebox\GPT@space\fi - \Gin@base\Gin@ext\MessageBreak in a terminal.}% - \else% - \loop% - \read\@inputcheck to\@tempa% - \ifeof\@inputcheck% - \Gread@false% - \else% - \expandafter\Gread@find@bb\@tempa:.\\% - \fi% - \ifGread@% - \repeat% - \immediate\closein\@inputcheck% - \fi% - } - \def\Ginclude@bitmap#1{% - \dimen@\Gin@urx pt% - \advance\dimen@ by-\Gin@llx pt% - \edef\Gin@svg@view@width{\strip@pt\dimen@}% - \dimen@\Gin@ury pt% - \advance\dimen@ by-\Gin@lly pt% - \edef\Gin@svg@view@height{\strip@pt\dimen@}% - \dimen@\Gin@svg@real@height@bp pt% - \advance\dimen@ by-\Gin@ury pt% - \edef\Gin@svg@view@base{\strip@pt\dimen@}% - \Gin@req@width0.99626\Gin@req@width% - \Gin@req@height0.99626\Gin@req@height% - \raise\strip@pt\Gin@req@height bp\hbox{% - \special{dvisvgm: raw - <g transform="translate({?x},{?y})"> - <svg overflow="\ifGin@clip hidden\else visible\fi" width="\strip@pt\Gin@req@width" height="\strip@pt\Gin@req@height" - viewBox="\Gin@llx\GPT@space\Gin@svg@view@base\GPT@space\Gin@svg@view@width\GPT@space\Gin@svg@view@height"> - <image width="\Gin@svg@real@width@bp" height="\Gin@svg@real@height@bp" - xlink:href="#1"/> - </svg> - </g>}% - }% - } - \@namedef{Gin@rule@.svg}#1{{svg}{.svg}{#1}} - \let\Ginclude@svg\Ginclude@bitmap - \def\Gread@svg#1{% - \begingroup - \catcode`\"12\relax% - \immediate\openin\@inputcheck#1 % - \ifeof\@inputcheck - \@latex@error{File `#1' not found}\@ehc - \else - \let\Gin@urx\relax - \let\Gin@ury\relax - \Gread@true - \let\@tempb\Gread@false - \loop - \read\@inputcheck to\@tempa - \ifeof\@inputcheck - \Gread@false - \else - \ifx\@tempa\Gin@partext\else - \ifx\Gin@ury\relax\expandafter\Gread@svg@height\@tempa height=\relax\fi% - \ifx\Gin@urx\relax\expandafter\Gread@svg@width\@tempa width=\relax\fi% - \fi% - \fi - \ifx\Gin@urx\relax\else\ifx\Gin@ury\relax\else\Gread@false\fi\fi% - \ifGread@ - \repeat - \immediate\closein\@inputcheck - \ifx\Gin@urx\relax - \@latex@error{Cannot determine width of graphic in #1 (no BoundingBox)}\@ehc - \def\Gin@urx{72}% - \fi - \ifx\Gin@ury\relax - \@latex@error{Cannot determine height of graphic in #1 (no BoundingBox)}\@ehc - \def\Gin@ury{72}% - \fi - \fi - \edef\Gin@setter{\def\noexpand\Gin@urx{\Gin@urx}\def\noexpand\Gin@ury{\Gin@ury}}% - \expandafter\endgroup\Gin@setter% - \def\Gin@llx{0}% - \def\Gin@lly{0}% - \edef\Gin@svg@real@width@bp{\Gin@urx}% - \edef\Gin@svg@real@height@bp{\Gin@ury}% - } - \def\Gin@partext{\par} - \def\Gread@svg@height#1height={\@ifnextchar\relax{}{\@ifnextchar'\Gread@svg@height@apo\Gread@svg@height@double}} - \def\Gread@svg@height@apo'#1'#2\relax{\afterassignment\Gin@gobble@till@relax\dimen@#1pt\relax\edef\Gin@ury{\strip@pt\dimen@}} - \def\Gread@svg@height@double"#1"#2\relax{\afterassignment\Gin@gobble@till@relax\dimen@#1pt\relax\edef\Gin@ury{\strip@pt\dimen@}} - \def\Gread@svg@width#1width={\@ifnextchar\relax{}{\@ifnextchar'\Gread@svg@width@apo\Gread@svg@width@double}} - \def\Gread@svg@width@apo'#1'#2\relax{\afterassignment\Gin@gobble@till@relax\dimen@#1pt\relax\edef\Gin@urx{\strip@pt\dimen@}} - \def\Gread@svg@width@double"#1"#2\relax{\afterassignment\Gin@gobble@till@relax\dimen@#1pt\relax\edef\Gin@urx{\strip@pt\dimen@}} - \def\Gin@gobble@till@relax#1\relax{} - \edef\Gin@hash@tag{\string#} - \def\Gin@clip@id{0} - \@namedef{Gin@rule@.jpg}#1{{bitmap}{.xbb}{#1}} - \@namedef{Gin@rule@.jpeg}#1{{bitmap}{.xbb}{#1}} - \@namedef{Gin@rule@.png}#1{{bitmap}{.xbb}{#1}} - \def\Gread@bitmap#1{% - \Gread@generic{#1}\Gread@extractbb@aux% - \dimen@\Gin@urx pt% - \advance\dimen@ by-\Gin@llx pt% - \edef\Gin@svg@real@width@bp{\strip@pt\dimen@}% - \dimen@\Gin@ury pt% - \advance\dimen@ by-\Gin@lly pt% - \edef\Gin@svg@real@height@bp{\strip@pt\dimen@}% - } - } - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \fi \if@anim@export @@ -364,7 +193,7 @@ \if@anim@dvisvgm \setboolean{@anim@export}{false} - \def\@anim@updatebbox#1#2#3{\special{dvisvgm:bbox #1 #2 #3}} + \def\@anim@updatebbox#1#2#3{\special{dvisvgm:bbox #1 #2 #3 transform}} %approach similar to OCGs, that is, putting the frame content in an svg group, % <g id='...'>...</g>, whose visibility is then manipulated by JavaScript @@ -1563,7 +1392,9 @@ \setlength{\@anim@tmpdimb}{\z@}% \vskip 0.1\@anim@tmpdima% \hbox to \@anim@animwidth {% - \hss% + \if@anim@ctrlleft\hspace{\@anim@ctrlsindent}\fi% + \ifnum\if@anim@ctrlright\@ne\else% + \if@anim@ctrlcentre\@ne\else\z@\fi\fi=\@ne\hss\fi% \setboolean{@anim@controls@firstgrp}{false}% \if@anim@controls@stop% \setboolean{@anim@controls@firstgrp}{true}% @@ -1584,7 +1415,9 @@ \if@anim@controls@firstgrp\hskip 0.3\@anim@tmpdima\fi% \frame{\phantom{\rule{3\@anim@tmpdima}{\@anim@tmpdima}}}% \fi% - \hss% + \ifnum\if@anim@ctrlleft\@ne\else% + \if@anim@ctrlcentre\@ne\else\z@\fi\fi=\@ne\hss\fi% + \if@anim@ctrlright\hspace{\@anim@ctrlsindent}\fi% }% \fi% }% @@ -1842,7 +1675,9 @@ \setlength{\@anim@tmpdima}{\@anim@btnsize}% \vskip 0.1\@anim@tmpdima% \hbox to \@anim@animwidth {% - \hss% + \if@anim@ctrlleft\hspace{\@anim@ctrlsindent}\fi% + \ifnum\if@anim@ctrlright\@ne\else% + \if@anim@ctrlcentre\@ne\else\z@\fi\fi=\@ne\hss\fi% \def\@anim@tooltip{}% \setboolean{@anim@controls@firstgrp}{false}% \if@anim@controls@stop% @@ -1890,7 +1725,9 @@ \@anim@makebutton{Plus}{#2}% \@anim@buttonwidget{#1}{Plus}{Plus:#2}% \fi% - \hss% + \ifnum\if@anim@ctrlleft\@ne\else% + \if@anim@ctrlcentre\@ne\else\z@\fi\fi=\@ne\hss\fi% + \if@anim@ctrlright\hspace{\@anim@ctrlsindent}\fi% }% \fi% }% @@ -3099,6 +2936,39 @@ \setboolean{@anim@controls@speed}{true}% } +\def\@anim@parse@ctrlsalignarg#1#2#3+#4\@nil{% + \ifthenelse{\equal{#3}{}}{}{\def#1{#3}}% + \ifthenelse{\equal{#4}{}}{#2=\z@}{\@anim@getalignindent#2#4\@nil}% +} +\def\@anim@getalignindent#1#2+\@nil{#1=#2} + +\newboolean{@anim@ctrlleft} +\newboolean{@anim@ctrlright} +\newboolean{@anim@ctrlcentre} +\define@key{anim@user}{controlsaligned}{% + \@anim@parse@ctrlsalignarg\@anim@tmpvar\@anim@tmpdima#1+\@nil% + \ifthenelse{\equal{\@anim@tmpvar}{left}}{% + \setboolean{@anim@ctrlleft}{true}% + \setboolean{@anim@ctrlright}{false}% + \setboolean{@anim@ctrlcentre}{false}% + \xdef\@anim@ctrlsindent{\the\@anim@tmpdima}% + }{% + \ifthenelse{\equal{\@anim@tmpvar}{right}}{% + \setboolean{@anim@ctrlleft}{false}% + \setboolean{@anim@ctrlright}{true}% + \setboolean{@anim@ctrlcentre}{false}% + \xdef\@anim@ctrlsindent{\the\@anim@tmpdima}% + }{% + \ifthenelse{\equal{\@anim@tmpvar}{center}}{% + \setboolean{@anim@ctrlleft}{false}% + \setboolean{@anim@ctrlright}{false}% + \setboolean{@anim@ctrlcentre}{true}% + \xdef\@anim@ctrlsindent{\z@}% + }{}% + }% + }% +} + \newboolean{@anim@loop} \define@key{anim@user}{loop}[true]{% \setboolean{@anim@loop}{#1}% @@ -3261,6 +3131,10 @@ \global\let\if@anim@controls@step=\if@anim@@controls@step% \global\let\if@anim@controls@stop=\if@anim@@controls@stop% \global\let\if@anim@controls@speed=\if@anim@@controls@speed% + \global\let\if@anim@ctrlleft=\if@anim@@ctrlleft% + \global\let\if@anim@ctrlright=\if@anim@@ctrlright% + \global\let\if@anim@ctrlcentre=\if@anim@@ctrlcentre% + \global\let\@anim@ctrlsindent\@anim@@ctrlsindent% \global\let\if@anim@loop=\if@anim@@loop% \global\let\if@anim@autoplay=\if@anim@@autoplay% \global\let\if@anim@autoresume=\if@anim@@autoresume% @@ -3509,6 +3383,25 @@ \setboolean{@anim@@controls@speed}{true}% } +\newboolean{@anim@@ctrlleft} +\newboolean{@anim@@ctrlright} +\newboolean{@anim@@ctrlcentre} +\setboolean{@anim@@ctrlcentre}{true} +\def\@anim@@ctrlsindent{\z@} +\define@key{anim@pkg}{controlsaligned}{% + \@anim@parse@ctrlsalignarg\@anim@tmpvar\@anim@tmpdima#1+\@nil% + \setboolean{@anim@@ctrlcentre}{false}% + \ifthenelse{\equal{#1}{left}}{% + \setboolean{@anim@@ctrlleft}{true}% + \edef\@anim@@ctrlsindent{\the\@anim@tmpdima}% + }{% + \ifthenelse{\equal{#1}{right}}{% + \setboolean{@anim@@ctrlright}{true}% + \edef\@anim@@ctrlsindent{\the\@anim@tmpdima}% + }{\setboolean{@anim@@ctrlcentre}{true}}% + }% +} + \newboolean{@anim@@loop} \setboolean{@anim@@loop}{false}% \define@key{anim@pkg}{loop}[true]{% |