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

相關內容