Source

beamer / base / beamerbaseframe.sty

Full commit
Odjel za informa… 165210f 

Joseph Wright 70f9d84 
Till Tantau 90e8502 







Vedran Miletić 25f85d5 
Till Tantau 32e874f 
Vedran Miletić efa082c 

Till Tantau 32e874f 
Till Tantau 3a4f548 
Till Tantau 456f36e 
Till Tantau a9b818e 



Till Tantau 3a4f548 
Till Tantau 3c00f07 




Joseph Wright 5fc3b3d 

Till Tantau 3c00f07 

Joseph Wright 1a3bb02 


Till Tantau 3a4f548 
Till Tantau 32e874f 

















Till Tantau 87b396e 



Vedran Miletić 5a25f58 
Till Tantau 87b396e 
Till Tantau 13fcdbc 
Till Tantau b4c81f9 
Till Tantau 32e874f 
Joseph Wright c68b4f3 
Till Tantau 3a4f548 
Till Tantau 7fec35d 
Till Tantau 32e874f 

Vedran Miletić a5daeed 

Till Tantau 3a4f548 
Till Tantau 32e874f 
Till Tantau 456f36e 
Till Tantau a9b818e 

Till Tantau 94b0ba1 
Till Tantau a9b818e 




Till Tantau 32e874f 
Till Tantau 3a4f548 
Till Tantau 7fec35d 
Till Tantau 94d4fb1 
Till Tantau 3c00f07 
Till Tantau 98f41ae 
Till Tantau 456f36e 
Joseph Wright 1a3bb02 
Till Tantau 456f36e 




Till Tantau a9b818e 








Till Tantau 97579e2 





Till Tantau 3589091 
Till Tantau 6a8f2b4 
Till Tantau 8973d8d 

Joseph Wright 1443917 

Till Tantau 7fec35d 
Till Tantau 456f36e 




Till Tantau 47a5615 
Till Tantau 456f36e 

Till Tantau a9b818e 






Till Tantau 9f771b5 
Till Tantau 456f36e 


Vedran Miletić 5a25f58 
Till Tantau a9b818e 


Till Tantau d733040 






Till Tantau 94b0ba1 
Till Tantau a9b818e 
Till Tantau 94b0ba1 
Till Tantau a9b818e 
Till Tantau 94d4fb1 
Till Tantau a9b818e 



Till Tantau 13fcdbc 
Till Tantau 94d4fb1 
Till Tantau 7fec35d 
Till Tantau 5db2abe 
Till Tantau 32e874f 
Till Tantau 8973d8d 




Till Tantau 712849f 
Till Tantau 8973d8d 



Till Tantau 32e874f 
Till Tantau 456f36e 

Till Tantau 32e874f 

Vedran Miletić 5a25f58 
Till Tantau 32e874f 
Vedran Miletić 5a25f58 
Till Tantau 32e874f 


Vedran Miletić 5a25f58 
Till Tantau 32e874f 


Vedran Miletić 5a25f58 
Till Tantau 32e874f 





Till Tantau a9b818e 
Till Tantau 3efe45f 


Till Tantau 32e874f 











Till Tantau 13fcdbc 










Till Tantau 32e874f 
Till Tantau 94b0ba1 





Till Tantau d733040 

Till Tantau 94b0ba1 

Till Tantau 32e874f 


Till Tantau 13fcdbc 





Till Tantau a9b818e 


Till Tantau bb45d55 

Till Tantau acaadf1 
Till Tantau 3baf135 
Till Tantau bb45d55 


Till Tantau 3baf135 
Vedran Miletić 5a25f58 
Till Tantau 088c16f 
Till Tantau d733040 



Till Tantau 6a8f2b4 
Till Tantau 088c16f 

Till Tantau 9c1af5b 
Till Tantau 94b0ba1 
Till Tantau d733040 

Joseph Wright 6c3020f 
Till Tantau 088c16f 

Till Tantau 94b0ba1 

Till Tantau d733040 

Till Tantau 6a8f2b4 
Till Tantau 088c16f 
Vedran Miletić d5368d5 





Till Tantau 3baf135 
Till Tantau 32e874f 
Till Tantau 07b66c7 

Till Tantau 69c0c27 
Till Tantau 3baf135 
Till Tantau 94d4fb1 
Till Tantau 456f36e 
Till Tantau a9b818e 
Till Tantau 94b0ba1 
Till Tantau 32e874f 
Till Tantau 3589091 
Till Tantau fdbdf3d 
Till Tantau 32e874f 
Till Tantau fdbdf3d 









Till Tantau 7c32e88 

Till Tantau fdbdf3d 











Till Tantau 7c32e88 
Till Tantau fdbdf3d 

Till Tantau 7c32e88 






Vedran Miletić 5a25f58 
Till Tantau 7c32e88 

Till Tantau fdbdf3d 

Till Tantau 7c32e88 
Till Tantau fdbdf3d 
Till Tantau 7c32e88 
Till Tantau fdbdf3d 

Till Tantau 7c32e88 




Till Tantau fdbdf3d 



Till Tantau b4c81f9 
Till Tantau fdbdf3d 
























Till Tantau bb45d55 






Till Tantau fdbdf3d 





Vedran Miletić 5a25f58 
Till Tantau fdbdf3d 


Till Tantau b98fd17 
Till Tantau b4c81f9 
Till Tantau 3c00f07 
Till Tantau b4c81f9 

Till Tantau 32e874f 








Till Tantau 3c00f07 
Till Tantau 32e874f 

Till Tantau b4c81f9 



Joseph Wright dcd8466 
Till Tantau b4c81f9 
Till Tantau 32e874f 
Till Tantau b4c81f9 

