summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/animate
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-03-25 03:01:53 +0000
committerNorbert Preining <norbert@preining.info>2020-03-25 03:01:53 +0000
commite32477e40d853a81951c9811f8554455dbff4014 (patch)
tree12744b350742c71cbb3c768354084a5c50369ce7 /macros/latex/contrib/animate
parente9af7499b89170ca5c737240b0cdb9563dcf6c5a (diff)
CTAN sync 202003250301
Diffstat (limited to 'macros/latex/contrib/animate')
-rw-r--r--macros/latex/contrib/animate/ChangeLog8
-rw-r--r--macros/latex/contrib/animate/README.md1
-rw-r--r--macros/latex/contrib/animate/animate.pdfbin3925892 -> 3909425 bytes
-rw-r--r--macros/latex/contrib/animate/animate.sty247
-rw-r--r--macros/latex/contrib/animate/animate.tex49
5 files changed, 105 insertions, 200 deletions
diff --git a/macros/latex/contrib/animate/ChangeLog b/macros/latex/contrib/animate/ChangeLog
index c2965e0508..55ece87d2e 100644
--- a/macros/latex/contrib/animate/ChangeLog
+++ b/macros/latex/contrib/animate/ChangeLog
@@ -1,3 +1,11 @@
+2020-03-24
+ * new: option `controlsaligned' extended for refined adjustment of
+ horizontal position
+
+2020-03-23
+ * new: option `controlsaligned' for changing horizontal position of
+ animation controls
+
2019-12-03
* fix: another occurrence of quotes issue, now fixed at a central place
diff --git a/macros/latex/contrib/animate/README.md b/macros/latex/contrib/animate/README.md
index 03fc9e0523..b91efeaad2 100644
--- a/macros/latex/contrib/animate/README.md
+++ b/macros/latex/contrib/animate/README.md
@@ -29,6 +29,7 @@ width=<h-size>, height=<v-size>, totalheight=<v-size>,
keepaspectratio, scale=<factor>, nomouse,
hiresbb,pagebox,interpolate,
autopause, autoplay, autoresume, controls[=all | none | ...],
+controlsaligned=left[+<indent>] | center | right[+<indent>],
final, draft,
buttonsize=<size>,
buttonbg=<colour>, buttonfg=<colour>, buttonalpha=<opacity>,
diff --git a/macros/latex/contrib/animate/animate.pdf b/macros/latex/contrib/animate/animate.pdf
index 0ed8c00b69..da8dc82801 100644
--- a/macros/latex/contrib/animate/animate.pdf
+++ b/macros/latex/contrib/animate/animate.pdf
Binary files differ
diff --git a/macros/latex/contrib/animate/animate.sty b/macros/latex/contrib/animate/animate.sty
index 47c4d19d6f..a5c45e8316 100644
--- a/macros/latex/contrib/animate/animate.sty
+++ b/macros/latex/contrib/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]{%
diff --git a/macros/latex/contrib/animate/animate.tex b/macros/latex/contrib/animate/animate.tex
index 0a178a58f4..684d9216df 100644
--- a/macros/latex/contrib/animate/animate.tex
+++ b/macros/latex/contrib/animate/animate.tex
@@ -161,6 +161,7 @@ draft
final
controls[=(all|true|on) |
(none|false|off) | {[play][,step][,stop][,speed]}]
+controlsaligned=left[+<indent>] | center | right[+<indent>]
width=<h-size>
height=<v-size> | totalheight=<v-size>
keepaspectratio
@@ -343,6 +344,14 @@ controls=(none | false | off) | {[play][,step][,stop][,speed]}
\end{verbatim}
Inserts control buttons below the animation widget. Visibility of buttons can be fine-tuned through optional keys. By default, if setting `\verb+controls+' alone, all available buttons are shown, while any of `\verb+none+', `\verb+false+' or `\verb+off+' suppresses them altogether. A comma-separated selection from `\verb+play+', `\verb+step+', `\verb+stop+' and `\verb+speed+' enables corresponding pairs or groups of buttons. Such a comma list must be enclosed in braces, i.\,e. \verb+controls={..., ..., ...}+. If all buttons are shown, their meaning is as follows, from left to right: stop \& first frame, step backwards, play backwards, play forwards, step forwards, stop \& last frame, decrease speed, default speed, increase speed. Both `play' buttons are replaced by a large `pause' button while the animation is playing.
\begin{verbatim}
+controlsaligned=left[+<indent>] | center | right[+<indent>]
+\end{verbatim}
+Animation controls are centred below the animation widget by default. With this option one can choose between centred, flush-left or flush-right alignment. The optional \verb+<indent>+ inserts additional horizontal space that pushes the control buttons away from the left or right edge of the animation widget towards the opposite side. \verb+<indent>+ must be a valid \TeX{} dimension. Negative values may be used, as in
+\begin{verbatim}
+ controlsaligned=right+-4em,
+\end{verbatim}
+in which case control buttons protrude beyond the animation's right vertical edge by \verb+4em+.
+\begin{verbatim}
buttonsize=<size>
\end{verbatim}
Changes the control button height to \verb+<size>+, which must be a valid \TeX{} dimension. The default button height is \verb+1.44em+ and thus scales with the current font size.
@@ -913,7 +922,7 @@ A timeline file, written on-the-fly, is used to assemble the curve segments fram
\noindent\begin{animateinline}[
timeline=lorenz.tln,
controls,poster=last,
- begin={\begin{pspicture}(-39,-13)(39,60)},
+ begin={\begin{pspicture}(-36,-13)(36,55)},
end={\end{pspicture}}
]{10}
%coordinate axes
@@ -1317,18 +1326,16 @@ dt dt Tm nT mul { % pop
\end{document}
\end{lstlisting}
-\section{Producing animated SVG}
-Thanks to Martin Gieseking's `\verb+dvisvgm+' utility~\cite{dvisvgm} that ships with all major \TeX{} distributions, package `animate' can produce self-contained animated SVG, with all the bits and pieces already included that are necessary to run in modern Web browsers as standalone files or as embedded objects within a Web page made of HTML. Animations have the same look and usability, including optional control buttons, as if they were embedded in a PDF document. Animated SVG even work on mobile devices.
+\section{Animated SVG}
+Thanks to Martin Gieseking's \verb+dvisvgm+ utility~\cite{dvisvgm} that ships with all major \TeX{} distributions, package `animate' can produce self-contained animated SVG, with all the bits and pieces already included that are necessary to run in modern Web browsers as standalone files or as embedded objects within a Web page made of HTML. Animations have the same look and usability, including optional control buttons, as if they were embedded in a PDF document. Animated SVG even work on mobile devices.
-As `\verb+dvisvgm+' is linked against the Ghostscript library, it can parse and convert embedded PostScript to inline SVG code. It is therefore compatible with the popular TikZ and PSTricks \LaTeX{} packages.
+As \verb+dvisvgm+ is linked against the Ghostscript library, it can parse and convert embedded PostScript to inline SVG code. It is therefore compatible with the popular TikZ and PSTricks \LaTeX{} packages.
-SVG is a single-page graphics format. Therefore, it is most useful to first produce DVI with a single animation per file or page. Then, `\verb+dvisvgm+' converts every page of the DVI input to a standalone animated SVG file. Use the `article' document class and pass `\verb+dvisvgm+' as a global option. In this way, it gets conveyed to `animate' and other packages to be loaded, such as `graphicx' or TikZ. Note that the `standalone' document class is not required; `\verb+dvisvgm+' already computes the tightly enclosing bounding box around the page content by default. If `standalone' is still to be used, `\verb+preview+' must be added as a global document class option.
+SVG is a single-page graphics format. Therefore, it is recommended to produce documents with a single animation per file or page. Thereafter, \verb+dvisvgm+ converts every page of the DVI input to a standalone animated SVG file. You may want to use the `standalone' document class for creating standalone SVG animations. Pass `\verb+dvisvgm+' as a global document class option. In this way, it gets conveyed to `animate' and other packages to be loaded, such as `graphicx' or TikZ.
The following code may serve as a template for generating standalone animated SVG:
\begin{lstlisting}
-\documentclass[dvisvgm]{article}
-
-\pagestyle{empty} % suppress page number
+\documentclass[dvisvgm]{standalone}
\usepackage{animate}
\usepackage{graphicx}
@@ -1340,7 +1347,6 @@ The following code may serve as a template for generating standalone animated SV
%\usepackage{tikz}
\begin{document}
-\begin{center}
%
% \animategraphics{..}{...}{...}{...}
@@ -1350,33 +1356,34 @@ The following code may serve as a template for generating standalone animated SV
% \begin{animateinline}{..} ... \end{animateinline}
%
-\end{center}
\end{document}
\end{lstlisting}
-Note that when animating external graphics with \verb+\animategraphics+, only PDF and PostScript (EPS, PS, MPS) files are converted to inline SVG code; files in other formats (SVG, PNG, JPEG) remain external and must be bundled with the final SVG output. Also note that PostScript files must have all required fonts embedded. This is not always the case for \MP-generated PostScript. Here, embedding of fonts is ensured by putting `\verb+prologues := 3;+' into the header of the \MP{} input. Unfortunately, animating PDF and PostScript files with \verb+\animategraphics+ is limited to vector graphics. If such files contain bitmapped content they must be converted to PNG (or JPEG, if photographs). Of course, these files remain external to the final animated SVG.
+Note that when animating external graphics with \verb+\animategraphics+, only PDF and PostScript (EPS, PS, MPS) files are converted to inline SVG code; files in other formats (SVG, PNG, JPEG) remain external and must be bundled with the final SVG output. Thus, for obtaining self-contained SVG, it is recommended to convert PNG, JPEG and SVG files to PDF or PostScript first. Also note that PostScript files must have all required fonts embedded. This is not always the case for \MP-generated PostScript. Here, embedding of fonts is ensured by putting `\verb+prologues := 3;+' into the header of the \MP{} input.
Use one of
\begin{verbatim}
latex
platex
-lualatex --output-format=dvi
+dvilualatex
xelatex -no-pdf
\end{verbatim}
to produce DVI or XDV output from the \LaTeX{} source. After this, SVG is obtained by running
\begin{verbatim}
-dvisvgm --font-format=woff --exact --zoom=-1
+dvisvgm --font-format=woff --exact --zoom=-1 --page=1,- --optimize ...
\end{verbatim}
on the intermediate DVI or XDV file.
-Option `\verb+--font-format=woff+' (or `\verb+--font-format=woff2+') prompts `\verb+dvisvgm+' to embed document fonts in a format that is understood by Web browsers. It ensures that typeset text looks as in normal PDF output.
+Option `\verb+--font-format=woff+' (or `\verb+--font-format=woff2+') prompts \verb+dvisvgm+ to embed document fonts in a format that is understood by Web browsers. It ensures that typeset text looks as in normal PDF output.
-Option `\verb+--exact+' tells `\verb+dvisvgm+' to calculate exact bounding boxes around font glyphs. This avoids clipping of glyphs in the SVG output, as glyphs usually tend to be slightly bigger than their boxes defined in the font files.
+Option `\verb+--exact+' tells \verb+dvisvgm+ to calculate exact bounding boxes around font glyphs. This avoids clipping of glyphs in the SVG output, as glyphs usually tend to be slightly bigger than their boxes defined in the font files.
The purpose of `\verb+--zoom=-1+' is to produce responsive SVG. If embedded in a Web page, this kind of SVG will automatically scale to fill up the available space of its surrounding container, usually an \verb+<object>+ tag (see below). If viewed standalone in a Web browser, a responsive SVG fills up the complete browser tab.
-By default, `\verb+dvisvgm+' processes only the very first page of the input file. To convert multipage DVI/XDV with several animations, add option `\verb+-p1,-+'.
+By default, \verb+dvisvgm+ processes only the very first page of the input file. To convert multipage DVI/XDV with several animations, add option `\verb+--page=1,-+'.
+
+With option `\verb+--optimize+', \verb+dvisvgm+ applies several optimizations to reduce the output file size.
-As SVG derives from XML it is not known to be particularly economical in terms of file size. Compressed SVG, with file extension `\verb+svgz+', shortens download times and is supported by most Web browsers. It can be generated by adding option `\verb+-z+'. Also, option `\verb+--precision=1+' may be used to reduce the SVG file size. It limits the precision of floating point numbers, such as coordinates, to one decimal figure.
+As SVG derives from XML it is not known to be particularly economical in terms of file size. Compressed SVG, with file extension `\verb+svgz+', shortens download times and is supported by most Web browsers. It can be generated by adding option `\verb+-z+'. Also, option `\verb+--precision=1+' may be used to reduce the SVG file size. It limits the precision of floating point numbers, such as coordinates, to one decimal figure. Sometimes, animations may behave stangely after applying this option. Then, of course, it should be omitted.
The recommended way to include animated SVG into HTML is to use the \verb+<object>+ tag. The \verb+<img>+ tag does not work here, as it ignores the embedded JavaScript. However, it may still be used as fallback. Also, it allows for search engine indexing, if desired:
\begin{lstlisting}
@@ -1395,10 +1402,6 @@ In \TeX4ht documents, the whole \verb+<object>...</object>+ tag can be inserted
\item Animated SVG is best viewed in Web browsers that are based on the Blink rendering engine. The most prominent representatives are Chrome, its open-source base Chromium and Opera. Unfortunately, Firefox is very slow.
-% \item Animations may run very slowly if viewed in the Acrobat Reader web-browser plugin. Instead, open the PDF locally in the Reader application for best results.
-
-% \item The Acrobat Reader setting `Use page cache' (menu `Edit' $\rightarrow$ `Preferences' $\rightarrow$ `Startup') should be \emph{dis}abled for version 7, while remaining \emph{en}abled beginning with version 8 (menu `Edit' $\rightarrow$ `Preferences' $\rightarrow$ `Page Display' $\rightarrow$ `Rendering').
-
\item The \verb+dvips+ option `\verb+-Ppdf+' should be avoided entirely or followed by something like `\verb+-D 1200+' on the command line in order to set a sensible DVI resolution. This does \emph{not} degrade the output quality! The configuration file `config.pdf' loaded by option `\verb+-Ppdf+' specifies an excessively high DVI resolution that will be passed on to the final PDF. Eventually, Acrobat Reader gets confused and will not display the frames within the animation widget.
\item Animations do not work if the PDF was produced with Ghostscript versions older than 9.15.
@@ -1427,7 +1430,7 @@ In \TeX4ht documents, the whole \verb+<object>...</object>+ tag can be inserted
into the editor window that opens, save the file and quit the editor.
\item\label{item:laststep} To rebuild the format, enter\\
{\tt initexmf -{}-dump=latex}
- \item Repeat steps \ref{item:firststep}--\ref{item:laststep} with config files `{\tt pdflatex}' and `{\tt xelatex}'
+ \item Repeat steps \ref{item:firststep}--\ref{item:laststep} with config files {\tt pdflatex} and {\tt xelatex}
\end{enumerate}
\TeX\ Live:
@@ -1450,7 +1453,7 @@ In \TeX4ht documents, the whole \verb+<object>...</object>+ tag can be inserted
\end{itemize}
\section{Acknowledgements}
-I would like to thank François Lafont who discovered quite a few bugs and made many suggestions that helped to improve the functionality of the package. Many thanks to Jin-Hwan Cho, the developer of `\verb+dvipdfmx+', for contributing the `\verb+dvipdfmx+' specific code, and to Walter Scott for proof-reading the documentation.
+I would like to thank François Lafont who discovered quite a few bugs and made many suggestions that helped to improve the functionality of the package. Many thanks to Jin-Hwan Cho, the developer of \verb+dvipdfmx+, for contributing the \verb+dvipdfmx+ specific code, and to Walter Scott for proof-reading the documentation.
\begin{thebibliography}{8}
\bibitem{chupin} Chupin, M.: \emph{Syracuse MetaPost/Animations.} URL: \href{http://melusine.eu.org/syracuse/metapost/animations/chupin/?idsec=scara}{\url{http://melusine.eu.org/}} \href{http://melusine.eu.org/syracuse/metapost/animations/chupin/?idsec=scara}{\url{syracuse/metapost/animations/chupin/?idsec=scara}}