beamerbasedecode.sty
在類別的來源檔案的開頭beamer
,定義了兩個開關:
\newif\ifbeamer@anotherslide
\newif\ifbeamer@localanotherslide
透過閱讀beamerbasedecode.sty
和beamerbaseframe.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
?