Joseph Wright dcd8466 
Till Tantau 4cf2f00 
Till Tantau b934697 
Till Tantau 63bd10a 

Till Tantau 13fcdbc 
Till Tantau 94d4fb1 
Till Tantau 456f36e 
Till Tantau 9afeae6 
Till Tantau 94d4fb1 
Till Tantau b988ea7 
Till Tantau a9b818e 
Till Tantau 69c0c27 
Till Tantau 3baf135 
Till Tantau 94d4fb1 
Till Tantau 456f36e 
Till Tantau a9b818e 
Till Tantau 8395f31 
Till Tantau 07b66c7 
Till Tantau 088c16f 
Till Tantau 3baf135 
Till Tantau 32e874f 
Till Tantau 63bd10a 
Vedran Miletić d5368d5 


Joseph Wright 1a3bb02 
Vedran Miletić d5368d5 
Till Tantau 32e874f 


Till Tantau 1f662a4 


Till Tantau 276233c 



Till Tantau 63bd10a 
Till Tantau 6b817b3 

Till Tantau 0a5d778 
Till Tantau 6b817b3 
Till Tantau 77c0412 





Till Tantau 6b817b3 
Till Tantau 77c0412 



Till Tantau 69c0c27 


Till Tantau 94d4fb1 


Till Tantau 3baf135 
Till Tantau acaadf1 

Till Tantau 6b817b3 


Till Tantau 63bd10a 
Till Tantau 6b817b3 
Till Tantau 3baf135 
Till Tantau bb45d55 

Joseph Wright c8fca43 


Vedran Miletić 5a25f58 
Till Tantau 6b817b3 

Till Tantau 32e874f 
Till Tantau 4cf2f00 
Till Tantau 3c00f07 
Till Tantau 4cf2f00 

Till Tantau 92f2171 
Till Tantau 4cf2f00 
Till Tantau 32e874f 

Till Tantau 1f662a4 




Till Tantau 32e874f 


Till Tantau 6b817b3 
Till Tantau 63bd10a 


Till Tantau 6b817b3 
Till Tantau 32e874f 






Till Tantau 0a5d778 
Till Tantau 32e874f 
Till Tantau f67491f 


Till Tantau 32e874f 





Till Tantau 6b817b3 

Till Tantau 995f23d 
Till Tantau 6b817b3 
Till Tantau 32e874f 

Till Tantau 995f23d 
Till Tantau 32e874f 




Till Tantau bb45d55 

Till Tantau 3baf135 
Till Tantau 5101810 
Till Tantau 712849f 

Joseph Wright 6db5df0 









Till Tantau 712849f 
Till Tantau bb45d55 
Till Tantau acaadf1 
Till Tantau 5101810 
Till Tantau 5cd6149 
Till Tantau 5101810 
Till Tantau 5cd6149 
Till Tantau 5101810 
Till Tantau bb45d55 




Till Tantau a33cdb4 
Till Tantau bb45d55 
Till Tantau 5cd6149 
Till Tantau a33cdb4 
Till Tantau 5101810 
Till Tantau 3baf135 




Till Tantau bb45d55 

Till Tantau 3baf135 



Till Tantau 94d4fb1 
Till Tantau 32e874f 
Till Tantau 3a4f548 
Till Tantau 32e874f 
Till Tantau 6b817b3 
Till Tantau 32e874f 
Till Tantau 63bd10a 

Till Tantau 6b817b3 
Vedran Miletić 5a25f58 
Till Tantau 32e874f 
Till Tantau 7fec35d 
Till Tantau 32e874f 

Till Tantau b934697 

Till Tantau 32e874f 
Till Tantau 3baf135 











Till Tantau 94d4fb1 

Till Tantau 456f36e 
Till Tantau 94d4fb1 



Joseph Wright edcfd2d 
Till Tantau 1f662a4 
Till Tantau 63bd10a 
Till Tantau 1f662a4 











Till Tantau 6b817b3 
Till Tantau 94d4fb1 



Till Tantau b934697 

Till Tantau 5db2abe 
Till Tantau fdbdf3d 
Vedran Miletić 5a25f58 
Till Tantau 3c00f07 
Till Tantau b934697 

Till Tantau 712849f 

Till Tantau 5db2abe 



Till Tantau 0a5d778 
Till Tantau 5db2abe 









Till Tantau 3c00f07 
Joseph Wright 5fc3b3d 
Till Tantau 4c6c7e3 
Till Tantau 8973d8d 

Till Tantau 5db2abe 

Till Tantau 3c00f07 
Joseph Wright 5fc3b3d 
Till Tantau 4c6c7e3 
Till Tantau 5db2abe 
Till Tantau 8973d8d 
Till Tantau 5db2abe 
Till Tantau 4c6c7e3 
Till Tantau 5db2abe 
Till Tantau 8973d8d 






Vedran Miletić 5a25f58 
Till Tantau 8973d8d 


Vedran Miletić 5a25f58 
Till Tantau 4c6c7e3 
Till Tantau 5db2abe 

Till Tantau b934697 








Till Tantau 5db2abe 


Till Tantau b934697 

Till Tantau 5db2abe 





Till Tantau 94d4fb1 





Till Tantau a33cdb4 

Till Tantau 94d4fb1 



Till Tantau 6b817b3 

Till Tantau 3c00f07 


Till Tantau 276233c 
Till Tantau 7aa5a2a 
Till Tantau 3c00f07 



Till Tantau 456f36e 


Till Tantau 3c00f07 

Till Tantau 276233c 
Till Tantau 5cdc3bd 
Till Tantau 276233c 


Till Tantau 3c00f07 




