From f0cc2d8030038bc728c1d758aaa39da12e0611ee Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 5 May 2019 18:06:50 +0000 Subject: animate (9apr19) git-svn-id: svn://tug.org/texlive/trunk@51009 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/animate/animate.sty | 185 ++++++++++++++++++------ 1 file changed, 141 insertions(+), 44 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/animate/animate.sty b/Master/texmf-dist/tex/latex/animate/animate.sty index 20847c9d014..12ab6bd4289 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/03/06} +\def\@anim@version{2019/04/09} \ProvidesPackage{animate} [\@anim@version\space PDF & SVG animations from files and inline graphics] @@ -146,37 +146,52 @@ \if@anim@dvisvgm \setboolean{@anim@export}{false} - + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \AtBeginDocument{% - % Add PS and PDF file inclusion (PDF files as of dvisvgm-2.4) to and - % fix scaling/rotation/transformation in dvisvgm graphics driver - \xdef\Gin@extensions{.eps,.pdf,\Gin@extensions}% - \def\Ginclude@pdf#1{\@anim@include@psorpdf{#1}{pdffile}}% - \def\Ginclude@eps#1{\let\Gin@page\@empty\@anim@include@psorpdf{#1}{PSfile}}% - \def\@anim@include@psorpdf#1#2{% code taken from dvips.def - \message{<#1>}% - \bgroup% + % 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@\Gin@req@width \dimen@ii.1bp% - \divide\dimen@\dimen@ii% - \@tempdima\Gin@req@height% - \divide\@tempdima\dimen@ii% - \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 clip\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}}% - % BoundingBox determination (from dvipdfmx.def) + \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 + % + % + % + }% + \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 }% + \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% }% @@ -192,9 +207,13 @@ \let\@tempb\Gread@false% \ifeof\@inputcheck% \@latex@error% - {Cannot run pipe command. Try --shell-escape^^J% + {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% @@ -207,20 +226,98 @@ \repeat% \immediate\closein\@inputcheck% \fi% - }% - % PS scaling and rotation (from dvips.def) - \def\Grot@start{% - \special{ps: gsave currentpoint - currentpoint translate \Grot@angle\GPT@space neg - rotate neg exch neg exch translate}}% - \def\Grot@end{\special{ps: currentpoint grestore moveto}}% - \def\Gscale@start{\special{ps: currentpoint currentpoint translate - \Gscale@x\GPT@space \Gscale@y\GPT@space scale neg exch neg exch - translate}}% - \def\Gscale@end{\special{ps: currentpoint currentpoint translate - 1 \Gscale@x\GPT@space div 1 \Gscale@y\GPT@space div scale - neg exch neg exch translate}}% + } + \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% + \special{dvisvgm:bbox \strip@pt\Gin@req@width bp\GPT@space\strip@pt\Gin@req@height bp}% + \raise\strip@pt\Gin@req@height bp\hbox{% + \special{dvisvgm: raw + + + + + }% + }% + } + \@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 -- cgit v1.2.3