summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/beamer/base/beamerbasenavigation.sty
blob: 0ba8359d58737c1c291db2b813f5ac4a4484870f (plain)
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
% Copyright 2003--2007 by Till Tantau
% Copyright 2010 by Vedran Mileti\'c
% Copyright 2012--2015 by Vedran Mileti\'c, Joseph Wright
% Copyright 2017,2018 by Louis Stuart, Joseph Wright
% Copyright 2022 by Joseph Wright, samcarter
%
% 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 LICENSE.md for more details.

\mode
<presentation>

%
% Navigation buttons
%

% The following commands are called by the .nav file.
\def\beamer@framepages#1#2{%
  \ifnum\c@page<#1%
  \else%
    \ifnum\c@page>#2%
    \else%
      \gdef\beamer@startpageofframe{#1}%
      \gdef\beamer@endpageofframe{#2}%
    \fi%
  \fi%
}
\def\beamer@subsectionpages#1#2{%
  \ifnum\c@page<#1%
  \else%
    \ifnum\c@page>#2%
    \else%
      \gdef\beamer@startpageofsubsection{#1}%
      \gdef\beamer@endpageofsubsection{#2}%
    \fi%
  \fi%
}
\def\beamer@sectionpages#1#2{%
  \ifnum\c@page<#1%
  \else%
    \ifnum\c@page>#2%
    \else%
      \gdef\beamer@startpageofsection{#1}%
      \gdef\beamer@endpageofsection{#2}%
    \fi%
  \fi%
}
\def\beamer@partpages#1#2{%
  \ifnum\c@page<#1%
  \else%
    \ifnum\c@page>#2%
    \else%
      \gdef\beamer@startpageofpart{#1}%
      \gdef\beamer@endpageofpart{#2}%
    \fi%
  \fi%
}
\def\beamer@nextpage#1{%
  \beamer@tempcount=#1%
  \advance\beamer@tempcount by1\relax%
  \ifnum\beamer@tempcount>\beamer@endpageofdocument%
  \beamer@tempcount=\beamer@endpageofdocument%
  \fi}
\def\beamer@prevpage#1{%
  \beamer@tempcount=#1\relax%
  \ifnum\beamer@tempcount>1%
  \advance\beamer@tempcount by-1%
  \fi%
}

\def\hyperlinkslideprev{%
  \beamer@prevpage\c@page%
  \hyperlink{Navigation\the\beamer@tempcount}}
\def\hyperlinkslidenext{%
  \beamer@nextpage\c@page%
  \hyperlink{Navigation\the\beamer@tempcount}}
\def\hyperlinkframestart{\hyperlink{Navigation\beamer@startpageofframe}}
\def\hyperlinkframeend{\hyperlink{Navigation\beamer@endpageofframe}}
\def\hyperlinkframestartnext{%
  \beamer@nextpage\beamer@endpageofframe%
  \hyperlink{Navigation\the\beamer@tempcount}}
\def\hyperlinkframeendprev{%
  \beamer@prevpage\beamer@startpageofframe%
  \hyperlink{Navigation\the\beamer@tempcount}}

\def\hyperlinksubsectionstart{\hyperlink{Navigation\beamer@startpageofsubsection}}
\def\hyperlinksubsectionend{\hyperlink{Navigation\beamer@endpageofsubsection}}
\def\hyperlinksubsectionstartnext{%
  \beamer@nextpage\beamer@endpageofsubsection%
  \hyperlink{Navigation\the\beamer@tempcount}}
\def\hyperlinksubsectionendprev{%
  \beamer@prevpage\beamer@startpageofsubsection%
  \hyperlink{Navigation\the\beamer@tempcount}}

\def\hyperlinksectionstart{\hyperlink{Navigation\beamer@startpageofsection}}
\def\hyperlinksectionend{\hyperlink{Navigation\beamer@endpageofsection}}
\def\hyperlinksectionstartnext{%
  \beamer@nextpage\beamer@endpageofsection%
  \hyperlink{Navigation\the\beamer@tempcount}}
\def\hyperlinksectionendprev{%
  \beamer@prevpage\beamer@startpageofsection%
  \hyperlink{Navigation\the\beamer@tempcount}}

\def\hyperlinkpartstart{\hyperlink{Navigation\beamer@startpageofpart}}
\def\hyperlinkpartend{\hyperlink{Navigation\beamer@endpageofpart}}
\def\hyperlinkpartstartnext{%
  \beamer@nextpage\beamer@endpageofpart%
  \hyperlink{Navigation\the\beamer@tempcount}}
\def\hyperlinkpartendprev{%
  \beamer@prevpage\beamer@startpageofpart%
  \hyperlink{Navigation\the\beamer@tempcount}}

\def\hyperlinkpresentationstart{\hyperlink{Navigation1}}
\def\hyperlinkpresentationend{%
  \ifx\beamer@startpageofappendix\@empty%
  \beamer@tempcount=\beamer@endpageofdocument%
  \else%
  \beamer@prevpage\beamer@startpageofappendix%
  \fi%
  \hyperlink{Navigation\the\beamer@tempcount}}
\def\hyperlinkappendixstart{%
  \ifx\beamer@startpageofappendix\@empty%
  \beamer@tempcount=\beamer@endpageofdocument%
  \else%
  \beamer@tempcount=\beamer@startpageofappendix%
  \fi%
  \hyperlink{Navigation\the\beamer@tempcount}}
\def\hyperlinkappendixend{\hyperlink{Navigation\beamer@endpageofdocument}}

\def\hyperlinkdocumentstart{\hyperlink{Navigation1}}
\def\hyperlinkdocumentend{\hyperlink{Navigation\beamer@endpageofdocument}}

\mode
<article>
{
  \newcommand<>\hyperlinkslideprev[1]{}
  \newcommand<>\hyperlinkslidenext[1]{}

  \newcommand<>\hyperlinkframestart[1]{}
  \newcommand<>\hyperlinkframeend[1]{}
  \newcommand<>\hyperlinkframestartnext[1]{}
  \newcommand<>\hyperlinkframeendprev[1]{}

  \newcommand<>\hyperlinksubsectionstart[1]{}
  \newcommand<>\hyperlinksubsectionend[1]{}
  \newcommand<>\hyperlinksubsectionstartnext[1]{}
  \newcommand<>\hyperlinksubsectionendprev[1]{}

  \newcommand<>\hyperlinksectionstart[1]{}
  \newcommand<>\hyperlinksectionend[1]{}
  \newcommand<>\hyperlinksectionstartnext[1]{}
  \newcommand<>\hyperlinksectionendprev[1]{}

  \newcommand<>\hyperlinkpartstart[1]{}
  \newcommand<>\hyperlinkpartend[1]{}
  \newcommand<>\hyperlinkpartstartnext[1]{}
  \newcommand<>\hyperlinkpartendprev[1]{}

  \newcommand<>\hyperlinkpresentationstart[1]{}
  \newcommand<>\hyperlinkpresentationend[1]{}
  \newcommand<>\hyperlinkappendixstart[1]{}
  \newcommand<>\hyperlinkappendixend[1]{}

  \newcommand<>\hyperlinkdocumentstart[1]{}
  \newcommand<>\hyperlinkdocumentend[1]{}
}

\newcommand\insertframestartpage{\beamer@startpageofframe}
\newcommand\insertframeendpage{\beamer@endpageofframe}
\newcommand\insertsubsectionstartpage{\beamer@startpageofsubsection}
\newcommand\insertsubsectionendpage{\beamer@endpageofsubsection}
\newcommand\insertsectionstartpage{\beamer@startpageofsection}
\newcommand\insertsectionendpage{\beamer@endpageofsection}
\newcommand\insertpartstartpage{\beamer@startpageofpart}
\newcommand\insertpartendpage{\beamer@endpageofpart}
\newcommand\insertpresentationstartpage{1}
\newcommand\insertpresentationendpage{{%
  \ifx\beamer@startpageofappendix\@empty%
    \beamer@tempcount=\beamer@endpageofdocument\relax%
  \else%
    \beamer@prevpage\beamer@startpageofappendix\relax%
  \fi%
  \the\beamer@tempcount}}
\newcommand\insertappendixstartpage{{%
  \ifx\beamer@startpageofappendix\@empty%
    \beamer@tempcount=\beamer@endpageofdocument\relax%
  \else%
    \beamer@tempcount=\beamer@startpageofappendix\relax%
  \fi%
  \the\beamer@tempcount}}
\newcommand\insertappendixendpage{\beamer@endpageofdocument}
\newcommand\insertdocumentstartpage{1}
\newcommand\insertdocumentendpage{\beamer@endpageofdocument}


%
% Navigation Button Art
%

\def\beamer@linkspace#1{\vbox to7.5pt{}\kern#1}

% Due to what could be regarded as a bug in hyperref or DVIPDFm and
% derivatives, no links are made to empty boxes with XeTeX. This is
% fixed by drawing some 'real' content, which makes the PDF bigger!
\begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname XeTeXrevision\endcsname\relax
  \expandafter\@gobble
\else
  \expandafter\@firstofone
\fi
  {%
    \def\beamer@linkspace#1{%
      \@ifundefined{if@RTL}{%
        \special{dvipdfmx:catch_phantom true height 8pt depth 1.5pt}%
        \vbox to7.5pt{}\kern#1%
      }{%
        \if@RTL%
          \vbox to7.5pt{}\kern#1%
          \special{dvipdfmx:catch_phantom true height 8pt depth 1.5pt}%
        \else%
          \special{dvipdfmx:catch_phantom true height 8pt depth 1.5pt}%
          \vbox to7.5pt{}\kern#1%
        \fi%
      }%
    }%
  }

\input{beamerbasenavigationsymbols}

%
% User Buttons
%

\pgfdefobject{beamergotosymbol}{\pgfpoint{0pt}{-1pt}}{\pgfpoint{5pt}{5pt}}
{
  \pgfpathqmoveto{1.5bp}{0.5bp}
  \pgfpathqlineto{3.5bp}{2bp}
  \pgfpathqlineto{1.5bp}{3.5bp}
  \pgfusepathqfill
}

\def\insertgotosymbol{%
  \begin{pgfpicture}{1pt}{0pt}{6pt}{5pt}
    \pgfuseobject{beamergotosymbol}%
  \end{pgfpicture}}

\pgfdefobject{beamerskipsymbol}{\pgfpoint{0pt}{-1pt}}{\pgfpoint{7pt}{5pt}}
{
  \pgfpathqmoveto{1.5bp}{0.5bp}
  \pgfpathqlineto{3.5bp}{2bp}
  \pgfpathqlineto{1.5bp}{3.5bp}
  \pgfpathqmoveto{3.5bp}{0.5bp}
  \pgfpathqlineto{5.5bp}{2bp}
  \pgfpathqlineto{3.5bp}{3.5bp}
  \pgfusepathqfill
}

\def\insertskipsymbol{%
  \begin{pgfpicture}{1pt}{0pt}{8pt}{5pt}
    \pgfuseobject{beamerskipsymbol}%
  \end{pgfpicture}}


\pgfdefobject{beamerreturnsymbol}{\pgfpoint{0pt}{-1pt}}{\pgfpoint{5pt}{5pt}}
{
  \pgfpathqmoveto{3.5bp}{0.5bp}
  \pgfpathqlineto{1.5bp}{2bp}
  \pgfpathqlineto{3.5bp}{3.5bp}
  \pgfusepathqfill
}

\def\insertreturnsymbol{%
  \begin{pgfpicture}{1pt}{0pt}{6pt}{5pt}
    \pgfuseobject{beamerreturnsymbol}%
  \end{pgfpicture}}


\def\beamerbutton#1{\def\insertbuttontext{#1}\usebeamertemplate**{button}}
\def\beamergotobutton#1{\beamerbutton{\insertgotosymbol#1}}
\def\beamerskipbutton#1{\beamerbutton{\insertskipsymbol#1}}
\def\beamerreturnbutton#1{\beamerbutton{\insertreturnsymbol#1}}

\mode
<article>
{
  \let\beamerbutton=\@firstofone
  \let\beamergotobutton=\beamerbutton
  \let\beamerskipbutton=\beamerbutton
  \let\beamerreturnbutton=\beamerbutton
}


%
% Inserting navigation bars
%

\newdimen\beamer@section@min@dim
\newcommand*{\beamer@section@set@min@width}{%
  \ifdim\wd\beamer@sectionbox>\beamer@section@min@dim
  \else
    \setbox\beamer@sectionbox=\hbox to \beamer@section@min@dim
      {\box\beamer@sectionbox\hfil}%
    \global\beamer@section@min@dim\z@
  \fi
}

\def\insertnavigation#1{%
  \vbox{{%
    \usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}%
    \beamer@xpos=0\relax%
    \beamer@ypos=1\relax%
    \beamer@ypos@offset=0\relax%
    \hbox to #1{\hskip.3cm\setbox\beamer@sectionbox=\hbox{\kern1sp}%
      \ht\beamer@sectionbox=1.875ex%
      \dp\beamer@sectionbox=0.75ex%
        \hskip-1.875ex plus-1fill%
        \global\beamer@section@min@dim\z@
        \dohead%
        \beamer@section@set@min@width
      \box\beamer@sectionbox\hfil\hskip.3cm}%
  }}}