Till Tantau 6b817b3 

Till Tantau 32e874f 
Till Tantau 63bd10a 
Till Tantau 32e874f 




Till Tantau 63bd10a 
Till Tantau 32e874f 

Till Tantau b4c81f9 


Till Tantau a33cdb4 
Till Tantau b4c81f9 

Till Tantau 6b817b3 
Till Tantau b4c81f9 
Till Tantau 6b817b3 
Vedran Miletić 9d21039 
Till Tantau b4c81f9 
Till Tantau 6b817b3 

Till Tantau 32e874f 
Till Tantau b934697 

Till Tantau 5db2abe 
Till Tantau 63bd10a 

Till Tantau b4c81f9 
Till Tantau a33cdb4 
Till Tantau b4c81f9 
Till Tantau 5db2abe 


Till Tantau b934697 
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
% Copyright 2003--2007 by Till Tantau
% Copyright 2010 by Vedran Mileti\'c
% Copyright 2011 by Vedran Mileti\'c, Joseph Wright
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/licenses/LICENSE for more details.

\ProvidesPackageRCS $Header$

\mode
<presentation>

\newbox\beamer@framebox
\newbox\beamer@frametitlebox
\newbox\beamer@zoombox
\newcount\beamer@zoomcount
\newcount\beamer@zoomframecount
\newdimen\beamer@frametextheight

\mode
<all>
{
  \newif\ifbeamer@inframe
  \beamer@inframefalse
% Save!
  \let\framelatex=\frame
}

