对于使用 Beamer 的演示,我希望幻灯片中有一长串公式(可能与文本混合)在幻灯片的某个部分自动滚动。这应该看起来像电影中的片尾字幕。
我已经尝试过这里
基于animateinline
动画包,但每当我使用类似的环境\begin{equation} ... \end{equation}
或类似的命令时\textcolor{red}{...}
,我都会收到错误:
TeX capacity exceeded, sorry [main memory size=3000000]. \end{frame}
理想情况下,公式/文本应该在文档本身中给出,但如果带有外部 PDF 的解决方案可以正常工作,我会接受它!
有什么想法可以实现吗?
答案1
概要:
%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}
用法:
\smoothscroll[autoplay]
{<box number>} %filled box
{<viewport height>}
{<steps>} %increase to enhance smoothness
{<steps per sec>} %adjust scrolling speed (not more than 25)
完整示例:
\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]
\begin{equation}
E=mc^2
\end{equation}
\centerline{* * *}\strut
\end{minipage}
\end{lrbox}
\noindent Read this if you can:\\[1ex]
\smoothscroll[autoplay]{\lipsumbox}{0.93\textheight}{400}{25}
\end{document}