beamerbasedecode.sty 中的 \ifbeamer@anotherslide 和 \ifbeamer@localanotherslide

beamerbasedecode.sty 中的 \ifbeamer@anotherslide 和 \ifbeamer@localanotherslide

beamerbasedecode.sty在类的源文件的开头beamer,定义了两个开关:

\newif\ifbeamer@anotherslide
\newif\ifbeamer@localanotherslide

通过阅读beamerbasedecode.stybeamerbaseframe.sty,我了解到\ifbeamer@anotherslide:在每个frame环境中,beamer调用\beamer@masterdecode,和\beamer@masterdecode都会改变开关\ifbeamer@anotherslide。虽然这是真的,但beamer会一次又一次地调用\beamer@masterdecode,最后生成框架中的所有幻灯片。

在里面\beamerbasedecode.sty,似乎\ifbeamer@anotherslide\ifbeamer@localanotherslide总是具有相同的值:

\global\beamer@anotherslidetrue\beamer@localanotherslidetrue

唯一的区别是\global第一个之前的。但在主宏中\beamer@masterdecode,第二个也是全局的。

\def\beamer@stoptexts{| stop:0| }
{
   \catcode`\|=13
   \catcode`\:=13
   \catcode`\,=13
   \catcode`\.=13
   \catcode`\+=13
   \catcode`\-=13
   \catcode`\(=13
   \catcode`\)=13
   \catcode`\ =13
\gdef\beamer@masterdecode#1{% must be called within a group
\ifnum\catcode`\|=13\edef|{\string|}\fi%
\ifnum\catcode`\:=13\edef:{\string:}\fi%
\ifnum\catcode`\,=13\edef,{\string,}\fi%
\ifnum\catcode`\.=13\edef.{\string.}\fi%
\ifnum\catcode`\+=13\edef+{\string+}\fi%
\ifnum\catcode`\-=13\edef-{\string-}\fi%
\ifnum\catcode`\(=13\edef({\string(}\fi%
\ifnum\catcode`\)=13\edef){\string)}\fi%
\ifnum\catcode`\ =13\edef {\string }\fi%
\edef\beamer@@@temp{#1\beamer@stoptexts}%
\beamer@localanotherslidefalse%
\setbox0=\hbox{%
\expandafter\beamer@decode\beamer@@@temp%
\ifbeamer@localanotherslide\global\beamer@localanotherslidetrue\fi}%
}%

\ifbeamer@anotherslide这让我很困惑:和之间有什么区别\ifbeamer@localanotherslide? 为什么我们需要\ifbeamer@localanotherslide

相关内容