# Self-scrolling formulas and text in Beamer?

For a presentation with Beamer, I would like to have a slide where a long list of formulas (maybe mixed with text) scrolls automatically within a certain part of the slide. This should look like e.g. closing credits in movies.

I have tried the idea from here based on animateinline from the animate package, but whenever I use environments like $$...$$ or commands like \textcolor{red}{...} I get an error:

TeX capacity exceeded, sorry [main memory size=3000000]. \end{frame}


Ideally, the formulas/the text should be given within the document itself, but if a solution with an external PDF works fine, I'll take it!

Any ideas how that might work?

Synopsis:

%put a longer paragraph of text in a box
\newsavebox\lipsumbox
\begin{lrbox}{\lipsumbox}%
\begin{minipage}{\textwidth}%
\strut
\lipsum
\strut
\end{minipage}
\end{lrbox}

%scroll the box content within a viewport of limited height
\smoothscroll[autoplay]{\lipsumbox}{0.93\textheight}{400}{25}


Usage:

\smoothscroll[autoplay]
{<box number>}       %filled box
{<viewport height>}
{<steps>}            %increase to enhance smoothness
{<steps per sec>}    %adjust scrolling speed (not more than 25)


Complete example:

\documentclass[a5paper]{scrartcl}
\usepackage{lipsum}
\usepackage{animate}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{xsavebox}
\newcommand\smoothscroll[5][]{%
% [#1] autoplay
% #2 <boxnum>
% #3 <viewport height>
% #4 <steps>
% #5 <steps per sec>
\edef\mywd{\the\wd#2}%
\edef\myht{\the\ht#2}%
\edef\mytht{\the\dimexpr\ht#2+\dp#2\relax}%
\xsavebox{scrollbox}{\usebox{#2}}% make re-usable PDF XObject
\edef\portht{\the\dimexpr#3\relax}%
\begin{animateinline}[#1,width=\mywd,height=\portht,loop]{#5}
\multiframe{#4}{dRaiseLen=-\myht+\dimexpr(\mytht+\portht)/#4\relax}{%
\begin{minipage}[b][#3][b]{\mywd}%
\raisebox{\dRaiseLen}[0pt][0pt]{\thescrollbox}%
\end{minipage}%
}%
\end{animateinline}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}\huge
\newsavebox\lipsumbox
\begin{lrbox}{\lipsumbox}%
\begin{minipage}{\textwidth}
\strut Lipsum:\\

\lipsum[1]
$$E=mc^2$$
\centerline{* * *}\strut
\end{minipage}
\end{lrbox}

\noindent Read this if you can:\\[1ex]
\smoothscroll[autoplay]{\lipsumbox}{0.93\textheight}{400}{25}
\end{document}

• That's exactly what I was looking for. Thanks for figuring this out for me! Great job. Nov 7, 2014 at 19:53
• This now is giving an error. Can you update the code? Missing number, treated as zero. ...utoplay]{\mybox}{0.93\textheight}{400}{25} Oct 10, 2020 at 13:48
• +1 This is amazing! Should be part of the animate package. Feb 15 at 14:06
• @Dr.ManuelKuehner Maybe as an example in the manual. (I am a bit of reluctant to extend the package's interface with specialised commands.) Feb 15 at 14:15
• Joking: Or creating a new package called "movie credits". Feb 15 at 14:20