\def\refcounter#1{\protected@edef\@currentlabel%
       {\csname p@#1\endcsname\csname the#1\endcsname}}%


%
% Slide Definitions
%

\newcounter{subsectionslide}[subsection]
\renewcommand\thesubsectionslide{\@arabic\c@subsectionslide}
\def\beamer@entrycode{}
\def\beamer@exitcode{}

\def\beamer@setuplinks{%
  {%
    \def\sectionentry##1##2##3##4##5{}%
    \def\slideentry##1##2##3##4##5##6{}%
    \dohead%
  }%
}

\newenvironment{beamer@frameslide}{%
  \ifbeamer@autobreak\else%
    \ifx\beamer@againname\@empty%
      {\let\@elt\beamer@restorecounter\beamer@overlaycounterresets}%
    \else%
      {\let\@elt\beamer@labelrestorecounter\beamer@overlaycounterresets}%
    \fi%
  \fi%
  \global\c@beamerpauses=1\relax%
  \expandafter\beamer@ifempty\expandafter{\beamer@framestartpage}{%
    \stepcounter{subsectionslide}%
    \xdef\beamer@framestartpage{\the\c@page}% only first time
  }{\clearpage\beamer@notesactions}% cleanup from previous slide
  \hypersetup{pdfpagetransition=R}%
  \hypersetup{pdfpageduration=}%
  \@ifundefined{thispdfpagelabel}{}{%
  \thispdfpagelabel{\insertframenumber}}%
  \xdef\beamer@frameendpage{\the\c@page}% every time
  \beamer@setuplinks%
  \beamer@displaybreak%
  \global\setbox\beamer@zoombox=\box\voidb@x%
  \def\beamer@zoomer{}%
  \beamer@slidehaszoomfalse%
  \gdef\insertframetitle{}%
  \gdef\insertframesubtitle{}%
  \gdef\beamer@frametitle{}%
  \gdef\beamer@shortframetitle{}%
  \gdef\beamer@framesubtitle{}%
  \let\beamer@startcomment=\beamer@startcommentinframe%
  % Start slide:
  \beamer@framenotesbegin%
    \global\setbox\beamer@framebox=\vbox\bgroup%
    \beamer@inframetrue%
    \let\frame=\framelatex% inside frames, use LaTeX's \frame command
    \begin{beamer@framepauses}%
      \refcounter{framenumber}%use frame number for  \label
      \ifbeamer@shrink%
        \hsize=\beamer@shrinkfactorinv\hsize%
        \textwidth=\beamer@shrinkfactorinv\textwidth%
        \linewidth=\beamer@shrinkfactorinv\linewidth%
      \fi%
      % Insert labels if necessary:
      \ifx\beamer@againname\@empty\else%
        \nointerlineskip\vbox to0pt{\vss%
        \label<\the\beamer@slideinframe>{\beamer@againname<\the\beamer@slideinframe>}%
        \ifnum\beamer@slideinframe=1\relax%
          \label<1>{\beamer@againname}%
        \fi%
        }\nointerlineskip%
      \fi%
      \ifx\beamer@framehypertargets\@empty\else%
        \nointerlineskip\vbox to0pt{\vss%
          \beamer@framehypertargets%
          \global\let\beamer@framehypertargets\@empty%
        }\nointerlineskip%
      \fi%
      \vskip-\parskip\vbox{}%
      \beamer@initfirstlineunskip%
      \ifbeamer@plainframe\nointerlineskip\fi%
    \beamer@checkframetitle}%
    {\par
    \end{beamer@framepauses}%
  \egroup%
  \ifx\beamer@frametitle\@empty%
    \setbox\beamer@frametitlebox=\box\voidb@x%
  \else%
    \setbox\beamer@frametitlebox=\vbox{%
      \vbox{}%
      {\parskip0pt\usebeamertemplate***{frametitle}\vskip0.25em}%
    }%
  \fi%
  \ifbeamer@plainframe%
    \beamer@frametextheight=\paperheight%
  \else%
    \beamer@frametextheight=\textheight%
  \fi%
  \advance\beamer@frametextheight by-\ht\beamer@frametitlebox%
  \advance\beamer@frametextheight by-\dp\beamer@frametitlebox%
  \advance\beamer@frametextheight by-\beamer@frametopskip%
  \ifbeamer@shrink%
    \beamer@shrinkframebox%
  \fi%
  \ifx\beamer@zoomer\@empty
    \setbox\beamer@framebox=\vbox{%
      \nobreak\vbox{}\nobreak\par\nobreak\beamer@entrycode\nobreak%
      \nointerlineskip\unvbox\beamer@frametitlebox%
      \nobreak%
      \ifbeamer@autobreak%
        \vskip\beamer@frametopskipautobreak%
      \else%
        \vskip\beamer@frametopskip%
      \fi%
      \nobreak%
      \nointerlineskip\box\beamer@zoombox\nointerlineskip%
      \nobreak%
      \ifbeamer@slidehaszoom\box\beamer@framebox\else\unvbox\beamer@framebox\fi%
      % bottom skip is added in autobreakframebox
    }%
    \beamer@autobreakframebox%
  \else%
    \beamer@zoomer%
  \fi%
  \beamer@undolabels%
  \beamer@framenotesend%
  \box\beamer@framebox}


\mode
<all>
{
  \def\beamer@checkframetitle{\@ifnextchar\bgroup\beamer@inlineframetitle{}}
  \def\beamer@inlineframetitle#1{%
    \@ifnextchar\bgroup{\frametitle{#1}\framesubtitle}{\frametitle{#1}\relax}%
  }
}





%
% Resetting counters
%
\def\resetcounteronoverlays#1{%
  \@cons\beamer@overlaycounterresets{{c@#1}}%
}

\def\resetcountonoverlays#1{%
  \@cons\beamer@overlaycounterresets{{#1}}%
}

\def\beamer@overlaycounterresets{}

\resetcounteronoverlays{equation}
\resetcounteronoverlays{parentequation}
\resetcounteronoverlays{footnote}
\resetcounteronoverlays{mpfootnote}
\resetcounteronoverlays{figure}
\resetcounteronoverlays{table}
\resetcountonoverlays{beamer@zoomframecount}
\resetcounteronoverlays{ExNo}
\resetcounteronoverlays{SubExNo}
\resetcounteronoverlays{SubSubExNo}

\def\beamer@savecounter#1{%
  \@ifundefined{#1}{}%
  {\expandafter\xdef\csname saved@#1\endcsname%
    {\expandafter\the\csname #1\endcsname}}%
}
\def\beamer@restorecounter#1{%
  \@ifundefined{#1}{}%
  {\edef\temp{\csname saved@#1\endcsname}%
  \expandafter\global\csname #1\endcsname=\temp}%
}

\def\beamer@labelsavecounter#1{%
  \@ifundefined{#1}{}%
  {\expandafter\xdef\csname saved@\beamer@againname @#1\endcsname%
    {\expandafter\the\csname #1\endcsname}}%
}
\def\beamer@labelrestorecounter#1{%
  \@ifundefined{#1}{}%
  {\edef\temp{\csname saved@\beamer@againname @#1\endcsname}%
  \expandafter\global\csname #1\endcsname=\temp}%
}



%
% Skips
%
\newskip\beamer@frametopskip
\newskip\beamer@framebottomskip
\newskip\beamer@frametopskipautobreak
\newskip\beamer@framebottomskipautobreak


%
% Keys
%
\define@key{beamerframe}{label}{\def\beamer@againname{#1}%
  {\let\@elt\beamer@labelsavecounter\beamer@overlaycounterresets}%
}
\define@key{beamerframe}{relabel}{\def\beamer@againname{#1}%
  \def\beamer@undolabels{{\let\@elt\beamer@restorecounter\beamer@overlaycounterresets}}%
}
\define@key{beamerframe}{plain}[true]{%
  \beamer@plainframetrue%
  \def\beamer@frametemplate{\beamer@frametemplate@plain}}
\define@key{beamerframe}{containsverbatim}[true]{\csname beamer@containsverbatim#1\endcsname}
\define@key{beamerframe}{fragile}[true]{%
  \beamer@containsverbatimfalse%
  \beamer@isfragilefalse%
  \csname beamer@fragile#1\endcsname%
}
\def\beamer@fragilefalse{}
\def\beamer@fragiletrue{\beamer@isfragiletrue}
\def\beamer@fragilesingleslide{\beamer@containsverbatimtrue}
\define@key{beamerframe}{c}[true]{% centered
  \beamer@frametopskip=0pt plus 1fill\relax%
  \beamer@framebottomskip=0pt plus 1.5fill\relax%
  \beamer@frametopskipautobreak=0pt plus .4\paperheight\relax%
  \beamer@framebottomskipautobreak=0pt plus .6\paperheight\relax%
  \def\beamer@initfirstlineunskip{}%
}
\define@key{beamerframe}{t}[true]{% top
  \beamer@frametopskip=.2cm plus .5\paperheight\relax%
  \beamer@framebottomskip=0pt plus 1fill\relax%
  \beamer@frametopskipautobreak=\beamer@frametopskip\relax%
  \beamer@framebottomskipautobreak=\beamer@framebottomskip\relax%
  \def\beamer@initfirstlineunskip{}%
}
\define@key{beamerframe}{b}[true]{% bottom
  \beamer@frametopskip=0pt plus 1fill\relax%
  \beamer@framebottomskip=0pt\relax%
  \beamer@frametopskipautobreak=\beamer@frametopskip\relax%
  \beamer@framebottomskipautobreak=\beamer@framebottomskip\relax%
  \def\beamer@initfirstlineunskip{}%
}

\newif\ifbeamer@noframenumbering
\beamer@noframenumberingfalse

\define@key{beamerframe}{noframenumbering}[true]{\beamer@noframenumberingtrue}

\define@key{beamerframe}{environment}{\def\beamer@frameenvironmentsubst{#1}}

\define@key{beamerframe}{typeset second}[true]{\csname beamer@dosecondmode#1\endcsname}

\newif\ifbeamer@containsverbatim
\newif\ifbeamer@isfragile
\newif\ifbeamer@autobreak
\newif\ifbeamer@shrink
\newif\ifbeamer@plainframe
\newif\ifbeamer@slidehaszoom

\let\beamer@firstlineitemizeunskip\relax



%
% The frame environment (a trifle ugly...)
%

% Copyright notice: the following code is adapted from code from the
% amsmath package.

\newtoks\beamer@envbody
\def\beamer@frameenv{%
  \def\beamer@process@envbody{\endgroup%
    \expandafter\expandafter\expandafter\beamer@framecommand\expandafter\beamer@frameoptions\expandafter{\the\beamer@envbody}}%
  \global\beamer@envbody{}\def\beamer@begin@stack{b}%
  \begingroup
  \let\frame\beamer@collect@@body
  \def\beamer@process@envbody{\frame}%
  \beamer@process@envbody%
}

% Normally not executed; only in containsverbatim context:
\def\endframe{\egroup\begingroup\def\@currenvir{frame}}

\long\def\beamer@push@begins#1\begin#2{\ifx\end#2\else b\expandafter\beamer@push@begins\fi}
\long\def\beamer@collect@@body#1\end#2{%
  \def\test{#1}%
  \edef\beamer@begin@stack{\beamer@push@begins#1\begin\end \expandafter\@gobble\beamer@begin@stack}%
  \ifx\@empty\beamer@begin@stack
      \global\beamer@envbody\expandafter{\the\beamer@envbody#1}%
    \def\reserved@a{#2}
    \ifx\reserved@a\beamer@frametext%
      \endgroup%
      \let\@next=\beamer@process@envbody % A little tricky! Note the grouping
      \@checkend{#2}%
    \else%
      % ok, just expand it, presumably it will generate the desired \end{frame}
      \let\@next=\beamer@process@expander%
    \fi
  \else
    \global\beamer@envbody\expandafter{\the\beamer@envbody#1\end{#2}}%
    \let\@next=\beamer@process@envbody%
  \fi
  \@next
}

\def\beamer@process@expander{%
  \def\beamer@begin@stack{b}%
  \expandafter\expandafter\expandafter\beamer@collect@@body\csname end\reserved@a\endcsname\endgroup}


\mode
<all>
{\def\beamer@frametext{frame}}

\def\frame{%
  \ifx\@currenvir\beamer@frametext%
    \gdef\beamer@frameoptions{}%
    \let\beamer@next=\beamer@copewithframeenv%
  \else%
    \let\beamer@next=\beamer@framecommand%
  \fi%
  \beamer@next}

\def\beamer@copewithframeenv{%
  \@ifnextchar<%
  {\beamer@@frameenvspec}%
  {%
    \@ifnextchar[%
    {\beamer@@frameenvopt}%
    {\expandafter\beamer@checkforverbatim\beamer@frameoptions containsverbatim\relax}}%
}
\def\beamer@@frameenvspec<#1>{%
  \expandafter\gdef\expandafter\beamer@frameoptions\expandafter{\beamer@frameoptions<#1>}%
  \beamer@copewithframeenv}
\def\beamer@@frameenvopt[#1]{%
  \expandafter\gdef\expandafter\beamer@frameoptions\expandafter{\beamer@frameoptions[#1]}%
  \beamer@copewithframeenv}

\def\beamer@checkforverbatim#1containsverbatim#2\relax{%
  \beamer@ifempty{#2}%
  {\beamer@checkforfragile#1fragile\relax}
  {% contains verbatim
    \endgroup% end environment
    \expandafter\beamer@framecommand\beamer@frameoptions\bgroup}%
}
\def\beamer@checkforfragile#1fragile#2\relax{%
  \beamer@ifempty{#2}%
  {\beamer@frameenv}% normal frame
  {% contains verbatim
    \endgroup% end environment
    \expandafter\beamer@framecommand\beamer@frameoptions\bgroup}%
}


% Check for old version:

\def\beamer@framecommand{%
  \edef\beamer@defaultospec{\beamer@gdefaultospec}%
  \@ifnextchar<\beamer@frame\beamer@checkoldframe}
\def\beamer@checkoldframe{\@ifnextchar[\beamer@@checkoldframe{\beamer@frame<*>}}
\def\beamer@@checkoldframe[{\@ifnextchar<{\beamer@frame<*>[}{\beamer@@@checkoldframe[}}
\def\beamer@@@checkoldframe[#1#2]{%
  \let\beamer@next=\beamer@newframesyntax%
  \ifcat#11% a number-like first letter in argument
    \let\beamer@next=\beamer@oldframesyntax%
  \else%
    \beamer@checkforcolon#2:.%
  \fi%
  \beamer@next{#1#2}}
\def\beamer@checkforcolon#1:#2.{%
  \beamer@ifempty{#2}{}{\let\beamer@next=\beamer@oldframesyntax}}
\def\beamer@newframesyntax#1{\beamer@@@frame<*>[#1]}
\def\beamer@oldframesyntax#1{\beamer@@@frame<#1>[]}

\def\beamer@framedefaultospec<#1>[#2]{%
  \def\beamer@defaultospec{#2}%
  \@ifnextchar[{\beamer@@@@frame<#1>}{\beamer@@@@frame<#1>[]}}

\newdimen\framewidth
\def\beamer@frame<#1>{
  \@ifnextchar[{\beamer@@@frame<#1>}{\beamer@@@frame<#1>[]}}
\def\beamer@@@frame<#1>[{\@ifnextchar<{\beamer@framedefaultospec<#1>[}{\beamer@@@@frame<#1>[}}
\def\beamer@@@@frame<#1>[#2]{%
  \framewidth\textwidth
  \beamer@savemode%
  \def\beamer@mode{\mode<all>}%
  \def\beamer@frametemplate{}%
  \def\beamer@againname{}%
  \def\beamer@undolabels{}%
  \def\beamer@cramped{}%
  \def\beamer@displaybreak{}%
  \setbox\beamer@footins=\box\voidb@x%
  \beamer@autobreakcount=0\relax%
  \beamer@autobreaklastheight=16000pt%
  \beamer@zoomcount=0\relax%
  \beamer@containsverbatimfalse%
  \beamer@isfragilefalse%
  \beamer@autobreakfalse%
  \beamer@shrinkfalse%
  \beamer@plainframefalse%
  \global\advance\beamer@zoomframecount by1\relax%
  \csname beamer@dosecondmode\beamer@defaultdosecondmode\endcsname%
  \ifbeamer@centered\setkeys{beamerframe}{c}\else\setkeys{beamerframe}{t}\fi%
  \setkeys{beamerframe}{environment=frame}%
  \setkeys{beamerframe}{#2}%
  \beamer@frametemplate%
  \ifbeamer@noframenumbering%
    \beamer@noframenumberingfalse%
  \else%
    \stepcounter{framenumber}%do not set \label here - it interferes with AtBegin*
  \fi%
  {\let\@elt\beamer@savecounter\beamer@overlaycounterresets}
  \gdef\beamer@framestartpage{}%
  \gdef\beamer@whichframes{#1}%
  \ifx\beamer@framerestriction\@undefined\else% restriction stuff
    \expandafter\beamer@checkifinlist\beamer@framerestriction\relax%
  \fi%
  \ifbeamer@inlecture%
  \else%
    \gdef\beamer@whichframes{all:0}%
  \fi%
  \ifx\beamer@againname\@empty%
    \beamer@slideinframe=0\relax%
    \beamer@anotherslidefalse%
    {\beamer@masterdecode{\beamer@whichframes}}%
    \ifbeamer@anotherslide%
%%       \beamer@slideinframe=2\relax%
%%       \def\beamer@doifnotinframe{}%
%%       \def\beamer@doifinframe{\let\beamer@howtotreatframe\beamer@doseveralframes}%
%%       \beamer@anotherslidefalse%
%%       {\beamer@masterdecode{\beamer@whichframes}}%
%%       \ifbeamer@anotherslide%
        \let\beamer@howtotreatframe\beamer@doseveralframes%
%%       \else% single slide in frame
%%         \let\beamer@howtotreatframe\beamer@dosingleframe%
%%       \fi%
%%       \beamer@donow%
      \ifbeamer@containsverbatim%
        \let\beamer@howtotreatframe\beamer@dosingleframe%
      \fi%
      \ifbeamer@autobreak%
        \let\beamer@howtotreatframe\beamer@autobreakframe%
      \fi%
      \ifbeamer@isfragile%
        \let\beamer@howtotreatframe\beamer@doexternalframe%
      \fi%
    \else% no slides in frame
      \let\beamer@howtotreatframe\beamer@donoframe%
    \fi%
  \else% again mode
    \let\beamer@howtotreatframe\beamer@doseveralframes%
    \ifbeamer@isfragile%
      \let\beamer@howtotreatframe\beamer@doexternalframe%
    \fi%
    \ifbeamer@containsverbatim
      \let\beamer@howtotreatframe\beamer@dosingleframe
    \fi
  \fi%
  \beamer@howtotreatframe}
\long\def\beamer@donoframe{%
  \beamer@slideinframe=1\relax%
  \setbox\beamer@tempbox\vbox\bgroup%
    \beamer@inframetrue%
    \leavevmode%
    \def\pause{}%
    \def\onslide{}%
    \afterassignment\beamer@checknoslide\let\beamer@next}
\def\beamer@checknoslide{%
  \ifcat\bgroup\noexpand\beamer@next%
    \let\beamer@do\relax%
    \aftergroup\beamer@reseteecodes%
  \else%
    \let\beamer@do\beamer@noframesingletoken%
  \fi%
  \beamer@do}
\def\beamer@noframesingletoken{\beamer@next\egroup\beamer@reseteecodes}

\long\def\beamer@doseveralframes#1{%
  \ifx\beamer@againname\@empty\else%
    % Again stuff
    \expandafter \gdef\csname beamer@again@\beamer@againname\endcsname{{#1}}%
  \fi%
  \beamer@slideinframe=1\relax%
  \loop%
  \beamer@anotherslidefalse%
  \def\beamer@doifnotinframe{}%
  \def\beamer@doifinframe{\begin{beamer@frameslide}%
    #1%
  \end{beamer@frameslide}}%
  {\beamer@masterdecode{\beamer@whichframes}}%
  \beamer@donow%
  \ifbeamer@twoscreenstext%
    \beamer@dosecondscreennow{#1}% two screen stuff
  \fi%
  \ifbeamer@anotherslide
  \advance\beamer@slideinframe by 1\relax
  \repeat%
  \beamer@writeslidentry%
  \beamer@reseteecodes}

\def\beamer@dosingleframe{%
  \beamer@slideinframe=1\relax%
  \begin{beamer@frameslide}\relax%
    \bgroup\aftergroup\beamer@endslide\afterassignment\beamer@checkslide\let\beamer@next}
\def\beamer@checkslide{%
  \ifcat\bgroup\noexpand\beamer@next%
  \let\beamer@do\beamer@checkframetitle%
  \else\let\beamer@do\beamer@singletoken\fi%
  \beamer@do}
\def\beamer@endslide{\end{beamer@frameslide}\beamer@writeslidentry\beamer@reseteecodes}
\def\beamer@singletoken{\beamer@next\egroup}

\def\beamer@doexternalframe{%
  \edef\beamer@verbfilename{\jobname\ifx\beamer@againname\@empty\else.\insertframenumber\fi.vrb}% .vrb for `verbatim'
  \beamer@setupstoppers{\beamer@frameenvironmentsubst}%
  \immediate\openout\beamer@verbatimfileout=\beamer@verbfilename%
  \expandafter\beamer@checktitleverbatim\@gobble}
\def\beamer@checktitleverbatim{\@ifnextchar\bgroup{\beamer@verbatim@frametitle}{\beamer@verbatimreadframe}}
\def\beamer@verbatim@frametitle#1{%
  \@ifnextchar\bgroup{\beamer@verbatim@framesubtitle{#1}}
  {%
    \@temptokena{#1}%
    \edef\@tempa{\string\frametitle\string{\the\@temptokena\string}}%
    \@temptokena\expandafter{\@tempa}%
    \immediate\write\beamer@verbatimfileout{\the\@temptokena}%
    \beamer@verbatimreadframe
  }%
}
\def\beamer@verbatim@framesubtitle#1#2{\beamer@verbatimreadframe\frametitle{#1}\framesubtitle{#2}}
% will return to following command with frame contents written to \beamer@verbfilename
\def\beamer@afterexternalframe{%
  \ifx\beamer@frameenvironmentsubst\beamer@frametext%
  \else%
    \immediate\write\beamer@verbatimfileout{\noexpand\beamerclosesubstitutedenvironement{\beamer@frameenvironmentsubst}}%
  \fi%
  \immediate\closeout\beamer@verbatimfileout%
  \expandafter\beamer@doframeinput\beamer@frameoptions\relax}

\def\beamer@doframeinput{\@ifnextchar<{\beamer@frameinput}{\beamer@frameinput<*>}}
\def\beamer@frameinput<#1>{\@ifnextchar[{\beamer@@frameinput<#1>}{\beamer@@frameinput<#1>[]}}
\def\beamer@@frameinput<#1>[{\@ifnextchar<{\beamer@@@@frameinput<#1>[}{\beamer@@@frameinput<#1>[<*>][}}
\def\beamer@@@@frameinput<#1>[#2]{\@ifnextchar[{\beamer@@@frameinput<#1>[{#2}]}{\beamer@@@frameinput<#1>[{#2}][]}}
\def\beamer@@@frameinput<#1>[#2][#3]{%
  \global\advance\c@framenumber by-1\relax%
  \edef\beamer@temp{\noexpand\frame<#1>[#2][{#3,fragile=false}]%
    {\begingroup\noexpand\input{\beamer@verbfilename}\endgroup}}%
  \beamer@temp%
  \ifx\beamer@frameenvironmentsubst\beamer@frametext%
  \else%
    \expandafter\endgroup%
  \fi%
  \beamer@reseteecodes}

\def\beamerclosesubstitutedenvironement#1{
  \let\end\beamer@specialend%
  \let\endframe\relax%
  \csname end#1\endcsname}

\def\beamer@writeslidentry{%
  \expandafter\beamer@ifempty\expandafter{\beamer@framestartpage}{}% does not happen normally
  {%else
    \addtocontents{nav}%
      {\protect\headcommand{%
          \protect\slideentry{\the\c@section}{\the\c@subsection}{\the\c@subsectionslide}%
          {\beamer@framestartpage/\beamer@frameendpage}{\lastsubsection}{\the\c@part}}}%
    \addtocontents{nav}%
      {\protect\headcommand{%
        \protect\beamer@framepages{\beamer@framestartpage}{\beamer@frameendpage}}}%
    \clearpage\beamer@notesactions%
  }
}
\def\beamer@reseteecodes{\gdef\beamer@entrycode{}\gdef\beamer@exitcode{}%
  \beamer@slideinframe=1\relax\beamer@resumemode}

\let\beamer@origend\end
\def\beamer@specialend#1{%
  \def\beamer@temp{#1}%
  \ifx\beamer@temp\beamer@frametext%
    \def\beamer@next{}%
  \else%
    \def\beamer@next{\expandafter\beamer@origend\expandafter{\beamer@temp}%
      \let\end\beamer@specialend%
      \let\endframe\relax%
    }
  \fi%
  \beamer@next}



%
% \includeonlyframes
%

\def\beamer@checkifinlist#1,#2\relax{%
  \def\beamer@temp{#1}%
  \ifx\beamer@temp\beamer@againname\else
    \def\beamer@temp{#2}%
    \ifx\beamer@temp\@empty
      \gdef\beamer@whichframes{all:0}%
    \else%
      \beamer@checkifinlist#2\relax%
    \fi%
  \fi%
}

\def\includeonlyframes#1{\def\beamer@framerestriction{#1,}}



%
% Frames in article mode
%

\mode
<article>
{
  \def\endframe{\egroup}

  \def\frame{\@ifnextchar<\beamer@frame{\beamer@frame<*>}}
  \def\beamer@frame<#1>{\@ifnextchar[{\beamer@@frame<#1>}{\beamer@@frame<#1>[]}}
  \long\def\beamer@@frame<#1>[#2]{%
    \global\let\insertframetitle=\@empty%
    \global\let\insertframesubtitle=\@empty%
    \beamer@slideinframe=1\relax%
    \refstepcounter{framenumber}%
    \beamer@slideinframe=0\relax%
    \beamer@anotherslidefalse%
    {\beamer@masterdecode{#1}}%
    \ifbeamer@anotherslide%
      \let\beamer@howtotreatframe\beamer@dosingleframe%
    \else% no slides in frame
      \let\beamer@howtotreatframe\beamer@donoframe%
    \fi%
    \beamer@slideinframe=1\relax%
    \beamer@howtotreatframe}

  \long\def\beamer@donoframe{%
    \setbox\beamer@tempbox\vbox\bgroup%
    \beamer@inframetrue%
    \let\frame=\framelatex
    \usebeamertemplate{frame begin}%
    \bgroup\aftergroup\beamer@endframe%
    \beamer@article@startframe}%
  \def\beamer@dosingleframe{%
    \bgroup%
    \beamer@inframetrue%
    \let\frame=\framelatex
    \usebeamertemplate{frame begin}%
    \bgroup\aftergroup\beamer@endframe%
    \beamer@article@startframe}%
  \def\beamer@endframe{%
    \usebeamertemplate{frame end}\egroup}

  \def\beamer@article@startframe{%
    \ifx\@currenvir\beamer@frametext%
      \let\beamer@next=\beamer@checkframetitle%
    \else%
      \let\beamer@next=\beamer@article@framecmd%
    \fi%
    \beamer@next}%

  \def\beamer@article@framecmd{%
    \afterassignment\beamer@checkframetitle
    \let\beamer@next=}

  \providecommand\includeonlyframes[1]{}% no effect
}


\mode
<all>
{
  \beamer@slideinframe=1\relax%
}



%
% Frame counter
%
\mode
<all>
{
  \newcounter{framenumber}
  \def\insertframenumber{\@arabic\c@framenumber}
}


%
% Pagebreak command
%
\mode
<all>
{
  \renewcommand<>{\pagebreak}[1][4]{\only#2{\beameroriginal\pagebreak[{#1}]}}
  \renewcommand<>{\nopagebreak}[1][4]{\only#2{\beameroriginal\nopagebreak[{#1}]}}
  \def\framebreak{\pagebreak<presentation>}
  \def\noframebreak{\nopagebreak<presentation>}
}


%
% Linebreak command
%
\renewcommand<>{\\}{\only#1{\beameroriginal\\}}
\renewcommand<>{\@centercr}{\only#1{\beameroriginal\@centercr}}
\renewcommand<>{\@normalcr}{\only#1{\beameroriginal\@normalcr}}

\mode
<article>
{
  \expandafter\let\expandafter\beamer@origbreak\expandafter=%
    \csname\expandafter\@gobble\string\\ \endcsname% evil trickery to add a space to the name
  \DeclareRobustCommand\\{\beamer@ifnextcharospec{\beamer@breaker}{\beamer@@breaker}}
  \def\beamer@breaker<#1>{\only<#1>{\beamer@origbreak}}
  \def\beamer@@breaker{\ifbeamer@inframe\else\expandafter\beamer@origbreak\fi}

  \let\beamer@origbreakcenter=\@centercr
  \def\@centercr{\beamer@ifnextcharospec{\beamer@breakercenter}{\beamer@@breakercenter}}
  \def\beamer@breakercenter<#1>{\only<#1>{\beamer@origbreakcenter}}
  \def\beamer@@breakercenter{\ifbeamer@inframe\else\expandafter\beamer@origbreakcenter\fi}
}



%
% Plain frames
%

\def\beamer@frametemplate@plain{%
  \def\beamer@entrycode{\vspace*{-\headheight}}%
  \def\beamer@exitcode{\vspace*{-\footheight}\thispagestyle{empty}}}


%
% Again frame
%

\def\againframe{\@ifnextchar<{\beamer@againframe}{\beamer@againframe<*>}}
\def\beamer@againframe<#1>{\@ifnextchar[{\beamer@@againframe<#1>}{\beamer@@againframe<#1>[]}}
\def\beamer@@againframe<#1>[{\@ifnextchar<{\beamer@@@@againframe<#1>[}{\beamer@@@againframe<#1>[<*>][}}
\def\beamer@@@@againframe<#1>[#2]{\@ifnextchar[{\beamer@@@againframe<#1>[{#2}]}{\beamer@@@againframe<#1>[{#2}][]}}
\def\beamer@@@againframe<#1>[#2][#3]#4{%
  \@ifundefined{beamer@again@#4}%
  {\ClassError{beamer}{No frame has been designated to resume under
      the name "#4"}{}}%
  {%
  \def\beamer@temp{\frame<#1>[#2][{#3,relabel=#4}]}%
  \expandafter\let\expandafter\beamer@templet\csname beamer@again@#4\endcsname%
  \expandafter\beamer@temp\beamer@templet}%
}

\mode
<article>
{
  \def\againframe{\@ifnextchar<{\beamer@againframe}{\beamer@againframe<>}}
  \def\beamer@againframe<#1>{\@ifnextchar[{\beamer@@againframe<#1>}{\beamer@@againframe<#1>[]}}
  \def\beamer@@againframe<#1>[{\@ifnextchar<{\beamer@@@@againframe<#1>[}{\beamer@@againframe<#1>[<*>][}}
  \def\beamer@@@@againframe<#1>[#2]{\@ifnextchar[{\beamer@@@againframe<#1>[{#2}]}{\beamer@@@againframe<#1>[{#2}][]}}
  \def\beamer@@@againframe<#1>[#2][#3]#4{} % do nothing
}


\mode
<all>