Latex Beamer:允许使用脚注进行框架中断

Latex Beamer:允许使用脚注进行框架中断

我创建了一个简单的 Latex Beamer 文档,如下所示:

\documentclass{beamer}

\usepackage{default}

\begin{document}

\begin{frame}[allowframebreaks]\frametitle{Pages}
    \begin{itemize}
        \item First page\footnote{some text}
    \end{itemize}
\newpage
    \begin{itemize}
        \item next page
    \end{itemize}
\end{frame}
\end{document}

它使用具有属性的框架允许框架中断。第一页有脚注,但它打印在帧序列的最后一页上。我知道这是指定的目标行为,但可以改变这一点吗?我希望将脚注放在它应该在的同一张幻灯片上。

谢谢。

答案1

Beamer处理的流程allowframebreaks如下

  • 收集页面上的所有材料(包括脚注);
  • 排版材料并放入一个\vbox叫做的\beamer@framebox
    • 同时,脚注被放入一个名为的框中\beamer@footins
  • 如果\beamer@framebox少于一页,则寄出此箱;
    • 如果没有,\vsplit盒子和发货一页;
    • 循环直至\beamer@framebox空;
  • \beamer@footins于最后一页。

我们从上述过程中学到的教训是,我们不知道哪个脚注项属于哪个页面。所以我们有三个选择

  • 将所有脚注放在最后一页;这是默认行为;
  • 把所有脚注都放在第一页;这太愚蠢了;
  • 把所有的脚注放在每一页上;这值得一试。

以下是原始定义

\def\beamer@autobreakframebox{%
  \global\setbox\beamer@splitbox=\box\voidb@x%
  \ifbeamer@autobreak%
    % Ok, frame was overful -> split it!
    \setbox\@tempboxa=\vsplit\beamer@framebox to\beamer@autobreakfactor\textheight%
    \global\setbox\beamer@splitbox=\box\beamer@framebox%
    \@tempdima=\ht\beamer@splitbox%
    \ifdim\@tempdima<\beamer@autobreaklastheight%
      \global\beamer@autobreaklastheight=\@tempdima\relax%
    \else%
      \setbox\@tempboxa=\vbox{\unvbox\@tempboxa\unvbox\beamer@splitbox}%
      \global\setbox\beamer@splitbox=\box\voidb@x%
    \fi%
    \setbox\beamer@framebox=\vbox to\textheight{\unvbox\@tempboxa%
      \vskip\beamer@framebottomskipautobreak%
      \ifvoid\beamer@splitbox%
        \ifvoid\beamer@footins%
        \else%
          \begingroup
            \usebeamercolor*[fg]{footnote}%
            \footnoterule%
            \unvbox \beamer@footins%
            \global\setbox\beamer@footins=\box\voidb@x%
          \endgroup  
        \fi%
      \fi%
      \beamer@exitcode%
    }%
  \else%
    \setbox\beamer@framebox=\vbox to\textheight{\unvbox\beamer@framebox%
      \vskip\beamer@framebottomskip%
      \ifvoid\beamer@footins%
      \else%
        \begingroup
          \usebeamercolor*[fg]{footnote}%
          \footnoterule%
          \unvbox \beamer@footins%
          \global\setbox\beamer@footins=\box\voidb@x%
        \endgroup 
      \fi%
      \beamer@exitcode}%
    \global\setbox\beamer@footins=\box\voidb@x%
  \fi%
  }

我们可以修改脚注部分如下

\def\beamer@autobreakframebox{%
  \global\setbox\beamer@splitbox=\box\voidb@x%
  \ifbeamer@autobreak%
    % Ok, frame was overful -> split it!
    \setbox\@tempboxa=\vsplit\beamer@framebox to\beamer@autobreakfactor\textheight%
    \global\setbox\beamer@splitbox=\box\beamer@framebox%
    \@tempdima=\ht\beamer@splitbox%
    \ifdim\@tempdima<\beamer@autobreaklastheight%
      \global\beamer@autobreaklastheight=\@tempdima\relax%
    \else%
      \setbox\@tempboxa=\vbox{\unvbox\@tempboxa\unvbox\beamer@splitbox}%
      \global\setbox\beamer@splitbox=\box\voidb@x%
    \fi%
    \setbox\beamer@framebox=\vbox to\textheight{\unvbox\@tempboxa%
      \vskip\beamer@framebottomskipautobreak%
      \ifvoid\beamer@footins%                          MODIFIED
      \else%                                           MODIFIED
        \begingroup%                                   MODIFIED
          \usebeamercolor*[fg]{footnote}%              MODIFIED
          \footnoterule%                               MODIFIED
          \unvcopy \beamer@footins%                    MODIFIED
        \endgroup%                                     MODIFIED
      \fi%                                             MODIFIED
      \ifvoid\beamer@splitbox%                         MODIFIED
          \global\setbox\beamer@footins=\box\voidb@x%  MODIFIED
      \fi%                                             MODIFIED
      \beamer@exitcode%
    }%
  \else%
    \setbox\beamer@framebox=\vbox to\textheight{\unvbox\beamer@framebox%
      \vskip\beamer@framebottomskip%
      \ifvoid\beamer@footins%
      \else%
        \begingroup
          \usebeamercolor*[fg]{footnote}%
          \footnoterule%
          \unvbox \beamer@footins%
          \global\setbox\beamer@footins=\box\voidb@x%
        \endgroup 
      \fi%
      \beamer@exitcode}%
    \global\setbox\beamer@footins=\box\voidb@x%
  \fi%
  }

然后我们实现以下

PS. 这里讨论了奇怪/可怕的跳跃现象:beamer:使用列表(itemize、enumerate 等)时允许框架中断选项和垂直间距

相关内容