2

I have the following graphics in my document:

\animategraphics[controls={step},width=\linewidth]{0}{picture}{0}{2}

that let's the user to view or "scroll" over the three images picture0.png, picture1.png and picture2.png.

Can I add some kind of a label that tells the user which picture is viewed, out of the total images that appear in this animategraphics (something like 1/3, 2/3, 3/3)?

tush
  • 1,115
  • Looking at the animate documentation, animate has a label options for \animategraphics that could possibly be used. –  Apr 22 '22 at 18:38
  • 1
    @LaccaseTVersicolor I don't think it is related to what I asked about it. label make the object accesible as js property or method. I am talking about adding a visual label. – tush Apr 22 '22 at 19:11

1 Answers1

2

To add a visual label, e. g. in the lower right corner, use the animateinline environment:

\documentclass{article}

\usepackage{animate} \usepackage{graphicx}

\begin{document}

\noindent% \begin{animateinline}[controls=step]{1} \multiframe{3}{i=0+1,ii=1+1}{ % zero-based and one-based counters \includegraphics[width=\linewidth]{picture\i}% \makebox[0pt][r]{\raisebox{-\totalheight}{\ii/3}} } \end{animateinline}

\end{document}

or in the top right corner. Just play with box commands:

\documentclass{article}

\usepackage{animate} \usepackage{graphicx}

\begin{document}

\noindent% \begin{animateinline}[controls=step]{1} \multiframe{3}{i=0+1,ii=1+1}{ % zero-based and one-based counters \raisebox{\depth}{% \raisebox{-\height}{\includegraphics[width=\linewidth]{picture\i}}% \makebox[0pt][r]{\raisebox{\depth}{\strut\ii/3}}% }
} \end{animateinline}

\end{document}

AlexG
  • 54,894
  • Thanks very much for the quick reply! Can you also explain how to add such a visual label on top of the picture? For example at relative coordinate (0.2,0.4) on the picture? I haven't asked about it in the OP. I was quite general in my question. – tush Apr 22 '22 at 19:36
  • I am terribly sorry, but my pictures I want to include are actually pic01.png, pic02.png, pic03.png, ..., pic13.png, all located at ./figures/ directory. Can you please amend the code for the counters to fit this type of file names? – tush Apr 23 '22 at 12:32
  • You can use my zero-padding command: \includegraphics{pic\zeropad{00}{\i}} for two-digits zero-padded numbers. – AlexG Apr 23 '22 at 13:58
  • Thanks. If the first file is pic01, then do I need to make any changes to the i=0+1 of the \multiframe command? – tush Apr 23 '22 at 14:56
  • Ah yes, since the pictures are numbered in a one-based fashion now, the counter i isn't needed anymore. You can remove it in the 2nd argument of \multiframe and use \ii in the \zeropad macro. – AlexG Apr 23 '22 at 16:12
  • Sorry, but what is the argument I need to give for the second argument? Just i? – tush Apr 23 '22 at 16:37
  • Only the one-based counter \ii is needed. Use it for both, pic\zeropad{00}{\ii} and label \ii/3. The zero-based counter isn't needed anymore, remove its declaration i=0+1. – AlexG Apr 23 '22 at 18:48