\def\sectionentry#1#2#3#4#5{% section number, section title, page
  \beamer@xpos=0\relax%
  \beamer@ypos=1\relax%
  \beamer@ypos@offset=0\relax%
  \ifnum#5=\c@part%
  \beamer@section@set@min@width%
  \box\beamer@sectionbox\hskip1.875ex plus 1fill%
  \setbox\beamer@sectionbox=
  \hbox{\def\insertsectionhead{#2}%
    \def\insertsectionheadnumber{#1}%
    \def\insertpartheadnumber{#5}%
    {%
      \usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}%
      \ifnum\c@section=#1%
        \hyperlink{Navigation#3}{{\usebeamertemplate{section in head/foot}}}%
      \else%
        \hyperlink{Navigation#3}{{\usebeamertemplate{section in head/foot shaded}}}%
      \fi}%
  }%
  \ht\beamer@sectionbox=1.875ex%
  \dp\beamer@sectionbox=0.75ex%
  \fi\ignorespaces}

\def\beamer@nav@subsectionstyle#1{\beamer@toc@sprocess\beamer@nav@css\beamer@nav@oss\beamer@nav@ooss#1///}
\beamer@nav@subsectionstyle{show}

\def\beamer@subsectionentry#1#2#3#4#5{}% no effect by default.
\def\beamer@subsubsectionentry#1#2#3#4#5#6{}% no effect by default.

\def\insertverticalnavigation#1{%
  \vbox{%
    \def\sectionentry##1##2##3##4##5{%
      \ifnum##5=\c@part%
      \def\insertsectionhead{##2}%
      \def\insertsectionheadnumber{##1}%
      \def\insertpartheadnumber{##5}%
      \hbox to #1{{%
        \usebeamerfont{section in sidebar}\usebeamercolor[fg]{section in sidebar}%
          \hyperlink{Navigation##3}{%
          \ifnum\c@section=##1%
            \ifnum\c@subsection=0\relax%
              {\usebeamertemplate{section in sidebar}}%
            \else%
              \ifx\beamer@nav@css\beamer@hidetext%
                {\usebeamertemplate{section in sidebar}}%
              \else%
                {\usebeamertemplate{section in sidebar shaded}}%
              \fi%
            \fi%
          \else
            {\usebeamertemplate{section in sidebar shaded}}%
          \fi}}}%
      \beamer@currentsubsection=0\relax\fi}%
    \def\slideentry##1##2##3##4##5##6{}%
    \def\beamer@subsectionentry##1##2##3##4##5{%
      \ifnum##1=\c@part%
      \def\insertpartheadnumber{##1}%
      \def\insertsectionheadnumber{##2}%
      \def\insertsubsectionheadnumber{##3}%
      \def\insertsubsectionhead{##5}%
       \beamer@tocifnothide{\ifnum\c@section=##2\ifnum\c@subsection=##3\beamer@nav@css\else\beamer@nav@oss\fi\else\beamer@nav@ooss\fi}%
      {\hbox{{%
        \usebeamerfont{subsection in sidebar}\usebeamercolor[fg]{subsection in sidebar}%
          \hyperlink{Navigation##4}{%
          \ifnum\c@section=##2%
            \ifnum\c@subsection=##3%
              \ifnum\c@subsubsection=0\relax%
                {\usebeamertemplate{subsection in sidebar}}%
              \else%
                {\usebeamertemplate{subsection in sidebar shaded}}%
              \fi%
            \else%
              {\usebeamertemplate{subsection in sidebar shaded}}%
            \fi%
          \else%
            {\usebeamertemplate{subsection in sidebar shaded}}%
          \fi}}}%
      }%
      \fi}%
    \def\beamer@subsubsectionentry##1##2##3##4##5##6{%
      \ifnum##1=\c@part%
      \def\insertpartheadnumber{##1}%
      \def\insertsectionheadnumber{##2}%
      \def\insertsubsectionheadnumber{##3}%
      \def\insertsubsubsectionheadnumber{##4}%
      \def\insertsubsubsectionhead{##6}%
      \beamer@tocifnothide{\ifnum\c@section=##2\ifnum\c@subsection=##3\ifnum\c@subsubsection=##4\beamer@nav@css\else\beamer@nav@oss\fi\else\beamer@nav@ooss\fi\else\beamer@nav@ooss\fi}%
      {\hbox{{%
        \usebeamerfont{subsubsection in sidebar}\usebeamercolor[fg]{subsubsection in sidebar}%
          \hyperlink{Navigation##5}{%
          \ifnum\c@section=##2%
            \ifnum\c@subsection=##3%
              \ifnum\c@subsubsection=##4%
                {\usebeamertemplate{subsubsection in sidebar}}%
              \else
                {\usebeamertemplate{subsubsection in sidebar shaded}}%
              \fi%
            \else%
              {\usebeamertemplate{subsubsection in sidebar shaded}}%
            \fi%
          \else%
            {\usebeamertemplate{subsubsection in sidebar shaded}}%
          \fi}}}%
      }%
      \fi}%
    %\beamer@currentsubsection=0\relax%
    \dohead%
  }%
}

\def\slideentry#1#2#3#4#5#6{%
  %section number, subsection number, slide number, first/last frame, page number, part number
  \ifnum#6=\c@part\ifnum#1>0\ifnum#3>0%
    \ifbeamer@compress%
      \advance\beamer@xpos by1\relax%
    \else%
      \ifnum#2=0%
        \beamer@ypos@offset=1\relax%
      \fi
      \beamer@xpos=#3\relax%
      \beamer@ypos=#2\relax%
      \advance\beamer@ypos by \beamer@ypos@offset\relax
    \fi%
  \hbox to 0pt{%
    \beamer@tempdim=-\beamer@vboxoffset%
    \advance\beamer@tempdim by-\beamer@boxsize%
    \multiply\beamer@tempdim by\beamer@ypos%
    \advance\beamer@tempdim by -.05cm%
    \raise\beamer@tempdim\hbox{%
      \beamer@tempdim=\beamer@boxsize%
      \multiply\beamer@tempdim by\beamer@xpos%
      \advance\beamer@tempdim by -\beamer@boxsize%
      \advance\beamer@tempdim by 1pt%
      \kern\beamer@tempdim
      \global\beamer@section@min@dim\beamer@tempdim
      \hbox{\beamer@link(#4){%
          \usebeamerfont{mini frame}%
          \ifnum\c@section=#1%
            \ifnum\c@subsection=#2%
              \usebeamercolor[fg]{mini frame}%
              \ifnum\c@subsectionslide=#3%
                \usebeamertemplate{mini frame}%\beamer@minislidehilight%
              \else%
                \usebeamertemplate{mini frame in current subsection}%\beamer@minisliderowhilight%
              \fi%
            \else%
              \usebeamercolor{mini frame}%
              %\color{fg!50!bg}%
              \usebeamertemplate{mini frame in other subsection}%\beamer@minislide%
            \fi%
          \else%
            \usebeamercolor{mini frame}%
            %\color{fg!50!bg}%
            \usebeamertemplate{mini frame in other subsection}%\beamer@minislide%
          \fi%
        }}}\hskip-10cm plus 1fil%
  }\fi\fi%
  \else%
  \fakeslideentry{#1}{#2}{#3}{#4}{#5}{#6}%
  \fi\ignorespaces
  }

\def\fakeslideentry#1#2#3#4#5#6{%
  \ifnum#1>0\ifnum#3>0%
    \ifbeamer@compress%
      \advance\beamer@xpos by1\relax%
    \else%
      \ifnum#2=0%
        \beamer@ypos@offset=1\relax%
      \fi
      \beamer@xpos=#3\relax%
      \beamer@ypos=#2\relax%
      \advance\beamer@ypos by \beamer@ypos@offset\relax
    \fi%
  \hbox to 0pt{\beamer@tempdim=-\beamer@vboxoffset%
    \advance\beamer@tempdim by -\beamer@boxsize%
    \multiply\beamer@tempdim by\beamer@ypos%
    \advance\beamer@tempdim by -.05cm%
    \raise\beamer@tempdim\hbox{}}\fi\fi\ignorespaces}


\def\beamer@link(#1/#2){%
  \def\beamer@goto{{Navigation#1}}% default: first slide of frame
  \ifnum\c@page<#2%
  \ifnum\c@page<#1\else% go to last slide of frame, on all slides of
                                % the frame, except for the last one
  \def\beamer@goto{{Navigation#2}}% jump to last slide of frame
  \fi\fi%
  \expandafter\hyperlink\beamer@goto}

\define@key{beamer@margin}{mini frame size}{\beamer@boxsize=#1}
\define@key{beamer@margin}{mini frame offset}{\beamer@vboxoffset=#1}

\def\insertsectionnavigation#1{%
  \hbox to #1{%
    \vbox{{\usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}%
     \vskip0.5625ex%
     \def\slideentry##1##2##3##4##5##6{}%
     \def\sectionentry##1##2##3##4##5{%
       \ifnum##5=\c@part%
       \def\insertsectionhead{##2}%
       \def\insertsectionheadnumber{##1}%
       \def\insertpartheadnumber{##5}%
       \setbox\beamer@tempbox=\hbox{%
         \hyperlink{Navigation##3}{\hbox to #1{%
             \hskip0.3cm%
             \ifnum\c@section=##1%
               {\usebeamertemplate{section in head/foot}}%
             \else%
               {\usebeamertemplate{section in head/foot shaded}}%
             \fi\hskip0.3cm}}}%
       \ht\beamer@tempbox=1.6875ex\dp\beamer@tempbox=0.75ex%
       \box\beamer@tempbox\fi}%
     \dohead\vskip0.5625ex}}\hfil}}

\def\insertsectionnavigationhorizontal#1#2#3{%
  \hbox to #1{{%
     \def\slideentry##1##2##3##4##5##6{}%
     #2\hskip.3cm%
     \usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}%
     \setbox\beamer@sectionbox=\hbox{}%
     \ht\beamer@sectionbox=1.875ex%
     \dp\beamer@sectionbox=0.75ex%
     \hskip-1.875ex plus-1fill\dohead%
     \box\beamer@sectionbox\hfil\hskip.3cm%
     #3}}}

\def\insertsubsectionnavigation#1{%
  \hbox to #1{%
    \vbox{{%
      \usebeamerfont{subsection in head/foot}\usebeamercolor[fg]{subsection in head/foot}%
      \vskip0.5625ex%
      \beamer@currentsubsection=0%
      \def\sectionentry##1##2##3##4##5{}%
      \def\slideentry##1##2##3##4##5##6{\ifnum##6=\c@part\ifnum##1=\c@section%
        \ifnum##2>\beamer@currentsubsection%
        \beamer@currentsubsection=##2%
        \def\insertsubsectionhead{##5}%
        \def\insertsectionheadnumber{##1}%
        \def\insertsubsectionheadnumber{##2}%
        \def\insertpartheadnumber{##6}%
        \setbox\beamer@tempbox=\hbox{\beamer@link(##4){%
            \hbox to #1{\hskip0.3cm%
              \ifnum\c@subsection=##2%
                {\usebeamertemplate{subsection in head/foot}}%
              \else%
                {\usebeamertemplate{subsection in head/foot shaded}}%
              \fi\hfil\hskip0.3cm}}}%
        \ht\beamer@tempbox=1.6875ex\dp\beamer@tempbox=0.75ex%
        \box\beamer@tempbox\fi\fi\fi}%
      \dohead\vskip0.5625ex}}\hfil}}

\def\insertsubsectionnavigationhorizontal#1#2#3{%
  \hbox to #1{{%
    \usebeamerfont{subsection in head/foot}\usebeamercolor[fg]{subsection in head/foot}%
    \beamer@currentsubsection=0%
    \def\sectionentry##1##2##3##4##5{}%
    \def\slideentry##1##2##3##4##5##6{\ifnum##6=\c@part\ifnum##1=\c@section%
      \ifnum##2>\beamer@currentsubsection%
      \beamer@currentsubsection=##2%
      \box\beamer@sectionbox\hskip1.875ex plus1fill%
      \setbox\beamer@sectionbox=
      \hbox{\def\insertsubsectionhead{##5}%
         \def\insertsectionheadnumber{##1}%
         \def\insertsubsectionheadnumber{##2}%
         \def\insertpartheadnumber{##6}%
         \ifnum\c@subsection=##2%
        \beamer@link(##4){{\usebeamertemplate{subsection in head/foot}}}\else%
        \beamer@link(##4){{\usebeamertemplate{subsection in head/foot shaded}}}\fi}%
      \ht\beamer@sectionbox=1.875ex%
      \dp\beamer@sectionbox=0.75ex%
      \fi\fi\fi\ignorespaces}%
    #2\hskip.3cm\setbox\beamer@sectionbox=\hbox{}%
    \hskip-1.875ex plus-1fill\dohead%
    \box\beamer@sectionbox\hfil\hskip.3cm%
    #3}}}



%
% Name slides
%

\def\beamer@inserttarget#1{%
  \ifbeamer@inframe%
    \ifvmode%
      \nointerlineskip\vbox to0pt{#1}%
    \else%
      \hbox{#1}%
    \fi%
  \else% defer to next frame
    \expandafter\gdef\expandafter\beamer@framehypertargets\expandafter{\beamer@framehypertargets#1}%
  \fi%
}


\def\beamer@nameslide#1{%
  \addtocontents{snm}{\protect\beamer@slide{#1}{\the\c@page}}%
  \beamer@inserttarget{\hypertarget{#1}{}}}
\def\beamer@dummynameslide{\beamer@inserttarget{}}

\def\beamer@slide#1#2{\expandafter\def\csname beamer@hyperlink#1\endcsname{%
  \hyperlink{Navigation#2}}}

\let\beamer@framehypertargets\@empty

% 
% Page anchors
%

% This code is copied from hyperref, which doesn't activate this part with
% option "implicit = false" set. Things are much simplified as we already
% know that anchors are required and what to use for them.

\def\Hy@EveryPageAnchor{%
  \Hy@DistillerDestFix
  \vbox to 0pt{%
    \kern\voffset
    \kern\topmargin
    \kern-1bp\relax
    \hbox to 0pt{%
      \kern\hoffset
      \kern\ifodd\value{page}%
        \oddsidemargin
      \else
        \evensidemargin
      \fi
      \kern-1bp\relax
      \hyper@@anchor{Navigation\the\c@page}\relax%
      \hyper@@anchor{page.\the\c@page}\relax%
      \hss
      }%
    \vss
  }%
}

\AtBeginShipout{%
  \setbox\AtBeginShipoutBox=\vbox{%
    \offinterlineskip
    \Hy@EveryPageAnchor
    \box\AtBeginShipoutBox
  }%
}

\providecommand*{\Hy@DistillerDestFix}{}

\mode
<all>